@termix-ssh/plugin-sdk 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/LICENSE +202 -0
  3. package/README.md +3 -2
  4. package/cli/commands/build.mjs +37 -12
  5. package/cli/commands/dev.mjs +1 -1
  6. package/cli/commands/openapi.mjs +39 -0
  7. package/cli/commands/validate.mjs +67 -0
  8. package/cli/index.mjs +3 -0
  9. package/cli/lib/css-classes.mjs +37 -0
  10. package/dist/docs.d.ts +28 -0
  11. package/dist/docs.js +39 -0
  12. package/dist/frontend.d.ts +17 -0
  13. package/dist/frontend.js +8 -0
  14. package/dist/host/{chunk-LKYAVM4T.js → chunk-F5RZH6HE.js} +13 -2
  15. package/dist/host/{chunk-XKMRKQFN.js → chunk-O2OHNVFX.js} +1 -1
  16. package/dist/host/{chunk-SS43S6VI.js → chunk-RU4E5XLY.js} +453 -287
  17. package/dist/host/core-classes.json +1 -0
  18. package/dist/host/{linked-server-DW5P3NLZ.js → linked-server-4VWYYABP.js} +1 -1
  19. package/dist/host/{rbac-api-JKISXZEP.js → rbac-api-WIJVZH3M.js} +1 -1
  20. package/dist/host/testing-host.js +3 -3
  21. package/dist/host/types/src/ui/api/plugins-api.d.ts +6 -0
  22. package/dist/host/types/src/ui/components/docs-link.d.ts +25 -0
  23. package/dist/host/types/src/ui/components/panel-layout.d.ts +3 -1
  24. package/dist/host/types/src/ui/lib/docs.d.ts +10 -0
  25. package/dist/host/types/src/ui/main-axios.d.ts +1 -0
  26. package/dist/host/types/src/ui/plugin-host/sdk-ui.d.ts +1 -0
  27. package/dist/host/ui.js +6 -3
  28. package/dist/host/{use-permissions-5CZEA3P4.js → use-permissions-KIQCJ35M.js} +1 -1
  29. package/dist/manifest.d.ts +7 -1
  30. package/dist/manifest.js +48 -1
  31. package/dist/openapi.d.ts +43 -0
  32. package/dist/openapi.js +60 -0
  33. package/dist/testing/setup.js +1 -0
  34. package/package.json +10 -1
  35. package/schema/manifest.schema.json +21 -0
package/dist/frontend.js CHANGED
@@ -49,6 +49,14 @@ function requireHost() {
49
49
  export function usePluginId() {
50
50
  return requireHost().usePluginId();
51
51
  }
52
+ /**
53
+ * A page of this plugin's docs, or null when the manifest has no docs link.
54
+ * Pass it to PanelShell's docs prop or use DocsLink. Needs plugin API 1.2.
55
+ */
56
+ export function useDocsUrl(page, anchor) {
57
+ const bridge = requireHost();
58
+ return bridge.useDocsUrl(bridge.usePluginId(), page, anchor);
59
+ }
52
60
  /**
53
61
  * Translation bound to this plugin's namespace. Keys the plugin does not
54
62
  * define fall back to core's shared strings (common.*, hosts.*).
@@ -5037,7 +5037,7 @@ async function updateRole(roleId, roleData) {
5037
5037
  try {
5038
5038
  const response = await rbacApi.put(`/rbac/roles/${roleId}`, roleData);
5039
5039
  if (roleData.permissions) {
5040
- const { notifyPermissionsChanged } = await import("./use-permissions-5CZEA3P4.js");
5040
+ const { notifyPermissionsChanged } = await import("./use-permissions-KIQCJ35M.js");
5041
5041
  notifyPermissionsChanged();
5042
5042
  }
5043
5043
  return response.data;
@@ -5266,6 +5266,7 @@ async function getUserPreferences() {
5266
5266
  }
5267
5267
 
5268
5268
  // src/ui/main-axios.ts
5269
+ var TRUST_TOKEN_KEY = "termixTrustToken";
5269
5270
  function getLoggerForService(serviceName) {
5270
5271
  if (serviceName.includes("SSH") || serviceName.includes("ssh")) {
5271
5272
  return sshLogger;
@@ -5427,6 +5428,15 @@ function createApiInstance(baseURL, serviceName = "API") {
5427
5428
  config.headers["Authorization"] = `Bearer ${jwt}`;
5428
5429
  }
5429
5430
  }
5431
+ const trustToken = localStorage.getItem(TRUST_TOKEN_KEY);
5432
+ const isLogin = config.url?.includes("/users/login") || /\/users\/auth\/[^/]+\/verify$/.test(config.url ?? "");
5433
+ if (trustToken && isLogin) {
5434
+ if (config.headers.set) {
5435
+ config.headers.set("X-Termix-Trust-Token", trustToken);
5436
+ } else {
5437
+ config.headers["X-Termix-Trust-Token"] = trustToken;
5438
+ }
5439
+ }
5430
5440
  }
5431
5441
  if (typeof window !== "undefined" && window.ReactNativeWebView) {
5432
5442
  let platform = "Unknown";
@@ -5587,7 +5597,7 @@ function createRemoteOriginApiInstance(path) {
5587
5597
  });
5588
5598
  instance.interceptors.request.use(
5589
5599
  async (config) => {
5590
- const { getLinkedSession: getLinkedSession2 } = await import("./linked-server-DW5P3NLZ.js");
5600
+ const { getLinkedSession: getLinkedSession2 } = await import("./linked-server-4VWYYABP.js");
5591
5601
  const linked = await getLinkedSession2();
5592
5602
  config.baseURL = linked ? `${linked.serverUrl}${path}` : "http://no-server-configured";
5593
5603
  if (config.headers.set) {
@@ -6009,6 +6019,7 @@ export {
6009
6019
  patchOpenTab,
6010
6020
  parseCustomKeybindings,
6011
6021
  getUserPreferences,
6022
+ TRUST_TOKEN_KEY,
6012
6023
  setCookie,
6013
6024
  getCookie,
6014
6025
  markUserAuthenticated,
@@ -21,7 +21,7 @@ var inFlight = null;
21
21
  function load() {
22
22
  if (cache) return Promise.resolve(cache);
23
23
  if (inFlight) return inFlight;
24
- inFlight = import("./rbac-api-JKISXZEP.js").then(({ getMyPermissions }) => getMyPermissions()).then((result) => {
24
+ inFlight = import("./rbac-api-WIJVZH3M.js").then(({ getMyPermissions }) => getMyPermissions()).then((result) => {
25
25
  cache = {
26
26
  permissions: result.permissions ?? [],
27
27
  isAdmin: !!result.isAdmin