@harborclient/sdk 1.0.35 → 1.0.37

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Toolbar/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,wBAAwB,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIjG;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,IAAI,EAAE,cAAc,CAAC;IAErB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;IAEpB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,YAAY,CAAC,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC;IAE/C;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;CACjD;AAED,UAAU,KAAM,SAAQ,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;IACtF;;OAEG;IACH,OAAO,EAAE,aAAa,EAAE,CAAC;IAEzB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAuBD;;GAEG;AACH,wBAAgB,OAAO,CAAC,EACtB,OAAO,EACP,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T,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CA4CrB"}
@@ -2,29 +2,15 @@ import { jsx as _jsx, jsxs as _jsxs } from "@harborclient/sdk/jsx-runtime";
2
2
  import { FaIcon } from '../FaIcon/index.js';
3
3
  import { cn } from '../utils.js';
4
4
  /**
5
- * Tailwind classes for inactive toolbar icon action buttons.
5
+ * Tailwind classes for toolbar icon action buttons.
6
6
  */
7
- const TOOLBAR_ACTION_BUTTON_INACTIVE = 'hc-toolbar-action inline-flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-md border-none bg-transparent text-muted hover:bg-selection hover:text-text focus-visible:bg-selection focus-visible:text-text disabled:cursor-not-allowed disabled:opacity-50 app-no-drag';
8
- /**
9
- * Tailwind classes for pressed toolbar toggles, matching footer layout icon buttons.
10
- */
11
- const TOOLBAR_ACTION_BUTTON_ACTIVE = 'hc-toolbar-action inline-flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-md border-none bg-control text-text shadow-sm focus-visible:bg-surface focus-visible:text-text disabled:cursor-not-allowed disabled:opacity-50 app-no-drag';
12
- /**
13
- * Resolves toolbar button classes for a declarative action.
14
- */
15
- function toolbarActionButton(action) {
16
- return action.ariaPressed === true
17
- ? TOOLBAR_ACTION_BUTTON_ACTIVE
18
- : TOOLBAR_ACTION_BUTTON_INACTIVE;
19
- }
7
+ const TOOLBAR_ACTION_BUTTON = 'hc-toolbar-action inline-flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-md border-none bg-transparent text-text hover:bg-selection focus-visible:bg-selection focus-visible:text-text disabled:cursor-not-allowed disabled:opacity-50 app-no-drag';
20
8
  /**
21
9
  * Top-of-sidebar toolbar with left-aligned icon actions.
22
10
  */
23
11
  export function Toolbar({ actions, ariaLabel = 'Toolbar', className, ...props }) {
24
12
  return (_jsx("div", { ...props, role: "toolbar", "aria-label": ariaLabel, className: cn('hc-toolbar app-no-drag flex shrink-0 items-center border-b border-separator bg-sidebar-toolbar px-2 py-2', className), children: _jsx("div", { className: "hc-toolbar-actions flex items-center gap-1", children: actions.map((action) => {
25
13
  const title = action.title ?? action.label;
26
- return (_jsxs("div", { className: "hc-toolbar-action-wrap relative", children: [_jsx("button", { type: "button", ref: action.buttonRef, className: toolbarActionButton(action), title: title, "aria-label": action.label, "aria-expanded": action.ariaExpanded, "aria-pressed": action.ariaPressed, "aria-haspopup": action.ariaHaspopup, disabled: action.disabled, onClick: action.onClick, children: _jsx(FaIcon, { icon: action.icon, className: action.ariaPressed === true
27
- ? 'hc-toolbar-action-icon h-5! w-5!'
28
- : 'hc-toolbar-action-icon h-5! w-5!' }) }), action.popover] }, action.id));
14
+ return (_jsxs("div", { className: "hc-toolbar-action-wrap relative", children: [_jsx("button", { type: "button", ref: action.buttonRef, className: TOOLBAR_ACTION_BUTTON, title: title, "aria-label": action.label, "aria-expanded": action.ariaExpanded, "aria-pressed": action.ariaPressed, "aria-haspopup": action.ariaHaspopup, disabled: action.disabled, onClick: action.onClick, children: _jsx(FaIcon, { icon: action.icon, className: cn('hc-toolbar-action-icon h-5! w-5!', action.ariaPressed === true ? 'opacity-100' : 'opacity-50') }) }), action.popover] }, action.id));
29
15
  }) }) }));
30
16
  }
@@ -6,11 +6,13 @@ export interface PluginManifestIdentity {
6
6
  version: string;
7
7
  }
8
8
  /**
9
- * Reads and validates plugin id and version from manifest.json.
9
+ * Reads and validates plugin id and version from manifest.json or snippets.json.
10
10
  *
11
- * @param pluginDir - Plugin root directory containing manifest.json.
11
+ * Prefers manifest.json when both files are present.
12
+ *
13
+ * @param pluginDir - Plugin or snippet bundle root directory.
12
14
  * @returns Parsed manifest identity fields.
13
- * @throws When manifest.json is missing, invalid JSON, or fails validation.
15
+ * @throws When neither manifest file exists or validation fails.
14
16
  */
15
17
  export declare function readPluginManifestIdentity(pluginDir: string): PluginManifestIdentity;
16
18
  //# sourceMappingURL=manifest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/signing/manifest.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,MAAM,GAAG,sBAAsB,CAyBpF"}
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/signing/manifest.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;CACjB;AAmCD;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,MAAM,GAAG,sBAAsB,CAcpF"}
@@ -1,15 +1,16 @@
1
- import { readFileSync } from 'node:fs';
1
+ import { existsSync, readFileSync } from 'node:fs';
2
2
  import { join } from 'node:path';
3
3
  const PLUGIN_ID_PATTERN = /^[a-zA-Z][a-zA-Z0-9.-]*\.[a-zA-Z][a-zA-Z0-9.-]+$/;
4
+ const PLUGIN_MANIFEST_FILENAME = 'manifest.json';
5
+ const SNIPPET_MANIFEST_FILENAME = 'snippets.json';
4
6
  /**
5
- * Reads and validates plugin id and version from manifest.json.
7
+ * Parses and validates id and version from a manifest.json or snippets.json file.
6
8
  *
7
- * @param pluginDir - Plugin root directory containing manifest.json.
9
+ * @param manifestPath - Absolute path to the manifest file on disk.
8
10
  * @returns Parsed manifest identity fields.
9
- * @throws When manifest.json is missing, invalid JSON, or fails validation.
11
+ * @throws When the file is invalid JSON or fails validation.
10
12
  */
11
- export function readPluginManifestIdentity(pluginDir) {
12
- const manifestPath = join(pluginDir, 'manifest.json');
13
+ function parseManifestIdentityFile(manifestPath) {
13
14
  let raw;
14
15
  try {
15
16
  raw = JSON.parse(readFileSync(manifestPath, 'utf8'));
@@ -31,3 +32,23 @@ export function readPluginManifestIdentity(pluginDir) {
31
32
  }
32
33
  return { id, version };
33
34
  }
35
+ /**
36
+ * Reads and validates plugin id and version from manifest.json or snippets.json.
37
+ *
38
+ * Prefers manifest.json when both files are present.
39
+ *
40
+ * @param pluginDir - Plugin or snippet bundle root directory.
41
+ * @returns Parsed manifest identity fields.
42
+ * @throws When neither manifest file exists or validation fails.
43
+ */
44
+ export function readPluginManifestIdentity(pluginDir) {
45
+ const manifestPath = join(pluginDir, PLUGIN_MANIFEST_FILENAME);
46
+ if (existsSync(manifestPath)) {
47
+ return parseManifestIdentityFile(manifestPath);
48
+ }
49
+ const snippetsPath = join(pluginDir, SNIPPET_MANIFEST_FILENAME);
50
+ if (existsSync(snippetsPath)) {
51
+ return parseManifestIdentityFile(snippetsPath);
52
+ }
53
+ throw new Error(`Plugin or snippet manifest not found: expected ${PLUGIN_MANIFEST_FILENAME} or ${SNIPPET_MANIFEST_FILENAME} in ${pluginDir}`);
54
+ }
@@ -18,4 +18,13 @@ export declare function createTestPluginDir(pluginId?: string): {
18
18
  pluginDir: string;
19
19
  cleanup: () => void;
20
20
  };
21
+ /**
22
+ * Creates a minimal snippet bundle directory suitable for signing tests.
23
+ *
24
+ * @param catalogId - Snippet bundle id from snippets.json.
25
+ */
26
+ export declare function createTestSnippetDir(catalogId?: string): {
27
+ pluginDir: string;
28
+ cleanup: () => void;
29
+ };
21
30
  //# sourceMappingURL=testFixtures.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"testFixtures.d.ts","sourceRoot":"","sources":["../../src/signing/testFixtures.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,eAAe,CASvD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,SAA4B,GAAG;IACzE,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CA0BA"}
1
+ {"version":3,"file":"testFixtures.d.ts","sourceRoot":"","sources":["../../src/signing/testFixtures.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,eAAe,CASvD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,SAA4B,GAAG;IACzE,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CA0BA;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,SAA8B,GAAG;IAC7E,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CA4BA"}
@@ -39,3 +39,29 @@ export function createTestPluginDir(pluginId = 'com.example.test-plugin') {
39
39
  }
40
40
  };
41
41
  }
42
+ /**
43
+ * Creates a minimal snippet bundle directory suitable for signing tests.
44
+ *
45
+ * @param catalogId - Snippet bundle id from snippets.json.
46
+ */
47
+ export function createTestSnippetDir(catalogId = 'com.example.test-snippets') {
48
+ const pluginDir = mkdtempSync(join(tmpdir(), 'hc-snippet-sign-'));
49
+ mkdirSync(join(pluginDir, 'dist'), { recursive: true });
50
+ writeFileSync(join(pluginDir, 'snippets.json'), JSON.stringify({
51
+ id: catalogId,
52
+ name: 'Test Snippets',
53
+ version: '1.0.0',
54
+ summary: 'Test snippet bundle for signing.',
55
+ author: 'Example Inc.',
56
+ categories: ['testing'],
57
+ engines: { harborclient: '>=2.0.0' },
58
+ snippets: [{ name: 'Tester', where: 'post-request', file: 'dist/tester.js' }]
59
+ }, null, 2));
60
+ writeFileSync(join(pluginDir, 'dist', 'tester.js'), 'hc.test("ok", () => true);');
61
+ return {
62
+ pluginDir,
63
+ cleanup: () => {
64
+ rmSync(pluginDir, { recursive: true, force: true });
65
+ }
66
+ };
67
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harborclient/sdk",
3
- "version": "1.0.35",
3
+ "version": "1.0.37",
4
4
  "description": "TypeScript SDK for HarborClient development.",
5
5
  "keywords": [
6
6
  "harborclient",