@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.
Files changed (160) hide show
  1. package/CLAUDE.md +3 -2
  2. package/NOTICE.md +1 -0
  3. package/dist/appkit/package.js +1 -1
  4. package/dist/cache/index.js +1 -2
  5. package/dist/cache/index.js.map +1 -1
  6. package/dist/cache/storage/persistent.js +1 -2
  7. package/dist/cache/storage/persistent.js.map +1 -1
  8. package/dist/cli/commands/plugin/add-resource/add-resource.js.map +1 -1
  9. package/dist/cli/commands/plugin/create/resource-defaults.js +2 -1
  10. package/dist/cli/commands/plugin/create/resource-defaults.js.map +1 -1
  11. package/dist/cli/commands/plugin/schema-resources.js +34 -51
  12. package/dist/cli/commands/plugin/schema-resources.js.map +1 -1
  13. package/dist/cli/commands/plugin/sync/sync.js +20 -6
  14. package/dist/cli/commands/plugin/sync/sync.js.map +1 -1
  15. package/dist/cli/commands/plugin/validate/validate-manifest.js +71 -157
  16. package/dist/cli/commands/plugin/validate/validate-manifest.js.map +1 -1
  17. package/dist/cli/commands/plugin/validate/validate.js +2 -2
  18. package/dist/cli/commands/plugin/validate/validate.js.map +1 -1
  19. package/dist/cli/commands/setup.js +2 -2
  20. package/dist/cli/commands/setup.js.map +1 -1
  21. package/dist/connectors/index.js +0 -1
  22. package/dist/connectors/jobs/client.js +1 -2
  23. package/dist/connectors/jobs/client.js.map +1 -1
  24. package/dist/connectors/lakebase/routing-pool.js +1 -2
  25. package/dist/connectors/lakebase/routing-pool.js.map +1 -1
  26. package/dist/connectors/sql-warehouse/client.js +1 -2
  27. package/dist/connectors/sql-warehouse/client.js.map +1 -1
  28. package/dist/context/execution-context.js +9 -13
  29. package/dist/context/execution-context.js.map +1 -1
  30. package/dist/context/index.js +3 -13
  31. package/dist/context/service-context.js +137 -136
  32. package/dist/context/service-context.js.map +1 -1
  33. package/dist/context/user-context.js +1 -5
  34. package/dist/context/user-context.js.map +1 -1
  35. package/dist/core/agent/create-agent.js +1 -2
  36. package/dist/core/agent/create-agent.js.map +1 -1
  37. package/dist/core/appkit.d.ts.map +1 -1
  38. package/dist/core/appkit.js +9 -37
  39. package/dist/core/appkit.js.map +1 -1
  40. package/dist/errors/authentication.js +44 -40
  41. package/dist/errors/authentication.js.map +1 -1
  42. package/dist/errors/base.js +86 -70
  43. package/dist/errors/base.js.map +1 -1
  44. package/dist/errors/configuration.js +70 -66
  45. package/dist/errors/configuration.js.map +1 -1
  46. package/dist/errors/connection.js +50 -46
  47. package/dist/errors/connection.js.map +1 -1
  48. package/dist/errors/execution.js +47 -43
  49. package/dist/errors/execution.js.map +1 -1
  50. package/dist/errors/index.js +10 -27
  51. package/dist/errors/initialization.js +38 -34
  52. package/dist/errors/initialization.js.map +1 -1
  53. package/dist/errors/server.js +34 -31
  54. package/dist/errors/server.js.map +1 -1
  55. package/dist/errors/tunnel.js +47 -43
  56. package/dist/errors/tunnel.js.map +1 -1
  57. package/dist/errors/validation.js +41 -37
  58. package/dist/errors/validation.js.map +1 -1
  59. package/dist/index.d.ts +1 -1
  60. package/dist/index.js +3 -9
  61. package/dist/plugin/dev-reader.js +1 -2
  62. package/dist/plugin/dev-reader.js.map +1 -1
  63. package/dist/plugin/interceptors/retry.js +1 -2
  64. package/dist/plugin/interceptors/retry.js.map +1 -1
  65. package/dist/plugin/interceptors/telemetry.js +1 -2
  66. package/dist/plugin/interceptors/telemetry.js.map +1 -1
  67. package/dist/plugin/plugin.d.ts +12 -4
  68. package/dist/plugin/plugin.d.ts.map +1 -1
  69. package/dist/plugin/plugin.js +59 -28
  70. package/dist/plugin/plugin.js.map +1 -1
  71. package/dist/plugins/agents/agents.d.ts +56 -3
  72. package/dist/plugins/agents/agents.d.ts.map +1 -1
  73. package/dist/plugins/agents/agents.js +160 -8
  74. package/dist/plugins/agents/agents.js.map +1 -1
  75. package/dist/plugins/agents/schemas.js +0 -1
  76. package/dist/plugins/agents/schemas.js.map +1 -1
  77. package/dist/plugins/analytics/analytics.js +1 -2
  78. package/dist/plugins/analytics/analytics.js.map +1 -1
  79. package/dist/plugins/analytics/manifest.js +9 -1
  80. package/dist/plugins/analytics/query.js +2 -4
  81. package/dist/plugins/analytics/query.js.map +1 -1
  82. package/dist/plugins/files/manifest.js +7 -1
  83. package/dist/plugins/files/plugin.js +3 -6
  84. package/dist/plugins/files/plugin.js.map +1 -1
  85. package/dist/plugins/genie/genie.js +1 -2
  86. package/dist/plugins/genie/genie.js.map +1 -1
  87. package/dist/plugins/genie/manifest.js +7 -1
  88. package/dist/plugins/jobs/plugin.js +2 -4
  89. package/dist/plugins/jobs/plugin.js.map +1 -1
  90. package/dist/plugins/lakebase/lakebase.js +1 -2
  91. package/dist/plugins/lakebase/lakebase.js.map +1 -1
  92. package/dist/plugins/lakebase/manifest.js +26 -4
  93. package/dist/plugins/server/index.js +1 -2
  94. package/dist/plugins/server/index.js.map +1 -1
  95. package/dist/plugins/server/vite-dev-server.js +1 -2
  96. package/dist/plugins/server/vite-dev-server.js.map +1 -1
  97. package/dist/plugins/serving/serving.js +1 -2
  98. package/dist/plugins/serving/serving.js.map +1 -1
  99. package/dist/registry/index.d.ts +1 -1
  100. package/dist/registry/manifest-loader.d.ts +4 -4
  101. package/dist/registry/manifest-loader.d.ts.map +1 -1
  102. package/dist/registry/manifest-loader.js +1 -2
  103. package/dist/registry/manifest-loader.js.map +1 -1
  104. package/dist/registry/resource-registry.js +1 -2
  105. package/dist/registry/resource-registry.js.map +1 -1
  106. package/dist/registry/types.d.ts +21 -7
  107. package/dist/registry/types.d.ts.map +1 -1
  108. package/dist/registry/types.generated.d.ts +1 -1
  109. package/dist/registry/types.generated.js +1 -1
  110. package/dist/registry/types.generated.js.map +1 -1
  111. package/dist/registry/types.js +3 -3
  112. package/dist/registry/types.js.map +1 -1
  113. package/dist/schemas/manifest.d.ts +1139 -0
  114. package/dist/schemas/manifest.d.ts.map +1 -0
  115. package/dist/schemas/manifest.js +524 -0
  116. package/dist/schemas/manifest.js.map +1 -0
  117. package/dist/shared/src/index.d.ts +1 -1
  118. package/dist/shared/src/plugin.d.ts +38 -7
  119. package/dist/shared/src/plugin.d.ts.map +1 -1
  120. package/dist/shared/src/schemas/manifest.d.ts +1110 -0
  121. package/dist/shared/src/schemas/manifest.d.ts.map +1 -0
  122. package/dist/stream/arrow-stream-processor.js +1 -2
  123. package/dist/stream/arrow-stream-processor.js.map +1 -1
  124. package/dist/stream/buffers.js +1 -2
  125. package/dist/stream/buffers.js.map +1 -1
  126. package/docs/api/appkit/Enumeration.ResourceType.md +1 -1
  127. package/docs/api/appkit/Interface.PluginManifest.md +57 -3
  128. package/docs/api/appkit/Interface.ResourceEntry.md +6 -4
  129. package/docs/api/appkit/Interface.ResourceRequirement.md +7 -61
  130. package/docs/api/appkit/TypeAlias.ResourceFieldEntry.md +6 -0
  131. package/docs/api/appkit/Variable.agents.md +1 -1
  132. package/docs/api/appkit.md +12 -12
  133. package/docs/app-management.md +1 -1
  134. package/docs/development/ai-assisted-development.md +2 -2
  135. package/docs/development/local-development.md +1 -1
  136. package/docs/development/remote-bridge.md +1 -1
  137. package/docs/development/templates.md +118 -12
  138. package/docs/development.md +1 -1
  139. package/docs/plugins/agents.md +8 -4
  140. package/docs/plugins/custom-plugins.md +33 -23
  141. package/docs/plugins/lakebase.md +1 -1
  142. package/docs/plugins/manifest.md +293 -0
  143. package/docs.md +2 -2
  144. package/llms.txt +3 -2
  145. package/package.json +3 -3
  146. package/sbom.cdx.json +1 -1
  147. package/dist/_virtual/_rolldown/runtime.js +0 -7
  148. package/dist/connectors/lakebase-v1/client.js +0 -15
  149. package/dist/connectors/lakebase-v1/client.js.map +0 -1
  150. package/dist/connectors/lakebase-v1/index.js +0 -3
  151. package/dist/context/index.js.map +0 -1
  152. package/dist/errors/index.js.map +0 -1
  153. package/dist/index.js.map +0 -1
  154. package/dist/schemas/plugin-manifest.generated.d.ts +0 -182
  155. package/dist/schemas/plugin-manifest.generated.d.ts.map +0 -1
  156. package/dist/schemas/plugin-manifest.schema.json +0 -489
  157. package/dist/schemas/template-plugins.schema.json +0 -113
  158. package/dist/shared/src/schemas/plugin-manifest.generated.d.ts +0 -182
  159. package/dist/shared/src/schemas/plugin-manifest.generated.d.ts.map +0 -1
  160. package/docs/api/appkit/Interface.ResourceFieldEntry.md +0 -82
@@ -1,48 +1,52 @@
1
- import { __esmMin } from "../_virtual/_rolldown/runtime.js";
2
- import { AppKitError, init_base } from "./base.js";
1
+ import { AppKitError } from "./base.js";
3
2
 
4
3
  //#region src/errors/execution.ts
5
- var ExecutionError;
6
- var init_execution = __esmMin((() => {
7
- init_base();
8
- ExecutionError = class ExecutionError extends AppKitError {
9
- code = "EXECUTION_ERROR";
10
- statusCode = 500;
11
- isRetryable = false;
12
- /**
13
- * Create an execution error for statement failure
14
- */
15
- static statementFailed(errorMessage) {
16
- return new ExecutionError(errorMessage ? `Statement failed: ${errorMessage}` : "Statement failed: Unknown error");
17
- }
18
- /**
19
- * Create an execution error for canceled operation
20
- */
21
- static canceled() {
22
- return new ExecutionError("Statement was canceled");
23
- }
24
- /**
25
- * Create an execution error for closed/expired results
26
- */
27
- static resultsClosed() {
28
- return new ExecutionError("Statement execution completed but results are no longer available (CLOSED state)");
29
- }
30
- /**
31
- * Create an execution error for unknown state
32
- */
33
- static unknownState(state) {
34
- return new ExecutionError(`Unknown statement state: ${state}`, { context: { state } });
35
- }
36
- /**
37
- * Create an execution error for missing data
38
- */
39
- static missingData(dataType) {
40
- return new ExecutionError(`No ${dataType} found in response`, { context: { dataType } });
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
- init_execution();
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":";;;;;;YAAqC;CAYxB,iBAAb,MAAa,uBAAuB,YAAY;EAC9C,AAAS,OAAO;EAChB,AAAS,aAAa;EACtB,AAAS,cAAc;;;;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"}
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"}
@@ -1,28 +1,11 @@
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";
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
- //#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
11
+ export { };
@@ -1,39 +1,43 @@
1
- import { __esmMin } from "../_virtual/_rolldown/runtime.js";
2
- import { AppKitError, init_base } from "./base.js";
1
+ import { AppKitError } from "./base.js";
3
2
 
4
3
  //#region src/errors/initialization.ts
5
- var InitializationError;
6
- var init_initialization = __esmMin((() => {
7
- init_base();
8
- InitializationError = class InitializationError extends AppKitError {
9
- code = "INITIALIZATION_ERROR";
10
- statusCode = 500;
11
- isRetryable = true;
12
- /**
13
- * Create an initialization error for a service that is not ready
14
- */
15
- static notInitialized(serviceName, hint) {
16
- return new InitializationError(hint ? `${serviceName} not initialized. ${hint}` : `${serviceName} not initialized`, { context: { service: serviceName } });
17
- }
18
- /**
19
- * Create an initialization error for setup failure
20
- */
21
- static setupFailed(component, cause) {
22
- return new InitializationError(`Failed to initialize ${component}`, {
23
- cause,
24
- context: { component }
25
- });
26
- }
27
- /**
28
- * Create an initialization error for migration failure
29
- */
30
- static migrationFailed(cause) {
31
- return new InitializationError("Error in running migrations for persistent storage", { cause });
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
- init_initialization();
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":";;;;;;YAAqC;CAYxB,sBAAb,MAAa,4BAA4B,YAAY;EACnD,AAAS,OAAO;EAChB,AAAS,aAAa;EACtB,AAAS,cAAc;;;;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"}
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"}
@@ -1,36 +1,39 @@
1
- import { __esmMin } from "../_virtual/_rolldown/runtime.js";
2
- import { AppKitError, init_base } from "./base.js";
1
+ import { AppKitError } from "./base.js";
3
2
 
4
3
  //#region src/errors/server.ts
5
- var ServerError;
6
- var init_server = __esmMin((() => {
7
- init_base();
8
- ServerError = class ServerError extends AppKitError {
9
- code = "SERVER_ERROR";
10
- statusCode = 500;
11
- isRetryable = false;
12
- /**
13
- * Create a server error for server not started
14
- */
15
- static notStarted() {
16
- return new ServerError("Server not started. Please start the server first by calling the start() method");
17
- }
18
- /**
19
- * Create a server error for Vite dev server not initialized
20
- */
21
- static viteNotInitialized() {
22
- return new ServerError("Vite dev server not initialized");
23
- }
24
- /**
25
- * Create a server error for missing client directory
26
- */
27
- static clientDirectoryNotFound(searchedPaths) {
28
- return new ServerError(`Could not find client directory. Searched for vite.config.ts/js + index.html in: ${searchedPaths.join(", ")}`, { context: { searchedPaths } });
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
- init_server();
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":";;;;;;YAAqC;CAWxB,cAAb,MAAa,oBAAoB,YAAY;EAC3C,AAAS,OAAO;EAChB,AAAS,aAAa;EACtB,AAAS,cAAc;;;;EAKvB,OAAO,aAA0B;AAC/B,UAAO,IAAI,YACT,kFACD;;;;;EAMH,OAAO,qBAAkC;AACvC,UAAO,IAAI,YAAY,kCAAkC;;;;;EAM3D,OAAO,wBAAwB,eAAsC;AACnE,UAAO,IAAI,YACT,oFAAoF,cAAc,KAAK,KAAK,IAC5G,EAAE,SAAS,EAAE,eAAe,EAAE,CAC/B"}
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"}
@@ -1,48 +1,52 @@
1
- import { __esmMin } from "../_virtual/_rolldown/runtime.js";
2
- import { AppKitError, init_base } from "./base.js";
1
+ import { AppKitError } from "./base.js";
3
2
 
4
3
  //#region src/errors/tunnel.ts
5
- var TunnelError;
6
- var init_tunnel = __esmMin((() => {
7
- init_base();
8
- TunnelError = class TunnelError extends AppKitError {
9
- code = "TUNNEL_ERROR";
10
- statusCode = 502;
11
- isRetryable = true;
12
- /**
13
- * Create a tunnel error for missing tunnel getter
14
- */
15
- static getterNotRegistered() {
16
- return new TunnelError("Tunnel getter not registered for DevFileReader singleton");
17
- }
18
- /**
19
- * Create a tunnel error for no available connection
20
- */
21
- static noConnection() {
22
- return new TunnelError("No tunnel connection available for file read");
23
- }
24
- /**
25
- * Create a tunnel error for asset fetch failure
26
- */
27
- static fetchFailed(path, cause) {
28
- return new TunnelError("Failed to fetch asset", {
29
- cause,
30
- context: { path }
31
- });
32
- }
33
- /**
34
- * Create a tunnel error for message parsing failure
35
- */
36
- static parseError(messageType, cause) {
37
- return new TunnelError(`Failed to parse ${messageType} message`, {
38
- cause,
39
- context: { messageType }
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
- init_tunnel();
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":";;;;;;YAAqC;CAYxB,cAAb,MAAa,oBAAoB,YAAY;EAC3C,AAAS,OAAO;EAChB,AAAS,aAAa;EACtB,AAAS,cAAc;;;;EAKvB,OAAO,sBAAmC;AACxC,UAAO,IAAI,YACT,2DACD;;;;;EAMH,OAAO,eAA4B;AACjC,UAAO,IAAI,YAAY,+CAA+C;;;;;EAMxE,OAAO,YAAY,MAAc,OAA4B;AAC3D,UAAO,IAAI,YAAY,yBAAyB;IAC9C;IACA,SAAS,EAAE,MAAM;IAClB,CAAC;;;;;EAMJ,OAAO,WAAW,aAAqB,OAA4B;AACjE,UAAO,IAAI,YAAY,mBAAmB,YAAY,WAAW;IAC/D;IACA,SAAS,EAAE,aAAa;IACzB,CAAC"}
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 { __esmMin } from "../_virtual/_rolldown/runtime.js";
2
- import { AppKitError, init_base } from "./base.js";
1
+ import { AppKitError } from "./base.js";
3
2
 
4
3
  //#region src/errors/validation.ts
5
- var ValidationError;
6
- var init_validation = __esmMin((() => {
7
- init_base();
8
- ValidationError = class ValidationError extends AppKitError {
9
- code = "VALIDATION_ERROR";
10
- statusCode = 400;
11
- isRetryable = false;
12
- /**
13
- * Create a validation error for a missing required field
14
- */
15
- static missingField(fieldName) {
16
- return new ValidationError(`Missing required field: ${fieldName}`, { context: { field: fieldName } });
17
- }
18
- /**
19
- * Create a validation error for an invalid field value.
20
- * Note: The actual value is not stored in context for security reasons.
21
- * Only the value's type is recorded.
22
- */
23
- static invalidValue(fieldName, value, expected) {
24
- return new ValidationError(expected ? `Invalid value for ${fieldName}: expected ${expected}` : `Invalid value for ${fieldName}`, { context: {
25
- field: fieldName,
26
- valueType: value === null ? "null" : typeof value,
27
- expected
28
- } });
29
- }
30
- /**
31
- * Create a validation error for missing environment variables
32
- */
33
- static missingEnvVars(vars) {
34
- return new ValidationError(`Missing required environment variables: ${vars.join(", ")}`, { context: { missingVars: vars } });
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
- init_validation();
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":";;;;;;YAAqC;CAYxB,kBAAb,MAAa,wBAAwB,YAAY;EAC/C,AAAS,OAAO;EAChB,AAAS,aAAa;EACtB,AAAS,cAAc;;;;EAKvB,OAAO,aAAa,WAAoC;AACtD,UAAO,IAAI,gBAAgB,2BAA2B,aAAa,EACjE,SAAS,EAAE,OAAO,WAAW,EAC9B,CAAC;;;;;;;EAQJ,OAAO,aACL,WACA,OACA,UACiB;AAIjB,UAAO,IAAI,gBAHC,WACR,qBAAqB,UAAU,aAAa,aAC5C,qBAAqB,aACO,EAC9B,SAAS;IACP,OAAO;IACP,WAAW,UAAU,OAAO,SAAS,OAAO;IAC5C;IACD,EACF,CAAC;;;;;EAMJ,OAAO,eAAe,MAAiC;AACrD,UAAO,IAAI,gBACT,2CAA2C,KAAK,KAAK,KAAK,IAC1D,EAAE,SAAS,EAAE,aAAa,MAAM,EAAE,CACnC"}
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/plugin-manifest.generated.js";
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 { init_errors } from "./errors/index.js";
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 { init_context } from "./context/index.js";
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
- //#region src/index.ts
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 { init_errors } from "../errors/index.js";
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":";;;;;;;aAEwC;AAIxC,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"}
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"}