@databricks/appkit 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/CLAUDE.md +2 -1
  2. package/NOTICE.md +1 -0
  3. package/dist/appkit/package.js +1 -1
  4. package/dist/cli/commands/plugin/add-resource/add-resource.js +61 -0
  5. package/dist/cli/commands/plugin/add-resource/add-resource.js.map +1 -0
  6. package/dist/cli/commands/plugin/create/create.js +162 -0
  7. package/dist/cli/commands/plugin/create/create.js.map +1 -0
  8. package/dist/cli/commands/plugin/create/prompt-resource.js +95 -0
  9. package/dist/cli/commands/plugin/create/prompt-resource.js.map +1 -0
  10. package/dist/cli/commands/plugin/create/resource-defaults.js +105 -0
  11. package/dist/cli/commands/plugin/create/resource-defaults.js.map +1 -0
  12. package/dist/cli/commands/plugin/create/scaffold.js +195 -0
  13. package/dist/cli/commands/plugin/create/scaffold.js.map +1 -0
  14. package/dist/cli/commands/plugin/index.js +22 -0
  15. package/dist/cli/commands/plugin/index.js.map +1 -0
  16. package/dist/cli/commands/plugin/list/list.js +113 -0
  17. package/dist/cli/commands/plugin/list/list.js.map +1 -0
  18. package/dist/cli/commands/plugin/schema-resources.js +82 -0
  19. package/dist/cli/commands/plugin/schema-resources.js.map +1 -0
  20. package/dist/cli/commands/{plugins-sync.js → plugin/sync/sync.js} +98 -79
  21. package/dist/cli/commands/plugin/sync/sync.js.map +1 -0
  22. package/dist/cli/commands/plugin/validate/validate-manifest.js +216 -0
  23. package/dist/cli/commands/plugin/validate/validate-manifest.js.map +1 -0
  24. package/dist/cli/commands/plugin/validate/validate.js +67 -0
  25. package/dist/cli/commands/plugin/validate/validate.js.map +1 -0
  26. package/dist/cli/index.js +2 -2
  27. package/dist/cli/index.js.map +1 -1
  28. package/dist/index.d.ts +4 -3
  29. package/dist/index.js +1 -1
  30. package/dist/index.js.map +1 -1
  31. package/dist/registry/index.js +2 -1
  32. package/dist/registry/manifest-loader.d.ts +2 -1
  33. package/dist/registry/manifest-loader.d.ts.map +1 -1
  34. package/dist/registry/manifest-loader.js +2 -1
  35. package/dist/registry/manifest-loader.js.map +1 -1
  36. package/dist/registry/resource-registry.js +2 -1
  37. package/dist/registry/resource-registry.js.map +1 -1
  38. package/dist/registry/types.d.ts +2 -70
  39. package/dist/registry/types.d.ts.map +1 -1
  40. package/dist/registry/types.generated.d.ts +45 -0
  41. package/dist/registry/types.generated.d.ts.map +1 -0
  42. package/dist/registry/types.generated.js +59 -0
  43. package/dist/registry/types.generated.js.map +1 -0
  44. package/dist/registry/types.js +5 -77
  45. package/dist/registry/types.js.map +1 -1
  46. package/dist/schemas/plugin-manifest.schema.json +439 -0
  47. package/dist/schemas/template-plugins.schema.json +103 -0
  48. package/docs/docs/api/appkit/Class.AppKitError/index.html +3 -3
  49. package/docs/docs/api/appkit/Class.AuthenticationError/index.html +3 -3
  50. package/docs/docs/api/appkit/Class.ConfigurationError/index.html +3 -3
  51. package/docs/docs/api/appkit/Class.ConnectionError/index.html +3 -3
  52. package/docs/docs/api/appkit/Class.ExecutionError/index.html +3 -3
  53. package/docs/docs/api/appkit/Class.InitializationError/index.html +3 -3
  54. package/docs/docs/api/appkit/Class.Plugin/index.html +3 -3
  55. package/docs/docs/api/appkit/Class.ResourceRegistry/index.html +3 -3
  56. package/docs/docs/api/appkit/Class.ServerError/index.html +3 -3
  57. package/docs/docs/api/appkit/Class.TunnelError/index.html +3 -3
  58. package/docs/docs/api/appkit/Class.ValidationError/index.html +3 -3
  59. package/docs/docs/api/appkit/Enumeration.RequestedClaimsPermissionSet/index.html +3 -3
  60. package/docs/docs/api/appkit/Enumeration.ResourceType/index.html +6 -19
  61. package/docs/docs/api/appkit/Enumeration.ResourceType.md +1 -25
  62. package/docs/docs/api/appkit/Function.appKitTypesPlugin/index.html +3 -3
  63. package/docs/docs/api/appkit/Function.createApp/index.html +3 -3
  64. package/docs/docs/api/appkit/Function.createLakebasePool/index.html +3 -3
  65. package/docs/docs/api/appkit/Function.generateDatabaseCredential/index.html +3 -3
  66. package/docs/docs/api/appkit/Function.getExecutionContext/index.html +3 -3
  67. package/docs/docs/api/appkit/Function.getLakebaseOrmConfig/index.html +3 -3
  68. package/docs/docs/api/appkit/Function.getLakebasePgConfig/index.html +3 -3
  69. package/docs/docs/api/appkit/Function.getPluginManifest/index.html +3 -3
  70. package/docs/docs/api/appkit/Function.getResourceRequirements/index.html +3 -3
  71. package/docs/docs/api/appkit/Function.getWorkspaceClient/index.html +3 -3
  72. package/docs/docs/api/appkit/Function.isSQLTypeMarker/index.html +3 -3
  73. package/docs/docs/api/appkit/Interface.BasePluginConfig/index.html +3 -3
  74. package/docs/docs/api/appkit/Interface.CacheConfig/index.html +3 -3
  75. package/docs/docs/api/appkit/Interface.DatabaseCredential/index.html +3 -3
  76. package/docs/docs/api/appkit/Interface.GenerateDatabaseCredentialRequest/index.html +3 -3
  77. package/docs/docs/api/appkit/Interface.ITelemetry/index.html +3 -3
  78. package/docs/docs/api/appkit/Interface.LakebasePoolConfig/index.html +3 -3
  79. package/docs/docs/api/appkit/Interface.PluginManifest/index.html +3 -3
  80. package/docs/docs/api/appkit/Interface.RequestedClaims/index.html +3 -3
  81. package/docs/docs/api/appkit/Interface.RequestedResource/index.html +3 -3
  82. package/docs/docs/api/appkit/Interface.ResourceEntry/index.html +3 -3
  83. package/docs/docs/api/appkit/Interface.ResourceFieldEntry/index.html +3 -3
  84. package/docs/docs/api/appkit/Interface.ResourceRequirement/index.html +3 -3
  85. package/docs/docs/api/appkit/Interface.StreamExecutionSettings/index.html +3 -3
  86. package/docs/docs/api/appkit/Interface.TelemetryConfig/index.html +3 -3
  87. package/docs/docs/api/appkit/Interface.ValidationResult/index.html +3 -3
  88. package/docs/docs/api/appkit/TypeAlias.ConfigSchema/index.html +3 -3
  89. package/docs/docs/api/appkit/TypeAlias.IAppRouter/index.html +3 -3
  90. package/docs/docs/api/appkit/TypeAlias.ResourcePermission/index.html +4 -4
  91. package/docs/docs/api/appkit/TypeAlias.ToPlugin/index.html +23 -0
  92. package/docs/docs/api/appkit/TypeAlias.ToPlugin.md +24 -0
  93. package/docs/docs/api/appkit/Variable.sql/index.html +4 -4
  94. package/docs/docs/api/appkit/index.html +5 -5
  95. package/docs/docs/api/appkit-ui/data/AreaChart/index.html +2 -2
  96. package/docs/docs/api/appkit-ui/data/BarChart/index.html +2 -2
  97. package/docs/docs/api/appkit-ui/data/DataTable/index.html +2 -2
  98. package/docs/docs/api/appkit-ui/data/DonutChart/index.html +2 -2
  99. package/docs/docs/api/appkit-ui/data/HeatmapChart/index.html +2 -2
  100. package/docs/docs/api/appkit-ui/data/LineChart/index.html +2 -2
  101. package/docs/docs/api/appkit-ui/data/PieChart/index.html +2 -2
  102. package/docs/docs/api/appkit-ui/data/RadarChart/index.html +2 -2
  103. package/docs/docs/api/appkit-ui/data/ScatterChart/index.html +2 -2
  104. package/docs/docs/api/appkit-ui/index.html +2 -2
  105. package/docs/docs/api/appkit-ui/styling/index.html +2 -2
  106. package/docs/docs/api/appkit-ui/ui/Accordion/index.html +2 -2
  107. package/docs/docs/api/appkit-ui/ui/Alert/index.html +2 -2
  108. package/docs/docs/api/appkit-ui/ui/AlertDialog/index.html +2 -2
  109. package/docs/docs/api/appkit-ui/ui/AspectRatio/index.html +2 -2
  110. package/docs/docs/api/appkit-ui/ui/Avatar/index.html +2 -2
  111. package/docs/docs/api/appkit-ui/ui/Badge/index.html +2 -2
  112. package/docs/docs/api/appkit-ui/ui/Breadcrumb/index.html +2 -2
  113. package/docs/docs/api/appkit-ui/ui/Button/index.html +2 -2
  114. package/docs/docs/api/appkit-ui/ui/ButtonGroup/index.html +2 -2
  115. package/docs/docs/api/appkit-ui/ui/Calendar/index.html +2 -2
  116. package/docs/docs/api/appkit-ui/ui/Card/index.html +2 -2
  117. package/docs/docs/api/appkit-ui/ui/Carousel/index.html +2 -2
  118. package/docs/docs/api/appkit-ui/ui/ChartContainer/index.html +2 -2
  119. package/docs/docs/api/appkit-ui/ui/Checkbox/index.html +2 -2
  120. package/docs/docs/api/appkit-ui/ui/Collapsible/index.html +2 -2
  121. package/docs/docs/api/appkit-ui/ui/Command/index.html +2 -2
  122. package/docs/docs/api/appkit-ui/ui/ContextMenu/index.html +2 -2
  123. package/docs/docs/api/appkit-ui/ui/Dialog/index.html +2 -2
  124. package/docs/docs/api/appkit-ui/ui/Drawer/index.html +2 -2
  125. package/docs/docs/api/appkit-ui/ui/DropdownMenu/index.html +2 -2
  126. package/docs/docs/api/appkit-ui/ui/Empty/index.html +2 -2
  127. package/docs/docs/api/appkit-ui/ui/Field/index.html +2 -2
  128. package/docs/docs/api/appkit-ui/ui/FormControl/index.html +2 -2
  129. package/docs/docs/api/appkit-ui/ui/HoverCard/index.html +2 -2
  130. package/docs/docs/api/appkit-ui/ui/Input/index.html +2 -2
  131. package/docs/docs/api/appkit-ui/ui/InputGroup/index.html +2 -2
  132. package/docs/docs/api/appkit-ui/ui/InputOTP/index.html +2 -2
  133. package/docs/docs/api/appkit-ui/ui/Item/index.html +2 -2
  134. package/docs/docs/api/appkit-ui/ui/Kbd/index.html +2 -2
  135. package/docs/docs/api/appkit-ui/ui/Label/index.html +2 -2
  136. package/docs/docs/api/appkit-ui/ui/Menubar/index.html +2 -2
  137. package/docs/docs/api/appkit-ui/ui/NavigationMenu/index.html +2 -2
  138. package/docs/docs/api/appkit-ui/ui/Pagination/index.html +2 -2
  139. package/docs/docs/api/appkit-ui/ui/Popover/index.html +2 -2
  140. package/docs/docs/api/appkit-ui/ui/Progress/index.html +2 -2
  141. package/docs/docs/api/appkit-ui/ui/RadioGroup/index.html +2 -2
  142. package/docs/docs/api/appkit-ui/ui/ResizableHandle/index.html +2 -2
  143. package/docs/docs/api/appkit-ui/ui/ScrollArea/index.html +2 -2
  144. package/docs/docs/api/appkit-ui/ui/Select/index.html +2 -2
  145. package/docs/docs/api/appkit-ui/ui/Separator/index.html +2 -2
  146. package/docs/docs/api/appkit-ui/ui/Sheet/index.html +2 -2
  147. package/docs/docs/api/appkit-ui/ui/Sidebar/index.html +2 -2
  148. package/docs/docs/api/appkit-ui/ui/Skeleton/index.html +2 -2
  149. package/docs/docs/api/appkit-ui/ui/Slider/index.html +2 -2
  150. package/docs/docs/api/appkit-ui/ui/Spinner/index.html +2 -2
  151. package/docs/docs/api/appkit-ui/ui/Switch/index.html +2 -2
  152. package/docs/docs/api/appkit-ui/ui/Table/index.html +2 -2
  153. package/docs/docs/api/appkit-ui/ui/Tabs/index.html +2 -2
  154. package/docs/docs/api/appkit-ui/ui/Textarea/index.html +2 -2
  155. package/docs/docs/api/appkit-ui/ui/Toaster/index.html +2 -2
  156. package/docs/docs/api/appkit-ui/ui/Toggle/index.html +2 -2
  157. package/docs/docs/api/appkit-ui/ui/ToggleGroup/index.html +2 -2
  158. package/docs/docs/api/appkit-ui/ui/Tooltip/index.html +2 -2
  159. package/docs/docs/api/appkit.md +5 -4
  160. package/docs/docs/api/index.html +2 -2
  161. package/docs/docs/app-management/index.html +2 -2
  162. package/docs/docs/architecture/index.html +2 -2
  163. package/docs/docs/category/development/index.html +2 -2
  164. package/docs/docs/configuration/index.html +2 -2
  165. package/docs/docs/core-principles/index.html +2 -2
  166. package/docs/docs/development/ai-assisted-development/index.html +2 -2
  167. package/docs/docs/development/index.html +2 -2
  168. package/docs/docs/development/llm-guide/index.html +2 -2
  169. package/docs/docs/development/local-development/index.html +2 -2
  170. package/docs/docs/development/project-setup/index.html +2 -2
  171. package/docs/docs/development/remote-bridge/index.html +2 -2
  172. package/docs/docs/development/type-generation/index.html +2 -2
  173. package/docs/docs/index.html +2 -2
  174. package/docs/docs/plugins/index.html +35 -4
  175. package/docs/docs/plugins.md +97 -1
  176. package/llms.txt +2 -1
  177. package/package.json +3 -2
  178. package/dist/cli/commands/plugins-sync.js.map +0 -1
  179. package/dist/cli/commands/plugins.js +0 -19
  180. package/dist/cli/commands/plugins.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../src/registry/types.ts"],"sourcesContent":["/**\n * Resource Registry Type System\n *\n * This module defines the type system for the AppKit Resource Registry,\n * which enables plugins to declare their Databricks resource requirements\n * in a machine-readable format.\n *\n * Resource types are exposed as first-class citizens with their specific\n * permissions, making it simple for users to declare dependencies.\n * Internal tooling handles conversion to Databricks app.yaml format.\n */\n\n/**\n * Supported resource types that plugins can depend on.\n * Each type has its own set of valid permissions.\n */\nexport enum ResourceType {\n /** Secret scope for secure credential storage */\n SECRET = \"secret\",\n\n /** Databricks Job for scheduled or triggered workflows */\n JOB = \"job\",\n\n /** Databricks SQL Warehouse for query execution */\n SQL_WAREHOUSE = \"sql_warehouse\",\n\n /** Model serving endpoint for ML inference */\n SERVING_ENDPOINT = \"serving_endpoint\",\n\n /** Unity Catalog Volume for file storage */\n VOLUME = \"volume\",\n\n /** Vector Search Index for similarity search */\n VECTOR_SEARCH_INDEX = \"vector_search_index\",\n\n /** Unity Catalog Function */\n UC_FUNCTION = \"uc_function\",\n\n /** Unity Catalog Connection for external data sources */\n UC_CONNECTION = \"uc_connection\",\n\n /** Database (Lakebase) for persistent storage */\n DATABASE = \"database\",\n\n /** Genie Space for AI assistant */\n GENIE_SPACE = \"genie_space\",\n\n /** MLflow Experiment for ML tracking */\n EXPERIMENT = \"experiment\",\n\n /** Databricks App dependency */\n APP = \"app\",\n}\n\n// ============================================================================\n// Permissions per resource type\n// ============================================================================\n\n/** Permissions for SECRET resources */\nexport type SecretPermission = \"MANAGE\" | \"READ\" | \"WRITE\";\n\n/** Permissions for JOB resources */\nexport type JobPermission = \"CAN_MANAGE\" | \"CAN_MANAGE_RUN\" | \"CAN_VIEW\";\n\n/** Permissions for SQL_WAREHOUSE resources */\nexport type SqlWarehousePermission = \"CAN_MANAGE\" | \"CAN_USE\";\n\n/** Permissions for SERVING_ENDPOINT resources */\nexport type ServingEndpointPermission = \"CAN_MANAGE\" | \"CAN_QUERY\" | \"CAN_VIEW\";\n\n/** Permissions for VOLUME resources */\nexport type VolumePermission = \"READ_VOLUME\" | \"WRITE_VOLUME\";\n\n/** Permissions for VECTOR_SEARCH_INDEX resources */\nexport type VectorSearchIndexPermission = \"SELECT\";\n\n/** Permissions for UC_FUNCTION resources */\nexport type UcFunctionPermission = \"EXECUTE\";\n\n/** Permissions for UC_CONNECTION resources */\nexport type UcConnectionPermission = \"USE_CONNECTION\";\n\n/** Permissions for DATABASE resources */\nexport type DatabasePermission = \"CAN_CONNECT_AND_CREATE\";\n\n/** Permissions for GENIE_SPACE resources */\nexport type GenieSpacePermission =\n | \"CAN_EDIT\"\n | \"CAN_VIEW\"\n | \"CAN_RUN\"\n | \"CAN_MANAGE\";\n\n/** Permissions for EXPERIMENT resources */\nexport type ExperimentPermission = \"CAN_READ\" | \"CAN_EDIT\" | \"CAN_MANAGE\";\n\n/** Permissions for APP resources */\nexport type AppPermission = \"CAN_USE\";\n\n/**\n * Union of all possible permission levels across all resource types.\n */\nexport type ResourcePermission =\n | SecretPermission\n | JobPermission\n | SqlWarehousePermission\n | ServingEndpointPermission\n | VolumePermission\n | VectorSearchIndexPermission\n | UcFunctionPermission\n | UcConnectionPermission\n | DatabasePermission\n | GenieSpacePermission\n | ExperimentPermission\n | AppPermission;\n\n/**\n * Permission hierarchy per resource type (weakest to strongest).\n * Used to compare permissions when merging; higher index = more permissive.\n * Unknown permissions are treated as less than any known permission.\n */\nexport const PERMISSION_HIERARCHY_BY_TYPE: Record<\n ResourceType,\n readonly ResourcePermission[]\n> = {\n [ResourceType.SECRET]: [\"READ\", \"WRITE\", \"MANAGE\"],\n [ResourceType.JOB]: [\"CAN_VIEW\", \"CAN_MANAGE_RUN\", \"CAN_MANAGE\"],\n [ResourceType.SQL_WAREHOUSE]: [\"CAN_USE\", \"CAN_MANAGE\"],\n [ResourceType.SERVING_ENDPOINT]: [\"CAN_VIEW\", \"CAN_QUERY\", \"CAN_MANAGE\"],\n [ResourceType.VOLUME]: [\"READ_VOLUME\", \"WRITE_VOLUME\"],\n [ResourceType.VECTOR_SEARCH_INDEX]: [\"SELECT\"],\n [ResourceType.UC_FUNCTION]: [\"EXECUTE\"],\n [ResourceType.UC_CONNECTION]: [\"USE_CONNECTION\"],\n [ResourceType.DATABASE]: [\"CAN_CONNECT_AND_CREATE\"],\n [ResourceType.GENIE_SPACE]: [\"CAN_VIEW\", \"CAN_RUN\", \"CAN_EDIT\", \"CAN_MANAGE\"],\n [ResourceType.EXPERIMENT]: [\"CAN_READ\", \"CAN_EDIT\", \"CAN_MANAGE\"],\n [ResourceType.APP]: [\"CAN_USE\"],\n} as const;\n\n/** Set of valid permissions per type (for validation). */\nexport const PERMISSIONS_BY_TYPE: Record<\n ResourceType,\n readonly ResourcePermission[]\n> = PERMISSION_HIERARCHY_BY_TYPE;\n\n/**\n * Defines a single field for a resource. Each field has its own environment variable and optional description.\n * Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key).\n */\nexport interface ResourceFieldEntry {\n /** Environment variable name for this field */\n env: string;\n /** Human-readable description for this field */\n description?: string;\n}\n\n/**\n * Declares a resource requirement for a plugin.\n * Can be defined statically in a manifest or dynamically via getResourceRequirements().\n */\nexport interface ResourceRequirement {\n /** Type of Databricks resource required */\n type: ResourceType;\n\n /** Unique alias for this resource within the plugin (e.g., 'warehouse', 'secrets'). Used for UI/display. */\n alias: string;\n\n /** Stable key for machine use (env naming, composite keys, app.yaml). Required. */\n resourceKey: string;\n\n /** Human-readable description of why this resource is needed */\n description: string;\n\n /** Required permission level for the resource */\n permission: ResourcePermission;\n\n /**\n * Map of field name to env and optional description.\n * Single-value types use one key (e.g. id); multi-value (database, secret) use multiple keys.\n */\n fields: Record<string, ResourceFieldEntry>;\n\n /** Whether this resource is required (true) or optional (false) */\n required: boolean;\n}\n\n/**\n * Internal representation of a resource in the registry.\n * Extends ResourceRequirement with resolution state and plugin ownership.\n */\nexport interface ResourceEntry extends ResourceRequirement {\n /** Plugin(s) that require this resource (comma-separated if multiple) */\n plugin: string;\n\n /** Whether the resource has been resolved (all field env vars set) */\n resolved: boolean;\n\n /** Resolved value per field name. Populated by validate() when all field env vars are set. */\n values?: Record<string, string>;\n\n /**\n * Per-plugin permission tracking.\n * Maps plugin name to the permission it originally requested.\n * Populated when multiple plugins share the same resource.\n */\n permissionSources?: Record<string, ResourcePermission>;\n}\n\n/**\n * Result of validating all registered resources against the environment.\n */\nexport interface ValidationResult {\n /** Whether all required resources are available */\n valid: boolean;\n\n /** List of missing required resources */\n missing: ResourceEntry[];\n\n /** Complete list of all registered resources (required and optional) */\n all: ResourceEntry[];\n}\n\nimport type { JSONSchema7 } from \"json-schema\";\n\n/**\n * Configuration schema definition for plugin config.\n * Re-exported from the standard JSON Schema Draft 7 types.\n *\n * @see {@link https://json-schema.org/draft-07/json-schema-release-notes | JSON Schema Draft 7}\n */\nexport type ConfigSchema = JSONSchema7;\n\n/**\n * Plugin manifest that declares metadata and resource requirements.\n * Attached to plugin classes as a static property.\n */\nexport interface PluginManifest {\n /** Plugin identifier (matches plugin.name) */\n name: string;\n\n /** Human-readable display name for UI/CLI */\n displayName: string;\n\n /** Brief description of what the plugin does */\n description: string;\n\n /**\n * Resource requirements declaration\n */\n resources: {\n /** Resources that must be available for the plugin to function */\n required: Omit<ResourceRequirement, \"required\">[];\n\n /** Resources that enhance functionality but are not mandatory */\n optional: Omit<ResourceRequirement, \"required\">[];\n };\n\n /**\n * Configuration schema for the plugin.\n * Defines the shape and validation rules for plugin config.\n */\n config?: {\n schema: ConfigSchema;\n };\n\n /**\n * Optional metadata for community plugins\n */\n author?: string;\n version?: string;\n repository?: string;\n keywords?: string[];\n license?: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,IAAY,sDAAL;;AAEL;;AAGA;;AAGA;;AAGA;;AAGA;;AAGA;;AAGA;;AAGA;;AAGA;;AAGA;;AAGA;;AAGA;;;;;;;;AAqEF,MAAa,+BAGT;EACD,aAAa,SAAS;EAAC;EAAQ;EAAS;EAAS;EACjD,aAAa,MAAM;EAAC;EAAY;EAAkB;EAAa;EAC/D,aAAa,gBAAgB,CAAC,WAAW,aAAa;EACtD,aAAa,mBAAmB;EAAC;EAAY;EAAa;EAAa;EACvE,aAAa,SAAS,CAAC,eAAe,eAAe;EACrD,aAAa,sBAAsB,CAAC,SAAS;EAC7C,aAAa,cAAc,CAAC,UAAU;EACtC,aAAa,gBAAgB,CAAC,iBAAiB;EAC/C,aAAa,WAAW,CAAC,yBAAyB;EAClD,aAAa,cAAc;EAAC;EAAY;EAAW;EAAY;EAAa;EAC5E,aAAa,aAAa;EAAC;EAAY;EAAY;EAAa;EAChE,aAAa,MAAM,CAAC,UAAU;CAChC;;AAGD,MAAa,sBAGT"}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../src/registry/types.ts"],"sourcesContent":["/**\n * Resource Registry Type System\n *\n * This module defines the type system for the AppKit Resource Registry,\n * which enables plugins to declare their Databricks resource requirements\n * in a machine-readable format.\n *\n * Resource types and permissions are generated from plugin-manifest.schema.json\n * (see types.generated.ts). Hand-written interfaces below define the registry API.\n */\n\n// Re-export generated registry types (enum + const must be value exports for runtime)\nimport {\n type AppPermission,\n type DatabasePermission,\n type ExperimentPermission,\n type GenieSpacePermission,\n type JobPermission,\n PERMISSION_HIERARCHY_BY_TYPE,\n PERMISSIONS_BY_TYPE,\n type ResourcePermission,\n ResourceType,\n type SecretPermission,\n type ServingEndpointPermission,\n type SqlWarehousePermission,\n type UcConnectionPermission,\n type UcFunctionPermission,\n type VectorSearchIndexPermission,\n type VolumePermission,\n} from \"./types.generated\";\n\nexport {\n PERMISSION_HIERARCHY_BY_TYPE,\n PERMISSIONS_BY_TYPE,\n ResourceType,\n type AppPermission,\n type DatabasePermission,\n type ExperimentPermission,\n type GenieSpacePermission,\n type JobPermission,\n type ResourcePermission,\n type SecretPermission,\n type ServingEndpointPermission,\n type SqlWarehousePermission,\n type UcConnectionPermission,\n type UcFunctionPermission,\n type VectorSearchIndexPermission,\n type VolumePermission,\n};\n\n// ============================================================================\n// Hand-written interfaces (not in JSON schema)\n// ============================================================================\n\n/**\n * Defines a single field for a resource. Each field has its own environment variable and optional description.\n * Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance_name, database_name or scope, key).\n */\nexport interface ResourceFieldEntry {\n /** Environment variable name for this field */\n env: string;\n /** Human-readable description for this field */\n description?: string;\n}\n\n/**\n * Declares a resource requirement for a plugin.\n * Can be defined statically in a manifest or dynamically via getResourceRequirements().\n */\nexport interface ResourceRequirement {\n /** Type of Databricks resource required */\n type: ResourceType;\n\n /** Unique alias for this resource within the plugin (e.g., 'warehouse', 'secrets'). Used for UI/display. */\n alias: string;\n\n /** Stable key for machine use (env naming, composite keys, app.yaml). Required. */\n resourceKey: string;\n\n /** Human-readable description of why this resource is needed */\n description: string;\n\n /** Required permission level for the resource */\n permission: ResourcePermission;\n\n /**\n * Map of field name to env and optional description.\n * Single-value types use one key (e.g. id); multi-value (database, secret) use multiple keys.\n */\n fields: Record<string, ResourceFieldEntry>;\n\n /** Whether this resource is required (true) or optional (false) */\n required: boolean;\n}\n\n/**\n * Internal representation of a resource in the registry.\n * Extends ResourceRequirement with resolution state and plugin ownership.\n */\nexport interface ResourceEntry extends ResourceRequirement {\n /** Plugin(s) that require this resource (comma-separated if multiple) */\n plugin: string;\n\n /** Whether the resource has been resolved (all field env vars set) */\n resolved: boolean;\n\n /** Resolved value per field name. Populated by validate() when all field env vars are set. */\n values?: Record<string, string>;\n\n /**\n * Per-plugin permission tracking.\n * Maps plugin name to the permission it originally requested.\n * Populated when multiple plugins share the same resource.\n */\n permissionSources?: Record<string, ResourcePermission>;\n}\n\n/**\n * Result of validating all registered resources against the environment.\n */\nexport interface ValidationResult {\n /** Whether all required resources are available */\n valid: boolean;\n\n /** List of missing required resources */\n missing: ResourceEntry[];\n\n /** Complete list of all registered resources (required and optional) */\n all: ResourceEntry[];\n}\n\nimport type { JSONSchema7 } from \"json-schema\";\n\n/**\n * Configuration schema definition for plugin config.\n * Re-exported from the standard JSON Schema Draft 7 types.\n *\n * @see {@link https://json-schema.org/draft-07/json-schema-release-notes | JSON Schema Draft 7}\n */\nexport type ConfigSchema = JSONSchema7;\n\n/**\n * Plugin manifest that declares metadata and resource requirements.\n * Attached to plugin classes as a static property.\n */\nexport interface PluginManifest {\n /** Plugin identifier (matches plugin.name) */\n name: string;\n\n /** Human-readable display name for UI/CLI */\n displayName: string;\n\n /** Brief description of what the plugin does */\n description: string;\n\n /**\n * Resource requirements declaration\n */\n resources: {\n /** Resources that must be available for the plugin to function */\n required: Omit<ResourceRequirement, \"required\">[];\n\n /** Resources that enhance functionality but are not mandatory */\n optional: Omit<ResourceRequirement, \"required\">[];\n };\n\n /**\n * Configuration schema for the plugin.\n * Defines the shape and validation rules for plugin config.\n */\n config?: {\n schema: ConfigSchema;\n };\n\n /**\n * Optional metadata for community plugins\n */\n author?: string;\n version?: string;\n repository?: string;\n keywords?: string[];\n license?: string;\n}\n"],"mappings":""}
@@ -0,0 +1,439 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://databricks.github.io/appkit/schemas/plugin-manifest.schema.json",
4
+ "title": "AppKit Plugin Manifest",
5
+ "description": "Schema for Databricks AppKit plugin manifest files. Defines plugin metadata, resource requirements, and configuration options.",
6
+ "type": "object",
7
+ "required": ["name", "displayName", "description", "resources"],
8
+ "properties": {
9
+ "$schema": {
10
+ "type": "string",
11
+ "description": "Reference to the JSON Schema for validation"
12
+ },
13
+ "name": {
14
+ "type": "string",
15
+ "pattern": "^[a-z][a-z0-9-]*$",
16
+ "description": "Plugin identifier. Must be lowercase, start with a letter, and contain only letters, numbers, and hyphens.",
17
+ "examples": ["analytics", "server", "my-custom-plugin"]
18
+ },
19
+ "displayName": {
20
+ "type": "string",
21
+ "minLength": 1,
22
+ "description": "Human-readable display name for UI and CLI",
23
+ "examples": ["Analytics Plugin", "Server Plugin"]
24
+ },
25
+ "description": {
26
+ "type": "string",
27
+ "minLength": 1,
28
+ "description": "Brief description of what the plugin does",
29
+ "examples": ["SQL query execution against Databricks SQL Warehouses"]
30
+ },
31
+ "resources": {
32
+ "type": "object",
33
+ "required": ["required", "optional"],
34
+ "description": "Databricks resource requirements for this plugin",
35
+ "properties": {
36
+ "required": {
37
+ "type": "array",
38
+ "description": "Resources that must be available for the plugin to function",
39
+ "items": {
40
+ "$ref": "#/$defs/resourceRequirement"
41
+ }
42
+ },
43
+ "optional": {
44
+ "type": "array",
45
+ "description": "Resources that enhance functionality but are not mandatory",
46
+ "items": {
47
+ "$ref": "#/$defs/resourceRequirement"
48
+ }
49
+ }
50
+ },
51
+ "additionalProperties": false
52
+ },
53
+ "config": {
54
+ "type": "object",
55
+ "description": "Configuration schema for the plugin",
56
+ "properties": {
57
+ "schema": {
58
+ "$ref": "#/$defs/configSchema"
59
+ }
60
+ },
61
+ "additionalProperties": false
62
+ },
63
+ "author": {
64
+ "type": "string",
65
+ "description": "Author name or organization"
66
+ },
67
+ "version": {
68
+ "type": "string",
69
+ "pattern": "^\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9.]+)?$",
70
+ "description": "Plugin version (semver format)",
71
+ "examples": ["1.0.0", "2.1.0-beta.1"]
72
+ },
73
+ "repository": {
74
+ "type": "string",
75
+ "format": "uri",
76
+ "description": "URL to the plugin's source repository"
77
+ },
78
+ "keywords": {
79
+ "type": "array",
80
+ "items": {
81
+ "type": "string"
82
+ },
83
+ "description": "Keywords for plugin discovery"
84
+ },
85
+ "license": {
86
+ "type": "string",
87
+ "description": "SPDX license identifier",
88
+ "examples": ["Apache-2.0", "MIT"]
89
+ }
90
+ },
91
+ "additionalProperties": false,
92
+ "$defs": {
93
+ "resourceType": {
94
+ "type": "string",
95
+ "enum": [
96
+ "secret",
97
+ "job",
98
+ "sql_warehouse",
99
+ "serving_endpoint",
100
+ "volume",
101
+ "vector_search_index",
102
+ "uc_function",
103
+ "uc_connection",
104
+ "database",
105
+ "genie_space",
106
+ "experiment",
107
+ "app"
108
+ ],
109
+ "description": "Type of Databricks resource"
110
+ },
111
+ "secretPermission": {
112
+ "type": "string",
113
+ "enum": ["READ", "WRITE", "MANAGE"],
114
+ "description": "Permission for secret resources (order: weakest to strongest)"
115
+ },
116
+ "jobPermission": {
117
+ "type": "string",
118
+ "enum": ["CAN_VIEW", "CAN_MANAGE_RUN", "CAN_MANAGE"],
119
+ "description": "Permission for job resources (order: weakest to strongest)"
120
+ },
121
+ "sqlWarehousePermission": {
122
+ "type": "string",
123
+ "enum": ["CAN_USE", "CAN_MANAGE"],
124
+ "description": "Permission for SQL warehouse resources (order: weakest to strongest)"
125
+ },
126
+ "servingEndpointPermission": {
127
+ "type": "string",
128
+ "enum": ["CAN_VIEW", "CAN_QUERY", "CAN_MANAGE"],
129
+ "description": "Permission for serving endpoint resources (order: weakest to strongest)"
130
+ },
131
+ "volumePermission": {
132
+ "type": "string",
133
+ "enum": ["READ_VOLUME", "WRITE_VOLUME"],
134
+ "description": "Permission for Unity Catalog volume resources"
135
+ },
136
+ "vectorSearchIndexPermission": {
137
+ "type": "string",
138
+ "enum": ["SELECT"],
139
+ "description": "Permission for vector search index resources"
140
+ },
141
+ "ucFunctionPermission": {
142
+ "type": "string",
143
+ "enum": ["EXECUTE"],
144
+ "description": "Permission for Unity Catalog function resources"
145
+ },
146
+ "ucConnectionPermission": {
147
+ "type": "string",
148
+ "enum": ["USE_CONNECTION"],
149
+ "description": "Permission for Unity Catalog connection resources"
150
+ },
151
+ "databasePermission": {
152
+ "type": "string",
153
+ "enum": ["CAN_CONNECT_AND_CREATE"],
154
+ "description": "Permission for database resources"
155
+ },
156
+ "genieSpacePermission": {
157
+ "type": "string",
158
+ "enum": ["CAN_VIEW", "CAN_RUN", "CAN_EDIT", "CAN_MANAGE"],
159
+ "description": "Permission for Genie Space resources (order: weakest to strongest)"
160
+ },
161
+ "experimentPermission": {
162
+ "type": "string",
163
+ "enum": ["CAN_READ", "CAN_EDIT", "CAN_MANAGE"],
164
+ "description": "Permission for MLflow experiment resources (order: weakest to strongest)"
165
+ },
166
+ "appPermission": {
167
+ "type": "string",
168
+ "enum": ["CAN_USE"],
169
+ "description": "Permission for Databricks App resources"
170
+ },
171
+ "resourceFieldEntry": {
172
+ "type": "object",
173
+ "required": ["env"],
174
+ "properties": {
175
+ "env": {
176
+ "type": "string",
177
+ "pattern": "^[A-Z][A-Z0-9_]*$",
178
+ "description": "Environment variable name for this field",
179
+ "examples": ["DATABRICKS_CACHE_INSTANCE", "SECRET_SCOPE"]
180
+ },
181
+ "description": {
182
+ "type": "string",
183
+ "description": "Human-readable description for this field"
184
+ }
185
+ },
186
+ "additionalProperties": false
187
+ },
188
+ "resourceRequirement": {
189
+ "type": "object",
190
+ "required": [
191
+ "type",
192
+ "alias",
193
+ "resourceKey",
194
+ "description",
195
+ "permission",
196
+ "fields"
197
+ ],
198
+ "properties": {
199
+ "type": {
200
+ "$ref": "#/$defs/resourceType"
201
+ },
202
+ "alias": {
203
+ "type": "string",
204
+ "minLength": 1,
205
+ "description": "Human-readable label for UI/display only. Deduplication uses resourceKey, not alias.",
206
+ "examples": ["SQL Warehouse", "Secret", "Vector search index"]
207
+ },
208
+ "resourceKey": {
209
+ "type": "string",
210
+ "pattern": "^[a-z][a-z0-9-]*$",
211
+ "description": "Stable key for machine use: deduplication, env naming, composite keys, app.yaml. Required for registry lookup.",
212
+ "examples": ["sql-warehouse", "database", "secret"]
213
+ },
214
+ "description": {
215
+ "type": "string",
216
+ "minLength": 1,
217
+ "description": "Human-readable description of why this resource is needed"
218
+ },
219
+ "permission": {
220
+ "type": "string",
221
+ "description": "Required permission level. Validated per resource type by the allOf/if-then rules below."
222
+ },
223
+ "fields": {
224
+ "type": "object",
225
+ "additionalProperties": {
226
+ "$ref": "#/$defs/resourceFieldEntry"
227
+ },
228
+ "minProperties": 1,
229
+ "description": "Map of field name to env and optional description. Single-value types use one key (e.g. id); multi-value (database, secret) use multiple (e.g. instance_name, database_name or scope, key)."
230
+ }
231
+ },
232
+ "additionalProperties": false,
233
+ "allOf": [
234
+ {
235
+ "if": {
236
+ "properties": { "type": { "const": "secret" } },
237
+ "required": ["type"]
238
+ },
239
+ "then": {
240
+ "properties": {
241
+ "permission": { "$ref": "#/$defs/secretPermission" }
242
+ }
243
+ }
244
+ },
245
+ {
246
+ "if": {
247
+ "properties": { "type": { "const": "job" } },
248
+ "required": ["type"]
249
+ },
250
+ "then": {
251
+ "properties": { "permission": { "$ref": "#/$defs/jobPermission" } }
252
+ }
253
+ },
254
+ {
255
+ "if": {
256
+ "properties": { "type": { "const": "sql_warehouse" } },
257
+ "required": ["type"]
258
+ },
259
+ "then": {
260
+ "properties": {
261
+ "permission": { "$ref": "#/$defs/sqlWarehousePermission" }
262
+ }
263
+ }
264
+ },
265
+ {
266
+ "if": {
267
+ "properties": { "type": { "const": "serving_endpoint" } },
268
+ "required": ["type"]
269
+ },
270
+ "then": {
271
+ "properties": {
272
+ "permission": { "$ref": "#/$defs/servingEndpointPermission" }
273
+ }
274
+ }
275
+ },
276
+ {
277
+ "if": {
278
+ "properties": { "type": { "const": "volume" } },
279
+ "required": ["type"]
280
+ },
281
+ "then": {
282
+ "properties": {
283
+ "permission": { "$ref": "#/$defs/volumePermission" }
284
+ }
285
+ }
286
+ },
287
+ {
288
+ "if": {
289
+ "properties": { "type": { "const": "vector_search_index" } },
290
+ "required": ["type"]
291
+ },
292
+ "then": {
293
+ "properties": {
294
+ "permission": { "$ref": "#/$defs/vectorSearchIndexPermission" }
295
+ }
296
+ }
297
+ },
298
+ {
299
+ "if": {
300
+ "properties": { "type": { "const": "uc_function" } },
301
+ "required": ["type"]
302
+ },
303
+ "then": {
304
+ "properties": {
305
+ "permission": { "$ref": "#/$defs/ucFunctionPermission" }
306
+ }
307
+ }
308
+ },
309
+ {
310
+ "if": {
311
+ "properties": { "type": { "const": "uc_connection" } },
312
+ "required": ["type"]
313
+ },
314
+ "then": {
315
+ "properties": {
316
+ "permission": { "$ref": "#/$defs/ucConnectionPermission" }
317
+ }
318
+ }
319
+ },
320
+ {
321
+ "if": {
322
+ "properties": { "type": { "const": "database" } },
323
+ "required": ["type"]
324
+ },
325
+ "then": {
326
+ "properties": {
327
+ "permission": { "$ref": "#/$defs/databasePermission" }
328
+ }
329
+ }
330
+ },
331
+ {
332
+ "if": {
333
+ "properties": { "type": { "const": "genie_space" } },
334
+ "required": ["type"]
335
+ },
336
+ "then": {
337
+ "properties": {
338
+ "permission": { "$ref": "#/$defs/genieSpacePermission" }
339
+ }
340
+ }
341
+ },
342
+ {
343
+ "if": {
344
+ "properties": { "type": { "const": "experiment" } },
345
+ "required": ["type"]
346
+ },
347
+ "then": {
348
+ "properties": {
349
+ "permission": { "$ref": "#/$defs/experimentPermission" }
350
+ }
351
+ }
352
+ },
353
+ {
354
+ "if": {
355
+ "properties": { "type": { "const": "app" } },
356
+ "required": ["type"]
357
+ },
358
+ "then": {
359
+ "properties": { "permission": { "$ref": "#/$defs/appPermission" } }
360
+ }
361
+ }
362
+ ]
363
+ },
364
+ "configSchemaProperty": {
365
+ "type": "object",
366
+ "required": ["type"],
367
+ "properties": {
368
+ "type": {
369
+ "type": "string",
370
+ "enum": ["object", "array", "string", "number", "boolean", "integer"]
371
+ },
372
+ "description": {
373
+ "type": "string"
374
+ },
375
+ "default": {},
376
+ "enum": {
377
+ "type": "array"
378
+ },
379
+ "properties": {
380
+ "type": "object",
381
+ "additionalProperties": {
382
+ "$ref": "#/$defs/configSchemaProperty"
383
+ }
384
+ },
385
+ "items": {
386
+ "$ref": "#/$defs/configSchemaProperty"
387
+ },
388
+ "minimum": {
389
+ "type": "number"
390
+ },
391
+ "maximum": {
392
+ "type": "number"
393
+ },
394
+ "minLength": {
395
+ "type": "integer",
396
+ "minimum": 0
397
+ },
398
+ "maxLength": {
399
+ "type": "integer",
400
+ "minimum": 0
401
+ },
402
+ "required": {
403
+ "type": "array",
404
+ "items": {
405
+ "type": "string"
406
+ }
407
+ }
408
+ }
409
+ },
410
+ "configSchema": {
411
+ "type": "object",
412
+ "required": ["type"],
413
+ "properties": {
414
+ "type": {
415
+ "type": "string",
416
+ "enum": ["object", "array", "string", "number", "boolean"]
417
+ },
418
+ "properties": {
419
+ "type": "object",
420
+ "additionalProperties": {
421
+ "$ref": "#/$defs/configSchemaProperty"
422
+ }
423
+ },
424
+ "items": {
425
+ "$ref": "#/$defs/configSchema"
426
+ },
427
+ "required": {
428
+ "type": "array",
429
+ "items": {
430
+ "type": "string"
431
+ }
432
+ },
433
+ "additionalProperties": {
434
+ "type": "boolean"
435
+ }
436
+ }
437
+ }
438
+ }
439
+ }
@@ -0,0 +1,103 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://databricks.github.io/appkit/schemas/template-plugins.schema.json",
4
+ "title": "AppKit Template Plugins Manifest",
5
+ "description": "Aggregated plugin manifest for AppKit templates. Read by Databricks CLI during init to discover available plugins and their resource requirements.",
6
+ "type": "object",
7
+ "required": ["version", "plugins"],
8
+ "properties": {
9
+ "$schema": {
10
+ "type": "string",
11
+ "description": "Reference to the JSON Schema for validation"
12
+ },
13
+ "version": {
14
+ "type": "string",
15
+ "const": "1.0",
16
+ "description": "Schema version for the template plugins manifest"
17
+ },
18
+ "plugins": {
19
+ "type": "object",
20
+ "description": "Map of plugin name to plugin manifest with package source",
21
+ "additionalProperties": {
22
+ "$ref": "#/$defs/templatePlugin"
23
+ }
24
+ }
25
+ },
26
+ "additionalProperties": false,
27
+ "$defs": {
28
+ "templatePlugin": {
29
+ "type": "object",
30
+ "required": [
31
+ "name",
32
+ "displayName",
33
+ "description",
34
+ "package",
35
+ "resources"
36
+ ],
37
+ "description": "Plugin manifest with package source information",
38
+ "properties": {
39
+ "name": {
40
+ "type": "string",
41
+ "pattern": "^[a-z][a-z0-9-]*$",
42
+ "description": "Plugin identifier. Must be lowercase, start with a letter, and contain only letters, numbers, and hyphens.",
43
+ "examples": ["analytics", "server", "my-custom-plugin"]
44
+ },
45
+ "displayName": {
46
+ "type": "string",
47
+ "minLength": 1,
48
+ "description": "Human-readable display name for UI and CLI",
49
+ "examples": ["Analytics Plugin", "Server Plugin"]
50
+ },
51
+ "description": {
52
+ "type": "string",
53
+ "minLength": 1,
54
+ "description": "Brief description of what the plugin does",
55
+ "examples": ["SQL query execution against Databricks SQL Warehouses"]
56
+ },
57
+ "package": {
58
+ "type": "string",
59
+ "minLength": 1,
60
+ "description": "NPM package name that provides this plugin",
61
+ "examples": ["@databricks/appkit", "@my-org/custom-plugin"]
62
+ },
63
+ "requiredByTemplate": {
64
+ "type": "boolean",
65
+ "default": false,
66
+ "description": "When true, this plugin is required by the template and cannot be deselected during CLI init. The user will only be prompted to configure its resources. When absent or false, the plugin is optional and the user can choose whether to include it."
67
+ },
68
+ "resources": {
69
+ "type": "object",
70
+ "required": ["required", "optional"],
71
+ "description": "Databricks resource requirements for this plugin",
72
+ "properties": {
73
+ "required": {
74
+ "type": "array",
75
+ "description": "Resources that must be available for the plugin to function",
76
+ "items": {
77
+ "$ref": "#/$defs/resourceRequirement"
78
+ }
79
+ },
80
+ "optional": {
81
+ "type": "array",
82
+ "description": "Resources that enhance functionality but are not mandatory",
83
+ "items": {
84
+ "$ref": "#/$defs/resourceRequirement"
85
+ }
86
+ }
87
+ },
88
+ "additionalProperties": false
89
+ }
90
+ },
91
+ "additionalProperties": false
92
+ },
93
+ "resourceType": {
94
+ "$ref": "plugin-manifest.schema.json#/$defs/resourceType"
95
+ },
96
+ "resourceFieldEntry": {
97
+ "$ref": "plugin-manifest.schema.json#/$defs/resourceFieldEntry"
98
+ },
99
+ "resourceRequirement": {
100
+ "$ref": "plugin-manifest.schema.json#/$defs/resourceRequirement"
101
+ }
102
+ }
103
+ }