digital-ai-testing-mcp 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +197 -0
- package/README.md +984 -0
- package/dist/api/agents.d.ts +5 -0
- package/dist/api/agents.d.ts.map +1 -0
- package/dist/api/agents.js +33 -0
- package/dist/api/agents.js.map +1 -0
- package/dist/api/applications.d.ts +35 -0
- package/dist/api/applications.d.ts.map +1 -0
- package/dist/api/applications.js +162 -0
- package/dist/api/applications.js.map +1 -0
- package/dist/api/backup.d.ts +4 -0
- package/dist/api/backup.d.ts.map +1 -0
- package/dist/api/backup.js +13 -0
- package/dist/api/backup.js.map +1 -0
- package/dist/api/browser-inspection.d.ts +33 -0
- package/dist/api/browser-inspection.d.ts.map +1 -0
- package/dist/api/browser-inspection.js +273 -0
- package/dist/api/browser-inspection.js.map +1 -0
- package/dist/api/browsers.d.ts +20 -0
- package/dist/api/browsers.d.ts.map +1 -0
- package/dist/api/browsers.js +31 -0
- package/dist/api/browsers.js.map +1 -0
- package/dist/api/client.d.ts +33 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +200 -0
- package/dist/api/client.js.map +1 -0
- package/dist/api/device-groups.d.ts +15 -0
- package/dist/api/device-groups.d.ts.map +1 -0
- package/dist/api/device-groups.js +106 -0
- package/dist/api/device-groups.js.map +1 -0
- package/dist/api/devices.d.ts +32 -0
- package/dist/api/devices.d.ts.map +1 -0
- package/dist/api/devices.js +192 -0
- package/dist/api/devices.js.map +1 -0
- package/dist/api/license.d.ts +3 -0
- package/dist/api/license.d.ts.map +1 -0
- package/dist/api/license.js +11 -0
- package/dist/api/license.js.map +1 -0
- package/dist/api/nv-servers.d.ts +4 -0
- package/dist/api/nv-servers.d.ts.map +1 -0
- package/dist/api/nv-servers.js +20 -0
- package/dist/api/nv-servers.js.map +1 -0
- package/dist/api/projects.d.ts +36 -0
- package/dist/api/projects.d.ts.map +1 -0
- package/dist/api/projects.js +246 -0
- package/dist/api/projects.js.map +1 -0
- package/dist/api/provisioning-profiles.d.ts +7 -0
- package/dist/api/provisioning-profiles.d.ts.map +1 -0
- package/dist/api/provisioning-profiles.js +54 -0
- package/dist/api/provisioning-profiles.js.map +1 -0
- package/dist/api/regions.d.ts +4 -0
- package/dist/api/regions.d.ts.map +1 -0
- package/dist/api/regions.js +20 -0
- package/dist/api/regions.js.map +1 -0
- package/dist/api/reporter-projects.d.ts +3 -0
- package/dist/api/reporter-projects.d.ts.map +1 -0
- package/dist/api/reporter-projects.js +13 -0
- package/dist/api/reporter-projects.js.map +1 -0
- package/dist/api/reporting.d.ts +28 -0
- package/dist/api/reporting.d.ts.map +1 -0
- package/dist/api/reporting.js +340 -0
- package/dist/api/reporting.js.map +1 -0
- package/dist/api/repository.d.ts +17 -0
- package/dist/api/repository.d.ts.map +1 -0
- package/dist/api/repository.js +81 -0
- package/dist/api/repository.js.map +1 -0
- package/dist/api/reservations.d.ts +9 -0
- package/dist/api/reservations.d.ts.map +1 -0
- package/dist/api/reservations.js +72 -0
- package/dist/api/reservations.js.map +1 -0
- package/dist/api/sessions.d.ts +3 -0
- package/dist/api/sessions.d.ts.map +1 -0
- package/dist/api/sessions.js +12 -0
- package/dist/api/sessions.js.map +1 -0
- package/dist/api/test-views.d.ts +9 -0
- package/dist/api/test-views.d.ts.map +1 -0
- package/dist/api/test-views.js +77 -0
- package/dist/api/test-views.js.map +1 -0
- package/dist/api/transactions.d.ts +4 -0
- package/dist/api/transactions.d.ts.map +1 -0
- package/dist/api/transactions.js +28 -0
- package/dist/api/transactions.js.map +1 -0
- package/dist/api/usage-reports.d.ts +24 -0
- package/dist/api/usage-reports.d.ts.map +1 -0
- package/dist/api/usage-reports.js +47 -0
- package/dist/api/usage-reports.js.map +1 -0
- package/dist/api/users.d.ts +14 -0
- package/dist/api/users.d.ts.map +1 -0
- package/dist/api/users.js +77 -0
- package/dist/api/users.js.map +1 -0
- package/dist/api/webdriver.d.ts +97 -0
- package/dist/api/webdriver.d.ts.map +1 -0
- package/dist/api/webdriver.js +1183 -0
- package/dist/api/webdriver.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +130 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/agent-tools.d.ts +3 -0
- package/dist/tools/agent-tools.d.ts.map +1 -0
- package/dist/tools/agent-tools.js +74 -0
- package/dist/tools/agent-tools.js.map +1 -0
- package/dist/tools/application-tools.d.ts +3 -0
- package/dist/tools/application-tools.d.ts.map +1 -0
- package/dist/tools/application-tools.js +816 -0
- package/dist/tools/application-tools.js.map +1 -0
- package/dist/tools/backup-tools.d.ts +3 -0
- package/dist/tools/backup-tools.d.ts.map +1 -0
- package/dist/tools/backup-tools.js +33 -0
- package/dist/tools/backup-tools.js.map +1 -0
- package/dist/tools/boilerplate-tools.d.ts +9 -0
- package/dist/tools/boilerplate-tools.d.ts.map +1 -0
- package/dist/tools/boilerplate-tools.js +1365 -0
- package/dist/tools/boilerplate-tools.js.map +1 -0
- package/dist/tools/browser-tools.d.ts +3 -0
- package/dist/tools/browser-tools.d.ts.map +1 -0
- package/dist/tools/browser-tools.js +108 -0
- package/dist/tools/browser-tools.js.map +1 -0
- package/dist/tools/coverage-tools.d.ts +3 -0
- package/dist/tools/coverage-tools.d.ts.map +1 -0
- package/dist/tools/coverage-tools.js +148 -0
- package/dist/tools/coverage-tools.js.map +1 -0
- package/dist/tools/debug-tools.d.ts +3 -0
- package/dist/tools/debug-tools.d.ts.map +1 -0
- package/dist/tools/debug-tools.js +315 -0
- package/dist/tools/debug-tools.js.map +1 -0
- package/dist/tools/device-group-tools.d.ts +3 -0
- package/dist/tools/device-group-tools.d.ts.map +1 -0
- package/dist/tools/device-group-tools.js +284 -0
- package/dist/tools/device-group-tools.js.map +1 -0
- package/dist/tools/device-tools.d.ts +3 -0
- package/dist/tools/device-tools.d.ts.map +1 -0
- package/dist/tools/device-tools.js +757 -0
- package/dist/tools/device-tools.js.map +1 -0
- package/dist/tools/health-tools.d.ts +3 -0
- package/dist/tools/health-tools.d.ts.map +1 -0
- package/dist/tools/health-tools.js +368 -0
- package/dist/tools/health-tools.js.map +1 -0
- package/dist/tools/inspection-tools.d.ts +3 -0
- package/dist/tools/inspection-tools.d.ts.map +1 -0
- package/dist/tools/inspection-tools.js +1170 -0
- package/dist/tools/inspection-tools.js.map +1 -0
- package/dist/tools/meta-tools.d.ts +4 -0
- package/dist/tools/meta-tools.d.ts.map +1 -0
- package/dist/tools/meta-tools.js +412 -0
- package/dist/tools/meta-tools.js.map +1 -0
- package/dist/tools/nv-server-tools.d.ts +3 -0
- package/dist/tools/nv-server-tools.d.ts.map +1 -0
- package/dist/tools/nv-server-tools.js +67 -0
- package/dist/tools/nv-server-tools.js.map +1 -0
- package/dist/tools/performance-tools.d.ts +3 -0
- package/dist/tools/performance-tools.d.ts.map +1 -0
- package/dist/tools/performance-tools.js +295 -0
- package/dist/tools/performance-tools.js.map +1 -0
- package/dist/tools/project-tools.d.ts +3 -0
- package/dist/tools/project-tools.d.ts.map +1 -0
- package/dist/tools/project-tools.js +577 -0
- package/dist/tools/project-tools.js.map +1 -0
- package/dist/tools/prompt-tools.d.ts +3 -0
- package/dist/tools/prompt-tools.d.ts.map +1 -0
- package/dist/tools/prompt-tools.js +570 -0
- package/dist/tools/prompt-tools.js.map +1 -0
- package/dist/tools/provisioning-profile-tools.d.ts +3 -0
- package/dist/tools/provisioning-profile-tools.d.ts.map +1 -0
- package/dist/tools/provisioning-profile-tools.js +169 -0
- package/dist/tools/provisioning-profile-tools.js.map +1 -0
- package/dist/tools/region-tools.d.ts +3 -0
- package/dist/tools/region-tools.d.ts.map +1 -0
- package/dist/tools/region-tools.js +46 -0
- package/dist/tools/region-tools.js.map +1 -0
- package/dist/tools/reporting-tools.d.ts +3 -0
- package/dist/tools/reporting-tools.d.ts.map +1 -0
- package/dist/tools/reporting-tools.js +1105 -0
- package/dist/tools/reporting-tools.js.map +1 -0
- package/dist/tools/repository-tools.d.ts +3 -0
- package/dist/tools/repository-tools.d.ts.map +1 -0
- package/dist/tools/repository-tools.js +208 -0
- package/dist/tools/repository-tools.js.map +1 -0
- package/dist/tools/reservation-tools.d.ts +3 -0
- package/dist/tools/reservation-tools.d.ts.map +1 -0
- package/dist/tools/reservation-tools.js +199 -0
- package/dist/tools/reservation-tools.js.map +1 -0
- package/dist/tools/resources.d.ts +3 -0
- package/dist/tools/resources.d.ts.map +1 -0
- package/dist/tools/resources.js +91 -0
- package/dist/tools/resources.js.map +1 -0
- package/dist/tools/test-view-tools.d.ts +3 -0
- package/dist/tools/test-view-tools.d.ts.map +1 -0
- package/dist/tools/test-view-tools.js +242 -0
- package/dist/tools/test-view-tools.js.map +1 -0
- package/dist/tools/transaction-tools.d.ts +3 -0
- package/dist/tools/transaction-tools.d.ts.map +1 -0
- package/dist/tools/transaction-tools.js +391 -0
- package/dist/tools/transaction-tools.js.map +1 -0
- package/dist/tools/usage-report-tools.d.ts +3 -0
- package/dist/tools/usage-report-tools.d.ts.map +1 -0
- package/dist/tools/usage-report-tools.js +160 -0
- package/dist/tools/usage-report-tools.js.map +1 -0
- package/dist/tools/user-tools.d.ts +3 -0
- package/dist/tools/user-tools.d.ts.map +1 -0
- package/dist/tools/user-tools.js +279 -0
- package/dist/tools/user-tools.js.map +1 -0
- package/dist/tools/web-inspection-tools.d.ts +3 -0
- package/dist/tools/web-inspection-tools.d.ts.map +1 -0
- package/dist/tools/web-inspection-tools.js +416 -0
- package/dist/tools/web-inspection-tools.js.map +1 -0
- package/dist/tools/workflow-tools.d.ts +3 -0
- package/dist/tools/workflow-tools.d.ts.map +1 -0
- package/dist/tools/workflow-tools.js +1136 -0
- package/dist/tools/workflow-tools.js.map +1 -0
- package/dist/types/digital-ai.d.ts +691 -0
- package/dist/types/digital-ai.d.ts.map +1 -0
- package/dist/types/digital-ai.js +3 -0
- package/dist/types/digital-ai.js.map +1 -0
- package/dist/utils/csv.d.ts +6 -0
- package/dist/utils/csv.d.ts.map +1 -0
- package/dist/utils/csv.js +77 -0
- package/dist/utils/csv.js.map +1 -0
- package/dist/utils/destructive-guard.d.ts +2 -0
- package/dist/utils/destructive-guard.d.ts.map +1 -0
- package/dist/utils/destructive-guard.js +13 -0
- package/dist/utils/destructive-guard.js.map +1 -0
- package/dist/utils/device-resolver.d.ts +22 -0
- package/dist/utils/device-resolver.d.ts.map +1 -0
- package/dist/utils/device-resolver.js +69 -0
- package/dist/utils/device-resolver.js.map +1 -0
- package/dist/utils/download-command.d.ts +18 -0
- package/dist/utils/download-command.d.ts.map +1 -0
- package/dist/utils/download-command.js +54 -0
- package/dist/utils/download-command.js.map +1 -0
- package/dist/utils/locality.d.ts +9 -0
- package/dist/utils/locality.d.ts.map +1 -0
- package/dist/utils/locality.js +22 -0
- package/dist/utils/locality.js.map +1 -0
- package/dist/utils/output-format.d.ts +13 -0
- package/dist/utils/output-format.d.ts.map +1 -0
- package/dist/utils/output-format.js +13 -0
- package/dist/utils/output-format.js.map +1 -0
- package/dist/utils/pagination.d.ts +12 -0
- package/dist/utils/pagination.d.ts.map +1 -0
- package/dist/utils/pagination.js +24 -0
- package/dist/utils/pagination.js.map +1 -0
- package/dist/utils/path-guard.d.ts +17 -0
- package/dist/utils/path-guard.d.ts.map +1 -0
- package/dist/utils/path-guard.js +41 -0
- package/dist/utils/path-guard.js.map +1 -0
- package/dist/utils/performance-comparison.d.ts +53 -0
- package/dist/utils/performance-comparison.d.ts.map +1 -0
- package/dist/utils/performance-comparison.js +286 -0
- package/dist/utils/performance-comparison.js.map +1 -0
- package/dist/utils/performance-stats.d.ts +72 -0
- package/dist/utils/performance-stats.d.ts.map +1 -0
- package/dist/utils/performance-stats.js +124 -0
- package/dist/utils/performance-stats.js.map +1 -0
- package/dist/utils/profile-loader.d.ts +37 -0
- package/dist/utils/profile-loader.d.ts.map +1 -0
- package/dist/utils/profile-loader.js +80 -0
- package/dist/utils/profile-loader.js.map +1 -0
- package/dist/utils/response-formatter.d.ts +27 -0
- package/dist/utils/response-formatter.d.ts.map +1 -0
- package/dist/utils/response-formatter.js +493 -0
- package/dist/utils/response-formatter.js.map +1 -0
- package/dist/utils/timestamp.d.ts +12 -0
- package/dist/utils/timestamp.d.ts.map +1 -0
- package/dist/utils/timestamp.js +22 -0
- package/dist/utils/timestamp.js.map +1 -0
- package/dist/utils/tool-registry.d.ts +21 -0
- package/dist/utils/tool-registry.d.ts.map +1 -0
- package/dist/utils/tool-registry.js +137 -0
- package/dist/utils/tool-registry.js.map +1 -0
- package/dist/utils/upload-command.d.ts +20 -0
- package/dist/utils/upload-command.d.ts.map +1 -0
- package/dist/utils/upload-command.js +64 -0
- package/dist/utils/upload-command.js.map +1 -0
- package/dist/utils/usage-report-guard.d.ts +48 -0
- package/dist/utils/usage-report-guard.d.ts.map +1 -0
- package/dist/utils/usage-report-guard.js +88 -0
- package/dist/utils/usage-report-guard.js.map +1 -0
- package/dist/utils/usage-report-summary.d.ts +20 -0
- package/dist/utils/usage-report-summary.d.ts.map +1 -0
- package/dist/utils/usage-report-summary.js +48 -0
- package/dist/utils/usage-report-summary.js.map +1 -0
- package/dist/utils/version.d.ts +2 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/utils/version.js +24 -0
- package/dist/utils/version.js.map +1 -0
- package/package.json +73 -0
- package/resources/boilerplate/Android-Native/Java JUnit5/AndroidNative-oss.java +58 -0
- package/resources/boilerplate/Android-Native/Java JUnit5/AndroidNative.java +67 -0
- package/resources/boilerplate/Android-Native/Java JUnit5/gradle +10 -0
- package/resources/boilerplate/Android-Native/Java JUnit5/gradle-oss +10 -0
- package/resources/boilerplate/Android-Native/Java JUnit5/maven +42 -0
- package/resources/boilerplate/Android-Native/Java JUnit5/maven-oss +42 -0
- package/resources/boilerplate/Android-Native/NodeJS (WebDriver)/AndroidNative.js +30 -0
- package/resources/boilerplate/Android-Native/NodeJS (WebDriver)/Shell +19 -0
- package/resources/boilerplate/Android-Native/NodeJS (WebDriver)/Shell-oss +19 -0
- package/resources/boilerplate/Android-Native/NodeJS (WebDriver)/package-oss.json +12 -0
- package/resources/boilerplate/Android-Native/NodeJS (WebDriver)/package.json +12 -0
- package/resources/boilerplate/Android-Native/NodeJS (WebDriver)/wdio-oss.conf.js +40 -0
- package/resources/boilerplate/Android-Native/NodeJS (WebDriver)/wdio.conf.js +44 -0
- package/resources/boilerplate/Android-Native/Python/AndroidNative-oss.py +49 -0
- package/resources/boilerplate/Android-Native/Python/AndroidNative.py +69 -0
- package/resources/boilerplate/Android-Native/Python/pip +2 -0
- package/resources/boilerplate/Android-Native/Python/pip-oss +1 -0
- package/resources/boilerplate/Android-Native/java TestNG/AndroidNative-oss.java +58 -0
- package/resources/boilerplate/Android-Native/java TestNG/AndroidNative.java +67 -0
- package/resources/boilerplate/Android-Native/java TestNG/gradle +13 -0
- package/resources/boilerplate/Android-Native/java TestNG/gradle-oss +13 -0
- package/resources/boilerplate/Android-Native/java TestNG/maven +42 -0
- package/resources/boilerplate/Android-Native/java TestNG/maven-oss +42 -0
- package/resources/boilerplate/iOS-Native/NodeJS (WebDriver)/Shell-oss.txt +19 -0
- package/resources/boilerplate/iOS-Native/NodeJS (WebDriver)/Shell.txt +19 -0
- package/resources/boilerplate/iOS-Native/NodeJS (WebDriver)/iOSNative.js +30 -0
- package/resources/boilerplate/iOS-Native/NodeJS (WebDriver)/package-oss.json +12 -0
- package/resources/boilerplate/iOS-Native/NodeJS (WebDriver)/package.json +12 -0
- package/resources/boilerplate/iOS-Native/NodeJS (WebDriver)/wdio-oss.conf.js +35 -0
- package/resources/boilerplate/iOS-Native/NodeJS (WebDriver)/wdio.conf.js +39 -0
- package/resources/boilerplate/iOS-Native/Python/iOSNative-oss.py +44 -0
- package/resources/boilerplate/iOS-Native/Python/iOSNative.py +62 -0
- package/resources/boilerplate/iOS-Native/Python/pip-oss.txt +1 -0
- package/resources/boilerplate/iOS-Native/Python/pip.txt +2 -0
- package/resources/boilerplate/iOS-Native/java-JUnit5/gradle +10 -0
- package/resources/boilerplate/iOS-Native/java-JUnit5/gradle-oss +10 -0
- package/resources/boilerplate/iOS-Native/java-JUnit5/iOSNative-oss.java +52 -0
- package/resources/boilerplate/iOS-Native/java-JUnit5/iOSNative.java +59 -0
- package/resources/boilerplate/iOS-Native/java-JUnit5/maven +42 -0
- package/resources/boilerplate/iOS-Native/java-JUnit5/maven-oss +42 -0
- package/resources/boilerplate/iOS-Native/java-TestNG/gradle +13 -0
- package/resources/boilerplate/iOS-Native/java-TestNG/gradle-oss +13 -0
- package/resources/boilerplate/iOS-Native/java-TestNG/iOSNative-oss.java +52 -0
- package/resources/boilerplate/iOS-Native/java-TestNG/iOSNative.java +59 -0
- package/resources/boilerplate/iOS-Native/java-TestNG/maven +42 -0
- package/resources/boilerplate/iOS-Native/java-TestNG/maven-oss +42 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
/** Tool dependency sets for each workflow tool. Kept here as the single source of truth
|
|
3
|
+
* so startup checks, the readiness tool, and workflow pre-flight guards all agree. */
|
|
4
|
+
export declare const WORKFLOW_DEPS: Record<string, {
|
|
5
|
+
read: string[];
|
|
6
|
+
write: string[];
|
|
7
|
+
}>;
|
|
8
|
+
export interface WorkflowReadinessResult {
|
|
9
|
+
workflowPresent: boolean;
|
|
10
|
+
ready: boolean;
|
|
11
|
+
missingRead: string[];
|
|
12
|
+
missingWrite: string[];
|
|
13
|
+
registeredCount: number;
|
|
14
|
+
}
|
|
15
|
+
/** Returns the names of all tools currently registered on the server instance.
|
|
16
|
+
* Uses _registeredTools (plain object, keys = tool names) which is populated
|
|
17
|
+
* synchronously as each server.tool() call fires at startup. */
|
|
18
|
+
export declare function getLiveToolNames(server: McpServer): string[];
|
|
19
|
+
/** Computes readiness for one or all workflow tools against the live server registry. */
|
|
20
|
+
export declare function computeWorkflowReadiness(server: McpServer, workflow?: string): Record<string, WorkflowReadinessResult>;
|
|
21
|
+
//# sourceMappingURL=tool-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-registry.d.ts","sourceRoot":"","sources":["../../src/utils/tool-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE;uFACuF;AACvF,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CA0G7E,CAAC;AAEF,MAAM,WAAW,uBAAuB;IACtC,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;iEAEiE;AACjE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,EAAE,CAG5D;AAED,yFAAyF;AACzF,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,SAAS,EACjB,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAoBzC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/** Tool dependency sets for each workflow tool. Kept here as the single source of truth
|
|
2
|
+
* so startup checks, the readiness tool, and workflow pre-flight guards all agree. */
|
|
3
|
+
export const WORKFLOW_DEPS = {
|
|
4
|
+
create_poc: {
|
|
5
|
+
read: [
|
|
6
|
+
'list_device_groups',
|
|
7
|
+
'get_devices_in_group',
|
|
8
|
+
'list_projects',
|
|
9
|
+
'list_applications',
|
|
10
|
+
],
|
|
11
|
+
write: [
|
|
12
|
+
'create_device_group',
|
|
13
|
+
'add_devices_to_group',
|
|
14
|
+
'add_device_tag',
|
|
15
|
+
'remove_devices_from_group',
|
|
16
|
+
'create_project',
|
|
17
|
+
'set_project_notes',
|
|
18
|
+
'create_user',
|
|
19
|
+
'assign_user_to_project',
|
|
20
|
+
'remove_user_from_project',
|
|
21
|
+
'set_user_tags',
|
|
22
|
+
'assign_app_to_project',
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
close_poc: {
|
|
26
|
+
read: [
|
|
27
|
+
'list_projects',
|
|
28
|
+
'list_device_groups',
|
|
29
|
+
'get_devices_in_group',
|
|
30
|
+
'list_users',
|
|
31
|
+
],
|
|
32
|
+
write: [
|
|
33
|
+
'remove_device_tag',
|
|
34
|
+
'remove_devices_from_group',
|
|
35
|
+
'add_devices_to_group',
|
|
36
|
+
'delete_user',
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
delete_poc: {
|
|
40
|
+
read: [
|
|
41
|
+
'list_projects',
|
|
42
|
+
'list_device_groups',
|
|
43
|
+
'get_devices_in_group',
|
|
44
|
+
'list_users',
|
|
45
|
+
],
|
|
46
|
+
write: [
|
|
47
|
+
'remove_device_tag',
|
|
48
|
+
'remove_devices_from_group',
|
|
49
|
+
'add_devices_to_group',
|
|
50
|
+
'delete_user',
|
|
51
|
+
'delete_device_group',
|
|
52
|
+
'delete_project',
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
setup_project: {
|
|
56
|
+
read: [
|
|
57
|
+
'list_device_groups',
|
|
58
|
+
'get_devices_in_group',
|
|
59
|
+
'list_projects',
|
|
60
|
+
'list_applications',
|
|
61
|
+
],
|
|
62
|
+
write: [
|
|
63
|
+
'create_device_group',
|
|
64
|
+
'assign_group_to_project',
|
|
65
|
+
'add_devices_to_group',
|
|
66
|
+
'add_device_tag',
|
|
67
|
+
'remove_devices_from_group',
|
|
68
|
+
'create_project',
|
|
69
|
+
'set_project_notes',
|
|
70
|
+
'create_user',
|
|
71
|
+
'assign_user_to_project',
|
|
72
|
+
'remove_user_from_project',
|
|
73
|
+
'set_user_tags',
|
|
74
|
+
'assign_app_to_project',
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
close_project_resources: {
|
|
78
|
+
read: [
|
|
79
|
+
'list_projects',
|
|
80
|
+
'list_device_groups',
|
|
81
|
+
'get_devices_in_group',
|
|
82
|
+
'list_users',
|
|
83
|
+
],
|
|
84
|
+
write: [
|
|
85
|
+
'remove_device_tag',
|
|
86
|
+
'remove_devices_from_group',
|
|
87
|
+
'add_devices_to_group',
|
|
88
|
+
'delete_user',
|
|
89
|
+
'remove_user_from_project',
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
teardown_project: {
|
|
93
|
+
read: [
|
|
94
|
+
'list_projects',
|
|
95
|
+
'list_device_groups',
|
|
96
|
+
'get_devices_in_group',
|
|
97
|
+
'list_users',
|
|
98
|
+
],
|
|
99
|
+
write: [
|
|
100
|
+
'remove_device_tag',
|
|
101
|
+
'remove_devices_from_group',
|
|
102
|
+
'add_devices_to_group',
|
|
103
|
+
'delete_user',
|
|
104
|
+
'remove_user_from_project',
|
|
105
|
+
'delete_device_group',
|
|
106
|
+
'delete_project',
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
/** Returns the names of all tools currently registered on the server instance.
|
|
111
|
+
* Uses _registeredTools (plain object, keys = tool names) which is populated
|
|
112
|
+
* synchronously as each server.tool() call fires at startup. */
|
|
113
|
+
export function getLiveToolNames(server) {
|
|
114
|
+
const rt = server._registeredTools;
|
|
115
|
+
return rt ? Object.keys(rt) : [];
|
|
116
|
+
}
|
|
117
|
+
/** Computes readiness for one or all workflow tools against the live server registry. */
|
|
118
|
+
export function computeWorkflowReadiness(server, workflow) {
|
|
119
|
+
const registered = new Set(getLiveToolNames(server));
|
|
120
|
+
const toCheck = workflow && workflow !== 'all' && WORKFLOW_DEPS[workflow]
|
|
121
|
+
? { [workflow]: WORKFLOW_DEPS[workflow] }
|
|
122
|
+
: WORKFLOW_DEPS;
|
|
123
|
+
const result = {};
|
|
124
|
+
for (const [wf, deps] of Object.entries(toCheck)) {
|
|
125
|
+
const missingRead = deps.read.filter(t => !registered.has(t));
|
|
126
|
+
const missingWrite = deps.write.filter(t => !registered.has(t));
|
|
127
|
+
result[wf] = {
|
|
128
|
+
workflowPresent: registered.has(wf),
|
|
129
|
+
ready: registered.has(wf) && missingRead.length === 0 && missingWrite.length === 0,
|
|
130
|
+
missingRead,
|
|
131
|
+
missingWrite,
|
|
132
|
+
registeredCount: registered.size,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
return result;
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=tool-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-registry.js","sourceRoot":"","sources":["../../src/utils/tool-registry.ts"],"names":[],"mappings":"AAEA;uFACuF;AACvF,MAAM,CAAC,MAAM,aAAa,GAAwD;IAChF,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,oBAAoB;YACpB,sBAAsB;YACtB,eAAe;YACf,mBAAmB;SACpB;QACD,KAAK,EAAE;YACL,qBAAqB;YACrB,sBAAsB;YACtB,gBAAgB;YAChB,2BAA2B;YAC3B,gBAAgB;YAChB,mBAAmB;YACnB,aAAa;YACb,wBAAwB;YACxB,0BAA0B;YAC1B,eAAe;YACf,uBAAuB;SACxB;KACF;IACD,SAAS,EAAE;QACT,IAAI,EAAE;YACJ,eAAe;YACf,oBAAoB;YACpB,sBAAsB;YACtB,YAAY;SACb;QACD,KAAK,EAAE;YACL,mBAAmB;YACnB,2BAA2B;YAC3B,sBAAsB;YACtB,aAAa;SACd;KACF;IACD,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,eAAe;YACf,oBAAoB;YACpB,sBAAsB;YACtB,YAAY;SACb;QACD,KAAK,EAAE;YACL,mBAAmB;YACnB,2BAA2B;YAC3B,sBAAsB;YACtB,aAAa;YACb,qBAAqB;YACrB,gBAAgB;SACjB;KACF;IACD,aAAa,EAAE;QACb,IAAI,EAAE;YACJ,oBAAoB;YACpB,sBAAsB;YACtB,eAAe;YACf,mBAAmB;SACpB;QACD,KAAK,EAAE;YACL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,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACjD,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9D,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAChE,MAAM,CAAC,EAAE,CAAC,GAAG;YACX,eAAe,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACnC,KAAK,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC;YAClF,WAAW;YACX,YAAY;YACZ,eAAe,EAAE,UAAU,CAAC,IAAI;SACjC,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface UploadCommandSpec {
|
|
2
|
+
/** Full endpoint URL is built from the active base URL + this path (leading slash). */
|
|
3
|
+
path: string;
|
|
4
|
+
/** Multipart file fields: [formFieldName, localFilePath]. */
|
|
5
|
+
files: Array<[string, string]>;
|
|
6
|
+
/** Multipart scalar fields: [formFieldName, value]. */
|
|
7
|
+
fields: Array<[string, string]>;
|
|
8
|
+
/** Platform of the machine that will RUN the command (cannot be inferred — MCP runs in Docker). */
|
|
9
|
+
localPlatform: 'windows' | 'macos' | 'linux';
|
|
10
|
+
/** Optional extra advisory lines inserted before the command blocks. */
|
|
11
|
+
notes?: string[];
|
|
12
|
+
}
|
|
13
|
+
export interface UploadCommandResult {
|
|
14
|
+
endpoint: string;
|
|
15
|
+
curlCommand: string;
|
|
16
|
+
psCommand: string | null;
|
|
17
|
+
humanText: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function buildUploadCommand(spec: UploadCommandSpec): UploadCommandResult;
|
|
20
|
+
//# sourceMappingURL=upload-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-command.d.ts","sourceRoot":"","sources":["../../src/utils/upload-command.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,iBAAiB;IAChC,uFAAuF;IACvF,IAAI,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,KAAK,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC/B,uDAAuD;IACvD,MAAM,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAChC,mGAAmG;IACnG,aAAa,EAAE,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;IAC7C,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,iBAAiB,GAAG,mBAAmB,CA0D/E"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { getActiveAccessKey, getActiveUrl, getActiveKeyType } from '../api/client.js';
|
|
2
|
+
export function buildUploadCommand(spec) {
|
|
3
|
+
const accessKey = getActiveAccessKey();
|
|
4
|
+
const baseUrl = getActiveUrl();
|
|
5
|
+
const isJwt = getActiveKeyType() === 'jwt';
|
|
6
|
+
const isWindows = spec.localPlatform === 'windows';
|
|
7
|
+
const endpoint = `${baseUrl}${spec.path}`;
|
|
8
|
+
// curl — works on macOS, Linux, Git Bash, and WSL
|
|
9
|
+
const curlLines = ['curl -X POST \\'];
|
|
10
|
+
if (isJwt) {
|
|
11
|
+
curlLines.push(` -H "Authorization: Bearer ${accessKey}" \\`);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
curlLines.push(` -H "X-API-KEY: ${accessKey}" \\`);
|
|
15
|
+
curlLines.push(` -H "Authorization: Bearer ${accessKey}" \\`);
|
|
16
|
+
}
|
|
17
|
+
for (const [field, filePath] of spec.files) {
|
|
18
|
+
curlLines.push(` -F "${field}=@${filePath.replace(/\\/g, '/')}" \\`);
|
|
19
|
+
}
|
|
20
|
+
for (const [k, v] of spec.fields)
|
|
21
|
+
curlLines.push(` -F "${k}=${v}" \\`);
|
|
22
|
+
curlLines.push(` "${endpoint}"`);
|
|
23
|
+
const curlCommand = curlLines.join('\n');
|
|
24
|
+
// PowerShell (Invoke-RestMethod) — Windows native
|
|
25
|
+
const psLines = ['$headers = @{'];
|
|
26
|
+
if (isJwt) {
|
|
27
|
+
psLines.push(` "Authorization" = "Bearer ${accessKey}"`);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
psLines.push(` "X-API-KEY" = "${accessKey}"`);
|
|
31
|
+
psLines.push(` "Authorization" = "Bearer ${accessKey}"`);
|
|
32
|
+
}
|
|
33
|
+
psLines.push('}');
|
|
34
|
+
psLines.push('$form = @{');
|
|
35
|
+
for (const [field, filePath] of spec.files)
|
|
36
|
+
psLines.push(` "${field}" = Get-Item "${filePath}"`);
|
|
37
|
+
for (const [k, v] of spec.fields)
|
|
38
|
+
psLines.push(` "${k}" = "${v}"`);
|
|
39
|
+
psLines.push('}');
|
|
40
|
+
psLines.push(`Invoke-RestMethod -Uri "${endpoint}" \``);
|
|
41
|
+
psLines.push(' -Method POST `');
|
|
42
|
+
psLines.push(' -Headers $headers `');
|
|
43
|
+
psLines.push(' -Form $form');
|
|
44
|
+
const psCommand = psLines.join('\n');
|
|
45
|
+
// Human-readable output
|
|
46
|
+
const lines = [
|
|
47
|
+
'⚠️ WARNING: The commands below embed your access key in plaintext.',
|
|
48
|
+
' Run immediately — do not save, share, or commit this output.',
|
|
49
|
+
'',
|
|
50
|
+
];
|
|
51
|
+
for (const note of spec.notes ?? [])
|
|
52
|
+
lines.push(note);
|
|
53
|
+
if ((spec.notes ?? []).length > 0)
|
|
54
|
+
lines.push('');
|
|
55
|
+
if (isWindows) {
|
|
56
|
+
lines.push('─── Git Bash / WSL / macOS curl ─────────────────────────────────', '', '```bash', curlCommand, '```', '');
|
|
57
|
+
lines.push('─── PowerShell (Invoke-RestMethod) ──────────────────────────────', '', '```powershell', psCommand, '```');
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
lines.push('```bash', curlCommand, '```');
|
|
61
|
+
}
|
|
62
|
+
return { endpoint, curlCommand, psCommand: isWindows ? psCommand : null, humanText: lines.join('\n') };
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=upload-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-command.js","sourceRoot":"","sources":["../../src/utils/upload-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AA4BtF,MAAM,UAAU,kBAAkB,CAAC,IAAuB;IACxD,MAAM,SAAS,GAAG,kBAAkB,EAAE,CAAC;IACvC,MAAM,OAAO,GAAG,YAAY,EAAE,CAAC;IAC/B,MAAM,KAAK,GAAG,gBAAgB,EAAE,KAAK,KAAK,CAAC;IAC3C,MAAM,SAAS,GAAG,IAAI,CAAC,aAAa,KAAK,SAAS,CAAC;IACnD,MAAM,QAAQ,GAAG,GAAG,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAE1C,kDAAkD;IAClD,MAAM,SAAS,GAAa,CAAC,iBAAiB,CAAC,CAAC;IAChD,IAAI,KAAK,EAAE,CAAC;QACV,SAAS,CAAC,IAAI,CAAC,+BAA+B,SAAS,MAAM,CAAC,CAAC;IACjE,CAAC;SAAM,CAAC;QACN,SAAS,CAAC,I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IAAI,CAAC,EAAE,CAAC;AACzG,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export type UsageReportType = 'Device Reservations' | 'Users Usage' | 'Devices Usage' | 'Browser Usage' | 'Users Statistics' | 'License Usage';
|
|
2
|
+
interface ReportCapabilities {
|
|
3
|
+
supportsProject: boolean;
|
|
4
|
+
supportsUser: boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Literal object-type path segment the backend expects.
|
|
7
|
+
*
|
|
8
|
+
* For "Users Statistics", a since-superseded internal note suggested the wire
|
|
9
|
+
* value was misspelled "Users Stastistics". Live testing against this tenant
|
|
10
|
+
* disproved that: the correctly-spelled "Users Statistics" returns real data
|
|
11
|
+
* (200, per-user click/screen-time telemetry) and the misspelled variant 500s
|
|
12
|
+
* consistently, at every projectId/date-range combination tried. If a future
|
|
13
|
+
* platform version flips this, re-probe both spellings before trusting either.
|
|
14
|
+
*/
|
|
15
|
+
wireValue: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const USAGE_REPORT_TYPES: Record<UsageReportType, ReportCapabilities>;
|
|
18
|
+
export declare const MAX_UNSCOPED_RANGE_DAYS = 31;
|
|
19
|
+
export interface UsageReportParams {
|
|
20
|
+
reportType: UsageReportType;
|
|
21
|
+
startDate: string;
|
|
22
|
+
endDate: string;
|
|
23
|
+
projectId?: number;
|
|
24
|
+
userId?: number;
|
|
25
|
+
confirmLargeExport?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Converts a "YYYY-MM-DD" calendar day to its UTC epoch-ms boundary.
|
|
29
|
+
*
|
|
30
|
+
* The backend filters on raw epoch ms with no timezone awareness of its own —
|
|
31
|
+
* confirmed live by requesting the same calendar month two ways: our own
|
|
32
|
+
* example encoding (Pacific-Time midnight) vs. literal UTC midnight returned
|
|
33
|
+
* DIFFERENT byte-for-byte data, with the Pacific version missing the first
|
|
34
|
+
* 7-8 hours of the UTC day. Always anchor to UTC here so results are
|
|
35
|
+
* reproducible regardless of the caller's or server's local timezone.
|
|
36
|
+
*/
|
|
37
|
+
export declare function usageReportUtcMs(dateStr: string, boundary: 'start' | 'end'): number;
|
|
38
|
+
/** Returns an error message string, or null if params are well-formed. */
|
|
39
|
+
export declare function validateUsageReportParams(params: UsageReportParams): string | null;
|
|
40
|
+
/**
|
|
41
|
+
* Returns a guard message (safe to return to the caller, isError: false — same
|
|
42
|
+
* convention as checkDestructiveGuard) if this request looks like it will
|
|
43
|
+
* produce a very large, slow download with no way for the caller to have
|
|
44
|
+
* anticipated it. Returns null when the request may proceed.
|
|
45
|
+
*/
|
|
46
|
+
export declare function checkUsageReportSizeGuard(params: UsageReportParams): string | null;
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=usage-report-guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage-report-guard.d.ts","sourceRoot":"","sources":["../../src/utils/usage-report-guard.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,eAAe,GACvB,qBAAqB,GACrB,aAAa,GACb,eAAe,GACf,eAAe,GACf,kBAAkB,GAClB,eAAe,CAAC;AAEpB,UAAU,kBAAkB;IAC1B,eAAe,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,OAAO,CAAC;IACtB;;;;;;;;;OASG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAO1E,CAAC;AAKF,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,eAAe,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAID;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM,CAInF;AAED,0EAA0E;AAC1E,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAiBlF;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CA8BlF"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// Pure validation + size-guard logic for the platform usage-report CSV exports
|
|
2
|
+
// (GET /api/v2/configuration/get-CSV-reports/...). Kept dependency-free (no
|
|
3
|
+
// network, no fs) so it can be unit-tested directly.
|
|
4
|
+
export const USAGE_REPORT_TYPES = {
|
|
5
|
+
'Device Reservations': { supportsProject: true, supportsUser: true, wireValue: 'Device Reservations' },
|
|
6
|
+
'Users Usage': { supportsProject: true, supportsUser: true, wireValue: 'Users Usage' },
|
|
7
|
+
'Devices Usage': { supportsProject: true, supportsUser: false, wireValue: 'Devices Usage' },
|
|
8
|
+
'Browser Usage': { supportsProject: true, supportsUser: false, wireValue: 'Browser Usage' },
|
|
9
|
+
'Users Statistics': { supportsProject: true, supportsUser: true, wireValue: 'Users Statistics' },
|
|
10
|
+
'License Usage': { supportsProject: false, supportsUser: false, wireValue: 'License Usage' },
|
|
11
|
+
};
|
|
12
|
+
// Measured live (see CLAUDE.md): one unfiltered month of License Usage was ~27 MB;
|
|
13
|
+
// one unfiltered week of Device Reservations was ~6.4 MB. Beyond this many days
|
|
14
|
+
// with no project/user narrowing, require explicit confirmation.
|
|
15
|
+
export const MAX_UNSCOPED_RANGE_DAYS = 31;
|
|
16
|
+
const DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
17
|
+
/**
|
|
18
|
+
* Converts a "YYYY-MM-DD" calendar day to its UTC epoch-ms boundary.
|
|
19
|
+
*
|
|
20
|
+
* The backend filters on raw epoch ms with no timezone awareness of its own —
|
|
21
|
+
* confirmed live by requesting the same calendar month two ways: our own
|
|
22
|
+
* example encoding (Pacific-Time midnight) vs. literal UTC midnight returned
|
|
23
|
+
* DIFFERENT byte-for-byte data, with the Pacific version missing the first
|
|
24
|
+
* 7-8 hours of the UTC day. Always anchor to UTC here so results are
|
|
25
|
+
* reproducible regardless of the caller's or server's local timezone.
|
|
26
|
+
*/
|
|
27
|
+
export function usageReportUtcMs(dateStr, boundary) {
|
|
28
|
+
return boundary === 'start'
|
|
29
|
+
? Date.parse(`${dateStr}T00:00:00.000Z`)
|
|
30
|
+
: Date.parse(`${dateStr}T23:59:59.999Z`);
|
|
31
|
+
}
|
|
32
|
+
/** Returns an error message string, or null if params are well-formed. */
|
|
33
|
+
export function validateUsageReportParams(params) {
|
|
34
|
+
const caps = USAGE_REPORT_TYPES[params.reportType];
|
|
35
|
+
if (!caps)
|
|
36
|
+
return `Unknown reportType "${params.reportType}".`;
|
|
37
|
+
if (!DATE_RE.test(params.startDate))
|
|
38
|
+
return `startDate must be "YYYY-MM-DD", got "${params.startDate}".`;
|
|
39
|
+
if (!DATE_RE.test(params.endDate))
|
|
40
|
+
return `endDate must be "YYYY-MM-DD", got "${params.endDate}".`;
|
|
41
|
+
if (params.projectId !== undefined && !caps.supportsProject) {
|
|
42
|
+
return `"${params.reportType}" does not support project filtering — omit projectId.`;
|
|
43
|
+
}
|
|
44
|
+
if (params.userId !== undefined && !caps.supportsUser) {
|
|
45
|
+
return `"${params.reportType}" does not support user filtering — omit userId.`;
|
|
46
|
+
}
|
|
47
|
+
const startMs = usageReportUtcMs(params.startDate, 'start');
|
|
48
|
+
const endMs = usageReportUtcMs(params.endDate, 'end');
|
|
49
|
+
if (Number.isNaN(startMs))
|
|
50
|
+
return `Invalid startDate "${params.startDate}".`;
|
|
51
|
+
if (Number.isNaN(endMs))
|
|
52
|
+
return `Invalid endDate "${params.endDate}".`;
|
|
53
|
+
if (endMs < startMs)
|
|
54
|
+
return 'endDate must not be before startDate.';
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Returns a guard message (safe to return to the caller, isError: false — same
|
|
59
|
+
* convention as checkDestructiveGuard) if this request looks like it will
|
|
60
|
+
* produce a very large, slow download with no way for the caller to have
|
|
61
|
+
* anticipated it. Returns null when the request may proceed.
|
|
62
|
+
*/
|
|
63
|
+
export function checkUsageReportSizeGuard(params) {
|
|
64
|
+
if (params.confirmLargeExport === true)
|
|
65
|
+
return null;
|
|
66
|
+
const caps = USAGE_REPORT_TYPES[params.reportType];
|
|
67
|
+
const startMs = usageReportUtcMs(params.startDate, 'start');
|
|
68
|
+
const endMs = usageReportUtcMs(params.endDate, 'end');
|
|
69
|
+
const rangeDays = Math.ceil((endMs - startMs + 1) / 86_400_000);
|
|
70
|
+
const hasProjectFilter = caps.supportsProject && params.projectId !== undefined && params.projectId !== 0;
|
|
71
|
+
const hasUserFilter = caps.supportsUser && params.userId !== undefined && params.userId !== 0;
|
|
72
|
+
const isNarrowed = hasProjectFilter || hasUserFilter;
|
|
73
|
+
if (isNarrowed || rangeDays <= MAX_UNSCOPED_RANGE_DAYS)
|
|
74
|
+
return null;
|
|
75
|
+
const narrowingAdvice = caps.supportsProject || caps.supportsUser
|
|
76
|
+
? `Narrow the request with ${[caps.supportsProject && 'projectId', caps.supportsUser && 'userId']
|
|
77
|
+
.filter(Boolean)
|
|
78
|
+
.join(' and/or ')}, or shorten the date range to ${MAX_UNSCOPED_RANGE_DAYS} days or less.`
|
|
79
|
+
: `"${params.reportType}" has no project/user filter available — shorten the date range to ${MAX_UNSCOPED_RANGE_DAYS} days or less.`;
|
|
80
|
+
return (`⚠️ Large export guard triggered.\n\n` +
|
|
81
|
+
`"${params.reportType}" for ${rangeDays} days with no project/user filter is likely to be very large ` +
|
|
82
|
+
`(measured live: an unfiltered month of License Usage was ~27 MB; an unfiltered week of Device Reservations ` +
|
|
83
|
+
`was ~6.4 MB). A multi-month or full-year unfiltered export can run into the hundreds of MB and take minutes.\n\n` +
|
|
84
|
+
`${narrowingAdvice}\n\n` +
|
|
85
|
+
`To proceed anyway, include confirmLargeExport: true in your request.\n\n` +
|
|
86
|
+
`No download was attempted.`);
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=usage-report-guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage-report-guard.js","sourceRoot":"","sources":["../../src/utils/usage-report-guard.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,4EAA4E;AAC5E,qDAAqD;AA0BrD,MAAM,CAAC,MAAM,kBAAkB,GAAgD;IAC7E,qBAAqB,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,qBAAqB,EAAE;IACtG,aAAa,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE;IACtF,eAAe,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE;IAC3F,eAAe,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE;IAC3F,kBAAkB,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,kBAAkB,EAAE;IAChG,eAAe,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE;CAC7F,CAAC;AAEF,mFAAmF;AACnF,gFAAgF;AAChF,iEAAiE;AACjE,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAW1C,MAAM,OAAO,GAAG,qBAAqB,CAAC;AAEtC;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe,EAAE,QAAyB;IACzE,OAAO,QAAQ,KAAK,OAAO;QACzB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GA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OAAO,CACL,uCAAuC;QACvC,IAAI,MAAM,CAAC,UAAU,SAAS,SAAS,+DAA+D;QACtG,6GAA6G;QAC7G,kHAAkH;QAClH,GAAG,eAAe,MAAM;QACxB,0EAA0E;QAC1E,4BAA4B,CAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ParsedCsv } from './csv.js';
|
|
2
|
+
export interface SummarizeOptions {
|
|
3
|
+
groupBy: string;
|
|
4
|
+
sumColumn?: string;
|
|
5
|
+
topN?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface GroupResult {
|
|
8
|
+
value: string;
|
|
9
|
+
count: number;
|
|
10
|
+
sum?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface SummaryResult {
|
|
13
|
+
totalRows: number;
|
|
14
|
+
totalGroups: number;
|
|
15
|
+
groups: GroupResult[];
|
|
16
|
+
truncated: boolean;
|
|
17
|
+
availableColumns: string[];
|
|
18
|
+
}
|
|
19
|
+
export declare function summarizeRows(parsed: ParsedCsv, opts: SummarizeOptions): SummaryResult;
|
|
20
|
+
//# sourceMappingURL=usage-report-summary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage-report-summary.d.ts","sourceRoot":"","sources":["../../src/utils/usage-report-summary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAQ1C,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B;AASD,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,gBAAgB,GAAG,aAAa,CA6CtF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const DEFAULT_TOP_N = 50;
|
|
2
|
+
function findColumnIndex(headers, name) {
|
|
3
|
+
const target = name.trim().toLowerCase();
|
|
4
|
+
return headers.findIndex((h) => h.trim().toLowerCase() === target);
|
|
5
|
+
}
|
|
6
|
+
export function summarizeRows(parsed, opts) {
|
|
7
|
+
const { headers, rows } = parsed;
|
|
8
|
+
const groupIdx = findColumnIndex(headers, opts.groupBy);
|
|
9
|
+
if (groupIdx === -1) {
|
|
10
|
+
throw new Error(`groupBy column "${opts.groupBy}" not found. Available columns: ${headers.join(', ')}`);
|
|
11
|
+
}
|
|
12
|
+
let sumIdx = -1;
|
|
13
|
+
if (opts.sumColumn !== undefined) {
|
|
14
|
+
sumIdx = findColumnIndex(headers, opts.sumColumn);
|
|
15
|
+
if (sumIdx === -1) {
|
|
16
|
+
throw new Error(`sumColumn "${opts.sumColumn}" not found. Available columns: ${headers.join(', ')}`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const buckets = new Map();
|
|
20
|
+
let countedRows = 0;
|
|
21
|
+
for (const row of rows) {
|
|
22
|
+
if (row.every((cell) => cell === ''))
|
|
23
|
+
continue; // skip fully-blank rows (trailing-newline artifacts)
|
|
24
|
+
countedRows++;
|
|
25
|
+
const key = row[groupIdx] ?? '';
|
|
26
|
+
const entry = buckets.get(key) ?? { count: 0, sum: 0 };
|
|
27
|
+
entry.count += 1;
|
|
28
|
+
if (sumIdx !== -1) {
|
|
29
|
+
const n = Number(row[sumIdx]);
|
|
30
|
+
if (!Number.isNaN(n))
|
|
31
|
+
entry.sum += n;
|
|
32
|
+
}
|
|
33
|
+
buckets.set(key, entry);
|
|
34
|
+
}
|
|
35
|
+
const sorted = [...buckets.entries()]
|
|
36
|
+
.map(([value, { count, sum }]) => (sumIdx !== -1 ? { value, count, sum: Math.round(sum * 100) / 100 } : { value, count }))
|
|
37
|
+
.sort((a, b) => b.count - a.count);
|
|
38
|
+
const topN = opts.topN ?? DEFAULT_TOP_N;
|
|
39
|
+
const truncated = sorted.length > topN;
|
|
40
|
+
return {
|
|
41
|
+
totalRows: countedRows,
|
|
42
|
+
totalGroups: sorted.length,
|
|
43
|
+
groups: sorted.slice(0, topN),
|
|
44
|
+
truncated,
|
|
45
|
+
availableColumns: headers,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=usage-report-summary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage-report-summary.js","sourceRoot":"","sources":["../../src/utils/usage-report-summary.ts"],"names":[],"mappings":"AA4BA,MAAM,aAAa,GAAG,EAAE,CAAC;AAEzB,SAAS,eAAe,CAAC,OAAiB,EAAE,IAAY;IACtD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACzC,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,CAAC;AACrE,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,MAAiB,EAAE,IAAsB;IACrE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IAEjC,MAAM,QAAQ,GAAG,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACxD,IAAI,QAAQ,KAAK,CAAC,CAAC,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,CAAC,OAAO,mCAAmC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IA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AAE,CAAC;SACjD,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;SACzH,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IAErC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,aAAa,CAAC;IACxC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC;IAEvC,OAAO;QACL,SAAS,EAAE,WAAW;QACtB,WAAW,EAAE,MAAM,CAAC,MAAM;QAC1B,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC;QAC7B,SAAS;QACT,gBAAgB,EAAE,OAAO;KAC1B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/utils/version.ts"],"names":[],"mappings":"AASA,wBAAgB,gBAAgB,IAAI,MAAM,CAYzC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { readFileSync } from 'fs';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
// Single source of truth for the server version: package.json.
|
|
5
|
+
// MCP_SERVER_VERSION (if set) overrides; otherwise the hardcoded fallbacks
|
|
6
|
+
// scattered through the code drift from the real release version.
|
|
7
|
+
let cached = null;
|
|
8
|
+
export function getServerVersion() {
|
|
9
|
+
if (process.env.MCP_SERVER_VERSION)
|
|
10
|
+
return process.env.MCP_SERVER_VERSION;
|
|
11
|
+
if (cached)
|
|
12
|
+
return cached;
|
|
13
|
+
try {
|
|
14
|
+
// Resolves from both dist/utils/ (compiled) and src/utils/ (ts-node) to the repo root.
|
|
15
|
+
const pkgPath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../package.json');
|
|
16
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
|
17
|
+
cached = pkg.version ?? '0.0.0';
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
cached = '0.0.0';
|
|
21
|
+
}
|
|
22
|
+
return cached;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/utils/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,+DAA+D;AAC/D,2EAA2E;AAC3E,kEAAkE;AAClE,IAAI,MAAM,GAAkB,IAAI,CAAC;AAEjC,MAAM,UAAU,gBAAgB;IAC9B,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB;QAAE,OAAO,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;IAC1E,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAC1B,IAAI,CAAC;QACH,uFAAuF;QACvF,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,oBAAoB,CAAC,CAAC;QACjG,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAyB,CAAC;QAC9E,MAAM,GAAG,GAAG,CAAC,OAAO,IAAI,OAAO,CAAC;IAClC,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,GAAG,OAAO,CAAC;IACnB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "digital-ai-testing-mcp",
|
|
3
|
+
"version": "1.2.2",
|
|
4
|
+
"description": "MCP server for Digital.ai Testing — device farm management, app lifecycle, and test automation",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"digital-ai-testing-mcp": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"resources/boilerplate"
|
|
13
|
+
],
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=22"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/digitalai-opensource/digital-ai-testing-mcp.git"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/digitalai-opensource/digital-ai-testing-mcp#readme",
|
|
22
|
+
"bugs": "https://github.com/digitalai-opensource/digital-ai-testing-mcp/issues",
|
|
23
|
+
"license": "Apache-2.0",
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsc",
|
|
26
|
+
"start": "node dist/index.js",
|
|
27
|
+
"dev": "nodemon --exec ts-node --esm src/index.ts",
|
|
28
|
+
"lint": "eslint src/**/*.ts tests/**/*.ts",
|
|
29
|
+
"typecheck": "tsc --noEmit",
|
|
30
|
+
"test": "vitest run",
|
|
31
|
+
"test:live": "vitest run --config vitest.live.config.ts",
|
|
32
|
+
"test:users": "vitest run tests/users.test.ts",
|
|
33
|
+
"test:devices": "vitest run tests/devices.test.ts",
|
|
34
|
+
"test:device-groups": "vitest run tests/device-groups.test.ts",
|
|
35
|
+
"test:reservations": "vitest run tests/reservations.test.ts",
|
|
36
|
+
"test:applications": "vitest run tests/applications.test.ts",
|
|
37
|
+
"test:repository": "vitest run tests/repository.test.ts",
|
|
38
|
+
"test:browsers": "vitest run tests/browsers.test.ts",
|
|
39
|
+
"test:projects": "vitest run tests/projects.test.ts",
|
|
40
|
+
"test:provisioning": "vitest run tests/provisioning-profiles.test.ts",
|
|
41
|
+
"test:health": "vitest run tests/health.test.ts",
|
|
42
|
+
"test:utils": "vitest run tests/utils.test.ts",
|
|
43
|
+
"test:reporting": "vitest run tests/reporting.test.ts",
|
|
44
|
+
"test:test-views": "vitest run tests/test-views.test.ts",
|
|
45
|
+
"test:transactions": "vitest run tests/transactions.test.ts",
|
|
46
|
+
"test:analytics": "vitest run tests/analytics.test.ts",
|
|
47
|
+
"test:infrastructure": "vitest run tests/infrastructure.test.ts",
|
|
48
|
+
"test:performance": "vitest run tests/performance.test.ts",
|
|
49
|
+
"test:tools": "vitest run tests/tools.test.ts",
|
|
50
|
+
"test:usage-reports": "vitest run tests/usage-reports.test.ts"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
54
|
+
"adm-zip": "^0.6.0",
|
|
55
|
+
"axios": "^1.19.0",
|
|
56
|
+
"dotenv": "^17.4.2",
|
|
57
|
+
"form-data": "^4.0.6",
|
|
58
|
+
"zod": "^4.4.3"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@types/node": "^26.2.0",
|
|
62
|
+
"eslint": "^10.8.1",
|
|
63
|
+
"nodemon": "^3.0.0",
|
|
64
|
+
"ts-node": "^10.9.0",
|
|
65
|
+
"tsx": "^4.23.12",
|
|
66
|
+
"typescript": "^6.0.3",
|
|
67
|
+
"typescript-eslint": "^8.67.0",
|
|
68
|
+
"vitest": "^4.1.10"
|
|
69
|
+
},
|
|
70
|
+
"allowScripts": {
|
|
71
|
+
"esbuild@0.28.1": true
|
|
72
|
+
}
|
|
73
|
+
}
|