@databricks/appkit 0.36.0 → 0.38.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/CLAUDE.md +3 -2
- package/NOTICE.md +1 -0
- package/dist/appkit/package.js +1 -1
- package/dist/cache/index.js +1 -2
- package/dist/cache/index.js.map +1 -1
- package/dist/cache/storage/persistent.js +1 -2
- package/dist/cache/storage/persistent.js.map +1 -1
- package/dist/cli/commands/plugin/add-resource/add-resource.js.map +1 -1
- package/dist/cli/commands/plugin/create/resource-defaults.js +2 -1
- package/dist/cli/commands/plugin/create/resource-defaults.js.map +1 -1
- package/dist/cli/commands/plugin/schema-resources.js +34 -51
- package/dist/cli/commands/plugin/schema-resources.js.map +1 -1
- package/dist/cli/commands/plugin/sync/sync.js +20 -6
- package/dist/cli/commands/plugin/sync/sync.js.map +1 -1
- package/dist/cli/commands/plugin/validate/validate-manifest.js +71 -157
- package/dist/cli/commands/plugin/validate/validate-manifest.js.map +1 -1
- package/dist/cli/commands/plugin/validate/validate.js +2 -2
- package/dist/cli/commands/plugin/validate/validate.js.map +1 -1
- package/dist/cli/commands/setup.js +2 -2
- package/dist/cli/commands/setup.js.map +1 -1
- package/dist/connectors/index.js +0 -1
- package/dist/connectors/jobs/client.js +1 -2
- package/dist/connectors/jobs/client.js.map +1 -1
- package/dist/connectors/lakebase/routing-pool.js +1 -2
- package/dist/connectors/lakebase/routing-pool.js.map +1 -1
- package/dist/connectors/sql-warehouse/client.js +1 -2
- package/dist/connectors/sql-warehouse/client.js.map +1 -1
- package/dist/context/execution-context.js +9 -13
- package/dist/context/execution-context.js.map +1 -1
- package/dist/context/index.js +3 -13
- package/dist/context/service-context.js +137 -136
- package/dist/context/service-context.js.map +1 -1
- package/dist/context/user-context.js +1 -5
- package/dist/context/user-context.js.map +1 -1
- package/dist/core/agent/create-agent.js +1 -2
- package/dist/core/agent/create-agent.js.map +1 -1
- package/dist/core/appkit.d.ts.map +1 -1
- package/dist/core/appkit.js +9 -37
- package/dist/core/appkit.js.map +1 -1
- package/dist/errors/authentication.js +44 -40
- package/dist/errors/authentication.js.map +1 -1
- package/dist/errors/base.js +86 -70
- package/dist/errors/base.js.map +1 -1
- package/dist/errors/configuration.js +70 -66
- package/dist/errors/configuration.js.map +1 -1
- package/dist/errors/connection.js +50 -46
- package/dist/errors/connection.js.map +1 -1
- package/dist/errors/execution.js +47 -43
- package/dist/errors/execution.js.map +1 -1
- package/dist/errors/index.js +10 -27
- package/dist/errors/initialization.js +38 -34
- package/dist/errors/initialization.js.map +1 -1
- package/dist/errors/server.js +34 -31
- package/dist/errors/server.js.map +1 -1
- package/dist/errors/tunnel.js +47 -43
- package/dist/errors/tunnel.js.map +1 -1
- package/dist/errors/validation.js +41 -37
- package/dist/errors/validation.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -9
- package/dist/plugin/dev-reader.js +1 -2
- package/dist/plugin/dev-reader.js.map +1 -1
- package/dist/plugin/interceptors/retry.js +1 -2
- package/dist/plugin/interceptors/retry.js.map +1 -1
- package/dist/plugin/interceptors/telemetry.js +1 -2
- package/dist/plugin/interceptors/telemetry.js.map +1 -1
- package/dist/plugin/plugin.d.ts +12 -4
- package/dist/plugin/plugin.d.ts.map +1 -1
- package/dist/plugin/plugin.js +59 -28
- package/dist/plugin/plugin.js.map +1 -1
- package/dist/plugins/agents/agents.d.ts +56 -3
- package/dist/plugins/agents/agents.d.ts.map +1 -1
- package/dist/plugins/agents/agents.js +160 -8
- package/dist/plugins/agents/agents.js.map +1 -1
- package/dist/plugins/agents/schemas.js +0 -1
- package/dist/plugins/agents/schemas.js.map +1 -1
- package/dist/plugins/analytics/analytics.js +1 -2
- package/dist/plugins/analytics/analytics.js.map +1 -1
- package/dist/plugins/analytics/manifest.js +9 -1
- package/dist/plugins/analytics/query.js +2 -4
- package/dist/plugins/analytics/query.js.map +1 -1
- package/dist/plugins/files/manifest.js +7 -1
- package/dist/plugins/files/plugin.js +3 -6
- package/dist/plugins/files/plugin.js.map +1 -1
- package/dist/plugins/genie/genie.js +1 -2
- package/dist/plugins/genie/genie.js.map +1 -1
- package/dist/plugins/genie/manifest.js +7 -1
- package/dist/plugins/jobs/plugin.js +2 -4
- package/dist/plugins/jobs/plugin.js.map +1 -1
- package/dist/plugins/lakebase/lakebase.js +1 -2
- package/dist/plugins/lakebase/lakebase.js.map +1 -1
- package/dist/plugins/lakebase/manifest.js +26 -4
- package/dist/plugins/server/index.js +1 -2
- package/dist/plugins/server/index.js.map +1 -1
- package/dist/plugins/server/vite-dev-server.js +1 -2
- package/dist/plugins/server/vite-dev-server.js.map +1 -1
- package/dist/plugins/serving/serving.js +1 -2
- package/dist/plugins/serving/serving.js.map +1 -1
- package/dist/registry/index.d.ts +1 -1
- package/dist/registry/manifest-loader.d.ts +4 -4
- package/dist/registry/manifest-loader.d.ts.map +1 -1
- package/dist/registry/manifest-loader.js +1 -2
- package/dist/registry/manifest-loader.js.map +1 -1
- package/dist/registry/resource-registry.js +1 -2
- package/dist/registry/resource-registry.js.map +1 -1
- package/dist/registry/types.d.ts +21 -7
- package/dist/registry/types.d.ts.map +1 -1
- package/dist/registry/types.generated.d.ts +1 -1
- package/dist/registry/types.generated.js +1 -1
- package/dist/registry/types.generated.js.map +1 -1
- package/dist/registry/types.js +3 -3
- package/dist/registry/types.js.map +1 -1
- package/dist/schemas/manifest.d.ts +1139 -0
- package/dist/schemas/manifest.d.ts.map +1 -0
- package/dist/schemas/manifest.js +524 -0
- package/dist/schemas/manifest.js.map +1 -0
- package/dist/shared/src/index.d.ts +1 -1
- package/dist/shared/src/plugin.d.ts +38 -7
- package/dist/shared/src/plugin.d.ts.map +1 -1
- package/dist/shared/src/schemas/manifest.d.ts +1110 -0
- package/dist/shared/src/schemas/manifest.d.ts.map +1 -0
- package/dist/stream/arrow-stream-processor.js +1 -2
- package/dist/stream/arrow-stream-processor.js.map +1 -1
- package/dist/stream/buffers.js +1 -2
- package/dist/stream/buffers.js.map +1 -1
- package/docs/api/appkit/Enumeration.ResourceType.md +1 -1
- package/docs/api/appkit/Interface.PluginManifest.md +57 -3
- package/docs/api/appkit/Interface.ResourceEntry.md +6 -4
- package/docs/api/appkit/Interface.ResourceRequirement.md +7 -61
- package/docs/api/appkit/TypeAlias.ResourceFieldEntry.md +6 -0
- package/docs/api/appkit/Variable.agents.md +1 -1
- package/docs/api/appkit.md +12 -12
- package/docs/app-management.md +1 -1
- package/docs/development/ai-assisted-development.md +2 -2
- package/docs/development/local-development.md +1 -1
- package/docs/development/remote-bridge.md +1 -1
- package/docs/development/templates.md +118 -12
- package/docs/development.md +1 -1
- package/docs/plugins/agents.md +8 -4
- package/docs/plugins/custom-plugins.md +33 -23
- package/docs/plugins/lakebase.md +1 -1
- package/docs/plugins/manifest.md +293 -0
- package/docs.md +2 -2
- package/llms.txt +3 -2
- package/package.json +3 -3
- package/sbom.cdx.json +1 -1
- package/dist/_virtual/_rolldown/runtime.js +0 -7
- package/dist/connectors/lakebase-v1/client.js +0 -15
- package/dist/connectors/lakebase-v1/client.js.map +0 -1
- package/dist/connectors/lakebase-v1/index.js +0 -3
- package/dist/context/index.js.map +0 -1
- package/dist/errors/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/schemas/plugin-manifest.generated.d.ts +0 -182
- package/dist/schemas/plugin-manifest.generated.d.ts.map +0 -1
- package/dist/schemas/plugin-manifest.schema.json +0 -489
- package/dist/schemas/template-plugins.schema.json +0 -113
- package/dist/shared/src/schemas/plugin-manifest.generated.d.ts +0 -182
- package/dist/shared/src/schemas/plugin-manifest.generated.d.ts.map +0 -1
- package/docs/api/appkit/Interface.ResourceFieldEntry.md +0 -82
package/dist/errors/execution.js
CHANGED
|
@@ -1,48 +1,52 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AppKitError, init_base } from "./base.js";
|
|
1
|
+
import { AppKitError } from "./base.js";
|
|
3
2
|
|
|
4
3
|
//#region src/errors/execution.ts
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Error thrown when an operation execution fails.
|
|
6
|
+
* Use for statement failures, canceled operations, or unexpected states.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* throw new ExecutionError("Statement failed: syntax error");
|
|
11
|
+
* throw new ExecutionError("Statement was canceled");
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
var ExecutionError = class ExecutionError extends AppKitError {
|
|
15
|
+
code = "EXECUTION_ERROR";
|
|
16
|
+
statusCode = 500;
|
|
17
|
+
isRetryable = false;
|
|
18
|
+
/**
|
|
19
|
+
* Create an execution error for statement failure
|
|
20
|
+
*/
|
|
21
|
+
static statementFailed(errorMessage) {
|
|
22
|
+
return new ExecutionError(errorMessage ? `Statement failed: ${errorMessage}` : "Statement failed: Unknown error");
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Create an execution error for canceled operation
|
|
26
|
+
*/
|
|
27
|
+
static canceled() {
|
|
28
|
+
return new ExecutionError("Statement was canceled");
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Create an execution error for closed/expired results
|
|
32
|
+
*/
|
|
33
|
+
static resultsClosed() {
|
|
34
|
+
return new ExecutionError("Statement execution completed but results are no longer available (CLOSED state)");
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Create an execution error for unknown state
|
|
38
|
+
*/
|
|
39
|
+
static unknownState(state) {
|
|
40
|
+
return new ExecutionError(`Unknown statement state: ${state}`, { context: { state } });
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Create an execution error for missing data
|
|
44
|
+
*/
|
|
45
|
+
static missingData(dataType) {
|
|
46
|
+
return new ExecutionError(`No ${dataType} found in response`, { context: { dataType } });
|
|
47
|
+
}
|
|
48
|
+
};
|
|
44
49
|
|
|
45
50
|
//#endregion
|
|
46
|
-
|
|
47
|
-
export { ExecutionError, init_execution };
|
|
51
|
+
export { ExecutionError };
|
|
48
52
|
//# sourceMappingURL=execution.js.map
|
|
@@ -1 +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":"
|
|
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":";;;;;;;;;;;;;AAYA,IAAa,iBAAb,MAAa,uBAAuB,YAAY;CAC9C,AAAS,OAAO;CAChB,AAAS,aAAa;CACtB,AAAS,cAAc;;;;CAKvB,OAAO,gBAAgB,cAAuC;AAI5D,SAAO,IAAI,eAHK,eACZ,qBAAqB,iBACrB,kCAC8B;;;;;CAMpC,OAAO,WAA2B;AAChC,SAAO,IAAI,eAAe,yBAAyB;;;;;CAMrD,OAAO,gBAAgC;AACrC,SAAO,IAAI,eACT,mFACD;;;;;CAMH,OAAO,aAAa,OAA+B;AACjD,SAAO,IAAI,eAAe,4BAA4B,SAAS,EAC7D,SAAS,EAAE,OAAO,EACnB,CAAC;;;;;CAMJ,OAAO,YAAY,UAAkC;AACnD,SAAO,IAAI,eAAe,MAAM,SAAS,qBAAqB,EAC5D,SAAS,EAAE,UAAU,EACtB,CAAC"}
|
package/dist/errors/index.js
CHANGED
|
@@ -1,28 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { ValidationError, init_validation } from "./validation.js";
|
|
1
|
+
import { AppKitError } from "./base.js";
|
|
2
|
+
import { AuthenticationError } from "./authentication.js";
|
|
3
|
+
import { ConfigurationError } from "./configuration.js";
|
|
4
|
+
import { ConnectionError } from "./connection.js";
|
|
5
|
+
import { ExecutionError } from "./execution.js";
|
|
6
|
+
import { InitializationError } from "./initialization.js";
|
|
7
|
+
import { ServerError } from "./server.js";
|
|
8
|
+
import { TunnelError } from "./tunnel.js";
|
|
9
|
+
import { ValidationError } from "./validation.js";
|
|
11
10
|
|
|
12
|
-
|
|
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
|
|
11
|
+
export { };
|
|
@@ -1,39 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AppKitError, init_base } from "./base.js";
|
|
1
|
+
import { AppKitError } from "./base.js";
|
|
3
2
|
|
|
4
3
|
//#region src/errors/initialization.ts
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Error thrown when a service or component is not properly initialized.
|
|
6
|
+
* Use when accessing services before they are ready.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* throw new InitializationError("CacheManager not initialized");
|
|
11
|
+
* throw new InitializationError("ServiceContext not initialized. Call ServiceContext.initialize() first.");
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
var InitializationError = class InitializationError extends AppKitError {
|
|
15
|
+
code = "INITIALIZATION_ERROR";
|
|
16
|
+
statusCode = 500;
|
|
17
|
+
isRetryable = true;
|
|
18
|
+
/**
|
|
19
|
+
* Create an initialization error for a service that is not ready
|
|
20
|
+
*/
|
|
21
|
+
static notInitialized(serviceName, hint) {
|
|
22
|
+
return new InitializationError(hint ? `${serviceName} not initialized. ${hint}` : `${serviceName} not initialized`, { context: { service: serviceName } });
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Create an initialization error for setup failure
|
|
26
|
+
*/
|
|
27
|
+
static setupFailed(component, cause) {
|
|
28
|
+
return new InitializationError(`Failed to initialize ${component}`, {
|
|
29
|
+
cause,
|
|
30
|
+
context: { component }
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Create an initialization error for migration failure
|
|
35
|
+
*/
|
|
36
|
+
static migrationFailed(cause) {
|
|
37
|
+
return new InitializationError("Error in running migrations for persistent storage", { cause });
|
|
38
|
+
}
|
|
39
|
+
};
|
|
35
40
|
|
|
36
41
|
//#endregion
|
|
37
|
-
|
|
38
|
-
export { InitializationError, init_initialization };
|
|
42
|
+
export { InitializationError };
|
|
39
43
|
//# sourceMappingURL=initialization.js.map
|
|
@@ -1 +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":"
|
|
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":";;;;;;;;;;;;;AAYA,IAAa,sBAAb,MAAa,4BAA4B,YAAY;CACnD,AAAS,OAAO;CAChB,AAAS,aAAa;CACtB,AAAS,cAAc;;;;CAKvB,OAAO,eACL,aACA,MACqB;AAIrB,SAAO,IAAI,oBAHK,OACZ,GAAG,YAAY,oBAAoB,SACnC,GAAG,YAAY,mBACqB,EACtC,SAAS,EAAE,SAAS,aAAa,EAClC,CAAC;;;;;CAMJ,OAAO,YAAY,WAAmB,OAAoC;AACxE,SAAO,IAAI,oBAAoB,wBAAwB,aAAa;GAClE;GACA,SAAS,EAAE,WAAW;GACvB,CAAC;;;;;CAMJ,OAAO,gBAAgB,OAAoC;AACzD,SAAO,IAAI,oBACT,sDACA,EAAE,OAAO,CACV"}
|
package/dist/errors/server.js
CHANGED
|
@@ -1,36 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AppKitError, init_base } from "./base.js";
|
|
1
|
+
import { AppKitError } from "./base.js";
|
|
3
2
|
|
|
4
3
|
//#region src/errors/server.ts
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Error thrown when server lifecycle operations fail.
|
|
6
|
+
* Use for server start/stop issues, configuration conflicts, etc.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* throw new ServerError("Server not started");
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
var ServerError = class ServerError extends AppKitError {
|
|
14
|
+
code = "SERVER_ERROR";
|
|
15
|
+
statusCode = 500;
|
|
16
|
+
isRetryable = false;
|
|
17
|
+
/**
|
|
18
|
+
* Create a server error for server not started
|
|
19
|
+
*/
|
|
20
|
+
static notStarted() {
|
|
21
|
+
return new ServerError("Server not started. Please start the server first by calling the start() method");
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Create a server error for Vite dev server not initialized
|
|
25
|
+
*/
|
|
26
|
+
static viteNotInitialized() {
|
|
27
|
+
return new ServerError("Vite dev server not initialized");
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Create a server error for missing client directory
|
|
31
|
+
*/
|
|
32
|
+
static clientDirectoryNotFound(searchedPaths) {
|
|
33
|
+
return new ServerError(`Could not find client directory. Searched for vite.config.ts/js + index.html in: ${searchedPaths.join(", ")}`, { context: { searchedPaths } });
|
|
34
|
+
}
|
|
35
|
+
};
|
|
32
36
|
|
|
33
37
|
//#endregion
|
|
34
|
-
|
|
35
|
-
export { ServerError, init_server };
|
|
38
|
+
export { ServerError };
|
|
36
39
|
//# sourceMappingURL=server.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","names":[],"sources":["../../src/errors/server.ts"],"sourcesContent":["import { AppKitError } from \"./base\";\n\n/**\n * Error thrown when server lifecycle operations fail.\n * Use for server start/stop issues, configuration conflicts, etc.\n *\n * @example\n * ```typescript\n * throw new ServerError(\"Server not started\");\n * ```\n */\nexport class ServerError extends AppKitError {\n readonly code = \"SERVER_ERROR\";\n readonly statusCode = 500;\n readonly isRetryable = false;\n\n /**\n * Create a server error for server not started\n */\n static notStarted(): ServerError {\n return new ServerError(\n \"Server not started. Please start the server first by calling the start() method\",\n );\n }\n\n /**\n * Create a server error for Vite dev server not initialized\n */\n static viteNotInitialized(): ServerError {\n return new ServerError(\"Vite dev server not initialized\");\n }\n\n /**\n * Create a server error for missing client directory\n */\n static clientDirectoryNotFound(searchedPaths: string[]): ServerError {\n return new ServerError(\n `Could not find client directory. Searched for vite.config.ts/js + index.html in: ${searchedPaths.join(\", \")}`,\n { context: { searchedPaths } },\n );\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"server.js","names":[],"sources":["../../src/errors/server.ts"],"sourcesContent":["import { AppKitError } from \"./base\";\n\n/**\n * Error thrown when server lifecycle operations fail.\n * Use for server start/stop issues, configuration conflicts, etc.\n *\n * @example\n * ```typescript\n * throw new ServerError(\"Server not started\");\n * ```\n */\nexport class ServerError extends AppKitError {\n readonly code = \"SERVER_ERROR\";\n readonly statusCode = 500;\n readonly isRetryable = false;\n\n /**\n * Create a server error for server not started\n */\n static notStarted(): ServerError {\n return new ServerError(\n \"Server not started. Please start the server first by calling the start() method\",\n );\n }\n\n /**\n * Create a server error for Vite dev server not initialized\n */\n static viteNotInitialized(): ServerError {\n return new ServerError(\"Vite dev server not initialized\");\n }\n\n /**\n * Create a server error for missing client directory\n */\n static clientDirectoryNotFound(searchedPaths: string[]): ServerError {\n return new ServerError(\n `Could not find client directory. Searched for vite.config.ts/js + index.html in: ${searchedPaths.join(\", \")}`,\n { context: { searchedPaths } },\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;AAWA,IAAa,cAAb,MAAa,oBAAoB,YAAY;CAC3C,AAAS,OAAO;CAChB,AAAS,aAAa;CACtB,AAAS,cAAc;;;;CAKvB,OAAO,aAA0B;AAC/B,SAAO,IAAI,YACT,kFACD;;;;;CAMH,OAAO,qBAAkC;AACvC,SAAO,IAAI,YAAY,kCAAkC;;;;;CAM3D,OAAO,wBAAwB,eAAsC;AACnE,SAAO,IAAI,YACT,oFAAoF,cAAc,KAAK,KAAK,IAC5G,EAAE,SAAS,EAAE,eAAe,EAAE,CAC/B"}
|
package/dist/errors/tunnel.js
CHANGED
|
@@ -1,48 +1,52 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AppKitError, init_base } from "./base.js";
|
|
1
|
+
import { AppKitError } from "./base.js";
|
|
3
2
|
|
|
4
3
|
//#region src/errors/tunnel.ts
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Error thrown when remote tunnel operations fail.
|
|
6
|
+
* Use for tunnel connection issues, message parsing failures, etc.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* throw new TunnelError("No tunnel connection available");
|
|
11
|
+
* throw new TunnelError("Failed to parse WebSocket message", { cause: parseError });
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
var TunnelError = class TunnelError extends AppKitError {
|
|
15
|
+
code = "TUNNEL_ERROR";
|
|
16
|
+
statusCode = 502;
|
|
17
|
+
isRetryable = true;
|
|
18
|
+
/**
|
|
19
|
+
* Create a tunnel error for missing tunnel getter
|
|
20
|
+
*/
|
|
21
|
+
static getterNotRegistered() {
|
|
22
|
+
return new TunnelError("Tunnel getter not registered for DevFileReader singleton");
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Create a tunnel error for no available connection
|
|
26
|
+
*/
|
|
27
|
+
static noConnection() {
|
|
28
|
+
return new TunnelError("No tunnel connection available for file read");
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Create a tunnel error for asset fetch failure
|
|
32
|
+
*/
|
|
33
|
+
static fetchFailed(path, cause) {
|
|
34
|
+
return new TunnelError("Failed to fetch asset", {
|
|
35
|
+
cause,
|
|
36
|
+
context: { path }
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Create a tunnel error for message parsing failure
|
|
41
|
+
*/
|
|
42
|
+
static parseError(messageType, cause) {
|
|
43
|
+
return new TunnelError(`Failed to parse ${messageType} message`, {
|
|
44
|
+
cause,
|
|
45
|
+
context: { messageType }
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
};
|
|
44
49
|
|
|
45
50
|
//#endregion
|
|
46
|
-
|
|
47
|
-
export { TunnelError, init_tunnel };
|
|
51
|
+
export { TunnelError };
|
|
48
52
|
//# sourceMappingURL=tunnel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tunnel.js","names":[],"sources":["../../src/errors/tunnel.ts"],"sourcesContent":["import { AppKitError } from \"./base\";\n\n/**\n * Error thrown when remote tunnel operations fail.\n * Use for tunnel connection issues, message parsing failures, etc.\n *\n * @example\n * ```typescript\n * throw new TunnelError(\"No tunnel connection available\");\n * throw new TunnelError(\"Failed to parse WebSocket message\", { cause: parseError });\n * ```\n */\nexport class TunnelError extends AppKitError {\n readonly code = \"TUNNEL_ERROR\";\n readonly statusCode = 502;\n readonly isRetryable = true;\n\n /**\n * Create a tunnel error for missing tunnel getter\n */\n static getterNotRegistered(): TunnelError {\n return new TunnelError(\n \"Tunnel getter not registered for DevFileReader singleton\",\n );\n }\n\n /**\n * Create a tunnel error for no available connection\n */\n static noConnection(): TunnelError {\n return new TunnelError(\"No tunnel connection available for file read\");\n }\n\n /**\n * Create a tunnel error for asset fetch failure\n */\n static fetchFailed(path: string, cause?: Error): TunnelError {\n return new TunnelError(\"Failed to fetch asset\", {\n cause,\n context: { path },\n });\n }\n\n /**\n * Create a tunnel error for message parsing failure\n */\n static parseError(messageType: string, cause?: Error): TunnelError {\n return new TunnelError(`Failed to parse ${messageType} message`, {\n cause,\n context: { messageType },\n });\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tunnel.js","names":[],"sources":["../../src/errors/tunnel.ts"],"sourcesContent":["import { AppKitError } from \"./base\";\n\n/**\n * Error thrown when remote tunnel operations fail.\n * Use for tunnel connection issues, message parsing failures, etc.\n *\n * @example\n * ```typescript\n * throw new TunnelError(\"No tunnel connection available\");\n * throw new TunnelError(\"Failed to parse WebSocket message\", { cause: parseError });\n * ```\n */\nexport class TunnelError extends AppKitError {\n readonly code = \"TUNNEL_ERROR\";\n readonly statusCode = 502;\n readonly isRetryable = true;\n\n /**\n * Create a tunnel error for missing tunnel getter\n */\n static getterNotRegistered(): TunnelError {\n return new TunnelError(\n \"Tunnel getter not registered for DevFileReader singleton\",\n );\n }\n\n /**\n * Create a tunnel error for no available connection\n */\n static noConnection(): TunnelError {\n return new TunnelError(\"No tunnel connection available for file read\");\n }\n\n /**\n * Create a tunnel error for asset fetch failure\n */\n static fetchFailed(path: string, cause?: Error): TunnelError {\n return new TunnelError(\"Failed to fetch asset\", {\n cause,\n context: { path },\n });\n }\n\n /**\n * Create a tunnel error for message parsing failure\n */\n static parseError(messageType: string, cause?: Error): TunnelError {\n return new TunnelError(`Failed to parse ${messageType} message`, {\n cause,\n context: { messageType },\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAYA,IAAa,cAAb,MAAa,oBAAoB,YAAY;CAC3C,AAAS,OAAO;CAChB,AAAS,aAAa;CACtB,AAAS,cAAc;;;;CAKvB,OAAO,sBAAmC;AACxC,SAAO,IAAI,YACT,2DACD;;;;;CAMH,OAAO,eAA4B;AACjC,SAAO,IAAI,YAAY,+CAA+C;;;;;CAMxE,OAAO,YAAY,MAAc,OAA4B;AAC3D,SAAO,IAAI,YAAY,yBAAyB;GAC9C;GACA,SAAS,EAAE,MAAM;GAClB,CAAC;;;;;CAMJ,OAAO,WAAW,aAAqB,OAA4B;AACjE,SAAO,IAAI,YAAY,mBAAmB,YAAY,WAAW;GAC/D;GACA,SAAS,EAAE,aAAa;GACzB,CAAC"}
|
|
@@ -1,42 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AppKitError, init_base } from "./base.js";
|
|
1
|
+
import { AppKitError } from "./base.js";
|
|
3
2
|
|
|
4
3
|
//#region src/errors/validation.ts
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Error thrown when input validation fails.
|
|
6
|
+
* Use for invalid parameters, missing required fields, or type mismatches.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* throw new ValidationError("Statement is required", { context: { field: "statement" } });
|
|
11
|
+
* throw new ValidationError("maxPoolSize must be at least 1", { context: { value: config.maxPoolSize } });
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
var ValidationError = class ValidationError extends AppKitError {
|
|
15
|
+
code = "VALIDATION_ERROR";
|
|
16
|
+
statusCode = 400;
|
|
17
|
+
isRetryable = false;
|
|
18
|
+
/**
|
|
19
|
+
* Create a validation error for a missing required field
|
|
20
|
+
*/
|
|
21
|
+
static missingField(fieldName) {
|
|
22
|
+
return new ValidationError(`Missing required field: ${fieldName}`, { context: { field: fieldName } });
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Create a validation error for an invalid field value.
|
|
26
|
+
* Note: The actual value is not stored in context for security reasons.
|
|
27
|
+
* Only the value's type is recorded.
|
|
28
|
+
*/
|
|
29
|
+
static invalidValue(fieldName, value, expected) {
|
|
30
|
+
return new ValidationError(expected ? `Invalid value for ${fieldName}: expected ${expected}` : `Invalid value for ${fieldName}`, { context: {
|
|
31
|
+
field: fieldName,
|
|
32
|
+
valueType: value === null ? "null" : typeof value,
|
|
33
|
+
expected
|
|
34
|
+
} });
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Create a validation error for missing environment variables
|
|
38
|
+
*/
|
|
39
|
+
static missingEnvVars(vars) {
|
|
40
|
+
return new ValidationError(`Missing required environment variables: ${vars.join(", ")}`, { context: { missingVars: vars } });
|
|
41
|
+
}
|
|
42
|
+
};
|
|
38
43
|
|
|
39
44
|
//#endregion
|
|
40
|
-
|
|
41
|
-
export { ValidationError, init_validation };
|
|
45
|
+
export { ValidationError };
|
|
42
46
|
//# sourceMappingURL=validation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","names":[],"sources":["../../src/errors/validation.ts"],"sourcesContent":["import { AppKitError } from \"./base\";\n\n/**\n * Error thrown when input validation fails.\n * Use for invalid parameters, missing required fields, or type mismatches.\n *\n * @example\n * ```typescript\n * throw new ValidationError(\"Statement is required\", { context: { field: \"statement\" } });\n * throw new ValidationError(\"maxPoolSize must be at least 1\", { context: { value: config.maxPoolSize } });\n * ```\n */\nexport class ValidationError extends AppKitError {\n readonly code = \"VALIDATION_ERROR\";\n readonly statusCode = 400;\n readonly isRetryable = false;\n\n /**\n * Create a validation error for a missing required field\n */\n static missingField(fieldName: string): ValidationError {\n return new ValidationError(`Missing required field: ${fieldName}`, {\n context: { field: fieldName },\n });\n }\n\n /**\n * Create a validation error for an invalid field value.\n * Note: The actual value is not stored in context for security reasons.\n * Only the value's type is recorded.\n */\n static invalidValue(\n fieldName: string,\n value: unknown,\n expected?: string,\n ): ValidationError {\n const msg = expected\n ? `Invalid value for ${fieldName}: expected ${expected}`\n : `Invalid value for ${fieldName}`;\n return new ValidationError(msg, {\n context: {\n field: fieldName,\n valueType: value === null ? \"null\" : typeof value,\n expected,\n },\n });\n }\n\n /**\n * Create a validation error for missing environment variables\n */\n static missingEnvVars(vars: string[]): ValidationError {\n return new ValidationError(\n `Missing required environment variables: ${vars.join(\", \")}`,\n { context: { missingVars: vars } },\n );\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"validation.js","names":[],"sources":["../../src/errors/validation.ts"],"sourcesContent":["import { AppKitError } from \"./base\";\n\n/**\n * Error thrown when input validation fails.\n * Use for invalid parameters, missing required fields, or type mismatches.\n *\n * @example\n * ```typescript\n * throw new ValidationError(\"Statement is required\", { context: { field: \"statement\" } });\n * throw new ValidationError(\"maxPoolSize must be at least 1\", { context: { value: config.maxPoolSize } });\n * ```\n */\nexport class ValidationError extends AppKitError {\n readonly code = \"VALIDATION_ERROR\";\n readonly statusCode = 400;\n readonly isRetryable = false;\n\n /**\n * Create a validation error for a missing required field\n */\n static missingField(fieldName: string): ValidationError {\n return new ValidationError(`Missing required field: ${fieldName}`, {\n context: { field: fieldName },\n });\n }\n\n /**\n * Create a validation error for an invalid field value.\n * Note: The actual value is not stored in context for security reasons.\n * Only the value's type is recorded.\n */\n static invalidValue(\n fieldName: string,\n value: unknown,\n expected?: string,\n ): ValidationError {\n const msg = expected\n ? `Invalid value for ${fieldName}: expected ${expected}`\n : `Invalid value for ${fieldName}`;\n return new ValidationError(msg, {\n context: {\n field: fieldName,\n valueType: value === null ? \"null\" : typeof value,\n expected,\n },\n });\n }\n\n /**\n * Create a validation error for missing environment variables\n */\n static missingEnvVars(vars: string[]): ValidationError {\n return new ValidationError(\n `Missing required environment variables: ${vars.join(\", \")}`,\n { context: { missingVars: vars } },\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAYA,IAAa,kBAAb,MAAa,wBAAwB,YAAY;CAC/C,AAAS,OAAO;CAChB,AAAS,aAAa;CACtB,AAAS,cAAc;;;;CAKvB,OAAO,aAAa,WAAoC;AACtD,SAAO,IAAI,gBAAgB,2BAA2B,aAAa,EACjE,SAAS,EAAE,OAAO,WAAW,EAC9B,CAAC;;;;;;;CAQJ,OAAO,aACL,WACA,OACA,UACiB;AAIjB,SAAO,IAAI,gBAHC,WACR,qBAAqB,UAAU,aAAa,aAC5C,qBAAqB,aACO,EAC9B,SAAS;GACP,OAAO;GACP,WAAW,UAAU,OAAO,SAAS,OAAO;GAC5C;GACD,EACF,CAAC;;;;;CAMJ,OAAO,eAAe,MAAiC;AACrD,SAAO,IAAI,gBACT,2CAA2C,KAAK,KAAK,KAAK,IAC1D,EAAE,SAAS,EAAE,aAAa,MAAM,EAAE,CACnC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ResourceFieldEntry } from "./shared/src/schemas/
|
|
1
|
+
import { ResourceFieldEntry } from "./shared/src/schemas/manifest.js";
|
|
2
2
|
import { BasePluginConfig, IAppRouter, PluginData, ToPlugin } from "./shared/src/plugin.js";
|
|
3
3
|
import { CacheConfig } from "./shared/src/cache.js";
|
|
4
4
|
import { StreamExecutionSettings } from "./shared/src/execute.js";
|
package/dist/index.js
CHANGED
|
@@ -10,12 +10,12 @@ import { InitializationError } from "./errors/initialization.js";
|
|
|
10
10
|
import { ServerError } from "./errors/server.js";
|
|
11
11
|
import { TunnelError } from "./errors/tunnel.js";
|
|
12
12
|
import { ValidationError } from "./errors/validation.js";
|
|
13
|
-
import
|
|
13
|
+
import "./errors/index.js";
|
|
14
14
|
import { getExecutionContext } from "./context/execution-context.js";
|
|
15
15
|
import { RequestedClaimsPermissionSet, createLakebasePool, generateDatabaseCredential, getLakebaseOrmConfig, getLakebasePgConfig, getUsernameWithApiLookup, getWorkspaceClient } from "./connectors/lakebase/index.js";
|
|
16
16
|
import { SeverityNumber, SpanStatusCode } from "./telemetry/index.js";
|
|
17
17
|
import { CacheManager } from "./cache/index.js";
|
|
18
|
-
import
|
|
18
|
+
import "./context/index.js";
|
|
19
19
|
import { Plugin } from "./plugin/plugin.js";
|
|
20
20
|
import { ResourceType } from "./registry/types.generated.js";
|
|
21
21
|
import { getPluginManifest, getResourceRequirements } from "./registry/manifest-loader.js";
|
|
@@ -38,10 +38,4 @@ import { server } from "./plugins/server/index.js";
|
|
|
38
38
|
import { serving } from "./plugins/serving/serving.js";
|
|
39
39
|
import "./plugins/ga-exports.generated.js";
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
init_context();
|
|
43
|
-
init_errors();
|
|
44
|
-
|
|
45
|
-
//#endregion
|
|
46
|
-
export { AppKitError, AuthenticationError, CacheManager, ConfigurationError, ConnectionError, ExecutionError, InitializationError, Plugin, PolicyDeniedError, READ_ACTIONS, RequestedClaimsPermissionSet, ResourceRegistry, ResourceType, ServerError, SeverityNumber, SpanStatusCode, TunnelError, ValidationError, WRITE_ACTIONS, analytics, appKitServingTypesPlugin, appKitTypesPlugin, createApp, createLakebasePool, createLakebasePoolManager, extractServingEndpoints, files, findServerFile, generateDatabaseCredential, genie, getExecutionContext, getLakebaseOrmConfig, getLakebasePgConfig, getPluginManifest, getResourceRequirements, getUsernameWithApiLookup, getWorkspaceClient, isSQLTypeMarker, jobs, lakebase, server, serving, sql, toPlugin };
|
|
47
|
-
//# sourceMappingURL=index.js.map
|
|
41
|
+
export { AppKitError, AuthenticationError, CacheManager, ConfigurationError, ConnectionError, ExecutionError, InitializationError, Plugin, PolicyDeniedError, READ_ACTIONS, RequestedClaimsPermissionSet, ResourceRegistry, ResourceType, ServerError, SeverityNumber, SpanStatusCode, TunnelError, ValidationError, WRITE_ACTIONS, analytics, appKitServingTypesPlugin, appKitTypesPlugin, createApp, createLakebasePool, createLakebasePoolManager, extractServingEndpoints, files, findServerFile, generateDatabaseCredential, genie, getExecutionContext, getLakebaseOrmConfig, getLakebasePgConfig, getPluginManifest, getResourceRequirements, getUsernameWithApiLookup, getWorkspaceClient, isSQLTypeMarker, jobs, lakebase, server, serving, sql, toPlugin };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { createLogger } from "../logging/logger.js";
|
|
2
2
|
import { TunnelError } from "../errors/tunnel.js";
|
|
3
|
-
import
|
|
3
|
+
import "../errors/index.js";
|
|
4
4
|
import { isRemoteTunnelAllowedByEnv } from "../plugins/server/remote-tunnel/gate.js";
|
|
5
5
|
import { randomUUID } from "node:crypto";
|
|
6
6
|
|
|
7
7
|
//#region src/plugin/dev-reader.ts
|
|
8
|
-
init_errors();
|
|
9
8
|
const logger = createLogger("plugin:dev-reader");
|
|
10
9
|
/**
|
|
11
10
|
* This class is used to read files from the local filesystem in dev mode
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-reader.js","names":[],"sources":["../../src/plugin/dev-reader.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport type { TunnelConnection } from \"shared\";\nimport { TunnelError } from \"../errors\";\nimport { createLogger } from \"../logging/logger\";\nimport { isRemoteTunnelAllowedByEnv } from \"../plugins/server/remote-tunnel/gate\";\n\nconst logger = createLogger(\"plugin:dev-reader\");\n\ntype TunnelConnectionGetter = (\n req: import(\"express\").Request,\n) => TunnelConnection | null;\n\n/**\n * This class is used to read files from the local filesystem in dev mode\n * through the WebSocket tunnel.\n */\nexport class DevFileReader {\n private static instance: DevFileReader | null = null;\n private getTunnelForRequest: TunnelConnectionGetter | null = null;\n\n private constructor() {}\n\n static getInstance(): DevFileReader {\n if (!DevFileReader.instance) {\n DevFileReader.instance = new Proxy(new DevFileReader(), {\n /**\n * We proxy the reader to return a noop function if the remote server is disabled.\n */\n get(target, prop, receiver) {\n if (isRemoteTunnelAllowedByEnv()) {\n return Reflect.get(target, prop, receiver);\n }\n\n const value = Reflect.get(target, prop, receiver);\n\n if (typeof value === \"function\") {\n return function noop() {\n logger.debug(\"Noop: %s (remote server disabled)\", String(prop));\n return Promise.resolve(\"\");\n };\n }\n\n return value;\n },\n set(target, prop, value, receiver) {\n return Reflect.set(target, prop, value, receiver);\n },\n });\n }\n\n return DevFileReader.instance;\n }\n\n registerTunnelGetter(getter: TunnelConnectionGetter) {\n this.getTunnelForRequest = getter;\n }\n\n async readFile(\n filePath: string,\n req: import(\"express\").Request,\n ): Promise<string> {\n if (!this.getTunnelForRequest) {\n throw TunnelError.getterNotRegistered();\n }\n const tunnel = this.getTunnelForRequest(req);\n\n if (!tunnel) {\n throw TunnelError.noConnection();\n }\n\n const { ws, pendingFileReads } = tunnel;\n const requestId = randomUUID();\n\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => {\n pendingFileReads.delete(requestId);\n reject(new Error(`File read timeout: ${filePath}`));\n }, 10000);\n\n pendingFileReads.set(requestId, { resolve, reject, timeout });\n\n ws.send(\n JSON.stringify({\n type: \"file:read\",\n requestId,\n path: filePath,\n }),\n );\n });\n }\n\n async readdir(\n dirPath: string,\n req: import(\"express\").Request,\n ): Promise<string[]> {\n if (!this.getTunnelForRequest) {\n throw TunnelError.getterNotRegistered();\n }\n const tunnel = this.getTunnelForRequest(req);\n\n if (!tunnel) {\n throw TunnelError.noConnection();\n }\n\n const { ws, pendingFileReads } = tunnel;\n const requestId = randomUUID();\n\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => {\n pendingFileReads.delete(requestId);\n reject(new Error(`Directory read timeout: ${dirPath}`));\n }, 10000);\n\n pendingFileReads.set(requestId, {\n resolve: (data: string) => {\n try {\n const files = JSON.parse(data);\n // Validate it's an array of strings\n if (!Array.isArray(files)) {\n reject(\n new Error(\n \"Invalid directory listing format: expected array, got \" +\n typeof files,\n ),\n );\n return;\n }\n if (!files.every((f) => typeof f === \"string\")) {\n reject(\n new Error(\n \"Invalid directory listing format: expected array of strings\",\n ),\n );\n return;\n }\n resolve(files);\n } catch (error) {\n reject(\n new Error(\n `Failed to parse directory listing: ${(error as Error).message}`,\n ),\n );\n }\n },\n reject,\n timeout,\n });\n\n ws.send(\n JSON.stringify({\n type: \"dir:list\",\n requestId,\n path: dirPath,\n }),\n );\n });\n }\n}\n"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"dev-reader.js","names":[],"sources":["../../src/plugin/dev-reader.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport type { TunnelConnection } from \"shared\";\nimport { TunnelError } from \"../errors\";\nimport { createLogger } from \"../logging/logger\";\nimport { isRemoteTunnelAllowedByEnv } from \"../plugins/server/remote-tunnel/gate\";\n\nconst logger = createLogger(\"plugin:dev-reader\");\n\ntype TunnelConnectionGetter = (\n req: import(\"express\").Request,\n) => TunnelConnection | null;\n\n/**\n * This class is used to read files from the local filesystem in dev mode\n * through the WebSocket tunnel.\n */\nexport class DevFileReader {\n private static instance: DevFileReader | null = null;\n private getTunnelForRequest: TunnelConnectionGetter | null = null;\n\n private constructor() {}\n\n static getInstance(): DevFileReader {\n if (!DevFileReader.instance) {\n DevFileReader.instance = new Proxy(new DevFileReader(), {\n /**\n * We proxy the reader to return a noop function if the remote server is disabled.\n */\n get(target, prop, receiver) {\n if (isRemoteTunnelAllowedByEnv()) {\n return Reflect.get(target, prop, receiver);\n }\n\n const value = Reflect.get(target, prop, receiver);\n\n if (typeof value === \"function\") {\n return function noop() {\n logger.debug(\"Noop: %s (remote server disabled)\", String(prop));\n return Promise.resolve(\"\");\n };\n }\n\n return value;\n },\n set(target, prop, value, receiver) {\n return Reflect.set(target, prop, value, receiver);\n },\n });\n }\n\n return DevFileReader.instance;\n }\n\n registerTunnelGetter(getter: TunnelConnectionGetter) {\n this.getTunnelForRequest = getter;\n }\n\n async readFile(\n filePath: string,\n req: import(\"express\").Request,\n ): Promise<string> {\n if (!this.getTunnelForRequest) {\n throw TunnelError.getterNotRegistered();\n }\n const tunnel = this.getTunnelForRequest(req);\n\n if (!tunnel) {\n throw TunnelError.noConnection();\n }\n\n const { ws, pendingFileReads } = tunnel;\n const requestId = randomUUID();\n\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => {\n pendingFileReads.delete(requestId);\n reject(new Error(`File read timeout: ${filePath}`));\n }, 10000);\n\n pendingFileReads.set(requestId, { resolve, reject, timeout });\n\n ws.send(\n JSON.stringify({\n type: \"file:read\",\n requestId,\n path: filePath,\n }),\n );\n });\n }\n\n async readdir(\n dirPath: string,\n req: import(\"express\").Request,\n ): Promise<string[]> {\n if (!this.getTunnelForRequest) {\n throw TunnelError.getterNotRegistered();\n }\n const tunnel = this.getTunnelForRequest(req);\n\n if (!tunnel) {\n throw TunnelError.noConnection();\n }\n\n const { ws, pendingFileReads } = tunnel;\n const requestId = randomUUID();\n\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => {\n pendingFileReads.delete(requestId);\n reject(new Error(`Directory read timeout: ${dirPath}`));\n }, 10000);\n\n pendingFileReads.set(requestId, {\n resolve: (data: string) => {\n try {\n const files = JSON.parse(data);\n // Validate it's an array of strings\n if (!Array.isArray(files)) {\n reject(\n new Error(\n \"Invalid directory listing format: expected array, got \" +\n typeof files,\n ),\n );\n return;\n }\n if (!files.every((f) => typeof f === \"string\")) {\n reject(\n new Error(\n \"Invalid directory listing format: expected array of strings\",\n ),\n );\n return;\n }\n resolve(files);\n } catch (error) {\n reject(\n new Error(\n `Failed to parse directory listing: ${(error as Error).message}`,\n ),\n );\n }\n },\n reject,\n timeout,\n });\n\n ws.send(\n JSON.stringify({\n type: \"dir:list\",\n requestId,\n path: dirPath,\n }),\n );\n });\n }\n}\n"],"mappings":";;;;;;;AAMA,MAAM,SAAS,aAAa,oBAAoB;;;;;AAUhD,IAAa,gBAAb,MAAa,cAAc;CACzB,OAAe,WAAiC;CAChD,AAAQ,sBAAqD;CAE7D,AAAQ,cAAc;CAEtB,OAAO,cAA6B;AAClC,MAAI,CAAC,cAAc,SACjB,eAAc,WAAW,IAAI,MAAM,IAAI,eAAe,EAAE;GAItD,IAAI,QAAQ,MAAM,UAAU;AAC1B,QAAI,4BAA4B,CAC9B,QAAO,QAAQ,IAAI,QAAQ,MAAM,SAAS;IAG5C,MAAM,QAAQ,QAAQ,IAAI,QAAQ,MAAM,SAAS;AAEjD,QAAI,OAAO,UAAU,WACnB,QAAO,SAAS,OAAO;AACrB,YAAO,MAAM,qCAAqC,OAAO,KAAK,CAAC;AAC/D,YAAO,QAAQ,QAAQ,GAAG;;AAI9B,WAAO;;GAET,IAAI,QAAQ,MAAM,OAAO,UAAU;AACjC,WAAO,QAAQ,IAAI,QAAQ,MAAM,OAAO,SAAS;;GAEpD,CAAC;AAGJ,SAAO,cAAc;;CAGvB,qBAAqB,QAAgC;AACnD,OAAK,sBAAsB;;CAG7B,MAAM,SACJ,UACA,KACiB;AACjB,MAAI,CAAC,KAAK,oBACR,OAAM,YAAY,qBAAqB;EAEzC,MAAM,SAAS,KAAK,oBAAoB,IAAI;AAE5C,MAAI,CAAC,OACH,OAAM,YAAY,cAAc;EAGlC,MAAM,EAAE,IAAI,qBAAqB;EACjC,MAAM,YAAY,YAAY;AAE9B,SAAO,IAAI,SAAS,SAAS,WAAW;GACtC,MAAM,UAAU,iBAAiB;AAC/B,qBAAiB,OAAO,UAAU;AAClC,2BAAO,IAAI,MAAM,sBAAsB,WAAW,CAAC;MAClD,IAAM;AAET,oBAAiB,IAAI,WAAW;IAAE;IAAS;IAAQ;IAAS,CAAC;AAE7D,MAAG,KACD,KAAK,UAAU;IACb,MAAM;IACN;IACA,MAAM;IACP,CAAC,CACH;IACD;;CAGJ,MAAM,QACJ,SACA,KACmB;AACnB,MAAI,CAAC,KAAK,oBACR,OAAM,YAAY,qBAAqB;EAEzC,MAAM,SAAS,KAAK,oBAAoB,IAAI;AAE5C,MAAI,CAAC,OACH,OAAM,YAAY,cAAc;EAGlC,MAAM,EAAE,IAAI,qBAAqB;EACjC,MAAM,YAAY,YAAY;AAE9B,SAAO,IAAI,SAAS,SAAS,WAAW;GACtC,MAAM,UAAU,iBAAiB;AAC/B,qBAAiB,OAAO,UAAU;AAClC,2BAAO,IAAI,MAAM,2BAA2B,UAAU,CAAC;MACtD,IAAM;AAET,oBAAiB,IAAI,WAAW;IAC9B,UAAU,SAAiB;AACzB,SAAI;MACF,MAAM,QAAQ,KAAK,MAAM,KAAK;AAE9B,UAAI,CAAC,MAAM,QAAQ,MAAM,EAAE;AACzB,8BACE,IAAI,MACF,2DACE,OAAO,MACV,CACF;AACD;;AAEF,UAAI,CAAC,MAAM,OAAO,MAAM,OAAO,MAAM,SAAS,EAAE;AAC9C,8BACE,IAAI,MACF,8DACD,CACF;AACD;;AAEF,cAAQ,MAAM;cACP,OAAO;AACd,6BACE,IAAI,MACF,sCAAuC,MAAgB,UACxD,CACF;;;IAGL;IACA;IACD,CAAC;AAEF,MAAG,KACD,KAAK,UAAU;IACb,MAAM;IACN;IACA,MAAM;IACP,CAAC,CACH;IACD"}
|