@forumviriumhelsinki/podio-mcp 2.3.0

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 (197) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +491 -0
  3. package/build/__tests__/integration/setup.integration.d.ts +104 -0
  4. package/build/__tests__/integration/setup.integration.d.ts.map +1 -0
  5. package/build/__tests__/integration/setup.integration.js +233 -0
  6. package/build/__tests__/integration/setup.integration.js.map +1 -0
  7. package/build/__tests__/mock-data/items-mock-data.d.ts +168 -0
  8. package/build/__tests__/mock-data/items-mock-data.d.ts.map +1 -0
  9. package/build/__tests__/mock-data/items-mock-data.js +370 -0
  10. package/build/__tests__/mock-data/items-mock-data.js.map +1 -0
  11. package/build/__tests__/mock-data/notification-mock-data.d.ts +55 -0
  12. package/build/__tests__/mock-data/notification-mock-data.d.ts.map +1 -0
  13. package/build/__tests__/mock-data/notification-mock-data.js +190 -0
  14. package/build/__tests__/mock-data/notification-mock-data.js.map +1 -0
  15. package/build/__tests__/mock-data/project-epic-mock-data.d.ts +45 -0
  16. package/build/__tests__/mock-data/project-epic-mock-data.d.ts.map +1 -0
  17. package/build/__tests__/mock-data/project-epic-mock-data.js +85 -0
  18. package/build/__tests__/mock-data/project-epic-mock-data.js.map +1 -0
  19. package/build/__tests__/mock-data/tasks-mock-data.d.ts +27 -0
  20. package/build/__tests__/mock-data/tasks-mock-data.d.ts.map +1 -0
  21. package/build/__tests__/mock-data/tasks-mock-data.js +104 -0
  22. package/build/__tests__/mock-data/tasks-mock-data.js.map +1 -0
  23. package/build/__tests__/mock-data/utility-mock-data.d.ts +19 -0
  24. package/build/__tests__/mock-data/utility-mock-data.d.ts.map +1 -0
  25. package/build/__tests__/mock-data/utility-mock-data.js +165 -0
  26. package/build/__tests__/mock-data/utility-mock-data.js.map +1 -0
  27. package/build/__tests__/setup.d.ts +8 -0
  28. package/build/__tests__/setup.d.ts.map +1 -0
  29. package/build/__tests__/setup.js +31 -0
  30. package/build/__tests__/setup.js.map +1 -0
  31. package/build/__tests__/utils/test-helpers.d.ts +110 -0
  32. package/build/__tests__/utils/test-helpers.d.ts.map +1 -0
  33. package/build/__tests__/utils/test-helpers.js +222 -0
  34. package/build/__tests__/utils/test-helpers.js.map +1 -0
  35. package/build/api/podio-api-client.d.ts +364 -0
  36. package/build/api/podio-api-client.d.ts.map +1 -0
  37. package/build/api/podio-api-client.js +696 -0
  38. package/build/api/podio-api-client.js.map +1 -0
  39. package/build/cache/app-cache.d.ts +77 -0
  40. package/build/cache/app-cache.d.ts.map +1 -0
  41. package/build/cache/app-cache.js +230 -0
  42. package/build/cache/app-cache.js.map +1 -0
  43. package/build/cache/base-cache-manager.d.ts +149 -0
  44. package/build/cache/base-cache-manager.d.ts.map +1 -0
  45. package/build/cache/base-cache-manager.js +312 -0
  46. package/build/cache/base-cache-manager.js.map +1 -0
  47. package/build/cache/cache-manager.d.ts +230 -0
  48. package/build/cache/cache-manager.d.ts.map +1 -0
  49. package/build/cache/cache-manager.js +362 -0
  50. package/build/cache/cache-manager.js.map +1 -0
  51. package/build/cache/cache-test.d.ts +9 -0
  52. package/build/cache/cache-test.d.ts.map +1 -0
  53. package/build/cache/cache-test.js +169 -0
  54. package/build/cache/cache-test.js.map +1 -0
  55. package/build/cache/index.d.ts +18 -0
  56. package/build/cache/index.d.ts.map +1 -0
  57. package/build/cache/index.js +20 -0
  58. package/build/cache/index.js.map +1 -0
  59. package/build/cache/migration-helper.d.ts +44 -0
  60. package/build/cache/migration-helper.d.ts.map +1 -0
  61. package/build/cache/migration-helper.js +235 -0
  62. package/build/cache/migration-helper.js.map +1 -0
  63. package/build/cache/project-epic-cache.d.ts +108 -0
  64. package/build/cache/project-epic-cache.d.ts.map +1 -0
  65. package/build/cache/project-epic-cache.js +278 -0
  66. package/build/cache/project-epic-cache.js.map +1 -0
  67. package/build/cache/space-members-cache.d.ts +99 -0
  68. package/build/cache/space-members-cache.d.ts.map +1 -0
  69. package/build/cache/space-members-cache.js +305 -0
  70. package/build/cache/space-members-cache.js.map +1 -0
  71. package/build/cache/storage-adapters.d.ts +100 -0
  72. package/build/cache/storage-adapters.d.ts.map +1 -0
  73. package/build/cache/storage-adapters.js +297 -0
  74. package/build/cache/storage-adapters.js.map +1 -0
  75. package/build/errors/api-errors.d.ts +52 -0
  76. package/build/errors/api-errors.d.ts.map +1 -0
  77. package/build/errors/api-errors.js +86 -0
  78. package/build/errors/api-errors.js.map +1 -0
  79. package/build/errors/auth-errors.d.ts +67 -0
  80. package/build/errors/auth-errors.d.ts.map +1 -0
  81. package/build/errors/auth-errors.js +114 -0
  82. package/build/errors/auth-errors.js.map +1 -0
  83. package/build/errors/base.d.ts +102 -0
  84. package/build/errors/base.d.ts.map +1 -0
  85. package/build/errors/base.js +131 -0
  86. package/build/errors/base.js.map +1 -0
  87. package/build/errors/cache-errors.d.ts +53 -0
  88. package/build/errors/cache-errors.d.ts.map +1 -0
  89. package/build/errors/cache-errors.js +83 -0
  90. package/build/errors/cache-errors.js.map +1 -0
  91. package/build/errors/config-errors.d.ts +58 -0
  92. package/build/errors/config-errors.d.ts.map +1 -0
  93. package/build/errors/config-errors.js +96 -0
  94. package/build/errors/config-errors.js.map +1 -0
  95. package/build/errors/index.d.ts +101 -0
  96. package/build/errors/index.d.ts.map +1 -0
  97. package/build/errors/index.js +135 -0
  98. package/build/errors/index.js.map +1 -0
  99. package/build/errors/structure-errors.d.ts +89 -0
  100. package/build/errors/structure-errors.d.ts.map +1 -0
  101. package/build/errors/structure-errors.js +182 -0
  102. package/build/errors/structure-errors.js.map +1 -0
  103. package/build/errors/validation-errors.d.ts +81 -0
  104. package/build/errors/validation-errors.d.ts.map +1 -0
  105. package/build/errors/validation-errors.js +169 -0
  106. package/build/errors/validation-errors.js.map +1 -0
  107. package/build/fields/field-mapper.d.ts +245 -0
  108. package/build/fields/field-mapper.d.ts.map +1 -0
  109. package/build/fields/field-mapper.js +404 -0
  110. package/build/fields/field-mapper.js.map +1 -0
  111. package/build/index.d.ts +550 -0
  112. package/build/index.d.ts.map +1 -0
  113. package/build/index.js +1527 -0
  114. package/build/index.js.map +1 -0
  115. package/build/oauth-helper.d.ts +189 -0
  116. package/build/oauth-helper.d.ts.map +1 -0
  117. package/build/oauth-helper.js +422 -0
  118. package/build/oauth-helper.js.map +1 -0
  119. package/build/services/app-structure-service.d.ts +49 -0
  120. package/build/services/app-structure-service.d.ts.map +1 -0
  121. package/build/services/app-structure-service.js +122 -0
  122. package/build/services/app-structure-service.js.map +1 -0
  123. package/build/services/code-execution-service.d.ts +88 -0
  124. package/build/services/code-execution-service.d.ts.map +1 -0
  125. package/build/services/code-execution-service.js +342 -0
  126. package/build/services/code-execution-service.js.map +1 -0
  127. package/build/services/comment-service.d.ts +66 -0
  128. package/build/services/comment-service.d.ts.map +1 -0
  129. package/build/services/comment-service.js +139 -0
  130. package/build/services/comment-service.js.map +1 -0
  131. package/build/services/index.d.ts +16 -0
  132. package/build/services/index.d.ts.map +1 -0
  133. package/build/services/index.js +15 -0
  134. package/build/services/index.js.map +1 -0
  135. package/build/services/item-service.d.ts +104 -0
  136. package/build/services/item-service.d.ts.map +1 -0
  137. package/build/services/item-service.js +368 -0
  138. package/build/services/item-service.js.map +1 -0
  139. package/build/services/notification-service.d.ts +125 -0
  140. package/build/services/notification-service.d.ts.map +1 -0
  141. package/build/services/notification-service.js +321 -0
  142. package/build/services/notification-service.js.map +1 -0
  143. package/build/services/project-epic-service.d.ts +73 -0
  144. package/build/services/project-epic-service.d.ts.map +1 -0
  145. package/build/services/project-epic-service.js +248 -0
  146. package/build/services/project-epic-service.js.map +1 -0
  147. package/build/services/response-formatter.d.ts +190 -0
  148. package/build/services/response-formatter.d.ts.map +1 -0
  149. package/build/services/response-formatter.js +1221 -0
  150. package/build/services/response-formatter.js.map +1 -0
  151. package/build/services/search-service.d.ts +103 -0
  152. package/build/services/search-service.d.ts.map +1 -0
  153. package/build/services/search-service.js +273 -0
  154. package/build/services/search-service.js.map +1 -0
  155. package/build/services/task-service.d.ts +70 -0
  156. package/build/services/task-service.d.ts.map +1 -0
  157. package/build/services/task-service.js +156 -0
  158. package/build/services/task-service.js.map +1 -0
  159. package/build/tools/index.d.ts +8 -0
  160. package/build/tools/index.d.ts.map +1 -0
  161. package/build/tools/index.js +8 -0
  162. package/build/tools/index.js.map +1 -0
  163. package/build/tools/tool-definitions.d.ts +89 -0
  164. package/build/tools/tool-definitions.d.ts.map +1 -0
  165. package/build/tools/tool-definitions.js +1167 -0
  166. package/build/tools/tool-definitions.js.map +1 -0
  167. package/build/types/api-types.d.ts +106 -0
  168. package/build/types/api-types.d.ts.map +1 -0
  169. package/build/types/api-types.js +11 -0
  170. package/build/types/api-types.js.map +1 -0
  171. package/build/types/cache-types.d.ts +52 -0
  172. package/build/types/cache-types.d.ts.map +1 -0
  173. package/build/types/cache-types.js +12 -0
  174. package/build/types/cache-types.js.map +1 -0
  175. package/build/types/index.d.ts +31 -0
  176. package/build/types/index.d.ts.map +1 -0
  177. package/build/types/index.js +25 -0
  178. package/build/types/index.js.map +1 -0
  179. package/build/types/notification-types.d.ts +154 -0
  180. package/build/types/notification-types.d.ts.map +1 -0
  181. package/build/types/notification-types.js +7 -0
  182. package/build/types/notification-types.js.map +1 -0
  183. package/build/types/podio-types.d.ts +250 -0
  184. package/build/types/podio-types.d.ts.map +1 -0
  185. package/build/types/podio-types.js +11 -0
  186. package/build/types/podio-types.js.map +1 -0
  187. package/build/types/search-types.d.ts +188 -0
  188. package/build/types/search-types.d.ts.map +1 -0
  189. package/build/types/search-types.js +43 -0
  190. package/build/types/search-types.js.map +1 -0
  191. package/build/utils/debug.d.ts +58 -0
  192. package/build/utils/debug.d.ts.map +1 -0
  193. package/build/utils/debug.js +147 -0
  194. package/build/utils/debug.js.map +1 -0
  195. package/examples/claude-config-example.json +13 -0
  196. package/package.json +87 -0
  197. package/scripts/generate-claude-config.js +107 -0
@@ -0,0 +1,102 @@
1
+ /**
2
+ * @fileoverview Base error classes for the Podio MCP server
3
+ *
4
+ * This module provides the foundation for all error handling in the Podio MCP server.
5
+ * It includes a base PodioError class that extends the native Error class with additional
6
+ * structured information for better debugging and error handling.
7
+ */
8
+ /**
9
+ * Enumeration of all error codes used throughout the Podio MCP server.
10
+ * These codes provide programmatic access to error types for proper error handling.
11
+ */
12
+ export declare enum PodioErrorCode {
13
+ API_REQUEST_FAILED = 1000,
14
+ API_RESPONSE_INVALID = 1001,
15
+ API_TIMEOUT = 1002,
16
+ API_NETWORK_ERROR = 1003,
17
+ AUTH_INVALID_CREDENTIALS = 2000,
18
+ AUTH_TOKEN_EXPIRED = 2001,
19
+ AUTH_TOKEN_INVALID = 2002,
20
+ AUTH_OAUTH_FAILED = 2003,
21
+ AUTH_REFRESH_FAILED = 2004,
22
+ AUTH_NOT_INITIALIZED = 2005,
23
+ CONFIG_MISSING_REQUIRED = 3000,
24
+ CONFIG_INVALID_VALUE = 3001,
25
+ CONFIG_ENVIRONMENT_INVALID = 3002,
26
+ CONFIG_OAUTH_INCOMPLETE = 3003,
27
+ CACHE_READ_FAILED = 4000,
28
+ CACHE_WRITE_FAILED = 4001,
29
+ CACHE_INVALIDATION_FAILED = 4002,
30
+ CACHE_CORRUPTED = 4003,
31
+ VALIDATION_REQUIRED_FIELD = 5000,
32
+ VALIDATION_INVALID_TYPE = 5001,
33
+ VALIDATION_OUT_OF_RANGE = 5002,
34
+ VALIDATION_FORMAT_INVALID = 5003,
35
+ VALIDATION_NO_VALID_FIELDS = 5004,
36
+ STRUCTURE_NOT_LOADED = 6000,
37
+ STRUCTURE_APP_NOT_FOUND = 6001,
38
+ STRUCTURE_FIELD_NOT_FOUND = 6002,
39
+ STRUCTURE_INVALID_CONFIG = 6003,
40
+ STRUCTURE_SPACE_NOT_FOUND = 6004
41
+ }
42
+ /**
43
+ * Additional context information that can be attached to errors for better debugging.
44
+ */
45
+ export interface ErrorContext {
46
+ /** HTTP status code if applicable */
47
+ statusCode?: number;
48
+ /** HTTP status text if applicable */
49
+ statusText?: string;
50
+ /** Request URL that caused the error */
51
+ url?: string;
52
+ /** Request method that caused the error */
53
+ method?: string;
54
+ /** Additional metadata relevant to the error */
55
+ metadata?: Record<string, any>;
56
+ /** Timestamp when the error occurred */
57
+ timestamp?: Date;
58
+ /** Request/operation ID for tracing */
59
+ requestId?: string;
60
+ /** Stack trace from the original error if wrapped */
61
+ originalStack?: string;
62
+ }
63
+ /**
64
+ * Base error class for all Podio MCP server errors.
65
+ *
66
+ * This class extends the native Error class with additional structured information
67
+ * including error codes, HTTP status information, and contextual metadata.
68
+ *
69
+ * @example
70
+ * ```typescript
71
+ * throw new PodioError('Something went wrong', PodioErrorCode.API_REQUEST_FAILED, {
72
+ * statusCode: 500,
73
+ * url: 'https://api.podio.com/app/123'
74
+ * });
75
+ * ```
76
+ */
77
+ export declare class PodioError extends Error {
78
+ /** Unique error code for programmatic handling */
79
+ readonly code: PodioErrorCode;
80
+ /** Additional context information */
81
+ readonly context: ErrorContext;
82
+ /** The original error that caused this error, if any */
83
+ readonly cause?: Error;
84
+ /**
85
+ * Creates a new PodioError instance.
86
+ *
87
+ * @param message - Human-readable error message
88
+ * @param code - Error code for programmatic handling
89
+ * @param context - Additional context information
90
+ * @param cause - Original error that caused this error
91
+ */
92
+ constructor(message: string, code: PodioErrorCode, context?: ErrorContext, cause?: Error);
93
+ /**
94
+ * Returns a JSON representation of the error for logging and debugging.
95
+ */
96
+ toJSON(): Record<string, any>;
97
+ /**
98
+ * Returns a formatted string representation of the error.
99
+ */
100
+ toString(): string;
101
+ }
102
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/errors/base.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,oBAAY,cAAc;IAExB,kBAAkB,OAAO;IACzB,oBAAoB,OAAO;IAC3B,WAAW,OAAO;IAClB,iBAAiB,OAAO;IAGxB,wBAAwB,OAAO;IAC/B,kBAAkB,O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,cAAc,EAAE,OAAO,GAAE,YAAiB,EAAE,KAAK,CAAC,EAAE,KAAK;IAyB5F;;OAEG;IACH,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAiB7B;;OAEG;IACH,QAAQ,IAAI,MAAM;CAanB"}
@@ -0,0 +1,131 @@
1
+ /**
2
+ * @fileoverview Base error classes for the Podio MCP server
3
+ *
4
+ * This module provides the foundation for all error handling in the Podio MCP server.
5
+ * It includes a base PodioError class that extends the native Error class with additional
6
+ * structured information for better debugging and error handling.
7
+ */
8
+ /**
9
+ * Enumeration of all error codes used throughout the Podio MCP server.
10
+ * These codes provide programmatic access to error types for proper error handling.
11
+ */
12
+ export var PodioErrorCode;
13
+ (function (PodioErrorCode) {
14
+ // API Errors (1000-1999)
15
+ PodioErrorCode[PodioErrorCode["API_REQUEST_FAILED"] = 1000] = "API_REQUEST_FAILED";
16
+ PodioErrorCode[PodioErrorCode["API_RESPONSE_INVALID"] = 1001] = "API_RESPONSE_INVALID";
17
+ PodioErrorCode[PodioErrorCode["API_TIMEOUT"] = 1002] = "API_TIMEOUT";
18
+ PodioErrorCode[PodioErrorCode["API_NETWORK_ERROR"] = 1003] = "API_NETWORK_ERROR";
19
+ // Authentication Errors (2000-2999)
20
+ PodioErrorCode[PodioErrorCode["AUTH_INVALID_CREDENTIALS"] = 2000] = "AUTH_INVALID_CREDENTIALS";
21
+ PodioErrorCode[PodioErrorCode["AUTH_TOKEN_EXPIRED"] = 2001] = "AUTH_TOKEN_EXPIRED";
22
+ PodioErrorCode[PodioErrorCode["AUTH_TOKEN_INVALID"] = 2002] = "AUTH_TOKEN_INVALID";
23
+ PodioErrorCode[PodioErrorCode["AUTH_OAUTH_FAILED"] = 2003] = "AUTH_OAUTH_FAILED";
24
+ PodioErrorCode[PodioErrorCode["AUTH_REFRESH_FAILED"] = 2004] = "AUTH_REFRESH_FAILED";
25
+ PodioErrorCode[PodioErrorCode["AUTH_NOT_INITIALIZED"] = 2005] = "AUTH_NOT_INITIALIZED";
26
+ // Configuration Errors (3000-3999)
27
+ PodioErrorCode[PodioErrorCode["CONFIG_MISSING_REQUIRED"] = 3000] = "CONFIG_MISSING_REQUIRED";
28
+ PodioErrorCode[PodioErrorCode["CONFIG_INVALID_VALUE"] = 3001] = "CONFIG_INVALID_VALUE";
29
+ PodioErrorCode[PodioErrorCode["CONFIG_ENVIRONMENT_INVALID"] = 3002] = "CONFIG_ENVIRONMENT_INVALID";
30
+ PodioErrorCode[PodioErrorCode["CONFIG_OAUTH_INCOMPLETE"] = 3003] = "CONFIG_OAUTH_INCOMPLETE";
31
+ // Cache Errors (4000-4999)
32
+ PodioErrorCode[PodioErrorCode["CACHE_READ_FAILED"] = 4000] = "CACHE_READ_FAILED";
33
+ PodioErrorCode[PodioErrorCode["CACHE_WRITE_FAILED"] = 4001] = "CACHE_WRITE_FAILED";
34
+ PodioErrorCode[PodioErrorCode["CACHE_INVALIDATION_FAILED"] = 4002] = "CACHE_INVALIDATION_FAILED";
35
+ PodioErrorCode[PodioErrorCode["CACHE_CORRUPTED"] = 4003] = "CACHE_CORRUPTED";
36
+ // Validation Errors (5000-5999)
37
+ PodioErrorCode[PodioErrorCode["VALIDATION_REQUIRED_FIELD"] = 5000] = "VALIDATION_REQUIRED_FIELD";
38
+ PodioErrorCode[PodioErrorCode["VALIDATION_INVALID_TYPE"] = 5001] = "VALIDATION_INVALID_TYPE";
39
+ PodioErrorCode[PodioErrorCode["VALIDATION_OUT_OF_RANGE"] = 5002] = "VALIDATION_OUT_OF_RANGE";
40
+ PodioErrorCode[PodioErrorCode["VALIDATION_FORMAT_INVALID"] = 5003] = "VALIDATION_FORMAT_INVALID";
41
+ PodioErrorCode[PodioErrorCode["VALIDATION_NO_VALID_FIELDS"] = 5004] = "VALIDATION_NO_VALID_FIELDS";
42
+ // Structure Errors (6000-6999)
43
+ PodioErrorCode[PodioErrorCode["STRUCTURE_NOT_LOADED"] = 6000] = "STRUCTURE_NOT_LOADED";
44
+ PodioErrorCode[PodioErrorCode["STRUCTURE_APP_NOT_FOUND"] = 6001] = "STRUCTURE_APP_NOT_FOUND";
45
+ PodioErrorCode[PodioErrorCode["STRUCTURE_FIELD_NOT_FOUND"] = 6002] = "STRUCTURE_FIELD_NOT_FOUND";
46
+ PodioErrorCode[PodioErrorCode["STRUCTURE_INVALID_CONFIG"] = 6003] = "STRUCTURE_INVALID_CONFIG";
47
+ PodioErrorCode[PodioErrorCode["STRUCTURE_SPACE_NOT_FOUND"] = 6004] = "STRUCTURE_SPACE_NOT_FOUND";
48
+ })(PodioErrorCode || (PodioErrorCode = {}));
49
+ /**
50
+ * Base error class for all Podio MCP server errors.
51
+ *
52
+ * This class extends the native Error class with additional structured information
53
+ * including error codes, HTTP status information, and contextual metadata.
54
+ *
55
+ * @example
56
+ * ```typescript
57
+ * throw new PodioError('Something went wrong', PodioErrorCode.API_REQUEST_FAILED, {
58
+ * statusCode: 500,
59
+ * url: 'https://api.podio.com/app/123'
60
+ * });
61
+ * ```
62
+ */
63
+ export class PodioError extends Error {
64
+ /** Unique error code for programmatic handling */
65
+ code;
66
+ /** Additional context information */
67
+ context;
68
+ /** The original error that caused this error, if any */
69
+ cause;
70
+ /**
71
+ * Creates a new PodioError instance.
72
+ *
73
+ * @param message - Human-readable error message
74
+ * @param code - Error code for programmatic handling
75
+ * @param context - Additional context information
76
+ * @param cause - Original error that caused this error
77
+ */
78
+ constructor(message, code, context = {}, cause) {
79
+ super(message);
80
+ this.name = this.constructor.name;
81
+ this.code = code;
82
+ this.context = {
83
+ timestamp: new Date(),
84
+ ...context,
85
+ };
86
+ this.cause = cause;
87
+ // Capture the original stack trace if wrapping another error
88
+ if (cause?.stack) {
89
+ this.context.originalStack = cause.stack;
90
+ }
91
+ // Ensure proper prototype chain for instanceof checks
92
+ Object.setPrototypeOf(this, new.target.prototype);
93
+ // Capture stack trace, excluding constructor call
94
+ if (Error.captureStackTrace) {
95
+ Error.captureStackTrace(this, this.constructor);
96
+ }
97
+ }
98
+ /**
99
+ * Returns a JSON representation of the error for logging and debugging.
100
+ */
101
+ toJSON() {
102
+ return {
103
+ name: this.name,
104
+ message: this.message,
105
+ code: this.code,
106
+ context: this.context,
107
+ stack: this.stack,
108
+ cause: this.cause
109
+ ? {
110
+ name: this.cause.name,
111
+ message: this.cause.message,
112
+ stack: this.cause.stack,
113
+ }
114
+ : undefined,
115
+ };
116
+ }
117
+ /**
118
+ * Returns a formatted string representation of the error.
119
+ */
120
+ toString() {
121
+ const parts = [`${this.name}: ${this.message}`, `Code: ${this.code}`];
122
+ if (this.context.statusCode) {
123
+ parts.push(`Status: ${this.context.statusCode}`);
124
+ }
125
+ if (this.context.url) {
126
+ parts.push(`URL: ${this.context.url}`);
127
+ }
128
+ return parts.join(' | ');
129
+ }
130
+ }
131
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/errors/base.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,MAAM,CAAN,IAAY,cAwCX;AAxCD,WAAY,cAAc;IACxB,yBAAyB;IACzB,kFAAyB,CAAA;IACzB,sFAA2B,CAAA;IAC3B,oEAAkB,CAAA;IAClB,gFAAwB,CAAA;IAExB,oCAAoC;IACpC,8FAA+B,CAAA;IAC/B,kFAAyB,CAAA;IACzB,kFAAyB,CAAA;IACzB,gFAAwB,CAAA;IACxB,oFAA0B,CAAA;IAC1B,sFAA2B,CAAA;IAE3B,mCAAmC;IACnC,4FAA8B,CAAA;IAC9B,sFAA2B,CAAA;IAC3B,kGAAiC,CAAA;IACjC,4FAA8B,CAAA;IAE9B,2BAA2B;IAC3B,gFAAwB,CAAA;IACxB,kFAAyB,CAAA;IACzB,gGAAgC,CAAA;IAChC,4EAAsB,CAAA;IAEtB,gCAAgC;IAChC,gGAAgC,CAAA;IAChC,4FAA8B,CAAA;IAC9B,4FAA8B,CAAA;IAC9B,gGAAgC,CAAA;IAChC,kGAAiC,CAAA;IAE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AO,EAAE,IAAI,CAAC,OAAO;YACrB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,KAAK,EAAE,IAAI,CAAC,KAAK;gBACf,CAAC,CAAC;oBACE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI;oBACrB,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO;oBAC3B,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK;iBACxB;gBACH,CAAC,CAAC,SAAS;SACd,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAEtE,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;YAC5B,KAAK,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;QACnD,CAAC;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;YACrB,KAAK,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACzC,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;CACF"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @fileoverview Cache-related error classes for the Podio MCP server
3
+ *
4
+ * This module provides error classes specifically for caching operations,
5
+ * including cache reads, writes, invalidation, and corruption issues.
6
+ */
7
+ import { PodioError, PodioErrorCode, type ErrorContext } from './base.js';
8
+ /**
9
+ * Base class for all cache-related errors.
10
+ *
11
+ * This error is thrown when cache operations fail, including read/write
12
+ * operations, cache invalidation, and cache corruption detection.
13
+ */
14
+ export declare class PodioCacheError extends PodioError {
15
+ constructor(message: string, code?: PodioErrorCode, context?: ErrorContext, cause?: Error);
16
+ /**
17
+ * Creates an error for cache read failures.
18
+ *
19
+ * @param cacheKey - The cache key that failed to read
20
+ * @param cause - Original error that caused the read failure
21
+ */
22
+ static readFailed(cacheKey: string, cause?: Error): PodioCacheError;
23
+ /**
24
+ * Creates an error for cache write failures.
25
+ *
26
+ * @param cacheKey - The cache key that failed to write
27
+ * @param cause - Original error that caused the write failure
28
+ */
29
+ static writeFailed(cacheKey: string, cause?: Error): PodioCacheError;
30
+ /**
31
+ * Creates an error for cache invalidation failures.
32
+ *
33
+ * @param cacheKey - The cache key that failed to invalidate
34
+ * @param cause - Original error that caused the invalidation failure
35
+ */
36
+ static invalidationFailed(cacheKey: string, cause?: Error): PodioCacheError;
37
+ /**
38
+ * Creates an error for corrupted cache data.
39
+ *
40
+ * @param cacheKey - The cache key with corrupted data
41
+ * @param corruptionType - Type of corruption detected
42
+ */
43
+ static corrupted(cacheKey: string, corruptionType: string): PodioCacheError;
44
+ /**
45
+ * Creates an error for cache serialization/deserialization failures.
46
+ *
47
+ * @param cacheKey - The cache key involved in serialization
48
+ * @param operation - Whether it was 'serialize' or 'deserialize'
49
+ * @param cause - Original error that caused the serialization failure
50
+ */
51
+ static serializationFailed(cacheKey: string, operation: 'serialize' | 'deserialize', cause?: Error): PodioCacheError;
52
+ }
53
+ //# sourceMappingURL=cache-errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache-errors.d.ts","sourceRoot":"","sources":["../../src/errors/cache-errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAE1E;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,UAAU;gBAE3C,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,cAAiD,EACvD,OAAO,GAAE,YAAiB,EAC1B,KAAK,CAAC,EAAE,KAAK;IAKf;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,eAAe;IAWnE;;;;;OAKG;IACH,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,eAAe;IAWpE;;;;;OAKG;IACH,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,eAAe;IAW3E;;;;;OAKG;IACH,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,eAAe;IAW3E;;;;;;OAMG;IACH,MAAM,CAAC,mBAAmB,CACxB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,WAAW,GAAG,aAAa,EACtC,KAAK,CAAC,EAAE,KAAK,GACZ,eAAe;CAmBnB"}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * @fileoverview Cache-related error classes for the Podio MCP server
3
+ *
4
+ * This module provides error classes specifically for caching operations,
5
+ * including cache reads, writes, invalidation, and corruption issues.
6
+ */
7
+ import { PodioError, PodioErrorCode } from './base.js';
8
+ /**
9
+ * Base class for all cache-related errors.
10
+ *
11
+ * This error is thrown when cache operations fail, including read/write
12
+ * operations, cache invalidation, and cache corruption detection.
13
+ */
14
+ export class PodioCacheError extends PodioError {
15
+ constructor(message, code = PodioErrorCode.CACHE_READ_FAILED, context = {}, cause) {
16
+ super(message, code, context, cause);
17
+ }
18
+ /**
19
+ * Creates an error for cache read failures.
20
+ *
21
+ * @param cacheKey - The cache key that failed to read
22
+ * @param cause - Original error that caused the read failure
23
+ */
24
+ static readFailed(cacheKey, cause) {
25
+ const message = `Failed to read from cache: ${cacheKey}`;
26
+ return new PodioCacheError(message, PodioErrorCode.CACHE_READ_FAILED, { metadata: { cacheKey } }, cause);
27
+ }
28
+ /**
29
+ * Creates an error for cache write failures.
30
+ *
31
+ * @param cacheKey - The cache key that failed to write
32
+ * @param cause - Original error that caused the write failure
33
+ */
34
+ static writeFailed(cacheKey, cause) {
35
+ const message = `Failed to write to cache: ${cacheKey}`;
36
+ return new PodioCacheError(message, PodioErrorCode.CACHE_WRITE_FAILED, { metadata: { cacheKey } }, cause);
37
+ }
38
+ /**
39
+ * Creates an error for cache invalidation failures.
40
+ *
41
+ * @param cacheKey - The cache key that failed to invalidate
42
+ * @param cause - Original error that caused the invalidation failure
43
+ */
44
+ static invalidationFailed(cacheKey, cause) {
45
+ const message = `Failed to invalidate cache: ${cacheKey}`;
46
+ return new PodioCacheError(message, PodioErrorCode.CACHE_INVALIDATION_FAILED, { metadata: { cacheKey } }, cause);
47
+ }
48
+ /**
49
+ * Creates an error for corrupted cache data.
50
+ *
51
+ * @param cacheKey - The cache key with corrupted data
52
+ * @param corruptionType - Type of corruption detected
53
+ */
54
+ static corrupted(cacheKey, corruptionType) {
55
+ const message = `Cache data corrupted for key '${cacheKey}': ${corruptionType}`;
56
+ return new PodioCacheError(message, PodioErrorCode.CACHE_CORRUPTED, {
57
+ metadata: {
58
+ cacheKey,
59
+ corruptionType,
60
+ },
61
+ });
62
+ }
63
+ /**
64
+ * Creates an error for cache serialization/deserialization failures.
65
+ *
66
+ * @param cacheKey - The cache key involved in serialization
67
+ * @param operation - Whether it was 'serialize' or 'deserialize'
68
+ * @param cause - Original error that caused the serialization failure
69
+ */
70
+ static serializationFailed(cacheKey, operation, cause) {
71
+ const message = `Failed to ${operation} cache data for key '${cacheKey}'`;
72
+ const code = operation === 'serialize'
73
+ ? PodioErrorCode.CACHE_WRITE_FAILED
74
+ : PodioErrorCode.CACHE_READ_FAILED;
75
+ return new PodioCacheError(message, code, {
76
+ metadata: {
77
+ cacheKey,
78
+ operation,
79
+ },
80
+ }, cause);
81
+ }
82
+ }
83
+ //# sourceMappingURL=cache-errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache-errors.js","sourceRoot":"","sources":["../../src/errors/cache-errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,cAA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AAe,EAAE;YAClE,QAAQ,EAAE;gBACR,QAAQ;gBACR,cAAc;aACf;SACF,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,mBAAmB,CACxB,QAAgB,EAChB,SAAsC,EACtC,KAAa;QAEb,MAAM,OAAO,GAAG,aAAa,SAAS,wBAAwB,QAAQ,GAAG,CAAC;QAC1E,MAAM,IAAI,GACR,SAAS,KAAK,WAAW;YACvB,CAAC,CAAC,cAAc,CAAC,kBAAkB;YACnC,CAAC,CAAC,cAAc,CAAC,iBAAiB,CAAC;QAEvC,OAAO,IAAI,eAAe,CACxB,OAAO,EACP,IAAI,EACJ;YACE,QAAQ,EAAE;gBACR,QAAQ;gBACR,SAAS;aACV;SACF,EACD,KAAK,CACN,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @fileoverview Configuration-related error classes for the Podio MCP server
3
+ *
4
+ * This module provides error classes specifically for configuration issues,
5
+ * missing environment variables, and invalid configuration values.
6
+ */
7
+ import { PodioError, PodioErrorCode, type ErrorContext } from './base.js';
8
+ /**
9
+ * Base class for all configuration-related errors.
10
+ *
11
+ * This error is thrown when there are issues with application configuration,
12
+ * environment variables, or invalid configuration values.
13
+ */
14
+ export declare class PodioConfigError extends PodioError {
15
+ constructor(message: string, code?: PodioErrorCode, context?: ErrorContext, cause?: Error);
16
+ /**
17
+ * Creates an error for missing required configuration.
18
+ *
19
+ * @param configKey - The missing configuration key
20
+ * @param description - Optional description of what the config is for
21
+ */
22
+ static missingRequired(configKey: string, description?: string): PodioConfigError;
23
+ /**
24
+ * Creates an error for invalid configuration values.
25
+ *
26
+ * @param configKey - The configuration key with invalid value
27
+ * @param value - The invalid value
28
+ * @param expectedFormat - Expected format or valid values
29
+ */
30
+ static invalidValue(configKey: string, value: any, expectedFormat: string): PodioConfigError;
31
+ /**
32
+ * Creates an error for incomplete OAuth configuration.
33
+ *
34
+ * @param missingFields - Array of missing OAuth fields
35
+ */
36
+ static incompleteOAuth(missingFields: string[]): PodioConfigError;
37
+ /**
38
+ * Creates an error for invalid environment configuration.
39
+ *
40
+ * @param environment - The problematic environment
41
+ * @param issue - Description of the issue
42
+ */
43
+ static invalidEnvironment(environment: string, issue: string): PodioConfigError;
44
+ /**
45
+ * Creates an error for missing workspace coordinates.
46
+ *
47
+ * @param missingParams - Array of missing coordinate parameters
48
+ */
49
+ static missingWorkspaceCoordinates(missingParams: string[]): PodioConfigError;
50
+ /**
51
+ * Creates an error for invalid credentials.
52
+ *
53
+ * @param message - Error message
54
+ * @param cause - Optional underlying cause
55
+ */
56
+ static invalidCredentials(message: string, cause?: Error): PodioConfigError;
57
+ }
58
+ //# sourceMappingURL=config-errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-errors.d.ts","sourceRoot":"","sources":["../../src/errors/config-errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAE1E;;;;;GAKG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;gBAE5C,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,cAAuD,EAC7D,OAAO,GAAE,YAAiB,EAC1B,KAAK,CAAC,EAAE,KAAK;IAKf;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,gBAAgB;IAUjF;;;;;;OAMG;IACH,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,GAAG,gBAAgB;IAY5F;;;;OAIG;IACH,MAAM,CAAC,eAAe,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,gBAAgB;IAQjE;;;;;OAKG;IACH,MAAM,CAAC,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,gBAAgB;IAW/E;;;;OAIG;IACH,MAAM,CAAC,2BAA2B,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,gBAAgB;IAQ7E;;;;;OAKG;IACH,MAAM,CAAC,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,gBAAgB;CAQ5E"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * @fileoverview Configuration-related error classes for the Podio MCP server
3
+ *
4
+ * This module provides error classes specifically for configuration issues,
5
+ * missing environment variables, and invalid configuration values.
6
+ */
7
+ import { PodioError, PodioErrorCode } from './base.js';
8
+ /**
9
+ * Base class for all configuration-related errors.
10
+ *
11
+ * This error is thrown when there are issues with application configuration,
12
+ * environment variables, or invalid configuration values.
13
+ */
14
+ export class PodioConfigError extends PodioError {
15
+ constructor(message, code = PodioErrorCode.CONFIG_MISSING_REQUIRED, context = {}, cause) {
16
+ super(message, code, context, cause);
17
+ }
18
+ /**
19
+ * Creates an error for missing required configuration.
20
+ *
21
+ * @param configKey - The missing configuration key
22
+ * @param description - Optional description of what the config is for
23
+ */
24
+ static missingRequired(configKey, description) {
25
+ const message = description
26
+ ? `Missing required configuration '${configKey}': ${description}`
27
+ : `Missing required configuration: ${configKey}`;
28
+ return new PodioConfigError(message, PodioErrorCode.CONFIG_MISSING_REQUIRED, {
29
+ metadata: { configKey, description },
30
+ });
31
+ }
32
+ /**
33
+ * Creates an error for invalid configuration values.
34
+ *
35
+ * @param configKey - The configuration key with invalid value
36
+ * @param value - The invalid value
37
+ * @param expectedFormat - Expected format or valid values
38
+ */
39
+ static invalidValue(configKey, value, expectedFormat) {
40
+ const message = `Invalid configuration value for '${configKey}': ${value}. Expected: ${expectedFormat}`;
41
+ return new PodioConfigError(message, PodioErrorCode.CONFIG_INVALID_VALUE, {
42
+ metadata: {
43
+ configKey,
44
+ invalidValue: value,
45
+ expectedFormat,
46
+ },
47
+ });
48
+ }
49
+ /**
50
+ * Creates an error for incomplete OAuth configuration.
51
+ *
52
+ * @param missingFields - Array of missing OAuth fields
53
+ */
54
+ static incompleteOAuth(missingFields) {
55
+ const message = `Incomplete OAuth configuration. Missing: ${missingFields.join(', ')}`;
56
+ return new PodioConfigError(message, PodioErrorCode.CONFIG_OAUTH_INCOMPLETE, {
57
+ metadata: { missingFields },
58
+ });
59
+ }
60
+ /**
61
+ * Creates an error for invalid environment configuration.
62
+ *
63
+ * @param environment - The problematic environment
64
+ * @param issue - Description of the issue
65
+ */
66
+ static invalidEnvironment(environment, issue) {
67
+ const message = `Invalid environment configuration for '${environment}': ${issue}`;
68
+ return new PodioConfigError(message, PodioErrorCode.CONFIG_ENVIRONMENT_INVALID, {
69
+ metadata: {
70
+ environment,
71
+ issue,
72
+ },
73
+ });
74
+ }
75
+ /**
76
+ * Creates an error for missing workspace coordinates.
77
+ *
78
+ * @param missingParams - Array of missing coordinate parameters
79
+ */
80
+ static missingWorkspaceCoordinates(missingParams) {
81
+ const message = `Missing required workspace coordinates: ${missingParams.join(', ')}`;
82
+ return new PodioConfigError(message, PodioErrorCode.CONFIG_MISSING_REQUIRED, {
83
+ metadata: { missingParams, context: 'workspace_coordinates' },
84
+ });
85
+ }
86
+ /**
87
+ * Creates an error for invalid credentials.
88
+ *
89
+ * @param message - Error message
90
+ * @param cause - Optional underlying cause
91
+ */
92
+ static invalidCredentials(message, cause) {
93
+ return new PodioConfigError(message, PodioErrorCode.CONFIG_INVALID_VALUE, { metadata: { context: 'credentials' } }, cause);
94
+ }
95
+ }
96
+ //# sourceMappingURL=config-errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-errors.js","sourceRoot":"","sources":["../../src/errors/config-errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAqB,MAAM,WAAW,CAAC;AAE1E;;;;;GAKG;AACH,MAAM,OAAO,gBAAiB,SAAQ,UAAU;IAC9C,YACE,OAAe,EACf,OAAuB,cAAc,CAAC,uBAAuB,EAC7D,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,CAAC,0BAA0B,EAAE;YAC9E,QAAQ,EAAE;gBACR,WAAW;gBACX,KAAK;aACN;SACF,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,2BAA2B,CAAC,aAAuB;QACxD,MAAM,OAAO,GAAG,2CAA2C,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAEtF,OAAO,IAAI,gBAAgB,CAAC,OAAO,EAAE,cAAc,CAAC,uBAAuB,EAAE;YAC3E,QAAQ,EAAE,EAAE,aAAa,EAAE,OAAO,EAAE,uBAAuB,EAAE;SAC9D,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,kBAAkB,CAAC,OAAe,EAAE,KAAa;QACtD,OAAO,IAAI,gBAAgB,CACzB,OAAO,EACP,cAAc,CAAC,oBAAoB,EACnC,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,EAAE,EACxC,KAAK,CACN,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,101 @@
1
+ /**
2
+ * @fileoverview Comprehensive typed error system for the Podio MCP server
3
+ *
4
+ * This module provides a complete set of error classes for proper error handling
5
+ * throughout the Podio MCP server. It replaces generic Error usage with specific,
6
+ * typed error classes that include error codes, HTTP status information, and
7
+ * contextual metadata for better debugging and error handling.
8
+ *
9
+ * @example Basic Usage
10
+ * ```typescript
11
+ * import { PodioApiError, PodioAuthError } from './errors/index.js';
12
+ *
13
+ * // API error with response
14
+ * throw PodioApiError.fromResponse(response, 'Custom message');
15
+ *
16
+ * // Authentication error
17
+ * throw PodioAuthError.notInitialized(['PODIO_CLIENT_ID']);
18
+ * ```
19
+ *
20
+ * @example Error Handling
21
+ * ```typescript
22
+ * try {
23
+ * await podioOperation();
24
+ * } catch (error) {
25
+ * if (error instanceof PodioApiError) {
26
+ * console.log(`API Error: ${error.code}, Status: ${error.context.statusCode}`);
27
+ * } else if (error instanceof PodioAuthError) {
28
+ * console.log(`Auth Error: ${error.code}`);
29
+ * }
30
+ * }
31
+ * ```
32
+ */
33
+ export { PodioError, PodioErrorCode, type ErrorContext, } from './base.js';
34
+ export { PodioApiError, PodioApiResponseError, } from './api-errors.js';
35
+ export { PodioAuthError } from './auth-errors.js';
36
+ export { PodioConfigError } from './config-errors.js';
37
+ export { PodioCacheError } from './cache-errors.js';
38
+ export { PodioValidationError } from './validation-errors.js';
39
+ export { PodioStructureError } from './structure-errors.js';
40
+ import { PodioError } from './base.js';
41
+ import { PodioApiError } from './api-errors.js';
42
+ import { PodioAuthError } from './auth-errors.js';
43
+ import { PodioConfigError } from './config-errors.js';
44
+ import { PodioCacheError } from './cache-errors.js';
45
+ import { PodioValidationError } from './validation-errors.js';
46
+ import { PodioStructureError } from './structure-errors.js';
47
+ /**
48
+ * Type guard to check if an error is any Podio error
49
+ */
50
+ export declare function isPodioError(error: any): error is PodioError;
51
+ /**
52
+ * Type guard to check if an error is an API error
53
+ */
54
+ export declare function isPodioApiError(error: any): error is PodioApiError;
55
+ /**
56
+ * Type guard to check if an error is an authentication error
57
+ */
58
+ export declare function isPodioAuthError(error: any): error is PodioAuthError;
59
+ /**
60
+ * Type guard to check if an error is a configuration error
61
+ */
62
+ export declare function isPodioConfigError(error: any): error is PodioConfigError;
63
+ /**
64
+ * Type guard to check if an error is a cache error
65
+ */
66
+ export declare function isPodioCacheError(error: any): error is PodioCacheError;
67
+ /**
68
+ * Type guard to check if an error is a validation error
69
+ */
70
+ export declare function isPodioValidationError(error: any): error is PodioValidationError;
71
+ /**
72
+ * Type guard to check if an error is a structure error
73
+ */
74
+ export declare function isPodioStructureError(error: any): error is PodioStructureError;
75
+ /**
76
+ * Error factory for common error scenarios
77
+ */
78
+ export declare class PodioErrorFactory {
79
+ /**
80
+ * Creates appropriate error from HTTP response
81
+ */
82
+ static fromHttpError(response: Response, message?: string, cause?: Error): PodioApiError;
83
+ /**
84
+ * Creates structure not loaded error
85
+ */
86
+ static structureNotLoaded(operation?: string): PodioStructureError;
87
+ /**
88
+ * Creates validation error for required field
89
+ */
90
+ static requiredField(fieldName: string, context?: string): PodioValidationError;
91
+ /**
92
+ * Creates auth error for uninitialized OAuth
93
+ */
94
+ static authNotInitialized(missingVars?: string[]): PodioAuthError;
95
+ /**
96
+ * Creates API error for failed API call
97
+ */
98
+ static apiCallFailed(operation: string, error: any): PodioApiError;
99
+ }
100
+ export { PodioError as default } from './base.js';
101
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,EACL,UAAU,EACV,cAAc,EACd,KAAK,YAAY,GAClB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,aAAa,EACb,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,UAAU,EAAkB,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EA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