@databricks/appkit 0.30.0 → 0.31.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.
@@ -1,6 +1,6 @@
1
1
  //#region package.json
2
2
  var name = "@databricks/appkit";
3
- var version = "0.30.0";
3
+ var version = "0.31.0";
4
4
 
5
5
  //#endregion
6
6
  export { name, version };
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","names":[],"sources":["../../src/plugin/plugin.ts"],"mappings":";;;;;;;;;;;;;;;AA+KA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAAsB,MAAA,iBACJ,gBAAA,GAAmB,gBAAA,aACxB,UAAA;EAAA,UA4BW,MAAA,EAAQ,OAAA;EAAA,UA1BpB,OAAA;EAAA,UACA,KAAA,EAAO,YAAA;EAAA,UACP,GAAA,EAAK,UAAA;EAAA,UACL,aAAA,EAAe,aAAA;EAAA,UACf,aAAA,EAAe,aAAA;EAAA,UACf,SAAA,EAAW,UAAA;EA6OM;EAAA,QA1OnB,mBAAA;EA2OG;EAAA,QAxOH,oBAAA;EAyON;;;;;;EAAA,OAjOK,KAAA,EAAO,WAAA;EA0S0B;;;EArSxC,IAAA;cAEsB,MAAA,EAAQ,OAAA;EAc9B,YAAA,CAAa,CAAA,EAAG,OAAA,CAAQ,MAAA;EAIlB,KAAA,CAAA,GAAK,OAAA;EAEX,YAAA,CAAA,GAAgB,iBAAA;EAIhB,uBAAA,CAAA,GAA2B,WAAA;EAI3B,qBAAA,CAAA;EA6TyC;;;;;;;;;;;;;;;;;;;;;;;;EAjSzC,OAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiDA,YAAA,CAAA,GAAgB,MAAA;;;;;;;;;;;YAcN,aAAA,CAAc,GAAA,EAAK,OAAA,CAAQ,OAAA;;;;;;;;;;;EAmBrC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AIlB,KAAA,CAAA,GAAK,OAAA;EAEX,YAAA,CAAA,GAAgB,iBAAA;EAIhB,uBAAA,CAAA,GAA2B,WAAA;EAI3B,qBAAA,CAAA;EAqUyC;;;;;;;;;;;;;;;;;;;;;;;;EAzSzC,OAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiDA,YAAA,CAAA,GAAgB,MAAA;;;;;;;;;;;YAcN,aAAA,CAAc,GAAA,EAAK,OAAA,CAAQ,OAAA;;;;;;;;;;;EAmBrC,MAAA,CAAO,GAAA,EAAK,OAAA,CAAQ,OAAA;;;;;;UAuDZ,uBAAA;EAAA,UAqBQ,aAAA,GAAA,CACd,GAAA,EAAK,YAAA,EACL,EAAA,EAAI,oBAAA,CAAqB,CAAA,GACzB,OAAA,EAAS,uBAAA,EACT,OAAA,YAAgB,OAAA;;;;;;;;;;YAgFF,OAAA,GAAA,CACd,EAAA,GAAK,MAAA,GAAS,WAAA,KAAgB,OAAA,CAAQ,CAAA,GACtC,OAAA,EAAS,uBAAA,EACT,OAAA,YACC,OAAA,CAAQ,eAAA,CAAgB,CAAA;EAAA,UAmDjB,gBAAA,CAAiB,IAAA,UAAc,IAAA;EAAA,UAI/B,KAAA,YAAA,CACR,MAAA,EAAQ,OAAA,CAAQ,MAAA,EAChB,MAAA,EAAQ,WAAA;EAAA,QAeF,qBAAA;EAAA,QAaA,kBAAA;EAAA,QAqCM,wBAAA;EAAA,QAqBN,iBAAA;AAAA"}
@@ -346,7 +346,7 @@ var Plugin = class {
346
346
  if (self._checkIfGenerator(result)) yield* result;
347
347
  else yield result;
348
348
  };
349
- await this.streamManager.stream(res, asyncWrapperFn, streamConfig);
349
+ await this.streamManager.stream(res, asyncWrapperFn, streamConfig, effectiveUserKey);
350
350
  }
351
351
  /**
352
352
  * Execute a function with the plugin's interceptor chain.
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","names":["otelContext","context"],"sources":["../../src/plugin/plugin.ts"],"sourcesContent":["import { createContextKey, context as otelContext } from \"@opentelemetry/api\";\nimport type express from \"express\";\nimport type {\n BasePlugin,\n BasePluginConfig,\n IAppResponse,\n PluginEndpointMap,\n PluginExecuteConfig,\n PluginExecutionSettings,\n PluginPhase,\n RouteConfig,\n StreamExecuteHandler,\n StreamExecutionSettings,\n} from \"shared\";\nimport { AppManager } from \"../app\";\nimport { CacheManager } from \"../cache\";\nimport {\n getCurrentUserId,\n runInUserContext,\n ServiceContext,\n type UserContext,\n} from \"../context\";\nimport { AppKitError, AuthenticationError } from \"../errors\";\nimport { createLogger } from \"../logging/logger\";\nimport { StreamManager } from \"../stream\";\nimport {\n type ITelemetry,\n normalizeTelemetryOptions,\n TelemetryManager,\n} from \"../telemetry\";\nimport { deepMerge } from \"../utils\";\nimport { DevFileReader } from \"./dev-reader\";\nimport type { ExecutionResult } from \"./execution-result\";\nimport { CacheInterceptor } from \"./interceptors/cache\";\nimport { RetryInterceptor } from \"./interceptors/retry\";\nimport { TelemetryInterceptor } from \"./interceptors/telemetry\";\nimport { TimeoutInterceptor } from \"./interceptors/timeout\";\nimport type {\n ExecutionInterceptor,\n InterceptorContext,\n} from \"./interceptors/types\";\n\nconst logger = createLogger(\"plugin\");\n\n/**\n * OTel context key for marking OBO dev mode fallback.\n * Set when asUser() is called in development mode without a user token.\n */\nconst DEV_OBO_FALLBACK_KEY = createContextKey(\"appkit.devOboFallback\");\n\n/**\n * Returns true if the current execution is an OBO dev mode fallback\n * (asUser() was called but fell back to service principal due to missing token).\n */\nexport function isDevOboFallback(): boolean {\n return otelContext.active().getValue(DEV_OBO_FALLBACK_KEY) === true;\n}\n\n/**\n * Narrow an unknown thrown value to an Error that carries a numeric\n * `statusCode` property (e.g. `ApiError` from `@databricks/sdk-experimental`).\n */\nfunction hasHttpStatusCode(\n error: unknown,\n): error is Error & { statusCode: number } {\n return (\n error instanceof Error &&\n \"statusCode\" in error &&\n typeof (error as Record<string, unknown>).statusCode === \"number\"\n );\n}\n\n/**\n * Methods that should not be proxied by asUser().\n * These are lifecycle/internal methods that don't make sense\n * to execute in a user context.\n */\nconst EXCLUDED_FROM_PROXY = new Set([\n // Lifecycle methods\n \"setup\",\n \"shutdown\",\n \"injectRoutes\",\n \"getEndpoints\",\n \"getSkipBodyParsingPaths\",\n \"abortActiveOperations\",\n \"clientConfig\",\n // asUser itself - prevent chaining like .asUser().asUser()\n \"asUser\",\n // Internal methods\n \"constructor\",\n]);\n\n/**\n * Base abstract class for creating AppKit plugins.\n *\n * All plugins must declare a static `manifest` property with their metadata\n * and resource requirements. The manifest defines:\n * - `required` resources: Always needed for the plugin to function\n * - `optional` resources: May be needed depending on plugin configuration\n *\n * ## Static vs Runtime Resource Requirements\n *\n * The manifest is static and doesn't know the plugin's runtime configuration.\n * For resources that become required based on config options, plugins can\n * implement a static `getResourceRequirements(config)` method.\n *\n * At runtime, this method is called with the actual config to determine\n * which \"optional\" resources should be treated as \"required\".\n *\n * @example Basic plugin with static requirements\n * ```typescript\n * import { Plugin, toPlugin, PluginManifest, ResourceType } from '@databricks/appkit';\n *\n * const myManifest: PluginManifest = {\n * name: 'myPlugin',\n * displayName: 'My Plugin',\n * description: 'Does something awesome',\n * resources: {\n * required: [\n * { type: ResourceType.SQL_WAREHOUSE, alias: 'warehouse', ... }\n * ],\n * optional: []\n * }\n * };\n *\n * class MyPlugin extends Plugin<MyConfig> {\n * static manifest = myManifest;\n * }\n * ```\n *\n * @example Plugin with config-dependent resources\n * ```typescript\n * interface MyConfig extends BasePluginConfig {\n * enableCaching?: boolean;\n * }\n *\n * const myManifest: PluginManifest = {\n * name: 'myPlugin',\n * resources: {\n * required: [\n * { type: ResourceType.SQL_WAREHOUSE, alias: 'warehouse', ... }\n * ],\n * optional: [\n * // Database is optional in the static manifest\n * { type: ResourceType.DATABASE, alias: 'cache', description: 'Required if caching enabled', ... }\n * ]\n * }\n * };\n *\n * class MyPlugin extends Plugin<MyConfig> {\n * static manifest = myManifest<\"myPlugin\">;\n *\n * // Runtime method: converts optional resources to required based on config\n * static getResourceRequirements(config: MyConfig) {\n * const resources = [];\n * if (config.enableCaching) {\n * // When caching is enabled, Database becomes required\n * resources.push({\n * type: ResourceType.DATABASE,\n * alias: 'cache',\n * resourceKey: 'database',\n * description: 'Cache storage for query results',\n * permission: 'CAN_CONNECT_AND_CREATE',\n * fields: {\n * instance_name: { env: 'DATABRICKS_CACHE_INSTANCE' },\n * database_name: { env: 'DATABRICKS_CACHE_DB' },\n * },\n * required: true // Mark as required at runtime\n * });\n * }\n * return resources;\n * }\n * }\n * ```\n */\nexport abstract class Plugin<\n TConfig extends BasePluginConfig = BasePluginConfig,\n> implements BasePlugin\n{\n protected isReady = false;\n protected cache: CacheManager;\n protected app: AppManager;\n protected devFileReader: DevFileReader;\n protected streamManager: StreamManager;\n protected telemetry: ITelemetry;\n\n /** Registered endpoints for this plugin */\n private registeredEndpoints: PluginEndpointMap = {};\n\n /** Paths that opt out of JSON body parsing (e.g. file upload routes) */\n private skipBodyParsingPaths: Set<string> = new Set();\n\n /**\n * Plugin initialization phase.\n * - 'core': Initialized first (e.g., config plugins)\n * - 'normal': Initialized second (most plugins)\n * - 'deferred': Initialized last (e.g., server plugin)\n */\n static phase: PluginPhase = \"normal\";\n\n /**\n * Plugin name identifier.\n */\n name: string;\n\n constructor(protected config: TConfig) {\n this.name =\n config.name ??\n (this.constructor as { manifest?: { name: string } }).manifest?.name ??\n \"plugin\";\n this.telemetry = TelemetryManager.getProvider(this.name, config.telemetry);\n this.streamManager = new StreamManager();\n this.cache = CacheManager.getInstanceSync();\n this.app = new AppManager();\n this.devFileReader = DevFileReader.getInstance();\n\n this.isReady = true;\n }\n\n injectRoutes(_: express.Router) {\n return;\n }\n\n async setup() {}\n\n getEndpoints(): PluginEndpointMap {\n return this.registeredEndpoints;\n }\n\n getSkipBodyParsingPaths(): ReadonlySet<string> {\n return this.skipBodyParsingPaths;\n }\n\n abortActiveOperations(): void {\n this.streamManager.abortAll();\n }\n\n /**\n * Returns the public exports for this plugin.\n * Override this to define a custom public API.\n * By default, returns an empty object.\n *\n * The returned object becomes the plugin's public API on the AppKit instance\n * (e.g. `appkit.myPlugin.method()`). AppKit automatically binds method context\n * and adds `asUser(req)` for user-scoped execution.\n *\n * @example\n * ```ts\n * class MyPlugin extends Plugin {\n * private getData() { return []; }\n *\n * exports() {\n * return { getData: this.getData };\n * }\n * }\n *\n * // After registration:\n * const appkit = await createApp({ plugins: [myPlugin()] });\n * appkit.myPlugin.getData();\n * ```\n */\n exports(): unknown {\n return {};\n }\n\n /**\n * Returns startup config to expose to the client.\n * Override this to surface server-side values that are safe to publish to the\n * frontend, such as feature flags, resource IDs, or other app boot settings.\n *\n * This runs once when the server starts, so it should not depend on\n * request-scoped or user-specific state.\n *\n * String values that match non-public environment variables are redacted\n * unless you intentionally expose them via a matching `PUBLIC_APPKIT_` env var.\n *\n * Values must be JSON-serializable plain data (no functions, Dates, classes,\n * Maps, Sets, BigInts, or circular references).\n * By default returns an empty object (plugin contributes nothing to client config).\n *\n * On the client, read the config with the `usePluginClientConfig` hook\n * (React) or the `getPluginClientConfig` function (vanilla JS), both\n * from `@databricks/appkit-ui`.\n *\n * @example\n * ```ts\n * // Server — plugin definition\n * class MyPlugin extends Plugin<MyConfig> {\n * clientConfig() {\n * return {\n * warehouseId: this.config.warehouseId,\n * features: { darkMode: true },\n * };\n * }\n * }\n *\n * // Client — React component\n * import { usePluginClientConfig } from \"@databricks/appkit-ui/react\";\n *\n * interface MyPluginConfig { warehouseId: string; features: { darkMode: boolean } }\n *\n * const config = usePluginClientConfig<MyPluginConfig>(\"myPlugin\");\n * config.warehouseId; // \"abc-123\"\n *\n * // Client — vanilla JS\n * import { getPluginClientConfig } from \"@databricks/appkit-ui/js\";\n *\n * const config = getPluginClientConfig<MyPluginConfig>(\"myPlugin\");\n * ```\n */\n clientConfig(): Record<string, unknown> {\n return {};\n }\n\n /**\n * Resolve the effective user ID from a request.\n *\n * Returns the `x-forwarded-user` header when present. In development mode\n * (`NODE_ENV=development`) falls back to the current context user ID so\n * that callers outside an active `runInUserContext` scope still get a\n * consistent value.\n *\n * @throws AuthenticationError in production when no user header is present.\n */\n protected resolveUserId(req: express.Request): string {\n const userId = req.header(\"x-forwarded-user\");\n if (userId) return userId;\n if (process.env.NODE_ENV === \"development\") return getCurrentUserId();\n throw AuthenticationError.missingToken(\n \"Missing x-forwarded-user header. Cannot resolve user ID.\",\n );\n }\n\n /**\n * Execute operations using the user's identity from the request.\n * Returns a proxy of this plugin where all method calls execute\n * with the user's Databricks credentials instead of the service principal.\n *\n * @param req - The Express request containing the user token in headers\n * @returns A proxied plugin instance that executes as the user\n * @throws AuthenticationError if user token is not available in request headers (production only).\n * In development mode (`NODE_ENV=development`), skips user impersonation instead of throwing.\n */\n asUser(req: express.Request): this {\n const token = req.header(\"x-forwarded-access-token\");\n const userId = req.header(\"x-forwarded-user\");\n const isDev = process.env.NODE_ENV === \"development\";\n\n // In local development, skip user impersonation\n // since there's no user token available\n if (!token && isDev) {\n logger.warn(\n \"asUser() called without user token in development mode. Skipping user impersonation.\",\n );\n\n // Return a proxy that marks execution as OBO dev fallback via OTel context,\n // so telemetry spans can distinguish intended OBO calls from regular SP calls\n return new Proxy(this, {\n get: (target, prop, receiver) => {\n const value = Reflect.get(target, prop, receiver);\n if (typeof value !== \"function\") return value;\n if (typeof prop === \"string\" && EXCLUDED_FROM_PROXY.has(prop))\n return value;\n\n return (...args: unknown[]) => {\n const ctx = otelContext\n .active()\n .setValue(DEV_OBO_FALLBACK_KEY, true);\n return otelContext.with(ctx, () => value.apply(target, args));\n };\n },\n }) as this;\n }\n\n if (!token) {\n throw AuthenticationError.missingToken(\"user token\");\n }\n\n if (!userId && !isDev) {\n throw AuthenticationError.missingUserId();\n }\n\n const effectiveUserId = userId || \"dev-user\";\n\n const userContext = ServiceContext.createUserContext(\n token,\n effectiveUserId,\n );\n\n // Return a proxy that wraps method calls in user context\n return this._createUserContextProxy(userContext);\n }\n\n /**\n * Creates a proxy that wraps method calls in a user context.\n * This allows all plugin methods to automatically use the user's\n * Databricks credentials.\n */\n private _createUserContextProxy(userContext: UserContext): this {\n return new Proxy(this, {\n get: (target, prop, receiver) => {\n const value = Reflect.get(target, prop, receiver);\n\n if (typeof value !== \"function\") {\n return value;\n }\n\n if (typeof prop === \"string\" && EXCLUDED_FROM_PROXY.has(prop)) {\n return value;\n }\n\n return (...args: unknown[]) => {\n return runInUserContext(userContext, () => value.apply(target, args));\n };\n },\n }) as this;\n }\n\n // streaming execution with interceptors\n protected async executeStream<T>(\n res: IAppResponse,\n fn: StreamExecuteHandler<T>,\n options: StreamExecutionSettings,\n userKey?: string,\n ) {\n // destructure options\n const {\n stream: streamConfig,\n default: defaultConfig,\n user: userConfig,\n } = options;\n\n // build execution options\n const executeConfig = this._buildExecutionConfig({\n default: defaultConfig,\n user: userConfig,\n });\n\n // get user key from context if not provided\n const effectiveUserKey = userKey ?? getCurrentUserId();\n\n const self = this;\n // capture the active OTel context (HTTP span) before entering the async generator,\n // where it would otherwise be lost across the async boundary\n const parentOtelContext = otelContext.active();\n\n // wrapper function to ensure it returns a generator\n const asyncWrapperFn = async function* (streamSignal?: AbortSignal) {\n // build execution context\n const context: InterceptorContext = {\n signal: streamSignal,\n metadata: new Map(),\n userKey: effectiveUserKey,\n };\n\n // build interceptors\n const interceptors = self._buildInterceptors(executeConfig);\n\n // wrap the function to ensure it returns a promise\n const wrappedFn = async () => {\n const result = await fn(context.signal);\n return result;\n };\n\n // execute the function with interceptors, restoring the parent OTel context\n // so telemetry spans are linked as children of the HTTP request span\n const result = await otelContext.with(parentOtelContext, () =>\n self._executeWithInterceptors(\n wrappedFn as (signal?: AbortSignal) => Promise<T>,\n interceptors,\n context,\n ),\n );\n\n // check if result is a generator\n if (self._checkIfGenerator(result)) {\n yield* result;\n } else {\n yield result;\n }\n };\n\n // stream the result to the client\n await this.streamManager.stream(res, asyncWrapperFn, streamConfig);\n }\n\n /**\n * Execute a function with the plugin's interceptor chain.\n *\n * Returns an {@link ExecutionResult} discriminated union:\n * - `{ ok: true, data: T }` on success\n * - `{ ok: false, status: number, message: string }` on failure\n *\n * Errors are never thrown — the method is production-safe.\n */\n protected async execute<T>(\n fn: (signal?: AbortSignal) => Promise<T>,\n options: PluginExecutionSettings,\n userKey?: string,\n ): Promise<ExecutionResult<T>> {\n const executeConfig = this._buildExecutionConfig(options);\n\n const interceptors = this._buildInterceptors(executeConfig);\n\n // get user key from context if not provided\n const effectiveUserKey = userKey ?? getCurrentUserId();\n\n const context: InterceptorContext = {\n metadata: new Map(),\n userKey: effectiveUserKey,\n };\n\n try {\n const data = await this._executeWithInterceptors(\n fn,\n interceptors,\n context,\n );\n return { ok: true, data };\n } catch (error) {\n logger.error(\"Plugin execution failed\", { error, plugin: this.name });\n\n if (error instanceof AppKitError) {\n return {\n ok: false,\n status: error.statusCode,\n message: error.message,\n };\n }\n\n if (hasHttpStatusCode(error)) {\n const isDev = process.env.NODE_ENV !== \"production\";\n const isClientError = error.statusCode >= 400 && error.statusCode < 500;\n return {\n ok: false,\n status: error.statusCode,\n message: isDev || isClientError ? error.message : \"Server error\",\n };\n }\n\n const isDev = process.env.NODE_ENV !== \"production\";\n return {\n ok: false,\n status: 500,\n message:\n isDev && error instanceof Error ? error.message : \"Server error\",\n };\n }\n }\n\n protected registerEndpoint(name: string, path: string): void {\n this.registeredEndpoints[name] = path;\n }\n\n protected route<_TResponse>(\n router: express.Router,\n config: RouteConfig,\n ): void {\n const { name, method, path, handler } = config;\n\n router[method](path, handler);\n\n const fullPath = `/api/${this.name}${path}`;\n this.registerEndpoint(name, fullPath);\n\n if (config.skipBodyParsing) {\n this.skipBodyParsingPaths.add(fullPath);\n }\n }\n\n // build execution options by merging defaults, plugin config, and user overrides\n private _buildExecutionConfig(\n options: PluginExecutionSettings,\n ): PluginExecuteConfig {\n const { default: methodDefaults, user: userOverride } = options;\n\n // Merge: method defaults <- plugin config <- user override (highest priority)\n return deepMerge(\n deepMerge(methodDefaults, this.config),\n userOverride ?? {},\n ) as PluginExecuteConfig;\n }\n\n // build interceptors based on execute options\n private _buildInterceptors(\n options: PluginExecuteConfig,\n ): ExecutionInterceptor[] {\n const interceptors: ExecutionInterceptor[] = [];\n\n // order matters: telemetry → timeout → retry → cache (innermost to outermost)\n\n const telemetryConfig = normalizeTelemetryOptions(this.config.telemetry);\n if (\n telemetryConfig.traces &&\n (options.telemetryInterceptor?.enabled ?? true)\n ) {\n interceptors.push(\n new TelemetryInterceptor(this.telemetry, options.telemetryInterceptor),\n );\n }\n\n if (options.timeout && options.timeout > 0) {\n interceptors.push(new TimeoutInterceptor(options.timeout));\n }\n\n if (\n options.retry?.enabled &&\n options.retry.attempts &&\n options.retry.attempts > 1\n ) {\n interceptors.push(new RetryInterceptor(options.retry));\n }\n\n if (options.cache?.enabled && options.cache.cacheKey?.length) {\n interceptors.push(new CacheInterceptor(this.cache, options.cache));\n }\n\n return interceptors;\n }\n\n // execute method wrapped with interceptors\n private async _executeWithInterceptors<T>(\n fn: (signal?: AbortSignal) => Promise<T>,\n interceptors: ExecutionInterceptor[],\n context: InterceptorContext,\n ): Promise<T> {\n // no interceptors, execute directly\n if (interceptors.length === 0) {\n return fn(context.signal);\n }\n // build nested execution chain from interceptors\n let wrappedFn = () => fn(context.signal);\n\n // wrap each interceptor around the previous function\n for (const interceptor of interceptors) {\n const previousFn = wrappedFn;\n wrappedFn = () => interceptor.intercept(previousFn, context);\n }\n\n return wrappedFn();\n }\n\n private _checkIfGenerator(\n result: any,\n ): result is AsyncGenerator<any, void, unknown> {\n return (\n result && typeof result === \"object\" && Symbol.asyncIterator in result\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;cAqBoB;aACyC;AAoB7D,MAAM,SAAS,aAAa,SAAS;;;;;AAMrC,MAAM,uBAAuB,iBAAiB,wBAAwB;;;;;AAMtE,SAAgB,mBAA4B;AAC1C,QAAOA,QAAY,QAAQ,CAAC,SAAS,qBAAqB,KAAK;;;;;;AAOjE,SAAS,kBACP,OACyC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,OAAO;AAGxC,OAAK,MAAM,eAAe,cAAc;GACtC,MAAM,aAAa;AACnB,qBAAkB,YAAY,UAAU,YAAY,QAAQ;;AAG9D,SAAO,WAAW;;CAGpB,AAAQ,kBACN,QAC8C;AAC9C,SACE,UAAU,OAAO,WAAW,YAAY,OAAO,iBAAiB"}
1
+ {"version":3,"file":"plugin.js","names":["otelContext","context"],"sources":["../../src/plugin/plugin.ts"],"sourcesContent":["import { createContextKey, context as otelContext } from \"@opentelemetry/api\";\nimport type express from \"express\";\nimport type {\n BasePlugin,\n BasePluginConfig,\n IAppResponse,\n PluginEndpointMap,\n PluginExecuteConfig,\n PluginExecutionSettings,\n PluginPhase,\n RouteConfig,\n StreamExecuteHandler,\n StreamExecutionSettings,\n} from \"shared\";\nimport { AppManager } from \"../app\";\nimport { CacheManager } from \"../cache\";\nimport {\n getCurrentUserId,\n runInUserContext,\n ServiceContext,\n type UserContext,\n} from \"../context\";\nimport { AppKitError, AuthenticationError } from \"../errors\";\nimport { createLogger } from \"../logging/logger\";\nimport { StreamManager } from \"../stream\";\nimport {\n type ITelemetry,\n normalizeTelemetryOptions,\n TelemetryManager,\n} from \"../telemetry\";\nimport { deepMerge } from \"../utils\";\nimport { DevFileReader } from \"./dev-reader\";\nimport type { ExecutionResult } from \"./execution-result\";\nimport { CacheInterceptor } from \"./interceptors/cache\";\nimport { RetryInterceptor } from \"./interceptors/retry\";\nimport { TelemetryInterceptor } from \"./interceptors/telemetry\";\nimport { TimeoutInterceptor } from \"./interceptors/timeout\";\nimport type {\n ExecutionInterceptor,\n InterceptorContext,\n} from \"./interceptors/types\";\n\nconst logger = createLogger(\"plugin\");\n\n/**\n * OTel context key for marking OBO dev mode fallback.\n * Set when asUser() is called in development mode without a user token.\n */\nconst DEV_OBO_FALLBACK_KEY = createContextKey(\"appkit.devOboFallback\");\n\n/**\n * Returns true if the current execution is an OBO dev mode fallback\n * (asUser() was called but fell back to service principal due to missing token).\n */\nexport function isDevOboFallback(): boolean {\n return otelContext.active().getValue(DEV_OBO_FALLBACK_KEY) === true;\n}\n\n/**\n * Narrow an unknown thrown value to an Error that carries a numeric\n * `statusCode` property (e.g. `ApiError` from `@databricks/sdk-experimental`).\n */\nfunction hasHttpStatusCode(\n error: unknown,\n): error is Error & { statusCode: number } {\n return (\n error instanceof Error &&\n \"statusCode\" in error &&\n typeof (error as Record<string, unknown>).statusCode === \"number\"\n );\n}\n\n/**\n * Methods that should not be proxied by asUser().\n * These are lifecycle/internal methods that don't make sense\n * to execute in a user context.\n */\nconst EXCLUDED_FROM_PROXY = new Set([\n // Lifecycle methods\n \"setup\",\n \"shutdown\",\n \"injectRoutes\",\n \"getEndpoints\",\n \"getSkipBodyParsingPaths\",\n \"abortActiveOperations\",\n \"clientConfig\",\n // asUser itself - prevent chaining like .asUser().asUser()\n \"asUser\",\n // Internal methods\n \"constructor\",\n]);\n\n/**\n * Base abstract class for creating AppKit plugins.\n *\n * All plugins must declare a static `manifest` property with their metadata\n * and resource requirements. The manifest defines:\n * - `required` resources: Always needed for the plugin to function\n * - `optional` resources: May be needed depending on plugin configuration\n *\n * ## Static vs Runtime Resource Requirements\n *\n * The manifest is static and doesn't know the plugin's runtime configuration.\n * For resources that become required based on config options, plugins can\n * implement a static `getResourceRequirements(config)` method.\n *\n * At runtime, this method is called with the actual config to determine\n * which \"optional\" resources should be treated as \"required\".\n *\n * @example Basic plugin with static requirements\n * ```typescript\n * import { Plugin, toPlugin, PluginManifest, ResourceType } from '@databricks/appkit';\n *\n * const myManifest: PluginManifest = {\n * name: 'myPlugin',\n * displayName: 'My Plugin',\n * description: 'Does something awesome',\n * resources: {\n * required: [\n * { type: ResourceType.SQL_WAREHOUSE, alias: 'warehouse', ... }\n * ],\n * optional: []\n * }\n * };\n *\n * class MyPlugin extends Plugin<MyConfig> {\n * static manifest = myManifest;\n * }\n * ```\n *\n * @example Plugin with config-dependent resources\n * ```typescript\n * interface MyConfig extends BasePluginConfig {\n * enableCaching?: boolean;\n * }\n *\n * const myManifest: PluginManifest = {\n * name: 'myPlugin',\n * resources: {\n * required: [\n * { type: ResourceType.SQL_WAREHOUSE, alias: 'warehouse', ... }\n * ],\n * optional: [\n * // Database is optional in the static manifest\n * { type: ResourceType.DATABASE, alias: 'cache', description: 'Required if caching enabled', ... }\n * ]\n * }\n * };\n *\n * class MyPlugin extends Plugin<MyConfig> {\n * static manifest = myManifest<\"myPlugin\">;\n *\n * // Runtime method: converts optional resources to required based on config\n * static getResourceRequirements(config: MyConfig) {\n * const resources = [];\n * if (config.enableCaching) {\n * // When caching is enabled, Database becomes required\n * resources.push({\n * type: ResourceType.DATABASE,\n * alias: 'cache',\n * resourceKey: 'database',\n * description: 'Cache storage for query results',\n * permission: 'CAN_CONNECT_AND_CREATE',\n * fields: {\n * instance_name: { env: 'DATABRICKS_CACHE_INSTANCE' },\n * database_name: { env: 'DATABRICKS_CACHE_DB' },\n * },\n * required: true // Mark as required at runtime\n * });\n * }\n * return resources;\n * }\n * }\n * ```\n */\nexport abstract class Plugin<\n TConfig extends BasePluginConfig = BasePluginConfig,\n> implements BasePlugin\n{\n protected isReady = false;\n protected cache: CacheManager;\n protected app: AppManager;\n protected devFileReader: DevFileReader;\n protected streamManager: StreamManager;\n protected telemetry: ITelemetry;\n\n /** Registered endpoints for this plugin */\n private registeredEndpoints: PluginEndpointMap = {};\n\n /** Paths that opt out of JSON body parsing (e.g. file upload routes) */\n private skipBodyParsingPaths: Set<string> = new Set();\n\n /**\n * Plugin initialization phase.\n * - 'core': Initialized first (e.g., config plugins)\n * - 'normal': Initialized second (most plugins)\n * - 'deferred': Initialized last (e.g., server plugin)\n */\n static phase: PluginPhase = \"normal\";\n\n /**\n * Plugin name identifier.\n */\n name: string;\n\n constructor(protected config: TConfig) {\n this.name =\n config.name ??\n (this.constructor as { manifest?: { name: string } }).manifest?.name ??\n \"plugin\";\n this.telemetry = TelemetryManager.getProvider(this.name, config.telemetry);\n this.streamManager = new StreamManager();\n this.cache = CacheManager.getInstanceSync();\n this.app = new AppManager();\n this.devFileReader = DevFileReader.getInstance();\n\n this.isReady = true;\n }\n\n injectRoutes(_: express.Router) {\n return;\n }\n\n async setup() {}\n\n getEndpoints(): PluginEndpointMap {\n return this.registeredEndpoints;\n }\n\n getSkipBodyParsingPaths(): ReadonlySet<string> {\n return this.skipBodyParsingPaths;\n }\n\n abortActiveOperations(): void {\n this.streamManager.abortAll();\n }\n\n /**\n * Returns the public exports for this plugin.\n * Override this to define a custom public API.\n * By default, returns an empty object.\n *\n * The returned object becomes the plugin's public API on the AppKit instance\n * (e.g. `appkit.myPlugin.method()`). AppKit automatically binds method context\n * and adds `asUser(req)` for user-scoped execution.\n *\n * @example\n * ```ts\n * class MyPlugin extends Plugin {\n * private getData() { return []; }\n *\n * exports() {\n * return { getData: this.getData };\n * }\n * }\n *\n * // After registration:\n * const appkit = await createApp({ plugins: [myPlugin()] });\n * appkit.myPlugin.getData();\n * ```\n */\n exports(): unknown {\n return {};\n }\n\n /**\n * Returns startup config to expose to the client.\n * Override this to surface server-side values that are safe to publish to the\n * frontend, such as feature flags, resource IDs, or other app boot settings.\n *\n * This runs once when the server starts, so it should not depend on\n * request-scoped or user-specific state.\n *\n * String values that match non-public environment variables are redacted\n * unless you intentionally expose them via a matching `PUBLIC_APPKIT_` env var.\n *\n * Values must be JSON-serializable plain data (no functions, Dates, classes,\n * Maps, Sets, BigInts, or circular references).\n * By default returns an empty object (plugin contributes nothing to client config).\n *\n * On the client, read the config with the `usePluginClientConfig` hook\n * (React) or the `getPluginClientConfig` function (vanilla JS), both\n * from `@databricks/appkit-ui`.\n *\n * @example\n * ```ts\n * // Server — plugin definition\n * class MyPlugin extends Plugin<MyConfig> {\n * clientConfig() {\n * return {\n * warehouseId: this.config.warehouseId,\n * features: { darkMode: true },\n * };\n * }\n * }\n *\n * // Client — React component\n * import { usePluginClientConfig } from \"@databricks/appkit-ui/react\";\n *\n * interface MyPluginConfig { warehouseId: string; features: { darkMode: boolean } }\n *\n * const config = usePluginClientConfig<MyPluginConfig>(\"myPlugin\");\n * config.warehouseId; // \"abc-123\"\n *\n * // Client — vanilla JS\n * import { getPluginClientConfig } from \"@databricks/appkit-ui/js\";\n *\n * const config = getPluginClientConfig<MyPluginConfig>(\"myPlugin\");\n * ```\n */\n clientConfig(): Record<string, unknown> {\n return {};\n }\n\n /**\n * Resolve the effective user ID from a request.\n *\n * Returns the `x-forwarded-user` header when present. In development mode\n * (`NODE_ENV=development`) falls back to the current context user ID so\n * that callers outside an active `runInUserContext` scope still get a\n * consistent value.\n *\n * @throws AuthenticationError in production when no user header is present.\n */\n protected resolveUserId(req: express.Request): string {\n const userId = req.header(\"x-forwarded-user\");\n if (userId) return userId;\n if (process.env.NODE_ENV === \"development\") return getCurrentUserId();\n throw AuthenticationError.missingToken(\n \"Missing x-forwarded-user header. Cannot resolve user ID.\",\n );\n }\n\n /**\n * Execute operations using the user's identity from the request.\n * Returns a proxy of this plugin where all method calls execute\n * with the user's Databricks credentials instead of the service principal.\n *\n * @param req - The Express request containing the user token in headers\n * @returns A proxied plugin instance that executes as the user\n * @throws AuthenticationError if user token is not available in request headers (production only).\n * In development mode (`NODE_ENV=development`), skips user impersonation instead of throwing.\n */\n asUser(req: express.Request): this {\n const token = req.header(\"x-forwarded-access-token\");\n const userId = req.header(\"x-forwarded-user\");\n const isDev = process.env.NODE_ENV === \"development\";\n\n // In local development, skip user impersonation\n // since there's no user token available\n if (!token && isDev) {\n logger.warn(\n \"asUser() called without user token in development mode. Skipping user impersonation.\",\n );\n\n // Return a proxy that marks execution as OBO dev fallback via OTel context,\n // so telemetry spans can distinguish intended OBO calls from regular SP calls\n return new Proxy(this, {\n get: (target, prop, receiver) => {\n const value = Reflect.get(target, prop, receiver);\n if (typeof value !== \"function\") return value;\n if (typeof prop === \"string\" && EXCLUDED_FROM_PROXY.has(prop))\n return value;\n\n return (...args: unknown[]) => {\n const ctx = otelContext\n .active()\n .setValue(DEV_OBO_FALLBACK_KEY, true);\n return otelContext.with(ctx, () => value.apply(target, args));\n };\n },\n }) as this;\n }\n\n if (!token) {\n throw AuthenticationError.missingToken(\"user token\");\n }\n\n if (!userId && !isDev) {\n throw AuthenticationError.missingUserId();\n }\n\n const effectiveUserId = userId || \"dev-user\";\n\n const userContext = ServiceContext.createUserContext(\n token,\n effectiveUserId,\n );\n\n // Return a proxy that wraps method calls in user context\n return this._createUserContextProxy(userContext);\n }\n\n /**\n * Creates a proxy that wraps method calls in a user context.\n * This allows all plugin methods to automatically use the user's\n * Databricks credentials.\n */\n private _createUserContextProxy(userContext: UserContext): this {\n return new Proxy(this, {\n get: (target, prop, receiver) => {\n const value = Reflect.get(target, prop, receiver);\n\n if (typeof value !== \"function\") {\n return value;\n }\n\n if (typeof prop === \"string\" && EXCLUDED_FROM_PROXY.has(prop)) {\n return value;\n }\n\n return (...args: unknown[]) => {\n return runInUserContext(userContext, () => value.apply(target, args));\n };\n },\n }) as this;\n }\n\n // streaming execution with interceptors\n protected async executeStream<T>(\n res: IAppResponse,\n fn: StreamExecuteHandler<T>,\n options: StreamExecutionSettings,\n userKey?: string,\n ) {\n // destructure options\n const {\n stream: streamConfig,\n default: defaultConfig,\n user: userConfig,\n } = options;\n\n // build execution options\n const executeConfig = this._buildExecutionConfig({\n default: defaultConfig,\n user: userConfig,\n });\n\n // get user key from context if not provided\n const effectiveUserKey = userKey ?? getCurrentUserId();\n\n const self = this;\n // capture the active OTel context (HTTP span) before entering the async generator,\n // where it would otherwise be lost across the async boundary\n const parentOtelContext = otelContext.active();\n\n // wrapper function to ensure it returns a generator\n const asyncWrapperFn = async function* (streamSignal?: AbortSignal) {\n // build execution context\n const context: InterceptorContext = {\n signal: streamSignal,\n metadata: new Map(),\n userKey: effectiveUserKey,\n };\n\n // build interceptors\n const interceptors = self._buildInterceptors(executeConfig);\n\n // wrap the function to ensure it returns a promise\n const wrappedFn = async () => {\n const result = await fn(context.signal);\n return result;\n };\n\n // execute the function with interceptors, restoring the parent OTel context\n // so telemetry spans are linked as children of the HTTP request span\n const result = await otelContext.with(parentOtelContext, () =>\n self._executeWithInterceptors(\n wrappedFn as (signal?: AbortSignal) => Promise<T>,\n interceptors,\n context,\n ),\n );\n\n // check if result is a generator\n if (self._checkIfGenerator(result)) {\n yield* result;\n } else {\n yield result;\n }\n };\n\n // stream the result to the client. The effective user key is forwarded\n // to the stream manager so that reconnections to existing streamIds are\n // bound to the original creator (prevents cross-user stream takeover via\n // guessed/leaked IDs).\n await this.streamManager.stream(\n res,\n asyncWrapperFn,\n streamConfig,\n effectiveUserKey,\n );\n }\n\n /**\n * Execute a function with the plugin's interceptor chain.\n *\n * Returns an {@link ExecutionResult} discriminated union:\n * - `{ ok: true, data: T }` on success\n * - `{ ok: false, status: number, message: string }` on failure\n *\n * Errors are never thrown — the method is production-safe.\n */\n protected async execute<T>(\n fn: (signal?: AbortSignal) => Promise<T>,\n options: PluginExecutionSettings,\n userKey?: string,\n ): Promise<ExecutionResult<T>> {\n const executeConfig = this._buildExecutionConfig(options);\n\n const interceptors = this._buildInterceptors(executeConfig);\n\n // get user key from context if not provided\n const effectiveUserKey = userKey ?? getCurrentUserId();\n\n const context: InterceptorContext = {\n metadata: new Map(),\n userKey: effectiveUserKey,\n };\n\n try {\n const data = await this._executeWithInterceptors(\n fn,\n interceptors,\n context,\n );\n return { ok: true, data };\n } catch (error) {\n logger.error(\"Plugin execution failed\", { error, plugin: this.name });\n\n if (error instanceof AppKitError) {\n return {\n ok: false,\n status: error.statusCode,\n message: error.message,\n };\n }\n\n if (hasHttpStatusCode(error)) {\n const isDev = process.env.NODE_ENV !== \"production\";\n const isClientError = error.statusCode >= 400 && error.statusCode < 500;\n return {\n ok: false,\n status: error.statusCode,\n message: isDev || isClientError ? error.message : \"Server error\",\n };\n }\n\n const isDev = process.env.NODE_ENV !== \"production\";\n return {\n ok: false,\n status: 500,\n message:\n isDev && error instanceof Error ? error.message : \"Server error\",\n };\n }\n }\n\n protected registerEndpoint(name: string, path: string): void {\n this.registeredEndpoints[name] = path;\n }\n\n protected route<_TResponse>(\n router: express.Router,\n config: RouteConfig,\n ): void {\n const { name, method, path, handler } = config;\n\n router[method](path, handler);\n\n const fullPath = `/api/${this.name}${path}`;\n this.registerEndpoint(name, fullPath);\n\n if (config.skipBodyParsing) {\n this.skipBodyParsingPaths.add(fullPath);\n }\n }\n\n // build execution options by merging defaults, plugin config, and user overrides\n private _buildExecutionConfig(\n options: PluginExecutionSettings,\n ): PluginExecuteConfig {\n const { default: methodDefaults, user: userOverride } = options;\n\n // Merge: method defaults <- plugin config <- user override (highest priority)\n return deepMerge(\n deepMerge(methodDefaults, this.config),\n userOverride ?? {},\n ) as PluginExecuteConfig;\n }\n\n // build interceptors based on execute options\n private _buildInterceptors(\n options: PluginExecuteConfig,\n ): ExecutionInterceptor[] {\n const interceptors: ExecutionInterceptor[] = [];\n\n // order matters: telemetry → timeout → retry → cache (innermost to outermost)\n\n const telemetryConfig = normalizeTelemetryOptions(this.config.telemetry);\n if (\n telemetryConfig.traces &&\n (options.telemetryInterceptor?.enabled ?? true)\n ) {\n interceptors.push(\n new TelemetryInterceptor(this.telemetry, options.telemetryInterceptor),\n );\n }\n\n if (options.timeout && options.timeout > 0) {\n interceptors.push(new TimeoutInterceptor(options.timeout));\n }\n\n if (\n options.retry?.enabled &&\n options.retry.attempts &&\n options.retry.attempts > 1\n ) {\n interceptors.push(new RetryInterceptor(options.retry));\n }\n\n if (options.cache?.enabled && options.cache.cacheKey?.length) {\n interceptors.push(new CacheInterceptor(this.cache, options.cache));\n }\n\n return interceptors;\n }\n\n // execute method wrapped with interceptors\n private async _executeWithInterceptors<T>(\n fn: (signal?: AbortSignal) => Promise<T>,\n interceptors: ExecutionInterceptor[],\n context: InterceptorContext,\n ): Promise<T> {\n // no interceptors, execute directly\n if (interceptors.length === 0) {\n return fn(context.signal);\n }\n // build nested execution chain from interceptors\n let wrappedFn = () => fn(context.signal);\n\n // wrap each interceptor around the previous function\n for (const interceptor of interceptors) {\n const previousFn = wrappedFn;\n wrappedFn = () => interceptor.intercept(previousFn, context);\n }\n\n return wrappedFn();\n }\n\n private _checkIfGenerator(\n result: any,\n ): result is AsyncGenerator<any, void, unknown> {\n return (\n result && typeof result === \"object\" && Symbol.asyncIterator in result\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;cAqBoB;aACyC;AAoB7D,MAAM,SAAS,aAAa,SAAS;;;;;AAMrC,MAAM,uBAAuB,iBAAiB,wBAAwB;;;;;AAMtE,SAAgB,mBAA4B;AAC1C,QAAOA,QAAY,QAAQ,CAAC,SAAS,qBAAqB,KAAK;;;;;;AAOjE,SAAS,kBACP,OACyC;AACzC,QACE,iBAAiB,SACjB,gBAAgB,SAChB,OAAQ,MAAkC,eAAe;;;;;;;AAS7D,MAAM,sBAAsB,IAAI,IAAI;CAElC;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CAEA;CACD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFF,IAAsB,SAAtB,MAGA;CACE,AAAU,UAAU;CACpB,AAAU;CACV,AAAU;CACV,AAAU;CACV,AAAU;CACV,AAAU;;CAGV,AAAQ,sBAAyC,EAAE;;CAGnD,AAAQ,uCAAoC,IAAI,KAAK;;;;;;;CAQrD,OAAO,QAAqB;;;;CAK5B;CAEA,YAAY,AAAU,QAAiB;EAAjB;AACpB,OAAK,OACH,OAAO,QACN,KAAK,YAAgD,UAAU,QAChE;AACF,OAAK,YAAY,iBAAiB,YAAY,KAAK,MAAM,OAAO,UAAU;AAC1E,OAAK,gBAAgB,IAAI,eAAe;AACxC,OAAK,QAAQ,aAAa,iBAAiB;AAC3C,OAAK,MAAM,IAAI,YAAY;AAC3B,OAAK,gBAAgB,cAAc,aAAa;AAEhD,OAAK,UAAU;;CAGjB,aAAa,GAAmB;CAIhC,MAAM,QAAQ;CAEd,eAAkC;AAChC,SAAO,KAAK;;CAGd,0BAA+C;AAC7C,SAAO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;AAG5D,MACE,QAAQ,OAAO,WACf,QAAQ,MAAM,YACd,QAAQ,MAAM,WAAW,EAEzB,cAAa,KAAK,IAAI,iBAAiB,QAAQ,MAAM,CAAC;AAGxD,MAAI,QAAQ,OAAO,WAAW,QAAQ,MAAM,UAAU,OACpD,cAAa,KAAK,IAAI,iBAAiB,KAAK,OAAO,QAAQ,MAAM,CAAC;AAGpE,SAAO;;CAIT,MAAc,yBACZ,IACA,cACA,SACY;AAEZ,MAAI,aAAa,WAAW,EAC1B,QAAO,GAAG,QAAQ,OAAO;EAG3B,IAAI,kBAAkB,GAAG,QAAQ,OAAO;AAGxC,OAAK,MAAM,eAAe,cAAc;GACtC,MAAM,aAAa;AACnB,qBAAkB,YAAY,UAAU,YAAY,QAAQ;;AAG9D,SAAO,WAAW;;CAGpB,AAAQ,kBACN,QAC8C;AAC9C,SACE,UAAU,OAAO,WAAW,YAAY,OAAO,iBAAiB"}
@@ -41,6 +41,8 @@ declare class ServerPlugin extends Plugin {
41
41
  private server;
42
42
  private viteDevServer?;
43
43
  private remoteTunnelController?;
44
+ /** Bound listen port after optional dev-time resolution. */
45
+ private resolvedListenPort?;
44
46
  protected config: ServerConfig;
45
47
  private serverExtensions;
46
48
  private rawBodyPaths;
@@ -100,6 +102,12 @@ declare class ServerPlugin extends Plugin {
100
102
  */
101
103
  private setupFrontend;
102
104
  private static findStaticPath;
105
+ /**
106
+ * In development, prefers {@link ServerConfig.port} / env / default (8000), then
107
+ * scans upward using `get-port`'s `portNumbers()` on the listen host until one binds.
108
+ * In non-development, uses config / env / default only (no fallback).
109
+ */
110
+ private resolveListenPort;
103
111
  private logStartupInfo;
104
112
  private _gracefulShutdown;
105
113
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/plugins/server/index.ts"],"mappings":";;;;;;;;;;;;;;;;AA4CA;;;;;;;;;;;;;;;;cAAa,YAAA,SAAqB,MAAA;EAAA,OAClB,cAAA;;;;;SAMP,QAAA,EA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AAA,CAAA;IAAA;;;;;gBAHW,gBAAA;EAAA;;;;;;;;;EAiBL,KAAA,CAAA,GAAS,OAAA,CAAQ,OAAA,CAAQ,WAAA;EA6D/B;;;;;;;;EAAA,SAAA,CAAA,GAAa,MAAA;EA2IE;;;;;;;;;EA1Hf,MAAA,CAAO,EAAA,GAAK,GAAA,EAAK,OAAA,CAAQ,WAAA;;;;;;;;UAYX,YAAA;;;;;;AAuQhB;UArMgB,aAAA;EAAA,eA4CC,cAAA;EAyJE;;;;;EAAA,QAvIH,iBAAA;EAAA,QAqBN,cAAA;EAAA,QA+BM,iBAAA;EAmFG;;;;EAlCjB,OAAA,CAAA;yEAIgB,GAAA,EAAK,OAAA,CAAQ,WAAA;qBAtQhB,MAAA;;;;;;;kBAAU,gBAAA;IAAA;;;;;;;cAoSZ,MAAA,EAAM,QAAA,QAAA,YAAA,EAAA,YAAA"}
@@ -16,11 +16,14 @@ import path from "node:path";
16
16
  import fs from "node:fs";
17
17
  import dotenv from "dotenv";
18
18
  import express from "express";
19
+ import getPort, { portNumbers } from "get-port";
19
20
 
20
21
  //#region src/plugins/server/index.ts
21
22
  init_errors();
22
23
  dotenv.config({ path: path.resolve(process.cwd(), "./.env") });
23
24
  const logger = createLogger("server");
25
+ /** Dev-only: try `requested` then consecutive ports (see `get-port` `portNumbers`). */
26
+ const devListenPortSpan = 100;
24
27
  /**
25
28
  * Server plugin for the AppKit.
26
29
  *
@@ -53,6 +56,8 @@ var ServerPlugin = class ServerPlugin extends Plugin {
53
56
  server;
54
57
  viteDevServer;
55
58
  remoteTunnelController;
59
+ /** Bound listen port after optional dev-time resolution. */
60
+ resolvedListenPort;
56
61
  serverExtensions = [];
57
62
  rawBodyPaths = /* @__PURE__ */ new Set();
58
63
  static phase = "deferred";
@@ -90,7 +95,8 @@ var ServerPlugin = class ServerPlugin extends Plugin {
90
95
  this.remoteTunnelController = new RemoteTunnelController(this.devFileReader);
91
96
  this.serverApplication.use(this.remoteTunnelController.middleware);
92
97
  await this.setupFrontend(endpoints, pluginConfigs);
93
- const server = this.serverApplication.listen(this.config.port ?? ServerPlugin.DEFAULT_CONFIG.port, this.config.host ?? ServerPlugin.DEFAULT_CONFIG.host, () => this.logStartupInfo());
98
+ const listenPort = await this.resolveListenPort();
99
+ const server = this.serverApplication.listen(listenPort, this.config.host ?? ServerPlugin.DEFAULT_CONFIG.host, () => this.logStartupInfo());
94
100
  this.server = server;
95
101
  this.remoteTunnelController.setServer(server);
96
102
  process.on("SIGTERM", () => this._gracefulShutdown());
@@ -203,10 +209,29 @@ var ServerPlugin = class ServerPlugin extends Plugin {
203
209
  }
204
210
  }
205
211
  }
212
+ /**
213
+ * In development, prefers {@link ServerConfig.port} / env / default (8000), then
214
+ * scans upward using `get-port`'s `portNumbers()` on the listen host until one binds.
215
+ * In non-development, uses config / env / default only (no fallback).
216
+ */
217
+ async resolveListenPort() {
218
+ const requested = this.config.port ?? ServerPlugin.DEFAULT_CONFIG.port;
219
+ if (process.env.NODE_ENV !== "development") {
220
+ this.resolvedListenPort = requested;
221
+ return requested;
222
+ }
223
+ const port = await getPort({
224
+ host: this.config.host ?? ServerPlugin.DEFAULT_CONFIG.host,
225
+ port: portNumbers(requested, Math.min(requested + devListenPortSpan - 1, 65535))
226
+ });
227
+ this.resolvedListenPort = port;
228
+ if (port !== requested) logger.info("Port %d was busy, picking %d", requested, port);
229
+ return port;
230
+ }
206
231
  logStartupInfo() {
207
232
  const isDev = process.env.NODE_ENV === "development";
208
233
  const hasExplicitStaticPath = this.config.staticPath !== void 0;
209
- const port = this.config.port ?? ServerPlugin.DEFAULT_CONFIG.port;
234
+ const port = this.resolvedListenPort ?? this.config.port ?? ServerPlugin.DEFAULT_CONFIG.port;
210
235
  const host = this.config.host ?? ServerPlugin.DEFAULT_CONFIG.host;
211
236
  logger.info("Server running on http://%s:%d", host, port);
212
237
  if (hasExplicitStaticPath) logger.info("Mode: static (%s)", this.config.staticPath);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["manifest"],"sources":["../../../src/plugins/server/index.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport type { Server as HTTPServer } from \"node:http\";\nimport path from \"node:path\";\nimport dotenv from \"dotenv\";\nimport express from \"express\";\nimport type { PluginClientConfigs, PluginPhase } from \"shared\";\nimport { ServerError } from \"../../errors\";\nimport { createLogger } from \"../../logging/logger\";\nimport { Plugin, toPlugin } from \"../../plugin\";\nimport type { PluginManifest } from \"../../registry\";\nimport { instrumentations } from \"../../telemetry\";\nimport { sanitizeClientConfig } from \"./client-config-sanitizer\";\nimport manifest from \"./manifest.json\";\nimport { RemoteTunnelController } from \"./remote-tunnel/remote-tunnel-controller\";\nimport { StaticServer } from \"./static-server\";\nimport type { ServerConfig } from \"./types\";\nimport { getRoutes, type PluginEndpoints, printRoutes } from \"./utils\";\nimport { ViteDevServer } from \"./vite-dev-server\";\n\ndotenv.config({ path: path.resolve(process.cwd(), \"./.env\") });\n\nconst logger = createLogger(\"server\");\n\n/**\n * Server plugin for the AppKit.\n *\n * This plugin is responsible for starting the server and serving the static files.\n * It also handles the remote tunneling for development purposes.\n *\n * The server is started automatically by `createApp` after all plugins are set up\n * and the optional `onPluginsReady` callback has run.\n *\n * @example\n * ```ts\n * createApp({\n * plugins: [server(), analytics({})],\n * onPluginsReady(appkit) {\n * appkit.server.extend((app) => {\n * app.get(\"/custom\", (_req, res) => res.json({ ok: true }));\n * });\n * },\n * });\n * ```\n */\nexport class ServerPlugin extends Plugin {\n public static DEFAULT_CONFIG = {\n host: process.env.FLASK_RUN_HOST || \"0.0.0.0\",\n port: Number(process.env.DATABRICKS_APP_PORT) || 8000,\n };\n\n /** Plugin manifest declaring metadata and resource requirements */\n static manifest = manifest as PluginManifest<\"server\">;\n private serverApplication: express.Application;\n private server: HTTPServer | null;\n private viteDevServer?: ViteDevServer;\n private remoteTunnelController?: RemoteTunnelController;\n protected declare config: ServerConfig;\n private serverExtensions: ((app: express.Application) => void)[] = [];\n private rawBodyPaths: Set<string> = new Set();\n static phase: PluginPhase = \"deferred\";\n\n constructor(config: ServerConfig) {\n if (\"autoStart\" in config) {\n throw new ServerError(\n \"server({ autoStart }) has been removed. \" +\n \"The server is now started automatically by createApp.\\n\\n\" +\n \"Run `npx appkit codemod on-plugins-ready --write` to auto-migrate.\",\n );\n }\n super(config);\n this.config = config;\n this.serverApplication = express();\n this.server = null;\n this.serverExtensions = [];\n this.telemetry.registerInstrumentations([\n instrumentations.http,\n instrumentations.express,\n ]);\n }\n\n async setup() {}\n\n /** Get the server configuration. */\n getConfig() {\n const { plugins: _plugins, ...config } = this.config;\n\n return config;\n }\n\n /**\n * Start the server.\n *\n * This method starts the server and sets up the frontend.\n * It also sets up the remote tunneling if enabled.\n *\n * @returns The express application.\n */\n async start(): Promise<express.Application> {\n this.serverApplication.use(\n express.json({\n type: (req) => {\n // Skip JSON parsing for routes that declared skipBodyParsing\n // (e.g. file uploads where the raw body must flow through).\n // rawBodyPaths is populated by extendRoutes() below; the type\n // callback runs per-request so the set is already filled.\n const urlPath = req.url?.split(\"?\")[0];\n if (urlPath && this.rawBodyPaths.has(urlPath)) return false;\n const ct = req.headers[\"content-type\"] ?? \"\";\n return ct.includes(\"json\");\n },\n }),\n );\n\n const { endpoints, pluginConfigs } = await this.extendRoutes();\n\n for (const extension of this.serverExtensions) {\n extension(this.serverApplication);\n }\n\n // register remote tunnel controller (before static/vite)\n this.remoteTunnelController = new RemoteTunnelController(\n this.devFileReader,\n );\n this.serverApplication.use(this.remoteTunnelController.middleware);\n\n await this.setupFrontend(endpoints, pluginConfigs);\n\n const server = this.serverApplication.listen(\n this.config.port ?? ServerPlugin.DEFAULT_CONFIG.port,\n this.config.host ?? ServerPlugin.DEFAULT_CONFIG.host,\n () => this.logStartupInfo(),\n );\n\n this.server = server;\n\n // attach server to remote tunnel controller\n this.remoteTunnelController.setServer(server);\n\n process.on(\"SIGTERM\", () => this._gracefulShutdown());\n process.on(\"SIGINT\", () => this._gracefulShutdown());\n\n if (process.env.NODE_ENV === \"development\") {\n const allRoutes = getRoutes(this.serverApplication._router.stack);\n printRoutes(allRoutes);\n }\n return this.serverApplication;\n }\n\n /**\n * Get the low level node.js http server instance.\n *\n * Only use this method if you need to access the server instance for advanced usage like a custom websocket server, etc.\n *\n * @throws {Error} If the server has not started yet.\n * @returns {HTTPServer} The server instance.\n */\n getServer(): HTTPServer {\n if (!this.server) {\n throw ServerError.notStarted();\n }\n\n return this.server;\n }\n\n /**\n * Extend the server with custom routes or middleware.\n *\n * Call this inside the `onPluginsReady` callback of `createApp` to register\n * custom Express routes or middleware before the server starts listening.\n *\n * @param fn - A function that receives the express application.\n * @returns The server plugin instance for chaining.\n */\n extend(fn: (app: express.Application) => void) {\n this.serverExtensions.push(fn);\n return this;\n }\n\n /**\n * Setup the routes with the plugins.\n *\n * This method goes through all the plugins and injects the routes into the server application.\n * Returns a map of plugin names to their registered named endpoints,\n * and a map of plugin names to their client-exposed configs.\n */\n private async extendRoutes(): Promise<{\n endpoints: PluginEndpoints;\n pluginConfigs: PluginClientConfigs;\n }> {\n const endpoints: PluginEndpoints = {};\n const pluginConfigs: PluginClientConfigs = {};\n\n if (!this.config.plugins) return { endpoints, pluginConfigs };\n\n this.serverApplication.get(\"/health\", (_, res) => {\n res.status(200).json({ status: \"ok\" });\n });\n this.registerEndpoint(\"health\", \"/health\");\n\n for (const plugin of Object.values(this.config.plugins)) {\n if (EXCLUDED_PLUGINS.includes(plugin.name)) continue;\n\n if (plugin?.injectRoutes && typeof plugin.injectRoutes === \"function\") {\n const router = express.Router();\n\n plugin.injectRoutes(router);\n\n const basePath = `/api/${plugin.name}`;\n this.serverApplication.use(basePath, router);\n\n endpoints[plugin.name] = plugin.getEndpoints();\n\n // Collect paths that should skip body parsing\n if (\n plugin.getSkipBodyParsingPaths &&\n typeof plugin.getSkipBodyParsingPaths === \"function\"\n ) {\n for (const p of plugin.getSkipBodyParsingPaths()) {\n this.rawBodyPaths.add(p);\n }\n }\n }\n\n if (typeof plugin.clientConfig === \"function\") {\n try {\n const raw = plugin.clientConfig();\n if (raw != null) {\n const sanitized = sanitizeClientConfig(plugin.name, raw);\n if (Object.keys(sanitized).length > 0) {\n pluginConfigs[plugin.name] = sanitized;\n }\n }\n } catch (error) {\n logger.error(\n \"Plugin '%s' clientConfig() failed, skipping its config: %O\",\n plugin.name,\n error,\n );\n }\n }\n }\n\n return { endpoints, pluginConfigs };\n }\n\n /**\n * Setup frontend serving based on environment:\n * - If staticPath is explicitly provided: use static server\n * - Dev mode (no staticPath): Vite for HMR\n * - Production (no staticPath): Static files auto-detected\n */\n private async setupFrontend(\n endpoints: PluginEndpoints,\n pluginConfigs: PluginClientConfigs,\n ) {\n const isDev = process.env.NODE_ENV === \"development\";\n const hasExplicitStaticPath = this.config.staticPath !== undefined;\n\n // explict static path provided\n if (hasExplicitStaticPath) {\n const staticServer = new StaticServer(\n this.serverApplication,\n this.config.staticPath as string,\n endpoints,\n pluginConfigs,\n );\n staticServer.setup();\n return;\n }\n\n // auto-detection based on environment\n if (isDev) {\n this.viteDevServer = new ViteDevServer(\n this.serverApplication,\n endpoints,\n pluginConfigs,\n );\n await this.viteDevServer.setup();\n return;\n }\n\n // auto-detection based on static path\n const staticPath = ServerPlugin.findStaticPath();\n if (staticPath) {\n const staticServer = new StaticServer(\n this.serverApplication,\n staticPath,\n endpoints,\n pluginConfigs,\n );\n\n staticServer.setup();\n }\n }\n\n private static findStaticPath() {\n const staticPaths = [\"dist\", \"client/dist\", \"build\", \"public\", \"out\"];\n const cwd = process.cwd();\n for (const p of staticPaths) {\n const fullPath = path.resolve(cwd, p);\n if (fs.existsSync(path.resolve(fullPath, \"index.html\"))) {\n logger.debug(\"Static files: serving from %s\", fullPath);\n return fullPath;\n }\n }\n return undefined;\n }\n\n private logStartupInfo() {\n const isDev = process.env.NODE_ENV === \"development\";\n const hasExplicitStaticPath = this.config.staticPath !== undefined;\n const port = this.config.port ?? ServerPlugin.DEFAULT_CONFIG.port;\n const host = this.config.host ?? ServerPlugin.DEFAULT_CONFIG.host;\n\n logger.info(\"Server running on http://%s:%d\", host, port);\n\n if (hasExplicitStaticPath) {\n logger.info(\"Mode: static (%s)\", this.config.staticPath);\n } else if (isDev) {\n logger.info(\"Mode: development (Vite HMR)\");\n } else {\n logger.info(\"Mode: production (static)\");\n }\n\n const remoteServerController = this.remoteTunnelController;\n if (!remoteServerController) {\n logger.debug(\"Remote tunnel: disabled (controller not initialized)\");\n } else {\n logger.debug(\n \"Remote tunnel: %s; %s\",\n remoteServerController.isAllowedByEnv() ? \"allowed\" : \"blocked\",\n remoteServerController.isActive() ? \"active\" : \"inactive\",\n );\n }\n }\n\n private async _gracefulShutdown() {\n logger.info(\"Starting graceful shutdown...\");\n\n if (this.viteDevServer) {\n await this.viteDevServer.close();\n }\n\n if (this.remoteTunnelController) {\n this.remoteTunnelController.cleanup();\n }\n\n // 1. abort active operations from plugins\n if (this.config.plugins) {\n for (const plugin of Object.values(this.config.plugins)) {\n if (plugin.abortActiveOperations) {\n try {\n plugin.abortActiveOperations();\n } catch (err) {\n logger.error(\n \"Error aborting operations for plugin %s: %O\",\n plugin.name,\n err,\n );\n }\n }\n }\n }\n\n // 2. close the server\n if (this.server) {\n this.server.close(() => {\n logger.debug(\"Server closed gracefully\");\n process.exit(0);\n });\n\n // 3. timeout to force shutdown after 15 seconds\n setTimeout(() => {\n logger.debug(\"Force shutdown after timeout\");\n process.exit(1);\n }, 15000);\n } else {\n process.exit(0);\n }\n }\n\n /**\n * Returns the public exports for the server plugin.\n * Exposes server management methods.\n */\n exports() {\n const self = this;\n return {\n /** Extend the server with custom routes or middleware */\n extend(fn: (app: express.Application) => void) {\n self.extend(fn);\n return this;\n },\n /** Get the underlying HTTP server instance */\n getServer: this.getServer,\n /** Get the server configuration */\n getConfig: this.getConfig,\n /** @deprecated Server is now started automatically by createApp. */\n start() {\n throw new ServerError(\n \"server.start() has been removed. Use the onPluginsReady callback instead:\\n\\n\" +\n \" createApp({\\n\" +\n \" plugins: [server(), ...],\\n\" +\n \" onPluginsReady(appkit) {\\n\" +\n \" appkit.server.extend(...);\\n\" +\n \" },\\n\" +\n \" });\\n\\n\" +\n \"Run `npx appkit codemod on-plugins-ready --write` to auto-migrate.\",\n );\n },\n };\n }\n}\n\nconst EXCLUDED_PLUGINS: string[] = [ServerPlugin.manifest.name];\n\n/**\n * @internal\n */\nexport const server = toPlugin(ServerPlugin);\n// Export manifest and types\n"],"mappings":";;;;;;;;;;;;;;;;;;;;aAM2C;AAa3C,OAAO,OAAO,EAAE,MAAM,KAAK,QAAQ,QAAQ,KAAK,EAAE,SAAS,EAAE,CAAC;AAE9D,MAAM,SAAS,aAAa,SAAS;;;;;;;;;;;;;;;;;;;;;;AAuBrC,IAAa,eAAb,MAAa,qBAAqB,OAAO;CACvC,OAAc,iBAAiB;EAC7B,MAAM,QAAQ,IAAI,kBAAkB;EACpC,MAAM,OAAO,QAAQ,IAAI,oBAAoB,IAAI;EAClD;;CAGD,OAAO,WAAWA;CAClB,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CAER,AAAQ,mBAA2D,EAAE;CACrE,AAAQ,+BAA4B,IAAI,KAAK;CAC7C,OAAO,QAAqB;CAE5B,YAAY,QAAsB;AAChC,MAAI,eAAe,OACjB,OAAM,IAAI,YACR,sKAGD;AAEH,QAAM,OAAO;AACb,OAAK,SAAS;AACd,OAAK,oBAAoB,SAAS;AAClC,OAAK,SAAS;AACd,OAAK,mBAAmB,EAAE;AAC1B,OAAK,UAAU,yBAAyB,CACtC,iBAAiB,MACjB,iBAAiB,QAClB,CAAC;;CAGJ,MAAM,QAAQ;;CAGd,YAAY;EACV,MAAM,EAAE,SAAS,UAAU,GAAG,WAAW,KAAK;AAE9C,SAAO;;;;;;;;;;CAWT,MAAM,QAAsC;AAC1C,OAAK,kBAAkB,IACrB,QAAQ,KAAK,EACX,OAAO,QAAQ;GAKb,MAAM,UAAU,IAAI,KAAK,MAAM,IAAI,CAAC;AACpC,OAAI,WAAW,KAAK,aAAa,IAAI,QA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ACb,SAAO;GAEL,OAAO,IAAwC;AAC7C,SAAK,OAAO,GAAG;AACf,WAAO;;GAGT,WAAW,KAAK;GAEhB,WAAW,KAAK;GAEhB,QAAQ;AACN,UAAM,IAAI,YACR,iRAQD;;GAEJ;;;AAIL,MAAM,mBAA6B,CAAC,aAAa,SAAS,KAAK;;;;AAK/D,MAAa,SAAS,SAAS,aAAa"}
1
+ {"version":3,"file":"index.js","names":["manifest"],"sources":["../../../src/plugins/server/index.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport type { Server as HTTPServer } from \"node:http\";\nimport path from \"node:path\";\nimport dotenv from \"dotenv\";\nimport express from \"express\";\nimport getPort, { portNumbers } from \"get-port\";\nimport type { PluginClientConfigs, PluginPhase } from \"shared\";\nimport { ServerError } from \"../../errors\";\nimport { createLogger } from \"../../logging/logger\";\nimport { Plugin, toPlugin } from \"../../plugin\";\nimport type { PluginManifest } from \"../../registry\";\nimport { instrumentations } from \"../../telemetry\";\nimport { sanitizeClientConfig } from \"./client-config-sanitizer\";\nimport manifest from \"./manifest.json\";\nimport { RemoteTunnelController } from \"./remote-tunnel/remote-tunnel-controller\";\nimport { StaticServer } from \"./static-server\";\nimport type { ServerConfig } from \"./types\";\nimport { getRoutes, type PluginEndpoints, printRoutes } from \"./utils\";\nimport { ViteDevServer } from \"./vite-dev-server\";\n\ndotenv.config({ path: path.resolve(process.cwd(), \"./.env\") });\n\nconst logger = createLogger(\"server\");\n\n/** Dev-only: try `requested` then consecutive ports (see `get-port` `portNumbers`). */\nconst devListenPortSpan = 100;\n\n/**\n * Server plugin for the AppKit.\n *\n * This plugin is responsible for starting the server and serving the static files.\n * It also handles the remote tunneling for development purposes.\n *\n * The server is started automatically by `createApp` after all plugins are set up\n * and the optional `onPluginsReady` callback has run.\n *\n * @example\n * ```ts\n * createApp({\n * plugins: [server(), analytics({})],\n * onPluginsReady(appkit) {\n * appkit.server.extend((app) => {\n * app.get(\"/custom\", (_req, res) => res.json({ ok: true }));\n * });\n * },\n * });\n * ```\n */\nexport class ServerPlugin extends Plugin {\n public static DEFAULT_CONFIG = {\n host: process.env.FLASK_RUN_HOST || \"0.0.0.0\",\n port: Number(process.env.DATABRICKS_APP_PORT) || 8000,\n };\n\n /** Plugin manifest declaring metadata and resource requirements */\n static manifest = manifest as PluginManifest<\"server\">;\n private serverApplication: express.Application;\n private server: HTTPServer | null;\n private viteDevServer?: ViteDevServer;\n private remoteTunnelController?: RemoteTunnelController;\n /** Bound listen port after optional dev-time resolution. */\n private resolvedListenPort?: number;\n protected declare config: ServerConfig;\n private serverExtensions: ((app: express.Application) => void)[] = [];\n private rawBodyPaths: Set<string> = new Set();\n static phase: PluginPhase = \"deferred\";\n\n constructor(config: ServerConfig) {\n if (\"autoStart\" in config) {\n throw new ServerError(\n \"server({ autoStart }) has been removed. \" +\n \"The server is now started automatically by createApp.\\n\\n\" +\n \"Run `npx appkit codemod on-plugins-ready --write` to auto-migrate.\",\n );\n }\n super(config);\n this.config = config;\n this.serverApplication = express();\n this.server = null;\n this.serverExtensions = [];\n this.telemetry.registerInstrumentations([\n instrumentations.http,\n instrumentations.express,\n ]);\n }\n\n async setup() {}\n\n /** Get the server configuration. */\n getConfig() {\n const { plugins: _plugins, ...config } = this.config;\n\n return config;\n }\n\n /**\n * Start the server.\n *\n * This method starts the server and sets up the frontend.\n * It also sets up the remote tunneling if enabled.\n *\n * @returns The express application.\n */\n async start(): Promise<express.Application> {\n this.serverApplication.use(\n express.json({\n type: (req) => {\n // Skip JSON parsing for routes that declared skipBodyParsing\n // (e.g. file uploads where the raw body must flow through).\n // rawBodyPaths is populated by extendRoutes() below; the type\n // callback runs per-request so the set is already filled.\n const urlPath = req.url?.split(\"?\")[0];\n if (urlPath && this.rawBodyPaths.has(urlPath)) return false;\n const ct = req.headers[\"content-type\"] ?? \"\";\n return ct.includes(\"json\");\n },\n }),\n );\n\n const { endpoints, pluginConfigs } = await this.extendRoutes();\n\n for (const extension of this.serverExtensions) {\n extension(this.serverApplication);\n }\n\n // register remote tunnel controller (before static/vite)\n this.remoteTunnelController = new RemoteTunnelController(\n this.devFileReader,\n );\n this.serverApplication.use(this.remoteTunnelController.middleware);\n\n await this.setupFrontend(endpoints, pluginConfigs);\n\n const listenPort = await this.resolveListenPort();\n\n const server = this.serverApplication.listen(\n listenPort,\n this.config.host ?? ServerPlugin.DEFAULT_CONFIG.host,\n () => this.logStartupInfo(),\n );\n\n this.server = server;\n\n // attach server to remote tunnel controller\n this.remoteTunnelController.setServer(server);\n\n process.on(\"SIGTERM\", () => this._gracefulShutdown());\n process.on(\"SIGINT\", () => this._gracefulShutdown());\n\n if (process.env.NODE_ENV === \"development\") {\n const allRoutes = getRoutes(this.serverApplication._router.stack);\n printRoutes(allRoutes);\n }\n return this.serverApplication;\n }\n\n /**\n * Get the low level node.js http server instance.\n *\n * Only use this method if you need to access the server instance for advanced usage like a custom websocket server, etc.\n *\n * @throws {Error} If the server has not started yet.\n * @returns {HTTPServer} The server instance.\n */\n getServer(): HTTPServer {\n if (!this.server) {\n throw ServerError.notStarted();\n }\n\n return this.server;\n }\n\n /**\n * Extend the server with custom routes or middleware.\n *\n * Call this inside the `onPluginsReady` callback of `createApp` to register\n * custom Express routes or middleware before the server starts listening.\n *\n * @param fn - A function that receives the express application.\n * @returns The server plugin instance for chaining.\n */\n extend(fn: (app: express.Application) => void) {\n this.serverExtensions.push(fn);\n return this;\n }\n\n /**\n * Setup the routes with the plugins.\n *\n * This method goes through all the plugins and injects the routes into the server application.\n * Returns a map of plugin names to their registered named endpoints,\n * and a map of plugin names to their client-exposed configs.\n */\n private async extendRoutes(): Promise<{\n endpoints: PluginEndpoints;\n pluginConfigs: PluginClientConfigs;\n }> {\n const endpoints: PluginEndpoints = {};\n const pluginConfigs: PluginClientConfigs = {};\n\n if (!this.config.plugins) return { endpoints, pluginConfigs };\n\n this.serverApplication.get(\"/health\", (_, res) => {\n res.status(200).json({ status: \"ok\" });\n });\n this.registerEndpoint(\"health\", \"/health\");\n\n for (const plugin of Object.values(this.config.plugins)) {\n if (EXCLUDED_PLUGINS.includes(plugin.name)) continue;\n\n if (plugin?.injectRoutes && typeof plugin.injectRoutes === \"function\") {\n const router = express.Router();\n\n plugin.injectRoutes(router);\n\n const basePath = `/api/${plugin.name}`;\n this.serverApplication.use(basePath, router);\n\n endpoints[plugin.name] = plugin.getEndpoints();\n\n // Collect paths that should skip body parsing\n if (\n plugin.getSkipBodyParsingPaths &&\n typeof plugin.getSkipBodyParsingPaths === \"function\"\n ) {\n for (const p of plugin.getSkipBodyParsingPaths()) {\n this.rawBodyPaths.add(p);\n }\n }\n }\n\n if (typeof plugin.clientConfig === \"function\") {\n try {\n const raw = plugin.clientConfig();\n if (raw != null) {\n const sanitized = sanitizeClientConfig(plugin.name, raw);\n if (Object.keys(sanitized).length > 0) {\n pluginConfigs[plugin.name] = sanitized;\n }\n }\n } catch (error) {\n logger.error(\n \"Plugin '%s' clientConfig() failed, skipping its config: %O\",\n plugin.name,\n error,\n );\n }\n }\n }\n\n return { endpoints, pluginConfigs };\n }\n\n /**\n * Setup frontend serving based on environment:\n * - If staticPath is explicitly provided: use static server\n * - Dev mode (no staticPath): Vite for HMR\n * - Production (no staticPath): Static files auto-detected\n */\n private async setupFrontend(\n endpoints: PluginEndpoints,\n pluginConfigs: PluginClientConfigs,\n ) {\n const isDev = process.env.NODE_ENV === \"development\";\n const hasExplicitStaticPath = this.config.staticPath !== undefined;\n\n // explict static path provided\n if (hasExplicitStaticPath) {\n const staticServer = new StaticServer(\n this.serverApplication,\n this.config.staticPath as string,\n endpoints,\n pluginConfigs,\n );\n staticServer.setup();\n return;\n }\n\n // auto-detection based on environment\n if (isDev) {\n this.viteDevServer = new ViteDevServer(\n this.serverApplication,\n endpoints,\n pluginConfigs,\n );\n await this.viteDevServer.setup();\n return;\n }\n\n // auto-detection based on static path\n const staticPath = ServerPlugin.findStaticPath();\n if (staticPath) {\n const staticServer = new StaticServer(\n this.serverApplication,\n staticPath,\n endpoints,\n pluginConfigs,\n );\n\n staticServer.setup();\n }\n }\n\n private static findStaticPath() {\n const staticPaths = [\"dist\", \"client/dist\", \"build\", \"public\", \"out\"];\n const cwd = process.cwd();\n for (const p of staticPaths) {\n const fullPath = path.resolve(cwd, p);\n if (fs.existsSync(path.resolve(fullPath, \"index.html\"))) {\n logger.debug(\"Static files: serving from %s\", fullPath);\n return fullPath;\n }\n }\n return undefined;\n }\n\n /**\n * In development, prefers {@link ServerConfig.port} / env / default (8000), then\n * scans upward using `get-port`'s `portNumbers()` on the listen host until one binds.\n * In non-development, uses config / env / default only (no fallback).\n */\n private async resolveListenPort(): Promise<number> {\n const requested = this.config.port ?? ServerPlugin.DEFAULT_CONFIG.port;\n\n if (process.env.NODE_ENV !== \"development\") {\n this.resolvedListenPort = requested;\n return requested;\n }\n\n const host = this.config.host ?? ServerPlugin.DEFAULT_CONFIG.host;\n const upper = Math.min(requested + devListenPortSpan - 1, 65_535);\n const port = await getPort({\n host,\n port: portNumbers(requested, upper),\n });\n this.resolvedListenPort = port;\n if (port !== requested) {\n logger.info(\"Port %d was busy, picking %d\", requested, port);\n }\n return port;\n }\n\n private logStartupInfo() {\n const isDev = process.env.NODE_ENV === \"development\";\n const hasExplicitStaticPath = this.config.staticPath !== undefined;\n const port =\n this.resolvedListenPort ??\n this.config.port ??\n ServerPlugin.DEFAULT_CONFIG.port;\n const host = this.config.host ?? ServerPlugin.DEFAULT_CONFIG.host;\n\n logger.info(\"Server running on http://%s:%d\", host, port);\n\n if (hasExplicitStaticPath) {\n logger.info(\"Mode: static (%s)\", this.config.staticPath);\n } else if (isDev) {\n logger.info(\"Mode: development (Vite HMR)\");\n } else {\n logger.info(\"Mode: production (static)\");\n }\n\n const remoteServerController = this.remoteTunnelController;\n if (!remoteServerController) {\n logger.debug(\"Remote tunnel: disabled (controller not initialized)\");\n } else {\n logger.debug(\n \"Remote tunnel: %s; %s\",\n remoteServerController.isAllowedByEnv() ? \"allowed\" : \"blocked\",\n remoteServerController.isActive() ? \"active\" : \"inactive\",\n );\n }\n }\n\n private async _gracefulShutdown() {\n logger.info(\"Starting graceful shutdown...\");\n\n if (this.viteDevServer) {\n await this.viteDevServer.close();\n }\n\n if (this.remoteTunnelController) {\n this.remoteTunnelController.cleanup();\n }\n\n // 1. abort active operations from plugins\n if (this.config.plugins) {\n for (const plugin of Object.values(this.config.plugins)) {\n if (plugin.abortActiveOperations) {\n try {\n plugin.abortActiveOperations();\n } catch (err) {\n logger.error(\n \"Error aborting operations for plugin %s: %O\",\n plugin.name,\n err,\n );\n }\n }\n }\n }\n\n // 2. close the server\n if (this.server) {\n this.server.close(() => {\n logger.debug(\"Server closed gracefully\");\n process.exit(0);\n });\n\n // 3. timeout to force shutdown after 15 seconds\n setTimeout(() => {\n logger.debug(\"Force shutdown after timeout\");\n process.exit(1);\n }, 15000);\n } else {\n process.exit(0);\n }\n }\n\n /**\n * Returns the public exports for the server plugin.\n * Exposes server management methods.\n */\n exports() {\n const self = this;\n return {\n /** Extend the server with custom routes or middleware */\n extend(fn: (app: express.Application) => void) {\n self.extend(fn);\n return this;\n },\n /** Get the underlying HTTP server instance */\n getServer: this.getServer,\n /** Get the server configuration */\n getConfig: this.getConfig,\n /** @deprecated Server is now started automatically by createApp. */\n start() {\n throw new ServerError(\n \"server.start() has been removed. Use the onPluginsReady callback instead:\\n\\n\" +\n \" createApp({\\n\" +\n \" plugins: [server(), ...],\\n\" +\n \" onPluginsReady(appkit) {\\n\" +\n \" appkit.server.extend(...);\\n\" +\n \" },\\n\" +\n \" });\\n\\n\" +\n \"Run `npx appkit codemod on-plugins-ready --write` to auto-migrate.\",\n );\n },\n };\n }\n}\n\nconst EXCLUDED_PLUGINS: string[] = [ServerPlugin.manifest.name];\n\n/**\n * @internal\n */\nexport const server = toPlugin(ServerPlugin);\n// Export manifest and types\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;aAO2C;AAa3C,OAAO,OAAO,EAAE,MAAM,KAAK,QAAQ,QAAQ,KAAK,EAAE,SAAS,EAAE,CAAC;AAE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AK,EAAE;MACd,KAAM;QAET,SAAQ,KAAK,EAAE;;;;;;CAQnB,UAAU;EACR,MAAM,OAAO;AACb,SAAO;GAEL,OAAO,IAAwC;AAC7C,SAAK,OAAO,GAAG;AACf,WAAO;;GAGT,WAAW,KAAK;GAEhB,WAAW,KAAK;GAEhB,QAAQ;AACN,UAAM,IAAI,YACR,iRAQD;;GAEJ;;;AAIL,MAAM,mBAA6B,CAAC,aAAa,SAAS,KAAK;;;;AAK/D,MAAa,SAAS,SAAS,aAAa"}
@@ -10,7 +10,7 @@ declare class StreamManager {
10
10
  private maxEventSize;
11
11
  private bufferTTL;
12
12
  constructor(options?: StreamConfig);
13
- stream(res: IAppResponse, handler: (signal: AbortSignal) => AsyncGenerator<any, void, unknown>, options?: StreamConfig): Promise<void>;
13
+ stream(res: IAppResponse, handler: (signal: AbortSignal) => AsyncGenerator<any, void, unknown>, options?: StreamConfig, ownerKey?: string): Promise<void>;
14
14
  abortAll(): void;
15
15
  getActiveCount(): number;
16
16
  private _attachToExistingStream;
@@ -1 +1 @@
1
- {"version":3,"file":"stream-manager.d.ts","names":[],"sources":["../../src/stream/stream-manager.ts"],"mappings":";;;;;cAca,aAAA;EAAA,QACH,gBAAA;EAAA,QACA,cAAA;EAAA,QACA,SAAA;EAAA,QACA,YAAA;EAAA,QACA,SAAA;cAEI,OAAA,GAAU,YAAA;EAWhB,MAAA,CACJ,GAAA,EAAK,YAAA,EACL,OAAA,GAAU,MAAA,EAAQ,WAAA,KAAgB,cAAA,sBAClC,OAAA,GAAU,YAAA,GACT,OAAA;EAyBH,QAAA,CAAA;EAUA,cAAA,CAAA;EAAA,QAKc,uBAAA;EAAA,QAyEA,gBAAA;EAAA,QA2EA,6BAAA;EAAA,QAoFN,eAAA;EAAA,QA6BA,yBAAA;EAAA,QAaA,wBAAA;EAAA,QAkBA,gBAAA;EAAA,QASA,cAAA;EAAA,QAUA,gBAAA;AAAA"}
1
+ {"version":3,"file":"stream-manager.d.ts","names":[],"sources":["../../src/stream/stream-manager.ts"],"mappings":";;;;;cAca,aAAA;EAAA,QACH,gBAAA;EAAA,QACA,cAAA;EAAA,QACA,SAAA;EAAA,QACA,YAAA;EAAA,QACA,SAAA;cAEI,OAAA,GAAU,YAAA;EAWhB,MAAA,CACJ,GAAA,EAAK,YAAA,EACL,OAAA,GAAU,MAAA,EAAQ,WAAA,KAAgB,cAAA,sBAClC,OAAA,GAAU,YAAA,EACV,QAAA,YACC,OAAA;EAsCH,QAAA,CAAA;EAUA,cAAA,CAAA;EAAA,QAKc,uBAAA;EAAA,QAyEA,gBAAA;EAAA,QA6EA,6BAAA;EAAA,QAoFN,eAAA;EAAA,QA6BA,yBAAA;EAAA,QAaA,wBAAA;EAAA,QAkBA,gBAAA;EAAA,QASA,cAAA;EAAA,QAUA,gBAAA;AAAA"}
@@ -23,15 +23,22 @@ var StreamManager = class {
23
23
  this.bufferTTL = options?.bufferTTL ?? streamDefaults.bufferTTL;
24
24
  this.activeOperations = /* @__PURE__ */ new Set();
25
25
  }
26
- async stream(res, handler, options) {
26
+ async stream(res, handler, options, ownerKey) {
27
27
  const { streamId } = options || {};
28
28
  if (res.writableEnded || res.destroyed) return;
29
29
  this.sseWriter.setupHeaders(res);
30
30
  if (streamId && StreamValidator.validateStreamId(streamId)) {
31
31
  const existingStream = this.streamRegistry.get(streamId);
32
- if (existingStream) return this._attachToExistingStream(res, existingStream, options);
32
+ if (existingStream) {
33
+ if (existingStream.ownerKey !== ownerKey) {
34
+ this.sseWriter.writeError(res, randomUUID(), "Stream not found or access denied", SSEErrorCode.STREAM_FORBIDDEN);
35
+ res.end();
36
+ return;
37
+ }
38
+ return this._attachToExistingStream(res, existingStream, options);
39
+ }
33
40
  }
34
- return this._createNewStream(res, handler, options);
41
+ return this._createNewStream(res, handler, options, ownerKey);
35
42
  }
36
43
  abortAll() {
37
44
  this.activeOperations.forEach((operation) => {
@@ -81,7 +88,7 @@ var StreamManager = class {
81
88
  clearInterval(heartbeat);
82
89
  }
83
90
  }
84
- async _createNewStream(res, handler, options) {
91
+ async _createNewStream(res, handler, options, ownerKey) {
85
92
  const streamId = options?.streamId ?? randomUUID();
86
93
  if (res.writableEnded || res.destroyed) return;
87
94
  const abortController = new AbortController();
@@ -95,6 +102,7 @@ var StreamManager = class {
95
102
  }
96
103
  const streamEntry = {
97
104
  streamId,
105
+ ownerKey,
98
106
  generator: handler(combinedSignal),
99
107
  eventBuffer,
100
108
  clients: new Set([res]),
@@ -1 +1 @@
1
- {"version":3,"file":"stream-manager.js","names":[],"sources":["../../src/stream/stream-manager.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport { context } from \"@opentelemetry/api\";\nimport type { IAppResponse, StreamConfig } from \"shared\";\nimport { createLogger } from \"../logging/logger\";\nimport { EventRingBuffer } from \"./buffers\";\nimport { streamDefaults } from \"./defaults\";\nimport { SSEWriter } from \"./sse-writer\";\nimport { StreamRegistry } from \"./stream-registry\";\nimport { SSEErrorCode, type StreamEntry, type StreamOperation } from \"./types\";\nimport { StreamValidator } from \"./validator\";\n\nconst logger = createLogger(\"stream\");\n\n// main entry point for Server-Sent events streaming\nexport class StreamManager {\n private activeOperations: Set<StreamOperation>;\n private streamRegistry: StreamRegistry;\n private sseWriter: SSEWriter;\n private maxEventSize: number;\n private bufferTTL: number;\n\n constructor(options?: StreamConfig) {\n this.streamRegistry = new StreamRegistry(\n options?.maxActiveStreams ?? streamDefaults.maxActiveStreams,\n );\n this.sseWriter = new SSEWriter();\n this.maxEventSize = options?.maxEventSize ?? streamDefaults.maxEventSize;\n this.bufferTTL = options?.bufferTTL ?? streamDefaults.bufferTTL;\n this.activeOperations = new Set();\n }\n\n // main streaming method - handles new connection and reconnection\n async stream(\n res: IAppResponse,\n handler: (signal: AbortSignal) => AsyncGenerator<any, void, unknown>,\n options?: StreamConfig,\n ): Promise<void> {\n const { streamId } = options || {};\n\n // check if response is already closed\n if (res.writableEnded || res.destroyed) {\n return;\n }\n\n // setup SSE headers\n this.sseWriter.setupHeaders(res);\n\n // handle reconnection\n if (streamId && StreamValidator.validateStreamId(streamId)) {\n const existingStream = this.streamRegistry.get(streamId);\n // if stream exists, attach to it\n if (existingStream) {\n return this._attachToExistingStream(res, existingStream, options);\n }\n }\n\n // if stream does not exist, create a new one\n return this._createNewStream(res, handler, options);\n }\n\n // abort all active operations\n abortAll(): void {\n this.activeOperations.forEach((operation) => {\n if (operation.heartbeat) clearInterval(operation.heartbeat);\n operation.controller.abort(\"Server shutdown\");\n });\n this.activeOperations.clear();\n this.streamRegistry.clear();\n }\n\n // get the number of active operations\n getActiveCount(): number {\n return this.activeOperations.size;\n }\n\n // attach to existing stream\n private async _attachToExistingStream(\n res: IAppResponse,\n streamEntry: StreamEntry,\n options?: StreamConfig,\n ): Promise<void> {\n // handle reconnection - replay missed events\n const lastEventId = res.req?.headers[\"last-event-id\"];\n\n if (StreamValidator.validateEventId(lastEventId)) {\n // cast to string after validation\n const validEventId = lastEventId as string;\n if (streamEntry.eventBuffer.has(validEventId)) {\n const missedEvents =\n streamEntry.eventBuffer.getEventsSince(validEventId);\n // broadcast missed events to client\n for (const event of missedEvents) {\n if (options?.userSignal?.aborted) break;\n this.sseWriter.writeBufferedEvent(res, event);\n }\n } else {\n // buffer overflow - send warning\n this.sseWriter.writeBufferOverflowWarning(res, validEventId);\n }\n }\n\n // add client to stream entry\n streamEntry.clients.add(res);\n streamEntry.lastAccess = Date.now();\n\n // start heartbeat\n const combinedSignal = this._combineSignals(\n streamEntry.abortController.signal,\n options?.userSignal,\n );\n const heartbeat = this.sseWriter.startHeartbeat(res, combinedSignal);\n\n // track operation\n const streamOperation: StreamOperation = {\n controller: streamEntry.abortController,\n type: \"stream\",\n heartbeat,\n };\n this.activeOperations.add(streamOperation);\n\n // handle client disconnect\n res.on(\"close\", () => {\n clearInterval(heartbeat);\n streamEntry.clients.delete(res);\n this.activeOperations.delete(streamOperation);\n\n // Stop the generator when no clients remain\n if (streamEntry.clients.size === 0 && !streamEntry.isCompleted) {\n streamEntry.abortController.abort(\"All clients disconnected\");\n }\n\n // cleanup if stream is completed and no clients are connected\n if (streamEntry.isCompleted && streamEntry.clients.size === 0) {\n setTimeout(() => {\n if (streamEntry.clients.size === 0) {\n this.streamRegistry.remove(streamEntry.streamId);\n }\n }, this.bufferTTL);\n }\n });\n\n // if stream is completed, close connection\n if (streamEntry.isCompleted) {\n res.end();\n // cleanup operation\n this.activeOperations.delete(streamOperation);\n clearInterval(heartbeat);\n }\n }\n private async _createNewStream(\n res: IAppResponse,\n handler: (signal: AbortSignal) => AsyncGenerator<any, void, unknown>,\n options?: StreamConfig,\n ): Promise<void> {\n const streamId = options?.streamId ?? randomUUID();\n\n // abort stream if response is closed\n if (res.writableEnded || res.destroyed) {\n return;\n }\n\n const abortController = new AbortController();\n\n // create event buffer\n const eventBuffer = new EventRingBuffer(\n options?.bufferSize ?? streamDefaults.bufferSize,\n );\n\n // setup signals and heartbeat\n const combinedSignal = this._combineSignals(\n abortController.signal,\n options?.userSignal,\n );\n const heartbeat = this.sseWriter.startHeartbeat(res, combinedSignal);\n\n // capture the current trace context at stream creation time\n const traceContext = context.active();\n\n // abort stream if response is closed\n if (res.writableEnded || res.destroyed) {\n clearInterval(heartbeat);\n return;\n }\n\n // create stream entry\n const streamEntry: StreamEntry = {\n streamId,\n generator: handler(combinedSignal),\n eventBuffer,\n clients: new Set([res]),\n isCompleted: false,\n lastAccess: Date.now(),\n abortController,\n traceContext,\n };\n this.streamRegistry.add(streamEntry);\n\n // track operation\n const streamOperation: StreamOperation = {\n controller: abortController,\n type: \"stream\",\n heartbeat,\n };\n this.activeOperations.add(streamOperation);\n\n res.on(\"close\", () => {\n clearInterval(heartbeat);\n this.activeOperations.delete(streamOperation);\n streamEntry.clients.delete(res);\n\n // Stop the generator when no clients remain so polling loops\n // (e.g. jobs runAndWait) don't keep running in the background.\n if (streamEntry.clients.size === 0 && !streamEntry.isCompleted) {\n abortController.abort(\"Client disconnected\");\n }\n });\n\n await this._processGeneratorInBackground(streamEntry);\n\n // cleanup\n clearInterval(heartbeat);\n this.activeOperations.delete(streamOperation);\n }\n\n private async _processGeneratorInBackground(\n streamEntry: StreamEntry,\n ): Promise<void> {\n // run the entire generator processing within the captured trace context\n return context.with(streamEntry.traceContext, async () => {\n try {\n // retrieve all events from generator\n for await (const event of streamEntry.generator) {\n if (streamEntry.abortController.signal.aborted) break;\n const eventId = randomUUID();\n const eventData = JSON.stringify(event);\n\n // validate event size\n if (eventData.length > this.maxEventSize) {\n const errorMsg = `Event exceeds max size of ${this.maxEventSize} bytes`;\n const errorCode = SSEErrorCode.INVALID_REQUEST;\n // broadcast error to all connected clients\n this._broadcastErrorToClients(\n streamEntry,\n eventId,\n errorMsg,\n errorCode,\n );\n continue;\n }\n\n // buffer event for reconnection\n streamEntry.eventBuffer.add({\n id: eventId,\n type: event.type,\n data: eventData,\n timestamp: Date.now(),\n });\n\n // broadcast to all connected clients\n this._broadcastEventsToClients(streamEntry, eventId, event);\n streamEntry.lastAccess = Date.now();\n }\n\n streamEntry.isCompleted = true;\n\n // close all clients\n this._closeAllClients(streamEntry);\n\n // cleanup if no clients are connected\n this._cleanupStream(streamEntry);\n } catch (error) {\n const errorMsg =\n error instanceof Error ? error.message : \"Internal server error\";\n const errorEventId = randomUUID();\n const errorCode = this._categorizeError(error);\n\n // client cancellation is a normal control-flow signal, not a failure\n if (errorCode === SSEErrorCode.STREAM_ABORTED) {\n logger.info(\"Stream aborted by client (code=%s)\", errorCode);\n } else {\n logger.error(\n \"Stream execution failed: %s (code=%s)\",\n errorMsg,\n errorCode,\n );\n }\n\n // buffer error event\n streamEntry.eventBuffer.add({\n id: errorEventId,\n type: \"error\",\n data: JSON.stringify({ error: errorMsg, code: errorCode }),\n timestamp: Date.now(),\n });\n\n // send error event to all connected clients\n this._broadcastErrorToClients(\n streamEntry,\n errorEventId,\n errorMsg,\n errorCode,\n true,\n );\n streamEntry.isCompleted = true;\n }\n });\n }\n\n private _combineSignals(\n internalSignal?: AbortSignal,\n userSignal?: AbortSignal,\n ): AbortSignal {\n if (!userSignal) return internalSignal || new AbortController().signal;\n\n const signals = [internalSignal, userSignal].filter(\n Boolean,\n ) as AbortSignal[];\n const controller = new AbortController();\n\n signals.forEach((signal) => {\n if (signal?.aborted) {\n controller.abort(signal.reason);\n return;\n }\n\n signal?.addEventListener(\n \"abort\",\n () => {\n controller.abort(signal.reason);\n },\n { once: true },\n );\n });\n return controller.signal;\n }\n\n // broadcast events to all connected clients\n private _broadcastEventsToClients(\n streamEntry: StreamEntry,\n eventId: string,\n event: any,\n ): void {\n for (const client of streamEntry.clients) {\n if (!client.writableEnded) {\n this.sseWriter.writeEvent(client, eventId, event);\n }\n }\n }\n\n // broadcast error to all connected clients\n private _broadcastErrorToClients(\n streamEntry: StreamEntry,\n eventId: string,\n errorMessage: string,\n errorCode: SSEErrorCode,\n closeClients: boolean = false,\n ): void {\n for (const client of streamEntry.clients) {\n if (!client.writableEnded) {\n this.sseWriter.writeError(client, eventId, errorMessage, errorCode);\n if (closeClients) {\n client.end();\n }\n }\n }\n }\n\n // close all connected clients\n private _closeAllClients(streamEntry: StreamEntry): void {\n for (const client of streamEntry.clients) {\n if (!client.writableEnded) {\n client.end();\n }\n }\n }\n\n // cleanup stream if no clients are connected\n private _cleanupStream(streamEntry: StreamEntry): void {\n if (streamEntry.clients.size === 0) {\n setTimeout(() => {\n if (streamEntry.clients.size === 0) {\n this.streamRegistry.remove(streamEntry.streamId);\n }\n }, this.bufferTTL);\n }\n }\n\n private _categorizeError(error: unknown): SSEErrorCode {\n if (error instanceof Error) {\n const message = error.message.toLowerCase();\n if (message.includes(\"timeout\") || message.includes(\"timed out\")) {\n return SSEErrorCode.TIMEOUT;\n }\n\n if (message.includes(\"unavailable\") || message.includes(\"econnrefused\")) {\n return SSEErrorCode.TEMPORARY_UNAVAILABLE;\n }\n\n if (error.name === \"AbortError\") {\n return SSEErrorCode.STREAM_ABORTED;\n }\n\n // Detect upstream API errors (e.g., from Databricks SDK ApiError)\n if (\n \"statusCode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AK;;CAMlB,AAAQ,eAAe,aAAgC;AACrD,MAAI,YAAY,QAAQ,SAAS,EAC/B,kBAAiB;AACf,OAAI,YAAY,QAAQ,SAAS,EAC/B,MAAK,eAAe,OAAO,YAAY,SAAS;KAEjD,KAAK,UAAU;;CAItB,AAAQ,iBAAiB,OAA8B;AACrD,MAAI,iBAAiB,OAAO;GAC1B,MAAM,UAAU,MAAM,QAAQ,aAAa;AAC3C,OAAI,QAAQ,SAAS,UAAU,IAAI,QAAQ,SAAS,YAAY,CAC9D,QAAO,aAAa;AAGtB,OAAI,QAAQ,SAAS,cAAc,IAAI,QAAQ,SAAS,eAAe,CACrE,QAAO,aAAa;AAGtB,OAAI,MAAM,SAAS,aACjB,QAAO,aAAa;AAItB,OACE,gBAAgB,SAChB,OAAQ,MAAc,eAAe,SAErC,QAAO,aAAa;;AAIxB,SAAO,aAAa"}
1
+ {"version":3,"file":"stream-manager.js","names":[],"sources":["../../src/stream/stream-manager.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport { context } from \"@opentelemetry/api\";\nimport type { IAppResponse, StreamConfig } from \"shared\";\nimport { createLogger } from \"../logging/logger\";\nimport { EventRingBuffer } from \"./buffers\";\nimport { streamDefaults } from \"./defaults\";\nimport { SSEWriter } from \"./sse-writer\";\nimport { StreamRegistry } from \"./stream-registry\";\nimport { SSEErrorCode, type StreamEntry, type StreamOperation } from \"./types\";\nimport { StreamValidator } from \"./validator\";\n\nconst logger = createLogger(\"stream\");\n\n// main entry point for Server-Sent events streaming\nexport class StreamManager {\n private activeOperations: Set<StreamOperation>;\n private streamRegistry: StreamRegistry;\n private sseWriter: SSEWriter;\n private maxEventSize: number;\n private bufferTTL: number;\n\n constructor(options?: StreamConfig) {\n this.streamRegistry = new StreamRegistry(\n options?.maxActiveStreams ?? streamDefaults.maxActiveStreams,\n );\n this.sseWriter = new SSEWriter();\n this.maxEventSize = options?.maxEventSize ?? streamDefaults.maxEventSize;\n this.bufferTTL = options?.bufferTTL ?? streamDefaults.bufferTTL;\n this.activeOperations = new Set();\n }\n\n // main streaming method - handles new connection and reconnection\n async stream(\n res: IAppResponse,\n handler: (signal: AbortSignal) => AsyncGenerator<any, void, unknown>,\n options?: StreamConfig,\n ownerKey?: string,\n ): Promise<void> {\n const { streamId } = options || {};\n\n // check if response is already closed\n if (res.writableEnded || res.destroyed) {\n return;\n }\n\n // setup SSE headers\n this.sseWriter.setupHeaders(res);\n\n // handle reconnection\n if (streamId && StreamValidator.validateStreamId(streamId)) {\n const existingStream = this.streamRegistry.get(streamId);\n if (existingStream) {\n // Enforce per-user binding: the stream's owner key must match the\n // requesting caller's owner key. This prevents cross-user stream\n // takeover via guessed/leaked stream IDs (the SSE registry was\n // previously a global lookup with no authorization step).\n if (existingStream.ownerKey !== ownerKey) {\n this.sseWriter.writeError(\n res,\n randomUUID(),\n \"Stream not found or access denied\",\n SSEErrorCode.STREAM_FORBIDDEN,\n );\n res.end();\n return;\n }\n return this._attachToExistingStream(res, existingStream, options);\n }\n }\n\n // if stream does not exist, create a new one\n return this._createNewStream(res, handler, options, ownerKey);\n }\n\n // abort all active operations\n abortAll(): void {\n this.activeOperations.forEach((operation) => {\n if (operation.heartbeat) clearInterval(operation.heartbeat);\n operation.controller.abort(\"Server shutdown\");\n });\n this.activeOperations.clear();\n this.streamRegistry.clear();\n }\n\n // get the number of active operations\n getActiveCount(): number {\n return this.activeOperations.size;\n }\n\n // attach to existing stream\n private async _attachToExistingStream(\n res: IAppResponse,\n streamEntry: StreamEntry,\n options?: StreamConfig,\n ): Promise<void> {\n // handle reconnection - replay missed events\n const lastEventId = res.req?.headers[\"last-event-id\"];\n\n if (StreamValidator.validateEventId(lastEventId)) {\n // cast to string after validation\n const validEventId = lastEventId as string;\n if (streamEntry.eventBuffer.has(validEventId)) {\n const missedEvents =\n streamEntry.eventBuffer.getEventsSince(validEventId);\n // broadcast missed events to client\n for (const event of missedEvents) {\n if (options?.userSignal?.aborted) break;\n this.sseWriter.writeBufferedEvent(res, event);\n }\n } else {\n // buffer overflow - send warning\n this.sseWriter.writeBufferOverflowWarning(res, validEventId);\n }\n }\n\n // add client to stream entry\n streamEntry.clients.add(res);\n streamEntry.lastAccess = Date.now();\n\n // start heartbeat\n const combinedSignal = this._combineSignals(\n streamEntry.abortController.signal,\n options?.userSignal,\n );\n const heartbeat = this.sseWriter.startHeartbeat(res, combinedSignal);\n\n // track operation\n const streamOperation: StreamOperation = {\n controller: streamEntry.abortController,\n type: \"stream\",\n heartbeat,\n };\n this.activeOperations.add(streamOperation);\n\n // handle client disconnect\n res.on(\"close\", () => {\n clearInterval(heartbeat);\n streamEntry.clients.delete(res);\n this.activeOperations.delete(streamOperation);\n\n // Stop the generator when no clients remain\n if (streamEntry.clients.size === 0 && !streamEntry.isCompleted) {\n streamEntry.abortController.abort(\"All clients disconnected\");\n }\n\n // cleanup if stream is completed and no clients are connected\n if (streamEntry.isCompleted && streamEntry.clients.size === 0) {\n setTimeout(() => {\n if (streamEntry.clients.size === 0) {\n this.streamRegistry.remove(streamEntry.streamId);\n }\n }, this.bufferTTL);\n }\n });\n\n // if stream is completed, close connection\n if (streamEntry.isCompleted) {\n res.end();\n // cleanup operation\n this.activeOperations.delete(streamOperation);\n clearInterval(heartbeat);\n }\n }\n private async _createNewStream(\n res: IAppResponse,\n handler: (signal: AbortSignal) => AsyncGenerator<any, void, unknown>,\n options?: StreamConfig,\n ownerKey?: string,\n ): Promise<void> {\n const streamId = options?.streamId ?? randomUUID();\n\n // abort stream if response is closed\n if (res.writableEnded || res.destroyed) {\n return;\n }\n\n const abortController = new AbortController();\n\n // create event buffer\n const eventBuffer = new EventRingBuffer(\n options?.bufferSize ?? streamDefaults.bufferSize,\n );\n\n // setup signals and heartbeat\n const combinedSignal = this._combineSignals(\n abortController.signal,\n options?.userSignal,\n );\n const heartbeat = this.sseWriter.startHeartbeat(res, combinedSignal);\n\n // capture the current trace context at stream creation time\n const traceContext = context.active();\n\n // abort stream if response is closed\n if (res.writableEnded || res.destroyed) {\n clearInterval(heartbeat);\n return;\n }\n\n // create stream entry\n const streamEntry: StreamEntry = {\n streamId,\n ownerKey,\n generator: handler(combinedSignal),\n eventBuffer,\n clients: new Set([res]),\n isCompleted: false,\n lastAccess: Date.now(),\n abortController,\n traceContext,\n };\n this.streamRegistry.add(streamEntry);\n\n // track operation\n const streamOperation: StreamOperation = {\n controller: abortController,\n type: \"stream\",\n heartbeat,\n };\n this.activeOperations.add(streamOperation);\n\n res.on(\"close\", () => {\n clearInterval(heartbeat);\n this.activeOperations.delete(streamOperation);\n streamEntry.clients.delete(res);\n\n // Stop the generator when no clients remain so polling loops\n // (e.g. jobs runAndWait) don't keep running in the background.\n if (streamEntry.clients.size === 0 && !streamEntry.isCompleted) {\n abortController.abort(\"Client disconnected\");\n }\n });\n\n await this._processGeneratorInBackground(streamEntry);\n\n // cleanup\n clearInterval(heartbeat);\n this.activeOperations.delete(streamOperation);\n }\n\n private async _processGeneratorInBackground(\n streamEntry: StreamEntry,\n ): Promise<void> {\n // run the entire generator processing within the captured trace context\n return context.with(streamEntry.traceContext, async () => {\n try {\n // retrieve all events from generator\n for await (const event of streamEntry.generator) {\n if (streamEntry.abortController.signal.aborted) break;\n const eventId = randomUUID();\n const eventData = JSON.stringify(event);\n\n // validate event size\n if (eventData.length > this.maxEventSize) {\n const errorMsg = `Event exceeds max size of ${this.maxEventSize} bytes`;\n const errorCode = SSEErrorCode.INVALID_REQUEST;\n // broadcast error to all connected clients\n this._broadcastErrorToClients(\n streamEntry,\n eventId,\n errorMsg,\n errorCode,\n );\n continue;\n }\n\n // buffer event for reconnection\n streamEntry.eventBuffer.add({\n id: eventId,\n type: event.type,\n data: eventData,\n timestamp: Date.now(),\n });\n\n // broadcast to all connected clients\n this._broadcastEventsToClients(streamEntry, eventId, event);\n streamEntry.lastAccess = Date.now();\n }\n\n streamEntry.isCompleted = true;\n\n // close all clients\n this._closeAllClients(streamEntry);\n\n // cleanup if no clients are connected\n this._cleanupStream(streamEntry);\n } catch (error) {\n const errorMsg =\n error instanceof Error ? error.message : \"Internal server error\";\n const errorEventId = randomUUID();\n const errorCode = this._categorizeError(error);\n\n // client cancellation is a normal control-flow signal, not a failure\n if (errorCode === SSEErrorCode.STREAM_ABORTED) {\n logger.info(\"Stream aborted by client (code=%s)\", errorCode);\n } else {\n logger.error(\n \"Stream execution failed: %s (code=%s)\",\n errorMsg,\n errorCode,\n );\n }\n\n // buffer error event\n streamEntry.eventBuffer.add({\n id: errorEventId,\n type: \"error\",\n data: JSON.stringify({ error: errorMsg, code: errorCode }),\n timestamp: Date.now(),\n });\n\n // send error event to all connected clients\n this._broadcastErrorToClients(\n streamEntry,\n errorEventId,\n errorMsg,\n errorCode,\n true,\n );\n streamEntry.isCompleted = true;\n }\n });\n }\n\n private _combineSignals(\n internalSignal?: AbortSignal,\n userSignal?: AbortSignal,\n ): AbortSignal {\n if (!userSignal) return internalSignal || new AbortController().signal;\n\n const signals = [internalSignal, userSignal].filter(\n Boolean,\n ) as AbortSignal[];\n const controller = new AbortController();\n\n signals.forEach((signal) => {\n if (signal?.aborted) {\n controller.abort(signal.reason);\n return;\n }\n\n signal?.addEventListener(\n \"abort\",\n () => {\n controller.abort(signal.reason);\n },\n { once: true },\n );\n });\n return controller.signal;\n }\n\n // broadcast events to all connected clients\n private _broadcastEventsToClients(\n streamEntry: StreamEntry,\n eventId: string,\n event: any,\n ): void {\n for (const client of streamEntry.clients) {\n if (!client.writableEnded) {\n this.sseWriter.writeEvent(client, eventId, event);\n }\n }\n }\n\n // broadcast error to all connected clients\n private _broadcastErrorToClients(\n streamEntry: StreamEntry,\n eventId: string,\n errorMessage: string,\n errorCode: SSEErrorCode,\n closeClients: boolean = false,\n ): void {\n for (const client of streamEntry.clients) {\n if (!client.writableEnded) {\n this.sseWriter.writeError(client, eventId, errorMessage, errorCode);\n if (closeClients) {\n client.end();\n }\n }\n }\n }\n\n // close all connected clients\n private _closeAllClients(streamEntry: StreamEntry): void {\n for (const client of streamEntry.clients) {\n if (!client.writableEnded) {\n client.end();\n }\n }\n }\n\n // cleanup stream if no clients are connected\n private _cleanupStream(streamEntry: StreamEntry): void {\n if (streamEntry.clients.size === 0) {\n setTimeout(() => {\n if (streamEntry.clients.size === 0) {\n this.streamRegistry.remove(streamEntry.streamId);\n }\n }, this.bufferTTL);\n }\n }\n\n private _categorizeError(error: unknown): SSEErrorCode {\n if (error instanceof Error) {\n const message = error.message.toLowerCase();\n if (message.includes(\"timeout\") || message.includes(\"timed out\")) {\n return SSEErrorCode.TIMEOUT;\n }\n\n if (message.includes(\"unavailable\") || message.includes(\"econnrefused\")) {\n return SSEErrorCode.TEMPORARY_UNAVAILABLE;\n }\n\n if (error.name === \"AbortError\") {\n return SSEErrorCode.STREAM_ABORTED;\n }\n\n // Detect upstream API errors (e.g., from Databricks SDK ApiError)\n if (\n \"statusCode\" in error &&\n typeof (error as any).statusCode === \"number\"\n ) {\n return SSEErrorCode.UPSTREAM_ERROR;\n }\n }\n\n return SSEErrorCode.INTERNAL_ERROR;\n }\n}\n"],"mappings":";;;;;;;;;;;AAWA,MAAM,SAAS,aAAa,SAAS;AAGrC,IAAa,gBAAb,MAA2B;CACzB,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CAER,YAAY,SAAwB;AAClC,OAAK,iBAAiB,IAAI,eACxB,SAAS,oBAAoB,eAAe,iBAC7C;AACD,OAAK,YAAY,IAAI,WAAW;AAChC,OAAK,eAAe,SAAS,gBAAgB,eAAe;AAC5D,OAAK,YAAY,SAAS,aAAa,eAAe;AACtD,OAAK,mCAAmB,IAAI,KAAK;;CAInC,MAAM,OACJ,KACA,SACA,SACA,UACe;EACf,MAAM,EAAE,aAAa,WAAW,EAAE;AAGlC,MAAI,IAAI,iBAAiB,IAAI,UAC3B;AAIF,OAAK,UAAU,aAAa,IAAI;AAGhC,MAAI,YAAY,gBAAgB,iBAAiB,SAAS,EAAE;GAC1D,MAAM,iBAAiB,KAAK,eAAe,IAAI,SAAS;AACxD,O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7
7
  INVALID_REQUEST: "INVALID_REQUEST",
8
8
  STREAM_ABORTED: "STREAM_ABORTED",
9
9
  STREAM_EVICTED: "STREAM_EVICTED",
10
+ STREAM_FORBIDDEN: "STREAM_FORBIDDEN",
10
11
  UPSTREAM_ERROR: "UPSTREAM_ERROR"
11
12
  };
12
13
 
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../src/stream/types.ts"],"sourcesContent":["import type { Context } from \"@opentelemetry/api\";\nimport type { IAppResponse } from \"shared\";\nimport type { EventRingBuffer } from \"./buffers\";\n\nexport const SSEWarningCode = {\n BUFFER_OVERFLOW_RESTART: \"BUFFER_OVERFLOW_RESTART\",\n} as const satisfies Record<string, string>;\n\nexport type SSEWarningCode =\n (typeof SSEWarningCode)[keyof typeof SSEWarningCode];\n\nexport const SSEErrorCode = {\n TEMPORARY_UNAVAILABLE: \"TEMPORARY_UNAVAILABLE\",\n TIMEOUT: \"TIMEOUT\",\n INTERNAL_ERROR: \"INTERNAL_ERROR\",\n INVALID_REQUEST: \"INVALID_REQUEST\",\n STREAM_ABORTED: \"STREAM_ABORTED\",\n STREAM_EVICTED: \"STREAM_EVICTED\",\n UPSTREAM_ERROR: \"UPSTREAM_ERROR\",\n} as const satisfies Record<string, string>;\n\nexport type SSEErrorCode = (typeof SSEErrorCode)[keyof typeof SSEErrorCode];\n\nexport interface SSEError {\n error: string;\n code: SSEErrorCode;\n}\n\nexport interface BufferedEvent {\n id: string;\n type: string;\n data: string;\n timestamp: number;\n}\n\nexport interface StreamEntry {\n streamId: string;\n generator: AsyncGenerator<any, void, unknown>;\n eventBuffer: EventRingBuffer;\n clients: Set<IAppResponse>;\n isCompleted: boolean;\n lastAccess: number;\n abortController: AbortController;\n traceContext: Context;\n}\n\nexport interface StreamOperation {\n controller: AbortController;\n type: \"query\" | \"stream\";\n heartbeat?: NodeJS.Timeout;\n}\n"],"mappings":";AAIA,MAAa,iBAAiB,EAC5B,yBAAyB,2BAC1B;AAKD,MAAa,eAAe;CAC1B,uBAAuB;CACvB,SAAS;CACT,gBAAgB;CAChB,iBAAiB;CACjB,gBAAgB;CAChB,gBAAgB;CAChB,gBAAgB;CACjB"}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../src/stream/types.ts"],"sourcesContent":["import type { Context } from \"@opentelemetry/api\";\nimport type { IAppResponse } from \"shared\";\nimport type { EventRingBuffer } from \"./buffers\";\n\nexport const SSEWarningCode = {\n BUFFER_OVERFLOW_RESTART: \"BUFFER_OVERFLOW_RESTART\",\n} as const satisfies Record<string, string>;\n\nexport type SSEWarningCode =\n (typeof SSEWarningCode)[keyof typeof SSEWarningCode];\n\nexport const SSEErrorCode = {\n TEMPORARY_UNAVAILABLE: \"TEMPORARY_UNAVAILABLE\",\n TIMEOUT: \"TIMEOUT\",\n INTERNAL_ERROR: \"INTERNAL_ERROR\",\n INVALID_REQUEST: \"INVALID_REQUEST\",\n STREAM_ABORTED: \"STREAM_ABORTED\",\n STREAM_EVICTED: \"STREAM_EVICTED\",\n STREAM_FORBIDDEN: \"STREAM_FORBIDDEN\",\n UPSTREAM_ERROR: \"UPSTREAM_ERROR\",\n} as const satisfies Record<string, string>;\n\nexport type SSEErrorCode = (typeof SSEErrorCode)[keyof typeof SSEErrorCode];\n\nexport interface SSEError {\n error: string;\n code: SSEErrorCode;\n}\n\nexport interface BufferedEvent {\n id: string;\n type: string;\n data: string;\n timestamp: number;\n}\n\nexport interface StreamEntry {\n streamId: string;\n /**\n * Identifier of the principal that created the stream (e.g. end-user ID\n * or service principal user ID). When set, only requests sharing the\n * same owner key may reconnect to the stream.\n */\n ownerKey?: string;\n generator: AsyncGenerator<any, void, unknown>;\n eventBuffer: EventRingBuffer;\n clients: Set<IAppResponse>;\n isCompleted: boolean;\n lastAccess: number;\n abortController: AbortController;\n traceContext: Context;\n}\n\nexport interface StreamOperation {\n controller: AbortController;\n type: \"query\" | \"stream\";\n heartbeat?: NodeJS.Timeout;\n}\n"],"mappings":";AAIA,MAAa,iBAAiB,EAC5B,yBAAyB,2BAC1B;AAKD,MAAa,eAAe;CAC1B,uBAAuB;CACvB,SAAS;CACT,gBAAgB;CAChB,iBAAiB;CACjB,gBAAgB;CAChB,gBAAgB;CAChB,kBAAkB;CAClB,gBAAgB;CACjB"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@databricks/appkit",
3
3
  "type": "module",
4
- "version": "0.30.0",
4
+ "version": "0.31.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "packageManager": "pnpm@10.21.0",
@@ -63,6 +63,7 @@
63
63
  "@types/semver": "7.7.1",
64
64
  "dotenv": "16.6.1",
65
65
  "express": "4.22.0",
66
+ "get-port": "7.2.0",
66
67
  "obug": "2.1.1",
67
68
  "pg": "8.18.0",
68
69
  "picocolors": "1.1.1",
package/sbom.cdx.json CHANGED
@@ -1 +1 @@
1
- {"bomFormat":"CycloneDX","specVersion":"1.6","serialNumber":"urn:uuid:c2579110-1a83-436e-9359-afb0bfff8865","version":1,"metadata":{"timestamp":"2026-05-05T13:11:01Z","tools":{"components":[{"group":"@cyclonedx","name":"cdxgen","version":"12.1.2","purl":"pkg:npm/%40cyclonedx/cdxgen@12.1.2","type":"application","bom-ref":"pkg:npm/@cyclonedx/cdxgen@12.1.2","publisher":"OWASP Foundation","authors":[{"name":"OWASP Foundation"}]}]},"authors":[{"name":"OWASP Foundation"}],"lifecycles":[{"phase":"build"}],"component":{"name":"appkit","group":"@databricks","version":"0.30.0","purl":"pkg:npm/%40databricks/appkit@0.30.0","bom-ref":"pkg:npm/@databricks/appkit@0.30.0","type":"application","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"externalReferences":[{"type":"vcs","url":"git+https://github.com/databricks/appkit.git"}]},"properties":[{"name":"cdx:bom:componentTypes","value":"npm"},{"name":"cdx:bom:componentNamespaces","value":"@ast-grep\\n@databricks\\n@opentelemetry"},{"name":"cdx:bom:componentSrcFiles","value":"packages/appkit/node_modules/@ast-grep/napi/package.json\\npackages/appkit/node_modules/@databricks/lakebase/package.json\\npackages/appkit/node_modules/@databricks/sdk-experimental/package.json\\npackages/appkit/node_modules/@opentelemetry/api-logs/package.json\\npackages/appkit/node_modules/@opentelemetry/api/package.json\\npackages/appkit/node_modules/@opentelemetry/auto-instrumentations-node/package.json\\npackages/appkit/node_modules/@opentelemetry/exporter-logs-otlp-proto/package.json\\npackages/appkit/node_modules/@opentelemetry/exporter-metrics-otlp-proto/package.json\\npackages/appkit/node_modules/@opentelemetry/exporter-trace-otlp-proto/package.json\\npackages/appkit/node_modules/@opentelemetry/instrumentation-express/package.json\\npackages/appkit/node_modules/@opentelemetry/instrumentation-http/package.json\\npackages/appkit/node_modules/@opentelemetry/instrumentation/package.json\\npackages/appkit/node_modules/@opentelemetry/resources/package.json\\npackages/appkit/node_modules/@opentelemetry/sdk-logs/package.json\\npackages/appkit/node_modules/@opentelemetry/sdk-metrics/package.json\\npackages/appkit/node_modules/@opentelemetry/sdk-node/package.json\\npackages/appkit/node_modules/@opentelemetry/sdk-trace-base/package.json\\npackages/appkit/node_modules/@opentelemetry/semantic-conventions/package.json\\npackages/appkit/node_modules/dotenv/package.json\\npackages/appkit/node_modules/express/package.json\\npackages/appkit/node_modules/obug/package.json\\npackages/appkit/node_modules/pg/package.json\\npackages/appkit/node_modules/picocolors/package.json\\npackages/appkit/node_modules/semver/package.json\\npackages/appkit/node_modules/shared/package.json\\npackages/appkit/node_modules/ws/package.json\\npackages/appkit/node_modules/zod/package.json"}]},"components":[{"group":"@ast-grep","name":"napi","version":"0.37.0","description":"Search and Rewrite code at large scale using precise AST pattern","scope":"required","licenses":[{"license":{"id":"MIT","url":"https://opensource.org/licenses/MIT"}}],"purl":"pkg:npm/%40ast-grep/napi@0.37.0","externalReferences":[{"type":"vcs","url":"https://ast-grep.github.io"}],"type":"library","bom-ref":"pkg:npm/@ast-grep/napi@0.37.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@ast-grep/napi/package.json"},{"name":"ImportedModules","value":"@ast-grep/napi,Lang,@ast-grep/napi/Lang,parse,@ast-grep/napi/parse,SgNode,@ast-grep/napi/SgNode"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@ast-grep/napi/package.json"}],"concludedValue":"packages/appkit/node_modules/@ast-grep/napi/package.json"}],"occurrences":[{"location":"dist/type-generator/serving/server-file-extractor.js#4"},{"location":"tmp/dist/cli/commands/codemod/on-plugins-ready.js#4"},{"location":"tmp/dist/cli/commands/lint.js#4"},{"location":"tmp/dist/cli/commands/plugin/sync/sync.js#7"},{"location":"tmp/dist/type-generator/serving/server-file-extractor.js#4"},{"location":"src/type-generator/serving/server-file-extractor.ts#3"}]}},{"group":"@databricks","name":"lakebase","version":"0.3.0","description":"PostgreSQL driver for Databricks Lakebase Autoscaling with automatic OAuth token refresh","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40databricks/lakebase@0.3.0","externalReferences":[{"type":"vcs","url":"git+https://github.com/databricks/appkit.git"}],"type":"library","bom-ref":"pkg:npm/@databricks/lakebase@0.3.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@databricks/lakebase/package.json"},{"name":"ExportedModules","value":"@databricks/lakebase,DatabaseCredential,@databricks/lakebase/DatabaseCredential,GenerateDatabaseCredentialRequest,@databricks/lakebase/GenerateDatabaseCredentialRequest,generateDatabaseCredential,@databricks/lakebase/generateDatabaseCredential,getLakebaseOrmConfig,@databricks/lakebase/getLakebaseOrmConfig,getLakebasePgConfig,@databricks/lakebase/getLakebasePgConfig,getUsernameWithApiLookup,@databricks/lakebase/getUsernameWithApiLookup,getWorkspaceClient,@databricks/lakebase/getWorkspaceClient,LakebasePoolConfig,@databricks/lakebase/LakebasePoolConfig,RequestedClaims,@databricks/lakebase/RequestedClaims,RequestedClaimsPermissionSet,@databricks/lakebase/RequestedClaimsPermissionSet,RequestedResource,@databricks/lakebase/RequestedResource"},{"name":"ImportedModules","value":"@databricks/lakebase,RequestedClaimsPermissionSet,@databricks/lakebase/RequestedClaimsPermissionSet,createLakebasePool,@databricks/lakebase/createLakebasePool,generateDatabaseCredential,@databricks/lakebase/generateDatabaseCredential,getLakebaseOrmConfig,@databricks/lakebase/getLakebaseOrmConfig,getLakebasePgConfig,@databricks/lakebase/getLakebasePgConfig,getUsernameWithApiLookup,@databricks/lakebase/getUsernameWithApiLookup,getWorkspaceClient,@databricks/lakebase/getWorkspaceClient,LakebasePoolConfig,@databricks/lakebase/LakebasePoolConfig"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@databricks/lakebase/package.json"}],"concludedValue":"packages/appkit/node_modules/@databricks/lakebase/package.json"}],"occurrences":[{"location":"dist/connectors/lakebase/index.js#2"},{"location":"tmp/dist/connectors/lakebase/index.js#2"},{"location":"src/connectors/lakebase/index.ts#4"},{"location":"src/connectors/lakebase/index.ts#37"}]},"tags":["token"]},{"group":"@databricks","name":"sdk-experimental","version":"0.16.0","description":"Databricks SDK","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40databricks/sdk-experimental@0.16.0","externalReferences":[{"type":"vcs","url":"https://github.com/databricks/databricks-sdk-js"},{"type":"vcs","url":"git+https://github.com/databricks/databricks-sdk-js.git#main"}],"type":"library","bom-ref":"pkg:npm/@databricks/sdk-experimental@0.16.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@databricks/sdk-experimental/package.json"},{"name":"ImportedModules","value":"@databricks/sdk-experimental,ApiError,@databricks/sdk-experimental/ApiError,WorkspaceClient,@databricks/sdk-experimental/WorkspaceClient,Context,@databricks/sdk-experimental/Context,ConfigError,@databricks/sdk-experimental/ConfigError,jobs,@databricks/sdk-experimental/jobs,ApiClient,@databricks/sdk-experimental/ApiClient,Config,@databricks/sdk-experimental/Config,CancellationToken,@databricks/sdk-experimental/CancellationToken,serving,@databricks/sdk-experimental/serving,@databricks/sdk-experimental/sql,ClientOptions,@databricks/sdk-experimental/ClientOptions,files,@databricks/sdk-experimental/files,@databricks/sdk-experimental/dist/apis/dashboards,GenieMessage,@databricks/sdk-experimental/dist/apis/dashboards/GenieMessage,@databricks/sdk-experimental/dist/wait,Waiter,@databricks/sdk-experimental/dist/wait/Waiter"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@databricks/sdk-experimental/package.json"}],"concludedValue":"packages/appkit/node_modules/@databricks/sdk-experimental/package.json"}],"occurrences":[{"location":"dist/cache/index.js#15"},{"location":"dist/connectors/files/client.js#5"},{"location":"dist/connectors/genie/client.js#5"},{"location":"dist/connectors/jobs/client.js#7"},{"location":"dist/connectors/lakebase-v1/client.js#6"},{"location":"dist/connectors/serving/client.js#2"},{"location":"dist/connectors/sql-warehouse/client.js#11"},{"location":"dist/context/service-context.js#7"},{"location":"dist/plugins/files/plugin.js#18"},{"location":"dist/type-generator/query-registry.js#5"},{"location":"dist/type-generator/serving/fetcher.js#2"},{"location":"dist/type-generator/serving/generator.js#7"},{"location":"tmp/dist/cache/index.js#15"},{"location":"tmp/dist/connectors/files/client.js#5"},{"location":"tmp/dist/connectors/genie/client.js#5"},{"location":"tmp/dist/connectors/jobs/client.js#7"},{"location":"tmp/dist/connectors/lakebase-v1/client.js#6"},{"location":"tmp/dist/connectors/serving/client.js#2"},{"location":"tmp/dist/connectors/sql-warehouse/client.js#11"},{"location":"tmp/dist/context/service-context.js#7"},{"location":"tmp/dist/plugins/files/plugin.js#18"},{"location":"tmp/dist/type-generator/query-registry.js#5"},{"location":"tmp/dist/type-generator/serving/fetcher.js#2"},{"location":"tmp/dist/type-generator/serving/generator.js#7"},{"location":"src/cache/index.ts#2"},{"location":"src/connectors/files/client.ts#1"},{"location":"src/connectors/genie/client.ts#1"},{"location":"src/connectors/genie/client.ts#2"},{"location":"src/connectors/jobs/client.ts#5"},{"location":"src/connectors/lakebase-v1/client.ts#2"},{"location":"src/connectors/lakebase-v1/client.ts#3"},{"location":"src/connectors/lakebase-v1/types.ts#1"},{"location":"src/connectors/serving/client.ts#5"},{"location":"src/connectors/serving/client.ts#6"},{"location":"src/connectors/sql-warehouse/client.ts#5"},{"location":"src/connectors/sql-warehouse/defaults.ts#1"},{"location":"src/connectors/vector-search/client.ts#1"},{"location":"src/context/service-context.ts#6"},{"location":"src/core/appkit.ts#1"},{"location":"src/plugins/analytics/analytics.ts#1"},{"location":"src/plugins/analytics/query.ts#2"},{"location":"src/plugins/files/plugin.ts#3"},{"location":"src/plugins/files/types.ts#1"},{"location":"src/plugins/jobs/plugin.ts#2"},{"location":"src/plugins/jobs/types.ts#1"},{"location":"src/stream/arrow-stream-processor.ts#1"},{"location":"src/type-generator/query-registry.ts#3"},{"location":"src/type-generator/serving/fetcher.ts#1"},{"location":"src/type-generator/serving/generator.ts#3"},{"location":"src/connectors/genie/client.ts#3"},{"location":"src/connectors/genie/client.ts#4"}]},"tags":["sql"]},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"api-logs","version":"0.208.0","description":"Public logs API for OpenTelemetry","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/api-logs@0.208.0","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/api-logs"}],"type":"library","bom-ref":"pkg:npm/@opentelemetry/api-logs@0.208.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/api-logs/package.json"},{"name":"ExportedModules","value":"@opentelemetry/api-logs"},{"name":"ImportedModules","value":"@opentelemetry/api-logs,SeverityNumber,@opentelemetry/api-logs/SeverityNumber,logs,@opentelemetry/api-logs/logs,NOOP_LOGGER,@opentelemetry/api-logs/NOOP_LOGGER,Logger,@opentelemetry/api-logs/Logger,LogRecord,@opentelemetry/api-logs/LogRecord"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/api-logs/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/api-logs/package.json"}],"occurrences":[{"location":"dist/logging/wide-event-emitter.js#1"},{"location":"dist/telemetry/index.js#6"},{"location":"dist/telemetry/noop.js#2"},{"location":"dist/telemetry/telemetry-provider.js#4"},{"location":"tmp/dist/logging/wide-event-emitter.js#1"},{"location":"tmp/dist/telemetry/index.js#6"},{"location":"tmp/dist/telemetry/noop.js#2"},{"location":"tmp/dist/telemetry/telemetry-provider.js#4"},{"location":"src/logging/wide-event-emitter.ts#1"},{"location":"src/telemetry/index.ts#7"},{"location":"src/telemetry/noop.ts#97"},{"location":"src/telemetry/telemetry-provider.ts#3"},{"location":"src/telemetry/types.ts#2"}]},"tags":["api"]},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"api","version":"1.9.0","description":"Public API for OpenTelemetry","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/api@1.9.0","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js/tree/main/api"}],"type":"library","bom-ref":"pkg:npm/@opentelemetry/api@1.9.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/api/package.json"},{"name":"ExportedModules","value":"@opentelemetry/api,@opentelemetry/api-logs,Counter,@opentelemetry/api/Counter,Histogram,@opentelemetry/api/Histogram,Span,@opentelemetry/api/Span,SpanKind,@opentelemetry/api/SpanKind,SpanStatusCode,@opentelemetry/api/SpanStatusCode"},{"name":"ImportedModules","value":"@opentelemetry/api,trace,@opentelemetry/api/trace,context,@opentelemetry/api/context,createContextKey,@opentelemetry/api/createContextKey,SpanKind,@opentelemetry/api/SpanKind,SpanStatusCode,@opentelemetry/api/SpanStatusCode,INVALID_SPAN_CONTEXT,@opentelemetry/api/INVALID_SPAN_CONTEXT,createNoopMeter,@opentelemetry/api/createNoopMeter,metrics,@opentelemetry/api/metrics,Context,@opentelemetry/api/Context,Span,@opentelemetry/api/Span,SpanContext,@opentelemetry/api/SpanContext,SpanOptions,@opentelemetry/api/SpanOptions,Tracer,@opentelemetry/api/Tracer,Meter,@opentelemetry/api/Meter,Attributes,@opentelemetry/api/Attributes,Link,@opentelemetry/api/Link"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/api/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/api/package.json"}],"occurrences":[{"location":"dist/logging/logger.js#6"},{"location":"dist/plugin/plugin.js#21"},{"location":"dist/stream/stream-manager.js#9"},{"location":"dist/telemetry/index.js#5"},{"location":"dist/telemetry/noop.js#1"},{"location":"dist/telemetry/telemetry-provider.js#3"},{"location":"tmp/dist/logging/logger.js#6"},{"location":"tmp/dist/plugin/plugin.js#21"},{"location":"tmp/dist/stream/stream-manager.js#9"},{"location":"tmp/dist/telemetry/index.js#5"},{"location":"tmp/dist/telemetry/noop.js#1"},{"location":"tmp/dist/telemetry/telemetry-provider.js#3"},{"location":"src/logging/logger.ts#3"},{"location":"src/plugin/plugin.ts#1"},{"location":"src/stream/stream-manager.ts#2"},{"location":"src/stream/types.ts#1"},{"location":"src/telemetry/index.ts#5"},{"location":"src/telemetry/index.ts#6"},{"location":"src/telemetry/noop.ts#17"},{"location":"src/telemetry/noop.ts#22"},{"location":"src/telemetry/telemetry-provider.ts#1"},{"location":"src/telemetry/telemetry-provider.ts#2"},{"location":"src/telemetry/trace-sampler.ts#1"},{"location":"src/telemetry/types.ts#1"}]},"tags":["api"]},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"auto-instrumentations-node","version":"0.67.2","description":"Metapackage which bundles opentelemetry node core and contrib instrumentations","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/auto-instrumentations-node@0.67.2","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/auto-instrumentations-node#readme"},{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js-contrib.git"}],"type":"library","bom-ref":"pkg:npm/@opentelemetry/auto-instrumentations-node@0.67.2","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/auto-instrumentations-node/package.json"},{"name":"ImportedModules","value":"@opentelemetry/auto-instrumentations-node,getNodeAutoInstrumentations,@opentelemetry/auto-instrumentations-node/getNodeAutoInstrumentations"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/auto-instrumentations-node/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/auto-instrumentations-node/package.json"}],"occurrences":[{"location":"dist/telemetry/telemetry-manager.js#4"},{"location":"tmp/dist/telemetry/telemetry-manager.js#4"},{"location":"src/telemetry/telemetry-manager.ts#1"}]}},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"exporter-logs-otlp-proto","version":"0.208.0","description":"An OTLP exporter to send logs using protobuf over HTTP","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/exporter-logs-otlp-proto@0.208.0","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/exporter-logs-otlp-proto"}],"type":"library","bom-ref":"pkg:npm/@opentelemetry/exporter-logs-otlp-proto@0.208.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/exporter-logs-otlp-proto/package.json"},{"name":"ImportedModules","value":"@opentelemetry/exporter-logs-otlp-proto,OTLPLogExporter,@opentelemetry/exporter-logs-otlp-proto/OTLPLogExporter"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/exporter-logs-otlp-proto/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/exporter-logs-otlp-proto/package.json"}],"occurrences":[{"location":"dist/telemetry/telemetry-manager.js#5"},{"location":"tmp/dist/telemetry/telemetry-manager.js#5"},{"location":"src/telemetry/telemetry-manager.ts#2"}]}},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"exporter-metrics-otlp-proto","version":"0.208.0","description":"OpenTelemetry Collector Metrics Exporter allows user to send collected metrics to the OpenTelemetry Collector using protobuf over HTTP","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/exporter-metrics-otlp-proto@0.208.0","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-exporter-metrics-otlp-proto"}],"type":"library","bom-ref":"pkg:npm/@opentelemetry/exporter-metrics-otlp-proto@0.208.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/exporter-metrics-otlp-proto/package.json"},{"name":"ImportedModules","value":"@opentelemetry/exporter-metrics-otlp-proto,OTLPMetricExporter,@opentelemetry/exporter-metrics-otlp-proto/OTLPMetricExporter"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/exporter-metrics-otlp-proto/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/exporter-metrics-otlp-proto/package.json"}],"occurrences":[{"location":"dist/telemetry/telemetry-manager.js#6"},{"location":"tmp/dist/telemetry/telemetry-manager.js#6"},{"location":"src/telemetry/telemetry-manager.ts#3"}]}},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"exporter-trace-otlp-proto","version":"0.208.0","description":"OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector using protobuf over HTTP","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/exporter-trace-otlp-proto@0.208.0","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/exporter-trace-otlp-proto"}],"type":"library","bom-ref":"pkg:npm/@opentelemetry/exporter-trace-otlp-proto@0.208.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/exporter-trace-otlp-proto/package.json"},{"name":"ImportedModules","value":"@opentelemetry/exporter-trace-otlp-proto,OTLPTraceExporter,@opentelemetry/exporter-trace-otlp-proto/OTLPTraceExporter"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/exporter-trace-otlp-proto/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/exporter-trace-otlp-proto/package.json"}],"occurrences":[{"location":"dist/telemetry/telemetry-manager.js#7"},{"location":"tmp/dist/telemetry/telemetry-manager.js#7"},{"location":"src/telemetry/telemetry-manager.ts#4"}]}},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"instrumentation-express","version":"0.57.0","description":"OpenTelemetry instrumentation for `express` http web application framework","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/instrumentation-express@0.57.0","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-express#readme"},{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js-contrib.git"}],"type":"framework","bom-ref":"pkg:npm/@opentelemetry/instrumentation-express@0.57.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/instrumentation-express/package.json"},{"name":"ImportedModules","value":"@opentelemetry/instrumentation-express,ExpressInstrumentation,@opentelemetry/instrumentation-express/ExpressInstrumentation"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/instrumentation-express/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/instrumentation-express/package.json"}],"occurrences":[{"location":"dist/telemetry/instrumentations.js#2"},{"location":"tmp/dist/telemetry/instrumentations.js#2"},{"location":"src/telemetry/instrumentations.ts#2"}]},"tags":["framework","web"]},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"instrumentation-http","version":"0.208.0","description":"OpenTelemetry instrumentation for `node:http` and `node:https` http client and server modules","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/instrumentation-http@0.208.0","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-http"}],"type":"library","bom-ref":"pkg:npm/@opentelemetry/instrumentation-http@0.208.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/instrumentation-http/package.json"},{"name":"ImportedModules","value":"@opentelemetry/instrumentation-http,HttpInstrumentation,@opentelemetry/instrumentation-http/HttpInstrumentation"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/instrumentation-http/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/instrumentation-http/package.json"}],"occurrences":[{"location":"dist/telemetry/instrumentations.js#3"},{"location":"tmp/dist/telemetry/instrumentations.js#3"},{"location":"src/telemetry/instrumentations.ts#3"}]}},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"instrumentation","version":"0.208.0","description":"Base class for node which OpenTelemetry instrumentation modules extend","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/instrumentation@0.208.0","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation"},{"type":"vcs","url":"git+https://github.com/open-telemetry/opentelemetry-js.git"}],"type":"library","bom-ref":"pkg:npm/@opentelemetry/instrumentation@0.208.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/instrumentation/package.json"},{"name":"ImportedModules","value":"@opentelemetry/instrumentation,registerInstrumentations,@opentelemetry/instrumentation/registerInstrumentations,Instrumentation,@opentelemetry/instrumentation/Instrumentation"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/instrumentation/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/instrumentation/package.json"}],"occurrences":[{"location":"dist/telemetry/telemetry-manager.js#8"},{"location":"tmp/dist/telemetry/telemetry-manager.js#8"},{"location":"src/telemetry/instrumentations.ts#1"},{"location":"src/telemetry/telemetry-manager.ts#8"},{"location":"src/telemetry/telemetry-provider.ts#4"},{"location":"src/telemetry/types.ts#3"}]}},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"resources","version":"2.2.0","description":"OpenTelemetry SDK resources","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/resources@2.2.0","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-resources"}],"type":"library","bom-ref":"pkg:npm/@opentelemetry/resources@2.2.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/resources/package.json"},{"name":"ImportedModules","value":"@opentelemetry/resources,detectResources,@opentelemetry/resources/detectResources,envDetector,@opentelemetry/resources/envDetector,hostDetector,@opentelemetry/resources/hostDetector,processDetector,@opentelemetry/resources/processDetector,resourceFromAttributes,@opentelemetry/resources/resourceFromAttributes,Resource,@opentelemetry/resources/Resource"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/resources/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/resources/package.json"}],"occurrences":[{"location":"dist/telemetry/telemetry-manager.js#9"},{"location":"tmp/dist/telemetry/telemetry-manager.js#9"},{"location":"src/telemetry/telemetry-manager.ts#16"}]}},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"sdk-logs","version":"0.208.0","description":"OpenTelemetry logs SDK","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/sdk-logs@0.208.0","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/sdk-logs"},{"type":"vcs","url":"git+https://github.com/open-telemetry/opentelemetry-js.git"}],"type":"library","bom-ref":"pkg:npm/@opentelemetry/sdk-logs@0.208.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/sdk-logs/package.json"},{"name":"ImportedModules","value":"@opentelemetry/sdk-logs,BatchLogRecordProcessor,@opentelemetry/sdk-logs/BatchLogRecordProcessor"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/sdk-logs/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/sdk-logs/package.json"}],"occurrences":[{"location":"dist/telemetry/telemetry-manager.js#10"},{"location":"tmp/dist/telemetry/telemetry-manager.js#10"},{"location":"src/telemetry/telemetry-manager.ts#17"}]}},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"sdk-metrics","version":"2.2.0","description":"OpenTelemetry metrics SDK","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/sdk-metrics@2.2.0","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/sdk-metrics"}],"type":"library","bom-ref":"pkg:npm/@opentelemetry/sdk-metrics@2.2.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/sdk-metrics/package.json"},{"name":"ImportedModules","value":"@opentelemetry/sdk-metrics,PeriodicExportingMetricReader,@opentelemetry/sdk-metrics/PeriodicExportingMetricReader"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/sdk-metrics/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/sdk-metrics/package.json"}],"occurrences":[{"location":"dist/telemetry/telemetry-manager.js#11"},{"location":"tmp/dist/telemetry/telemetry-manager.js#11"},{"location":"src/telemetry/telemetry-manager.ts#18"}]}},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"sdk-node","version":"0.208.0","description":"OpenTelemetry SDK for Node.js","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/sdk-node@0.208.0","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-sdk-node"}],"type":"library","bom-ref":"pkg:npm/@opentelemetry/sdk-node@0.208.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/sdk-node/package.json"},{"name":"ImportedModules","value":"@opentelemetry/sdk-node,NodeSDK,@opentelemetry/sdk-node/NodeSDK"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/sdk-node/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/sdk-node/package.json"}],"occurrences":[{"location":"dist/telemetry/telemetry-manager.js#12"},{"location":"tmp/dist/telemetry/telemetry-manager.js#12"},{"location":"src/telemetry/telemetry-manager.ts#19"}]}},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"sdk-trace-base","version":"2.6.0","description":"OpenTelemetry Tracing","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/sdk-trace-base@2.6.0","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-base"}],"type":"library","bom-ref":"pkg:npm/@opentelemetry/sdk-trace-base@2.6.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/sdk-trace-base/package.json"},{"name":"ImportedModules","value":"@opentelemetry/sdk-trace-base,SamplingDecision,@opentelemetry/sdk-trace-base/SamplingDecision,Sampler,@opentelemetry/sdk-trace-base/Sampler,SamplingResult,@opentelemetry/sdk-trace-base/SamplingResult"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/sdk-trace-base/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/sdk-trace-base/package.json"}],"occurrences":[{"location":"dist/telemetry/trace-sampler.js#2"},{"location":"tmp/dist/telemetry/trace-sampler.js#2"},{"location":"src/telemetry/trace-sampler.ts#2"},{"location":"src/telemetry/trace-sampler.ts#3"}]}},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"semantic-conventions","version":"1.38.0","description":"OpenTelemetry semantic conventions","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/semantic-conventions@1.38.0","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions"}],"type":"library","bom-ref":"pkg:npm/@opentelemetry/semantic-conventions@1.38.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/semantic-conventions/package.json"},{"name":"ImportedModules","value":"@opentelemetry/semantic-conventions,ATTR_SERVICE_NAME,@opentelemetry/semantic-conventions/ATTR_SERVICE_NAME,ATTR_SERVICE_VERSION,@opentelemetry/semantic-conventions/ATTR_SERVICE_VERSION"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/semantic-conventions/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/semantic-conventions/package.json"}],"occurrences":[{"location":"dist/telemetry/telemetry-manager.js#13"},{"location":"tmp/dist/telemetry/telemetry-manager.js#13"},{"location":"src/telemetry/telemetry-manager.ts#23"}]}},{"group":"","name":"dotenv","version":"16.6.1","description":"Loads environment variables from .env file","scope":"required","licenses":[{"license":{"id":"BSD-2-Clause","url":"https://opensource.org/licenses/BSD-2-Clause"}}],"purl":"pkg:npm/dotenv@16.6.1","externalReferences":[{"type":"vcs","url":"https://github.com/motdotla/dotenv#readme"},{"type":"vcs","url":"git://github.com/motdotla/dotenv.git"}],"type":"library","bom-ref":"pkg:npm/dotenv@16.6.1","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/dotenv/package.json"},{"name":"ImportedModules","value":"dotenv,dotenv/config"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/dotenv/package.json"}],"concludedValue":"packages/appkit/node_modules/dotenv/package.json"}],"occurrences":[{"location":"dist/plugins/server/index.js#17"},{"location":"dist/type-generator/index.js#7"},{"location":"tmp/dist/cli/index.js#8"},{"location":"tmp/dist/plugins/server/index.js#17"},{"location":"tmp/dist/type-generator/index.js#7"},{"location":"src/plugins/server/index.ts#4"},{"location":"src/type-generator/index.ts#3"},{"location":"tmp/dist/cli/index.js#8"}]}},{"authors":[{"name":"TJ Holowaychuk <tj@vision-media.ca>"}],"group":"","name":"express","version":"4.22.0","description":"Fast, unopinionated, minimalist web framework","scope":"required","licenses":[{"license":{"id":"MIT","url":"https://opensource.org/licenses/MIT"}}],"purl":"pkg:npm/express@4.22.0","externalReferences":[{"type":"website","url":"http://expressjs.com/"}],"type":"framework","bom-ref":"pkg:npm/express@4.22.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/express/package.json"},{"name":"ImportedModules","value":"express,NextFunction,express/NextFunction,Request,express/Request,Response,express/Response"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/express/package.json"}],"concludedValue":"packages/appkit/node_modules/express/package.json"}],"occurrences":[{"location":"dist/plugins/server/index.js#18"},{"location":"dist/plugins/server/static-server.js#4"},{"location":"tmp/dist/plugins/server/index.js#18"},{"location":"tmp/dist/plugins/server/static-server.js#4"},{"location":"src/logging/logger.ts#4"},{"location":"src/plugin/plugin.ts#2"},{"location":"src/plugins/analytics/analytics.ts#2"},{"location":"src/plugins/files/plugin.ts#4"},{"location":"src/plugins/genie/genie.ts#2"},{"location":"src/plugins/jobs/plugin.ts#3"},{"location":"src/plugins/server/base-server.ts#1"},{"location":"src/plugins/server/index.ts#5"},{"location":"src/plugins/server/remote-tunnel/gate.ts#1"},{"location":"src/plugins/server/remote-tunnel/remote-tunnel-controller.ts#2"},{"location":"src/plugins/server/remote-tunnel/remote-tunnel-manager.ts#6"},{"location":"src/plugins/server/static-server.ts#3"},{"location":"src/plugins/server/static-server.ts#4"},{"location":"src/plugins/server/vite-dev-server.ts#3"},{"location":"src/plugins/serving/serving.ts#4"},{"location":"src/plugins/vector-search/vector-search.ts#1"}]},"tags":["framework","web"]},{"authors":[{"name":"Kevin Deng <sxzz@sxzz.moe>"}],"group":"","name":"obug","version":"2.1.1","description":"A lightweight JavaScript debugging utility, forked from debug, featuring TypeScript and ESM support.","scope":"required","licenses":[{"license":{"id":"MIT","url":"https://opensource.org/licenses/MIT"}}],"purl":"pkg:npm/obug@2.1.1","externalReferences":[{"type":"vcs","url":"https://github.com/sxzz/obug#readme"},{"type":"vcs","url":"git+https://github.com/sxzz/obug.git"}],"type":"library","bom-ref":"pkg:npm/obug@2.1.1","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/obug/package.json"},{"name":"ImportedModules","value":"obug,createDebug,obug/createDebug"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/obug/package.json"}],"concludedValue":"packages/appkit/node_modules/obug/package.json"}],"occurrences":[{"location":"dist/logging/logger.js#7"},{"location":"tmp/dist/logging/logger.js#7"},{"location":"src/logging/logger.ts#5"}]}},{"authors":[{"name":"Brian Carlson <brian.m.carlson@gmail.com>"}],"group":"","name":"pg","version":"8.18.0","description":"PostgreSQL client - pure javascript & libpq with the same API","scope":"required","licenses":[{"license":{"id":"MIT","url":"https://opensource.org/licenses/MIT"}}],"purl":"pkg:npm/pg@8.18.0","externalReferences":[{"type":"vcs","url":"https://github.com/brianc/node-postgres"},{"type":"vcs","url":"git://github.com/brianc/node-postgres.git"}],"type":"library","bom-ref":"pkg:npm/pg@8.18.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/pg/package.json"},{"name":"ImportedModules","value":"pg,Pool,pg/Pool,QueryResult,pg/QueryResult,QueryResultRow,pg/QueryResultRow"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/pg/package.json"}],"concludedValue":"packages/appkit/node_modules/pg/package.json"}],"occurrences":[{"location":"dist/connectors/lakebase-v1/client.js#7"},{"location":"tmp/dist/connectors/lakebase-v1/client.js#7"},{"location":"src/cache/storage/persistent.ts#2"},{"location":"src/connectors/lakebase/index.ts#5"},{"location":"src/connectors/lakebase-v1/client.ts#4"},{"location":"src/plugins/lakebase/lakebase.ts#1"}]}},{"authors":[{"name":"Alexey Raspopov"}],"group":"","name":"picocolors","version":"1.1.1","description":"The tiniest and the fastest library for terminal output formatting with ANSI colors","scope":"required","licenses":[{"license":{"id":"ISC","url":"https://opensource.org/licenses/ISC"}}],"purl":"pkg:npm/picocolors@1.1.1","type":"library","bom-ref":"pkg:npm/picocolors@1.1.1","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/picocolors/package.json"},{"name":"ImportedModules","value":"picocolors"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/picocolors/package.json"}],"concludedValue":"packages/appkit/node_modules/picocolors/package.json"}],"occurrences":[{"location":"dist/errors/configuration.js#3"},{"location":"dist/plugins/server/client-config-sanitizer.js#2"},{"location":"dist/plugins/server/utils.js#2"},{"location":"dist/type-generator/migration.js#2"},{"location":"dist/type-generator/query-registry.js#6"},{"location":"dist/type-generator/serving/generator.js#8"},{"location":"tmp/dist/errors/configuration.js#3"},{"location":"tmp/dist/plugins/server/client-config-sanitizer.js#2"},{"location":"tmp/dist/plugins/server/utils.js#2"},{"location":"tmp/dist/type-generator/migration.js#2"},{"location":"tmp/dist/type-generator/query-registry.js#6"},{"location":"tmp/dist/type-generator/serving/generator.js#8"},{"location":"src/errors/configuration.ts#1"},{"location":"src/plugins/server/client-config-sanitizer.ts#1"},{"location":"src/plugins/server/utils.ts#5"},{"location":"src/type-generator/migration.ts#4"},{"location":"src/type-generator/query-registry.ts#4"},{"location":"src/type-generator/serving/generator.ts#4"}]}},{"authors":[{"name":"GitHub Inc."}],"group":"","name":"semver","version":"7.7.3","description":"The semantic version parser used by npm.","scope":"required","licenses":[{"license":{"id":"ISC","url":"https://opensource.org/licenses/ISC"}}],"purl":"pkg:npm/semver@7.7.3","externalReferences":[{"type":"vcs","url":"git+https://github.com/npm/node-semver.git"}],"type":"library","bom-ref":"pkg:npm/semver@7.7.3","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/semver/package.json"},{"name":"ImportedModules","value":"semver,coerce,semver/coerce"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/semver/package.json"}],"concludedValue":"packages/appkit/node_modules/semver/package.json"}],"occurrences":[{"location":"dist/context/service-context.js#8"},{"location":"tmp/dist/context/service-context.js#8"},{"location":"src/context/service-context.ts#7"}]}},{"group":"","name":"shared","version":"0.0.1","scope":"required","purl":"pkg:npm/shared@0.0.1","type":"library","bom-ref":"pkg:npm/shared@0.0.1","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/shared/package.json"},{"name":"ExportedModules","value":"shared,GenieAttachmentResponse,shared/GenieAttachmentResponse,GenieMessageResponse,shared/GenieMessageResponse,GenieStatementResponse,shared/GenieStatementResponse,GenieStreamEvent,shared/GenieStreamEvent,BasePluginConfig,shared/BasePluginConfig,CacheConfig,shared/CacheConfig,IAppRouter,shared/IAppRouter,PluginData,shared/PluginData,StreamExecutionSettings,shared/StreamExecutionSettings,isSQLTypeMarker,shared/isSQLTypeMarker,shared/sql"},{"name":"ImportedModules","value":"shared,AgentAdapter,shared/AgentAdapter,AgentEvent,shared/AgentEvent,AgentInput,shared/AgentInput,AgentRunContext,shared/AgentRunContext,AgentToolDefinition,shared/AgentToolDefinition,CacheConfig,shared/CacheConfig,CacheStorage,shared/CacheStorage,CacheEntry,shared/CacheEntry,TelemetryOptions,shared/TelemetryOptions,GenieMessageResponse,shared/GenieMessageResponse,BasePlugin,shared/BasePlugin,InputPluginMap,shared/InputPluginMap,OptionalConfigPluginDef,shared/OptionalConfigPluginDef,PluginConstructor,shared/PluginConstructor,PluginData,shared/PluginData,PluginMap,shared/PluginMap,TunnelConnection,shared/TunnelConnection,RetryConfig,shared/RetryConfig,TelemetryConfig,shared/TelemetryConfig,BasePluginConfig,shared/BasePluginConfig,IAppResponse,shared/IAppResponse,PluginEndpointMap,shared/PluginEndpointMap,PluginExecuteConfig,shared/PluginExecuteConfig,PluginExecutionSettings,shared/PluginExecutionSettings,PluginPhase,shared/PluginPhase,RouteConfig,shared/RouteConfig,StreamExecuteHandler,shared/StreamExecuteHandler,StreamExecutionSettings,shared/StreamExecutionSettings,ToPlugin,shared/ToPlugin,IAppRouter,shared/IAppRouter,SQLTypeMarker,shared/SQLTypeMarker,isSQLTypeMarker,shared/isSQLTypeMarker,shared/sql,IAppRequest,shared/IAppRequest,PluginClientConfigs,shared/PluginClientConfigs,PluginEndpoints,shared/PluginEndpoints,PluginManifest,shared/PluginManifest,ResourceRequirement,shared/ResourceRequirement,StreamConfig,shared/StreamConfig"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/shared/package.json"}],"concludedValue":"packages/appkit/node_modules/shared/package.json"}],"occurrences":[{"location":"src/agents/databricks.ts#7"},{"location":"src/cache/defaults.ts#1"},{"location":"src/cache/index.ts#3"},{"location":"src/cache/storage/memory.ts#1"},{"location":"src/cache/storage/persistent.ts#3"},{"location":"src/connectors/files/client.ts#2"},{"location":"src/connectors/genie/types.ts#3"},{"location":"src/connectors/genie/types.ts#10"},{"location":"src/connectors/jobs/types.ts#1"},{"location":"src/connectors/lakebase-v1/types.ts#2"},{"location":"src/connectors/sql-warehouse/client.ts#6"},{"location":"src/connectors/vector-search/types.ts#1"},{"location":"src/core/appkit.ts#10"},{"location":"src/index.ts#15"},{"location":"src/index.ts#16"},{"location":"src/plugin/dev-reader.ts#2"},{"location":"src/plugin/index.ts#1"},{"location":"src/plugin/interceptors/cache.ts#1"},{"location":"src/plugin/interceptors/retry.ts#1"},{"location":"src/plugin/interceptors/telemetry.ts#1"},{"location":"src/plugin/plugin.ts#14"},{"location":"src/plugin/to-plugin.ts#1"},{"location":"src/plugins/analytics/analytics.ts#8"},{"location":"src/plugins/analytics/defaults.ts#1"},{"location":"src/plugins/analytics/query.ts#3"},{"location":"src/plugins/analytics/types.ts#1"},{"location":"src/plugins/files/defaults.ts#1"},{"location":"src/plugins/files/plugin.ts#5"},{"location":"src/plugins/files/types.ts#2"},{"location":"src/plugins/genie/defaults.ts#1"},{"location":"src/plugins/genie/genie.ts#3"},{"location":"src/plugins/genie/types.ts#1"},{"location":"src/plugins/genie/types.ts#4"},{"location":"src/plugins/jobs/defaults.ts#1"},{"location":"src/plugins/jobs/plugin.ts#9"},{"location":"src/plugins/jobs/types.ts#2"},{"location":"src/plugins/lakebase/types.ts#1"},{"location":"src/plugins/server/index.ts#6"},{"location":"src/plugins/server/remote-tunnel/remote-tunnel-manager.ts#7"},{"location":"src/plugins/server/types.ts#1"},{"location":"src/plugins/server/utils.ts#6"},{"location":"src/plugins/serving/serving.ts#5"},{"location":"src/plugins/serving/types.ts#1"},{"location":"src/plugins/vector-search/defaults.ts#1"},{"location":"src/plugins/vector-search/types.ts#1"},{"location":"src/plugins/vector-search/vector-search.ts#2"},{"location":"src/registry/manifest-loader.ts#1"},{"location":"src/registry/resource-registry.ts#13"},{"location":"src/registry/types.ts#33"},{"location":"src/registry/types.ts#39"},{"location":"src/stream/sse-writer.ts#1"},{"location":"src/stream/stream-manager.ts#3"},{"location":"src/stream/types.ts#2"},{"location":"src/telemetry/telemetry-manager.ts#24"},{"location":"src/telemetry/telemetry-provider.ts#5"}]},"tags":["sql"]},{"authors":[{"name":"Einar Otto Stangvik <einaros@gmail.com> (http://2x.io)"}],"group":"","name":"ws","version":"8.18.3","description":"Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js","scope":"required","licenses":[{"license":{"id":"MIT","url":"https://opensource.org/licenses/MIT"}}],"purl":"pkg:npm/ws@8.18.3","externalReferences":[{"type":"vcs","url":"https://github.com/websockets/ws"},{"type":"vcs","url":"git+https://github.com/websockets/ws.git"}],"type":"library","bom-ref":"pkg:npm/ws@8.18.3","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/ws/package.json"},{"name":"ImportedModules","value":"ws,WebSocketServer,ws/WebSocketServer"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/ws/package.json"}],"concludedValue":"packages/appkit/node_modules/ws/package.json"}],"occurrences":[{"location":"dist/plugins/server/remote-tunnel/remote-tunnel-manager.js#8"},{"location":"tmp/dist/plugins/server/remote-tunnel/remote-tunnel-manager.js#8"},{"location":"src/plugins/server/remote-tunnel/remote-tunnel-manager.ts#8"}]}},{"authors":[{"name":"Colin McDonnell <zod@colinhacks.com>"}],"group":"","name":"zod","version":"4.3.6","description":"TypeScript-first schema declaration and validation library with static type inference","scope":"required","licenses":[{"license":{"id":"MIT","url":"https://opensource.org/licenses/MIT"}}],"purl":"pkg:npm/zod@4.3.6","externalReferences":[{"type":"website","url":"https://zod.dev"},{"type":"vcs","url":"git+https://github.com/colinhacks/zod.git"}],"type":"library","bom-ref":"pkg:npm/zod@4.3.6","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/zod/package.json"},{"name":"ImportedModules","value":"zod,toJSONSchema,zod/toJSONSchema,zod/z"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/zod/package.json"}],"concludedValue":"packages/appkit/node_modules/zod/package.json"}],"occurrences":[{"location":"dist/plugins/jobs/plugin.js#18"},{"location":"tmp/dist/plugins/jobs/plugin.js#18"},{"location":"src/plugins/jobs/plugin.ts#10"},{"location":"src/plugins/jobs/types.ts#3"}]},"tags":["validation"]}],"dependencies":[],"compositions":[{"bom-ref":"pkg:npm/@databricks/appkit@0.30.0","aggregate":"incomplete"}],"annotations":[{"bom-ref":"metadata-annotations","subjects":["pkg:npm/@databricks/appkit@0.30.0"],"annotator":{"component":{"group":"@cyclonedx","name":"cdxgen","version":"12.1.2","purl":"pkg:npm/%40cyclonedx/cdxgen@12.1.2","type":"application","bom-ref":"pkg:npm/@cyclonedx/cdxgen@12.1.2","publisher":"OWASP Foundation","authors":[{"name":"OWASP Foundation"}]}},"timestamp":"2026-05-05T13:11:01Z","text":"This Software Bill-of-Materials (SBOM) document was created on Tuesday, May 5, 2026 with cdxgen. The data was captured during the build lifecycle phase. The document describes an application named 'appkit' with version '0.30.0'. There are 27 components. The package type in this SBOM is npm with 3 purl namespaces described under components. The components were identified from 27 source files."}]}
1
+ {"bomFormat":"CycloneDX","specVersion":"1.6","serialNumber":"urn:uuid:8140a53d-7b76-495f-8865-87d80debc527","version":1,"metadata":{"timestamp":"2026-05-06T11:07:17Z","tools":{"components":[{"group":"@cyclonedx","name":"cdxgen","version":"12.1.2","purl":"pkg:npm/%40cyclonedx/cdxgen@12.1.2","type":"application","bom-ref":"pkg:npm/@cyclonedx/cdxgen@12.1.2","publisher":"OWASP Foundation","authors":[{"name":"OWASP Foundation"}]}]},"authors":[{"name":"OWASP Foundation"}],"lifecycles":[{"phase":"build"}],"component":{"name":"appkit","group":"@databricks","version":"0.31.0","purl":"pkg:npm/%40databricks/appkit@0.31.0","bom-ref":"pkg:npm/@databricks/appkit@0.31.0","type":"application","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"externalReferences":[{"type":"vcs","url":"git+https://github.com/databricks/appkit.git"}]},"properties":[{"name":"cdx:bom:componentTypes","value":"npm"},{"name":"cdx:bom:componentNamespaces","value":"@ast-grep\\n@databricks\\n@opentelemetry"},{"name":"cdx:bom:componentSrcFiles","value":"packages/appkit/node_modules/@ast-grep/napi/package.json\\npackages/appkit/node_modules/@databricks/lakebase/package.json\\npackages/appkit/node_modules/@databricks/sdk-experimental/package.json\\npackages/appkit/node_modules/@opentelemetry/api-logs/package.json\\npackages/appkit/node_modules/@opentelemetry/api/package.json\\npackages/appkit/node_modules/@opentelemetry/auto-instrumentations-node/package.json\\npackages/appkit/node_modules/@opentelemetry/exporter-logs-otlp-proto/package.json\\npackages/appkit/node_modules/@opentelemetry/exporter-metrics-otlp-proto/package.json\\npackages/appkit/node_modules/@opentelemetry/exporter-trace-otlp-proto/package.json\\npackages/appkit/node_modules/@opentelemetry/instrumentation-express/package.json\\npackages/appkit/node_modules/@opentelemetry/instrumentation-http/package.json\\npackages/appkit/node_modules/@opentelemetry/instrumentation/package.json\\npackages/appkit/node_modules/@opentelemetry/resources/package.json\\npackages/appkit/node_modules/@opentelemetry/sdk-logs/package.json\\npackages/appkit/node_modules/@opentelemetry/sdk-metrics/package.json\\npackages/appkit/node_modules/@opentelemetry/sdk-node/package.json\\npackages/appkit/node_modules/@opentelemetry/sdk-trace-base/package.json\\npackages/appkit/node_modules/@opentelemetry/semantic-conventions/package.json\\npackages/appkit/node_modules/dotenv/package.json\\npackages/appkit/node_modules/express/package.json\\npackages/appkit/node_modules/get-port/package.json\\npackages/appkit/node_modules/obug/package.json\\npackages/appkit/node_modules/pg/package.json\\npackages/appkit/node_modules/picocolors/package.json\\npackages/appkit/node_modules/semver/package.json\\npackages/appkit/node_modules/shared/package.json\\npackages/appkit/node_modules/ws/package.json\\npackages/appkit/node_modules/zod/package.json"}]},"components":[{"group":"@ast-grep","name":"napi","version":"0.37.0","description":"Search and Rewrite code at large scale using precise AST pattern","scope":"required","licenses":[{"license":{"id":"MIT","url":"https://opensource.org/licenses/MIT"}}],"purl":"pkg:npm/%40ast-grep/napi@0.37.0","externalReferences":[{"type":"vcs","url":"https://ast-grep.github.io"}],"type":"library","bom-ref":"pkg:npm/@ast-grep/napi@0.37.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@ast-grep/napi/package.json"},{"name":"ImportedModules","value":"@ast-grep/napi,Lang,@ast-grep/napi/Lang,parse,@ast-grep/napi/parse,SgNode,@ast-grep/napi/SgNode"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@ast-grep/napi/package.json"}],"concludedValue":"packages/appkit/node_modules/@ast-grep/napi/package.json"}],"occurrences":[{"location":"dist/type-generator/serving/server-file-extractor.js#4"},{"location":"tmp/dist/cli/commands/codemod/on-plugins-ready.js#4"},{"location":"tmp/dist/cli/commands/lint.js#4"},{"location":"tmp/dist/cli/commands/plugin/sync/sync.js#7"},{"location":"tmp/dist/type-generator/serving/server-file-extractor.js#4"},{"location":"src/type-generator/serving/server-file-extractor.ts#3"}]}},{"group":"@databricks","name":"lakebase","version":"0.3.0","description":"PostgreSQL driver for Databricks Lakebase Autoscaling with automatic OAuth token refresh","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40databricks/lakebase@0.3.0","externalReferences":[{"type":"vcs","url":"git+https://github.com/databricks/appkit.git"}],"type":"library","bom-ref":"pkg:npm/@databricks/lakebase@0.3.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@databricks/lakebase/package.json"},{"name":"ExportedModules","value":"@databricks/lakebase,DatabaseCredential,@databricks/lakebase/DatabaseCredential,GenerateDatabaseCredentialRequest,@databricks/lakebase/GenerateDatabaseCredentialRequest,generateDatabaseCredential,@databricks/lakebase/generateDatabaseCredential,getLakebaseOrmConfig,@databricks/lakebase/getLakebaseOrmConfig,getLakebasePgConfig,@databricks/lakebase/getLakebasePgConfig,getUsernameWithApiLookup,@databricks/lakebase/getUsernameWithApiLookup,getWorkspaceClient,@databricks/lakebase/getWorkspaceClient,LakebasePoolConfig,@databricks/lakebase/LakebasePoolConfig,RequestedClaims,@databricks/lakebase/RequestedClaims,RequestedClaimsPermissionSet,@databricks/lakebase/RequestedClaimsPermissionSet,RequestedResource,@databricks/lakebase/RequestedResource"},{"name":"ImportedModules","value":"@databricks/lakebase,RequestedClaimsPermissionSet,@databricks/lakebase/RequestedClaimsPermissionSet,createLakebasePool,@databricks/lakebase/createLakebasePool,generateDatabaseCredential,@databricks/lakebase/generateDatabaseCredential,getLakebaseOrmConfig,@databricks/lakebase/getLakebaseOrmConfig,getLakebasePgConfig,@databricks/lakebase/getLakebasePgConfig,getUsernameWithApiLookup,@databricks/lakebase/getUsernameWithApiLookup,getWorkspaceClient,@databricks/lakebase/getWorkspaceClient,LakebasePoolConfig,@databricks/lakebase/LakebasePoolConfig"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@databricks/lakebase/package.json"}],"concludedValue":"packages/appkit/node_modules/@databricks/lakebase/package.json"}],"occurrences":[{"location":"dist/connectors/lakebase/index.js#2"},{"location":"tmp/dist/connectors/lakebase/index.js#2"},{"location":"src/connectors/lakebase/index.ts#4"},{"location":"src/connectors/lakebase/index.ts#37"}]},"tags":["token"]},{"group":"@databricks","name":"sdk-experimental","version":"0.16.0","description":"Databricks SDK","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40databricks/sdk-experimental@0.16.0","externalReferences":[{"type":"vcs","url":"https://github.com/databricks/databricks-sdk-js"},{"type":"vcs","url":"git+https://github.com/databricks/databricks-sdk-js.git#main"}],"type":"library","bom-ref":"pkg:npm/@databricks/sdk-experimental@0.16.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@databricks/sdk-experimental/package.json"},{"name":"ImportedModules","value":"@databricks/sdk-experimental,ApiError,@databricks/sdk-experimental/ApiError,WorkspaceClient,@databricks/sdk-experimental/WorkspaceClient,Context,@databricks/sdk-experimental/Context,ConfigError,@databricks/sdk-experimental/ConfigError,jobs,@databricks/sdk-experimental/jobs,ApiClient,@databricks/sdk-experimental/ApiClient,Config,@databricks/sdk-experimental/Config,CancellationToken,@databricks/sdk-experimental/CancellationToken,serving,@databricks/sdk-experimental/serving,@databricks/sdk-experimental/sql,ClientOptions,@databricks/sdk-experimental/ClientOptions,files,@databricks/sdk-experimental/files,@databricks/sdk-experimental/dist/apis/dashboards,GenieMessage,@databricks/sdk-experimental/dist/apis/dashboards/GenieMessage,@databricks/sdk-experimental/dist/wait,Waiter,@databricks/sdk-experimental/dist/wait/Waiter"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@databricks/sdk-experimental/package.json"}],"concludedValue":"packages/appkit/node_modules/@databricks/sdk-experimental/package.json"}],"occurrences":[{"location":"dist/cache/index.js#15"},{"location":"dist/connectors/files/client.js#5"},{"location":"dist/connectors/genie/client.js#5"},{"location":"dist/connectors/jobs/client.js#7"},{"location":"dist/connectors/lakebase-v1/client.js#6"},{"location":"dist/connectors/serving/client.js#2"},{"location":"dist/connectors/sql-warehouse/client.js#11"},{"location":"dist/context/service-context.js#7"},{"location":"dist/plugins/files/plugin.js#18"},{"location":"dist/type-generator/query-registry.js#5"},{"location":"dist/type-generator/serving/fetcher.js#2"},{"location":"dist/type-generator/serving/generator.js#7"},{"location":"tmp/dist/cache/index.js#15"},{"location":"tmp/dist/connectors/files/client.js#5"},{"location":"tmp/dist/connectors/genie/client.js#5"},{"location":"tmp/dist/connectors/jobs/client.js#7"},{"location":"tmp/dist/connectors/lakebase-v1/client.js#6"},{"location":"tmp/dist/connectors/serving/client.js#2"},{"location":"tmp/dist/connectors/sql-warehouse/client.js#11"},{"location":"tmp/dist/context/service-context.js#7"},{"location":"tmp/dist/plugins/files/plugin.js#18"},{"location":"tmp/dist/type-generator/query-registry.js#5"},{"location":"tmp/dist/type-generator/serving/fetcher.js#2"},{"location":"tmp/dist/type-generator/serving/generator.js#7"},{"location":"src/cache/index.ts#2"},{"location":"src/connectors/files/client.ts#1"},{"location":"src/connectors/genie/client.ts#1"},{"location":"src/connectors/genie/client.ts#2"},{"location":"src/connectors/jobs/client.ts#5"},{"location":"src/connectors/lakebase-v1/client.ts#2"},{"location":"src/connectors/lakebase-v1/client.ts#3"},{"location":"src/connectors/lakebase-v1/types.ts#1"},{"location":"src/connectors/serving/client.ts#5"},{"location":"src/connectors/serving/client.ts#6"},{"location":"src/connectors/sql-warehouse/client.ts#5"},{"location":"src/connectors/sql-warehouse/defaults.ts#1"},{"location":"src/connectors/vector-search/client.ts#1"},{"location":"src/context/service-context.ts#6"},{"location":"src/core/appkit.ts#1"},{"location":"src/plugins/analytics/analytics.ts#1"},{"location":"src/plugins/analytics/query.ts#2"},{"location":"src/plugins/files/plugin.ts#3"},{"location":"src/plugins/files/types.ts#1"},{"location":"src/plugins/jobs/plugin.ts#2"},{"location":"src/plugins/jobs/types.ts#1"},{"location":"src/stream/arrow-stream-processor.ts#1"},{"location":"src/type-generator/query-registry.ts#3"},{"location":"src/type-generator/serving/fetcher.ts#1"},{"location":"src/type-generator/serving/generator.ts#3"},{"location":"src/connectors/genie/client.ts#3"},{"location":"src/connectors/genie/client.ts#4"}]},"tags":["sql"]},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"api-logs","version":"0.208.0","description":"Public logs API for OpenTelemetry","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/api-logs@0.208.0","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/api-logs"}],"type":"library","bom-ref":"pkg:npm/@opentelemetry/api-logs@0.208.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/api-logs/package.json"},{"name":"ExportedModules","value":"@opentelemetry/api-logs"},{"name":"ImportedModules","value":"@opentelemetry/api-logs,SeverityNumber,@opentelemetry/api-logs/SeverityNumber,logs,@opentelemetry/api-logs/logs,NOOP_LOGGER,@opentelemetry/api-logs/NOOP_LOGGER,Logger,@opentelemetry/api-logs/Logger,LogRecord,@opentelemetry/api-logs/LogRecord"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/api-logs/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/api-logs/package.json"}],"occurrences":[{"location":"dist/logging/wide-event-emitter.js#1"},{"location":"dist/telemetry/index.js#6"},{"location":"dist/telemetry/noop.js#2"},{"location":"dist/telemetry/telemetry-provider.js#4"},{"location":"tmp/dist/logging/wide-event-emitter.js#1"},{"location":"tmp/dist/telemetry/index.js#6"},{"location":"tmp/dist/telemetry/noop.js#2"},{"location":"tmp/dist/telemetry/telemetry-provider.js#4"},{"location":"src/logging/wide-event-emitter.ts#1"},{"location":"src/telemetry/index.ts#7"},{"location":"src/telemetry/noop.ts#97"},{"location":"src/telemetry/telemetry-provider.ts#3"},{"location":"src/telemetry/types.ts#2"}]},"tags":["api"]},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"api","version":"1.9.0","description":"Public API for OpenTelemetry","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/api@1.9.0","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js/tree/main/api"}],"type":"library","bom-ref":"pkg:npm/@opentelemetry/api@1.9.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/api/package.json"},{"name":"ExportedModules","value":"@opentelemetry/api,@opentelemetry/api-logs,Counter,@opentelemetry/api/Counter,Histogram,@opentelemetry/api/Histogram,Span,@opentelemetry/api/Span,SpanKind,@opentelemetry/api/SpanKind,SpanStatusCode,@opentelemetry/api/SpanStatusCode"},{"name":"ImportedModules","value":"@opentelemetry/api,trace,@opentelemetry/api/trace,context,@opentelemetry/api/context,createContextKey,@opentelemetry/api/createContextKey,SpanKind,@opentelemetry/api/SpanKind,SpanStatusCode,@opentelemetry/api/SpanStatusCode,INVALID_SPAN_CONTEXT,@opentelemetry/api/INVALID_SPAN_CONTEXT,createNoopMeter,@opentelemetry/api/createNoopMeter,metrics,@opentelemetry/api/metrics,Context,@opentelemetry/api/Context,Span,@opentelemetry/api/Span,SpanContext,@opentelemetry/api/SpanContext,SpanOptions,@opentelemetry/api/SpanOptions,Tracer,@opentelemetry/api/Tracer,Meter,@opentelemetry/api/Meter,Attributes,@opentelemetry/api/Attributes,Link,@opentelemetry/api/Link"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/api/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/api/package.json"}],"occurrences":[{"location":"dist/logging/logger.js#6"},{"location":"dist/plugin/plugin.js#21"},{"location":"dist/stream/stream-manager.js#9"},{"location":"dist/telemetry/index.js#5"},{"location":"dist/telemetry/noop.js#1"},{"location":"dist/telemetry/telemetry-provider.js#3"},{"location":"tmp/dist/logging/logger.js#6"},{"location":"tmp/dist/plugin/plugin.js#21"},{"location":"tmp/dist/stream/stream-manager.js#9"},{"location":"tmp/dist/telemetry/index.js#5"},{"location":"tmp/dist/telemetry/noop.js#1"},{"location":"tmp/dist/telemetry/telemetry-provider.js#3"},{"location":"src/logging/logger.ts#3"},{"location":"src/plugin/plugin.ts#1"},{"location":"src/stream/stream-manager.ts#2"},{"location":"src/stream/types.ts#1"},{"location":"src/telemetry/index.ts#5"},{"location":"src/telemetry/index.ts#6"},{"location":"src/telemetry/noop.ts#17"},{"location":"src/telemetry/noop.ts#22"},{"location":"src/telemetry/telemetry-provider.ts#1"},{"location":"src/telemetry/telemetry-provider.ts#2"},{"location":"src/telemetry/trace-sampler.ts#1"},{"location":"src/telemetry/types.ts#1"}]},"tags":["api"]},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"auto-instrumentations-node","version":"0.67.2","description":"Metapackage which bundles opentelemetry node core and contrib instrumentations","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/auto-instrumentations-node@0.67.2","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/auto-instrumentations-node#readme"},{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js-contrib.git"}],"type":"library","bom-ref":"pkg:npm/@opentelemetry/auto-instrumentations-node@0.67.2","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/auto-instrumentations-node/package.json"},{"name":"ImportedModules","value":"@opentelemetry/auto-instrumentations-node,getNodeAutoInstrumentations,@opentelemetry/auto-instrumentations-node/getNodeAutoInstrumentations"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/auto-instrumentations-node/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/auto-instrumentations-node/package.json"}],"occurrences":[{"location":"dist/telemetry/telemetry-manager.js#4"},{"location":"tmp/dist/telemetry/telemetry-manager.js#4"},{"location":"src/telemetry/telemetry-manager.ts#1"}]}},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"exporter-logs-otlp-proto","version":"0.208.0","description":"An OTLP exporter to send logs using protobuf over HTTP","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/exporter-logs-otlp-proto@0.208.0","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/exporter-logs-otlp-proto"}],"type":"library","bom-ref":"pkg:npm/@opentelemetry/exporter-logs-otlp-proto@0.208.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/exporter-logs-otlp-proto/package.json"},{"name":"ImportedModules","value":"@opentelemetry/exporter-logs-otlp-proto,OTLPLogExporter,@opentelemetry/exporter-logs-otlp-proto/OTLPLogExporter"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/exporter-logs-otlp-proto/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/exporter-logs-otlp-proto/package.json"}],"occurrences":[{"location":"dist/telemetry/telemetry-manager.js#5"},{"location":"tmp/dist/telemetry/telemetry-manager.js#5"},{"location":"src/telemetry/telemetry-manager.ts#2"}]}},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"exporter-metrics-otlp-proto","version":"0.208.0","description":"OpenTelemetry Collector Metrics Exporter allows user to send collected metrics to the OpenTelemetry Collector using protobuf over HTTP","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/exporter-metrics-otlp-proto@0.208.0","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-exporter-metrics-otlp-proto"}],"type":"library","bom-ref":"pkg:npm/@opentelemetry/exporter-metrics-otlp-proto@0.208.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/exporter-metrics-otlp-proto/package.json"},{"name":"ImportedModules","value":"@opentelemetry/exporter-metrics-otlp-proto,OTLPMetricExporter,@opentelemetry/exporter-metrics-otlp-proto/OTLPMetricExporter"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/exporter-metrics-otlp-proto/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/exporter-metrics-otlp-proto/package.json"}],"occurrences":[{"location":"dist/telemetry/telemetry-manager.js#6"},{"location":"tmp/dist/telemetry/telemetry-manager.js#6"},{"location":"src/telemetry/telemetry-manager.ts#3"}]}},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"exporter-trace-otlp-proto","version":"0.208.0","description":"OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector using protobuf over HTTP","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/exporter-trace-otlp-proto@0.208.0","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/exporter-trace-otlp-proto"}],"type":"library","bom-ref":"pkg:npm/@opentelemetry/exporter-trace-otlp-proto@0.208.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/exporter-trace-otlp-proto/package.json"},{"name":"ImportedModules","value":"@opentelemetry/exporter-trace-otlp-proto,OTLPTraceExporter,@opentelemetry/exporter-trace-otlp-proto/OTLPTraceExporter"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/exporter-trace-otlp-proto/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/exporter-trace-otlp-proto/package.json"}],"occurrences":[{"location":"dist/telemetry/telemetry-manager.js#7"},{"location":"tmp/dist/telemetry/telemetry-manager.js#7"},{"location":"src/telemetry/telemetry-manager.ts#4"}]}},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"instrumentation-express","version":"0.57.0","description":"OpenTelemetry instrumentation for `express` http web application framework","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/instrumentation-express@0.57.0","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-express#readme"},{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js-contrib.git"}],"type":"framework","bom-ref":"pkg:npm/@opentelemetry/instrumentation-express@0.57.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/instrumentation-express/package.json"},{"name":"ImportedModules","value":"@opentelemetry/instrumentation-express,ExpressInstrumentation,@opentelemetry/instrumentation-express/ExpressInstrumentation"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/instrumentation-express/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/instrumentation-express/package.json"}],"occurrences":[{"location":"dist/telemetry/instrumentations.js#2"},{"location":"tmp/dist/telemetry/instrumentations.js#2"},{"location":"src/telemetry/instrumentations.ts#2"}]},"tags":["framework","web"]},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"instrumentation-http","version":"0.208.0","description":"OpenTelemetry instrumentation for `node:http` and `node:https` http client and server modules","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/instrumentation-http@0.208.0","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-http"}],"type":"library","bom-ref":"pkg:npm/@opentelemetry/instrumentation-http@0.208.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/instrumentation-http/package.json"},{"name":"ImportedModules","value":"@opentelemetry/instrumentation-http,HttpInstrumentation,@opentelemetry/instrumentation-http/HttpInstrumentation"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/instrumentation-http/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/instrumentation-http/package.json"}],"occurrences":[{"location":"dist/telemetry/instrumentations.js#3"},{"location":"tmp/dist/telemetry/instrumentations.js#3"},{"location":"src/telemetry/instrumentations.ts#3"}]}},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"instrumentation","version":"0.208.0","description":"Base class for node which OpenTelemetry instrumentation modules extend","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/instrumentation@0.208.0","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation"},{"type":"vcs","url":"git+https://github.com/open-telemetry/opentelemetry-js.git"}],"type":"library","bom-ref":"pkg:npm/@opentelemetry/instrumentation@0.208.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/instrumentation/package.json"},{"name":"ImportedModules","value":"@opentelemetry/instrumentation,registerInstrumentations,@opentelemetry/instrumentation/registerInstrumentations,Instrumentation,@opentelemetry/instrumentation/Instrumentation"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/instrumentation/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/instrumentation/package.json"}],"occurrences":[{"location":"dist/telemetry/telemetry-manager.js#8"},{"location":"tmp/dist/telemetry/telemetry-manager.js#8"},{"location":"src/telemetry/instrumentations.ts#1"},{"location":"src/telemetry/telemetry-manager.ts#8"},{"location":"src/telemetry/telemetry-provider.ts#4"},{"location":"src/telemetry/types.ts#3"}]}},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"resources","version":"2.2.0","description":"OpenTelemetry SDK resources","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/resources@2.2.0","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-resources"}],"type":"library","bom-ref":"pkg:npm/@opentelemetry/resources@2.2.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/resources/package.json"},{"name":"ImportedModules","value":"@opentelemetry/resources,detectResources,@opentelemetry/resources/detectResources,envDetector,@opentelemetry/resources/envDetector,hostDetector,@opentelemetry/resources/hostDetector,processDetector,@opentelemetry/resources/processDetector,resourceFromAttributes,@opentelemetry/resources/resourceFromAttributes,Resource,@opentelemetry/resources/Resource"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/resources/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/resources/package.json"}],"occurrences":[{"location":"dist/telemetry/telemetry-manager.js#9"},{"location":"tmp/dist/telemetry/telemetry-manager.js#9"},{"location":"src/telemetry/telemetry-manager.ts#16"}]}},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"sdk-logs","version":"0.208.0","description":"OpenTelemetry logs SDK","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/sdk-logs@0.208.0","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/sdk-logs"},{"type":"vcs","url":"git+https://github.com/open-telemetry/opentelemetry-js.git"}],"type":"library","bom-ref":"pkg:npm/@opentelemetry/sdk-logs@0.208.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/sdk-logs/package.json"},{"name":"ImportedModules","value":"@opentelemetry/sdk-logs,BatchLogRecordProcessor,@opentelemetry/sdk-logs/BatchLogRecordProcessor"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/sdk-logs/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/sdk-logs/package.json"}],"occurrences":[{"location":"dist/telemetry/telemetry-manager.js#10"},{"location":"tmp/dist/telemetry/telemetry-manager.js#10"},{"location":"src/telemetry/telemetry-manager.ts#17"}]}},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"sdk-metrics","version":"2.2.0","description":"OpenTelemetry metrics SDK","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/sdk-metrics@2.2.0","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/sdk-metrics"}],"type":"library","bom-ref":"pkg:npm/@opentelemetry/sdk-metrics@2.2.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/sdk-metrics/package.json"},{"name":"ImportedModules","value":"@opentelemetry/sdk-metrics,PeriodicExportingMetricReader,@opentelemetry/sdk-metrics/PeriodicExportingMetricReader"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/sdk-metrics/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/sdk-metrics/package.json"}],"occurrences":[{"location":"dist/telemetry/telemetry-manager.js#11"},{"location":"tmp/dist/telemetry/telemetry-manager.js#11"},{"location":"src/telemetry/telemetry-manager.ts#18"}]}},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"sdk-node","version":"0.208.0","description":"OpenTelemetry SDK for Node.js","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/sdk-node@0.208.0","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-sdk-node"}],"type":"library","bom-ref":"pkg:npm/@opentelemetry/sdk-node@0.208.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/sdk-node/package.json"},{"name":"ImportedModules","value":"@opentelemetry/sdk-node,NodeSDK,@opentelemetry/sdk-node/NodeSDK"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/sdk-node/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/sdk-node/package.json"}],"occurrences":[{"location":"dist/telemetry/telemetry-manager.js#12"},{"location":"tmp/dist/telemetry/telemetry-manager.js#12"},{"location":"src/telemetry/telemetry-manager.ts#19"}]}},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"sdk-trace-base","version":"2.6.0","description":"OpenTelemetry Tracing","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/sdk-trace-base@2.6.0","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-base"}],"type":"library","bom-ref":"pkg:npm/@opentelemetry/sdk-trace-base@2.6.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/sdk-trace-base/package.json"},{"name":"ImportedModules","value":"@opentelemetry/sdk-trace-base,SamplingDecision,@opentelemetry/sdk-trace-base/SamplingDecision,Sampler,@opentelemetry/sdk-trace-base/Sampler,SamplingResult,@opentelemetry/sdk-trace-base/SamplingResult"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/sdk-trace-base/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/sdk-trace-base/package.json"}],"occurrences":[{"location":"dist/telemetry/trace-sampler.js#2"},{"location":"tmp/dist/telemetry/trace-sampler.js#2"},{"location":"src/telemetry/trace-sampler.ts#2"},{"location":"src/telemetry/trace-sampler.ts#3"}]}},{"authors":[{"name":"OpenTelemetry Authors"}],"group":"@opentelemetry","name":"semantic-conventions","version":"1.38.0","description":"OpenTelemetry semantic conventions","scope":"required","licenses":[{"license":{"id":"Apache-2.0","url":"https://opensource.org/licenses/Apache-2.0"}}],"purl":"pkg:npm/%40opentelemetry/semantic-conventions@1.38.0","externalReferences":[{"type":"vcs","url":"https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions"}],"type":"library","bom-ref":"pkg:npm/@opentelemetry/semantic-conventions@1.38.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/@opentelemetry/semantic-conventions/package.json"},{"name":"ImportedModules","value":"@opentelemetry/semantic-conventions,ATTR_SERVICE_NAME,@opentelemetry/semantic-conventions/ATTR_SERVICE_NAME,ATTR_SERVICE_VERSION,@opentelemetry/semantic-conventions/ATTR_SERVICE_VERSION"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/@opentelemetry/semantic-conventions/package.json"}],"concludedValue":"packages/appkit/node_modules/@opentelemetry/semantic-conventions/package.json"}],"occurrences":[{"location":"dist/telemetry/telemetry-manager.js#13"},{"location":"tmp/dist/telemetry/telemetry-manager.js#13"},{"location":"src/telemetry/telemetry-manager.ts#23"}]}},{"group":"","name":"dotenv","version":"16.6.1","description":"Loads environment variables from .env file","scope":"required","licenses":[{"license":{"id":"BSD-2-Clause","url":"https://opensource.org/licenses/BSD-2-Clause"}}],"purl":"pkg:npm/dotenv@16.6.1","externalReferences":[{"type":"vcs","url":"https://github.com/motdotla/dotenv#readme"},{"type":"vcs","url":"git://github.com/motdotla/dotenv.git"}],"type":"library","bom-ref":"pkg:npm/dotenv@16.6.1","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/dotenv/package.json"},{"name":"ImportedModules","value":"dotenv,dotenv/config"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/dotenv/package.json"}],"concludedValue":"packages/appkit/node_modules/dotenv/package.json"}],"occurrences":[{"location":"dist/plugins/server/index.js#17"},{"location":"dist/type-generator/index.js#7"},{"location":"tmp/dist/cli/index.js#8"},{"location":"tmp/dist/plugins/server/index.js#17"},{"location":"tmp/dist/type-generator/index.js#7"},{"location":"src/plugins/server/index.ts#4"},{"location":"src/type-generator/index.ts#3"},{"location":"tmp/dist/cli/index.js#8"}]}},{"authors":[{"name":"TJ Holowaychuk <tj@vision-media.ca>"}],"group":"","name":"express","version":"4.22.0","description":"Fast, unopinionated, minimalist web framework","scope":"required","licenses":[{"license":{"id":"MIT","url":"https://opensource.org/licenses/MIT"}}],"purl":"pkg:npm/express@4.22.0","externalReferences":[{"type":"website","url":"http://expressjs.com/"}],"type":"framework","bom-ref":"pkg:npm/express@4.22.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/express/package.json"},{"name":"ImportedModules","value":"express,NextFunction,express/NextFunction,Request,express/Request,Response,express/Response"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/express/package.json"}],"concludedValue":"packages/appkit/node_modules/express/package.json"}],"occurrences":[{"location":"dist/plugins/server/index.js#18"},{"location":"dist/plugins/server/static-server.js#4"},{"location":"tmp/dist/plugins/server/index.js#18"},{"location":"tmp/dist/plugins/server/static-server.js#4"},{"location":"src/logging/logger.ts#4"},{"location":"src/plugin/plugin.ts#2"},{"location":"src/plugins/analytics/analytics.ts#2"},{"location":"src/plugins/files/plugin.ts#4"},{"location":"src/plugins/genie/genie.ts#2"},{"location":"src/plugins/jobs/plugin.ts#3"},{"location":"src/plugins/server/base-server.ts#1"},{"location":"src/plugins/server/index.ts#5"},{"location":"src/plugins/server/remote-tunnel/gate.ts#1"},{"location":"src/plugins/server/remote-tunnel/remote-tunnel-controller.ts#2"},{"location":"src/plugins/server/remote-tunnel/remote-tunnel-manager.ts#6"},{"location":"src/plugins/server/static-server.ts#3"},{"location":"src/plugins/server/static-server.ts#4"},{"location":"src/plugins/server/vite-dev-server.ts#3"},{"location":"src/plugins/serving/serving.ts#4"},{"location":"src/plugins/vector-search/vector-search.ts#1"}]},"tags":["framework","web"]},{"authors":[{"name":"Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)"}],"group":"","name":"get-port","version":"7.2.0","description":"Get an available port","scope":"required","licenses":[{"license":{"id":"MIT","url":"https://opensource.org/licenses/MIT"}}],"purl":"pkg:npm/get-port@7.2.0","type":"library","bom-ref":"pkg:npm/get-port@7.2.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/get-port/package.json"},{"name":"ImportedModules","value":"get-port,portNumbers,get-port/portNumbers"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/get-port/package.json"}],"concludedValue":"packages/appkit/node_modules/get-port/package.json"}],"occurrences":[{"location":"dist/plugins/server/index.js#19"},{"location":"tmp/dist/plugins/server/index.js#19"},{"location":"src/plugins/server/index.ts#6"}]}},{"authors":[{"name":"Kevin Deng <sxzz@sxzz.moe>"}],"group":"","name":"obug","version":"2.1.1","description":"A lightweight JavaScript debugging utility, forked from debug, featuring TypeScript and ESM support.","scope":"required","licenses":[{"license":{"id":"MIT","url":"https://opensource.org/licenses/MIT"}}],"purl":"pkg:npm/obug@2.1.1","externalReferences":[{"type":"vcs","url":"https://github.com/sxzz/obug#readme"},{"type":"vcs","url":"git+https://github.com/sxzz/obug.git"}],"type":"library","bom-ref":"pkg:npm/obug@2.1.1","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/obug/package.json"},{"name":"ImportedModules","value":"obug,createDebug,obug/createDebug"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/obug/package.json"}],"concludedValue":"packages/appkit/node_modules/obug/package.json"}],"occurrences":[{"location":"dist/logging/logger.js#7"},{"location":"tmp/dist/logging/logger.js#7"},{"location":"src/logging/logger.ts#5"}]}},{"authors":[{"name":"Brian Carlson <brian.m.carlson@gmail.com>"}],"group":"","name":"pg","version":"8.18.0","description":"PostgreSQL client - pure javascript & libpq with the same API","scope":"required","licenses":[{"license":{"id":"MIT","url":"https://opensource.org/licenses/MIT"}}],"purl":"pkg:npm/pg@8.18.0","externalReferences":[{"type":"vcs","url":"https://github.com/brianc/node-postgres"},{"type":"vcs","url":"git://github.com/brianc/node-postgres.git"}],"type":"library","bom-ref":"pkg:npm/pg@8.18.0","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/pg/package.json"},{"name":"ImportedModules","value":"pg,Pool,pg/Pool,QueryResult,pg/QueryResult,QueryResultRow,pg/QueryResultRow"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/pg/package.json"}],"concludedValue":"packages/appkit/node_modules/pg/package.json"}],"occurrences":[{"location":"dist/connectors/lakebase-v1/client.js#7"},{"location":"tmp/dist/connectors/lakebase-v1/client.js#7"},{"location":"src/cache/storage/persistent.ts#2"},{"location":"src/connectors/lakebase/index.ts#5"},{"location":"src/connectors/lakebase-v1/client.ts#4"},{"location":"src/plugins/lakebase/lakebase.ts#1"}]}},{"authors":[{"name":"Alexey Raspopov"}],"group":"","name":"picocolors","version":"1.1.1","description":"The tiniest and the fastest library for terminal output formatting with ANSI colors","scope":"required","licenses":[{"license":{"id":"ISC","url":"https://opensource.org/licenses/ISC"}}],"purl":"pkg:npm/picocolors@1.1.1","type":"library","bom-ref":"pkg:npm/picocolors@1.1.1","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/picocolors/package.json"},{"name":"ImportedModules","value":"picocolors"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/picocolors/package.json"}],"concludedValue":"packages/appkit/node_modules/picocolors/package.json"}],"occurrences":[{"location":"dist/errors/configuration.js#3"},{"location":"dist/plugins/server/client-config-sanitizer.js#2"},{"location":"dist/plugins/server/utils.js#2"},{"location":"dist/type-generator/migration.js#2"},{"location":"dist/type-generator/query-registry.js#6"},{"location":"dist/type-generator/serving/generator.js#8"},{"location":"tmp/dist/errors/configuration.js#3"},{"location":"tmp/dist/plugins/server/client-config-sanitizer.js#2"},{"location":"tmp/dist/plugins/server/utils.js#2"},{"location":"tmp/dist/type-generator/migration.js#2"},{"location":"tmp/dist/type-generator/query-registry.js#6"},{"location":"tmp/dist/type-generator/serving/generator.js#8"},{"location":"src/errors/configuration.ts#1"},{"location":"src/plugins/server/client-config-sanitizer.ts#1"},{"location":"src/plugins/server/utils.ts#5"},{"location":"src/type-generator/migration.ts#4"},{"location":"src/type-generator/query-registry.ts#4"},{"location":"src/type-generator/serving/generator.ts#4"}]}},{"authors":[{"name":"GitHub Inc."}],"group":"","name":"semver","version":"7.7.3","description":"The semantic version parser used by npm.","scope":"required","licenses":[{"license":{"id":"ISC","url":"https://opensource.org/licenses/ISC"}}],"purl":"pkg:npm/semver@7.7.3","externalReferences":[{"type":"vcs","url":"git+https://github.com/npm/node-semver.git"}],"type":"library","bom-ref":"pkg:npm/semver@7.7.3","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/semver/package.json"},{"name":"ImportedModules","value":"semver,coerce,semver/coerce"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/semver/package.json"}],"concludedValue":"packages/appkit/node_modules/semver/package.json"}],"occurrences":[{"location":"dist/context/service-context.js#8"},{"location":"tmp/dist/context/service-context.js#8"},{"location":"src/context/service-context.ts#7"}]}},{"group":"","name":"shared","version":"0.0.1","scope":"required","purl":"pkg:npm/shared@0.0.1","type":"library","bom-ref":"pkg:npm/shared@0.0.1","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/shared/package.json"},{"name":"ExportedModules","value":"shared,GenieAttachmentResponse,shared/GenieAttachmentResponse,GenieMessageResponse,shared/GenieMessageResponse,GenieStatementResponse,shared/GenieStatementResponse,GenieStreamEvent,shared/GenieStreamEvent,BasePluginConfig,shared/BasePluginConfig,CacheConfig,shared/CacheConfig,IAppRouter,shared/IAppRouter,PluginData,shared/PluginData,StreamExecutionSettings,shared/StreamExecutionSettings,isSQLTypeMarker,shared/isSQLTypeMarker,shared/sql"},{"name":"ImportedModules","value":"shared,AgentAdapter,shared/AgentAdapter,AgentEvent,shared/AgentEvent,AgentInput,shared/AgentInput,AgentRunContext,shared/AgentRunContext,AgentToolDefinition,shared/AgentToolDefinition,CacheConfig,shared/CacheConfig,CacheStorage,shared/CacheStorage,CacheEntry,shared/CacheEntry,TelemetryOptions,shared/TelemetryOptions,GenieMessageResponse,shared/GenieMessageResponse,BasePlugin,shared/BasePlugin,InputPluginMap,shared/InputPluginMap,OptionalConfigPluginDef,shared/OptionalConfigPluginDef,PluginConstructor,shared/PluginConstructor,PluginData,shared/PluginData,PluginMap,shared/PluginMap,TunnelConnection,shared/TunnelConnection,RetryConfig,shared/RetryConfig,TelemetryConfig,shared/TelemetryConfig,BasePluginConfig,shared/BasePluginConfig,IAppResponse,shared/IAppResponse,PluginEndpointMap,shared/PluginEndpointMap,PluginExecuteConfig,shared/PluginExecuteConfig,PluginExecutionSettings,shared/PluginExecutionSettings,PluginPhase,shared/PluginPhase,RouteConfig,shared/RouteConfig,StreamExecuteHandler,shared/StreamExecuteHandler,StreamExecutionSettings,shared/StreamExecutionSettings,ToPlugin,shared/ToPlugin,IAppRouter,shared/IAppRouter,SQLTypeMarker,shared/SQLTypeMarker,isSQLTypeMarker,shared/isSQLTypeMarker,shared/sql,IAppRequest,shared/IAppRequest,PluginClientConfigs,shared/PluginClientConfigs,PluginEndpoints,shared/PluginEndpoints,PluginManifest,shared/PluginManifest,ResourceRequirement,shared/ResourceRequirement,StreamConfig,shared/StreamConfig"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/shared/package.json"}],"concludedValue":"packages/appkit/node_modules/shared/package.json"}],"occurrences":[{"location":"src/agents/databricks.ts#7"},{"location":"src/cache/defaults.ts#1"},{"location":"src/cache/index.ts#3"},{"location":"src/cache/storage/memory.ts#1"},{"location":"src/cache/storage/persistent.ts#3"},{"location":"src/connectors/files/client.ts#2"},{"location":"src/connectors/genie/types.ts#3"},{"location":"src/connectors/genie/types.ts#10"},{"location":"src/connectors/jobs/types.ts#1"},{"location":"src/connectors/lakebase-v1/types.ts#2"},{"location":"src/connectors/sql-warehouse/client.ts#6"},{"location":"src/connectors/vector-search/types.ts#1"},{"location":"src/core/appkit.ts#10"},{"location":"src/index.ts#15"},{"location":"src/index.ts#16"},{"location":"src/plugin/dev-reader.ts#2"},{"location":"src/plugin/index.ts#1"},{"location":"src/plugin/interceptors/cache.ts#1"},{"location":"src/plugin/interceptors/retry.ts#1"},{"location":"src/plugin/interceptors/telemetry.ts#1"},{"location":"src/plugin/plugin.ts#14"},{"location":"src/plugin/to-plugin.ts#1"},{"location":"src/plugins/analytics/analytics.ts#8"},{"location":"src/plugins/analytics/defaults.ts#1"},{"location":"src/plugins/analytics/query.ts#3"},{"location":"src/plugins/analytics/types.ts#1"},{"location":"src/plugins/files/defaults.ts#1"},{"location":"src/plugins/files/plugin.ts#5"},{"location":"src/plugins/files/types.ts#2"},{"location":"src/plugins/genie/defaults.ts#1"},{"location":"src/plugins/genie/genie.ts#3"},{"location":"src/plugins/genie/types.ts#1"},{"location":"src/plugins/genie/types.ts#4"},{"location":"src/plugins/jobs/defaults.ts#1"},{"location":"src/plugins/jobs/plugin.ts#9"},{"location":"src/plugins/jobs/types.ts#2"},{"location":"src/plugins/lakebase/types.ts#1"},{"location":"src/plugins/server/index.ts#7"},{"location":"src/plugins/server/remote-tunnel/remote-tunnel-manager.ts#7"},{"location":"src/plugins/server/types.ts#1"},{"location":"src/plugins/server/utils.ts#6"},{"location":"src/plugins/serving/serving.ts#5"},{"location":"src/plugins/serving/types.ts#1"},{"location":"src/plugins/vector-search/defaults.ts#1"},{"location":"src/plugins/vector-search/types.ts#1"},{"location":"src/plugins/vector-search/vector-search.ts#2"},{"location":"src/registry/manifest-loader.ts#1"},{"location":"src/registry/resource-registry.ts#13"},{"location":"src/registry/types.ts#33"},{"location":"src/registry/types.ts#39"},{"location":"src/stream/sse-writer.ts#1"},{"location":"src/stream/stream-manager.ts#3"},{"location":"src/stream/types.ts#2"},{"location":"src/telemetry/telemetry-manager.ts#24"},{"location":"src/telemetry/telemetry-provider.ts#5"}]},"tags":["sql"]},{"authors":[{"name":"Einar Otto Stangvik <einaros@gmail.com> (http://2x.io)"}],"group":"","name":"ws","version":"8.18.3","description":"Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js","scope":"required","licenses":[{"license":{"id":"MIT","url":"https://opensource.org/licenses/MIT"}}],"purl":"pkg:npm/ws@8.18.3","externalReferences":[{"type":"vcs","url":"https://github.com/websockets/ws"},{"type":"vcs","url":"git+https://github.com/websockets/ws.git"}],"type":"library","bom-ref":"pkg:npm/ws@8.18.3","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/ws/package.json"},{"name":"ImportedModules","value":"ws,WebSocketServer,ws/WebSocketServer"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/ws/package.json"}],"concludedValue":"packages/appkit/node_modules/ws/package.json"}],"occurrences":[{"location":"dist/plugins/server/remote-tunnel/remote-tunnel-manager.js#8"},{"location":"tmp/dist/plugins/server/remote-tunnel/remote-tunnel-manager.js#8"},{"location":"src/plugins/server/remote-tunnel/remote-tunnel-manager.ts#8"}]}},{"authors":[{"name":"Colin McDonnell <zod@colinhacks.com>"}],"group":"","name":"zod","version":"4.3.6","description":"TypeScript-first schema declaration and validation library with static type inference","scope":"required","licenses":[{"license":{"id":"MIT","url":"https://opensource.org/licenses/MIT"}}],"purl":"pkg:npm/zod@4.3.6","externalReferences":[{"type":"website","url":"https://zod.dev"},{"type":"vcs","url":"git+https://github.com/colinhacks/zod.git"}],"type":"library","bom-ref":"pkg:npm/zod@4.3.6","properties":[{"name":"SrcFile","value":"packages/appkit/node_modules/zod/package.json"},{"name":"ImportedModules","value":"zod,toJSONSchema,zod/toJSONSchema,zod/z"}],"evidence":{"identity":[{"field":"purl","confidence":0.7,"methods":[{"technique":"manifest-analysis","confidence":0.7,"value":"packages/appkit/node_modules/zod/package.json"}],"concludedValue":"packages/appkit/node_modules/zod/package.json"}],"occurrences":[{"location":"dist/plugins/jobs/plugin.js#18"},{"location":"tmp/dist/plugins/jobs/plugin.js#18"},{"location":"src/plugins/jobs/plugin.ts#10"},{"location":"src/plugins/jobs/types.ts#3"}]},"tags":["validation"]}],"dependencies":[],"compositions":[{"bom-ref":"pkg:npm/@databricks/appkit@0.31.0","aggregate":"incomplete"}],"annotations":[{"bom-ref":"metadata-annotations","subjects":["pkg:npm/@databricks/appkit@0.31.0"],"annotator":{"component":{"group":"@cyclonedx","name":"cdxgen","version":"12.1.2","purl":"pkg:npm/%40cyclonedx/cdxgen@12.1.2","type":"application","bom-ref":"pkg:npm/@cyclonedx/cdxgen@12.1.2","publisher":"OWASP Foundation","authors":[{"name":"OWASP Foundation"}]}},"timestamp":"2026-05-06T11:07:17Z","text":"This Software Bill-of-Materials (SBOM) document was created on Wednesday, May 6, 2026 with cdxgen. The data was captured during the build lifecycle phase. The document describes an application named 'appkit' with version '0.31.0'. There are 28 components. The package type in this SBOM is npm with 3 purl namespaces described under components. The components were identified from 28 source files."}]}