@scalar/workspace-store 0.19.0 → 0.20.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 (74) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/events/definitions/auth.d.ts +20 -2
  3. package/dist/events/definitions/auth.d.ts.map +1 -1
  4. package/dist/events/definitions/document.d.ts +5 -1
  5. package/dist/events/definitions/document.d.ts.map +1 -1
  6. package/dist/events/definitions/index.d.ts +1 -2
  7. package/dist/events/definitions/index.d.ts.map +1 -1
  8. package/dist/events/definitions/server.d.ts +20 -28
  9. package/dist/events/definitions/server.d.ts.map +1 -1
  10. package/dist/events/index.d.ts +2 -2
  11. package/dist/events/index.d.ts.map +1 -1
  12. package/dist/events/index.js.map +2 -2
  13. package/dist/mutators/auth.d.ts +10 -73
  14. package/dist/mutators/auth.d.ts.map +1 -1
  15. package/dist/mutators/auth.js +24 -91
  16. package/dist/mutators/auth.js.map +2 -2
  17. package/dist/mutators/document.d.ts +6 -0
  18. package/dist/mutators/document.d.ts.map +1 -0
  19. package/dist/mutators/document.js +10 -0
  20. package/dist/mutators/document.js.map +7 -0
  21. package/dist/mutators/index.d.ts +10 -7
  22. package/dist/mutators/index.d.ts.map +1 -1
  23. package/dist/mutators/index.js +36 -1
  24. package/dist/mutators/index.js.map +3 -3
  25. package/dist/mutators/server.d.ts +43 -8
  26. package/dist/mutators/server.d.ts.map +1 -1
  27. package/dist/mutators/server.js +112 -20
  28. package/dist/mutators/server.js.map +2 -2
  29. package/dist/navigation/helpers/traverse-document.d.ts +1 -0
  30. package/dist/navigation/helpers/traverse-document.d.ts.map +1 -1
  31. package/dist/navigation/helpers/traverse-document.js +2 -1
  32. package/dist/navigation/helpers/traverse-document.js.map +2 -2
  33. package/dist/plugins/client/persistence.d.ts +2 -1
  34. package/dist/plugins/client/persistence.d.ts.map +1 -1
  35. package/dist/plugins/client/persistence.js +11 -9
  36. package/dist/plugins/client/persistence.js.map +2 -2
  37. package/dist/schemas/extensions/document/x-scalar-document-security.d.ts +13 -0
  38. package/dist/schemas/extensions/document/x-scalar-document-security.d.ts.map +1 -0
  39. package/dist/schemas/extensions/document/x-scalar-document-security.js +8 -0
  40. package/dist/schemas/extensions/document/x-scalar-document-security.js.map +7 -0
  41. package/dist/schemas/extensions/security/x-scalar-selected-security.d.ts +7 -7
  42. package/dist/schemas/extensions/security/x-scalar-selected-security.d.ts.map +1 -1
  43. package/dist/schemas/extensions/security/x-scalar-selected-security.js +2 -2
  44. package/dist/schemas/extensions/security/x-scalar-selected-security.js.map +2 -2
  45. package/dist/schemas/extensions/server/x-scalar-selected-server.d.ts +8 -0
  46. package/dist/schemas/extensions/server/x-scalar-selected-server.d.ts.map +1 -0
  47. package/dist/schemas/extensions/server/x-scalar-selected-server.js +8 -0
  48. package/dist/schemas/extensions/server/x-scalar-selected-server.js.map +7 -0
  49. package/dist/schemas/inmemory-workspace.d.ts +20 -8
  50. package/dist/schemas/inmemory-workspace.d.ts.map +1 -1
  51. package/dist/schemas/navigation.d.ts +5 -0
  52. package/dist/schemas/navigation.d.ts.map +1 -1
  53. package/dist/schemas/navigation.js +1 -0
  54. package/dist/schemas/navigation.js.map +2 -2
  55. package/dist/schemas/reference-config/index.d.ts +10 -4
  56. package/dist/schemas/reference-config/index.d.ts.map +1 -1
  57. package/dist/schemas/reference-config/settings.d.ts +10 -4
  58. package/dist/schemas/reference-config/settings.d.ts.map +1 -1
  59. package/dist/schemas/v3.1/strict/openapi-document.d.ts +343 -137
  60. package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
  61. package/dist/schemas/v3.1/strict/openapi-document.js +8 -0
  62. package/dist/schemas/v3.1/strict/openapi-document.js.map +2 -2
  63. package/dist/schemas/v3.1/strict/operation.d.ts +2 -2
  64. package/dist/schemas/workspace-specification/config.d.ts +10 -4
  65. package/dist/schemas/workspace-specification/config.d.ts.map +1 -1
  66. package/dist/schemas/workspace-specification/index.d.ts +10 -4
  67. package/dist/schemas/workspace-specification/index.d.ts.map +1 -1
  68. package/dist/schemas/workspace.d.ts +70 -28
  69. package/dist/schemas/workspace.d.ts.map +1 -1
  70. package/package.json +5 -5
  71. package/dist/helpers/debounce.d.ts +0 -28
  72. package/dist/helpers/debounce.d.ts.map +0 -1
  73. package/dist/helpers/debounce.js +0 -31
  74. package/dist/helpers/debounce.js.map +0 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @scalar/workspace-store
2
2
 
3
+ ## 0.20.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#7279](https://github.com/scalar/scalar/pull/7279) [`7ccd035`](https://github.com/scalar/scalar/commit/7ccd0351de104f78ef9c6e16538753d302c50d47) Thanks [@DemonHa](https://github.com/DemonHa)! - feat(api-client): integrate new sidebar with v2 routing
8
+
9
+ ### Patch Changes
10
+
11
+ - [#7305](https://github.com/scalar/scalar/pull/7305) [`c7a4690`](https://github.com/scalar/scalar/commit/c7a4690cec484ee16cee8dcba7ef5cb0fbb98133) Thanks [@amritk](https://github.com/amritk)! - chore: minor auth changes, code re-org, type safety
12
+
13
+ - Updated dependencies [[`9c9dbba`](https://github.com/scalar/scalar/commit/9c9dbbaa940667303f0ace59469fd78c2a741937), [`4bec1ba`](https://github.com/scalar/scalar/commit/4bec1ba332e919c4ee32dcfbfb07bd8ee42c4d74)]:
14
+ - @scalar/helpers@0.1.1
15
+ - @scalar/json-magic@0.8.1
16
+
3
17
  ## 0.19.0
4
18
 
5
19
  ### Minor Changes
@@ -1,5 +1,23 @@
1
- import type { AuthMeta, SecuritySchemeUpdate } from '../../mutators/auth.js';
1
+ import type { PartialDeep } from 'type-fest';
2
+ import type { AuthMeta } from '../../mutators/auth.js';
2
3
  import type { SecurityRequirementObject, SecuritySchemeObject } from '../../schemas/v3.1/strict/openapi-document.js';
4
+ import type { ApiKeyObject, HttpObject, OAuth2Object } from '../../schemas/v3.1/strict/security-scheme.js';
5
+ /**
6
+ * SecuritySchemeUpdate represents the possible updates that can be made
7
+ * to an OpenAPI security scheme object via UI interactions.
8
+ *
9
+ * - `http`: Updates to HTTP type schemes (e.g. basic, bearer), allowing token, username, and password changes.
10
+ * - `apiKey`: Updates to API Key type schemes, allowing the key name and its value to be updated.
11
+ * - `oauth2`: Updates to OAuth2 type schemes for each supported OAuth2 flow.
12
+ * - Can set various properties such as auth/token URLs, tokens, PKCE method, client credentials, etc.
13
+ */
14
+ export type SecuritySchemeUpdatePayload = ({
15
+ type: 'http';
16
+ } & Partial<Omit<HttpObject, 'type'>>) | ({
17
+ type: 'apiKey';
18
+ } & Partial<Omit<ApiKeyObject, 'type'>>) | ({
19
+ type: 'oauth2';
20
+ } & PartialDeep<Omit<OAuth2Object, 'type'>>);
3
21
  /** Event definitions for auth */
4
22
  export type AuthEvents = {
5
23
  /**
@@ -39,7 +57,7 @@ export type AuthEvents = {
39
57
  */
40
58
  'auth:update:security-scheme': {
41
59
  /** The data to update the security scheme with */
42
- data: SecuritySchemeUpdate;
60
+ payload: SecuritySchemeUpdatePayload;
43
61
  /** The name of the security scheme to update */
44
62
  name: string;
45
63
  };
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AACrE,OAAO,KAAK,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAA;AAE7G,iCAAiC;AACjC,MAAM,MAAM,UAAU,GAAG;IACvB;;;;;;OAMG;IACH,uCAAuC,EAAE;QACvC,2EAA2E;QAC3E,oBAAoB,EAAE,yBAAyB,EAAE,CAAA;QACjD,wEAAwE;QACxE,UAAU,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,oBAAoB,CAAA;SAAE,EAAE,CAAA;QAC5D,2DAA2D;QAC3D,IAAI,EAAE,QAAQ,CAAA;KACf,CAAA;IAED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C,CAAC,CAAC,GACxC,CAAC;IACC,IAAI,EAAE,QAAQ,CAAA;CACf,GAAG,WAAW,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC,CAAA;AAEhD,iCAAiC;AACjC,MAAM,MAAM,UAAU,GAAG;IACvB;;;;;;OAMG;IACH,uCAAuC,EAAE;QACvC,2EAA2E;QAC3E,oBAAoB,EAAE,yBAAyB,EAAE,CAAA;QACjD,wEAAwE;QACxE,UAAU,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,oBAAoB,CAAA;SAAE,EAAE,CAAA;QAC5D,2DAA2D;QAC3D,IAAI,EAAE,QAAQ,CAAA;KACf,CAAA;IAED;;;;;OAKG;IACH,0BAA0B,EAAE;QAC1B,iDAAiD;QACjD,KAAK,EAAE,MAAM,CAAA;QACb,2CAA2C;QAC3C,IAAI,EAAE,QAAQ,CAAA;KACf,CAAA;IAED;;;;OAIG;IACH,6BAA6B,EAAE;QAC7B,kDAAkD;QAClD,OAAO,EAAE,2BAA2B,CAAA;QACpC,gDAAgD;QAChD,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IAED;;;OAGG;IACH,6BAA6B,EAAE;QAC7B,6DAA6D;QAC7D,EAAE,EAAE,MAAM,EAAE,CAAA;QACZ,+DAA+D;QAC/D,IAAI,EAAE,MAAM,CAAA;QACZ,oDAAoD;QACpD,MAAM,EAAE,MAAM,EAAE,CAAA;QAChB,2CAA2C;QAC3C,IAAI,EAAE,QAAQ,CAAA;KACf,CAAA;IAED;;;;;;;;;OASG;IACH,6BAA6B,EAAE;QAC7B,8CAA8C;QAC9C,KAAK,EAAE,MAAM,EAAE,CAAA;KAChB,CAAA;CACF,CAAA"}
@@ -7,8 +7,12 @@ export type DocumentEvents = {
7
7
  */
8
8
  'document:update:info': PartialDeep<InfoObject>;
9
9
  /**
10
- * Update the icon of the active document/workspace
10
+ * Update the icon of the active document
11
11
  */
12
12
  'document:update:icon': string;
13
+ /**
14
+ * Toggle use document security
15
+ */
16
+ 'document:toggle:document-security': undefined;
13
17
  };
14
18
  //# sourceMappingURL=document.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/document.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAE5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAE5D,iDAAiD;AACjD,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,sBAAsB,EAAE,WAAW,CAAC,UAAU,CAAC,CAAA;IAC/C;;OAEG;IACH,sBAAsB,EAAE,MAAM,CAAA;CAC/B,CAAA"}
1
+ {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/document.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAE5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAE5D,iDAAiD;AACjD,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,sBAAsB,EAAE,WAAW,CAAC,UAAU,CAAC,CAAA;IAC/C;;OAEG;IACH,sBAAsB,EAAE,MAAM,CAAA;IAC9B;;OAEG;IACH,mCAAmC,EAAE,SAAS,CAAA;CAC/C,CAAA"}
@@ -1,5 +1,4 @@
1
1
  import type { EnvironmentEvents } from '../../events/definitions/environment.js';
2
- import type { ServerObject } from '../../schemas/v3.1/strict/openapi-document.js';
3
2
  import type { AnalyticsEvents } from './analytics.js';
4
3
  import type { AuthEvents } from './auth.js';
5
4
  import type { DocumentEvents } from './document.js';
@@ -7,6 +6,6 @@ import type { MetaEvents } from './meta.js';
7
6
  import type { OperationEvents } from './operation.js';
8
7
  import type { ServerEvents } from './server.js';
9
8
  import type { UIEvents } from './ui.js';
10
- export type ApiReferenceEvents<T extends keyof ServerObject = keyof ServerObject> = AuthEvents & AnalyticsEvents & DocumentEvents & EnvironmentEvents & MetaEvents & OperationEvents & ServerEvents<T> & UIEvents;
9
+ export type ApiReferenceEvents = AuthEvents & AnalyticsEvents & DocumentEvents & EnvironmentEvents & MetaEvents & OperationEvents & ServerEvents & UIEvents;
11
10
  export type { CollectionType } from './common.js';
12
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AAE1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AAEpC,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,MAAM,YAAY,GAAG,MAAM,YAAY,IAAI,UAAU,GAC5F,eAAe,GACf,cAAc,GACd,iBAAiB,GACjB,UAAU,GACV,eAAe,GACf,YAAY,CAAC,CAAC,CAAC,GACf,QAAQ,CAAA;AAEV,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AAEzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AAEpC,MAAM,MAAM,kBAAkB,GAAG,UAAU,GACzC,eAAe,GACf,cAAc,GACd,iBAAiB,GACjB,UAAU,GACV,eAAe,GACf,YAAY,GACZ,QAAQ,CAAA;AAEV,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA"}
@@ -1,50 +1,42 @@
1
1
  import type { ServerObject } from '../../schemas/v3.1/strict/openapi-document.js';
2
- export type ServerEvents<T extends keyof ServerObject = keyof ServerObject> = {
2
+ export type ServerEvents = {
3
3
  /**
4
- * Add a new server to the document
4
+ * Add a new blank server to the document
5
5
  */
6
- 'add:server': {
7
- /** The new server payload to add */
8
- server: ServerObject;
9
- };
6
+ 'server:add:server': undefined;
10
7
  /**
11
- * Delete a server from the document
8
+ * Update the entire server object
12
9
  */
13
- 'delete:server': {
14
- /** The URL of the server to delete */
15
- url: string;
10
+ 'server:update:server': {
11
+ /** The index of the server to update */
12
+ index: number;
13
+ /** The new server payload to update */
14
+ server: Partial<ServerObject>;
16
15
  };
17
16
  /**
18
- * Update the selected server via URL
17
+ * Delete a server from the document
19
18
  */
20
- 'update:selected-server': {
21
- /** The new selected server URL */
22
- url: string;
19
+ 'server:delete:server': {
20
+ /** The index of the server to delete */
21
+ index: number;
23
22
  };
24
23
  /**
25
24
  * Update the selected server variable for the document
26
25
  */
27
- 'update:selected-server-variables': {
26
+ 'server:update:variables': {
27
+ /** The index of the server to update */
28
+ index: number;
28
29
  /** The key of the variable to update */
29
30
  key: string;
30
31
  /** The new value of the variable */
31
32
  value: string;
32
33
  };
33
34
  /**
34
- * Update the selected server properties for the document
35
- */
36
- 'update:selected-server-properties': {
37
- /** The key of the property to update */
38
- key: T;
39
- /** The new value of the property */
40
- value: ServerObject[T];
41
- };
42
- /**
43
- * Replace all servers in the document
35
+ * Update the selected server for the document
44
36
  */
45
- 'update:all-servers': {
46
- /** The new servers to replace the current servers with */
47
- servers: ServerObject[];
37
+ 'server:update:selected': {
38
+ /** The index of the server to update */
39
+ index: number;
48
40
  };
49
41
  };
50
42
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AAE1E,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,YAAY,GAAG,MAAM,YAAY,IAAI;IAC5E;;OAEG;IACH,YAAY,EAAE;QACZ,oCAAoC;QACpC,MAAM,EAAE,YAAY,CAAA;KACrB,CAAA;IACD;;OAEG;IACH,eAAe,EAAE;QACf,sCAAsC;QACtC,GAAG,EAAE,MAAM,CAAA;KACZ,CAAA;IACD;;OAEG;IACH,wBAAwB,EAAE;QACxB,kCAAkC;QAClC,GAAG,EAAE,MAAM,CAAA;KACZ,CAAA;IACD;;OAEG;IACH,kCAAkC,EAAE;QAClC,wCAAwC;QACxC,GAAG,EAAE,MAAM,CAAA;QACX,oCAAoC;QACpC,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;IACD;;OAEG;IACH,mCAAmC,EAAE;QACnC,wCAAwC;QACxC,GAAG,EAAE,CAAC,CAAA;QACN,oCAAoC;QACpC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;KACvB,CAAA;IACD;;OAEG;IACH,oBAAoB,EAAE;QACpB,0DAA0D;QAC1D,OAAO,EAAE,YAAY,EAAE,CAAA;KACxB,CAAA;CACF,CAAA"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AAE1E,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,mBAAmB,EAAE,SAAS,CAAA;IAC9B;;OAEG;IACH,sBAAsB,EAAE;QACtB,wCAAwC;QACxC,KAAK,EAAE,MAAM,CAAA;QACb,uCAAuC;QACvC,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;KAC9B,CAAA;IACD;;OAEG;IACH,sBAAsB,EAAE;QACtB,wCAAwC;QACxC,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;IACD;;OAEG;IACH,yBAAyB,EAAE;QACzB,wCAAwC;QACxC,KAAK,EAAE,MAAM,CAAA;QACb,wCAAwC;QACxC,GAAG,EAAE,MAAM,CAAA;QACX,oCAAoC;QACpC,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;IACD;;OAEG;IACH,wBAAwB,EAAE;QACxB,wCAAwC;QACxC,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;CACF,CAAA"}
@@ -1,5 +1,5 @@
1
1
  export { type WorkspaceEventBus, createWorkspaceEventBus } from './bus.js';
2
- export type { CollectionType } from './definitions/index.js';
2
+ export type { ApiReferenceEvents, CollectionType } from './definitions/index.js';
3
3
  export { onCustomEvent } from './listeners.js';
4
- export { type ApiReferenceEvent, type ApiReferenceEvents, emitCustomEvent } from './old-definitions.js';
4
+ export { emitCustomEvent } from './old-definitions.js';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,OAAO,CAAA;AACvE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,kBAAkB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,OAAO,CAAA;AACvE,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/events/index.ts"],
4
- "sourcesContent": ["// biome-ignore lint/performance/noBarrelFile: Entry point for /events\nexport { type WorkspaceEventBus, createWorkspaceEventBus } from './bus'\nexport type { CollectionType } from './definitions'\nexport { onCustomEvent } from './listeners'\nexport { type ApiReferenceEvent, type ApiReferenceEvents, emitCustomEvent } from './old-definitions'\n"],
5
- "mappings": "AACA,SAAiC,+BAA+B;AAEhE,SAAS,qBAAqB;AAC9B,SAA0D,uBAAuB;",
4
+ "sourcesContent": ["// biome-ignore lint/performance/noBarrelFile: Entry point for /events\nexport { type WorkspaceEventBus, createWorkspaceEventBus } from './bus'\nexport type { ApiReferenceEvents, CollectionType } from './definitions'\nexport { onCustomEvent } from './listeners'\nexport { emitCustomEvent } from './old-definitions'\n"],
5
+ "mappings": "AACA,SAAiC,+BAA+B;AAEhE,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,6 @@
1
1
  import type { HttpMethod } from '@scalar/helpers/http/http-methods';
2
+ import type { AuthEvents } from '../events/definitions/auth.js';
2
3
  import type { WorkspaceDocument } from '../schemas.js';
3
- import type { SecurityRequirementObject } from '../schemas/v3.1/strict/security-requirement.js';
4
- import type { SecuritySchemeObject } from '../schemas/v3.1/strict/security-scheme.js';
5
4
  /**
6
5
  * AuthMeta defines the meta information needed to specify whether the authentication operation
7
6
  * is being performed at the document level (entire API), or for a specific operation (specific path and method).
@@ -40,52 +39,7 @@ export type AuthMeta = {
40
39
  * })
41
40
  * ```
42
41
  */
43
- export declare const updateSelectedSecuritySchemes: ({ document, selectedRequirements, newSchemes, meta, }: {
44
- document: WorkspaceDocument | null;
45
- selectedRequirements: SecurityRequirementObject[];
46
- newSchemes: {
47
- name: string;
48
- scheme: SecuritySchemeObject;
49
- }[];
50
- meta: AuthMeta;
51
- }) => void;
52
- /**
53
- * SecuritySchemeUpdate represents the possible updates that can be made
54
- * to an OpenAPI security scheme object via UI interactions.
55
- *
56
- * - `http`: Updates to HTTP type schemes (e.g. basic, bearer), allowing token, username, and password changes.
57
- * - `apiKey`: Updates to API Key type schemes, allowing the key name and its value to be updated.
58
- * - `oauth2`: Updates to OAuth2 type schemes for each supported OAuth2 flow.
59
- * - Can set various properties such as auth/token URLs, tokens, PKCE method, client credentials, etc.
60
- */
61
- export type SecuritySchemeUpdate = {
62
- type: 'http';
63
- payload: Partial<{
64
- token: string;
65
- username: string;
66
- password: string;
67
- }>;
68
- } | {
69
- type: 'apiKey';
70
- payload: Partial<{
71
- name: string;
72
- value: string;
73
- }>;
74
- } | {
75
- type: 'oauth2';
76
- flow: 'implicit' | 'password' | 'clientCredentials' | 'authorizationCode';
77
- payload: Partial<{
78
- authUrl: string;
79
- tokenUrl: string;
80
- token: string;
81
- redirectUrl: string;
82
- clientId: string;
83
- clientSecret: string;
84
- usePkce: 'no' | 'SHA-256' | 'plain';
85
- username: string;
86
- password: string;
87
- }>;
88
- };
42
+ export declare const updateSelectedSecuritySchemes: (document: WorkspaceDocument | null, { selectedRequirements, newSchemes, meta }: AuthEvents["auth:update:selected-security-schemes"]) => void;
89
43
  /**
90
44
  * Updates a security scheme in the OpenAPI document's components object.
91
45
  * Handles updates for HTTP, API Key, and OAuth2 types, saving secret information and configuration for UI-auth flows.
@@ -109,15 +63,11 @@ export type SecuritySchemeUpdate = {
109
63
  * name: 'MyHttpAuth',
110
64
  * })
111
65
  */
112
- export declare const updateSecurityScheme: ({ document, data, name, }: {
113
- document: WorkspaceDocument | null;
114
- data: SecuritySchemeUpdate;
115
- name: string;
116
- }) => void;
66
+ export declare const updateSecurityScheme: (document: WorkspaceDocument | null, { payload, name }: AuthEvents["auth:update:security-scheme"]) => import("../schemas/v3.1/strict/security-scheme.js").ApiKeyObject | import("../schemas/v3.1/strict/security-scheme.js").HttpObject | import("../schemas/v3.1/strict/security-scheme.js").OAuth2Object | import("../schemas/v3.1/strict/security-scheme.js").OpenIdConnectObject | undefined;
117
67
  /**
118
68
  * Sets the selected authentication tab (scheme) index for the given OpenAPI document or operation.
119
- * - When on the document level, updates the 'x-selected-index' on the document's x-scalar-selected-security extension.
120
- * - When on an operation (endpoint) level, updates the 'x-selected-index' for that operation's x-scalar-selected-security.
69
+ * - When on the document level, updates the 'selectedIndex' on the document's x-scalar-selected-security extension.
70
+ * - When on an operation (endpoint) level, updates the 'selectedIndex' for that operation's x-scalar-selected-security.
121
71
  *
122
72
  * Also initializes the x-scalar-selected-security extension if it does not exist.
123
73
  *
@@ -140,11 +90,7 @@ export declare const updateSecurityScheme: ({ document, data, name, }: {
140
90
  * meta: { type: 'operation', path: '/pets', method: 'get' }
141
91
  * });
142
92
  */
143
- export declare const updateSelectedAuthTab: ({ document, index, meta, }: {
144
- document: WorkspaceDocument | null;
145
- index: number;
146
- meta: AuthMeta;
147
- }) => void;
93
+ export declare const updateSelectedAuthTab: (document: WorkspaceDocument | null, { index, meta }: AuthEvents["auth:update:active-index"]) => void;
148
94
  /**
149
95
  * Updates the scopes for a specific security requirement in the selected security schemes of
150
96
  * a document or operation.
@@ -160,8 +106,8 @@ export declare const updateSelectedAuthTab: ({ document, index, meta, }: {
160
106
  * ```ts
161
107
  * // Suppose your document (or operation) x-scalar-selected-security looks like:
162
108
  * // "x-scalar-selected-security": {
163
- * // "x-selected-index": 0,
164
- * // "x-schemes": [
109
+ * // selectedIndex: 0,
110
+ * // selectedSchemes: [
165
111
  * // { "OAuth": ["read:pets"] },
166
112
  * // { "ApiKeyAuth": [] }
167
113
  * // ]
@@ -177,13 +123,7 @@ export declare const updateSelectedAuthTab: ({ document, index, meta, }: {
177
123
  * // After, the first scheme becomes: { "OAuth": ["write:pets"] }
178
124
  * ```
179
125
  */
180
- export declare const updateSelectedScopes: ({ document, id, name, scopes, meta, }: {
181
- document: WorkspaceDocument | null;
182
- id: string[];
183
- name: string;
184
- scopes: string[];
185
- meta: AuthMeta;
186
- }) => void;
126
+ export declare const updateSelectedScopes: (document: WorkspaceDocument | null, { id, name, scopes, meta }: AuthEvents["auth:update:selected-scopes"]) => void;
187
127
  /**
188
128
  * Deletes one or more security schemes from an OpenAPI WorkspaceDocument,
189
129
  * and removes all references to those schemes from selected security, document-level security,
@@ -203,8 +143,5 @@ export declare const updateSelectedScopes: ({ document, id, name, scopes, meta,
203
143
  * - All document-level and operation-level security entries referencing those schemes are removed.
204
144
  * - Any extended x-scalar-selected-security references to those schemes are also removed.
205
145
  */
206
- export declare const deleteSecurityScheme: ({ document, names }: {
207
- document: WorkspaceDocument | null;
208
- names: string[];
209
- }) => void;
146
+ export declare const deleteSecurityScheme: (document: WorkspaceDocument | null, { names }: AuthEvents["auth:delete:security-scheme"]) => void;
210
147
  //# sourceMappingURL=auth.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/mutators/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAInE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAA;AAC3F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAA;A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ACH,MAAM,MAAM,QAAQ,GAChB;IACE,IAAI,EAAE,UAAU,CAAA;CACjB,GACD;IACE,IAAI,EAAE,WAAW,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,UAAU,CAAA;CACnB,CAAA;AAEL;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,6BAA6B,GACxC,UAAU,iBAAiB,GAAG,IAAI,EAClC,4CAA4C,UAAU,CAAC,uCAAuC,CAAC,SA6EhG,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,oBAAoB,GAC/B,UAAU,iBAAiB,GAAG,IAAI,EAClC,mBAAmB,UAAU,CAAC,6BAA6B,CAAC,mRAc7D,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,qBAAqB,GAChC,UAAU,iBAAiB,GAAG,IAAI,EAClC,iBAAiB,UAAU,CAAC,0BAA0B,CAAC,SA+BxD,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,oBAAoB,GAC/B,UAAU,iBAAiB,GAAG,IAAI,EAClC,4BAA4B,UAAU,CAAC,6BAA6B,CAAC,SAqCtE,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB,GAC/B,UAAU,iBAAiB,GAAG,IAAI,EAClC,WAAW,UAAU,CAAC,6BAA6B,CAAC,SA6DrD,CAAA"}
@@ -1,11 +1,7 @@
1
1
  import { generateUniqueValue } from "../helpers/generate-unique-value.js";
2
2
  import { getResolvedRef } from "../helpers/get-resolved-ref.js";
3
- const updateSelectedSecuritySchemes = ({
4
- document,
5
- selectedRequirements,
6
- newSchemes,
7
- meta
8
- }) => {
3
+ import { mergeObjects } from "../helpers/merge-object.js";
4
+ const updateSelectedSecuritySchemes = (document, { selectedRequirements, newSchemes, meta }) => {
9
5
  if (!document) {
10
6
  return;
11
7
  }
@@ -42,88 +38,31 @@ const updateSelectedSecuritySchemes = ({
42
38
  }
43
39
  if (!target["x-scalar-selected-security"]) {
44
40
  target["x-scalar-selected-security"] = {
45
- "x-selected-index": -1,
46
- "x-schemes": []
41
+ selectedIndex: -1,
42
+ selectedSchemes: []
47
43
  };
48
44
  }
49
- const selectedIndex = target["x-scalar-selected-security"]["x-selected-index"];
50
- target["x-scalar-selected-security"]["x-schemes"] = newSelectedSecuritySchemes;
45
+ const selectedIndex = target["x-scalar-selected-security"].selectedIndex;
46
+ target["x-scalar-selected-security"].selectedSchemes = newSelectedSecuritySchemes;
51
47
  if (newSelectedSecuritySchemes.length > 0 && selectedIndex < 0) {
52
- target["x-scalar-selected-security"]["x-selected-index"] = 0;
48
+ target["x-scalar-selected-security"].selectedIndex = 0;
53
49
  }
54
50
  if (selectedIndex >= newSelectedSecuritySchemes.length) {
55
- target["x-scalar-selected-security"]["x-selected-index"] = newSelectedSecuritySchemes.length - 1;
51
+ target["x-scalar-selected-security"].selectedIndex = newSelectedSecuritySchemes.length - 1;
56
52
  }
57
53
  };
58
- const updateSecurityScheme = ({
59
- document,
60
- data,
61
- name
62
- }) => {
63
- if (!document) {
64
- return;
65
- }
66
- const target = getResolvedRef(document.components?.securitySchemes?.[name]);
54
+ const updateSecurityScheme = (document, { payload, name }) => {
55
+ const target = getResolvedRef(document?.components?.securitySchemes?.[name]);
67
56
  if (!target) {
57
+ console.error(`Security scheme ${name} not found`);
68
58
  return;
69
59
  }
70
- if (target.type === "http" && data.type === "http") {
71
- if (data.payload.username) {
72
- target["x-scalar-secret-username"] = data.payload.username;
73
- }
74
- if (data.payload.password) {
75
- target["x-scalar-secret-password"] = data.payload.password;
76
- }
77
- if (data.payload.token) {
78
- target["x-scalar-secret-token"] = data.payload.token;
79
- }
80
- } else if (target.type === "apiKey" && data.type === "apiKey") {
81
- if (data.payload.name) {
82
- target.name = data.payload.name;
83
- }
84
- if (data.payload.value) {
85
- target["x-scalar-secret-token"] = data.payload.value;
86
- }
87
- } else if (target.type === "oauth2" && data.type === "oauth2") {
88
- const flow = target.flows[data.flow];
89
- if (!flow) {
90
- return;
91
- }
92
- if (data.payload.authUrl && "authorizationUrl" in flow) {
93
- flow.authorizationUrl = data.payload.authUrl;
94
- }
95
- if (data.payload.tokenUrl && "tokenUrl" in flow) {
96
- flow.tokenUrl = data.payload.tokenUrl;
97
- }
98
- if (data.payload.token && "x-scalar-secret-token" in flow) {
99
- flow["x-scalar-secret-token"] = data.payload.token;
100
- }
101
- if (data.payload.redirectUrl && "x-scalar-secret-redirect-uri" in flow) {
102
- flow["x-scalar-secret-redirect-uri"] = data.payload.redirectUrl;
103
- }
104
- if (data.payload.clientId && "x-scalar-secret-client-id" in flow) {
105
- flow["x-scalar-secret-client-id"] = data.payload.clientId;
106
- }
107
- if (data.payload.clientSecret && "x-scalar-secret-client-secret" in flow) {
108
- flow["x-scalar-secret-client-secret"] = data.payload.clientSecret;
109
- }
110
- if (data.payload.usePkce && "x-usePkce" in flow) {
111
- flow["x-usePkce"] = data.payload.usePkce;
112
- }
113
- if (data.payload.username && "x-scalar-secret-username" in flow) {
114
- flow["x-scalar-secret-username"] = data.payload.username;
115
- }
116
- if (data.payload.password && "x-scalar-secret-password" in flow) {
117
- flow["x-scalar-secret-password"] = data.payload.password;
118
- }
60
+ if (target.type === payload.type) {
61
+ mergeObjects(target, payload);
119
62
  }
120
- return;
63
+ return target;
121
64
  };
122
- const updateSelectedAuthTab = ({
123
- document,
124
- index,
125
- meta
126
- }) => {
65
+ const updateSelectedAuthTab = (document, { index, meta }) => {
127
66
  if (!document) {
128
67
  return;
129
68
  }
@@ -139,19 +78,13 @@ const updateSelectedAuthTab = ({
139
78
  }
140
79
  if (!target["x-scalar-selected-security"]) {
141
80
  target["x-scalar-selected-security"] = {
142
- "x-selected-index": 0,
143
- "x-schemes": []
81
+ selectedIndex: 0,
82
+ selectedSchemes: []
144
83
  };
145
84
  }
146
- target["x-scalar-selected-security"]["x-selected-index"] = index;
85
+ target["x-scalar-selected-security"].selectedIndex = index;
147
86
  };
148
- const updateSelectedScopes = ({
149
- document,
150
- id,
151
- name,
152
- scopes,
153
- meta
154
- }) => {
87
+ const updateSelectedScopes = (document, { id, name, scopes, meta }) => {
155
88
  if (!document) {
156
89
  return;
157
90
  }
@@ -165,7 +98,7 @@ const updateSelectedScopes = ({
165
98
  if (!target) {
166
99
  return;
167
100
  }
168
- const selectedSchemes = target["x-scalar-selected-security"]?.["x-schemes"];
101
+ const selectedSchemes = target["x-scalar-selected-security"]?.selectedSchemes;
169
102
  if (!selectedSchemes) {
170
103
  return;
171
104
  }
@@ -175,7 +108,7 @@ const updateSelectedScopes = ({
175
108
  }
176
109
  scheme[name] = scopes;
177
110
  };
178
- const deleteSecurityScheme = ({ document, names }) => {
111
+ const deleteSecurityScheme = (document, { names }) => {
179
112
  if (!document) {
180
113
  return;
181
114
  }
@@ -191,7 +124,7 @@ const deleteSecurityScheme = ({ document, names }) => {
191
124
  };
192
125
  if (document["x-scalar-selected-security"]) {
193
126
  const selectedSecurity = document["x-scalar-selected-security"];
194
- selectedSecurity["x-schemes"] = filterSecuritySchemes(selectedSecurity["x-schemes"]);
127
+ selectedSecurity.selectedSchemes = filterSecuritySchemes(selectedSecurity.selectedSchemes);
195
128
  }
196
129
  if (document["security"]) {
197
130
  document["security"] = filterSecuritySchemes(document["security"]);
@@ -206,8 +139,8 @@ const deleteSecurityScheme = ({ document, names }) => {
206
139
  resolvedOperation["security"] = filterSecuritySchemes(resolvedOperation["security"]);
207
140
  }
208
141
  if ("x-scalar-selected-security" in resolvedOperation && resolvedOperation["x-scalar-selected-security"]) {
209
- resolvedOperation["x-scalar-selected-security"]["x-schemes"] = filterSecuritySchemes(
210
- resolvedOperation["x-scalar-selected-security"]["x-schemes"]
142
+ resolvedOperation["x-scalar-selected-security"].selectedSchemes = filterSecuritySchemes(
143
+ resolvedOperation["x-scalar-selected-security"].selectedSchemes
211
144
  );
212
145
  }
213
146
  });