termcast 1.3.9
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/dist/action-utils.d.ts +25 -0
- package/dist/action-utils.d.ts.map +1 -0
- package/dist/action-utils.js +209 -0
- package/dist/action-utils.js.map +1 -0
- package/dist/ai.d.ts +104 -0
- package/dist/ai.d.ts.map +1 -0
- package/dist/ai.js +135 -0
- package/dist/ai.js.map +1 -0
- package/dist/apis/ai.d.ts +104 -0
- package/dist/apis/ai.d.ts.map +1 -0
- package/dist/apis/ai.js +135 -0
- package/dist/apis/ai.js.map +1 -0
- package/dist/apis/cache.d.ts +84 -0
- package/dist/apis/cache.d.ts.map +1 -0
- package/dist/apis/cache.js +307 -0
- package/dist/apis/cache.js.map +1 -0
- package/dist/apis/cache.test.d.ts +2 -0
- package/dist/apis/cache.test.d.ts.map +1 -0
- package/dist/apis/cache.test.js +246 -0
- package/dist/apis/cache.test.js.map +1 -0
- package/dist/apis/clipboard.d.ts +36 -0
- package/dist/apis/clipboard.d.ts.map +1 -0
- package/dist/apis/clipboard.js +154 -0
- package/dist/apis/clipboard.js.map +1 -0
- package/dist/apis/environment.d.ts +63 -0
- package/dist/apis/environment.d.ts.map +1 -0
- package/dist/apis/environment.js +189 -0
- package/dist/apis/environment.js.map +1 -0
- package/dist/apis/hud.d.ts +7 -0
- package/dist/apis/hud.d.ts.map +1 -0
- package/dist/apis/hud.js +45 -0
- package/dist/apis/hud.js.map +1 -0
- package/dist/apis/localstorage.d.ts +13 -0
- package/dist/apis/localstorage.d.ts.map +1 -0
- package/dist/apis/localstorage.js +190 -0
- package/dist/apis/localstorage.js.map +1 -0
- package/dist/apis/localstorage.test.d.ts +2 -0
- package/dist/apis/localstorage.test.d.ts.map +1 -0
- package/dist/apis/localstorage.test.js +131 -0
- package/dist/apis/localstorage.test.js.map +1 -0
- package/dist/apis/oauth.d.ts +142 -0
- package/dist/apis/oauth.d.ts.map +1 -0
- package/dist/apis/oauth.js +551 -0
- package/dist/apis/oauth.js.map +1 -0
- package/dist/apis/preferences.d.ts +23 -0
- package/dist/apis/preferences.d.ts.map +1 -0
- package/dist/apis/preferences.js +105 -0
- package/dist/apis/preferences.js.map +1 -0
- package/dist/apis/toast.d.ts +81 -0
- package/dist/apis/toast.d.ts.map +1 -0
- package/dist/apis/toast.js +275 -0
- package/dist/apis/toast.js.map +1 -0
- package/dist/apis/toast.test.d.ts +2 -0
- package/dist/apis/toast.test.d.ts.map +1 -0
- package/dist/apis/toast.test.js +67 -0
- package/dist/apis/toast.test.js.map +1 -0
- package/dist/apis/window.d.ts +12 -0
- package/dist/apis/window.d.ts.map +1 -0
- package/dist/apis/window.js +47 -0
- package/dist/apis/window.js.map +1 -0
- package/dist/build.d.ts +15 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/build.js +213 -0
- package/dist/build.js.map +1 -0
- package/dist/build.test.d.ts +2 -0
- package/dist/build.test.d.ts.map +1 -0
- package/dist/build.test.js +73 -0
- package/dist/build.test.js.map +1 -0
- package/dist/cache.d.ts +32 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +205 -0
- package/dist/cache.js.map +1 -0
- package/dist/cache.test.d.ts +2 -0
- package/dist/cache.test.d.ts.map +1 -0
- package/dist/cache.test.js +246 -0
- package/dist/cache.test.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +278 -0
- package/dist/cli.js.map +1 -0
- package/dist/clipboard.d.ts +36 -0
- package/dist/clipboard.d.ts.map +1 -0
- package/dist/clipboard.js +154 -0
- package/dist/clipboard.js.map +1 -0
- package/dist/colors.d.ts +15 -0
- package/dist/colors.d.ts.map +1 -0
- package/dist/colors.js +13 -0
- package/dist/colors.js.map +1 -0
- package/dist/components/actions.d.ts +120 -0
- package/dist/components/actions.d.ts.map +1 -0
- package/dist/components/actions.js +371 -0
- package/dist/components/actions.js.map +1 -0
- package/dist/components/alert.d.ts +25 -0
- package/dist/components/alert.d.ts.map +1 -0
- package/dist/components/alert.js +99 -0
- package/dist/components/alert.js.map +1 -0
- package/dist/components/detail.d.ts +65 -0
- package/dist/components/detail.d.ts.map +1 -0
- package/dist/components/detail.js +147 -0
- package/dist/components/detail.js.map +1 -0
- package/dist/components/dropdown.d.ts +40 -0
- package/dist/components/dropdown.d.ts.map +1 -0
- package/dist/components/dropdown.js +202 -0
- package/dist/components/dropdown.js.map +1 -0
- package/dist/components/extension-preferences.d.ts +8 -0
- package/dist/components/extension-preferences.d.ts.map +1 -0
- package/dist/components/extension-preferences.js +139 -0
- package/dist/components/extension-preferences.js.map +1 -0
- package/dist/components/form/assign-components.d.ts +2 -0
- package/dist/components/form/assign-components.d.ts.map +1 -0
- package/dist/components/form/assign-components.js +22 -0
- package/dist/components/form/assign-components.js.map +1 -0
- package/dist/components/form/checkbox.d.ts +7 -0
- package/dist/components/form/checkbox.d.ts.map +1 -0
- package/dist/components/form/checkbox.js +46 -0
- package/dist/components/form/checkbox.js.map +1 -0
- package/dist/components/form/date-picker.d.ts +18 -0
- package/dist/components/form/date-picker.d.ts.map +1 -0
- package/dist/components/form/date-picker.js +69 -0
- package/dist/components/form/date-picker.js.map +1 -0
- package/dist/components/form/description.d.ts +7 -0
- package/dist/components/form/description.d.ts.map +1 -0
- package/dist/components/form/description.js +8 -0
- package/dist/components/form/description.js.map +1 -0
- package/dist/components/form/dropdown.d.ts +25 -0
- package/dist/components/form/dropdown.d.ts.map +1 -0
- package/dist/components/form/dropdown.js +286 -0
- package/dist/components/form/dropdown.js.map +1 -0
- package/dist/components/form/file-autocomplete.d.ts +12 -0
- package/dist/components/form/file-autocomplete.d.ts.map +1 -0
- package/dist/components/form/file-autocomplete.js +84 -0
- package/dist/components/form/file-autocomplete.js.map +1 -0
- package/dist/components/form/file-picker.d.ts +31 -0
- package/dist/components/form/file-picker.d.ts.map +1 -0
- package/dist/components/form/file-picker.js +113 -0
- package/dist/components/form/file-picker.js.map +1 -0
- package/dist/components/form/form-end.d.ts +2 -0
- package/dist/components/form/form-end.d.ts.map +1 -0
- package/dist/components/form/form-end.js +6 -0
- package/dist/components/form/form-end.js.map +1 -0
- package/dist/components/form/form-type-only.d.ts +174 -0
- package/dist/components/form/form-type-only.d.ts.map +1 -0
- package/dist/components/form/form-type-only.js +2 -0
- package/dist/components/form/form-type-only.js.map +1 -0
- package/dist/components/form/index.d.ts +46 -0
- package/dist/components/form/index.d.ts.map +1 -0
- package/dist/components/form/index.js +106 -0
- package/dist/components/form/index.js.map +1 -0
- package/dist/components/form/password-field.d.ts +7 -0
- package/dist/components/form/password-field.d.ts.map +1 -0
- package/dist/components/form/password-field.js +34 -0
- package/dist/components/form/password-field.js.map +1 -0
- package/dist/components/form/separator.d.ts +2 -0
- package/dist/components/form/separator.d.ts.map +1 -0
- package/dist/components/form/separator.js +8 -0
- package/dist/components/form/separator.js.map +1 -0
- package/dist/components/form/tagpicker.d.ts +134 -0
- package/dist/components/form/tagpicker.d.ts.map +1 -0
- package/dist/components/form/tagpicker.js +79 -0
- package/dist/components/form/tagpicker.js.map +1 -0
- package/dist/components/form/text-area.d.ts +8 -0
- package/dist/components/form/text-area.d.ts.map +1 -0
- package/dist/components/form/text-area.js +26 -0
- package/dist/components/form/text-area.js.map +1 -0
- package/dist/components/form/text-field.d.ts +7 -0
- package/dist/components/form/text-field.d.ts.map +1 -0
- package/dist/components/form/text-field.js +28 -0
- package/dist/components/form/text-field.js.map +1 -0
- package/dist/components/form/types.d.ts +43 -0
- package/dist/components/form/types.d.ts.map +1 -0
- package/dist/components/form/types.js +2 -0
- package/dist/components/form/types.js.map +1 -0
- package/dist/components/form/use-form-handling.d.ts +4 -0
- package/dist/components/form/use-form-handling.d.ts.map +1 -0
- package/dist/components/form/use-form-handling.js +37 -0
- package/dist/components/form/use-form-handling.js.map +1 -0
- package/dist/components/form/use-form-navigation.d.ts +8 -0
- package/dist/components/form/use-form-navigation.d.ts.map +1 -0
- package/dist/components/form/use-form-navigation.js +58 -0
- package/dist/components/form/use-form-navigation.js.map +1 -0
- package/dist/components/form/with-left-border.d.ts +17 -0
- package/dist/components/form/with-left-border.d.ts.map +1 -0
- package/dist/components/form/with-left-border.js +10 -0
- package/dist/components/form/with-left-border.js.map +1 -0
- package/dist/components/icon.d.ts +9 -0
- package/dist/components/icon.d.ts.map +1 -0
- package/dist/components/icon.js +485 -0
- package/dist/components/icon.js.map +1 -0
- package/dist/components/image.d.ts +19 -0
- package/dist/components/image.d.ts.map +1 -0
- package/dist/components/image.js +32 -0
- package/dist/components/image.js.map +1 -0
- package/dist/components/list.d.ts +234 -0
- package/dist/components/list.d.ts.map +1 -0
- package/dist/components/list.js +667 -0
- package/dist/components/list.js.map +1 -0
- package/dist/components/loading-bar.d.ts +8 -0
- package/dist/components/loading-bar.d.ts.map +1 -0
- package/dist/components/loading-bar.js +107 -0
- package/dist/components/loading-bar.js.map +1 -0
- package/dist/components/menubar-extra.d.ts +68 -0
- package/dist/components/menubar-extra.d.ts.map +1 -0
- package/dist/components/menubar-extra.js +39 -0
- package/dist/components/menubar-extra.js.map +1 -0
- package/dist/descendants.d.ts +25 -0
- package/dist/descendants.d.ts.map +1 -0
- package/dist/descendants.js +81 -0
- package/dist/descendants.js.map +1 -0
- package/dist/dev-ui.d.ts +7 -0
- package/dist/dev-ui.d.ts.map +1 -0
- package/dist/dev-ui.js +118 -0
- package/dist/dev-ui.js.map +1 -0
- package/dist/e2e-node.d.ts +63 -0
- package/dist/e2e-node.d.ts.map +1 -0
- package/dist/e2e-node.js +255 -0
- package/dist/e2e-node.js.map +1 -0
- package/dist/e2e.d.ts +39 -0
- package/dist/e2e.d.ts.map +1 -0
- package/dist/e2e.js +127 -0
- package/dist/e2e.js.map +1 -0
- package/dist/environment.d.ts +63 -0
- package/dist/environment.d.ts.map +1 -0
- package/dist/environment.js +189 -0
- package/dist/environment.js.map +1 -0
- package/dist/examples/action-show-in-finder.d.ts +2 -0
- package/dist/examples/action-show-in-finder.d.ts.map +1 -0
- package/dist/examples/action-show-in-finder.js +13 -0
- package/dist/examples/action-show-in-finder.js.map +1 -0
- package/dist/examples/datepicker.d.ts +2 -0
- package/dist/examples/datepicker.d.ts.map +1 -0
- package/dist/examples/datepicker.js +344 -0
- package/dist/examples/datepicker.js.map +1 -0
- package/dist/examples/environment-test.d.ts +2 -0
- package/dist/examples/environment-test.d.ts.map +1 -0
- package/dist/examples/environment-test.js +28 -0
- package/dist/examples/environment-test.js.map +1 -0
- package/dist/examples/error-boundary.d.ts +6 -0
- package/dist/examples/error-boundary.d.ts.map +1 -0
- package/dist/examples/error-boundary.js +67 -0
- package/dist/examples/error-boundary.js.map +1 -0
- package/dist/examples/form-basic-arrow-keys.vitest.d.ts +2 -0
- package/dist/examples/form-basic-arrow-keys.vitest.d.ts.map +1 -0
- package/dist/examples/form-basic-arrow-keys.vitest.js +46 -0
- package/dist/examples/form-basic-arrow-keys.vitest.js.map +1 -0
- package/dist/examples/form-basic.d.ts +2 -0
- package/dist/examples/form-basic.d.ts.map +1 -0
- package/dist/examples/form-basic.js +21 -0
- package/dist/examples/form-basic.js.map +1 -0
- package/dist/examples/form-basic.vitest.d.ts +2 -0
- package/dist/examples/form-basic.vitest.d.ts.map +1 -0
- package/dist/examples/form-basic.vitest.js +995 -0
- package/dist/examples/form-basic.vitest.js.map +1 -0
- package/dist/examples/form-dropdown-with-sections.d.ts +2 -0
- package/dist/examples/form-dropdown-with-sections.d.ts.map +1 -0
- package/dist/examples/form-dropdown-with-sections.js +13 -0
- package/dist/examples/form-dropdown-with-sections.js.map +1 -0
- package/dist/examples/form-dropdown-with-sections.vitest.d.ts +2 -0
- package/dist/examples/form-dropdown-with-sections.vitest.d.ts.map +1 -0
- package/dist/examples/form-dropdown-with-sections.vitest.js +75 -0
- package/dist/examples/form-dropdown-with-sections.vitest.js.map +1 -0
- package/dist/examples/form-dropdown.d.ts +2 -0
- package/dist/examples/form-dropdown.d.ts.map +1 -0
- package/dist/examples/form-dropdown.js +13 -0
- package/dist/examples/form-dropdown.js.map +1 -0
- package/dist/examples/form-dropdown.vitest.d.ts +2 -0
- package/dist/examples/form-dropdown.vitest.d.ts.map +1 -0
- package/dist/examples/form-dropdown.vitest.js +722 -0
- package/dist/examples/form-dropdown.vitest.js.map +1 -0
- package/dist/examples/form-multiselect-dropdown.d.ts +2 -0
- package/dist/examples/form-multiselect-dropdown.d.ts.map +1 -0
- package/dist/examples/form-multiselect-dropdown.js +13 -0
- package/dist/examples/form-multiselect-dropdown.js.map +1 -0
- package/dist/examples/form-tagpicker.d.ts +2 -0
- package/dist/examples/form-tagpicker.d.ts.map +1 -0
- package/dist/examples/form-tagpicker.js +13 -0
- package/dist/examples/form-tagpicker.js.map +1 -0
- package/dist/examples/form-tagpicker.vitest.d.ts +2 -0
- package/dist/examples/form-tagpicker.vitest.d.ts.map +1 -0
- package/dist/examples/form-tagpicker.vitest.js +491 -0
- package/dist/examples/form-tagpicker.vitest.js.map +1 -0
- package/dist/examples/internal/descendants-filtering.d.ts +2 -0
- package/dist/examples/internal/descendants-filtering.d.ts.map +1 -0
- package/dist/examples/internal/descendants-filtering.js +144 -0
- package/dist/examples/internal/descendants-filtering.js.map +1 -0
- package/dist/examples/internal/descendants.d.ts +2 -0
- package/dist/examples/internal/descendants.d.ts.map +1 -0
- package/dist/examples/internal/descendants.js +134 -0
- package/dist/examples/internal/descendants.js.map +1 -0
- package/dist/examples/internal/nested-boxes.d.ts +2 -0
- package/dist/examples/internal/nested-boxes.d.ts.map +1 -0
- package/dist/examples/internal/nested-boxes.js +7 -0
- package/dist/examples/internal/nested-boxes.js.map +1 -0
- package/dist/examples/internal/scrollbox-demo.d.ts +2 -0
- package/dist/examples/internal/scrollbox-demo.d.ts.map +1 -0
- package/dist/examples/internal/scrollbox-demo.js +104 -0
- package/dist/examples/internal/scrollbox-demo.js.map +1 -0
- package/dist/examples/internal/simple-dialog.d.ts +2 -0
- package/dist/examples/internal/simple-dialog.d.ts.map +1 -0
- package/dist/examples/internal/simple-dialog.js +43 -0
- package/dist/examples/internal/simple-dialog.js.map +1 -0
- package/dist/examples/internal/text-stacking.d.ts +2 -0
- package/dist/examples/internal/text-stacking.d.ts.map +1 -0
- package/dist/examples/internal/text-stacking.js +53 -0
- package/dist/examples/internal/text-stacking.js.map +1 -0
- package/dist/examples/internal/unicode-square-repro.d.ts +2 -0
- package/dist/examples/internal/unicode-square-repro.d.ts.map +1 -0
- package/dist/examples/internal/unicode-square-repro.js +7 -0
- package/dist/examples/internal/unicode-square-repro.js.map +1 -0
- package/dist/examples/list-dropdown-default.d.ts +2 -0
- package/dist/examples/list-dropdown-default.d.ts.map +1 -0
- package/dist/examples/list-dropdown-default.js +14 -0
- package/dist/examples/list-dropdown-default.js.map +1 -0
- package/dist/examples/list-dropdown-default.vitest.d.ts +2 -0
- package/dist/examples/list-dropdown-default.vitest.d.ts.map +1 -0
- package/dist/examples/list-dropdown-default.vitest.js +164 -0
- package/dist/examples/list-dropdown-default.vitest.js.map +1 -0
- package/dist/examples/list-fetch-data.d.ts +2 -0
- package/dist/examples/list-fetch-data.d.ts.map +1 -0
- package/dist/examples/list-fetch-data.js +87 -0
- package/dist/examples/list-fetch-data.js.map +1 -0
- package/dist/examples/list-fetch-data.vitest.d.ts +2 -0
- package/dist/examples/list-fetch-data.vitest.d.ts.map +1 -0
- package/dist/examples/list-fetch-data.vitest.js +103 -0
- package/dist/examples/list-fetch-data.vitest.js.map +1 -0
- package/dist/examples/list-filter-navigation.d.ts +2 -0
- package/dist/examples/list-filter-navigation.d.ts.map +1 -0
- package/dist/examples/list-filter-navigation.js +8 -0
- package/dist/examples/list-filter-navigation.js.map +1 -0
- package/dist/examples/list-with-detail.d.ts +2 -0
- package/dist/examples/list-with-detail.d.ts.map +1 -0
- package/dist/examples/list-with-detail.js +94 -0
- package/dist/examples/list-with-detail.js.map +1 -0
- package/dist/examples/list-with-detail.vitest.d.ts +2 -0
- package/dist/examples/list-with-detail.vitest.d.ts.map +1 -0
- package/dist/examples/list-with-detail.vitest.js +438 -0
- package/dist/examples/list-with-detail.vitest.js.map +1 -0
- package/dist/examples/list-with-dropdown.d.ts +2 -0
- package/dist/examples/list-with-dropdown.d.ts.map +1 -0
- package/dist/examples/list-with-dropdown.js +43 -0
- package/dist/examples/list-with-dropdown.js.map +1 -0
- package/dist/examples/list-with-dropdown.vitest.d.ts +2 -0
- package/dist/examples/list-with-dropdown.vitest.d.ts.map +1 -0
- package/dist/examples/list-with-dropdown.vitest.js +297 -0
- package/dist/examples/list-with-dropdown.vitest.js.map +1 -0
- package/dist/examples/list-with-sections.d.ts +2 -0
- package/dist/examples/list-with-sections.d.ts.map +1 -0
- package/dist/examples/list-with-sections.js +67 -0
- package/dist/examples/list-with-sections.js.map +1 -0
- package/dist/examples/list-with-sections.vitest.d.ts +2 -0
- package/dist/examples/list-with-sections.vitest.d.ts.map +1 -0
- package/dist/examples/list-with-sections.vitest.js +441 -0
- package/dist/examples/list-with-sections.vitest.js.map +1 -0
- package/dist/examples/miscellaneous.d.ts +2 -0
- package/dist/examples/miscellaneous.d.ts.map +1 -0
- package/dist/examples/miscellaneous.js +313 -0
- package/dist/examples/miscellaneous.js.map +1 -0
- package/dist/examples/nested-navigation.d.ts +2 -0
- package/dist/examples/nested-navigation.d.ts.map +1 -0
- package/dist/examples/nested-navigation.js +35 -0
- package/dist/examples/nested-navigation.js.map +1 -0
- package/dist/examples/preferences-test.d.ts +2 -0
- package/dist/examples/preferences-test.d.ts.map +1 -0
- package/dist/examples/preferences-test.js +43 -0
- package/dist/examples/preferences-test.js.map +1 -0
- package/dist/examples/simple-dropdown.d.ts +2 -0
- package/dist/examples/simple-dropdown.d.ts.map +1 -0
- package/dist/examples/simple-dropdown.js +15 -0
- package/dist/examples/simple-dropdown.js.map +1 -0
- package/dist/examples/simple-file-picker.d.ts +2 -0
- package/dist/examples/simple-file-picker.d.ts.map +1 -0
- package/dist/examples/simple-file-picker.js +21 -0
- package/dist/examples/simple-file-picker.js.map +1 -0
- package/dist/examples/simple-file-picker.vitest.d.ts +2 -0
- package/dist/examples/simple-file-picker.vitest.d.ts.map +1 -0
- package/dist/examples/simple-file-picker.vitest.js +277 -0
- package/dist/examples/simple-file-picker.vitest.js.map +1 -0
- package/dist/examples/simple-grid.d.ts +2 -0
- package/dist/examples/simple-grid.d.ts.map +1 -0
- package/dist/examples/simple-grid.js +51 -0
- package/dist/examples/simple-grid.js.map +1 -0
- package/dist/examples/simple-grid.vitest.d.ts +2 -0
- package/dist/examples/simple-grid.vitest.d.ts.map +1 -0
- package/dist/examples/simple-grid.vitest.js +498 -0
- package/dist/examples/simple-grid.vitest.js.map +1 -0
- package/dist/examples/simple-hud.d.ts +2 -0
- package/dist/examples/simple-hud.d.ts.map +1 -0
- package/dist/examples/simple-hud.js +18 -0
- package/dist/examples/simple-hud.js.map +1 -0
- package/dist/examples/simple-list-search.d.ts +2 -0
- package/dist/examples/simple-list-search.d.ts.map +1 -0
- package/dist/examples/simple-list-search.js +26 -0
- package/dist/examples/simple-list-search.js.map +1 -0
- package/dist/examples/simple-list.d.ts +2 -0
- package/dist/examples/simple-list.d.ts.map +1 -0
- package/dist/examples/simple-list.js +50 -0
- package/dist/examples/simple-list.js.map +1 -0
- package/dist/examples/simple-navigation.d.ts +2 -0
- package/dist/examples/simple-navigation.d.ts.map +1 -0
- package/dist/examples/simple-navigation.js +36 -0
- package/dist/examples/simple-navigation.js.map +1 -0
- package/dist/examples/simple-navigation.vitest.d.ts +2 -0
- package/dist/examples/simple-navigation.vitest.d.ts.map +1 -0
- package/dist/examples/simple-navigation.vitest.js +522 -0
- package/dist/examples/simple-navigation.vitest.js.map +1 -0
- package/dist/examples/store.d.ts +2 -0
- package/dist/examples/store.d.ts.map +1 -0
- package/dist/examples/store.js +5 -0
- package/dist/examples/store.js.map +1 -0
- package/dist/examples/store.vitest.d.ts +2 -0
- package/dist/examples/store.vitest.d.ts.map +1 -0
- package/dist/examples/store.vitest.js +52 -0
- package/dist/examples/store.vitest.js.map +1 -0
- package/dist/examples/tanstack-demo.d.ts +2 -0
- package/dist/examples/tanstack-demo.d.ts.map +1 -0
- package/dist/examples/tanstack-demo.js +51 -0
- package/dist/examples/tanstack-demo.js.map +1 -0
- package/dist/examples/use-promise-demo.d.ts +2 -0
- package/dist/examples/use-promise-demo.d.ts.map +1 -0
- package/dist/examples/use-promise-demo.js +45 -0
- package/dist/examples/use-promise-demo.js.map +1 -0
- package/dist/extensions/dev.d.ts +7 -0
- package/dist/extensions/dev.d.ts.map +1 -0
- package/dist/extensions/dev.js +124 -0
- package/dist/extensions/dev.js.map +1 -0
- package/dist/extensions/home.d.ts +8 -0
- package/dist/extensions/home.d.ts.map +1 -0
- package/dist/extensions/home.js +184 -0
- package/dist/extensions/home.js.map +1 -0
- package/dist/extensions/store.d.ts +6 -0
- package/dist/extensions/store.d.ts.map +1 -0
- package/dist/extensions/store.js +203 -0
- package/dist/extensions/store.js.map +1 -0
- package/dist/globals.d.ts +9 -0
- package/dist/globals.d.ts.map +1 -0
- package/dist/globals.js +21 -0
- package/dist/globals.js.map +1 -0
- package/dist/home-command.d.ts +8 -0
- package/dist/home-command.d.ts.map +1 -0
- package/dist/home-command.js +181 -0
- package/dist/home-command.js.map +1 -0
- package/dist/hooks/hooks.test.d.ts +2 -0
- package/dist/hooks/hooks.test.d.ts.map +1 -0
- package/dist/hooks/hooks.test.js +37 -0
- package/dist/hooks/hooks.test.js.map +1 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +6 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/use-action-panel.d.ts +16 -0
- package/dist/hooks/use-action-panel.d.ts.map +1 -0
- package/dist/hooks/use-action-panel.js +19 -0
- package/dist/hooks/use-action-panel.js.map +1 -0
- package/dist/hooks/use-id.d.ts +9 -0
- package/dist/hooks/use-id.d.ts.map +1 -0
- package/dist/hooks/use-id.js +17 -0
- package/dist/hooks/use-id.js.map +1 -0
- package/dist/hooks/use-unstable-ai.d.ts +9 -0
- package/dist/hooks/use-unstable-ai.d.ts.map +1 -0
- package/dist/hooks/use-unstable-ai.js +13 -0
- package/dist/hooks/use-unstable-ai.js.map +1 -0
- package/dist/hooks.d.ts +10 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +20 -0
- package/dist/hooks.js.map +1 -0
- package/dist/hover-repro.d.ts +2 -0
- package/dist/hover-repro.d.ts.map +1 -0
- package/dist/hover-repro.js +20 -0
- package/dist/hover-repro.js.map +1 -0
- package/dist/index.d.ts +58 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +71 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/date-picker-widget.d.ts +9 -0
- package/dist/internal/date-picker-widget.d.ts.map +1 -0
- package/dist/internal/date-picker-widget.js +380 -0
- package/dist/internal/date-picker-widget.js.map +1 -0
- package/dist/internal/dialog.d.ts +21 -0
- package/dist/internal/dialog.d.ts.map +1 -0
- package/dist/internal/dialog.js +122 -0
- package/dist/internal/dialog.js.map +1 -0
- package/dist/internal/error-handler.d.ts +2 -0
- package/dist/internal/error-handler.d.ts.map +1 -0
- package/dist/internal/error-handler.js +29 -0
- package/dist/internal/error-handler.js.map +1 -0
- package/dist/internal/focus-context.d.ts +10 -0
- package/dist/internal/focus-context.d.ts.map +1 -0
- package/dist/internal/focus-context.js +12 -0
- package/dist/internal/focus-context.js.map +1 -0
- package/dist/internal/navigation.d.ts +18 -0
- package/dist/internal/navigation.d.ts.map +1 -0
- package/dist/internal/navigation.js +83 -0
- package/dist/internal/navigation.js.map +1 -0
- package/dist/internal/providers.d.ts +8 -0
- package/dist/internal/providers.d.ts.map +1 -0
- package/dist/internal/providers.js +262 -0
- package/dist/internal/providers.js.map +1 -0
- package/dist/localstorage.d.ts +13 -0
- package/dist/localstorage.d.ts.map +1 -0
- package/dist/localstorage.js +190 -0
- package/dist/localstorage.js.map +1 -0
- package/dist/localstorage.test.d.ts +2 -0
- package/dist/localstorage.test.d.ts.map +1 -0
- package/dist/localstorage.test.js +131 -0
- package/dist/localstorage.test.js.map +1 -0
- package/dist/logger.d.ts +7 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +70 -0
- package/dist/logger.js.map +1 -0
- package/dist/oauth.d.ts +142 -0
- package/dist/oauth.d.ts.map +1 -0
- package/dist/oauth.js +551 -0
- package/dist/oauth.js.map +1 -0
- package/dist/package-json.d.ts +84 -0
- package/dist/package-json.d.ts.map +1 -0
- package/dist/package-json.js +77 -0
- package/dist/package-json.js.map +1 -0
- package/dist/preferences.d.ts +23 -0
- package/dist/preferences.d.ts.map +1 -0
- package/dist/preferences.js +105 -0
- package/dist/preferences.js.map +1 -0
- package/dist/preload.d.ts +2 -0
- package/dist/preload.d.ts.map +1 -0
- package/dist/preload.js +28 -0
- package/dist/preload.js.map +1 -0
- package/dist/state.d.ts +26 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/state.js +18 -0
- package/dist/state.js.map +1 -0
- package/dist/store-api/download.d.ts +8 -0
- package/dist/store-api/download.d.ts.map +1 -0
- package/dist/store-api/download.js +37 -0
- package/dist/store-api/download.js.map +1 -0
- package/dist/store-api/download.test.d.ts +2 -0
- package/dist/store-api/download.test.d.ts.map +1 -0
- package/dist/store-api/download.test.js +36 -0
- package/dist/store-api/download.test.js.map +1 -0
- package/dist/store-api/extension.d.ts +87 -0
- package/dist/store-api/extension.d.ts.map +1 -0
- package/dist/store-api/extension.js +23 -0
- package/dist/store-api/extension.js.map +1 -0
- package/dist/store-api/extension.test.d.ts +2 -0
- package/dist/store-api/extension.test.d.ts.map +1 -0
- package/dist/store-api/extension.test.js +22 -0
- package/dist/store-api/extension.test.js.map +1 -0
- package/dist/store-api/search.d.ts +101 -0
- package/dist/store-api/search.d.ts.map +1 -0
- package/dist/store-api/search.js +29 -0
- package/dist/store-api/search.js.map +1 -0
- package/dist/store-api/search.test.d.ts +2 -0
- package/dist/store-api/search.test.d.ts.map +1 -0
- package/dist/store-api/search.test.js +45 -0
- package/dist/store-api/search.test.js.map +1 -0
- package/dist/store.d.ts +21 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +84 -0
- package/dist/store.js.map +1 -0
- package/dist/theme.d.ts +20 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +26 -0
- package/dist/theme.js.map +1 -0
- package/dist/toast.d.ts +44 -0
- package/dist/toast.d.ts.map +1 -0
- package/dist/toast.js +221 -0
- package/dist/toast.js.map +1 -0
- package/dist/utils/file-system.d.ts +11 -0
- package/dist/utils/file-system.d.ts.map +1 -0
- package/dist/utils/file-system.js +66 -0
- package/dist/utils/file-system.js.map +1 -0
- package/dist/utils.d.ts +234 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +473 -0
- package/dist/utils.js.map +1 -0
- package/dist/utils.test.d.ts +2 -0
- package/dist/utils.test.d.ts.map +1 -0
- package/dist/utils.test.js +152 -0
- package/dist/utils.test.js.map +1 -0
- package/dist/window.d.ts +12 -0
- package/dist/window.d.ts.map +1 -0
- package/dist/window.js +48 -0
- package/dist/window.js.map +1 -0
- package/package.json +56 -0
- package/src/action-utils.tsx +207 -0
- package/src/apis/ai.tsx +177 -0
- package/src/apis/cache.test.ts +311 -0
- package/src/apis/cache.tsx +394 -0
- package/src/apis/clipboard.tsx +200 -0
- package/src/apis/environment.tsx +239 -0
- package/src/apis/hud.tsx +86 -0
- package/src/apis/localstorage.test.ts +164 -0
- package/src/apis/localstorage.tsx +215 -0
- package/src/apis/oauth.tsx +744 -0
- package/src/apis/preferences.tsx +140 -0
- package/src/apis/toast.tsx +388 -0
- package/src/apis/window.tsx +61 -0
- package/src/build.test.tsx +78 -0
- package/src/build.tsx +273 -0
- package/src/cli.tsx +328 -0
- package/src/colors.tsx +15 -0
- package/src/components/actions.tsx +718 -0
- package/src/components/alert.tsx +205 -0
- package/src/components/detail.tsx +359 -0
- package/src/components/dropdown.tsx +438 -0
- package/src/components/extension-preferences.tsx +269 -0
- package/src/components/form/assign-components.tsx +22 -0
- package/src/components/form/checkbox.tsx +96 -0
- package/src/components/form/date-picker.tsx +125 -0
- package/src/components/form/description.tsx +30 -0
- package/src/components/form/dropdown.tsx +512 -0
- package/src/components/form/file-autocomplete.tsx +141 -0
- package/src/components/form/file-picker.tsx +233 -0
- package/src/components/form/form-end.tsx +6 -0
- package/src/components/form/index.tsx +242 -0
- package/src/components/form/password-field.tsx +87 -0
- package/src/components/form/separator.tsx +15 -0
- package/src/components/form/tagpicker.tsx +245 -0
- package/src/components/form/text-area.tsx +82 -0
- package/src/components/form/text-field.tsx +82 -0
- package/src/components/form/types.tsx +49 -0
- package/src/components/form/use-form-navigation.tsx +65 -0
- package/src/components/form/with-left-border.tsx +53 -0
- package/src/components/icon.tsx +496 -0
- package/src/components/image.tsx +54 -0
- package/src/components/list.tsx +1564 -0
- package/src/components/loading-bar.tsx +141 -0
- package/src/components/menubar-extra.tsx +181 -0
- package/src/descendants.tsx +134 -0
- package/src/e2e-node.tsx +303 -0
- package/src/e2e.tsx +147 -0
- package/src/examples/action-show-in-finder.tsx +80 -0
- package/src/examples/environment-test.tsx +50 -0
- package/src/examples/error-boundary.tsx +217 -0
- package/src/examples/form-basic.tsx +122 -0
- package/src/examples/form-basic.vitest.tsx +1035 -0
- package/src/examples/form-dropdown.tsx +102 -0
- package/src/examples/form-dropdown.vitest.tsx +758 -0
- package/src/examples/form-tagpicker.tsx +66 -0
- package/src/examples/form-tagpicker.vitest.tsx +523 -0
- package/src/examples/internal/descendants-filtering.tsx +223 -0
- package/src/examples/internal/descendants.tsx +208 -0
- package/src/examples/internal/scrollbox-demo.tsx +149 -0
- package/src/examples/internal/simple-dialog.tsx +124 -0
- package/src/examples/internal/text-stacking.tsx +90 -0
- package/src/examples/list-dropdown-default.tsx +69 -0
- package/src/examples/list-dropdown-default.vitest.tsx +187 -0
- package/src/examples/list-fetch-data.tsx +123 -0
- package/src/examples/list-fetch-data.vitest.tsx +110 -0
- package/src/examples/list-with-detail.tsx +161 -0
- package/src/examples/list-with-detail.vitest.tsx +468 -0
- package/src/examples/list-with-dropdown.tsx +97 -0
- package/src/examples/list-with-dropdown.vitest.tsx +324 -0
- package/src/examples/list-with-sections.tsx +196 -0
- package/src/examples/list-with-sections.vitest.tsx +479 -0
- package/src/examples/miscellaneous.tsx +780 -0
- package/src/examples/nested-navigation.tsx +118 -0
- package/src/examples/preferences-test.tsx +82 -0
- package/src/examples/simple-dropdown.tsx +95 -0
- package/src/examples/simple-file-picker.tsx +75 -0
- package/src/examples/simple-file-picker.vitest.tsx +306 -0
- package/src/examples/simple-grid.tsx +149 -0
- package/src/examples/simple-grid.vitest.tsx +535 -0
- package/src/examples/simple-hud.tsx +60 -0
- package/src/examples/simple-list-search.tsx +93 -0
- package/src/examples/simple-list.tsx +149 -0
- package/src/examples/simple-navigation.tsx +89 -0
- package/src/examples/simple-navigation.vitest.tsx +571 -0
- package/src/examples/store.tsx +4 -0
- package/src/examples/store.vitest.tsx +59 -0
- package/src/examples/tanstack-demo.tsx +104 -0
- package/src/examples/use-promise-demo.tsx +96 -0
- package/src/extensions/dev.tsx +215 -0
- package/src/extensions/home.tsx +332 -0
- package/src/extensions/store.tsx +375 -0
- package/src/globals.ts +34 -0
- package/src/hooks/index.tsx +8 -0
- package/src/hooks/use-action-panel.tsx +28 -0
- package/src/hooks/use-id.tsx +19 -0
- package/src/hooks/use-unstable-ai.tsx +15 -0
- package/src/hooks.tsx +22 -0
- package/src/index.tsx +240 -0
- package/src/internal/date-picker-widget.tsx +500 -0
- package/src/internal/dialog.tsx +202 -0
- package/src/internal/error-handler.tsx +32 -0
- package/src/internal/focus-context.tsx +23 -0
- package/src/internal/navigation.tsx +149 -0
- package/src/internal/providers.tsx +430 -0
- package/src/logger.tsx +84 -0
- package/src/package-json.tsx +197 -0
- package/src/preload.tsx +32 -0
- package/src/state.tsx +49 -0
- package/src/store-api/download.test.tsx +38 -0
- package/src/store-api/download.tsx +52 -0
- package/src/store-api/extension.test.tsx +24 -0
- package/src/store-api/extension.tsx +123 -0
- package/src/store-api/search.test.tsx +50 -0
- package/src/store-api/search.tsx +146 -0
- package/src/theme.tsx +31 -0
- package/src/utils/file-system.ts +87 -0
- package/src/utils.test.tsx +204 -0
- package/src/utils.tsx +657 -0
package/dist/utils.js
ADDED
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@opentui/react/jsx-runtime";
|
|
2
|
+
import { render } from '@opentui/react';
|
|
3
|
+
import { Providers } from '@termcast/cli/src/internal/providers';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import fs from 'node:fs';
|
|
6
|
+
import os from 'node:os';
|
|
7
|
+
import { parsePackageJson, getCommandsWithFiles, } from './package-json';
|
|
8
|
+
import { logger } from './logger';
|
|
9
|
+
export function renderWithProviders(element) {
|
|
10
|
+
render(_jsx(Providers, { children: element }));
|
|
11
|
+
}
|
|
12
|
+
export function sleep(ms) {
|
|
13
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
14
|
+
}
|
|
15
|
+
export async function getApplications(path) {
|
|
16
|
+
// TODO: Implement system call to get applications
|
|
17
|
+
// For now, return common applications
|
|
18
|
+
const apps = [
|
|
19
|
+
{
|
|
20
|
+
name: 'Finder',
|
|
21
|
+
localizedName: 'Finder',
|
|
22
|
+
path: '/System/Library/CoreServices/Finder.app',
|
|
23
|
+
bundleId: 'com.apple.finder',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: 'Terminal',
|
|
27
|
+
localizedName: 'Terminal',
|
|
28
|
+
path: '/System/Applications/Utilities/Terminal.app',
|
|
29
|
+
bundleId: 'com.apple.Terminal',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'Visual Studio Code',
|
|
33
|
+
localizedName: 'Visual Studio Code',
|
|
34
|
+
path: '/Applications/Visual Studio Code.app',
|
|
35
|
+
bundleId: 'com.microsoft.VSCode',
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
return Promise.resolve(apps);
|
|
39
|
+
}
|
|
40
|
+
export async function getDefaultApplication(path) {
|
|
41
|
+
// TODO: Implement system call to get default application for file type
|
|
42
|
+
// For now, return a default app
|
|
43
|
+
const defaultApp = {
|
|
44
|
+
name: 'Finder',
|
|
45
|
+
localizedName: 'Finder',
|
|
46
|
+
path: '/System/Library/CoreServices/Finder.app',
|
|
47
|
+
bundleId: 'com.apple.finder',
|
|
48
|
+
};
|
|
49
|
+
return Promise.resolve(defaultApp);
|
|
50
|
+
}
|
|
51
|
+
export async function getFrontmostApplication() {
|
|
52
|
+
// TODO: Implement system call to get frontmost application
|
|
53
|
+
// For now, return Terminal as default
|
|
54
|
+
const frontmostApp = {
|
|
55
|
+
name: 'Terminal',
|
|
56
|
+
localizedName: 'Terminal',
|
|
57
|
+
path: '/System/Applications/Utilities/Terminal.app',
|
|
58
|
+
bundleId: 'com.apple.Terminal',
|
|
59
|
+
};
|
|
60
|
+
return Promise.resolve(frontmostApp);
|
|
61
|
+
}
|
|
62
|
+
export async function showInFinder(path) {
|
|
63
|
+
// TODO: Implement system call to show file in Finder
|
|
64
|
+
const pathStr = typeof path === 'string' ? path : path.toString();
|
|
65
|
+
console.log(`[showInFinder] Would open: ${pathStr}`);
|
|
66
|
+
return Promise.resolve();
|
|
67
|
+
}
|
|
68
|
+
export async function trash(path) {
|
|
69
|
+
// TODO: Implement system call to move files to trash
|
|
70
|
+
const paths = Array.isArray(path) ? path : [path];
|
|
71
|
+
const pathStrs = paths.map((p) => (typeof p === 'string' ? p : p.toString()));
|
|
72
|
+
console.log(`[trash] Would trash: ${pathStrs.join(', ')}`);
|
|
73
|
+
return Promise.resolve();
|
|
74
|
+
}
|
|
75
|
+
export async function open(target, application) {
|
|
76
|
+
// TODO: Implement system call to open file/URL with application
|
|
77
|
+
const appName = typeof application === 'string' ? application : application?.name;
|
|
78
|
+
console.log(`[open] Would open ${target}${appName ? ` with ${appName}` : ''}`);
|
|
79
|
+
return Promise.resolve();
|
|
80
|
+
}
|
|
81
|
+
export function captureException(exception) {
|
|
82
|
+
// TODO: Implement error reporting to Developer Hub
|
|
83
|
+
console.error('[captureException] Exception captured:', exception);
|
|
84
|
+
}
|
|
85
|
+
export function getExtensionPath(extensionName) {
|
|
86
|
+
const storeDir = getStoreDirectory();
|
|
87
|
+
return path.join(storeDir, extensionName);
|
|
88
|
+
}
|
|
89
|
+
export function getExtensionPackageJsonPath(extensionName) {
|
|
90
|
+
return path.join(getExtensionPath(extensionName), 'package.json');
|
|
91
|
+
}
|
|
92
|
+
export function getExtensionPackageJson(extensionName) {
|
|
93
|
+
const packageJsonPath = getExtensionPackageJsonPath(extensionName);
|
|
94
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
try {
|
|
98
|
+
return parsePackageJson({ packageJsonPath });
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
console.error(`Failed to parse package.json for ${extensionName}:`, error);
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
export function checkExtensionPreferences(extensionName) {
|
|
106
|
+
const packageJson = getExtensionPackageJson(extensionName);
|
|
107
|
+
if (!packageJson) {
|
|
108
|
+
return { hasPreferences: false, hasRequiredPreferences: false };
|
|
109
|
+
}
|
|
110
|
+
// Check for extension-wide preferences
|
|
111
|
+
const hasExtensionPreferences = packageJson.preferences && packageJson.preferences.length > 0;
|
|
112
|
+
// Check if any command has preferences
|
|
113
|
+
const commandsWithPreferences = (packageJson.commands || []).filter((cmd) => cmd.preferences && cmd.preferences.length > 0);
|
|
114
|
+
const hasPreferences = hasExtensionPreferences || commandsWithPreferences.length > 0;
|
|
115
|
+
// Check for required extension-wide preferences
|
|
116
|
+
const requiredExtensionPrefs = (packageJson.preferences || []).filter((pref) => pref.required);
|
|
117
|
+
// Check if any command has required preferences
|
|
118
|
+
const commandsWithRequiredPrefs = (packageJson.commands || []).filter((cmd) => {
|
|
119
|
+
const requiredPrefs = (cmd.preferences || []).filter((pref) => pref.required);
|
|
120
|
+
return requiredPrefs.length > 0;
|
|
121
|
+
});
|
|
122
|
+
const hasRequiredPreferences = requiredExtensionPrefs.length > 0 || commandsWithRequiredPrefs.length > 0;
|
|
123
|
+
return { hasPreferences, hasRequiredPreferences };
|
|
124
|
+
}
|
|
125
|
+
export function resolveCommandPath({ commandName, dir, }) {
|
|
126
|
+
// First check for .termcast-bundle directory
|
|
127
|
+
const bundleDir = path.join(dir, '.termcast-bundle');
|
|
128
|
+
const bundledPath = path.join(bundleDir, `${commandName}.js`);
|
|
129
|
+
if (fs.existsSync(bundledPath)) {
|
|
130
|
+
return bundledPath;
|
|
131
|
+
}
|
|
132
|
+
// Then check for top-level command file
|
|
133
|
+
const topLevelPath = path.join(dir, `${commandName}.js`);
|
|
134
|
+
if (fs.existsSync(topLevelPath)) {
|
|
135
|
+
return topLevelPath;
|
|
136
|
+
}
|
|
137
|
+
// Return empty string if not found
|
|
138
|
+
return '';
|
|
139
|
+
}
|
|
140
|
+
export function getStoreDirectory() {
|
|
141
|
+
const homeDir = os.homedir();
|
|
142
|
+
const storeDir = path.join(homeDir, '.termcast', 'store');
|
|
143
|
+
// Ensure store directory exists
|
|
144
|
+
if (!fs.existsSync(storeDir)) {
|
|
145
|
+
fs.mkdirSync(storeDir, { recursive: true });
|
|
146
|
+
}
|
|
147
|
+
return storeDir;
|
|
148
|
+
}
|
|
149
|
+
export function installExtension({ extensionName, extensionSourcePath, }) {
|
|
150
|
+
const storeDir = getStoreDirectory();
|
|
151
|
+
const extensionDir = path.join(storeDir, extensionName);
|
|
152
|
+
// Remove existing extension directory if it exists
|
|
153
|
+
if (fs.existsSync(extensionDir)) {
|
|
154
|
+
fs.rmSync(extensionDir, { recursive: true, force: true });
|
|
155
|
+
}
|
|
156
|
+
// Create extension directory
|
|
157
|
+
fs.mkdirSync(extensionDir, { recursive: true });
|
|
158
|
+
// Copy entire extension source directory
|
|
159
|
+
fs.cpSync(extensionSourcePath, extensionDir, { recursive: true });
|
|
160
|
+
logger.log(`Extension '${extensionName}' installed to ${extensionDir}`);
|
|
161
|
+
}
|
|
162
|
+
export function getStoredExtensions() {
|
|
163
|
+
const storeDir = getStoreDirectory();
|
|
164
|
+
const extensions = [];
|
|
165
|
+
if (!fs.existsSync(storeDir)) {
|
|
166
|
+
return extensions;
|
|
167
|
+
}
|
|
168
|
+
const entries = fs.readdirSync(storeDir, { withFileTypes: true });
|
|
169
|
+
for (const entry of entries) {
|
|
170
|
+
if (!entry.isDirectory())
|
|
171
|
+
continue;
|
|
172
|
+
const extensionDir = path.join(storeDir, entry.name);
|
|
173
|
+
const packageJsonPath = path.join(extensionDir, 'package.json');
|
|
174
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
175
|
+
logger.log(`Skipping ${entry.name}: no package.json found`);
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
try {
|
|
179
|
+
const commandsData = getCommandsWithFiles({ packageJsonPath });
|
|
180
|
+
// Map commands to bundled commands using the resolver
|
|
181
|
+
const bundledCommands = commandsData.commands.map((command) => {
|
|
182
|
+
const bundledPath = resolveCommandPath({
|
|
183
|
+
commandName: command.name,
|
|
184
|
+
dir: extensionDir,
|
|
185
|
+
});
|
|
186
|
+
return {
|
|
187
|
+
...command,
|
|
188
|
+
bundledPath,
|
|
189
|
+
};
|
|
190
|
+
});
|
|
191
|
+
extensions.push({
|
|
192
|
+
name: entry.name,
|
|
193
|
+
packageJsonPath,
|
|
194
|
+
commands: bundledCommands,
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
logger.error(`Failed to load extension ${entry.name}:`, error.message);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return extensions;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Executes an AppleScript or JavaScript for Automation script on macOS.
|
|
205
|
+
*
|
|
206
|
+
* This function provides a way to interact with macOS system features and applications
|
|
207
|
+
* through AppleScript or JavaScript for Automation (JXA). Only available on macOS.
|
|
208
|
+
*
|
|
209
|
+
* @param script - The AppleScript or JavaScript code to execute
|
|
210
|
+
* @param arguments_ - Optional array of arguments to pass to the script
|
|
211
|
+
* @param options - Execution options
|
|
212
|
+
* @param options.humanReadableOutput - Whether to format output for human readability (default: true)
|
|
213
|
+
* @param options.language - Script language: "AppleScript" (default) or "JavaScript"
|
|
214
|
+
* @param options.signal - AbortSignal to cancel execution
|
|
215
|
+
* @param options.timeout - Maximum execution time in milliseconds (default: 10000)
|
|
216
|
+
* @param options.parseOutput - Custom function to parse the script output
|
|
217
|
+
* @returns A Promise that resolves to the script output (string by default, or custom type if parseOutput is provided)
|
|
218
|
+
* @throws Error if not running on macOS or if script execution fails
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* ```typescript
|
|
222
|
+
* // Simple AppleScript
|
|
223
|
+
* const result = await runAppleScript('return "Hello World"')
|
|
224
|
+
*
|
|
225
|
+
* // AppleScript with arguments
|
|
226
|
+
* const greeting = await runAppleScript(
|
|
227
|
+
* 'return "Hello " & item 1 of argv',
|
|
228
|
+
* ['John']
|
|
229
|
+
* )
|
|
230
|
+
*
|
|
231
|
+
* // JavaScript for Automation
|
|
232
|
+
* const apps = await runAppleScript(
|
|
233
|
+
* 'Application("System Events").processes.name()',
|
|
234
|
+
* undefined,
|
|
235
|
+
* { language: 'JavaScript' }
|
|
236
|
+
* )
|
|
237
|
+
*
|
|
238
|
+
* // Custom output parsing
|
|
239
|
+
* interface SystemInfo {
|
|
240
|
+
* name: string
|
|
241
|
+
* version: string
|
|
242
|
+
* }
|
|
243
|
+
* const info = await runAppleScript<SystemInfo>(
|
|
244
|
+
* 'return "{\\"name\\": \\"macOS\\", \\"version\\": \\"14.0\\"}"',
|
|
245
|
+
* undefined,
|
|
246
|
+
* { parseOutput: ({ stdout }) => JSON.parse(stdout) }
|
|
247
|
+
* )
|
|
248
|
+
* ```
|
|
249
|
+
*/
|
|
250
|
+
export async function runAppleScript(script, arguments_, options) {
|
|
251
|
+
if (process.platform !== 'darwin') {
|
|
252
|
+
throw new Error('runAppleScript is only supported on macOS');
|
|
253
|
+
}
|
|
254
|
+
const { exec } = await import('node:child_process');
|
|
255
|
+
const { promisify } = await import('node:util');
|
|
256
|
+
const execAsync = promisify(exec);
|
|
257
|
+
const language = options?.language || 'AppleScript';
|
|
258
|
+
const timeout = options?.timeout || 10000;
|
|
259
|
+
const parseOutput = options?.parseOutput;
|
|
260
|
+
let command;
|
|
261
|
+
let fullScript = script;
|
|
262
|
+
if (arguments_ && arguments_.length > 0) {
|
|
263
|
+
if (language === 'AppleScript') {
|
|
264
|
+
const args = arguments_
|
|
265
|
+
.map((arg) => `"${arg.replace(/"/g, '\\"')}"`)
|
|
266
|
+
.join(', ');
|
|
267
|
+
// Check if the script already has an "on run" handler
|
|
268
|
+
if (script.includes('on run')) {
|
|
269
|
+
fullScript = script;
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
fullScript = `on run argv\n${script}\nend run`;
|
|
273
|
+
}
|
|
274
|
+
// Execute with arguments passed separately
|
|
275
|
+
command = `osascript ${options?.humanReadableOutput === false ? '' : '-ss'} -e '${fullScript.replace(/'/g, "'\"'\"'")}' ${args}`;
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
// JavaScript for Automation
|
|
279
|
+
const args = arguments_.map((arg) => `'${arg.replace(/'/g, "\\'")}'`);
|
|
280
|
+
fullScript = `const argv = [${args.join(', ')}];\n${script}`;
|
|
281
|
+
const wrappedScript = `(function() { ${fullScript.replace(/'/g, "'\"'\"'")} })()`;
|
|
282
|
+
command = `osascript -l JavaScript -e '${wrappedScript}'`;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
const escapedScript = fullScript.replace(/'/g, "'\"'\"'");
|
|
287
|
+
if (language === 'JavaScript') {
|
|
288
|
+
// For JavaScript, wrap in a function to allow return statements
|
|
289
|
+
const wrappedScript = `(function() { ${escapedScript} })()`;
|
|
290
|
+
command = `osascript -l JavaScript -e '${wrappedScript}'`;
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
command = `osascript ${options?.humanReadableOutput === false ? '' : '-ss'} -e '${escapedScript}'`;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
try {
|
|
297
|
+
const { stdout, stderr } = await execAsync(command, {
|
|
298
|
+
timeout,
|
|
299
|
+
signal: options?.signal,
|
|
300
|
+
});
|
|
301
|
+
if (stderr) {
|
|
302
|
+
throw new Error(stderr);
|
|
303
|
+
}
|
|
304
|
+
let result = stdout.trim();
|
|
305
|
+
// Remove surrounding quotes if present (AppleScript returns quoted strings)
|
|
306
|
+
if (result.startsWith('"') &&
|
|
307
|
+
result.endsWith('"') &&
|
|
308
|
+
options?.humanReadableOutput !== false) {
|
|
309
|
+
result = result.slice(1, -1);
|
|
310
|
+
}
|
|
311
|
+
if (parseOutput) {
|
|
312
|
+
return parseOutput({ stdout: result });
|
|
313
|
+
}
|
|
314
|
+
return result;
|
|
315
|
+
}
|
|
316
|
+
catch (error) {
|
|
317
|
+
if (error.code === 'ETIMEDOUT') {
|
|
318
|
+
throw new Error(`AppleScript execution timed out after ${timeout}ms`);
|
|
319
|
+
}
|
|
320
|
+
throw error;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
export var LaunchType;
|
|
324
|
+
(function (LaunchType) {
|
|
325
|
+
LaunchType["UserInitiated"] = "userInitiated";
|
|
326
|
+
LaunchType["Background"] = "background";
|
|
327
|
+
})(LaunchType || (LaunchType = {}));
|
|
328
|
+
export var DeeplinkType;
|
|
329
|
+
(function (DeeplinkType) {
|
|
330
|
+
DeeplinkType["Extension"] = "extension";
|
|
331
|
+
DeeplinkType["ScriptCommand"] = "script-command";
|
|
332
|
+
})(DeeplinkType || (DeeplinkType = {}));
|
|
333
|
+
/**
|
|
334
|
+
* Creates a Raycast deeplink URL for extensions or script commands.
|
|
335
|
+
*
|
|
336
|
+
* Deeplinks allow you to launch Raycast commands from external applications or share
|
|
337
|
+
* direct links to specific functionality. Supports both installed extensions and
|
|
338
|
+
* script commands.
|
|
339
|
+
*
|
|
340
|
+
* @param options - Configuration for the deeplink
|
|
341
|
+
* @param options.type - Type of deeplink: DeeplinkType.Extension (default) or DeeplinkType.ScriptCommand
|
|
342
|
+
* @param options.command - The command name to execute
|
|
343
|
+
* @param options.launchType - How to launch the command: LaunchType.UserInitiated or LaunchType.Background (extension only)
|
|
344
|
+
* @param options.arguments - Arguments to pass to the command (extension: any object, script: string array)
|
|
345
|
+
* @param options.fallbackText - Text to show if the command is not available (extension only)
|
|
346
|
+
* @param options.ownerOrAuthorName - The owner or author name for published extensions (extension only)
|
|
347
|
+
* @param options.extensionName - The extension name (extension only)
|
|
348
|
+
* @returns A Raycast deeplink URL string
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* ```typescript
|
|
352
|
+
* // Extension deeplink
|
|
353
|
+
* const extensionUrl = createDeeplink({
|
|
354
|
+
* command: 'search-notes',
|
|
355
|
+
* extensionName: 'notion',
|
|
356
|
+
* ownerOrAuthorName: 'raycast',
|
|
357
|
+
* arguments: { query: 'meeting notes' },
|
|
358
|
+
* fallbackText: 'Search Notion'
|
|
359
|
+
* })
|
|
360
|
+
* // Returns: "raycast://extensions/raycast/notion/search-notes?fallbackText=Search+Notion&arguments=%257B%2522query%2522%253A%2522meeting%2520notes%2522%257D"
|
|
361
|
+
*
|
|
362
|
+
* // Script command deeplink
|
|
363
|
+
* const scriptUrl = createDeeplink({
|
|
364
|
+
* type: DeeplinkType.ScriptCommand,
|
|
365
|
+
* command: 'toggle-system-appearance',
|
|
366
|
+
* arguments: ['dark']
|
|
367
|
+
* })
|
|
368
|
+
* // Returns: "raycast://script-commands/toggle-system-appearance?name=toggle-system-appearance&arguments=dark"
|
|
369
|
+
*
|
|
370
|
+
* // Background launch
|
|
371
|
+
* const backgroundUrl = createDeeplink({
|
|
372
|
+
* command: 'sync-data',
|
|
373
|
+
* launchType: LaunchType.Background,
|
|
374
|
+
* extensionName: 'my-extension'
|
|
375
|
+
* })
|
|
376
|
+
* ```
|
|
377
|
+
*/
|
|
378
|
+
export function createDeeplink(options) {
|
|
379
|
+
const baseUrl = 'raycast://';
|
|
380
|
+
if (options.type === DeeplinkType.ScriptCommand) {
|
|
381
|
+
const params = new URLSearchParams();
|
|
382
|
+
params.set('name', options.command);
|
|
383
|
+
if (options.arguments && options.arguments.length > 0) {
|
|
384
|
+
params.set('arguments', options.arguments.join('\t'));
|
|
385
|
+
}
|
|
386
|
+
return `${baseUrl}script-commands/${options.command}?${params.toString()}`;
|
|
387
|
+
}
|
|
388
|
+
// Extension deeplink
|
|
389
|
+
const extensionOptions = options;
|
|
390
|
+
const params = new URLSearchParams();
|
|
391
|
+
if (extensionOptions.fallbackText) {
|
|
392
|
+
params.set('fallbackText', extensionOptions.fallbackText);
|
|
393
|
+
}
|
|
394
|
+
if (extensionOptions.launchType) {
|
|
395
|
+
params.set('launchType', extensionOptions.launchType);
|
|
396
|
+
}
|
|
397
|
+
if (extensionOptions.arguments) {
|
|
398
|
+
params.set('arguments', encodeURIComponent(JSON.stringify(extensionOptions.arguments)));
|
|
399
|
+
}
|
|
400
|
+
let path = 'extensions';
|
|
401
|
+
if (extensionOptions.ownerOrAuthorName && extensionOptions.extensionName) {
|
|
402
|
+
path = `${path}/${extensionOptions.ownerOrAuthorName}/${extensionOptions.extensionName}`;
|
|
403
|
+
}
|
|
404
|
+
else if (extensionOptions.extensionName) {
|
|
405
|
+
path = `${path}/${extensionOptions.extensionName}`;
|
|
406
|
+
}
|
|
407
|
+
const queryString = params.toString();
|
|
408
|
+
const url = `${baseUrl}${path}/${extensionOptions.command}${queryString ? '?' + queryString : ''}`;
|
|
409
|
+
return url;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Executes a SQL query on a local SQLite database and returns the results.
|
|
413
|
+
*
|
|
414
|
+
* This function provides read-only access to SQLite databases, useful for querying
|
|
415
|
+
* application data, browser history, or other local SQLite-based storage.
|
|
416
|
+
*
|
|
417
|
+
* @param databasePath - Absolute path to the SQLite database file
|
|
418
|
+
* @param query - SQL query to execute (SELECT statements recommended)
|
|
419
|
+
* @returns A Promise that resolves to an array of result objects
|
|
420
|
+
* @throws Error if the database file doesn't exist or query execution fails
|
|
421
|
+
* @template T - Type of the expected result objects (default: unknown)
|
|
422
|
+
*
|
|
423
|
+
* @example
|
|
424
|
+
* ```typescript
|
|
425
|
+
* // Query browser bookmarks
|
|
426
|
+
* interface Bookmark {
|
|
427
|
+
* title: string
|
|
428
|
+
* url: string
|
|
429
|
+
* date_added: number
|
|
430
|
+
* }
|
|
431
|
+
* const bookmarks = await executeSQL<Bookmark>(
|
|
432
|
+
* '/Users/john/Library/Safari/Bookmarks.db',
|
|
433
|
+
* 'SELECT title, url, date_added FROM bookmarks ORDER BY date_added DESC LIMIT 10'
|
|
434
|
+
* )
|
|
435
|
+
*
|
|
436
|
+
* // Query application data
|
|
437
|
+
* const appData = await executeSQL(
|
|
438
|
+
* '/path/to/app.db',
|
|
439
|
+
* 'SELECT * FROM settings WHERE key = "theme"'
|
|
440
|
+
* )
|
|
441
|
+
*
|
|
442
|
+
* // Aggregate query
|
|
443
|
+
* interface Stats {
|
|
444
|
+
* total: number
|
|
445
|
+
* average: number
|
|
446
|
+
* }
|
|
447
|
+
* const stats = await executeSQL<Stats>(
|
|
448
|
+
* '/path/to/data.db',
|
|
449
|
+
* 'SELECT COUNT(*) as total, AVG(score) as average FROM results'
|
|
450
|
+
* )
|
|
451
|
+
* ```
|
|
452
|
+
*/
|
|
453
|
+
export async function executeSQL(databasePath, query) {
|
|
454
|
+
const { Database } = await import('bun:sqlite');
|
|
455
|
+
if (!fs.existsSync(databasePath)) {
|
|
456
|
+
throw new Error(`Database file not found: ${databasePath}`);
|
|
457
|
+
}
|
|
458
|
+
const db = new Database(databasePath, {
|
|
459
|
+
readonly: true,
|
|
460
|
+
});
|
|
461
|
+
try {
|
|
462
|
+
const stmt = db.prepare(query);
|
|
463
|
+
const results = stmt.all();
|
|
464
|
+
return results;
|
|
465
|
+
}
|
|
466
|
+
catch (error) {
|
|
467
|
+
throw new Error(`SQL execution failed: ${error.message}`);
|
|
468
|
+
}
|
|
469
|
+
finally {
|
|
470
|
+
db.close();
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AAChE,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,EACL,gBAAgB,EAEhB,oBAAoB,GAErB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,MAAM,UAAU,mBAAmB,CAAC,OAAkB;IACpD,MAAM,CAAC,KAAC,SAAS,cAAE,OAAO,GAAa,CAAC,CAAA;AAC1C,CAAC;AAeD,MAAM,UAAU,KAAK,CAAC,EAAU;IAC9B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA;AAC1D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,IAAe;IACnD,kDAAkD;IAClD,sCAAsC;IACtC,MAAM,IAAI,GAAkB;QAC1B;YACE,IAAI,EAAE,QAAQ;YACd,aAAa,EAAE,QAAQ;YACvB,IAAI,EAAE,yCAAyC;YAC/C,QAAQ,EAAE,kBAAkB;SAC7B;QACD;YACE,IAAI,EAAE,UAAU;YAChB,aAAa,EAAE,UAAU;YACzB,IAAI,EAAE,6CAA6C;YACnD,QAAQ,EAAE,oBAAoB;SAC/B;QACD;YACE,IAAI,EAAE,oBA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,CAAC,CAAC,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAAA;IAElG,OAAO,GAAG,CAAA;AACZ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,YAAoB,EACpB,KAAa;IAEb,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAA;IAE/C,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,4BAA4B,YAAY,EAAE,CAAC,CAAA;IAC7D,CAAC;IAED,MAAM,EAAE,GAAG,IAAI,QAAQ,CAAC,YAAY,EAAE;QACpC,QAAQ,EAAE,IAAI;KACf,CAAC,CAAA;IAEF,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAS,CAAA;QACjC,OAAO,OAAO,CAAA;IAChB,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,yBAAyB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;IAC3D,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAA;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.test.d.ts","sourceRoot":"","sources":["../src/utils.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { describe, test, expect, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import { createDeeplink, DeeplinkType, LaunchType, executeSQL, runAppleScript, } from './utils';
|
|
3
|
+
import { Database } from 'bun:sqlite';
|
|
4
|
+
import * as fs from 'fs';
|
|
5
|
+
import * as os from 'os';
|
|
6
|
+
import * as path from 'path';
|
|
7
|
+
describe('createDeeplink', () => {
|
|
8
|
+
test('creates extension deeplink without options', () => {
|
|
9
|
+
const url = createDeeplink({
|
|
10
|
+
command: 'my-command',
|
|
11
|
+
});
|
|
12
|
+
expect(url).toMatchInlineSnapshot(`"raycast://extensions/my-command"`);
|
|
13
|
+
});
|
|
14
|
+
test('creates extension deeplink with all options', () => {
|
|
15
|
+
const url = createDeeplink({
|
|
16
|
+
command: 'my-command',
|
|
17
|
+
launchType: LaunchType.Background,
|
|
18
|
+
arguments: { foo: 'bar', count: 42 },
|
|
19
|
+
fallbackText: 'Fallback text',
|
|
20
|
+
ownerOrAuthorName: 'john-doe',
|
|
21
|
+
extensionName: 'my-extension',
|
|
22
|
+
});
|
|
23
|
+
expect(url).toMatchInlineSnapshot(`"raycast://extensions/john-doe/my-extension/my-command?fallbackText=Fallback+text&launchType=background&arguments=%257B%2522foo%2522%253A%2522bar%2522%252C%2522count%2522%253A42%257D"`);
|
|
24
|
+
});
|
|
25
|
+
test('creates extension deeplink with only extension name', () => {
|
|
26
|
+
const url = createDeeplink({
|
|
27
|
+
command: 'my-command',
|
|
28
|
+
extensionName: 'my-extension',
|
|
29
|
+
fallbackText: 'Open extension',
|
|
30
|
+
});
|
|
31
|
+
expect(url).toMatchInlineSnapshot(`"raycast://extensions/my-extension/my-command?fallbackText=Open+extension"`);
|
|
32
|
+
});
|
|
33
|
+
test('creates script command deeplink', () => {
|
|
34
|
+
const url = createDeeplink({
|
|
35
|
+
type: DeeplinkType.ScriptCommand,
|
|
36
|
+
command: 'my-script',
|
|
37
|
+
arguments: ['arg1', 'arg2', 'arg3'],
|
|
38
|
+
});
|
|
39
|
+
expect(url).toMatchInlineSnapshot(`"raycast://script-commands/my-script?name=my-script&arguments=arg1%09arg2%09arg3"`);
|
|
40
|
+
});
|
|
41
|
+
test('creates script command deeplink without arguments', () => {
|
|
42
|
+
const url = createDeeplink({
|
|
43
|
+
type: DeeplinkType.ScriptCommand,
|
|
44
|
+
command: 'my-script',
|
|
45
|
+
});
|
|
46
|
+
expect(url).toMatchInlineSnapshot(`"raycast://script-commands/my-script?name=my-script"`);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
describe('executeSQL', () => {
|
|
50
|
+
const testDbPath = path.join(os.tmpdir(), 'test-db.sqlite');
|
|
51
|
+
beforeEach(() => {
|
|
52
|
+
// Create a test database
|
|
53
|
+
const db = new Database(testDbPath);
|
|
54
|
+
db.exec(`
|
|
55
|
+
CREATE TABLE users (
|
|
56
|
+
id INTEGER PRIMARY KEY,
|
|
57
|
+
name TEXT NOT NULL,
|
|
58
|
+
age INTEGER
|
|
59
|
+
)
|
|
60
|
+
`);
|
|
61
|
+
db.exec(`
|
|
62
|
+
INSERT INTO users (name, age) VALUES
|
|
63
|
+
('Alice', 30),
|
|
64
|
+
('Bob', 25),
|
|
65
|
+
('Charlie', 35)
|
|
66
|
+
`);
|
|
67
|
+
db.close();
|
|
68
|
+
});
|
|
69
|
+
afterEach(() => {
|
|
70
|
+
// Clean up test database
|
|
71
|
+
if (fs.existsSync(testDbPath)) {
|
|
72
|
+
fs.unlinkSync(testDbPath);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
test('executes SELECT query', async () => {
|
|
76
|
+
const results = await executeSQL(testDbPath, 'SELECT * FROM users ORDER BY age');
|
|
77
|
+
expect(results).toMatchInlineSnapshot(`
|
|
78
|
+
[
|
|
79
|
+
{
|
|
80
|
+
"age": 25,
|
|
81
|
+
"id": 2,
|
|
82
|
+
"name": "Bob",
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"age": 30,
|
|
86
|
+
"id": 1,
|
|
87
|
+
"name": "Alice",
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"age": 35,
|
|
91
|
+
"id": 3,
|
|
92
|
+
"name": "Charlie",
|
|
93
|
+
},
|
|
94
|
+
]
|
|
95
|
+
`);
|
|
96
|
+
});
|
|
97
|
+
test('executes query with WHERE clause', async () => {
|
|
98
|
+
const results = await executeSQL(testDbPath, 'SELECT name FROM users WHERE age > 30');
|
|
99
|
+
expect(results).toMatchInlineSnapshot(`
|
|
100
|
+
[
|
|
101
|
+
{
|
|
102
|
+
"name": "Charlie",
|
|
103
|
+
},
|
|
104
|
+
]
|
|
105
|
+
`);
|
|
106
|
+
});
|
|
107
|
+
test('throws error for non-existent database', async () => {
|
|
108
|
+
await expect(executeSQL('/non/existent/path.db', 'SELECT 1')).rejects.toThrow('Database file not found');
|
|
109
|
+
});
|
|
110
|
+
test('throws error for invalid SQL', async () => {
|
|
111
|
+
await expect(executeSQL(testDbPath, 'INVALID SQL QUERY')).rejects.toThrow('SQL execution failed');
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
describe('runAppleScript', () => {
|
|
115
|
+
test('throws error on non-macOS platforms', async () => {
|
|
116
|
+
if (process.platform !== 'darwin') {
|
|
117
|
+
await expect(runAppleScript('return "Hello"')).rejects.toThrow('runAppleScript is only supported on macOS');
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
// These tests will only run on macOS
|
|
121
|
+
if (process.platform === 'darwin') {
|
|
122
|
+
test('executes simple AppleScript', async () => {
|
|
123
|
+
const result = await runAppleScript('return "Hello World"');
|
|
124
|
+
expect(result).toBe('Hello World');
|
|
125
|
+
});
|
|
126
|
+
test('executes AppleScript with arguments', async () => {
|
|
127
|
+
const script = `return "Hello " & item 1 of argv & " " & item 2 of argv`;
|
|
128
|
+
const result = await runAppleScript(script, ['John', 'Doe']);
|
|
129
|
+
expect(result).toBe('Hello John, Doe');
|
|
130
|
+
});
|
|
131
|
+
test('executes JavaScript for Automation', async () => {
|
|
132
|
+
const result = await runAppleScript('return "Hello from JS"', undefined, {
|
|
133
|
+
language: 'JavaScript',
|
|
134
|
+
});
|
|
135
|
+
expect(result).toBe('Hello from JS');
|
|
136
|
+
});
|
|
137
|
+
test('parses custom output', async () => {
|
|
138
|
+
const result = await runAppleScript('return "{\\"message\\": \\"Test\\", \\"count\\": 42}"', undefined, {
|
|
139
|
+
humanReadableOutput: false, // Keep the raw quoted output for JSON parsing
|
|
140
|
+
parseOutput: ({ stdout }) => {
|
|
141
|
+
// Remove surrounding quotes from AppleScript output
|
|
142
|
+
const jsonStr = stdout.startsWith('"') && stdout.endsWith('"')
|
|
143
|
+
? stdout.slice(1, -1).replace(/\\"/g, '"')
|
|
144
|
+
: stdout;
|
|
145
|
+
return JSON.parse(jsonStr);
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
expect(result).toEqual({ message: 'Test', count: 42 });
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
//# sourceMappingURL=utils.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.test.js","sourceRoot":"","sources":["../src/utils.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AACtE,OAAO,EACL,cAAc,EACd,YAAY,EACZ,UAAU,EACV,UAAU,EACV,cAAc,GACf,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAE5B,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,IAAI,CAAC,4CAA4C,EAAE,GAAG,EAAE;QACtD,MAAM,GAAG,GAAG,cAAc,CAAC;YACzB,OAAO,EAAE,YAAY;SACtB,CAAC,CAAA;QACF,MAAM,CAAC,GAAG,CAAC,CAAC,qBAAqB,CAAC,mCAAmC,CAAC,CAAA;IACxE,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACvD,MAAM,GAAG,G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