@credibledata/cred-cli 0.0.100 → 0.0.103

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 (225) hide show
  1. package/README-DEV.md +2 -2
  2. package/README.md +1 -1
  3. package/coverage/coverage-summary.json +40 -0
  4. package/coverage/tmp/coverage-2152-1789496974457-0.json +1 -0
  5. package/coverage/tmp/coverage-2153-1789496954404-0.json +1 -0
  6. package/dist/client/api.js +6151 -2254
  7. package/dist/client/api.js.map +1 -1
  8. package/dist/client/base.js +1 -1
  9. package/dist/client/common.js +1 -1
  10. package/dist/client/configuration.js +1 -1
  11. package/dist/client/index.js +1 -1
  12. package/dist/clientconfiguration.js +114 -26
  13. package/dist/clientconfiguration.js.map +1 -1
  14. package/dist/clientconfiguration.spec.js +159 -37
  15. package/dist/clientconfiguration.spec.js.map +1 -1
  16. package/dist/commands/add.js +36 -5
  17. package/dist/commands/add.js.map +1 -1
  18. package/dist/commands/connection/createconnections.js +4 -4
  19. package/dist/commands/connection/createconnections.js.map +1 -1
  20. package/dist/commands/connection/createconnections.spec.js +11 -1
  21. package/dist/commands/connection/createconnections.spec.js.map +1 -1
  22. package/dist/commands/connection/deleteconnection.js +4 -4
  23. package/dist/commands/connection/deleteconnection.js.map +1 -1
  24. package/dist/commands/connection/deleteconnection.spec.js +1 -1
  25. package/dist/commands/connection/deleteconnection.spec.js.map +1 -1
  26. package/dist/commands/connection/listconnections.js +4 -4
  27. package/dist/commands/connection/listconnections.js.map +1 -1
  28. package/dist/commands/connection/listconnections.spec.js +1 -1
  29. package/dist/commands/connection/listconnections.spec.js.map +1 -1
  30. package/dist/commands/{project/createproject.js → environment/createenvironment.js} +17 -14
  31. package/dist/commands/environment/createenvironment.js.map +1 -0
  32. package/dist/commands/{project/createproject.spec.js → environment/createenvironment.spec.js} +46 -46
  33. package/dist/commands/environment/createenvironment.spec.js.map +1 -0
  34. package/dist/commands/{project/deleteproject.js → environment/deleteenvironment.js} +9 -9
  35. package/dist/commands/environment/deleteenvironment.js.map +1 -0
  36. package/dist/commands/{project/deleteproject.spec.js → environment/deleteenvironment.spec.js} +29 -29
  37. package/dist/commands/environment/deleteenvironment.spec.js.map +1 -0
  38. package/dist/commands/{project/getproject.js → environment/getenvironment.js} +8 -8
  39. package/dist/commands/environment/getenvironment.js.map +1 -0
  40. package/dist/commands/{project/getproject.spec.js → environment/getenvironment.spec.js} +32 -33
  41. package/dist/commands/environment/getenvironment.spec.js.map +1 -0
  42. package/dist/commands/{project/listprojects.js → environment/listenvironments.js} +10 -10
  43. package/dist/commands/environment/listenvironments.js.map +1 -0
  44. package/dist/commands/{project/listprojects.spec.js → environment/listenvironments.spec.js} +35 -35
  45. package/dist/commands/environment/listenvironments.spec.js.map +1 -0
  46. package/dist/commands/{project/setproject.js → environment/setenvironment.js} +6 -5
  47. package/dist/commands/environment/setenvironment.js.map +1 -0
  48. package/dist/commands/{project/setproject.spec.js → environment/setenvironment.spec.js} +9 -9
  49. package/dist/commands/environment/setenvironment.spec.js.map +1 -0
  50. package/dist/commands/environment/updateenvironment.js +130 -0
  51. package/dist/commands/environment/updateenvironment.js.map +1 -0
  52. package/dist/commands/environment/updateenvironment.spec.js +213 -0
  53. package/dist/commands/environment/updateenvironment.spec.js.map +1 -0
  54. package/dist/commands/get.js +66 -5
  55. package/dist/commands/get.js.map +1 -1
  56. package/dist/commands/legacy.js +9 -0
  57. package/dist/commands/legacy.js.map +1 -0
  58. package/dist/commands/list.js +95 -4
  59. package/dist/commands/list.js.map +1 -1
  60. package/dist/commands/materialization/cancelrun.js +62 -0
  61. package/dist/commands/materialization/cancelrun.js.map +1 -0
  62. package/dist/commands/materialization/getindex.js +52 -0
  63. package/dist/commands/materialization/getindex.js.map +1 -0
  64. package/dist/commands/materialization/getmaterialization.js +54 -0
  65. package/dist/commands/materialization/getmaterialization.js.map +1 -0
  66. package/dist/commands/materialization/getpreaggregate.js +55 -0
  67. package/dist/commands/materialization/getpreaggregate.js.map +1 -0
  68. package/dist/commands/materialization/getrun.js +54 -0
  69. package/dist/commands/materialization/getrun.js.map +1 -0
  70. package/dist/commands/materialization/listindexes.js +58 -0
  71. package/dist/commands/materialization/listindexes.js.map +1 -0
  72. package/dist/commands/materialization/listmaterializations.js +52 -0
  73. package/dist/commands/materialization/listmaterializations.js.map +1 -0
  74. package/dist/commands/materialization/listpreaggregates.js +61 -0
  75. package/dist/commands/materialization/listpreaggregates.js.map +1 -0
  76. package/dist/commands/materialization/listruns.js +60 -0
  77. package/dist/commands/materialization/listruns.js.map +1 -0
  78. package/dist/commands/materialization/rerun.js +111 -0
  79. package/dist/commands/materialization/rerun.js.map +1 -0
  80. package/dist/commands/misc/login.js +16 -2
  81. package/dist/commands/misc/login.js.map +1 -1
  82. package/dist/commands/misc/login.spec.js +133 -5
  83. package/dist/commands/misc/login.spec.js.map +1 -1
  84. package/dist/commands/package/deletepackage.js +4 -4
  85. package/dist/commands/package/deletepackage.js.map +1 -1
  86. package/dist/commands/package/deletepackage.spec.js +1 -1
  87. package/dist/commands/package/deletepackage.spec.js.map +1 -1
  88. package/dist/commands/package/listpackages.js +11 -4
  89. package/dist/commands/package/listpackages.js.map +1 -1
  90. package/dist/commands/package/listpackages.spec.js +13 -1
  91. package/dist/commands/package/listpackages.spec.js.map +1 -1
  92. package/dist/commands/package/publish.js +36 -13
  93. package/dist/commands/package/publish.js.map +1 -1
  94. package/dist/commands/package/publish.spec.js +27 -1
  95. package/dist/commands/package/publish.spec.js.map +1 -1
  96. package/dist/commands/package/updatepackage.js +4 -4
  97. package/dist/commands/package/updatepackage.js.map +1 -1
  98. package/dist/commands/package/updatepackage.spec.js +1 -1
  99. package/dist/commands/package/updatepackage.spec.js.map +1 -1
  100. package/dist/commands/permission/createpermission.js +123 -0
  101. package/dist/commands/permission/createpermission.js.map +1 -0
  102. package/dist/commands/permission/createpermission.spec.js +360 -0
  103. package/dist/commands/permission/createpermission.spec.js.map +1 -0
  104. package/dist/commands/permission/deletepermission.js +86 -0
  105. package/dist/commands/permission/deletepermission.js.map +1 -0
  106. package/dist/commands/permission/getpermission.js +85 -0
  107. package/dist/commands/permission/getpermission.js.map +1 -0
  108. package/dist/commands/permission/listpermissions.js +75 -0
  109. package/dist/commands/permission/listpermissions.js.map +1 -0
  110. package/dist/commands/permission/scope.js +140 -0
  111. package/dist/commands/permission/scope.js.map +1 -0
  112. package/dist/commands/rm.js +26 -4
  113. package/dist/commands/rm.js.map +1 -1
  114. package/dist/commands/set.js +12 -4
  115. package/dist/commands/set.js.map +1 -1
  116. package/dist/commands/update.js +29 -10
  117. package/dist/commands/update.js.map +1 -1
  118. package/dist/commands/version/archive-unarchive-version.js +4 -5
  119. package/dist/commands/version/archive-unarchive-version.js.map +1 -1
  120. package/dist/commands/version/archive-unarchive-version.spec.js +4 -4
  121. package/dist/commands/version/archive-unarchive-version.spec.js.map +1 -1
  122. package/dist/commands/version/listversions.js +4 -4
  123. package/dist/commands/version/listversions.js.map +1 -1
  124. package/dist/commands/version/listversions.spec.js +1 -1
  125. package/dist/commands/version/listversions.spec.js.map +1 -1
  126. package/dist/common/UserGroupId.js +1 -1
  127. package/dist/common/UserGroupId.js.map +1 -1
  128. package/dist/common/UserGroupId.spec.js +2 -4
  129. package/dist/common/UserGroupId.spec.js.map +1 -1
  130. package/dist/constants.js +95 -19
  131. package/dist/constants.js.map +1 -1
  132. package/dist/constants.spec.js +90 -0
  133. package/dist/constants.spec.js.map +1 -0
  134. package/dist/index.js +128 -15
  135. package/dist/index.js.map +1 -1
  136. package/dist/logger.js +5 -1
  137. package/dist/logger.js.map +1 -1
  138. package/openapitools.json +4 -1
  139. package/package.json +10 -9
  140. package/src/client/api.ts +9363 -3093
  141. package/src/client/base.ts +1 -1
  142. package/src/client/common.ts +1 -1
  143. package/src/client/configuration.ts +1 -1
  144. package/src/client/index.ts +1 -1
  145. package/src/clientconfiguration.spec.ts +238 -113
  146. package/src/clientconfiguration.ts +131 -30
  147. package/src/commands/add.ts +78 -12
  148. package/src/commands/connection/createconnections.spec.ts +11 -1
  149. package/src/commands/connection/createconnections.ts +4 -4
  150. package/src/commands/connection/deleteconnection.spec.ts +1 -1
  151. package/src/commands/connection/deleteconnection.ts +4 -4
  152. package/src/commands/connection/listconnections.spec.ts +1 -1
  153. package/src/commands/connection/listconnections.ts +4 -4
  154. package/src/commands/{project/createproject.spec.ts → environment/createenvironment.spec.ts} +56 -54
  155. package/src/commands/{project/createproject.ts → environment/createenvironment.ts} +17 -14
  156. package/src/commands/{project/deleteproject.spec.ts → environment/deleteenvironment.spec.ts} +59 -30
  157. package/src/commands/{project/deleteproject.ts → environment/deleteenvironment.ts} +10 -10
  158. package/src/commands/environment/getenvironment.spec.ts +110 -0
  159. package/src/commands/{project/getproject.ts → environment/getenvironment.ts} +9 -9
  160. package/src/commands/{project/listprojects.spec.ts → environment/listenvironments.spec.ts} +37 -35
  161. package/src/commands/{project/listprojects.ts → environment/listenvironments.ts} +13 -8
  162. package/src/commands/{project/setproject.spec.ts → environment/setenvironment.spec.ts} +8 -8
  163. package/src/commands/{project/setproject.ts → environment/setenvironment.ts} +4 -4
  164. package/src/commands/environment/updateenvironment.spec.ts +386 -0
  165. package/src/commands/environment/updateenvironment.ts +168 -0
  166. package/src/commands/get.ts +131 -9
  167. package/src/commands/legacy.ts +5 -0
  168. package/src/commands/list.ts +204 -9
  169. package/src/commands/materialization/cancelrun.ts +70 -0
  170. package/src/commands/materialization/getindex.ts +55 -0
  171. package/src/commands/materialization/getmaterialization.ts +57 -0
  172. package/src/commands/materialization/getpreaggregate.ts +58 -0
  173. package/src/commands/materialization/getrun.ts +55 -0
  174. package/src/commands/materialization/listindexes.ts +69 -0
  175. package/src/commands/materialization/listmaterializations.ts +53 -0
  176. package/src/commands/materialization/listpreaggregates.ts +74 -0
  177. package/src/commands/materialization/listruns.ts +77 -0
  178. package/src/commands/materialization/rerun.ts +123 -0
  179. package/src/commands/misc/login.spec.ts +165 -7
  180. package/src/commands/misc/login.ts +20 -2
  181. package/src/commands/package/deletepackage.spec.ts +1 -1
  182. package/src/commands/package/deletepackage.ts +4 -4
  183. package/src/commands/package/listpackages.spec.ts +17 -1
  184. package/src/commands/package/listpackages.ts +11 -4
  185. package/src/commands/package/publish.spec.ts +46 -1
  186. package/src/commands/package/publish.ts +38 -13
  187. package/src/commands/package/updatepackage.spec.ts +1 -1
  188. package/src/commands/package/updatepackage.ts +4 -4
  189. package/src/commands/permission/createpermission.spec.ts +507 -0
  190. package/src/commands/permission/createpermission.ts +181 -0
  191. package/src/commands/permission/deletepermission.ts +117 -0
  192. package/src/commands/permission/getpermission.ts +115 -0
  193. package/src/commands/permission/listpermissions.ts +101 -0
  194. package/src/commands/permission/scope.ts +180 -0
  195. package/src/commands/rm.ts +54 -9
  196. package/src/commands/set.ts +13 -4
  197. package/src/commands/update.ts +66 -23
  198. package/src/commands/version/archive-unarchive-version.spec.ts +4 -4
  199. package/src/commands/version/archive-unarchive-version.ts +4 -7
  200. package/src/commands/version/listversions.spec.ts +1 -1
  201. package/src/commands/version/listversions.ts +4 -4
  202. package/src/common/UserGroupId.spec.ts +2 -4
  203. package/src/common/UserGroupId.ts +1 -1
  204. package/src/constants.spec.ts +111 -0
  205. package/src/constants.ts +131 -19
  206. package/src/index.ts +187 -18
  207. package/src/logger.ts +5 -1
  208. package/bun.lock +0 -1158
  209. package/dist/commands/project/createproject.js.map +0 -1
  210. package/dist/commands/project/createproject.spec.js.map +0 -1
  211. package/dist/commands/project/deleteproject.js.map +0 -1
  212. package/dist/commands/project/deleteproject.spec.js.map +0 -1
  213. package/dist/commands/project/getproject.js.map +0 -1
  214. package/dist/commands/project/getproject.spec.js.map +0 -1
  215. package/dist/commands/project/listprojects.js.map +0 -1
  216. package/dist/commands/project/listprojects.spec.js.map +0 -1
  217. package/dist/commands/project/setproject.js.map +0 -1
  218. package/dist/commands/project/setproject.spec.js.map +0 -1
  219. package/dist/commands/project/updateproject.js +0 -68
  220. package/dist/commands/project/updateproject.js.map +0 -1
  221. package/dist/commands/project/updateproject.spec.js +0 -129
  222. package/dist/commands/project/updateproject.spec.js.map +0 -1
  223. package/src/commands/project/getproject.spec.ts +0 -109
  224. package/src/commands/project/updateproject.spec.ts +0 -217
  225. package/src/commands/project/updateproject.ts +0 -82
@@ -2,7 +2,7 @@
2
2
  /* eslint-disable */
3
3
  /**
4
4
  * Credible Admin API
5
- * The Credible Admin API is a comprehensive REST API that empowers organizations to manage their Malloy data modeling ecosystem with enterprise-grade security and governance. This API provides programmatic access to all administrative functions, enabling seamless integration with existing workflows and automation systems. ## Key Features - **Organization Management**: Create and manage organizations with fine-grained access controls - **Project & Package Lifecycle**: Full CRUD operations for projects, packages, and versions - **Connection Management**: Secure database connection configuration and management - **Permission Management**: Granular role-based access control (RBAC) at organization, project, package, workspace, and document levels - **Workspace Management**: Collaborative workspaces for data modeling and analysis - **User & Group Management**: Comprehensive user administration with group-based permissions ## Resource Hierarchy The API follows a hierarchical resource structure with fine-grained permission management at each level: ``` Organizations ├── Permissions ├── Projects │ ├── Permissions │ ├── Packages │ │ ├── Permissions │ │ └── Versions │ └── Connections ├── Workspaces │ ├── Permissions │ └── Documents │ └── Permissions └── Groups ├── Permissions └── Members System-Level Resources: ├── Users ├── System Permissions └── Demo Operations ``` ## Authentication & Authorization All API endpoints require proper authentication. The API implements fine-grained authorization using role-based permissions: - **Admin**: Full access to all resources within scope - **Modeler**: Can create and modify data models and packages - **Viewer**: Read-only access to resources - **Manager**: Workspace management capabilities - **Editor**: Document editing permissions ## Rate Limiting & Best Practices - API requests are rate-limited to ensure system stability - Implement proper error handling and retry logic - Cache responses when appropriate to reduce API calls ## Support & Documentation For additional support, examples, and integration guides, visit our developer documentation or contact our support team.
5
+ * The Credible Admin API is a comprehensive REST API that empowers organizations to manage their Malloy data modeling ecosystem with enterprise-grade security and governance. This API provides programmatic access to all administrative functions, enabling seamless integration with existing workflows and automation systems. ## Key Features - **Organization Management**: Create and manage organizations with fine-grained access controls - **Environment & Package Lifecycle**: Full CRUD operations for environments, packages, and versions - **Connection Management**: Secure database connection configuration and management - **Permission Management**: Granular role-based access control (RBAC) at organization, environment, package, workspace, and document levels - **Workspace Management**: Collaborative workspaces for data modeling and analysis - **User & Group Management**: Comprehensive user administration with group-based permissions ## Resource Hierarchy The API follows a hierarchical resource structure with fine-grained permission management at each level: ``` Organizations ├── Permissions ├── Environments │ ├── Permissions │ ├── Packages │ │ ├── Permissions │ │ └── Versions │ └── Connections ├── Workspaces │ ├── Permissions │ └── Documents │ └── Permissions └── Groups ├── Permissions └── Members System-Level Resources: ├── Users ├── System Permissions └── Demo Operations ``` ## Authentication & Authorization All API endpoints require proper authentication. The API implements fine-grained authorization using role-based permissions: - **Admin**: Full access to all resources within scope - **Modeler**: Can create and modify data models and packages - **Viewer**: Read-only access to resources - **Manager**: Workspace management capabilities - **Editor**: Document editing permissions ## Rate Limiting & Best Practices - API requests are rate-limited to ensure system stability - Implement proper error handling and retry logic - Cache responses when appropriate to reduce API calls ## Support & Documentation For additional support, examples, and integration guides, visit our developer documentation or contact our support team.
6
6
  *
7
7
  * The version of the OpenAPI document: v0
8
8
  * Contact: support@credibledata.com
@@ -2,7 +2,7 @@
2
2
  /* eslint-disable */
3
3
  /**
4
4
  * Credible Admin API
5
- * The Credible Admin API is a comprehensive REST API that empowers organizations to manage their Malloy data modeling ecosystem with enterprise-grade security and governance. This API provides programmatic access to all administrative functions, enabling seamless integration with existing workflows and automation systems. ## Key Features - **Organization Management**: Create and manage organizations with fine-grained access controls - **Project & Package Lifecycle**: Full CRUD operations for projects, packages, and versions - **Connection Management**: Secure database connection configuration and management - **Permission Management**: Granular role-based access control (RBAC) at organization, project, package, workspace, and document levels - **Workspace Management**: Collaborative workspaces for data modeling and analysis - **User & Group Management**: Comprehensive user administration with group-based permissions ## Resource Hierarchy The API follows a hierarchical resource structure with fine-grained permission management at each level: ``` Organizations ├── Permissions ├── Projects │ ├── Permissions │ ├── Packages │ │ ├── Permissions │ │ └── Versions │ └── Connections ├── Workspaces │ ├── Permissions │ └── Documents │ └── Permissions └── Groups ├── Permissions └── Members System-Level Resources: ├── Users ├── System Permissions └── Demo Operations ``` ## Authentication & Authorization All API endpoints require proper authentication. The API implements fine-grained authorization using role-based permissions: - **Admin**: Full access to all resources within scope - **Modeler**: Can create and modify data models and packages - **Viewer**: Read-only access to resources - **Manager**: Workspace management capabilities - **Editor**: Document editing permissions ## Rate Limiting & Best Practices - API requests are rate-limited to ensure system stability - Implement proper error handling and retry logic - Cache responses when appropriate to reduce API calls ## Support & Documentation For additional support, examples, and integration guides, visit our developer documentation or contact our support team.
5
+ * The Credible Admin API is a comprehensive REST API that empowers organizations to manage their Malloy data modeling ecosystem with enterprise-grade security and governance. This API provides programmatic access to all administrative functions, enabling seamless integration with existing workflows and automation systems. ## Key Features - **Organization Management**: Create and manage organizations with fine-grained access controls - **Environment & Package Lifecycle**: Full CRUD operations for environments, packages, and versions - **Connection Management**: Secure database connection configuration and management - **Permission Management**: Granular role-based access control (RBAC) at organization, environment, package, workspace, and document levels - **Workspace Management**: Collaborative workspaces for data modeling and analysis - **User & Group Management**: Comprehensive user administration with group-based permissions ## Resource Hierarchy The API follows a hierarchical resource structure with fine-grained permission management at each level: ``` Organizations ├── Permissions ├── Environments │ ├── Permissions │ ├── Packages │ │ ├── Permissions │ │ └── Versions │ └── Connections ├── Workspaces │ ├── Permissions │ └── Documents │ └── Permissions └── Groups ├── Permissions └── Members System-Level Resources: ├── Users ├── System Permissions └── Demo Operations ``` ## Authentication & Authorization All API endpoints require proper authentication. The API implements fine-grained authorization using role-based permissions: - **Admin**: Full access to all resources within scope - **Modeler**: Can create and modify data models and packages - **Viewer**: Read-only access to resources - **Manager**: Workspace management capabilities - **Editor**: Document editing permissions ## Rate Limiting & Best Practices - API requests are rate-limited to ensure system stability - Implement proper error handling and retry logic - Cache responses when appropriate to reduce API calls ## Support & Documentation For additional support, examples, and integration guides, visit our developer documentation or contact our support team.
6
6
  *
7
7
  * The version of the OpenAPI document: v0
8
8
  * Contact: support@credibledata.com
@@ -2,7 +2,7 @@
2
2
  /* eslint-disable */
3
3
  /**
4
4
  * Credible Admin API
5
- * The Credible Admin API is a comprehensive REST API that empowers organizations to manage their Malloy data modeling ecosystem with enterprise-grade security and governance. This API provides programmatic access to all administrative functions, enabling seamless integration with existing workflows and automation systems. ## Key Features - **Organization Management**: Create and manage organizations with fine-grained access controls - **Project & Package Lifecycle**: Full CRUD operations for projects, packages, and versions - **Connection Management**: Secure database connection configuration and management - **Permission Management**: Granular role-based access control (RBAC) at organization, project, package, workspace, and document levels - **Workspace Management**: Collaborative workspaces for data modeling and analysis - **User & Group Management**: Comprehensive user administration with group-based permissions ## Resource Hierarchy The API follows a hierarchical resource structure with fine-grained permission management at each level: ``` Organizations ├── Permissions ├── Projects │ ├── Permissions │ ├── Packages │ │ ├── Permissions │ │ └── Versions │ └── Connections ├── Workspaces │ ├── Permissions │ └── Documents │ └── Permissions └── Groups ├── Permissions └── Members System-Level Resources: ├── Users ├── System Permissions └── Demo Operations ``` ## Authentication & Authorization All API endpoints require proper authentication. The API implements fine-grained authorization using role-based permissions: - **Admin**: Full access to all resources within scope - **Modeler**: Can create and modify data models and packages - **Viewer**: Read-only access to resources - **Manager**: Workspace management capabilities - **Editor**: Document editing permissions ## Rate Limiting & Best Practices - API requests are rate-limited to ensure system stability - Implement proper error handling and retry logic - Cache responses when appropriate to reduce API calls ## Support & Documentation For additional support, examples, and integration guides, visit our developer documentation or contact our support team.
5
+ * The Credible Admin API is a comprehensive REST API that empowers organizations to manage their Malloy data modeling ecosystem with enterprise-grade security and governance. This API provides programmatic access to all administrative functions, enabling seamless integration with existing workflows and automation systems. ## Key Features - **Organization Management**: Create and manage organizations with fine-grained access controls - **Environment & Package Lifecycle**: Full CRUD operations for environments, packages, and versions - **Connection Management**: Secure database connection configuration and management - **Permission Management**: Granular role-based access control (RBAC) at organization, environment, package, workspace, and document levels - **Workspace Management**: Collaborative workspaces for data modeling and analysis - **User & Group Management**: Comprehensive user administration with group-based permissions ## Resource Hierarchy The API follows a hierarchical resource structure with fine-grained permission management at each level: ``` Organizations ├── Permissions ├── Environments │ ├── Permissions │ ├── Packages │ │ ├── Permissions │ │ └── Versions │ └── Connections ├── Workspaces │ ├── Permissions │ └── Documents │ └── Permissions └── Groups ├── Permissions └── Members System-Level Resources: ├── Users ├── System Permissions └── Demo Operations ``` ## Authentication & Authorization All API endpoints require proper authentication. The API implements fine-grained authorization using role-based permissions: - **Admin**: Full access to all resources within scope - **Modeler**: Can create and modify data models and packages - **Viewer**: Read-only access to resources - **Manager**: Workspace management capabilities - **Editor**: Document editing permissions ## Rate Limiting & Best Practices - API requests are rate-limited to ensure system stability - Implement proper error handling and retry logic - Cache responses when appropriate to reduce API calls ## Support & Documentation For additional support, examples, and integration guides, visit our developer documentation or contact our support team.
6
6
  *
7
7
  * The version of the OpenAPI document: v0
8
8
  * Contact: support@credibledata.com
@@ -2,7 +2,7 @@
2
2
  /* eslint-disable */
3
3
  /**
4
4
  * Credible Admin API
5
- * The Credible Admin API is a comprehensive REST API that empowers organizations to manage their Malloy data modeling ecosystem with enterprise-grade security and governance. This API provides programmatic access to all administrative functions, enabling seamless integration with existing workflows and automation systems. ## Key Features - **Organization Management**: Create and manage organizations with fine-grained access controls - **Project & Package Lifecycle**: Full CRUD operations for projects, packages, and versions - **Connection Management**: Secure database connection configuration and management - **Permission Management**: Granular role-based access control (RBAC) at organization, project, package, workspace, and document levels - **Workspace Management**: Collaborative workspaces for data modeling and analysis - **User & Group Management**: Comprehensive user administration with group-based permissions ## Resource Hierarchy The API follows a hierarchical resource structure with fine-grained permission management at each level: ``` Organizations ├── Permissions ├── Projects │ ├── Permissions │ ├── Packages │ │ ├── Permissions │ │ └── Versions │ └── Connections ├── Workspaces │ ├── Permissions │ └── Documents │ └── Permissions └── Groups ├── Permissions └── Members System-Level Resources: ├── Users ├── System Permissions └── Demo Operations ``` ## Authentication & Authorization All API endpoints require proper authentication. The API implements fine-grained authorization using role-based permissions: - **Admin**: Full access to all resources within scope - **Modeler**: Can create and modify data models and packages - **Viewer**: Read-only access to resources - **Manager**: Workspace management capabilities - **Editor**: Document editing permissions ## Rate Limiting & Best Practices - API requests are rate-limited to ensure system stability - Implement proper error handling and retry logic - Cache responses when appropriate to reduce API calls ## Support & Documentation For additional support, examples, and integration guides, visit our developer documentation or contact our support team.
5
+ * The Credible Admin API is a comprehensive REST API that empowers organizations to manage their Malloy data modeling ecosystem with enterprise-grade security and governance. This API provides programmatic access to all administrative functions, enabling seamless integration with existing workflows and automation systems. ## Key Features - **Organization Management**: Create and manage organizations with fine-grained access controls - **Environment & Package Lifecycle**: Full CRUD operations for environments, packages, and versions - **Connection Management**: Secure database connection configuration and management - **Permission Management**: Granular role-based access control (RBAC) at organization, environment, package, workspace, and document levels - **Workspace Management**: Collaborative workspaces for data modeling and analysis - **User & Group Management**: Comprehensive user administration with group-based permissions ## Resource Hierarchy The API follows a hierarchical resource structure with fine-grained permission management at each level: ``` Organizations ├── Permissions ├── Environments │ ├── Permissions │ ├── Packages │ │ ├── Permissions │ │ └── Versions │ └── Connections ├── Workspaces │ ├── Permissions │ └── Documents │ └── Permissions └── Groups ├── Permissions └── Members System-Level Resources: ├── Users ├── System Permissions └── Demo Operations ``` ## Authentication & Authorization All API endpoints require proper authentication. The API implements fine-grained authorization using role-based permissions: - **Admin**: Full access to all resources within scope - **Modeler**: Can create and modify data models and packages - **Viewer**: Read-only access to resources - **Manager**: Workspace management capabilities - **Editor**: Document editing permissions ## Rate Limiting & Best Practices - API requests are rate-limited to ensure system stability - Implement proper error handling and retry logic - Cache responses when appropriate to reduce API calls ## Support & Documentation For additional support, examples, and integration guides, visit our developer documentation or contact our support team.
6
6
  *
7
7
  * The version of the OpenAPI document: v0
8
8
  * Contact: support@credibledata.com
@@ -22,8 +22,21 @@ describe("ClientConfiguration", () => {
22
22
  let clientConfig: ClientConfiguration;
23
23
  let readFileSyncStub: sinon.SinonStub;
24
24
  let writeFileSyncStub: sinon.SinonStub;
25
+ let renameSyncStub: sinon.SinonStub;
25
26
  let customConfigPath: string;
26
27
 
28
+ // Simulate a real ENOENT from readFileSync (has `.code = "ENOENT"`).
29
+ // A bare `Error("File not found")` no longer triggers first-time-setup —
30
+ // loadConfig now rethrows non-ENOENT errors instead of silently masking them.
31
+ const enoent = () => Object.assign(new Error("ENOENT"), { code: "ENOENT" });
32
+
33
+ // Pull the most-recent persisted config payload off the stubs. Atomic writes
34
+ // go through writeFileSync(tmpPath, json) followed by renameSync(tmp, path).
35
+ const lastWrittenConfig = () => {
36
+ const args = writeFileSyncStub.lastCall.args;
37
+ return JSON.parse(args[1] as string);
38
+ };
39
+
27
40
  beforeEach(() => {
28
41
  customConfigPath = join(os.homedir(), ".cred_test");
29
42
  clientConfig = new ClientConfiguration(customConfigPath);
@@ -32,6 +45,7 @@ describe("ClientConfiguration", () => {
32
45
 
33
46
  readFileSyncStub = sinon.stub(fs, "readFileSync");
34
47
  writeFileSyncStub = sinon.stub(fs, "writeFileSync");
48
+ renameSyncStub = sinon.stub(fs, "renameSync");
35
49
  });
36
50
 
37
51
  afterEach(() => {
@@ -43,7 +57,7 @@ describe("ClientConfiguration", () => {
43
57
  });
44
58
 
45
59
  it("should load the default config if the file does not exist", () => {
46
- readFileSyncStub.throws(new Error("File not found"));
60
+ readFileSyncStub.throws(enoent());
47
61
  clientConfig.loadConfig();
48
62
  expect(clientConfig["config"]).to.deep.equal({
49
63
  configPerEnvironment: fullPerEnv(),
@@ -51,6 +65,21 @@ describe("ClientConfiguration", () => {
51
65
  });
52
66
  });
53
67
 
68
+ it("should throw loudly when the config file is unparseable", () => {
69
+ // Non-atomic writes from older binaries can leave `.cred` truncated.
70
+ // loadConfig must fail loud instead of silently overwriting — a silent
71
+ // reset erases the access token for every subsequent caller.
72
+ readFileSyncStub.returns("{ not json");
73
+ expect(() => clientConfig.loadConfig()).to.throw(/may be corrupt/);
74
+ expect(writeFileSyncStub.called).to.be.false;
75
+ });
76
+
77
+ it("should throw when readFileSync fails with a non-ENOENT error", () => {
78
+ const eacces = Object.assign(new Error("EACCES"), { code: "EACCES" });
79
+ readFileSyncStub.throws(eacces);
80
+ expect(() => clientConfig.loadConfig()).to.throw(/EACCES/);
81
+ });
82
+
54
83
  it("should load the config file correctly", () => {
55
84
  const mockConfig = {
56
85
  configPerEnvironment: {
@@ -92,134 +121,106 @@ describe("ClientConfiguration", () => {
92
121
  });
93
122
 
94
123
  it("should set and get the project correctly", () => {
95
- readFileSyncStub.throws(new Error("File not found"));
124
+ readFileSyncStub.throws(enoent());
96
125
  clientConfig.setProject("new-project");
97
126
 
98
- expect(
99
- writeFileSyncStub.calledWith(
100
- customConfigPath,
101
- JSON.stringify({
102
- configPerEnvironment: fullPerEnv({
103
- production: { project: "new-project" },
104
- }),
105
- activeEnvironment: "production",
106
- }),
107
- ),
108
- ).to.be.true;
127
+ expect(lastWrittenConfig()).to.deep.equal({
128
+ configPerEnvironment: fullPerEnv({
129
+ production: { project: "new-project" },
130
+ }),
131
+ activeEnvironment: "production",
132
+ });
133
+ expect(renameSyncStub.lastCall.args[1]).to.equal(customConfigPath);
109
134
  });
110
135
 
111
136
  it("should set and get the access token correctly", () => {
112
- readFileSyncStub.throws(new Error("File not found"));
137
+ readFileSyncStub.throws(enoent());
113
138
  clientConfig.setAccessToken(false, "token-123");
114
139
 
115
- expect(
116
- writeFileSyncStub.calledWith(
117
- customConfigPath,
118
- JSON.stringify({
119
- configPerEnvironment: fullPerEnv({
120
- production: {
121
- isServiceAccountToken: true,
122
- accessToken: "token-123",
123
- },
124
- }),
125
- activeEnvironment: "production",
126
- }),
127
- ),
128
- ).to.be.true;
140
+ expect(lastWrittenConfig()).to.deep.equal({
141
+ configPerEnvironment: fullPerEnv({
142
+ production: {
143
+ isServiceAccountToken: true,
144
+ accessToken: "token-123",
145
+ },
146
+ }),
147
+ activeEnvironment: "production",
148
+ });
129
149
  });
130
150
 
131
- it("should clear auth when setting access token", () => {
151
+ it("should preserve other per-env fields when setting access token", () => {
152
+ // Valid initial config (with an activeEnvironment so loadConfig accepts it).
132
153
  readFileSyncStub.returns(
133
- JSON.stringify({ auth: { username: "user", password: "pass" } }),
154
+ JSON.stringify({
155
+ configPerEnvironment: {
156
+ production: {
157
+ auth: { username: "user", password: "pass" },
158
+ },
159
+ },
160
+ activeEnvironment: "production",
161
+ }),
134
162
  );
135
163
  clientConfig.setAccessToken(true, "new-token");
136
- expect(
137
- writeFileSyncStub.calledWith(
138
- customConfigPath,
139
- JSON.stringify({
140
- configPerEnvironment: fullPerEnv({
141
- production: {
142
- isServiceAccountToken: false,
143
- accessToken: "new-token",
144
- },
145
- }),
146
- activeEnvironment: "production",
147
- }),
148
- ),
149
- ).to.be.true;
164
+ expect(lastWrittenConfig().configPerEnvironment.production).to.deep.equal(
165
+ {
166
+ auth: { username: "user", password: "pass" },
167
+ isServiceAccountToken: false,
168
+ accessToken: "new-token",
169
+ },
170
+ );
150
171
  });
151
172
 
152
173
  it("should set and get organization", () => {
153
- readFileSyncStub.throws(new Error("File not found"));
174
+ readFileSyncStub.throws(enoent());
154
175
  clientConfig.setOrganization("my-org");
155
176
 
156
- expect(
157
- writeFileSyncStub.calledWith(
158
- customConfigPath,
159
- JSON.stringify({
160
- configPerEnvironment: fullPerEnv({
161
- production: { organization: "my-org" },
162
- }),
163
- activeEnvironment: "production",
164
- }),
165
- ),
166
- ).to.be.true;
177
+ expect(lastWrittenConfig()).to.deep.equal({
178
+ configPerEnvironment: fullPerEnv({
179
+ production: { organization: "my-org" },
180
+ }),
181
+ activeEnvironment: "production",
182
+ });
167
183
  });
168
184
 
169
185
  it("should set and get refresh token", () => {
170
- readFileSyncStub.throws(new Error("File not found"));
186
+ readFileSyncStub.throws(enoent());
171
187
  clientConfig.setRefreshToken("refresh-token-123");
172
188
 
173
- expect(
174
- writeFileSyncStub.calledWith(
175
- customConfigPath,
176
- JSON.stringify({
177
- configPerEnvironment: fullPerEnv({
178
- production: { refreshToken: "refresh-token-123" },
179
- }),
180
- activeEnvironment: "production",
181
- }),
182
- ),
183
- ).to.be.true;
189
+ expect(lastWrittenConfig()).to.deep.equal({
190
+ configPerEnvironment: fullPerEnv({
191
+ production: { refreshToken: "refresh-token-123" },
192
+ }),
193
+ activeEnvironment: "production",
194
+ });
184
195
  });
185
196
 
186
197
  it("should set and get VSCode user", () => {
187
- readFileSyncStub.throws(new Error("File not found"));
198
+ readFileSyncStub.throws(enoent());
188
199
  clientConfig.setVSCodeUser("testuser", "test@example.com");
189
200
 
190
- expect(
191
- writeFileSyncStub.calledWith(
192
- customConfigPath,
193
- JSON.stringify({
194
- configPerEnvironment: fullPerEnv({
195
- production: {
196
- vsCodeUser: {
197
- username: "testuser",
198
- email: "test@example.com",
199
- },
200
- },
201
- }),
202
- activeEnvironment: "production",
203
- }),
204
- ),
205
- ).to.be.true;
201
+ expect(lastWrittenConfig()).to.deep.equal({
202
+ configPerEnvironment: fullPerEnv({
203
+ production: {
204
+ vsCodeUser: {
205
+ username: "testuser",
206
+ email: "test@example.com",
207
+ },
208
+ },
209
+ }),
210
+ activeEnvironment: "production",
211
+ });
206
212
  });
207
213
 
208
214
  it("should set and get JWT access token", () => {
209
- readFileSyncStub.throws(new Error("File not found"));
215
+ readFileSyncStub.throws(enoent());
210
216
  clientConfig.setJwtAccessToken("jwt-token-abc");
211
217
 
212
- expect(
213
- writeFileSyncStub.calledWith(
214
- customConfigPath,
215
- JSON.stringify({
216
- configPerEnvironment: fullPerEnv({
217
- production: { jwtAccessToken: "jwt-token-abc" },
218
- }),
219
- activeEnvironment: "production",
220
- }),
221
- ),
222
- ).to.be.true;
218
+ expect(lastWrittenConfig()).to.deep.equal({
219
+ configPerEnvironment: fullPerEnv({
220
+ production: { jwtAccessToken: "jwt-token-abc" },
221
+ }),
222
+ activeEnvironment: "production",
223
+ });
223
224
  });
224
225
 
225
226
  it("should return true for doesConfigExists when environment config exists", () => {
@@ -248,26 +249,20 @@ describe("ClientConfiguration", () => {
248
249
  readFileSyncStub.returns(JSON.stringify(mockConfig));
249
250
  clientConfig.destroyConfig();
250
251
 
251
- const lastWrite = writeFileSyncStub.lastCall.args[1] as string;
252
- expect(JSON.parse(lastWrite)).to.deep.equal({
252
+ expect(lastWrittenConfig()).to.deep.equal({
253
253
  configPerEnvironment: fullPerEnv(),
254
254
  activeEnvironment: "production",
255
255
  });
256
256
  });
257
257
 
258
258
  it("should set and get environment", () => {
259
- readFileSyncStub.throws(new Error("File not found"));
259
+ readFileSyncStub.throws(enoent());
260
260
  clientConfig.setEnvironment("staging");
261
261
 
262
- expect(
263
- writeFileSyncStub.calledWith(
264
- customConfigPath,
265
- JSON.stringify({
266
- configPerEnvironment: fullPerEnv(),
267
- activeEnvironment: "staging",
268
- }),
269
- ),
270
- ).to.be.true;
262
+ expect(lastWrittenConfig()).to.deep.equal({
263
+ configPerEnvironment: fullPerEnv(),
264
+ activeEnvironment: "staging",
265
+ });
271
266
  });
272
267
 
273
268
  it("should return headers with Bearer token for user tokens", () => {
@@ -308,11 +303,82 @@ describe("ClientConfiguration", () => {
308
303
  expect(headers.Authorization).to.equal("ApiKey service-token");
309
304
  });
310
305
 
311
- it("should reset to defaults when config file is corrupted (missing activeEnvironment)", () => {
306
+ it("should throw when config file is missing activeEnvironment", () => {
307
+ // Previously loadConfig silently reset to defaults — that turned one
308
+ // corrupt read into permanent state loss for every caller. Now we fail loud.
312
309
  readFileSyncStub.returns(JSON.stringify({ configPerEnvironment: {} }));
313
- clientConfig.loadConfig();
310
+ expect(() => clientConfig.loadConfig()).to.throw(
311
+ /Invalid config structure/,
312
+ );
313
+ expect(writeFileSyncStub.called).to.be.false;
314
+ });
315
+
316
+ describe("recoverIfCorrupt", () => {
317
+ it("returns null and writes nothing when the config is already valid", () => {
318
+ readFileSyncStub.returns(
319
+ JSON.stringify({
320
+ configPerEnvironment: {},
321
+ activeEnvironment: "staging",
322
+ }),
323
+ );
324
+
325
+ expect(clientConfig.recoverIfCorrupt()).to.be.null;
326
+ expect(renameSyncStub.called).to.be.false;
327
+ // Valid config preserved — active environment untouched.
328
+ expect(clientConfig.getEnvironment()).to.equal("staging");
329
+ });
330
+
331
+ it("backs up an unparseable file and resets to defaults", () => {
332
+ readFileSyncStub.returns("{ not json");
333
+
334
+ const backupPath = clientConfig.recoverIfCorrupt();
335
+
336
+ expect(backupPath).to.match(
337
+ new RegExp(`${customConfigPath}\\.corrupt-[0-9a-f]{16}$`),
338
+ );
339
+ // Renamed aside, never deleted, so the bad file is recoverable.
340
+ expect(renameSyncStub.calledWith(customConfigPath, backupPath!)).to.be
341
+ .true;
342
+ expect(lastWrittenConfig()).to.deep.equal({
343
+ configPerEnvironment: fullPerEnv(),
344
+ activeEnvironment: "production",
345
+ });
346
+ });
347
+
348
+ it("backs up a structurally-invalid file and resets to defaults", () => {
349
+ readFileSyncStub.returns(JSON.stringify({ configPerEnvironment: {} }));
350
+
351
+ const backupPath = clientConfig.recoverIfCorrupt();
352
+
353
+ expect(backupPath).to.be.a("string");
354
+ expect(renameSyncStub.calledWith(customConfigPath, backupPath!)).to.be
355
+ .true;
356
+ expect(lastWrittenConfig().activeEnvironment).to.equal("production");
357
+ });
358
+
359
+ it("rethrows fs errors (e.g. EACCES) instead of masking them as a reset", () => {
360
+ // A permissions problem must surface — resetting would just fail to
361
+ // write anyway, and silently "recovering" would hide the real cause.
362
+ const eacces = Object.assign(new Error("EACCES"), { code: "EACCES" });
363
+ readFileSyncStub.throws(eacces);
364
+
365
+ expect(() => clientConfig.recoverIfCorrupt()).to.throw(/EACCES/);
366
+ expect(renameSyncStub.called).to.be.false;
367
+ });
368
+
369
+ it("creates a fresh default when the file is absent (ENOENT)", () => {
370
+ readFileSyncStub.throws(enoent());
314
371
 
315
- expect(clientConfig["config"].activeEnvironment).to.equal("production");
372
+ // First-time setup is not corruption — nothing to back up. (The atomic
373
+ // write of the new default does call renameSync, but never to a
374
+ // `.corrupt-` backup path.)
375
+ expect(clientConfig.recoverIfCorrupt()).to.be.null;
376
+ expect(
377
+ renameSyncStub
378
+ .getCalls()
379
+ .some((c) => String(c.args[1]).includes(".corrupt-")),
380
+ ).to.be.false;
381
+ });
316
382
  });
317
383
 
318
384
  describe("isTokenValid", () => {
@@ -466,7 +532,66 @@ describe("ClientConfiguration", () => {
466
532
 
467
533
  expect(loggerStub.info.calledWith(sinon.match("Organization:"))).to.be
468
534
  .true;
469
- expect(loggerStub.info.calledWith(sinon.match("Project:"))).to.be.true;
535
+ expect(loggerStub.info.calledWith(sinon.match("Environment:"))).to.be
536
+ .true;
537
+ });
538
+
539
+ it("should name the targeted cell when the token is valid", () => {
540
+ const payload = { exp: Math.floor(Date.now() / 1000) + 3600 };
541
+ const fakeJwt =
542
+ Buffer.from(JSON.stringify({ alg: "HS256" })).toString(
543
+ "base64url",
544
+ ) +
545
+ "." +
546
+ Buffer.from(JSON.stringify(payload)).toString("base64url") +
547
+ ".signature";
548
+
549
+ const mockConfig = {
550
+ configPerEnvironment: {
551
+ production: {},
552
+ staging: {},
553
+ localhost: {},
554
+ dev: {
555
+ accessToken: fakeJwt,
556
+ isServiceAccountToken: false,
557
+ organization: "demo",
558
+ project: "demo",
559
+ },
560
+ },
561
+ activeEnvironment: "dev",
562
+ };
563
+ readFileSyncStub.returns(JSON.stringify(mockConfig));
564
+
565
+ clientConfig.printStatus();
566
+
567
+ expect(loggerStub.info.calledWith(sinon.match("Cell:"))).to.be.true;
568
+ expect(loggerStub.info.calledWith(sinon.match("dev"))).to.be.true;
569
+ expect(
570
+ loggerStub.info.calledWith(
571
+ sinon.match("https://dev-admin.credibledata.com/api/v0"),
572
+ ),
573
+ ).to.be.true;
574
+ });
575
+
576
+ it("should name the targeted cell even when the token is invalid", () => {
577
+ const mockConfig = {
578
+ configPerEnvironment: {
579
+ production: {},
580
+ staging: {},
581
+ localhost: {},
582
+ },
583
+ activeEnvironment: "localhost",
584
+ };
585
+ readFileSyncStub.returns(JSON.stringify(mockConfig));
586
+
587
+ clientConfig.printStatus();
588
+
589
+ expect(loggerStub.info.calledWith(sinon.match("Cell:"))).to.be.true;
590
+ expect(
591
+ loggerStub.info.calledWith(
592
+ sinon.match("http://admin.ms2.localhost/api/v0"),
593
+ ),
594
+ ).to.be.true;
470
595
  });
471
596
 
472
597
  it("should print error when token is invalid", () => {