@morphllm/morphsdk 0.2.93 → 0.2.94
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/dist/{chunk-IJ54DTJ3.js → chunk-4WO7PJNT.js} +11 -11
- package/dist/{chunk-EYGBUH2R.js → chunk-AV6YV2MH.js} +2 -2
- package/dist/{chunk-LMUZ3NGC.js → chunk-BVVDDTI7.js} +2 -2
- package/dist/chunk-ESRZJRTQ.js +359 -0
- package/dist/chunk-ESRZJRTQ.js.map +1 -0
- package/dist/{chunk-GU6DACME.js → chunk-FIA6LBW2.js} +2 -2
- package/dist/{chunk-4WLGDYWQ.js → chunk-FMWNVTJJ.js} +2 -2
- package/dist/{chunk-PBLPZ6AU.js → chunk-IH3KN4AT.js} +2 -2
- package/dist/{chunk-MIIJWDOQ.js → chunk-M7GFXRKL.js} +13 -3
- package/dist/chunk-M7GFXRKL.js.map +1 -0
- package/dist/{chunk-4KMBU6T3.js → chunk-R7WN43L2.js} +4 -4
- package/dist/{chunk-PUGIOVSP.js → chunk-TXYCM4NP.js} +2 -2
- package/dist/chunk-UJ7LVT5G.js +177 -0
- package/dist/chunk-UJ7LVT5G.js.map +1 -0
- package/dist/{chunk-FNLNDMIX.js → chunk-WSQMWVSD.js} +2 -2
- package/dist/chunk-YJ354BA2.js +46 -0
- package/dist/chunk-YJ354BA2.js.map +1 -0
- package/dist/client.cjs +546 -4
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +2 -0
- package/dist/client.js +12 -9
- package/dist/index.cjs +546 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +12 -9
- package/dist/tools/browser/anthropic.cjs +5 -1
- package/dist/tools/browser/anthropic.cjs.map +1 -1
- package/dist/tools/browser/anthropic.js +5 -2
- package/dist/tools/browser/core.cjs +544 -2
- package/dist/tools/browser/core.cjs.map +1 -1
- package/dist/tools/browser/core.d.ts +6 -0
- package/dist/tools/browser/core.js +4 -1
- package/dist/tools/browser/errors.cjs +208 -0
- package/dist/tools/browser/errors.cjs.map +1 -0
- package/dist/tools/browser/errors.d.ts +158 -0
- package/dist/tools/browser/errors.js +22 -0
- package/dist/tools/browser/errors.js.map +1 -0
- package/dist/tools/browser/index.cjs +562 -2
- package/dist/tools/browser/index.cjs.map +1 -1
- package/dist/tools/browser/index.d.ts +3 -0
- package/dist/tools/browser/index.js +27 -4
- package/dist/tools/browser/index.js.map +1 -1
- package/dist/tools/browser/openai.cjs +5 -1
- package/dist/tools/browser/openai.cjs.map +1 -1
- package/dist/tools/browser/openai.js +5 -2
- package/dist/tools/browser/profiles/core.cjs +639 -0
- package/dist/tools/browser/profiles/core.cjs.map +1 -0
- package/dist/tools/browser/profiles/core.d.ts +179 -0
- package/dist/tools/browser/profiles/core.js +27 -0
- package/dist/tools/browser/profiles/core.js.map +1 -0
- package/dist/tools/browser/profiles/index.cjs +639 -0
- package/dist/tools/browser/profiles/index.cjs.map +1 -0
- package/dist/tools/browser/profiles/index.d.ts +4 -0
- package/dist/tools/browser/profiles/index.js +27 -0
- package/dist/tools/browser/profiles/index.js.map +1 -0
- package/dist/tools/browser/profiles/types.cjs +74 -0
- package/dist/tools/browser/profiles/types.cjs.map +1 -0
- package/dist/tools/browser/profiles/types.d.ts +176 -0
- package/dist/tools/browser/profiles/types.js +16 -0
- package/dist/tools/browser/profiles/types.js.map +1 -0
- package/dist/tools/browser/types.cjs.map +1 -1
- package/dist/tools/browser/types.d.ts +2 -0
- package/dist/tools/browser/vercel.cjs +5 -1
- package/dist/tools/browser/vercel.cjs.map +1 -1
- package/dist/tools/browser/vercel.js +5 -2
- package/dist/tools/fastapply/index.js +3 -3
- package/dist/tools/index.js +3 -3
- package/dist/tools/warp_grep/anthropic.js +4 -4
- package/dist/tools/warp_grep/client.js +3 -3
- package/dist/tools/warp_grep/gemini.js +3 -3
- package/dist/tools/warp_grep/harness.js +2 -2
- package/dist/tools/warp_grep/index.js +3 -3
- package/dist/tools/warp_grep/openai.js +4 -4
- package/dist/tools/warp_grep/providers/local.js +2 -2
- package/dist/tools/warp_grep/vercel.js +4 -4
- package/package.json +7 -2
- package/dist/chunk-MIIJWDOQ.js.map +0 -1
- /package/dist/{chunk-IJ54DTJ3.js.map → chunk-4WO7PJNT.js.map} +0 -0
- /package/dist/{chunk-EYGBUH2R.js.map → chunk-AV6YV2MH.js.map} +0 -0
- /package/dist/{chunk-LMUZ3NGC.js.map → chunk-BVVDDTI7.js.map} +0 -0
- /package/dist/{chunk-GU6DACME.js.map → chunk-FIA6LBW2.js.map} +0 -0
- /package/dist/{chunk-4WLGDYWQ.js.map → chunk-FMWNVTJJ.js.map} +0 -0
- /package/dist/{chunk-PBLPZ6AU.js.map → chunk-IH3KN4AT.js.map} +0 -0
- /package/dist/{chunk-4KMBU6T3.js.map → chunk-R7WN43L2.js.map} +0 -0
- /package/dist/{chunk-PUGIOVSP.js.map → chunk-TXYCM4NP.js.map} +0 -0
- /package/dist/{chunk-FNLNDMIX.js.map → chunk-WSQMWVSD.js.map} +0 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom error classes for browser automation and profiles.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* try {
|
|
7
|
+
* await morph.browser.profiles.createProfile({ name: '', repoId: '...' });
|
|
8
|
+
* } catch (e) {
|
|
9
|
+
* if (e instanceof MorphValidationError) {
|
|
10
|
+
* console.log('Validation failed:', e.field, e.message);
|
|
11
|
+
* } else if (e instanceof MorphAPIError) {
|
|
12
|
+
* console.log('API error:', e.code, e.statusCode);
|
|
13
|
+
* }
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Error codes for Morph Browser SDK
|
|
19
|
+
*/
|
|
20
|
+
type MorphErrorCode = 'validation_error' | 'invalid_parameter' | 'missing_required_field' | 'authentication_required' | 'invalid_api_key' | 'insufficient_permissions' | 'profile_not_found' | 'session_not_found' | 'resource_not_found' | 'profile_limit_exceeded' | 'rate_limit_exceeded' | 'session_expired' | 'session_save_failed' | 'network_error' | 'timeout' | 'service_unavailable';
|
|
21
|
+
/**
|
|
22
|
+
* Base error class for all Morph SDK errors.
|
|
23
|
+
*/
|
|
24
|
+
declare class MorphError extends Error {
|
|
25
|
+
/** Error code for programmatic handling */
|
|
26
|
+
readonly code: MorphErrorCode;
|
|
27
|
+
/** Original cause of the error, if any */
|
|
28
|
+
readonly cause?: Error;
|
|
29
|
+
constructor(message: string, code: MorphErrorCode, cause?: Error);
|
|
30
|
+
/**
|
|
31
|
+
* Returns a JSON representation of the error for logging.
|
|
32
|
+
*/
|
|
33
|
+
toJSON(): {
|
|
34
|
+
name: string;
|
|
35
|
+
message: string;
|
|
36
|
+
code: MorphErrorCode;
|
|
37
|
+
cause: string | undefined;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Error thrown when API request validation fails.
|
|
42
|
+
*/
|
|
43
|
+
declare class MorphValidationError extends MorphError {
|
|
44
|
+
/** The field that failed validation */
|
|
45
|
+
readonly field?: string;
|
|
46
|
+
constructor(message: string, field?: string);
|
|
47
|
+
toJSON(): {
|
|
48
|
+
field: string | undefined;
|
|
49
|
+
name: string;
|
|
50
|
+
message: string;
|
|
51
|
+
code: MorphErrorCode;
|
|
52
|
+
cause: string | undefined;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Error thrown when an API request fails.
|
|
57
|
+
*/
|
|
58
|
+
declare class MorphAPIError extends MorphError {
|
|
59
|
+
/** HTTP status code */
|
|
60
|
+
readonly statusCode: number;
|
|
61
|
+
/** Request ID for debugging (if available) */
|
|
62
|
+
readonly requestId?: string;
|
|
63
|
+
/** Raw response body */
|
|
64
|
+
readonly rawResponse?: string;
|
|
65
|
+
constructor(message: string, code: MorphErrorCode, statusCode: number, options?: {
|
|
66
|
+
requestId?: string;
|
|
67
|
+
rawResponse?: string;
|
|
68
|
+
cause?: Error;
|
|
69
|
+
});
|
|
70
|
+
toJSON(): {
|
|
71
|
+
statusCode: number;
|
|
72
|
+
requestId: string | undefined;
|
|
73
|
+
name: string;
|
|
74
|
+
message: string;
|
|
75
|
+
code: MorphErrorCode;
|
|
76
|
+
cause: string | undefined;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Error thrown when authentication fails.
|
|
81
|
+
*/
|
|
82
|
+
declare class MorphAuthenticationError extends MorphAPIError {
|
|
83
|
+
constructor(message?: string);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Error thrown when rate limit is exceeded.
|
|
87
|
+
*/
|
|
88
|
+
declare class MorphRateLimitError extends MorphAPIError {
|
|
89
|
+
/** When the rate limit resets (Unix timestamp) */
|
|
90
|
+
readonly resetAt?: number;
|
|
91
|
+
/** Number of seconds until reset */
|
|
92
|
+
readonly retryAfter?: number;
|
|
93
|
+
constructor(message?: string, options?: {
|
|
94
|
+
resetAt?: number;
|
|
95
|
+
retryAfter?: number;
|
|
96
|
+
requestId?: string;
|
|
97
|
+
});
|
|
98
|
+
toJSON(): {
|
|
99
|
+
resetAt: number | undefined;
|
|
100
|
+
retryAfter: number | undefined;
|
|
101
|
+
statusCode: number;
|
|
102
|
+
requestId: string | undefined;
|
|
103
|
+
name: string;
|
|
104
|
+
message: string;
|
|
105
|
+
code: MorphErrorCode;
|
|
106
|
+
cause: string | undefined;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Error thrown when a resource is not found.
|
|
111
|
+
*/
|
|
112
|
+
declare class MorphNotFoundError extends MorphAPIError {
|
|
113
|
+
/** The type of resource that was not found */
|
|
114
|
+
readonly resourceType: string;
|
|
115
|
+
/** The ID of the resource that was not found */
|
|
116
|
+
readonly resourceId?: string;
|
|
117
|
+
constructor(resourceType: string, resourceId?: string);
|
|
118
|
+
toJSON(): {
|
|
119
|
+
resourceType: string;
|
|
120
|
+
resourceId: string | undefined;
|
|
121
|
+
statusCode: number;
|
|
122
|
+
requestId: string | undefined;
|
|
123
|
+
name: string;
|
|
124
|
+
message: string;
|
|
125
|
+
code: MorphErrorCode;
|
|
126
|
+
cause: string | undefined;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Error thrown when profile limit is exceeded.
|
|
131
|
+
*/
|
|
132
|
+
declare class MorphProfileLimitError extends MorphAPIError {
|
|
133
|
+
/** Current number of profiles */
|
|
134
|
+
readonly currentCount?: number;
|
|
135
|
+
/** Maximum allowed profiles for the plan */
|
|
136
|
+
readonly maxAllowed?: number;
|
|
137
|
+
constructor(message?: string, options?: {
|
|
138
|
+
currentCount?: number;
|
|
139
|
+
maxAllowed?: number;
|
|
140
|
+
requestId?: string;
|
|
141
|
+
});
|
|
142
|
+
toJSON(): {
|
|
143
|
+
currentCount: number | undefined;
|
|
144
|
+
maxAllowed: number | undefined;
|
|
145
|
+
statusCode: number;
|
|
146
|
+
requestId: string | undefined;
|
|
147
|
+
name: string;
|
|
148
|
+
message: string;
|
|
149
|
+
code: MorphErrorCode;
|
|
150
|
+
cause: string | undefined;
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Parse an API error response and return the appropriate error class.
|
|
155
|
+
*/
|
|
156
|
+
declare function parseAPIError(statusCode: number, responseText: string, requestId?: string): MorphAPIError;
|
|
157
|
+
|
|
158
|
+
export { MorphAPIError, MorphAuthenticationError, MorphError, type MorphErrorCode, MorphNotFoundError, MorphProfileLimitError, MorphRateLimitError, MorphValidationError, parseAPIError };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MorphAPIError,
|
|
3
|
+
MorphAuthenticationError,
|
|
4
|
+
MorphError,
|
|
5
|
+
MorphNotFoundError,
|
|
6
|
+
MorphProfileLimitError,
|
|
7
|
+
MorphRateLimitError,
|
|
8
|
+
MorphValidationError,
|
|
9
|
+
parseAPIError
|
|
10
|
+
} from "../../chunk-UJ7LVT5G.js";
|
|
11
|
+
import "../../chunk-PZ5AY32C.js";
|
|
12
|
+
export {
|
|
13
|
+
MorphAPIError,
|
|
14
|
+
MorphAuthenticationError,
|
|
15
|
+
MorphError,
|
|
16
|
+
MorphNotFoundError,
|
|
17
|
+
MorphProfileLimitError,
|
|
18
|
+
MorphRateLimitError,
|
|
19
|
+
MorphValidationError,
|
|
20
|
+
parseAPIError
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|