@gala-chain/launchpad-sdk 3.12.1 → 3.12.3
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 +37 -0
- package/dist/LaunchpadSDK.d.ts +8 -0
- package/dist/LaunchpadSDK.d.ts.map +1 -1
- package/dist/constants/version.d.ts +2 -0
- package/dist/constants/version.d.ts.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/schemas/files.d.ts +79 -16
- package/dist/schemas/files.d.ts.map +1 -1
- package/dist/utils/multipart.d.ts.map +1 -1
- package/package.json +5 -3
package/dist/schemas/files.d.ts
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
* File Upload Zod Schemas
|
|
3
3
|
*
|
|
4
4
|
* Validation schemas for file uploads (images, documents).
|
|
5
|
-
*
|
|
5
|
+
* Uses lazy evaluation to support both browser (File) and Node.js (Buffer) environments.
|
|
6
|
+
*
|
|
7
|
+
* IMPORTANT: Browser File class doesn't exist in Node.js, so we use lazy factory functions
|
|
8
|
+
* that only construct schemas at runtime after environment detection.
|
|
6
9
|
*/
|
|
7
10
|
import { z } from 'zod';
|
|
8
11
|
/**
|
|
@@ -10,12 +13,26 @@ import { z } from 'zod';
|
|
|
10
13
|
*/
|
|
11
14
|
export declare const IMAGE_EXTENSIONS: readonly [".png", ".jpg", ".jpeg", ".gif", ".webp", ".svg"];
|
|
12
15
|
/**
|
|
13
|
-
*
|
|
16
|
+
* Node.js Buffer validation
|
|
17
|
+
* For server-side file uploads
|
|
18
|
+
*/
|
|
19
|
+
export declare const bufferFileSchema: z.ZodEffects<z.ZodType<Buffer<ArrayBufferLike>, z.ZodTypeDef, Buffer<ArrayBufferLike>>, Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>;
|
|
20
|
+
/**
|
|
21
|
+
* Browser File object validation (lazy)
|
|
22
|
+
* For client-side file uploads
|
|
23
|
+
*/
|
|
24
|
+
export declare function getBrowserFileSchema(): z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodType<File, z.ZodTypeDef, File>, File, File>, File, File>, File, File> | null;
|
|
25
|
+
/**
|
|
26
|
+
* Flexible file schema - accepts File (browser) or Buffer (Node.js) (lazy)
|
|
27
|
+
*/
|
|
28
|
+
export declare function getFlexibleFileSchema(): z.ZodEffects<z.ZodType<Buffer<ArrayBufferLike>, z.ZodTypeDef, Buffer<ArrayBufferLike>>, Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>> | z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodType<File, z.ZodTypeDef, File>, File, File>, File, File>, File, File>, z.ZodEffects<z.ZodType<Buffer<ArrayBufferLike>, z.ZodTypeDef, Buffer<ArrayBufferLike>>, Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>]>;
|
|
29
|
+
/**
|
|
30
|
+
* File upload validation schema (lazy)
|
|
14
31
|
* Validates file size, type, and filename
|
|
15
32
|
*/
|
|
16
|
-
export declare
|
|
33
|
+
export declare function getFileUploadSchema(): z.ZodObject<{
|
|
17
34
|
/** File object (browser File or Node.js Buffer) */
|
|
18
|
-
file: z.ZodUnion<[z.ZodType<File, z.ZodTypeDef, File>, z.ZodType<Buffer<ArrayBufferLike>, z.ZodTypeDef, Buffer<ArrayBufferLike>>]>;
|
|
35
|
+
file: z.ZodType<Buffer<ArrayBufferLike>, z.ZodTypeDef, Buffer<ArrayBufferLike>> | z.ZodUnion<[z.ZodType<File, z.ZodTypeDef, File>, z.ZodType<Buffer<ArrayBufferLike>, z.ZodTypeDef, Buffer<ArrayBufferLike>>]>;
|
|
19
36
|
/** Filename with extension */
|
|
20
37
|
name: z.ZodString;
|
|
21
38
|
/** File size in bytes */
|
|
@@ -34,19 +51,45 @@ export declare const fileUploadSchema: z.ZodObject<{
|
|
|
34
51
|
size: number;
|
|
35
52
|
}>;
|
|
36
53
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
54
|
+
* Legacy exports for backward compatibility
|
|
55
|
+
* These reference the lazy getters to avoid File references at module load time
|
|
39
56
|
*/
|
|
40
|
-
export declare const browserFileSchema:
|
|
57
|
+
export declare const browserFileSchema: {
|
|
58
|
+
safeParse: (data: unknown) => z.SafeParseSuccess<File> | z.SafeParseError<File> | {
|
|
59
|
+
success: boolean;
|
|
60
|
+
error: Error;
|
|
61
|
+
};
|
|
62
|
+
parse: (data: unknown) => File;
|
|
63
|
+
};
|
|
41
64
|
/**
|
|
42
|
-
*
|
|
43
|
-
* For server-side file uploads
|
|
65
|
+
* Legacy export for backward compatibility
|
|
44
66
|
*/
|
|
45
|
-
export declare const
|
|
67
|
+
export declare const flexibleFileSchema: {
|
|
68
|
+
safeParse: (data: unknown) => z.SafeParseSuccess<File | Buffer<ArrayBufferLike>> | z.SafeParseError<File | Buffer<ArrayBufferLike>>;
|
|
69
|
+
parse: (data: unknown) => File | Buffer<ArrayBufferLike>;
|
|
70
|
+
};
|
|
46
71
|
/**
|
|
47
|
-
*
|
|
72
|
+
* Legacy export for backward compatibility
|
|
48
73
|
*/
|
|
49
|
-
export declare const
|
|
74
|
+
export declare const fileUploadSchema: {
|
|
75
|
+
safeParse: (data: unknown) => z.SafeParseReturnType<{
|
|
76
|
+
type: "image/png" | "image/jpg" | "image/jpeg" | "image/gif" | "image/webp" | "image/svg+xml";
|
|
77
|
+
name: string;
|
|
78
|
+
file: File | Buffer<ArrayBufferLike>;
|
|
79
|
+
size: number;
|
|
80
|
+
}, {
|
|
81
|
+
type: "image/png" | "image/jpg" | "image/jpeg" | "image/gif" | "image/webp" | "image/svg+xml";
|
|
82
|
+
name: string;
|
|
83
|
+
file: File | Buffer<ArrayBufferLike>;
|
|
84
|
+
size: number;
|
|
85
|
+
}>;
|
|
86
|
+
parse: (data: unknown) => {
|
|
87
|
+
type: "image/png" | "image/jpg" | "image/jpeg" | "image/gif" | "image/webp" | "image/svg+xml";
|
|
88
|
+
name: string;
|
|
89
|
+
file: File | Buffer<ArrayBufferLike>;
|
|
90
|
+
size: number;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
50
93
|
/**
|
|
51
94
|
* Image extension schema
|
|
52
95
|
*/
|
|
@@ -55,9 +98,29 @@ export declare const imageExtensionSchema: z.ZodEnum<[".png", ".jpg", ".jpeg", "
|
|
|
55
98
|
* Validate filename has allowed image extension
|
|
56
99
|
*/
|
|
57
100
|
export declare const imageFilenameSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
export type
|
|
101
|
+
/**
|
|
102
|
+
* Type for file upload objects with file, name, size, and type properties
|
|
103
|
+
*/
|
|
104
|
+
export type FileUpload = {
|
|
105
|
+
file: File | Buffer;
|
|
106
|
+
name: string;
|
|
107
|
+
size: number;
|
|
108
|
+
type: string;
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Type for browser File objects
|
|
112
|
+
*/
|
|
113
|
+
export type BrowserFile = File;
|
|
114
|
+
/**
|
|
115
|
+
* Type for Node.js Buffer objects used as files
|
|
116
|
+
*/
|
|
117
|
+
export type BufferFile = Buffer;
|
|
118
|
+
/**
|
|
119
|
+
* Type for flexible file objects (either File or Buffer)
|
|
120
|
+
*/
|
|
121
|
+
export type FlexibleFile = File | Buffer;
|
|
122
|
+
/**
|
|
123
|
+
* Type for allowed image extensions
|
|
124
|
+
*/
|
|
62
125
|
export type ImageExtension = z.infer<typeof imageExtensionSchema>;
|
|
63
126
|
//# sourceMappingURL=files.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/schemas/files.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/schemas/files.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC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AAM,EAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CA0CnD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAwB9C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAM3C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gala-chain/launchpad-sdk",
|
|
3
|
-
"version": "3.12.
|
|
3
|
+
"version": "3.12.3",
|
|
4
4
|
"description": "TypeScript SDK for Gala Launchpad Backend API - Production-ready DeFi token launchpad integration with wallet-based authentication, GalaChain trading, and comprehensive user operations. 100% tested (22/22 endpoints working).",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -36,12 +36,14 @@
|
|
|
36
36
|
"test:watch": "jest --watch",
|
|
37
37
|
"test:coverage": "jest --coverage",
|
|
38
38
|
"test:ci": "jest --coverage --ci --watchAll=false",
|
|
39
|
+
"test:cjs": "tsx scripts/test-cjs.ts",
|
|
40
|
+
"test:cjs:integration": "tsx scripts/test-cjs-integration.ts",
|
|
39
41
|
"demo": "tsx examples/complete-sdk-demo.ts",
|
|
40
42
|
"demo-trades": "tsx examples/demo-trades.ts",
|
|
41
43
|
"demo-cache": "tsx examples/demo-cache.ts",
|
|
42
44
|
"demo-fetch-all-pools": "tsx examples/demo-fetch-all-pools.ts",
|
|
43
|
-
"lint": "eslint src tests --ext .ts,.tsx --fix",
|
|
44
|
-
"lint:check": "eslint src tests --ext .ts,.tsx",
|
|
45
|
+
"lint": "eslint src tests scripts --ext .ts,.tsx --fix",
|
|
46
|
+
"lint:check": "eslint src tests scripts --ext .ts,.tsx",
|
|
45
47
|
"typecheck": "tsc --noEmit",
|
|
46
48
|
"typecheck:watch": "tsc --noEmit --watch",
|
|
47
49
|
"format": "prettier --write \"src/**/*.{ts,tsx,json,md}\"",
|