@scalar/workspace-store 0.22.2 → 0.23.0

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 (33) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/events/definitions/document.d.ts +7 -0
  3. package/dist/events/definitions/document.d.ts.map +1 -1
  4. package/dist/events/definitions/operation.d.ts +29 -19
  5. package/dist/events/definitions/operation.d.ts.map +1 -1
  6. package/dist/events/definitions/tag.d.ts +9 -2
  7. package/dist/events/definitions/tag.d.ts.map +1 -1
  8. package/dist/events/definitions/ui.d.ts +17 -4
  9. package/dist/events/definitions/ui.d.ts.map +1 -1
  10. package/dist/mutators/document.d.ts +6 -0
  11. package/dist/mutators/document.d.ts.map +1 -1
  12. package/dist/mutators/document.js +7 -0
  13. package/dist/mutators/document.js.map +2 -2
  14. package/dist/mutators/index.d.ts +3 -3
  15. package/dist/mutators/index.d.ts.map +1 -1
  16. package/dist/mutators/index.js +10 -6
  17. package/dist/mutators/index.js.map +2 -2
  18. package/dist/mutators/operation.d.ts +21 -19
  19. package/dist/mutators/operation.d.ts.map +1 -1
  20. package/dist/mutators/operation.js +118 -65
  21. package/dist/mutators/operation.js.map +2 -2
  22. package/dist/mutators/tag.d.ts +12 -0
  23. package/dist/mutators/tag.d.ts.map +1 -1
  24. package/dist/mutators/tag.js +40 -3
  25. package/dist/mutators/tag.js.map +2 -2
  26. package/dist/navigation/helpers/get-operation-entries.d.ts +5 -5
  27. package/dist/navigation/helpers/get-operation-entries.d.ts.map +1 -1
  28. package/dist/navigation/helpers/get-operation-entries.js.map +2 -2
  29. package/dist/navigation/index.d.ts +1 -0
  30. package/dist/navigation/index.d.ts.map +1 -1
  31. package/dist/navigation/index.js +2 -0
  32. package/dist/navigation/index.js.map +2 -2
  33. package/package.json +6 -6
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/navigation/helpers/get-operation-entries.ts"],
4
- "sourcesContent": ["import type {\n TraversedDocument,\n TraversedEntry,\n TraversedOperation,\n TraversedWebhook,\n WithParent,\n} from '@/schemas/navigation'\n\ntype EntriesMap = Map<string, (WithParent<TraversedOperation> | WithParent<TraversedWebhook>)[]>\n\n/**\n * Builds a map of all operations and webhooks in a document, indexed by path/name and method.\n *\n * This function recursively traverses the document structure and collects all operation and webhook\n * entries. Multiple entries can share the same path|method key (for example, when operations are\n * duplicated across different tags or groups).\n *\n * Performance note: If this function is called frequently, consider generating this map once when\n * creating the sidebar state rather than recalculating it in mutators.\n *\n * @param document - The traversed OpenAPI document to extract operations from\n * @returns A map where keys are `path|method` (for operations) or `name|method` (for webhooks),\n * and values are arrays of matching entries. The pipe separator is used to create a\n * unique composite key from the two parts.\n *\n * @example\n * const entries = getOperationEntries(document)\n * const getUsers = entries.get('/users|get') // Array of all GET /users operations\n */\nexport const getOperationEntries = (document: TraversedDocument): EntriesMap => {\n const map: EntriesMap = new Map()\n\n /**\n * Helper function to add an entry to the map under the specified key.\n * If the key already exists, appends to the array; otherwise creates a new array.\n *\n * @param key - The composite key (path|method or name|method)\n * @param entry - The operation or webhook entry to add (with parent information)\n */\n const addToMap = (key: string, entry: WithParent<TraversedOperation> | WithParent<TraversedWebhook>): void => {\n const existing = map.get(key)\n if (existing) {\n existing.push(entry)\n } else {\n map.set(key, [entry])\n }\n }\n\n /**\n * Recursively traverses the document tree to find all operations and webhooks.\n * Handles three entry types:\n * - operations: collected into the map using path|method as key\n * - webhooks: collected into the map using name|method as key\n * - containers (tags, groups): recursively traversed for their children\n *\n * @param entries - Array of entries to traverse (may be undefined for empty sections)\n * @param parent - The parent entry of the current entries (if any)\n */\n const traverse = (\n entries: TraversedEntry[] | undefined,\n parent: WithParent<TraversedEntry> | TraversedDocument,\n ): void => {\n if (!entries) {\n return\n }\n\n for (const entry of entries) {\n // Handle operations - use path and method to create unique key\n if (entry.type === 'operation') {\n const key = `${entry.path}|${entry.method}`\n addToMap(key, { ...entry, parent })\n }\n // Handle webhooks - use name and method to create unique key\n else if (entry.type === 'webhook') {\n const key = `${entry.name}|${entry.method}`\n addToMap(key, { ...entry, parent })\n }\n // Handle containers - recursively traverse children, passing current entry as parent\n else if ('children' in entry && entry.children) {\n traverse(entry.children, { ...entry, parent })\n }\n }\n }\n\n // Start traversal from document root\n traverse(document.children, document)\n\n return map\n}\n"],
5
- "mappings": "AA6BO,MAAM,sBAAsB,CAAC,aAA4C;AAC9E,QAAM,MAAkB,oBAAI,IAAI;AAShC,QAAM,WAAW,CAAC,KAAa,UAA+E;AAC5G,UAAM,WAAW,IAAI,IAAI,GAAG;AAC5B,QAAI,UAAU;AACZ,eAAS,KAAK,KAAK;AAAA,IACrB,OAAO;AACL,UAAI,IAAI,KAAK,CAAC,KAAK,CAAC;AAAA,IACtB;AAAA,EACF;AAYA,QAAM,WAAW,CACf,SACA,WACS;AACT,QAAI,CAAC,SAAS;AACZ;AAAA,IACF;AAEA,eAAW,SAAS,SAAS;AAE3B,UAAI,MAAM,SAAS,aAAa;AAC9B,cAAM,MAAM,GAAG,MAAM,IAAI,IAAI,MAAM,MAAM;AACzC,iBAAS,KAAK,EAAE,GAAG,OAAO,OAAO,CAAC;AAAA,MACpC,WAES,MAAM,SAAS,WAAW;AACjC,cAAM,MAAM,GAAG,MAAM,IAAI,IAAI,MAAM,MAAM;AACzC,iBAAS,KAAK,EAAE,GAAG,OAAO,OAAO,CAAC;AAAA,MACpC,WAES,cAAc,SAAS,MAAM,UAAU;AAC9C,iBAAS,MAAM,UAAU,EAAE,GAAG,OAAO,OAAO,CAAC;AAAA,MAC/C;AAAA,IACF;AAAA,EACF;AAGA,WAAS,SAAS,UAAU,QAAQ;AAEpC,SAAO;AACT;",
4
+ "sourcesContent": ["import type {\n TraversedDocument,\n TraversedEntry,\n TraversedOperation,\n TraversedWebhook,\n WithParent,\n} from '@/schemas/navigation'\n\nexport type OperationEntriesMap = Map<string, (WithParent<TraversedOperation> | WithParent<TraversedWebhook>)[]>\n\n/**\n * Builds a map of all operations and webhooks in a document, indexed by path/name and method.\n *\n * This function recursively traverses the document structure and collects all operation and webhook\n * entries. Multiple entries can share the same path|method key (for example, when operations are\n * duplicated across different tags or groups).\n *\n * ~Performance note: If this function is called frequently, consider generating this map once when\n * creating the sidebar state rather than recalculating it in mutators.~\n * Update: we are now generating it features/operation and its drilled down from there\n *\n * @param document - The traversed OpenAPI document to extract operations from\n * @returns A map where keys are `path|method` (for operations) or `name|method` (for webhooks),\n * and values are arrays of matching entries. The pipe separator is used to create a\n * unique composite key from the two parts.\n *\n * @example\n * const entries = getOperationEntries(document)\n * const getUsers = entries.get('/users|get') // Array of all GET /users operations\n */\nexport const getOperationEntries = (document: TraversedDocument): OperationEntriesMap => {\n const map: OperationEntriesMap = new Map()\n\n /**\n * Helper function to add an entry to the map under the specified key.\n * If the key already exists, appends to the array; otherwise creates a new array.\n *\n * @param key - The composite key (path|method or name|method)\n * @param entry - The operation or webhook entry to add (with parent information)\n */\n const addToMap = (key: string, entry: WithParent<TraversedOperation> | WithParent<TraversedWebhook>): void => {\n const existing = map.get(key)\n if (existing) {\n existing.push(entry)\n } else {\n map.set(key, [entry])\n }\n }\n\n /**\n * Recursively traverses the document tree to find all operations and webhooks.\n * Handles three entry types:\n * - operations: collected into the map using path|method as key\n * - webhooks: collected into the map using name|method as key\n * - containers (tags, groups): recursively traversed for their children\n *\n * @param entries - Array of entries to traverse (may be undefined for empty sections)\n * @param parent - The parent entry of the current entries (if any)\n */\n const traverse = (\n entries: TraversedEntry[] | undefined,\n parent: WithParent<TraversedEntry> | TraversedDocument,\n ): void => {\n if (!entries) {\n return\n }\n\n for (const entry of entries) {\n // Handle operations - use path and method to create unique key\n if (entry.type === 'operation') {\n const key = `${entry.path}|${entry.method}`\n addToMap(key, { ...entry, parent })\n }\n // Handle webhooks - use name and method to create unique key\n else if (entry.type === 'webhook') {\n const key = `${entry.name}|${entry.method}`\n addToMap(key, { ...entry, parent })\n }\n // Handle containers - recursively traverse children, passing current entry as parent\n else if ('children' in entry && entry.children) {\n traverse(entry.children, { ...entry, parent })\n }\n }\n }\n\n // Start traversal from document root\n traverse(document.children, document)\n\n return map\n}\n"],
5
+ "mappings": "AA8BO,MAAM,sBAAsB,CAAC,aAAqD;AACvF,QAAM,MAA2B,oBAAI,IAAI;AASzC,QAAM,WAAW,CAAC,KAAa,UAA+E;AAC5G,UAAM,WAAW,IAAI,IAAI,GAAG;AAC5B,QAAI,UAAU;AACZ,eAAS,KAAK,KAAK;AAAA,IACrB,OAAO;AACL,UAAI,IAAI,KAAK,CAAC,KAAK,CAAC;AAAA,IACtB;AAAA,EACF;AAYA,QAAM,WAAW,CACf,SACA,WACS;AACT,QAAI,CAAC,SAAS;AACZ;AAAA,IACF;AAEA,eAAW,SAAS,SAAS;AAE3B,UAAI,MAAM,SAAS,aAAa;AAC9B,cAAM,MAAM,GAAG,MAAM,IAAI,IAAI,MAAM,MAAM;AACzC,iBAAS,KAAK,EAAE,GAAG,OAAO,OAAO,CAAC;AAAA,MACpC,WAES,MAAM,SAAS,WAAW;AACjC,cAAM,MAAM,GAAG,MAAM,IAAI,IAAI,MAAM,MAAM;AACzC,iBAAS,KAAK,EAAE,GAAG,OAAO,OAAO,CAAC;AAAA,MACpC,WAES,cAAc,SAAS,MAAM,UAAU;AAC9C,iBAAS,MAAM,UAAU,EAAE,GAAG,OAAO,OAAO,CAAC;AAAA,MAC/C;AAAA,IACF;AAAA,EACF;AAGA,WAAS,SAAS,UAAU,QAAQ;AAEpC,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,5 @@
1
1
  export { getOpenapiObject } from './helpers/get-openapi-object.js';
2
+ export { type OperationEntriesMap, getOperationEntries } from './helpers/get-operation-entries.js';
2
3
  export { getParentEntry } from './helpers/get-parent-entry.js';
3
4
  export { traverseDocument as createNavigation } from './helpers/traverse-document.js';
4
5
  export type { TraverseSpecOptions as createNavigationOptions } from './types.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/navigation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,gBAAgB,IAAI,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAClF,YAAY,EAAE,mBAAmB,IAAI,uBAAuB,EAAE,MAAM,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/navigation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,EAAE,KAAK,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAA;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,gBAAgB,IAAI,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAClF,YAAY,EAAE,mBAAmB,IAAI,uBAAuB,EAAE,MAAM,SAAS,CAAA"}
@@ -1,9 +1,11 @@
1
1
  import { getOpenapiObject } from "./helpers/get-openapi-object.js";
2
+ import { getOperationEntries } from "./helpers/get-operation-entries.js";
2
3
  import { getParentEntry } from "./helpers/get-parent-entry.js";
3
4
  import { traverseDocument } from "./helpers/traverse-document.js";
4
5
  export {
5
6
  traverseDocument as createNavigation,
6
7
  getOpenapiObject,
8
+ getOperationEntries,
7
9
  getParentEntry
8
10
  };
9
11
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/navigation/index.ts"],
4
- "sourcesContent": ["export { getOpenapiObject } from './helpers/get-openapi-object'\nexport { getParentEntry } from './helpers/get-parent-entry'\nexport { traverseDocument as createNavigation } from './helpers/traverse-document'\nexport type { TraverseSpecOptions as createNavigationOptions } from './types'\n"],
5
- "mappings": "AAAA,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B,SAA6B,wBAAwB;",
4
+ "sourcesContent": ["export { getOpenapiObject } from './helpers/get-openapi-object'\nexport { type OperationEntriesMap, getOperationEntries } from './helpers/get-operation-entries'\nexport { getParentEntry } from './helpers/get-parent-entry'\nexport { traverseDocument as createNavigation } from './helpers/traverse-document'\nexport type { TraverseSpecOptions as createNavigationOptions } from './types'\n"],
5
+ "mappings": "AAAA,SAAS,wBAAwB;AACjC,SAAmC,2BAA2B;AAC9D,SAAS,sBAAsB;AAC/B,SAA6B,wBAAwB;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "openapi",
17
17
  "scalar"
18
18
  ],
19
- "version": "0.22.2",
19
+ "version": "0.23.0",
20
20
  "engines": {
21
21
  "node": ">=18"
22
22
  },
@@ -109,13 +109,13 @@
109
109
  "vue": "^3.5.21",
110
110
  "yaml": "^2.8.0",
111
111
  "@scalar/code-highlight": "0.2.1",
112
- "@scalar/helpers": "0.2.1",
113
- "@scalar/json-magic": "0.8.5",
112
+ "@scalar/json-magic": "0.8.6",
114
113
  "@scalar/openapi-upgrader": "0.1.6",
115
- "@scalar/object-utils": "1.2.15",
116
- "@scalar/snippetz": "0.5.5",
114
+ "@scalar/object-utils": "1.2.16",
115
+ "@scalar/helpers": "0.2.2",
116
+ "@scalar/themes": "0.13.26",
117
117
  "@scalar/types": "0.5.2",
118
- "@scalar/themes": "0.13.25"
118
+ "@scalar/snippetz": "0.5.5"
119
119
  },
120
120
  "devDependencies": {
121
121
  "@google-cloud/storage": "7.16.0",