@databricks/appkit 0.1.4 → 0.2.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.
- package/AGENTS.md +89 -12
- package/CLAUDE.md +89 -12
- package/NOTICE.md +4 -0
- package/README.md +21 -15
- package/bin/appkit-lint.js +129 -0
- package/dist/analytics/analytics.d.ts +33 -8
- package/dist/analytics/analytics.d.ts.map +1 -1
- package/dist/analytics/analytics.js +67 -27
- package/dist/analytics/analytics.js.map +1 -1
- package/dist/analytics/defaults.js.map +1 -1
- package/dist/analytics/query.js +12 -6
- package/dist/analytics/query.js.map +1 -1
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +7 -5
- package/dist/app/index.js.map +1 -1
- package/dist/appkit/package.js +1 -1
- package/dist/cache/defaults.js.map +1 -1
- package/dist/cache/index.d.ts +1 -0
- package/dist/cache/index.d.ts.map +1 -1
- package/dist/cache/index.js +25 -5
- package/dist/cache/index.js.map +1 -1
- package/dist/cache/storage/memory.js.map +1 -1
- package/dist/cache/storage/persistent.js +12 -6
- package/dist/cache/storage/persistent.js.map +1 -1
- package/dist/connectors/lakebase/client.js +31 -21
- package/dist/connectors/lakebase/client.js.map +1 -1
- package/dist/connectors/lakebase/defaults.js.map +1 -1
- package/dist/connectors/sql-warehouse/client.js +68 -28
- package/dist/connectors/sql-warehouse/client.js.map +1 -1
- package/dist/connectors/sql-warehouse/defaults.js.map +1 -1
- package/dist/context/execution-context.js +75 -0
- package/dist/context/execution-context.js.map +1 -0
- package/dist/context/index.js +27 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/service-context.js +154 -0
- package/dist/context/service-context.js.map +1 -0
- package/dist/context/user-context.js +15 -0
- package/dist/context/user-context.js.map +1 -0
- package/dist/core/appkit.d.ts +3 -0
- package/dist/core/appkit.d.ts.map +1 -1
- package/dist/core/appkit.js +7 -0
- package/dist/core/appkit.js.map +1 -1
- package/dist/errors/authentication.d.ts +38 -0
- package/dist/errors/authentication.d.ts.map +1 -0
- package/dist/errors/authentication.js +48 -0
- package/dist/errors/authentication.js.map +1 -0
- package/dist/errors/base.d.ts +58 -0
- package/dist/errors/base.d.ts.map +1 -0
- package/dist/errors/base.js +70 -0
- package/dist/errors/base.js.map +1 -0
- package/dist/errors/configuration.d.ts +38 -0
- package/dist/errors/configuration.d.ts.map +1 -0
- package/dist/errors/configuration.js +45 -0
- package/dist/errors/configuration.js.map +1 -0
- package/dist/errors/connection.d.ts +42 -0
- package/dist/errors/connection.d.ts.map +1 -0
- package/dist/errors/connection.js +54 -0
- package/dist/errors/connection.js.map +1 -0
- package/dist/errors/execution.d.ts +42 -0
- package/dist/errors/execution.d.ts.map +1 -0
- package/dist/errors/execution.js +51 -0
- package/dist/errors/execution.js.map +1 -0
- package/dist/errors/index.js +28 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/initialization.d.ts +34 -0
- package/dist/errors/initialization.d.ts.map +1 -0
- package/dist/errors/initialization.js +42 -0
- package/dist/errors/initialization.js.map +1 -0
- package/dist/errors/server.d.ts +38 -0
- package/dist/errors/server.d.ts.map +1 -0
- package/dist/errors/server.js +45 -0
- package/dist/errors/server.js.map +1 -0
- package/dist/errors/tunnel.d.ts +38 -0
- package/dist/errors/tunnel.d.ts.map +1 -0
- package/dist/errors/tunnel.js +51 -0
- package/dist/errors/tunnel.js.map +1 -0
- package/dist/errors/validation.d.ts +36 -0
- package/dist/errors/validation.d.ts.map +1 -0
- package/dist/errors/validation.js +45 -0
- package/dist/errors/validation.js.map +1 -0
- package/dist/index.d.ts +12 -4
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/dist/logging/logger.js +179 -0
- package/dist/logging/logger.js.map +1 -0
- package/dist/logging/sampling.js +56 -0
- package/dist/logging/sampling.js.map +1 -0
- package/dist/logging/wide-event-emitter.js +108 -0
- package/dist/logging/wide-event-emitter.js.map +1 -0
- package/dist/logging/wide-event.js +167 -0
- package/dist/logging/wide-event.js.map +1 -0
- package/dist/plugin/dev-reader.d.ts.map +1 -1
- package/dist/plugin/dev-reader.js +8 -3
- package/dist/plugin/dev-reader.js.map +1 -1
- package/dist/plugin/interceptors/cache.js.map +1 -1
- package/dist/plugin/interceptors/retry.js +10 -2
- package/dist/plugin/interceptors/retry.js.map +1 -1
- package/dist/plugin/interceptors/telemetry.js +24 -9
- package/dist/plugin/interceptors/telemetry.js.map +1 -1
- package/dist/plugin/interceptors/timeout.js +4 -0
- package/dist/plugin/interceptors/timeout.js.map +1 -1
- package/dist/plugin/plugin.d.ts +38 -4
- package/dist/plugin/plugin.d.ts.map +1 -1
- package/dist/plugin/plugin.js +86 -5
- package/dist/plugin/plugin.js.map +1 -1
- package/dist/plugin/to-plugin.d.ts +4 -0
- package/dist/plugin/to-plugin.d.ts.map +1 -1
- package/dist/plugin/to-plugin.js +3 -0
- package/dist/plugin/to-plugin.js.map +1 -1
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +25 -21
- package/dist/server/index.js.map +1 -1
- package/dist/server/remote-tunnel/remote-tunnel-controller.js +4 -2
- package/dist/server/remote-tunnel/remote-tunnel-controller.js.map +1 -1
- package/dist/server/remote-tunnel/remote-tunnel-manager.js +10 -8
- package/dist/server/remote-tunnel/remote-tunnel-manager.js.map +1 -1
- package/dist/server/utils.js.map +1 -1
- package/dist/server/vite-dev-server.js +8 -5
- package/dist/server/vite-dev-server.js.map +1 -1
- package/dist/shared/src/sql/helpers.js.map +1 -1
- package/dist/stream/arrow-stream-processor.js +13 -6
- package/dist/stream/arrow-stream-processor.js.map +1 -1
- package/dist/stream/buffers.js +5 -1
- package/dist/stream/buffers.js.map +1 -1
- package/dist/stream/sse-writer.js.map +1 -1
- package/dist/stream/stream-manager.d.ts.map +1 -1
- package/dist/stream/stream-manager.js +47 -36
- package/dist/stream/stream-manager.js.map +1 -1
- package/dist/stream/stream-registry.js.map +1 -1
- package/dist/stream/types.js.map +1 -1
- package/dist/telemetry/index.d.ts +2 -2
- package/dist/telemetry/index.js +2 -2
- package/dist/telemetry/instrumentations.js +14 -10
- package/dist/telemetry/instrumentations.js.map +1 -1
- package/dist/telemetry/telemetry-manager.js +8 -6
- package/dist/telemetry/telemetry-manager.js.map +1 -1
- package/dist/telemetry/trace-sampler.js +33 -0
- package/dist/telemetry/trace-sampler.js.map +1 -0
- package/dist/type-generator/index.js +4 -2
- package/dist/type-generator/index.js.map +1 -1
- package/dist/type-generator/query-registry.js +4 -2
- package/dist/type-generator/query-registry.js.map +1 -1
- package/dist/type-generator/types.js.map +1 -1
- package/dist/type-generator/vite-plugin.d.ts.map +1 -1
- package/dist/type-generator/vite-plugin.js +5 -3
- package/dist/type-generator/vite-plugin.js.map +1 -1
- package/dist/utils/env-validator.js +5 -5
- package/dist/utils/env-validator.js.map +1 -1
- package/dist/utils/merge.js +1 -5
- package/dist/utils/merge.js.map +1 -1
- package/dist/utils/path-exclusions.js +66 -0
- package/dist/utils/path-exclusions.js.map +1 -0
- package/dist/utils/vite-config-merge.js +1 -5
- package/dist/utils/vite-config-merge.js.map +1 -1
- package/llms.txt +89 -12
- package/package.json +6 -1
- package/dist/utils/databricks-client-middleware.d.ts +0 -17
- package/dist/utils/databricks-client-middleware.d.ts.map +0 -1
- package/dist/utils/databricks-client-middleware.js +0 -117
- package/dist/utils/databricks-client-middleware.js.map +0 -1
- package/dist/utils/index.js +0 -26
- package/dist/utils/index.js.map +0 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
//#region src/errors/base.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Base error class for all AppKit errors.
|
|
4
|
+
* Provides a consistent structure for error handling across the framework.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* // Catching errors by type
|
|
9
|
+
* try {
|
|
10
|
+
* await lakebase.query("...");
|
|
11
|
+
* } catch (e) {
|
|
12
|
+
* if (e instanceof AuthenticationError) {
|
|
13
|
+
* // Re-authenticate
|
|
14
|
+
* } else if (e instanceof ConnectionError && e.isRetryable) {
|
|
15
|
+
* // Retry with backoff
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
*
|
|
19
|
+
* // Logging errors
|
|
20
|
+
* console.error(error.toJSON()); // Safe for logging, sensitive values redacted
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
declare abstract class AppKitError extends Error {
|
|
24
|
+
/** Error code for programmatic error handling */
|
|
25
|
+
abstract readonly code: string;
|
|
26
|
+
/** HTTP status code suggestion (can be overridden) */
|
|
27
|
+
abstract readonly statusCode: number;
|
|
28
|
+
/** Whether this error type is generally safe to retry */
|
|
29
|
+
abstract readonly isRetryable: boolean;
|
|
30
|
+
/** Optional cause of the error */
|
|
31
|
+
readonly cause?: Error;
|
|
32
|
+
/** Additional context for the error */
|
|
33
|
+
readonly context?: Record<string, unknown>;
|
|
34
|
+
constructor(message: string, options?: {
|
|
35
|
+
cause?: Error;
|
|
36
|
+
context?: Record<string, unknown>;
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
* Convert error to JSON for logging/serialization.
|
|
40
|
+
* Sensitive values in context are automatically redacted.
|
|
41
|
+
*/
|
|
42
|
+
toJSON(): Record<string, unknown>;
|
|
43
|
+
/**
|
|
44
|
+
* Create a human-readable string representation
|
|
45
|
+
*/
|
|
46
|
+
toString(): string;
|
|
47
|
+
/**
|
|
48
|
+
* Sanitize context by redacting sensitive field values
|
|
49
|
+
*/
|
|
50
|
+
private sanitizeContext;
|
|
51
|
+
/**
|
|
52
|
+
* Check if a field name matches sensitive patterns
|
|
53
|
+
*/
|
|
54
|
+
private isSensitiveField;
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
export { AppKitError };
|
|
58
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","names":[],"sources":["../../src/errors/base.ts"],"sourcesContent":[],"mappings":";;AAgCA;;;;;;;;;;;;;;;;;;;;uBAAsB,WAAA,SAAoB,KAAA;;;;;;;;mBAWvB;;qBAGE;;YAIG;cAAiB;;;;;;YAiB7B"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { __esmMin } from "../_virtual/rolldown_runtime.js";
|
|
2
|
+
|
|
3
|
+
//#region src/errors/base.ts
|
|
4
|
+
var SENSITIVE_FIELD_PATTERNS, AppKitError;
|
|
5
|
+
var init_base = __esmMin((() => {
|
|
6
|
+
SENSITIVE_FIELD_PATTERNS = [
|
|
7
|
+
/token/i,
|
|
8
|
+
/password/i,
|
|
9
|
+
/secret/i,
|
|
10
|
+
/credential/i,
|
|
11
|
+
/auth/i,
|
|
12
|
+
/key$/i,
|
|
13
|
+
/apikey/i
|
|
14
|
+
];
|
|
15
|
+
AppKitError = class extends Error {
|
|
16
|
+
constructor(message, options) {
|
|
17
|
+
super(message);
|
|
18
|
+
this.name = this.constructor.name;
|
|
19
|
+
this.cause = options?.cause;
|
|
20
|
+
this.context = options?.context;
|
|
21
|
+
if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Convert error to JSON for logging/serialization.
|
|
25
|
+
* Sensitive values in context are automatically redacted.
|
|
26
|
+
*/
|
|
27
|
+
toJSON() {
|
|
28
|
+
return {
|
|
29
|
+
name: this.name,
|
|
30
|
+
code: this.code,
|
|
31
|
+
message: this.message,
|
|
32
|
+
statusCode: this.statusCode,
|
|
33
|
+
isRetryable: this.isRetryable,
|
|
34
|
+
context: this.sanitizeContext(this.context),
|
|
35
|
+
cause: this.cause?.message,
|
|
36
|
+
stack: this.stack
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Create a human-readable string representation
|
|
41
|
+
*/
|
|
42
|
+
toString() {
|
|
43
|
+
let str = `${this.name} [${this.code}]: ${this.message}`;
|
|
44
|
+
if (this.cause) str += ` (caused by: ${this.cause.message})`;
|
|
45
|
+
return str;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Sanitize context by redacting sensitive field values
|
|
49
|
+
*/
|
|
50
|
+
sanitizeContext(context) {
|
|
51
|
+
if (!context) return void 0;
|
|
52
|
+
const sanitized = {};
|
|
53
|
+
for (const [key, value] of Object.entries(context)) if (this.isSensitiveField(key)) sanitized[key] = "[REDACTED]";
|
|
54
|
+
else if (typeof value === "object" && value !== null) sanitized[key] = Array.isArray(value) ? `[Array(${value.length})]` : "[Object]";
|
|
55
|
+
else sanitized[key] = value;
|
|
56
|
+
return sanitized;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Check if a field name matches sensitive patterns
|
|
60
|
+
*/
|
|
61
|
+
isSensitiveField(fieldName) {
|
|
62
|
+
return SENSITIVE_FIELD_PATTERNS.some((pattern) => pattern.test(fieldName));
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}));
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
init_base();
|
|
69
|
+
export { AppKitError, init_base };
|
|
70
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","names":[],"sources":["../../src/errors/base.ts"],"sourcesContent":["/** Fields that should be redacted in logs/serialization for security */\nconst SENSITIVE_FIELD_PATTERNS = [\n /token/i,\n /password/i,\n /secret/i,\n /credential/i,\n /auth/i,\n /key$/i,\n /apikey/i,\n];\n\n/**\n * Base error class for all AppKit errors.\n * Provides a consistent structure for error handling across the framework.\n *\n * @example\n * ```typescript\n * // Catching errors by type\n * try {\n * await lakebase.query(\"...\");\n * } catch (e) {\n * if (e instanceof AuthenticationError) {\n * // Re-authenticate\n * } else if (e instanceof ConnectionError && e.isRetryable) {\n * // Retry with backoff\n * }\n * }\n *\n * // Logging errors\n * console.error(error.toJSON()); // Safe for logging, sensitive values redacted\n * ```\n */\nexport abstract class AppKitError extends Error {\n /** Error code for programmatic error handling */\n abstract readonly code: string;\n\n /** HTTP status code suggestion (can be overridden) */\n abstract readonly statusCode: number;\n\n /** Whether this error type is generally safe to retry */\n abstract readonly isRetryable: boolean;\n\n /** Optional cause of the error */\n readonly cause?: Error;\n\n /** Additional context for the error */\n readonly context?: Record<string, unknown>;\n\n constructor(\n message: string,\n options?: { cause?: Error; context?: Record<string, unknown> },\n ) {\n super(message);\n this.name = this.constructor.name;\n this.cause = options?.cause;\n this.context = options?.context;\n\n // Maintains proper stack trace for where the error was thrown\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n }\n\n /**\n * Convert error to JSON for logging/serialization.\n * Sensitive values in context are automatically redacted.\n */\n toJSON(): Record<string, unknown> {\n return {\n name: this.name,\n code: this.code,\n message: this.message,\n statusCode: this.statusCode,\n isRetryable: this.isRetryable,\n context: this.sanitizeContext(this.context),\n cause: this.cause?.message,\n stack: this.stack,\n };\n }\n\n /**\n * Create a human-readable string representation\n */\n toString(): string {\n let str = `${this.name} [${this.code}]: ${this.message}`;\n if (this.cause) {\n str += ` (caused by: ${this.cause.message})`;\n }\n return str;\n }\n\n /**\n * Sanitize context by redacting sensitive field values\n */\n private sanitizeContext(\n context?: Record<string, unknown>,\n ): Record<string, unknown> | undefined {\n if (!context) return undefined;\n\n const sanitized: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(context)) {\n if (this.isSensitiveField(key)) {\n sanitized[key] = \"[REDACTED]\";\n } else if (typeof value === \"object\" && value !== null) {\n // Don't deep-sanitize nested objects, just indicate their type\n sanitized[key] = Array.isArray(value)\n ? `[Array(${value.length})]`\n : \"[Object]\";\n } else {\n sanitized[key] = value;\n }\n }\n return sanitized;\n }\n\n /**\n * Check if a field name matches sensitive patterns\n */\n private isSensitiveField(fieldName: string): boolean {\n return SENSITIVE_FIELD_PATTERNS.some((pattern) => pattern.test(fieldName));\n }\n}\n"],"mappings":";;;;;CACM,2BAA2B;EAC/B;EACA;EACA;EACA;EACA;EACA;EACA;EACD;CAuBqB,cAAtB,cAA0C,MAAM;EAgB9C,YACE,SACA,SACA;AACA,SAAM,QAAQ;AACd,QAAK,OAAO,KAAK,YAAY;AAC7B,QAAK,QAAQ,SAAS;AACtB,QAAK,UAAU,SAAS;AAGxB,OAAI,MAAM,kBACR,OAAM,kBAAkB,MAAM,KAAK,YAAY;;;;;;EAQnD,SAAkC;AAChC,UAAO;IACL,MAAM,KAAK;IACX,MAAM,KAAK;IACX,SAAS,KAAK;IACd,YAAY,KAAK;IACjB,aAAa,KAAK;IAClB,SAAS,KAAK,gBAAgB,KAAK,QAAQ;IAC3C,OAAO,KAAK,OAAO;IACnB,OAAO,KAAK;IACb;;;;;EAMH,WAAmB;GACjB,IAAI,MAAM,GAAG,KAAK,KAAK,IAAI,KAAK,KAAK,KAAK,KAAK;AAC/C,OAAI,KAAK,MACP,QAAO,gBAAgB,KAAK,MAAM,QAAQ;AAE5C,UAAO;;;;;EAMT,AAAQ,gBACN,SACqC;AACrC,OAAI,CAAC,QAAS,QAAO;GAErB,MAAM,YAAqC,EAAE;AAC7C,QAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,QAAQ,CAChD,KAAI,KAAK,iBAAiB,IAAI,CAC5B,WAAU,OAAO;YACR,OAAO,UAAU,YAAY,UAAU,KAEhD,WAAU,OAAO,MAAM,QAAQ,MAAM,GACjC,UAAU,MAAM,OAAO,MACvB;OAEJ,WAAU,OAAO;AAGrB,UAAO;;;;;EAMT,AAAQ,iBAAiB,WAA4B;AACnD,UAAO,yBAAyB,MAAM,YAAY,QAAQ,KAAK,UAAU,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AppKitError } from "./base.js";
|
|
2
|
+
|
|
3
|
+
//#region src/errors/configuration.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Error thrown when configuration is missing or invalid.
|
|
7
|
+
* Use for missing environment variables, invalid settings, or setup issues.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* throw new ConfigurationError("DATABRICKS_HOST environment variable is required");
|
|
12
|
+
* throw new ConfigurationError("Warehouse ID not found", { context: { env: "production" } });
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
declare class ConfigurationError extends AppKitError {
|
|
16
|
+
readonly code = "CONFIGURATION_ERROR";
|
|
17
|
+
readonly statusCode = 500;
|
|
18
|
+
readonly isRetryable = false;
|
|
19
|
+
/**
|
|
20
|
+
* Create a configuration error for missing environment variable
|
|
21
|
+
*/
|
|
22
|
+
static missingEnvVar(varName: string): ConfigurationError;
|
|
23
|
+
/**
|
|
24
|
+
* Create a configuration error for missing resource
|
|
25
|
+
*/
|
|
26
|
+
static resourceNotFound(resource: string, hint?: string): ConfigurationError;
|
|
27
|
+
/**
|
|
28
|
+
* Create a configuration error for invalid connection config
|
|
29
|
+
*/
|
|
30
|
+
static invalidConnection(service: string, details?: string): ConfigurationError;
|
|
31
|
+
/**
|
|
32
|
+
* Create a configuration error for missing connection string parameter
|
|
33
|
+
*/
|
|
34
|
+
static missingConnectionParam(param: string): ConfigurationError;
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { ConfigurationError };
|
|
38
|
+
//# sourceMappingURL=configuration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.d.ts","names":[],"sources":["../../src/errors/configuration.ts"],"sourcesContent":[],"mappings":";;;;;;AAYA;;;;;;;;cAAa,kBAAA,SAA2B,WAAA;;;;;;;yCAQC;;;;4DAUmB;;;;+DAavD;;;;gDAU2C"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { __esmMin } from "../_virtual/rolldown_runtime.js";
|
|
2
|
+
import { AppKitError, init_base } from "./base.js";
|
|
3
|
+
|
|
4
|
+
//#region src/errors/configuration.ts
|
|
5
|
+
var ConfigurationError;
|
|
6
|
+
var init_configuration = __esmMin((() => {
|
|
7
|
+
init_base();
|
|
8
|
+
ConfigurationError = class ConfigurationError extends AppKitError {
|
|
9
|
+
constructor(..._args) {
|
|
10
|
+
super(..._args);
|
|
11
|
+
this.code = "CONFIGURATION_ERROR";
|
|
12
|
+
this.statusCode = 500;
|
|
13
|
+
this.isRetryable = false;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Create a configuration error for missing environment variable
|
|
17
|
+
*/
|
|
18
|
+
static missingEnvVar(varName) {
|
|
19
|
+
return new ConfigurationError(`${varName} environment variable is required`, { context: { envVar: varName } });
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Create a configuration error for missing resource
|
|
23
|
+
*/
|
|
24
|
+
static resourceNotFound(resource, hint) {
|
|
25
|
+
return new ConfigurationError(hint ? `${resource} not found. ${hint}` : `${resource} not found`, { context: { resource } });
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Create a configuration error for invalid connection config
|
|
29
|
+
*/
|
|
30
|
+
static invalidConnection(service, details) {
|
|
31
|
+
return new ConfigurationError(details ? `${service} connection not configured. ${details}` : `${service} connection not configured`, { context: { service } });
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Create a configuration error for missing connection string parameter
|
|
35
|
+
*/
|
|
36
|
+
static missingConnectionParam(param) {
|
|
37
|
+
return new ConfigurationError(`Connection string must include ${param} parameter`, { context: { parameter: param } });
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}));
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
init_configuration();
|
|
44
|
+
export { ConfigurationError, init_configuration };
|
|
45
|
+
//# sourceMappingURL=configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.js","names":[],"sources":["../../src/errors/configuration.ts"],"sourcesContent":["import { AppKitError } from \"./base\";\n\n/**\n * Error thrown when configuration is missing or invalid.\n * Use for missing environment variables, invalid settings, or setup issues.\n *\n * @example\n * ```typescript\n * throw new ConfigurationError(\"DATABRICKS_HOST environment variable is required\");\n * throw new ConfigurationError(\"Warehouse ID not found\", { context: { env: \"production\" } });\n * ```\n */\nexport class ConfigurationError extends AppKitError {\n readonly code = \"CONFIGURATION_ERROR\";\n readonly statusCode = 500;\n readonly isRetryable = false;\n\n /**\n * Create a configuration error for missing environment variable\n */\n static missingEnvVar(varName: string): ConfigurationError {\n return new ConfigurationError(\n `${varName} environment variable is required`,\n { context: { envVar: varName } },\n );\n }\n\n /**\n * Create a configuration error for missing resource\n */\n static resourceNotFound(resource: string, hint?: string): ConfigurationError {\n const message = hint\n ? `${resource} not found. ${hint}`\n : `${resource} not found`;\n return new ConfigurationError(message, { context: { resource } });\n }\n\n /**\n * Create a configuration error for invalid connection config\n */\n static invalidConnection(\n service: string,\n details?: string,\n ): ConfigurationError {\n const message = details\n ? `${service} connection not configured. ${details}`\n : `${service} connection not configured`;\n return new ConfigurationError(message, { context: { service } });\n }\n\n /**\n * Create a configuration error for missing connection string parameter\n */\n static missingConnectionParam(param: string): ConfigurationError {\n return new ConfigurationError(\n `Connection string must include ${param} parameter`,\n { context: { parameter: param } },\n );\n }\n}\n"],"mappings":";;;;;;YAAqC;CAYxB,qBAAb,MAAa,2BAA2B,YAAY;;;eAClC;qBACM;sBACC;;;;;EAKvB,OAAO,cAAc,SAAqC;AACxD,UAAO,IAAI,mBACT,GAAG,QAAQ,oCACX,EAAE,SAAS,EAAE,QAAQ,SAAS,EAAE,CACjC;;;;;EAMH,OAAO,iBAAiB,UAAkB,MAAmC;AAI3E,UAAO,IAAI,mBAHK,OACZ,GAAG,SAAS,cAAc,SAC1B,GAAG,SAAS,aACuB,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;;;;;EAMnE,OAAO,kBACL,SACA,SACoB;AAIpB,UAAO,IAAI,mBAHK,UACZ,GAAG,QAAQ,8BAA8B,YACzC,GAAG,QAAQ,6BACwB,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;;;;;EAMlE,OAAO,uBAAuB,OAAmC;AAC/D,UAAO,IAAI,mBACT,kCAAkC,MAAM,aACxC,EAAE,SAAS,EAAE,WAAW,OAAO,EAAE,CAClC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { AppKitError } from "./base.js";
|
|
2
|
+
|
|
3
|
+
//#region src/errors/connection.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Error thrown when a connection or network operation fails.
|
|
7
|
+
* Use for database pool errors, API failures, timeouts, etc.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* throw new ConnectionError("Query failed", { cause: pgError });
|
|
12
|
+
* throw new ConnectionError("No response received from SQL Warehouse API");
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
declare class ConnectionError extends AppKitError {
|
|
16
|
+
readonly code = "CONNECTION_ERROR";
|
|
17
|
+
readonly statusCode = 503;
|
|
18
|
+
readonly isRetryable = true;
|
|
19
|
+
/**
|
|
20
|
+
* Create a connection error for query failure
|
|
21
|
+
*/
|
|
22
|
+
static queryFailed(cause?: Error): ConnectionError;
|
|
23
|
+
/**
|
|
24
|
+
* Create a connection error for transaction failure
|
|
25
|
+
*/
|
|
26
|
+
static transactionFailed(cause?: Error): ConnectionError;
|
|
27
|
+
/**
|
|
28
|
+
* Create a connection error for pool errors
|
|
29
|
+
*/
|
|
30
|
+
static poolError(operation: string, cause?: Error): ConnectionError;
|
|
31
|
+
/**
|
|
32
|
+
* Create a connection error for API failures
|
|
33
|
+
*/
|
|
34
|
+
static apiFailure(service: string, cause?: Error): ConnectionError;
|
|
35
|
+
/**
|
|
36
|
+
* Create a connection error for client unavailable
|
|
37
|
+
*/
|
|
38
|
+
static clientUnavailable(clientType: string, hint?: string): ConnectionError;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { ConnectionError };
|
|
42
|
+
//# sourceMappingURL=connection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.d.ts","names":[],"sources":["../../src/errors/connection.ts"],"sourcesContent":[],"mappings":";;;;;;AAYA;;;;;;;;AA+B6C,cA/BhC,eAAA,SAAwB,WAAA,CA+BQ;WAAQ,IAAA,GAAA,kBAAA;WAUU,UAAA,GAAA,GAAA;WAzC1B,WAAA,GAAA,IAAA;EAAW;;;6BAQnB,QAAQ;;;;mCAOF,QAAQ;;;;8CAOG,QAAQ;;;;6CAST,QAAQ;;;;+DAUU"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { __esmMin } from "../_virtual/rolldown_runtime.js";
|
|
2
|
+
import { AppKitError, init_base } from "./base.js";
|
|
3
|
+
|
|
4
|
+
//#region src/errors/connection.ts
|
|
5
|
+
var ConnectionError;
|
|
6
|
+
var init_connection = __esmMin((() => {
|
|
7
|
+
init_base();
|
|
8
|
+
ConnectionError = class ConnectionError extends AppKitError {
|
|
9
|
+
constructor(..._args) {
|
|
10
|
+
super(..._args);
|
|
11
|
+
this.code = "CONNECTION_ERROR";
|
|
12
|
+
this.statusCode = 503;
|
|
13
|
+
this.isRetryable = true;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Create a connection error for query failure
|
|
17
|
+
*/
|
|
18
|
+
static queryFailed(cause) {
|
|
19
|
+
return new ConnectionError("Query failed", { cause });
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Create a connection error for transaction failure
|
|
23
|
+
*/
|
|
24
|
+
static transactionFailed(cause) {
|
|
25
|
+
return new ConnectionError("Transaction failed", { cause });
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Create a connection error for pool errors
|
|
29
|
+
*/
|
|
30
|
+
static poolError(operation, cause) {
|
|
31
|
+
return new ConnectionError(`Connection pool error: ${operation}`, { cause });
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Create a connection error for API failures
|
|
35
|
+
*/
|
|
36
|
+
static apiFailure(service, cause) {
|
|
37
|
+
return new ConnectionError(`No response received from ${service} API`, {
|
|
38
|
+
cause,
|
|
39
|
+
context: { service }
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Create a connection error for client unavailable
|
|
44
|
+
*/
|
|
45
|
+
static clientUnavailable(clientType, hint) {
|
|
46
|
+
return new ConnectionError(hint ? `${clientType} not available. ${hint}` : `${clientType} not available`, { context: { clientType } });
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}));
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
init_connection();
|
|
53
|
+
export { ConnectionError, init_connection };
|
|
54
|
+
//# sourceMappingURL=connection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.js","names":[],"sources":["../../src/errors/connection.ts"],"sourcesContent":["import { AppKitError } from \"./base\";\n\n/**\n * Error thrown when a connection or network operation fails.\n * Use for database pool errors, API failures, timeouts, etc.\n *\n * @example\n * ```typescript\n * throw new ConnectionError(\"Query failed\", { cause: pgError });\n * throw new ConnectionError(\"No response received from SQL Warehouse API\");\n * ```\n */\nexport class ConnectionError extends AppKitError {\n readonly code = \"CONNECTION_ERROR\";\n readonly statusCode = 503;\n readonly isRetryable = true;\n\n /**\n * Create a connection error for query failure\n */\n static queryFailed(cause?: Error): ConnectionError {\n return new ConnectionError(\"Query failed\", { cause });\n }\n\n /**\n * Create a connection error for transaction failure\n */\n static transactionFailed(cause?: Error): ConnectionError {\n return new ConnectionError(\"Transaction failed\", { cause });\n }\n\n /**\n * Create a connection error for pool errors\n */\n static poolError(operation: string, cause?: Error): ConnectionError {\n return new ConnectionError(`Connection pool error: ${operation}`, {\n cause,\n });\n }\n\n /**\n * Create a connection error for API failures\n */\n static apiFailure(service: string, cause?: Error): ConnectionError {\n return new ConnectionError(`No response received from ${service} API`, {\n cause,\n context: { service },\n });\n }\n\n /**\n * Create a connection error for client unavailable\n */\n static clientUnavailable(clientType: string, hint?: string): ConnectionError {\n const message = hint\n ? `${clientType} not available. ${hint}`\n : `${clientType} not available`;\n return new ConnectionError(message, { context: { clientType } });\n }\n}\n"],"mappings":";;;;;;YAAqC;CAYxB,kBAAb,MAAa,wBAAwB,YAAY;;;eAC/B;qBACM;sBACC;;;;;EAKvB,OAAO,YAAY,OAAgC;AACjD,UAAO,IAAI,gBAAgB,gBAAgB,EAAE,OAAO,CAAC;;;;;EAMvD,OAAO,kBAAkB,OAAgC;AACvD,UAAO,IAAI,gBAAgB,sBAAsB,EAAE,OAAO,CAAC;;;;;EAM7D,OAAO,UAAU,WAAmB,OAAgC;AAClE,UAAO,IAAI,gBAAgB,0BAA0B,aAAa,EAChE,OACD,CAAC;;;;;EAMJ,OAAO,WAAW,SAAiB,OAAgC;AACjE,UAAO,IAAI,gBAAgB,6BAA6B,QAAQ,OAAO;IACrE;IACA,SAAS,EAAE,SAAS;IACrB,CAAC;;;;;EAMJ,OAAO,kBAAkB,YAAoB,MAAgC;AAI3E,UAAO,IAAI,gBAHK,OACZ,GAAG,WAAW,kBAAkB,SAChC,GAAG,WAAW,iBACkB,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { AppKitError } from "./base.js";
|
|
2
|
+
|
|
3
|
+
//#region src/errors/execution.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Error thrown when an operation execution fails.
|
|
7
|
+
* Use for statement failures, canceled operations, or unexpected states.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* throw new ExecutionError("Statement failed: syntax error");
|
|
12
|
+
* throw new ExecutionError("Statement was canceled");
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
declare class ExecutionError extends AppKitError {
|
|
16
|
+
readonly code = "EXECUTION_ERROR";
|
|
17
|
+
readonly statusCode = 500;
|
|
18
|
+
readonly isRetryable = false;
|
|
19
|
+
/**
|
|
20
|
+
* Create an execution error for statement failure
|
|
21
|
+
*/
|
|
22
|
+
static statementFailed(errorMessage?: string): ExecutionError;
|
|
23
|
+
/**
|
|
24
|
+
* Create an execution error for canceled operation
|
|
25
|
+
*/
|
|
26
|
+
static canceled(): ExecutionError;
|
|
27
|
+
/**
|
|
28
|
+
* Create an execution error for closed/expired results
|
|
29
|
+
*/
|
|
30
|
+
static resultsClosed(): ExecutionError;
|
|
31
|
+
/**
|
|
32
|
+
* Create an execution error for unknown state
|
|
33
|
+
*/
|
|
34
|
+
static unknownState(state: string): ExecutionError;
|
|
35
|
+
/**
|
|
36
|
+
* Create an execution error for missing data
|
|
37
|
+
*/
|
|
38
|
+
static missingData(dataType: string): ExecutionError;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { ExecutionError };
|
|
42
|
+
//# sourceMappingURL=execution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution.d.ts","names":[],"sources":["../../src/errors/execution.ts"],"sourcesContent":[],"mappings":";;;;;;AAYA;;;;;;;;AAA+C,cAAlC,cAAA,SAAuB,WAAA,CAAW;;;;;;;iDAQE;;;;qBAU5B;;;;0BAOK;;;;sCASY;;;;wCASE"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { __esmMin } from "../_virtual/rolldown_runtime.js";
|
|
2
|
+
import { AppKitError, init_base } from "./base.js";
|
|
3
|
+
|
|
4
|
+
//#region src/errors/execution.ts
|
|
5
|
+
var ExecutionError;
|
|
6
|
+
var init_execution = __esmMin((() => {
|
|
7
|
+
init_base();
|
|
8
|
+
ExecutionError = class ExecutionError extends AppKitError {
|
|
9
|
+
constructor(..._args) {
|
|
10
|
+
super(..._args);
|
|
11
|
+
this.code = "EXECUTION_ERROR";
|
|
12
|
+
this.statusCode = 500;
|
|
13
|
+
this.isRetryable = false;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Create an execution error for statement failure
|
|
17
|
+
*/
|
|
18
|
+
static statementFailed(errorMessage) {
|
|
19
|
+
return new ExecutionError(errorMessage ? `Statement failed: ${errorMessage}` : "Statement failed: Unknown error");
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Create an execution error for canceled operation
|
|
23
|
+
*/
|
|
24
|
+
static canceled() {
|
|
25
|
+
return new ExecutionError("Statement was canceled");
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Create an execution error for closed/expired results
|
|
29
|
+
*/
|
|
30
|
+
static resultsClosed() {
|
|
31
|
+
return new ExecutionError("Statement execution completed but results are no longer available (CLOSED state)");
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Create an execution error for unknown state
|
|
35
|
+
*/
|
|
36
|
+
static unknownState(state) {
|
|
37
|
+
return new ExecutionError(`Unknown statement state: ${state}`, { context: { state } });
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Create an execution error for missing data
|
|
41
|
+
*/
|
|
42
|
+
static missingData(dataType) {
|
|
43
|
+
return new ExecutionError(`No ${dataType} found in response`, { context: { dataType } });
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}));
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
init_execution();
|
|
50
|
+
export { ExecutionError, init_execution };
|
|
51
|
+
//# sourceMappingURL=execution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution.js","names":[],"sources":["../../src/errors/execution.ts"],"sourcesContent":["import { AppKitError } from \"./base\";\n\n/**\n * Error thrown when an operation execution fails.\n * Use for statement failures, canceled operations, or unexpected states.\n *\n * @example\n * ```typescript\n * throw new ExecutionError(\"Statement failed: syntax error\");\n * throw new ExecutionError(\"Statement was canceled\");\n * ```\n */\nexport class ExecutionError extends AppKitError {\n readonly code = \"EXECUTION_ERROR\";\n readonly statusCode = 500;\n readonly isRetryable = false;\n\n /**\n * Create an execution error for statement failure\n */\n static statementFailed(errorMessage?: string): ExecutionError {\n const message = errorMessage\n ? `Statement failed: ${errorMessage}`\n : \"Statement failed: Unknown error\";\n return new ExecutionError(message);\n }\n\n /**\n * Create an execution error for canceled operation\n */\n static canceled(): ExecutionError {\n return new ExecutionError(\"Statement was canceled\");\n }\n\n /**\n * Create an execution error for closed/expired results\n */\n static resultsClosed(): ExecutionError {\n return new ExecutionError(\n \"Statement execution completed but results are no longer available (CLOSED state)\",\n );\n }\n\n /**\n * Create an execution error for unknown state\n */\n static unknownState(state: string): ExecutionError {\n return new ExecutionError(`Unknown statement state: ${state}`, {\n context: { state },\n });\n }\n\n /**\n * Create an execution error for missing data\n */\n static missingData(dataType: string): ExecutionError {\n return new ExecutionError(`No ${dataType} found in response`, {\n context: { dataType },\n });\n }\n}\n"],"mappings":";;;;;;YAAqC;CAYxB,iBAAb,MAAa,uBAAuB,YAAY;;;eAC9B;qBACM;sBACC;;;;;EAKvB,OAAO,gBAAgB,cAAuC;AAI5D,UAAO,IAAI,eAHK,eACZ,qBAAqB,iBACrB,kCAC8B;;;;;EAMpC,OAAO,WAA2B;AAChC,UAAO,IAAI,eAAe,yBAAyB;;;;;EAMrD,OAAO,gBAAgC;AACrC,UAAO,IAAI,eACT,mFACD;;;;;EAMH,OAAO,aAAa,OAA+B;AACjD,UAAO,IAAI,eAAe,4BAA4B,SAAS,EAC7D,SAAS,EAAE,OAAO,EACnB,CAAC;;;;;EAMJ,OAAO,YAAY,UAAkC;AACnD,UAAO,IAAI,eAAe,MAAM,SAAS,qBAAqB,EAC5D,SAAS,EAAE,UAAU,EACtB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { __esmMin } from "../_virtual/rolldown_runtime.js";
|
|
2
|
+
import { AppKitError, init_base } from "./base.js";
|
|
3
|
+
import { AuthenticationError, init_authentication } from "./authentication.js";
|
|
4
|
+
import { ConfigurationError, init_configuration } from "./configuration.js";
|
|
5
|
+
import { ConnectionError, init_connection } from "./connection.js";
|
|
6
|
+
import { ExecutionError, init_execution } from "./execution.js";
|
|
7
|
+
import { InitializationError, init_initialization } from "./initialization.js";
|
|
8
|
+
import { ServerError, init_server } from "./server.js";
|
|
9
|
+
import { TunnelError, init_tunnel } from "./tunnel.js";
|
|
10
|
+
import { ValidationError, init_validation } from "./validation.js";
|
|
11
|
+
|
|
12
|
+
//#region src/errors/index.ts
|
|
13
|
+
var init_errors = __esmMin((() => {
|
|
14
|
+
init_authentication();
|
|
15
|
+
init_base();
|
|
16
|
+
init_configuration();
|
|
17
|
+
init_connection();
|
|
18
|
+
init_execution();
|
|
19
|
+
init_initialization();
|
|
20
|
+
init_server();
|
|
21
|
+
init_tunnel();
|
|
22
|
+
init_validation();
|
|
23
|
+
}));
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
init_errors();
|
|
27
|
+
export { init_errors };
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/errors/index.ts"],"sourcesContent":["/**\n * AppKit Error Classes\n *\n * Standardized error classes for consistent error handling across the framework.\n *\n * @example\n * ```typescript\n * import { ValidationError, AuthenticationError } from \"@databricks/appkit\";\n *\n * // Validation errors\n * throw new ValidationError(\"Invalid parameter value\");\n * throw ValidationError.missingField(\"warehouseId\");\n *\n * // Authentication errors\n * throw AuthenticationError.missingToken();\n *\n * // Configuration errors\n * throw ConfigurationError.missingEnvVar(\"DATABRICKS_HOST\");\n * ```\n */\n\nexport { AuthenticationError } from \"./authentication\";\nexport { AppKitError } from \"./base\";\nexport { ConfigurationError } from \"./configuration\";\nexport { ConnectionError } from \"./connection\";\nexport { ExecutionError } from \"./execution\";\nexport { InitializationError } from \"./initialization\";\nexport { ServerError } from \"./server\";\nexport { TunnelError } from \"./tunnel\";\nexport { ValidationError } from \"./validation\";\n"],"mappings":";;;;;;;;;;;;;sBAqBuD;YAClB;qBACgB;kBACN;iBACF;sBACU;cAChB;cACA;kBACQ"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { AppKitError } from "./base.js";
|
|
2
|
+
|
|
3
|
+
//#region src/errors/initialization.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Error thrown when a service or component is not properly initialized.
|
|
7
|
+
* Use when accessing services before they are ready.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* throw new InitializationError("CacheManager not initialized");
|
|
12
|
+
* throw new InitializationError("ServiceContext not initialized. Call ServiceContext.initialize() first.");
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
declare class InitializationError extends AppKitError {
|
|
16
|
+
readonly code = "INITIALIZATION_ERROR";
|
|
17
|
+
readonly statusCode = 500;
|
|
18
|
+
readonly isRetryable = true;
|
|
19
|
+
/**
|
|
20
|
+
* Create an initialization error for a service that is not ready
|
|
21
|
+
*/
|
|
22
|
+
static notInitialized(serviceName: string, hint?: string): InitializationError;
|
|
23
|
+
/**
|
|
24
|
+
* Create an initialization error for setup failure
|
|
25
|
+
*/
|
|
26
|
+
static setupFailed(component: string, cause?: Error): InitializationError;
|
|
27
|
+
/**
|
|
28
|
+
* Create an initialization error for migration failure
|
|
29
|
+
*/
|
|
30
|
+
static migrationFailed(cause?: Error): InitializationError;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { InitializationError };
|
|
34
|
+
//# sourceMappingURL=initialization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initialization.d.ts","names":[],"sources":["../../src/errors/initialization.ts"],"sourcesContent":[],"mappings":";;;;;;AAYA;;;;;;;;AAAoD,cAAvC,mBAAA,SAA4B,WAAA,CAAW;;;;;;;6DAW/C;;;;gDAY2C,QAAQ;;;;iCAUvB,QAAQ"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { __esmMin } from "../_virtual/rolldown_runtime.js";
|
|
2
|
+
import { AppKitError, init_base } from "./base.js";
|
|
3
|
+
|
|
4
|
+
//#region src/errors/initialization.ts
|
|
5
|
+
var InitializationError;
|
|
6
|
+
var init_initialization = __esmMin((() => {
|
|
7
|
+
init_base();
|
|
8
|
+
InitializationError = class InitializationError extends AppKitError {
|
|
9
|
+
constructor(..._args) {
|
|
10
|
+
super(..._args);
|
|
11
|
+
this.code = "INITIALIZATION_ERROR";
|
|
12
|
+
this.statusCode = 500;
|
|
13
|
+
this.isRetryable = true;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Create an initialization error for a service that is not ready
|
|
17
|
+
*/
|
|
18
|
+
static notInitialized(serviceName, hint) {
|
|
19
|
+
return new InitializationError(hint ? `${serviceName} not initialized. ${hint}` : `${serviceName} not initialized`, { context: { service: serviceName } });
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Create an initialization error for setup failure
|
|
23
|
+
*/
|
|
24
|
+
static setupFailed(component, cause) {
|
|
25
|
+
return new InitializationError(`Failed to initialize ${component}`, {
|
|
26
|
+
cause,
|
|
27
|
+
context: { component }
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Create an initialization error for migration failure
|
|
32
|
+
*/
|
|
33
|
+
static migrationFailed(cause) {
|
|
34
|
+
return new InitializationError("Error in running migrations for persistent storage", { cause });
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}));
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
init_initialization();
|
|
41
|
+
export { InitializationError, init_initialization };
|
|
42
|
+
//# sourceMappingURL=initialization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initialization.js","names":[],"sources":["../../src/errors/initialization.ts"],"sourcesContent":["import { AppKitError } from \"./base\";\n\n/**\n * Error thrown when a service or component is not properly initialized.\n * Use when accessing services before they are ready.\n *\n * @example\n * ```typescript\n * throw new InitializationError(\"CacheManager not initialized\");\n * throw new InitializationError(\"ServiceContext not initialized. Call ServiceContext.initialize() first.\");\n * ```\n */\nexport class InitializationError extends AppKitError {\n readonly code = \"INITIALIZATION_ERROR\";\n readonly statusCode = 500;\n readonly isRetryable = true;\n\n /**\n * Create an initialization error for a service that is not ready\n */\n static notInitialized(\n serviceName: string,\n hint?: string,\n ): InitializationError {\n const message = hint\n ? `${serviceName} not initialized. ${hint}`\n : `${serviceName} not initialized`;\n return new InitializationError(message, {\n context: { service: serviceName },\n });\n }\n\n /**\n * Create an initialization error for setup failure\n */\n static setupFailed(component: string, cause?: Error): InitializationError {\n return new InitializationError(`Failed to initialize ${component}`, {\n cause,\n context: { component },\n });\n }\n\n /**\n * Create an initialization error for migration failure\n */\n static migrationFailed(cause?: Error): InitializationError {\n return new InitializationError(\n \"Error in running migrations for persistent storage\",\n { cause },\n );\n }\n}\n"],"mappings":";;;;;;YAAqC;CAYxB,sBAAb,MAAa,4BAA4B,YAAY;;;eACnC;qBACM;sBACC;;;;;EAKvB,OAAO,eACL,aACA,MACqB;AAIrB,UAAO,IAAI,oBAHK,OACZ,GAAG,YAAY,oBAAoB,SACnC,GAAG,YAAY,mBACqB,EACtC,SAAS,EAAE,SAAS,aAAa,EAClC,CAAC;;;;;EAMJ,OAAO,YAAY,WAAmB,OAAoC;AACxE,UAAO,IAAI,oBAAoB,wBAAwB,aAAa;IAClE;IACA,SAAS,EAAE,WAAW;IACvB,CAAC;;;;;EAMJ,OAAO,gBAAgB,OAAoC;AACzD,UAAO,IAAI,oBACT,sDACA,EAAE,OAAO,CACV"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AppKitError } from "./base.js";
|
|
2
|
+
|
|
3
|
+
//#region src/errors/server.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Error thrown when server lifecycle operations fail.
|
|
7
|
+
* Use for server start/stop issues, configuration conflicts, etc.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* throw new ServerError("Cannot get server when autoStart is true");
|
|
12
|
+
* throw new ServerError("Server not started");
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
declare class ServerError extends AppKitError {
|
|
16
|
+
readonly code = "SERVER_ERROR";
|
|
17
|
+
readonly statusCode = 500;
|
|
18
|
+
readonly isRetryable = false;
|
|
19
|
+
/**
|
|
20
|
+
* Create a server error for autoStart conflict
|
|
21
|
+
*/
|
|
22
|
+
static autoStartConflict(operation: string): ServerError;
|
|
23
|
+
/**
|
|
24
|
+
* Create a server error for server not started
|
|
25
|
+
*/
|
|
26
|
+
static notStarted(): ServerError;
|
|
27
|
+
/**
|
|
28
|
+
* Create a server error for Vite dev server not initialized
|
|
29
|
+
*/
|
|
30
|
+
static viteNotInitialized(): ServerError;
|
|
31
|
+
/**
|
|
32
|
+
* Create a server error for missing client directory
|
|
33
|
+
*/
|
|
34
|
+
static clientDirectoryNotFound(searchedPaths: string[]): ServerError;
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { ServerError };
|
|
38
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","names":[],"sources":["../../src/errors/server.ts"],"sourcesContent":[],"mappings":";;;;;;AAYA;;;;;;;;cAAa,WAAA,SAAoB,WAAA;;;;;;;+CAQc;;;;uBASxB;;;;+BASQ;;;;2DAO4B"}
|