skedyul 0.2.136 → 0.2.137
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/.build-stamp +1 -1
- package/dist/errors.d.ts +77 -0
- package/dist/errors.js +99 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8 -1
- package/dist/server.js +29 -6
- package/package.json +1 -1
package/dist/.build-stamp
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
1770183335160
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error types for install handlers.
|
|
3
|
+
*
|
|
4
|
+
* These errors can be thrown by install handlers to indicate specific failure modes.
|
|
5
|
+
* The server will recognize these errors and return structured error responses
|
|
6
|
+
* that the frontend can display inline on the install form.
|
|
7
|
+
*/
|
|
8
|
+
export type InstallErrorCode = 'MISSING_REQUIRED_FIELD' | 'AUTHENTICATION_FAILED' | 'INVALID_CONFIGURATION' | 'CONNECTION_FAILED';
|
|
9
|
+
/**
|
|
10
|
+
* Base error class for install handler errors.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* throw new InstallError('Something went wrong', 'INVALID_CONFIGURATION')
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare class InstallError extends Error {
|
|
18
|
+
code: InstallErrorCode;
|
|
19
|
+
field?: string;
|
|
20
|
+
constructor(message: string, code: InstallErrorCode, field?: string);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Error thrown when a required field is missing.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* if (!ctx.env.API_KEY) {
|
|
28
|
+
* throw new MissingRequiredFieldError('API_KEY')
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare class MissingRequiredFieldError extends InstallError {
|
|
33
|
+
constructor(fieldName: string, message?: string);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Error thrown when authentication/credential verification fails.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* try {
|
|
41
|
+
* await apiClient.verifyCredentials()
|
|
42
|
+
* } catch (error) {
|
|
43
|
+
* throw new AuthenticationError('Invalid API credentials. Please check your username and password.')
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare class AuthenticationError extends InstallError {
|
|
48
|
+
constructor(message?: string);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Error thrown when the configuration is invalid.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* if (!isValidUrl(ctx.env.API_URL)) {
|
|
56
|
+
* throw new InvalidConfigurationError('API_URL', 'Invalid URL format')
|
|
57
|
+
* }
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare class InvalidConfigurationError extends InstallError {
|
|
61
|
+
constructor(fieldName?: string, message?: string);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Error thrown when a connection to an external service fails.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```typescript
|
|
68
|
+
* try {
|
|
69
|
+
* await fetch(apiUrl)
|
|
70
|
+
* } catch (error) {
|
|
71
|
+
* throw new ConnectionError('Unable to connect to the API server. Please check the URL.')
|
|
72
|
+
* }
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare class ConnectionError extends InstallError {
|
|
76
|
+
constructor(message?: string);
|
|
77
|
+
}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Error types for install handlers.
|
|
4
|
+
*
|
|
5
|
+
* These errors can be thrown by install handlers to indicate specific failure modes.
|
|
6
|
+
* The server will recognize these errors and return structured error responses
|
|
7
|
+
* that the frontend can display inline on the install form.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ConnectionError = exports.InvalidConfigurationError = exports.AuthenticationError = exports.MissingRequiredFieldError = exports.InstallError = void 0;
|
|
11
|
+
/**
|
|
12
|
+
* Base error class for install handler errors.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* throw new InstallError('Something went wrong', 'INVALID_CONFIGURATION')
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
class InstallError extends Error {
|
|
20
|
+
constructor(message, code, field) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.name = 'InstallError';
|
|
23
|
+
this.code = code;
|
|
24
|
+
this.field = field;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.InstallError = InstallError;
|
|
28
|
+
/**
|
|
29
|
+
* Error thrown when a required field is missing.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* if (!ctx.env.API_KEY) {
|
|
34
|
+
* throw new MissingRequiredFieldError('API_KEY')
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
class MissingRequiredFieldError extends InstallError {
|
|
39
|
+
constructor(fieldName, message) {
|
|
40
|
+
super(message ?? `${fieldName} is required`, 'MISSING_REQUIRED_FIELD', fieldName);
|
|
41
|
+
this.name = 'MissingRequiredFieldError';
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.MissingRequiredFieldError = MissingRequiredFieldError;
|
|
45
|
+
/**
|
|
46
|
+
* Error thrown when authentication/credential verification fails.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* try {
|
|
51
|
+
* await apiClient.verifyCredentials()
|
|
52
|
+
* } catch (error) {
|
|
53
|
+
* throw new AuthenticationError('Invalid API credentials. Please check your username and password.')
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
class AuthenticationError extends InstallError {
|
|
58
|
+
constructor(message) {
|
|
59
|
+
super(message ?? 'Authentication failed', 'AUTHENTICATION_FAILED');
|
|
60
|
+
this.name = 'AuthenticationError';
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.AuthenticationError = AuthenticationError;
|
|
64
|
+
/**
|
|
65
|
+
* Error thrown when the configuration is invalid.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* if (!isValidUrl(ctx.env.API_URL)) {
|
|
70
|
+
* throw new InvalidConfigurationError('API_URL', 'Invalid URL format')
|
|
71
|
+
* }
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
class InvalidConfigurationError extends InstallError {
|
|
75
|
+
constructor(fieldName, message) {
|
|
76
|
+
super(message ?? 'Invalid configuration', 'INVALID_CONFIGURATION', fieldName);
|
|
77
|
+
this.name = 'InvalidConfigurationError';
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
exports.InvalidConfigurationError = InvalidConfigurationError;
|
|
81
|
+
/**
|
|
82
|
+
* Error thrown when a connection to an external service fails.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* try {
|
|
87
|
+
* await fetch(apiUrl)
|
|
88
|
+
* } catch (error) {
|
|
89
|
+
* throw new ConnectionError('Unable to connect to the API server. Please check the URL.')
|
|
90
|
+
* }
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
class ConnectionError extends InstallError {
|
|
94
|
+
constructor(message) {
|
|
95
|
+
super(message ?? 'Connection failed', 'CONNECTION_FAILED');
|
|
96
|
+
this.name = 'ConnectionError';
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.ConnectionError = ConnectionError;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export * from './types';
|
|
|
3
3
|
export * from './schemas';
|
|
4
4
|
export { server } from './server';
|
|
5
5
|
export { DEFAULT_DOCKERFILE } from './dockerfile';
|
|
6
|
+
export { InstallError, MissingRequiredFieldError, AuthenticationError, InvalidConfigurationError, ConnectionError, } from './errors';
|
|
7
|
+
export type { InstallErrorCode } from './errors';
|
|
6
8
|
export { z };
|
|
7
9
|
export { workplace, communicationChannel, instance, token, file, webhook, resource, contactAssociationLink, configure, getConfig, runWithConfig, } from './core/client';
|
|
8
10
|
export type { InstanceContext, InstanceData, InstanceMeta, InstancePagination, InstanceListResult, InstanceListArgs, FileUrlResponse, FileUploadParams, FileUploadResult, WebhookCreateResult, WebhookListItem, WebhookDeleteByNameOptions, WebhookListOptions, ResourceLinkParams, ResourceLinkResult, ContactAssociationLinkCreateParams, ContactAssociationLinkCreateResult, } from './core/client';
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.getRequiredInstallEnvKeys = exports.getAllEnvKeys = exports.CONFIG_FILE_NAMES = exports.validateConfig = exports.loadConfig = exports.defineConfig = exports.runWithConfig = exports.getConfig = exports.configure = exports.contactAssociationLink = exports.resource = exports.webhook = exports.file = exports.token = exports.instance = exports.communicationChannel = exports.workplace = exports.z = exports.DEFAULT_DOCKERFILE = exports.server = void 0;
|
|
17
|
+
exports.getRequiredInstallEnvKeys = exports.getAllEnvKeys = exports.CONFIG_FILE_NAMES = exports.validateConfig = exports.loadConfig = exports.defineConfig = exports.runWithConfig = exports.getConfig = exports.configure = exports.contactAssociationLink = exports.resource = exports.webhook = exports.file = exports.token = exports.instance = exports.communicationChannel = exports.workplace = exports.z = exports.ConnectionError = exports.InvalidConfigurationError = exports.AuthenticationError = exports.MissingRequiredFieldError = exports.InstallError = exports.DEFAULT_DOCKERFILE = exports.server = void 0;
|
|
18
18
|
const zod_1 = require("zod");
|
|
19
19
|
Object.defineProperty(exports, "z", { enumerable: true, get: function () { return zod_1.z; } });
|
|
20
20
|
__exportStar(require("./types"), exports);
|
|
@@ -23,6 +23,13 @@ var server_1 = require("./server");
|
|
|
23
23
|
Object.defineProperty(exports, "server", { enumerable: true, get: function () { return server_1.server; } });
|
|
24
24
|
var dockerfile_1 = require("./dockerfile");
|
|
25
25
|
Object.defineProperty(exports, "DEFAULT_DOCKERFILE", { enumerable: true, get: function () { return dockerfile_1.DEFAULT_DOCKERFILE; } });
|
|
26
|
+
// Install handler errors
|
|
27
|
+
var errors_1 = require("./errors");
|
|
28
|
+
Object.defineProperty(exports, "InstallError", { enumerable: true, get: function () { return errors_1.InstallError; } });
|
|
29
|
+
Object.defineProperty(exports, "MissingRequiredFieldError", { enumerable: true, get: function () { return errors_1.MissingRequiredFieldError; } });
|
|
30
|
+
Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: function () { return errors_1.AuthenticationError; } });
|
|
31
|
+
Object.defineProperty(exports, "InvalidConfigurationError", { enumerable: true, get: function () { return errors_1.InvalidConfigurationError; } });
|
|
32
|
+
Object.defineProperty(exports, "ConnectionError", { enumerable: true, get: function () { return errors_1.ConnectionError; } });
|
|
26
33
|
var client_1 = require("./core/client");
|
|
27
34
|
Object.defineProperty(exports, "workplace", { enumerable: true, get: function () { return client_1.workplace; } });
|
|
28
35
|
Object.defineProperty(exports, "communicationChannel", { enumerable: true, get: function () { return client_1.communicationChannel; } });
|
package/dist/server.js
CHANGED
|
@@ -44,6 +44,7 @@ const streamableHttp_js_1 = require("@modelcontextprotocol/sdk/server/streamable
|
|
|
44
44
|
const z = __importStar(require("zod"));
|
|
45
45
|
const service_1 = require("./core/service");
|
|
46
46
|
const client_1 = require("./core/client");
|
|
47
|
+
const errors_1 = require("./errors");
|
|
47
48
|
function normalizeBilling(billing) {
|
|
48
49
|
if (!billing || typeof billing.credits !== 'number') {
|
|
49
50
|
return { credits: 0 };
|
|
@@ -906,12 +907,24 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
|
|
|
906
907
|
});
|
|
907
908
|
}
|
|
908
909
|
catch (err) {
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
910
|
+
// Check for typed install errors
|
|
911
|
+
if (err instanceof errors_1.InstallError) {
|
|
912
|
+
sendJSON(res, 400, {
|
|
913
|
+
error: {
|
|
914
|
+
code: err.code,
|
|
915
|
+
message: err.message,
|
|
916
|
+
field: err.field,
|
|
917
|
+
},
|
|
918
|
+
});
|
|
919
|
+
}
|
|
920
|
+
else {
|
|
921
|
+
sendJSON(res, 500, {
|
|
922
|
+
error: {
|
|
923
|
+
code: -32603,
|
|
924
|
+
message: err instanceof Error ? err.message : String(err ?? ''),
|
|
925
|
+
},
|
|
926
|
+
});
|
|
927
|
+
}
|
|
915
928
|
}
|
|
916
929
|
return;
|
|
917
930
|
}
|
|
@@ -1423,6 +1436,16 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer, reg
|
|
|
1423
1436
|
return createResponse(200, { env: result.env ?? {}, redirect: result.redirect }, headers);
|
|
1424
1437
|
}
|
|
1425
1438
|
catch (err) {
|
|
1439
|
+
// Check for typed install errors
|
|
1440
|
+
if (err instanceof errors_1.InstallError) {
|
|
1441
|
+
return createResponse(400, {
|
|
1442
|
+
error: {
|
|
1443
|
+
code: err.code,
|
|
1444
|
+
message: err.message,
|
|
1445
|
+
field: err.field,
|
|
1446
|
+
},
|
|
1447
|
+
}, headers);
|
|
1448
|
+
}
|
|
1426
1449
|
return createResponse(500, {
|
|
1427
1450
|
error: {
|
|
1428
1451
|
code: -32603,
|