@scalar/workspace-store 0.34.3 → 0.35.1

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 (79) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/entities/auth/index.d.ts +13 -0
  3. package/dist/entities/auth/index.d.ts.map +1 -1
  4. package/dist/entities/auth/index.js +18 -0
  5. package/dist/entities/auth/index.js.map +2 -2
  6. package/dist/entities/auth/schema.d.ts +24 -19
  7. package/dist/entities/auth/schema.d.ts.map +1 -1
  8. package/dist/entities/auth/schema.js +1 -1
  9. package/dist/entities/auth/schema.js.map +2 -2
  10. package/dist/events/definitions/auth.d.ts +9 -0
  11. package/dist/events/definitions/auth.d.ts.map +1 -1
  12. package/dist/events/definitions/document.d.ts +0 -4
  13. package/dist/events/definitions/document.d.ts.map +1 -1
  14. package/dist/events/definitions/index.d.ts +1 -0
  15. package/dist/events/definitions/index.d.ts.map +1 -1
  16. package/dist/events/definitions/operation.d.ts +7 -9
  17. package/dist/events/definitions/operation.d.ts.map +1 -1
  18. package/dist/events/definitions/server.d.ts +45 -12
  19. package/dist/events/definitions/server.d.ts.map +1 -1
  20. package/dist/events/definitions/ui.d.ts +6 -0
  21. package/dist/events/definitions/ui.d.ts.map +1 -1
  22. package/dist/events/index.d.ts +1 -1
  23. package/dist/events/index.d.ts.map +1 -1
  24. package/dist/events/index.js.map +2 -2
  25. package/dist/mutators/auth.d.ts +1 -0
  26. package/dist/mutators/auth.d.ts.map +1 -1
  27. package/dist/mutators/auth.js +11 -0
  28. package/dist/mutators/auth.js.map +2 -2
  29. package/dist/mutators/document.d.ts +0 -5
  30. package/dist/mutators/document.d.ts.map +1 -1
  31. package/dist/mutators/document.js +0 -8
  32. package/dist/mutators/document.js.map +2 -2
  33. package/dist/mutators/index.d.ts +10 -6
  34. package/dist/mutators/index.d.ts.map +1 -1
  35. package/dist/mutators/operation/index.d.ts +1 -1
  36. package/dist/mutators/operation/index.d.ts.map +1 -1
  37. package/dist/mutators/operation/index.js +3 -3
  38. package/dist/mutators/operation/index.js.map +2 -2
  39. package/dist/mutators/operation/operation.d.ts +4 -6
  40. package/dist/mutators/operation/operation.d.ts.map +1 -1
  41. package/dist/mutators/operation/operation.js +5 -4
  42. package/dist/mutators/operation/operation.js.map +2 -2
  43. package/dist/mutators/server.d.ts +35 -15
  44. package/dist/mutators/server.d.ts.map +1 -1
  45. package/dist/mutators/server.js +63 -31
  46. package/dist/mutators/server.js.map +2 -2
  47. package/dist/schemas/extensions/general/x-scalar-active-environment.d.ts.map +1 -0
  48. package/dist/schemas/extensions/general/x-scalar-active-environment.js.map +7 -0
  49. package/dist/schemas/extensions/workspace/index.d.ts +0 -1
  50. package/dist/schemas/extensions/workspace/index.d.ts.map +1 -1
  51. package/dist/schemas/extensions/workspace/index.js +0 -4
  52. package/dist/schemas/extensions/workspace/index.js.map +2 -2
  53. package/dist/schemas/inmemory-workspace.d.ts +14 -11
  54. package/dist/schemas/inmemory-workspace.d.ts.map +1 -1
  55. package/dist/schemas/reference-config/index.d.ts +4 -3
  56. package/dist/schemas/reference-config/index.d.ts.map +1 -1
  57. package/dist/schemas/reference-config/settings.d.ts +4 -3
  58. package/dist/schemas/reference-config/settings.d.ts.map +1 -1
  59. package/dist/schemas/v3.1/strict/openapi-document.d.ts +144 -111
  60. package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
  61. package/dist/schemas/v3.1/strict/openapi-document.js +4 -5
  62. package/dist/schemas/v3.1/strict/openapi-document.js.map +2 -2
  63. package/dist/schemas/v3.1/strict/operation.d.ts +4 -1
  64. package/dist/schemas/v3.1/strict/operation.d.ts.map +1 -1
  65. package/dist/schemas/v3.1/strict/operation.js +5 -1
  66. package/dist/schemas/v3.1/strict/operation.js.map +2 -2
  67. package/dist/schemas/workspace.d.ts +13 -10
  68. package/dist/schemas/workspace.d.ts.map +1 -1
  69. package/dist/schemas/workspace.js +3 -3
  70. package/dist/schemas/workspace.js.map +2 -2
  71. package/package.json +5 -5
  72. package/dist/schemas/extensions/document/x-scalar-set-operation-security.d.ts +0 -13
  73. package/dist/schemas/extensions/document/x-scalar-set-operation-security.d.ts.map +0 -1
  74. package/dist/schemas/extensions/document/x-scalar-set-operation-security.js +0 -8
  75. package/dist/schemas/extensions/document/x-scalar-set-operation-security.js.map +0 -7
  76. package/dist/schemas/extensions/workspace/x-scalar-active-environment.d.ts.map +0 -1
  77. package/dist/schemas/extensions/workspace/x-scalar-active-environment.js.map +0 -7
  78. /package/dist/schemas/extensions/{workspace → general}/x-scalar-active-environment.d.ts +0 -0
  79. /package/dist/schemas/extensions/{workspace → general}/x-scalar-active-environment.js +0 -0
@@ -1,27 +1,40 @@
1
+ import type { HttpMethod } from '@scalar/helpers/http/http-methods';
1
2
  import type { ServerObject } from '../../schemas/v3.1/strict/openapi-document.js';
3
+ export type ServerMeta = {
4
+ type: 'document';
5
+ } | {
6
+ type: 'operation';
7
+ path: string;
8
+ method: HttpMethod;
9
+ };
2
10
  export type ServerEvents = {
3
11
  /**
4
- * Add a new blank server to the document
12
+ * Initialize the servers with an empty array for the target collection
5
13
  */
6
- 'server:add:server': undefined;
14
+ 'server:initialize:servers': {
15
+ /** The meta information for the server */
16
+ meta: ServerMeta;
17
+ };
18
+ /**
19
+ * Add a new blank server to the target collection
20
+ */
21
+ 'server:add:server': {
22
+ /** The meta information for the server */
23
+ meta: ServerMeta;
24
+ };
7
25
  /**
8
- * Update the entire server object
26
+ * Update the entire server object for the target collection
9
27
  */
10
28
  'server:update:server': {
11
29
  /** The index of the server to update */
12
30
  index: number;
13
31
  /** The new server payload to update */
14
32
  server: Partial<ServerObject>;
33
+ /** The meta information for the server */
34
+ meta: ServerMeta;
15
35
  };
16
36
  /**
17
- * Delete a server from the document
18
- */
19
- 'server:delete:server': {
20
- /** The index of the server to delete */
21
- index: number;
22
- };
23
- /**
24
- * Update the selected server variable for the document
37
+ * Update the selected server variables for the target collection
25
38
  */
26
39
  'server:update:variables': {
27
40
  /** The index of the server to update */
@@ -30,13 +43,33 @@ export type ServerEvents = {
30
43
  key: string;
31
44
  /** The new value of the variable */
32
45
  value: string;
46
+ /** The meta information for the server */
47
+ meta: ServerMeta;
33
48
  };
34
49
  /**
35
- * Update the selected server for the document
50
+ * Update the selected server for the target collection
36
51
  */
37
52
  'server:update:selected': {
38
53
  /** The URL of the server to select */
39
54
  url: string;
55
+ /** The meta information for the server */
56
+ meta: ServerMeta;
57
+ };
58
+ /**
59
+ * Delete a server from the target collection
60
+ */
61
+ 'server:delete:server': {
62
+ /** The index of the server to delete */
63
+ index: number;
64
+ /** The meta information for the server */
65
+ meta: ServerMeta;
66
+ };
67
+ /**
68
+ * Clear all servers from the target collection
69
+ */
70
+ 'server:clear:servers': {
71
+ /** The meta information for the server */
72
+ meta: ServerMeta;
40
73
  };
41
74
  };
42
75
  //# 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,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,sCAAsC;QACtC,GAAG,EAAE,MAAM,CAAA;KACZ,CAAA;CACF,CAAA"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AAE1E,MAAM,MAAM,UAAU,GAClB;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,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,2BAA2B,EAAE;QAC3B,0CAA0C;QAC1C,IAAI,EAAE,UAAU,CAAA;KACjB,CAAA;IACD;;OAEG;IACH,mBAAmB,EAAE;QACnB,0CAA0C;QAC1C,IAAI,EAAE,UAAU,CAAA;KACjB,CAAA;IACD;;OAEG;IACH,sBAAsB,EAAE;QACtB,wCAAwC;QACxC,KAAK,EAAE,MAAM,CAAA;QACb,uCAAuC;QACvC,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;QAC7B,0CAA0C;QAC1C,IAAI,EAAE,UAAU,CAAA;KACjB,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;QACb,0CAA0C;QAC1C,IAAI,EAAE,UAAU,CAAA;KACjB,CAAA;IACD;;OAEG;IACH,wBAAwB,EAAE;QACxB,sCAAsC;QACtC,GAAG,EAAE,MAAM,CAAA;QACX,0CAA0C;QAC1C,IAAI,EAAE,UAAU,CAAA;KACjB,CAAA;IACD;;OAEG;IACH,sBAAsB,EAAE;QACtB,wCAAwC;QACxC,KAAK,EAAE,MAAM,CAAA;QACb,0CAA0C;QAC1C,IAAI,EAAE,UAAU,CAAA;KACjB,CAAA;IACD;;OAEG;IACH,sBAAsB,EAAE;QACtB,0CAA0C;QAC1C,IAAI,EAAE,UAAU,CAAA;KACjB,CAAA;CACF,CAAA"}
@@ -201,6 +201,12 @@ export type UIEvents = {
201
201
  path: string;
202
202
  method: HttpMethod;
203
203
  exampleName: string;
204
+ } | {
205
+ page: 'operation';
206
+ path: 'overview' | 'servers' | 'authentication';
207
+ operationPath: string;
208
+ method: HttpMethod;
209
+ documentSlug?: string;
204
210
  });
205
211
  };
206
212
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/ui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,qEAAqE;IACrE,0CAA0C,EAAE,SAAS,CAAA;IACrD,6CAA6C;IAC7C,yBAAyB,EAAE,SAAS,CAAA;IACpC,yCAAyC;IACzC,SAAS,EAAE;QACT,iDAAiD;QACjD,YAAY,CAAC,EAAE,MAAM,CAAA;KACtB,CAAA;IACD,gCAAgC;IAChC,UAAU,EAAE;QACV,2DAA2D;QAC3D,GAAG,EAAE,YAAY,CAAA;QACjB,kDAAkD;QAClD,YAAY,EAAE,MAAM,CAAA;KACrB,CAAA;IACD,gCAAgC;IAChC,gBAAgB,EAAE;QAChB,wDAAwD;QACxD,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,kDAAkD;QAClD,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;IACD,+CAA+C;IAC/C,aAAa,EAAE;QACb,qDAAqD;QACrD,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,6CAA6C;QAC7C,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,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M,CAAA;QACrB,IAAI,EAAE,MAAM,CAAA;QACZ,MAAM,EAAE,UAAU,CAAA;QAClB,WAAW,EAAE,MAAM,CAAA;KACpB,CACJ,CAAA;CACF,CAAA"}
1
+ {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/ui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,qEAAqE;IACrE,0CAA0C,EAAE,SAAS,CAAA;IACrD,6CAA6C;IAC7C,yBAAyB,EAAE,SAAS,CAAA;IACpC,yCAAyC;IACzC,SAAS,EAAE;QACT,iDAAiD;QACjD,YAAY,CAAC,EAAE,MAAM,CAAA;KACtB,CAAA;IACD,gCAAgC;IAChC,UAAU,EAAE;QACV,2DAA2D;QAC3D,GAAG,EAAE,YAAY,CAAA;QACjB,kDAAkD;QAClD,YAAY,EAAE,MAAM,CAAA;KACrB,CAAA;IACD,gCAAgC;IAChC,gBAAgB,EAAE;QAChB,wDAAwD;QACxD,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,kDAAkD;QAClD,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;IACD,+CAA+C;IAC/C,aAAa,EAAE;QACb,qDAAqD;QACrD,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,6CAA6C;QAC7C,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,CAAA;IACD,kDAAkD;IAClD,qBAAqB,EAAE;QACrB,kDAAkD;QAClD,UAAU,EAAE,MAAM,CAAA;KACnB,CAAA;CACF,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,MAAM,qBAAqB,GAAG,MAAM,qBAAqB,IAAI;IACtG,4BAA4B;IAC5B,MAAM,EAAE,CAAC,CAAA;IACT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ClB,YAAY,CAAC,EAAE,MAAM,CAAA;KACtB,CACJ,CAAA;CACF,CAAA"}
@@ -1,5 +1,5 @@
1
1
  export { type WorkspaceEventBus, createWorkspaceEventBus } from './bus.js';
2
- export type { ApiReferenceEvents, AuthMeta, CollectionType, CommandPaletteAction, CommandPalettePayload, KeyboardEventPayload, OperationEvents, OperationExampleMeta, OperationMeta, } from './definitions/index.js';
2
+ export type { ApiReferenceEvents, AuthMeta, CollectionType, CommandPaletteAction, CommandPalettePayload, KeyboardEventPayload, OperationEvents, OperationExampleMeta, OperationMeta, ServerMeta, } from './definitions/index.js';
3
3
  export { onCustomEvent } from './listeners.js';
4
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":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,OAAO,CAAA;AACvE,YAAY,EACV,kBAAkB,EAClB,QAAQ,EACR,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,aAAa,GACd,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,OAAO,CAAA;AACvE,YAAY,EACV,kBAAkB,EAClB,QAAQ,EACR,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,aAAa,EACb,UAAU,GACX,MAAM,eAAe,CAAA;AACtB,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": ["export { type WorkspaceEventBus, createWorkspaceEventBus } from './bus'\nexport type {\n ApiReferenceEvents,\n AuthMeta,\n CollectionType,\n CommandPaletteAction,\n CommandPalettePayload,\n KeyboardEventPayload,\n OperationEvents,\n OperationExampleMeta,\n OperationMeta,\n} from './definitions'\nexport { onCustomEvent } from './listeners'\nexport { emitCustomEvent } from './old-definitions'\n"],
5
- "mappings": "AAAA,SAAiC,+BAA+B;AAYhE,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;",
4
+ "sourcesContent": ["export { type WorkspaceEventBus, createWorkspaceEventBus } from './bus'\nexport type {\n ApiReferenceEvents,\n AuthMeta,\n CollectionType,\n CommandPaletteAction,\n CommandPalettePayload,\n KeyboardEventPayload,\n OperationEvents,\n OperationExampleMeta,\n OperationMeta,\n ServerMeta,\n} from './definitions'\nexport { onCustomEvent } from './listeners'\nexport { emitCustomEvent } from './old-definitions'\n"],
5
+ "mappings": "AAAA,SAAiC,+BAA+B;AAahE,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;",
6
6
  "names": []
7
7
  }
@@ -137,6 +137,7 @@ export declare const authMutatorsFactory: ({ document, store, }: {
137
137
  store: WorkspaceStore | null;
138
138
  }) => {
139
139
  updateSelectedSecuritySchemes: (payload: AuthEvents["auth:update:selected-security-schemes"]) => Promise<void>;
140
+ clearSelectedSecuritySchemes: (payload: AuthEvents["auth:clear:selected-security-schemes"]) => void;
140
141
  updateSecurityScheme: (payload: AuthEvents["auth:update:security-scheme"]) => import("../schemas/v3.1/strict/security-scheme.js").ApiKeyObject | import("../schemas/v3.1/strict/security-scheme.js").HttpObject | OAuth2Object | import("../schemas/v3.1/strict/security-scheme.js").OpenIdConnectObject | undefined;
141
142
  updateSecuritySchemeSecrets: (payload: AuthEvents["auth:update:security-scheme-secrets"]) => void;
142
143
  clearSecuritySchemeSecrets: (payload: AuthEvents["auth:clear:security-scheme-secrets"]) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/mutators/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAM3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAA;AAEzE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,6BAA6B,GACxC,OAAO,cAAc,GAAG,IAAI,EAC5B,UAAU,iBAAiB,GAAG,IAAI,EAClC,4CAA4C,UAAU,CAAC,uCAAuC,CAAC,kBA4EhG,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,oBAAoB,GAC/B,UAAU,iBAAiB,GAAG,IAAI,EAClC,mBAAmB,UAAU,CAAC,6BAA6B,CAAC,+NAc7D,CAAA;AAuCD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,qBAAqB,GAChC,OAAO,cAAc,GAAG,IAAI,EAC5B,UAAU,iBAAiB,GAAG,IAAI,EAClC,iBAAiB,UAAU,CAAC,0BAA0B,CAAC,SAuCxD,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,oBAAoB,GAC/B,OAAO,cAAc,GAAG,IAAI,EAC5B,UAAU,iBAAiB,GAAG,IAAI,EAClC,6CAA6C,UAAU,CAAC,6BAA6B,CAAC,SA6CvF,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB,GAC/B,OAAO,cAAc,GAAG,IAAI,EAC5B,UAAU,iBAAiB,GAAG,IAAI,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U,CAAC,0BAA0B,CAAC,SAuCxD,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,oBAAoB,GAC/B,OAAO,cAAc,GAAG,IAAI,EAC5B,UAAU,iBAAiB,GAAG,IAAI,EAClC,6CAA6C,UAAU,CAAC,6BAA6B,CAAC,SA6CvF,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB,GAC/B,OAAO,cAAc,GAAG,IAAI,EAC5B,UAAU,iBAAiB,GAAG,IAAI,EAClC,WAAW,UAAU,CAAC,6BAA6B,CAAC,SAuErD,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAI,sBAGjC;IACD,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAClC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAA;CAC7B;6CAE4C,UAAU,CAAC,uCAAuC,CAAC;4CAEpD,UAAU,CAAC,sCAAsC,CAAC;oCAE1D,UAAU,CAAC,6BAA6B,CAAC;2CAElC,UAAU,CAAC,qCAAqC,CAAC;0CAElD,UAAU,CAAC,oCAAoC,CAAC;qCAErD,UAAU,CAAC,0BAA0B,CAAC;oCAEvC,UAAU,CAAC,6BAA6B,CAAC;oCAEzC,UAAU,CAAC,6BAA6B,CAAC;CAG5E,CAAA"}
@@ -59,6 +59,16 @@ const updateSelectedSecuritySchemes = async (store, document, { selectedRequirem
59
59
  { selectedIndex: getSelectedIndex(), selectedSchemes: newSelectedSecuritySchemes }
60
60
  );
61
61
  };
62
+ const clearSelectedSecuritySchemes = (store, document, { meta }) => {
63
+ const documentName = document?.["x-scalar-navigation"]?.name;
64
+ if (!documentName) {
65
+ return;
66
+ }
67
+ if (meta.type === "document") {
68
+ return store?.auth.clearAuthSelectedSchemas({ type: "document", documentName });
69
+ }
70
+ return store?.auth.clearAuthSelectedSchemas({ type: "operation", documentName, path: meta.path, method: meta.method });
71
+ };
62
72
  const updateSecurityScheme = (document, { payload, name }) => {
63
73
  const target = getResolvedRef(document?.components?.securitySchemes?.[name]);
64
74
  if (!target) {
@@ -207,6 +217,7 @@ const authMutatorsFactory = ({
207
217
  }) => {
208
218
  return {
209
219
  updateSelectedSecuritySchemes: (payload) => updateSelectedSecuritySchemes(store, document, payload),
220
+ clearSelectedSecuritySchemes: (payload) => clearSelectedSecuritySchemes(store, document, payload),
210
221
  updateSecurityScheme: (payload) => updateSecurityScheme(document, payload),
211
222
  updateSecuritySchemeSecrets: (payload) => updateSecuritySchemeSecrets(store, document, payload),
212
223
  clearSecuritySchemeSecrets: (payload) => clearSecuritySchemeSecrets(store, document, payload),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/mutators/auth.ts"],
4
- "sourcesContent": ["import type { WorkspaceStore } from '@/client'\nimport type { AuthEvents } from '@/events/definitions/auth'\nimport { generateUniqueValue } from '@/helpers/generate-unique-value'\nimport { getResolvedRef } from '@/helpers/get-resolved-ref'\nimport { isNonOptionalSecurityRequirement } from '@/helpers/is-non-optional-security-requirement'\nimport { mergeObjects } from '@/helpers/merge-object'\nimport { unpackProxyObject } from '@/helpers/unpack-proxy'\nimport type { WorkspaceDocument } from '@/schemas'\nimport type { SecurityRequirementObject } from '@/schemas/v3.1/strict/security-requirement'\nimport type { OAuth2Object } from '@/schemas/v3.1/strict/security-scheme'\n\n/**\n * Updates the selected security schemes for either the entire document or a specific operation.\n * - Adds newly created security schemes (if any) to the workspace document's components.\n * - Ensures that each new scheme name is unique within the document by using `generateUniqueValue`.\n * - Updates the `x-scalar-selected-security` property on the target (document or operation) to reflect the new set of selected security schemes.\n * - Corrects and maintains the selected index so it points to a valid security scheme.\n *\n * @param document - The workspace OpenAPI document to mutate (can be null, in which case nothing happens)\n * @param selectedSecuritySchemes - The current list of selected security scheme objects\n * @param create - Array of new schemes to create, each with a name and a scheme definition\n * @param meta - Location to update: whole document or a specific operation (`{ type: 'document' }` or `{ type: 'operation', path, method }`)\n *\n * Example usage:\n * ```\n * updateSelectedSecuritySchemes({\n * document,\n * selectedSecuritySchemes: [{ bearerAuth: [] }],\n * create: [\n * { name: 'ApiKeyAuth', scheme: { type: 'apiKey', in: 'header', name: 'X-API-Key' } }\n * ],\n * meta: { type: 'document' }\n * })\n * ```\n */\nexport const updateSelectedSecuritySchemes = async (\n store: WorkspaceStore | null,\n document: WorkspaceDocument | null,\n { selectedRequirements, newSchemes, meta }: AuthEvents['auth:update:selected-security-schemes'],\n) => {\n const documentName = document?.['x-scalar-navigation']?.name\n if (!documentName) {\n return\n }\n\n // Helper to get the target (whole document or a specific operation)\n const getTarget = () => {\n if (meta.type === 'document') {\n return store?.auth.getAuthSelectedSchemas({ type: 'document', documentName })\n }\n\n return store?.auth.getAuthSelectedSchemas({ type: 'operation', documentName, path: meta.path, method: meta.method })\n }\n\n const createdSecurityRequirements = await Promise.all(\n newSchemes.map(async (newScheme) => {\n const uniqueSchemeName = await generateUniqueValue({\n defaultValue: newScheme.name,\n validation: (value) => !document.components?.securitySchemes?.[value],\n maxRetries: 100,\n })\n\n if (!uniqueSchemeName) {\n return\n }\n\n // Ensure components and securitySchemes exist\n if (!document.components) {\n document.components = {}\n }\n if (!document.components.securitySchemes) {\n document.components.securitySchemes = {}\n }\n\n // Add the new security scheme definition\n document.components.securitySchemes[uniqueSchemeName] = newScheme.scheme\n\n // Return an OpenAPI Security Requirement Object for this new scheme (empty scope array)\n return {\n [uniqueSchemeName]: [],\n }\n }),\n )\n\n // Create any new security schemes required, ensuring unique names for the components\n const createdSchemes = createdSecurityRequirements.filter(Boolean) as SecurityRequirementObject[]\n\n const target = getTarget()\n\n const newSelectedSecuritySchemes = [...selectedRequirements, ...createdSchemes]\n\n const getSelectedIndex = () => {\n if (!target?.selectedIndex) {\n return 0\n }\n\n if (target.selectedIndex >= newSelectedSecuritySchemes.length) {\n return newSelectedSecuritySchemes.length - 1\n }\n\n return target.selectedIndex\n }\n\n // if (payload. === 'document') {\n if (meta.type === 'document') {\n return store?.auth.setAuthSelectedSchemas(\n { type: 'document', documentName },\n { selectedIndex: getSelectedIndex(), selectedSchemes: newSelectedSecuritySchemes },\n )\n }\n return store?.auth.setAuthSelectedSchemas(\n { type: 'operation', documentName, path: meta.path, method: meta.method },\n { selectedIndex: getSelectedIndex(), selectedSchemes: newSelectedSecuritySchemes },\n )\n}\n\n/**\n * Updates a security scheme in the OpenAPI document's components object.\n * Handles updates for HTTP, API Key, and OAuth2 types, saving secret information and configuration for UI-auth flows.\n *\n * @param document - The OpenAPI workspace document (can be null)\n * @param data - The update information, including type and payload\n * @param name - The name of the security scheme in document.components.securitySchemes\n *\n * Example usage:\n *\n * updateSecurityScheme({\n * document,\n * data: {\n * type: 'http',\n * payload: {\n * username: 'user123',\n * password: 'pw123',\n * token: 'tokenval'\n * }\n * },\n * name: 'MyHttpAuth',\n * })\n */\nexport const updateSecurityScheme = (\n document: WorkspaceDocument | null,\n { payload, name }: AuthEvents['auth:update:security-scheme'],\n) => {\n const target = getResolvedRef(document?.components?.securitySchemes?.[name])\n if (!target) {\n console.error(`Security scheme ${name} not found`)\n return\n }\n\n // Handle HTTP (basic, bearer, etc.)\n if (target.type === payload.type) {\n mergeObjects(target, payload)\n }\n\n return target\n}\n\nconst updateSecuritySchemeSecrets = (\n store: WorkspaceStore | null,\n document: WorkspaceDocument | null,\n { payload, name, overwrite = false }: AuthEvents['auth:update:security-scheme-secrets'],\n) => {\n const documentName = document?.['x-scalar-navigation']?.name\n if (!documentName) {\n return\n }\n\n // If we want to remove properties then we should set replace to true\n if (overwrite) {\n store?.auth.setAuthSecrets(documentName, name, payload)\n return\n }\n\n const auth = store?.auth.getAuthSecrets(documentName, name)\n const result = mergeObjects(\n unpackProxyObject(auth, { depth: 1 }) ?? {},\n payload,\n ) as AuthEvents['auth:update:security-scheme-secrets']['payload']\n store?.auth.setAuthSecrets(documentName, name, result)\n}\n\nconst clearSecuritySchemeSecrets = (\n store: WorkspaceStore | null,\n document: WorkspaceDocument | null,\n { name }: AuthEvents['auth:clear:security-scheme-secrets'],\n) => {\n const documentName = document?.['x-scalar-navigation']?.name\n if (!documentName) {\n return\n }\n\n store?.auth.clearAuthSecrets(documentName, name)\n}\n\n/**\n * Sets the selected authentication tab (scheme) index for the given OpenAPI document or operation.\n * - When on the document level, updates the 'selectedIndex' on the document's x-scalar-selected-security extension.\n * - When on an operation (endpoint) level, updates the 'selectedIndex' for that operation's x-scalar-selected-security.\n *\n * Also initializes the x-scalar-selected-security extension if it does not exist.\n *\n * @param document The OpenAPI document object (may be null)\n * @param index The index to set as selected\n * @param meta Context where the selection applies ('document' or specific operation)\n *\n * @example\n * // Document-level tab selection\n * updateSelectedAuthTab({\n * document,\n * index: 1,\n * meta: { type: 'document' }\n * });\n *\n * // Operation-level tab selection (e.g., GET /pets)\n * updateSelectedAuthTab({\n * document,\n * index: 0,\n * meta: { type: 'operation', path: '/pets', method: 'get' }\n * });\n */\nexport const updateSelectedAuthTab = (\n store: WorkspaceStore | null,\n document: WorkspaceDocument | null,\n { index, meta }: AuthEvents['auth:update:active-index'],\n) => {\n const documentName = document?.['x-scalar-navigation']?.name\n if (!documentName) {\n return\n }\n\n // Ensure the path/method exists in the document\n if (meta.type === 'operation' && document?.paths?.[meta.path]?.[meta.method] === undefined) {\n return\n }\n\n // Determine the target object for setting the auth tab index:\n // - Document/root level\n // - Operation/endpoint level (if meta specifies operation)\n const getTarget = () => {\n if (meta.type === 'document') {\n return store?.auth.getAuthSelectedSchemas({ type: 'document', documentName })\n }\n return store?.auth.getAuthSelectedSchemas({ type: 'operation', documentName, path: meta.path, method: meta.method })\n }\n\n const target = getTarget()\n\n if (!target) {\n if (meta.type === 'document') {\n return store?.auth.setAuthSelectedSchemas(\n { type: 'document', documentName },\n { selectedIndex: index, selectedSchemes: [] },\n )\n }\n return store?.auth.setAuthSelectedSchemas(\n { type: 'operation', documentName, path: meta.path, method: meta.method },\n { selectedIndex: index, selectedSchemes: [] },\n )\n }\n\n // Set the selected index\n target.selectedIndex = index\n}\n\n/**\n * Updates the scopes for a specific security requirement in the selected security schemes of\n * a document or operation. Also allow to add a new scope to the scheme.\n *\n * @param document - The OpenAPI WorkspaceDocument to update.\n * @param id - An array of scheme names that uniquely identifies the target security requirement.\n * For example: ['OAuth', 'ApiKeyAuth']\n * @param name - The security scheme name to update scopes for (e.g., 'OAuth').\n * @param scopes - The new list of scopes to set. For example: ['read:pets', 'write:pets']\n * @param newScopePayload - The payload to add a new scope with\n * @param meta - The context specifying whether the update is at the document-level or operation-level.\n *\n * Example usage:\n * ```ts\n * // Suppose your document (or operation) x-scalar-selected-security looks like:\n * // \"x-scalar-selected-security\": {\n * // selectedIndex: 0,\n * // selectedSchemes: [\n * // { \"OAuth\": [\"read:pets\"] },\n * // { \"ApiKeyAuth\": [] }\n * // ]\n * // }\n *\n * updateSelectedScopes({\n * document,\n * id: [\"OAuth\"], // identifies the scheme object: { \"OAuth\": [...] }\n * name: \"OAuth\", // scheme name to update within this security requirement\n * scopes: [\"write:pets\"], // new scopes array\n * meta: { type: \"document\" }\n * })\n * // After, the first scheme becomes: { \"OAuth\": [\"write:pets\"] }\n * ```\n */\nexport const updateSelectedScopes = (\n store: WorkspaceStore | null,\n document: WorkspaceDocument | null,\n { id, name, scopes, newScopePayload, meta }: AuthEvents['auth:update:selected-scopes'],\n) => {\n const documentName = document?.['x-scalar-navigation']?.name\n if (!documentName) {\n return\n }\n\n // Determine the target object (document or the operation)\n const getTarget = () => {\n if (meta.type === 'document') {\n return store?.auth.getAuthSelectedSchemas({ type: 'document', documentName })\n }\n return store?.auth.getAuthSelectedSchemas({ type: 'operation', documentName, path: meta.path, method: meta.method })\n }\n\n const target = getTarget()\n if (!target) {\n return\n }\n\n // Find the security requirement that matches the given id (scheme key names)\n // For example: if id = [\"OAuth\"], matches { OAuth: [...] }\n const scheme = target.selectedSchemes.find((scheme) => JSON.stringify(Object.keys(scheme)) === JSON.stringify(id))\n\n // If the scheme is optional, do nothing as it cannot have scopes\n if (!isNonOptionalSecurityRequirement(scheme)) {\n return\n }\n\n // If we have a new scope payload, add it to the scheme\n if (newScopePayload) {\n const securityScheme = getResolvedRef(document.components?.securitySchemes?.[name])\n const flow = (securityScheme as OAuth2Object)?.flows?.[newScopePayload?.flowType]\n if (!flow) {\n return\n }\n flow.scopes ||= {}\n\n flow.scopes[newScopePayload.name] = newScopePayload.description\n scheme[name] = [...scopes, newScopePayload.name]\n return\n }\n\n // Set the scopes array for the named security scheme within the found security requirement\n scheme[name] = scopes\n}\n\n/**\n * Deletes one or more security schemes from an OpenAPI WorkspaceDocument,\n * and removes all references to those schemes from selected security, document-level security,\n * and operation-level security/selected security (e.g., on paths).\n *\n * Example usage:\n *\n * ```ts\n * deleteSecurityScheme({\n * document, // The OpenAPI document to update\n * names: ['ApiKeyAuth', 'BearerAuth'], // The names of security schemes you want to delete\n * });\n * ```\n *\n * After running this function:\n * - The named security schemes are removed from the components.securitySchemes section.\n * - All document-level and operation-level security entries referencing those schemes are removed.\n * - Any extended x-scalar-selected-security references to those schemes are also removed.\n */\nexport const deleteSecurityScheme = (\n store: WorkspaceStore | null,\n document: WorkspaceDocument | null,\n { names }: AuthEvents['auth:delete:security-scheme'],\n) => {\n const documentName = document?.['x-scalar-navigation']?.name\n if (!documentName) {\n // Early exit if there is no document to modify\n return\n }\n\n // Get the mutable reference to securitySchemes in components (may be a proxy/resolved reference)\n const target = getResolvedRef(document.components?.securitySchemes)\n\n if (!target) {\n // If there are no security schemes to delete from, return early\n return\n }\n\n // Remove each named security scheme from the components.securitySchemes object\n names.forEach((name) => {\n delete target[name]\n })\n\n // Function to remove any security requirement objects that reference given scheme names.\n const filterSecuritySchemes = (schemes: SecurityRequirementObject[]) => {\n // Remove schemes whose key is included in the `names` to be deleted.\n return schemes.filter((scheme) => !names.some((name) => Object.keys(scheme).includes(name)))\n }\n\n const documentSelectedSecurity = store?.auth.getAuthSelectedSchemas({ type: 'document', documentName })\n\n // -- Remove from document-level `x-scalar-selected-security` extension, if present\n if (documentSelectedSecurity) {\n documentSelectedSecurity.selectedSchemes = filterSecuritySchemes(\n unpackProxyObject(documentSelectedSecurity.selectedSchemes, { depth: 1 }) ?? [],\n )\n }\n\n // -- Remove from document-level `security` property, if present\n if (document['security']) {\n document['security'] = filterSecuritySchemes(document['security'])\n }\n\n // -- For each path and operation, remove deleted security schemes from operation-level security and custom extension\n Object.entries(document.paths ?? {}).forEach(([path, pathItemObject]) => {\n Object.entries(pathItemObject).forEach(([method, operation]) => {\n if (typeof operation !== 'object') {\n // Ignore operations that are not objects (could be undefined)\n return\n }\n\n // Get mutable reference for the operation (could resolve $ref proxies)\n const resolvedOperation = getResolvedRef(operation)\n\n // Remove from operation-level security array\n if ('security' in resolvedOperation && resolvedOperation['security']) {\n resolvedOperation['security'] = filterSecuritySchemes(resolvedOperation['security'])\n }\n\n // // Remove from operation-level x-scalar-selected-security array\n const operationSelectedSecurity = store?.auth.getAuthSelectedSchemas({\n type: 'operation',\n documentName,\n path,\n method,\n })\n if (operationSelectedSecurity) {\n operationSelectedSecurity.selectedSchemes = filterSecuritySchemes(\n unpackProxyObject(operationSelectedSecurity.selectedSchemes, { depth: 1 }) ?? [],\n )\n }\n })\n })\n}\n\nexport const authMutatorsFactory = ({\n document,\n store,\n}: {\n document: WorkspaceDocument | null\n store: WorkspaceStore | null\n}) => {\n return {\n updateSelectedSecuritySchemes: (payload: AuthEvents['auth:update:selected-security-schemes']) =>\n updateSelectedSecuritySchemes(store, document, payload),\n updateSecurityScheme: (payload: AuthEvents['auth:update:security-scheme']) =>\n updateSecurityScheme(document, payload),\n updateSecuritySchemeSecrets: (payload: AuthEvents['auth:update:security-scheme-secrets']) =>\n updateSecuritySchemeSecrets(store, document, payload),\n clearSecuritySchemeSecrets: (payload: AuthEvents['auth:clear:security-scheme-secrets']) =>\n clearSecuritySchemeSecrets(store, document, payload),\n updateSelectedAuthTab: (payload: AuthEvents['auth:update:active-index']) =>\n updateSelectedAuthTab(store, document, payload),\n updateSelectedScopes: (payload: AuthEvents['auth:update:selected-scopes']) =>\n updateSelectedScopes(store, document, payload),\n deleteSecurityScheme: (payload: AuthEvents['auth:delete:security-scheme']) =>\n deleteSecurityScheme(store, document, payload),\n }\n}\n"],
5
- "mappings": "AAEA,SAAS,2BAA2B;AACpC,SAAS,sBAAsB;AAC/B,SAAS,wCAAwC;AACjD,SAAS,oBAAoB;AAC7B,SAAS,yBAAyB;AA6B3B,MAAM,gCAAgC,OAC3C,OACA,UACA,EAAE,sBAAsB,YAAY,KAAK,MACtC;AACH,QAAM,eAAe,WAAW,qBAAqB,GAAG;AACxD,MAAI,CAAC,cAAc;AACjB;AAAA,EACF;AAGA,QAAM,YAAY,MAAM;AACtB,QAAI,KAAK,SAAS,YAAY;AAC5B,aAAO,OAAO,KAAK,uBAAuB,EAAE,MAAM,YAAY,aAAa,CAAC;AAAA,IAC9E;AAEA,WAAO,OAAO,KAAK,uBAAuB,EAAE,MAAM,aAAa,cAAc,MAAM,KAAK,MAAM,QAAQ,KAAK,OAAO,CAAC;AAAA,EACrH;AAEA,QAAM,8BAA8B,MAAM,QAAQ;AAAA,IAChD,WAAW,IAAI,OAAO,cAAc;AAClC,YAAM,mBAAmB,MAAM,oBAAoB;AAAA,QACjD,cAAc,UAAU;AAAA,QACxB,YAAY,CAAC,UAAU,CAAC,SAAS,YAAY,kBAAkB,KAAK;AAAA,QACpE,YAAY;AAAA,MACd,CAAC;AAED,UAAI,CAAC,kBAAkB;AACrB;AAAA,MACF;AAGA,UAAI,CAAC,SAAS,YAAY;AACxB,iBAAS,aAAa,CAAC;AAAA,MACzB;AACA,UAAI,CAAC,SAAS,WAAW,iBAAiB;AACxC,iBAAS,WAAW,kBAAkB,CAAC;AAAA,MACzC;AAGA,eAAS,WAAW,gBAAgB,gBAAgB,IAAI,UAAU;AAGlE,aAAO;AAAA,QACL,CAAC,gBAAgB,GAAG,CAAC;AAAA,MACvB;AAAA,IACF,CAAC;AAAA,EACH;AAGA,QAAM,iBAAiB,4BAA4B,OAAO,OAAO;AAEjE,Q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BAAsB,CAAC,YACrB,qBAAqB,UAAU,OAAO;AAAA,IACxC,6BAA6B,CAAC,YAC5B,4BAA4B,OAAO,UAAU,OAAO;AAAA,IACtD,4BAA4B,CAAC,YAC3B,2BAA2B,OAAO,UAAU,OAAO;AAAA,IACrD,uBAAuB,CAAC,YACtB,sBAAsB,OAAO,UAAU,OAAO;AAAA,IAChD,sBAAsB,CAAC,YACrB,qBAAqB,OAAO,UAAU,OAAO;AAAA,IAC/C,sBAAsB,CAAC,YACrB,qBAAqB,OAAO,UAAU,OAAO;AAAA,EACjD;AACF;",
4
+ "sourcesContent": ["import type { WorkspaceStore } from '@/client'\nimport type { AuthEvents } from '@/events/definitions/auth'\nimport { generateUniqueValue } from '@/helpers/generate-unique-value'\nimport { getResolvedRef } from '@/helpers/get-resolved-ref'\nimport { isNonOptionalSecurityRequirement } from '@/helpers/is-non-optional-security-requirement'\nimport { mergeObjects } from '@/helpers/merge-object'\nimport { unpackProxyObject } from '@/helpers/unpack-proxy'\nimport type { WorkspaceDocument } from '@/schemas'\nimport type { SecurityRequirementObject } from '@/schemas/v3.1/strict/security-requirement'\nimport type { OAuth2Object } from '@/schemas/v3.1/strict/security-scheme'\n\n/**\n * Updates the selected security schemes for either the entire document or a specific operation.\n * - Adds newly created security schemes (if any) to the workspace document's components.\n * - Ensures that each new scheme name is unique within the document by using `generateUniqueValue`.\n * - Updates the `x-scalar-selected-security` property on the target (document or operation) to reflect the new set of selected security schemes.\n * - Corrects and maintains the selected index so it points to a valid security scheme.\n *\n * @param document - The workspace OpenAPI document to mutate (can be null, in which case nothing happens)\n * @param selectedSecuritySchemes - The current list of selected security scheme objects\n * @param create - Array of new schemes to create, each with a name and a scheme definition\n * @param meta - Location to update: whole document or a specific operation (`{ type: 'document' }` or `{ type: 'operation', path, method }`)\n *\n * Example usage:\n * ```\n * updateSelectedSecuritySchemes({\n * document,\n * selectedSecuritySchemes: [{ bearerAuth: [] }],\n * create: [\n * { name: 'ApiKeyAuth', scheme: { type: 'apiKey', in: 'header', name: 'X-API-Key' } }\n * ],\n * meta: { type: 'document' }\n * })\n * ```\n */\nexport const updateSelectedSecuritySchemes = async (\n store: WorkspaceStore | null,\n document: WorkspaceDocument | null,\n { selectedRequirements, newSchemes, meta }: AuthEvents['auth:update:selected-security-schemes'],\n) => {\n const documentName = document?.['x-scalar-navigation']?.name\n if (!documentName) {\n return\n }\n\n // Helper to get the target (whole document or a specific operation)\n const getTarget = () => {\n if (meta.type === 'document') {\n return store?.auth.getAuthSelectedSchemas({ type: 'document', documentName })\n }\n\n return store?.auth.getAuthSelectedSchemas({ type: 'operation', documentName, path: meta.path, method: meta.method })\n }\n\n const createdSecurityRequirements = await Promise.all(\n newSchemes.map(async (newScheme) => {\n const uniqueSchemeName = await generateUniqueValue({\n defaultValue: newScheme.name,\n validation: (value) => !document.components?.securitySchemes?.[value],\n maxRetries: 100,\n })\n\n if (!uniqueSchemeName) {\n return\n }\n\n // Ensure components and securitySchemes exist\n if (!document.components) {\n document.components = {}\n }\n if (!document.components.securitySchemes) {\n document.components.securitySchemes = {}\n }\n\n // Add the new security scheme definition\n document.components.securitySchemes[uniqueSchemeName] = newScheme.scheme\n\n // Return an OpenAPI Security Requirement Object for this new scheme (empty scope array)\n return {\n [uniqueSchemeName]: [],\n }\n }),\n )\n\n // Create any new security schemes required, ensuring unique names for the components\n const createdSchemes = createdSecurityRequirements.filter(Boolean) as SecurityRequirementObject[]\n\n const target = getTarget()\n\n const newSelectedSecuritySchemes = [...selectedRequirements, ...createdSchemes]\n\n const getSelectedIndex = () => {\n if (!target?.selectedIndex) {\n return 0\n }\n\n if (target.selectedIndex >= newSelectedSecuritySchemes.length) {\n return newSelectedSecuritySchemes.length - 1\n }\n\n return target.selectedIndex\n }\n\n // if (payload. === 'document') {\n if (meta.type === 'document') {\n return store?.auth.setAuthSelectedSchemas(\n { type: 'document', documentName },\n { selectedIndex: getSelectedIndex(), selectedSchemes: newSelectedSecuritySchemes },\n )\n }\n return store?.auth.setAuthSelectedSchemas(\n { type: 'operation', documentName, path: meta.path, method: meta.method },\n { selectedIndex: getSelectedIndex(), selectedSchemes: newSelectedSecuritySchemes },\n )\n}\n\n/**\n * Clears the selected security schemes from the workspace store for a document or operation.\n * This function will remove any selection state related to security (auth) for either the entire document\n * or for a specific operation if meta.type is 'operation'.\n * If the document name cannot be determined, nothing happens.\n */\nconst clearSelectedSecuritySchemes = (\n store: WorkspaceStore | null,\n document: WorkspaceDocument | null,\n { meta }: AuthEvents['auth:clear:selected-security-schemes'],\n) => {\n const documentName = document?.['x-scalar-navigation']?.name\n if (!documentName) {\n return\n }\n\n if (meta.type === 'document') {\n return store?.auth.clearAuthSelectedSchemas({ type: 'document', documentName })\n }\n return store?.auth.clearAuthSelectedSchemas({ type: 'operation', documentName, path: meta.path, method: meta.method })\n}\n\n/**\n * Updates a security scheme in the OpenAPI document's components object.\n * Handles updates for HTTP, API Key, and OAuth2 types, saving secret information and configuration for UI-auth flows.\n *\n * @param document - The OpenAPI workspace document (can be null)\n * @param data - The update information, including type and payload\n * @param name - The name of the security scheme in document.components.securitySchemes\n *\n * Example usage:\n *\n * updateSecurityScheme({\n * document,\n * data: {\n * type: 'http',\n * payload: {\n * username: 'user123',\n * password: 'pw123',\n * token: 'tokenval'\n * }\n * },\n * name: 'MyHttpAuth',\n * })\n */\nexport const updateSecurityScheme = (\n document: WorkspaceDocument | null,\n { payload, name }: AuthEvents['auth:update:security-scheme'],\n) => {\n const target = getResolvedRef(document?.components?.securitySchemes?.[name])\n if (!target) {\n console.error(`Security scheme ${name} not found`)\n return\n }\n\n // Handle HTTP (basic, bearer, etc.)\n if (target.type === payload.type) {\n mergeObjects(target, payload)\n }\n\n return target\n}\n\nconst updateSecuritySchemeSecrets = (\n store: WorkspaceStore | null,\n document: WorkspaceDocument | null,\n { payload, name, overwrite = false }: AuthEvents['auth:update:security-scheme-secrets'],\n) => {\n const documentName = document?.['x-scalar-navigation']?.name\n if (!documentName) {\n return\n }\n\n // If we want to remove properties then we should set replace to true\n if (overwrite) {\n store?.auth.setAuthSecrets(documentName, name, payload)\n return\n }\n\n const auth = store?.auth.getAuthSecrets(documentName, name)\n const result = mergeObjects(\n unpackProxyObject(auth, { depth: 1 }) ?? {},\n payload,\n ) as AuthEvents['auth:update:security-scheme-secrets']['payload']\n store?.auth.setAuthSecrets(documentName, name, result)\n}\n\nconst clearSecuritySchemeSecrets = (\n store: WorkspaceStore | null,\n document: WorkspaceDocument | null,\n { name }: AuthEvents['auth:clear:security-scheme-secrets'],\n) => {\n const documentName = document?.['x-scalar-navigation']?.name\n if (!documentName) {\n return\n }\n\n store?.auth.clearAuthSecrets(documentName, name)\n}\n\n/**\n * Sets the selected authentication tab (scheme) index for the given OpenAPI document or operation.\n * - When on the document level, updates the 'selectedIndex' on the document's x-scalar-selected-security extension.\n * - When on an operation (endpoint) level, updates the 'selectedIndex' for that operation's x-scalar-selected-security.\n *\n * Also initializes the x-scalar-selected-security extension if it does not exist.\n *\n * @param document The OpenAPI document object (may be null)\n * @param index The index to set as selected\n * @param meta Context where the selection applies ('document' or specific operation)\n *\n * @example\n * // Document-level tab selection\n * updateSelectedAuthTab({\n * document,\n * index: 1,\n * meta: { type: 'document' }\n * });\n *\n * // Operation-level tab selection (e.g., GET /pets)\n * updateSelectedAuthTab({\n * document,\n * index: 0,\n * meta: { type: 'operation', path: '/pets', method: 'get' }\n * });\n */\nexport const updateSelectedAuthTab = (\n store: WorkspaceStore | null,\n document: WorkspaceDocument | null,\n { index, meta }: AuthEvents['auth:update:active-index'],\n) => {\n const documentName = document?.['x-scalar-navigation']?.name\n if (!documentName) {\n return\n }\n\n // Ensure the path/method exists in the document\n if (meta.type === 'operation' && document?.paths?.[meta.path]?.[meta.method] === undefined) {\n return\n }\n\n // Determine the target object for setting the auth tab index:\n // - Document/root level\n // - Operation/endpoint level (if meta specifies operation)\n const getTarget = () => {\n if (meta.type === 'document') {\n return store?.auth.getAuthSelectedSchemas({ type: 'document', documentName })\n }\n return store?.auth.getAuthSelectedSchemas({ type: 'operation', documentName, path: meta.path, method: meta.method })\n }\n\n const target = getTarget()\n\n if (!target) {\n if (meta.type === 'document') {\n return store?.auth.setAuthSelectedSchemas(\n { type: 'document', documentName },\n { selectedIndex: index, selectedSchemes: [] },\n )\n }\n return store?.auth.setAuthSelectedSchemas(\n { type: 'operation', documentName, path: meta.path, method: meta.method },\n { selectedIndex: index, selectedSchemes: [] },\n )\n }\n\n // Set the selected index\n target.selectedIndex = index\n}\n\n/**\n * Updates the scopes for a specific security requirement in the selected security schemes of\n * a document or operation. Also allow to add a new scope to the scheme.\n *\n * @param document - The OpenAPI WorkspaceDocument to update.\n * @param id - An array of scheme names that uniquely identifies the target security requirement.\n * For example: ['OAuth', 'ApiKeyAuth']\n * @param name - The security scheme name to update scopes for (e.g., 'OAuth').\n * @param scopes - The new list of scopes to set. For example: ['read:pets', 'write:pets']\n * @param newScopePayload - The payload to add a new scope with\n * @param meta - The context specifying whether the update is at the document-level or operation-level.\n *\n * Example usage:\n * ```ts\n * // Suppose your document (or operation) x-scalar-selected-security looks like:\n * // \"x-scalar-selected-security\": {\n * // selectedIndex: 0,\n * // selectedSchemes: [\n * // { \"OAuth\": [\"read:pets\"] },\n * // { \"ApiKeyAuth\": [] }\n * // ]\n * // }\n *\n * updateSelectedScopes({\n * document,\n * id: [\"OAuth\"], // identifies the scheme object: { \"OAuth\": [...] }\n * name: \"OAuth\", // scheme name to update within this security requirement\n * scopes: [\"write:pets\"], // new scopes array\n * meta: { type: \"document\" }\n * })\n * // After, the first scheme becomes: { \"OAuth\": [\"write:pets\"] }\n * ```\n */\nexport const updateSelectedScopes = (\n store: WorkspaceStore | null,\n document: WorkspaceDocument | null,\n { id, name, scopes, newScopePayload, meta }: AuthEvents['auth:update:selected-scopes'],\n) => {\n const documentName = document?.['x-scalar-navigation']?.name\n if (!documentName) {\n return\n }\n\n // Determine the target object (document or the operation)\n const getTarget = () => {\n if (meta.type === 'document') {\n return store?.auth.getAuthSelectedSchemas({ type: 'document', documentName })\n }\n return store?.auth.getAuthSelectedSchemas({ type: 'operation', documentName, path: meta.path, method: meta.method })\n }\n\n const target = getTarget()\n if (!target) {\n return\n }\n\n // Find the security requirement that matches the given id (scheme key names)\n // For example: if id = [\"OAuth\"], matches { OAuth: [...] }\n const scheme = target.selectedSchemes.find((scheme) => JSON.stringify(Object.keys(scheme)) === JSON.stringify(id))\n\n // If the scheme is optional, do nothing as it cannot have scopes\n if (!isNonOptionalSecurityRequirement(scheme)) {\n return\n }\n\n // If we have a new scope payload, add it to the scheme\n if (newScopePayload) {\n const securityScheme = getResolvedRef(document.components?.securitySchemes?.[name])\n const flow = (securityScheme as OAuth2Object)?.flows?.[newScopePayload?.flowType]\n if (!flow) {\n return\n }\n flow.scopes ||= {}\n\n flow.scopes[newScopePayload.name] = newScopePayload.description\n scheme[name] = [...scopes, newScopePayload.name]\n return\n }\n\n // Set the scopes array for the named security scheme within the found security requirement\n scheme[name] = scopes\n}\n\n/**\n * Deletes one or more security schemes from an OpenAPI WorkspaceDocument,\n * and removes all references to those schemes from selected security, document-level security,\n * and operation-level security/selected security (e.g., on paths).\n *\n * Example usage:\n *\n * ```ts\n * deleteSecurityScheme({\n * document, // The OpenAPI document to update\n * names: ['ApiKeyAuth', 'BearerAuth'], // The names of security schemes you want to delete\n * });\n * ```\n *\n * After running this function:\n * - The named security schemes are removed from the components.securitySchemes section.\n * - All document-level and operation-level security entries referencing those schemes are removed.\n * - Any extended x-scalar-selected-security references to those schemes are also removed.\n */\nexport const deleteSecurityScheme = (\n store: WorkspaceStore | null,\n document: WorkspaceDocument | null,\n { names }: AuthEvents['auth:delete:security-scheme'],\n) => {\n const documentName = document?.['x-scalar-navigation']?.name\n if (!documentName) {\n // Early exit if there is no document to modify\n return\n }\n\n // Get the mutable reference to securitySchemes in components (may be a proxy/resolved reference)\n const target = getResolvedRef(document.components?.securitySchemes)\n\n if (!target) {\n // If there are no security schemes to delete from, return early\n return\n }\n\n // Remove each named security scheme from the components.securitySchemes object\n names.forEach((name) => {\n delete target[name]\n })\n\n // Function to remove any security requirement objects that reference given scheme names.\n const filterSecuritySchemes = (schemes: SecurityRequirementObject[]) => {\n // Remove schemes whose key is included in the `names` to be deleted.\n return schemes.filter((scheme) => !names.some((name) => Object.keys(scheme).includes(name)))\n }\n\n const documentSelectedSecurity = store?.auth.getAuthSelectedSchemas({ type: 'document', documentName })\n\n // -- Remove from document-level `x-scalar-selected-security` extension, if present\n if (documentSelectedSecurity) {\n documentSelectedSecurity.selectedSchemes = filterSecuritySchemes(\n unpackProxyObject(documentSelectedSecurity.selectedSchemes, { depth: 1 }) ?? [],\n )\n }\n\n // -- Remove from document-level `security` property, if present\n if (document['security']) {\n document['security'] = filterSecuritySchemes(document['security'])\n }\n\n // -- For each path and operation, remove deleted security schemes from operation-level security and custom extension\n Object.entries(document.paths ?? {}).forEach(([path, pathItemObject]) => {\n Object.entries(pathItemObject).forEach(([method, operation]) => {\n if (typeof operation !== 'object') {\n // Ignore operations that are not objects (could be undefined)\n return\n }\n\n // Get mutable reference for the operation (could resolve $ref proxies)\n const resolvedOperation = getResolvedRef(operation)\n\n // Remove from operation-level security array\n if ('security' in resolvedOperation && resolvedOperation['security']) {\n resolvedOperation['security'] = filterSecuritySchemes(resolvedOperation['security'])\n }\n\n // // Remove from operation-level x-scalar-selected-security array\n const operationSelectedSecurity = store?.auth.getAuthSelectedSchemas({\n type: 'operation',\n documentName,\n path,\n method,\n })\n if (operationSelectedSecurity) {\n operationSelectedSecurity.selectedSchemes = filterSecuritySchemes(\n unpackProxyObject(operationSelectedSecurity.selectedSchemes, { depth: 1 }) ?? [],\n )\n }\n })\n })\n}\n\nexport const authMutatorsFactory = ({\n document,\n store,\n}: {\n document: WorkspaceDocument | null\n store: WorkspaceStore | null\n}) => {\n return {\n updateSelectedSecuritySchemes: (payload: AuthEvents['auth:update:selected-security-schemes']) =>\n updateSelectedSecuritySchemes(store, document, payload),\n clearSelectedSecuritySchemes: (payload: AuthEvents['auth:clear:selected-security-schemes']) =>\n clearSelectedSecuritySchemes(store, document, payload),\n updateSecurityScheme: (payload: AuthEvents['auth:update:security-scheme']) =>\n updateSecurityScheme(document, payload),\n updateSecuritySchemeSecrets: (payload: AuthEvents['auth:update:security-scheme-secrets']) =>\n updateSecuritySchemeSecrets(store, document, payload),\n clearSecuritySchemeSecrets: (payload: AuthEvents['auth:clear:security-scheme-secrets']) =>\n clearSecuritySchemeSecrets(store, document, payload),\n updateSelectedAuthTab: (payload: AuthEvents['auth:update:active-index']) =>\n updateSelectedAuthTab(store, document, payload),\n updateSelectedScopes: (payload: AuthEvents['auth:update:selected-scopes']) =>\n updateSelectedScopes(store, document, payload),\n deleteSecurityScheme: (payload: AuthEvents['auth:delete:security-scheme']) =>\n deleteSecurityScheme(store, document, payload),\n }\n}\n"],
5
+ "mappings": "AAEA,SAAS,2BAA2B;AACpC,SAAS,sBAAsB;AAC/B,SAAS,wCAAwC;AACjD,SAAS,oBAAoB;AAC7B,SAAS,yBAAyB;AA6B3B,MAAM,gCAAgC,OAC3C,OACA,UACA,EAAE,sBAAsB,YAAY,KAAK,MACtC;AACH,QAAM,eAAe,WAAW,qBAAqB,GAAG;AACxD,MAAI,CAAC,cAAc;AACjB;AAAA,EACF;AAGA,QAAM,YAAY,MAAM;AACtB,QAAI,KAAK,SAAS,YAAY;AAC5B,aAAO,OAAO,KAAK,uBAAuB,EAAE,MAAM,YAAY,aAAa,CAAC;AAAA,IAC9E;AAEA,WAAO,OAAO,KAAK,uBAAuB,EAAE,MAAM,aAAa,cAAc,MAAM,KAAK,MAAM,QAAQ,KAAK,OAAO,CAAC;AAAA,EACrH;AAEA,QAAM,8BAA8B,MAAM,QAAQ;AAAA,IAChD,WAAW,IAAI,OAAO,cAAc;AAClC,YAAM,mBAAmB,MAAM,oBAAoB;AAAA,QACjD,cAAc,UAAU;AAAA,QACxB,YAAY,CAAC,UAAU,CAAC,SAAS,YAAY,kBAAkB,KAAK;AAAA,QACpE,YAAY;AAAA,MACd,CAAC;AAED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from '../events/definitions/document.js';
3
3
  import type { WorkspaceDocument } from '../schemas.js';
4
- /**
5
- * Toggle setting selected security schemes at the operation level
6
- */
7
- export declare const toggleSecurity: (document: WorkspaceDocument | null) => void;
8
4
  /**
9
5
  * Updates the "watch mode" state of the given document.
10
6
  *
@@ -53,7 +49,6 @@ export declare const documentMutatorsFactory: ({ document, store, }: {
53
49
  document: WorkspaceDocument | null;
54
50
  store: WorkspaceStore | null;
55
51
  }) => {
56
- toggleSecurity: () => void;
57
52
  updateDocumentInfo: (payload: DocumentEvents["document:update:info"]) => void;
58
53
  updateWatchMode: (payload: DocumentEvents["document:update:watch-mode"]) => void;
59
54
  updateDocumentIcon: (payload: DocumentEvents["document:update:icon"]) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../src/mutators/document.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAEnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAElD;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,UAAU,iBAAiB,GAAG,IAAI,SAMhE,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAI,UAAU,iBAAiB,GAAG,IAAI,EAAE,WAAW,OAAO,SAOrF,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,GAC7B,UAAU,iBAAiB,GAAG,IAAI,EAClC,SAAS,cAAc,CAAC,sBAAsB,CAAC,SAahD,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,iBAAiB,GAAG,IAAI,EAAE,MAAM,MAAM,SASlF,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,GAC9B,OAAO,cAAc,GAAG,IAAI,EAC5B,SAAS,cAAc,CAAC,gCAAgC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G,IAAI,EAAE,SAAS,cAAc,CAAC,0BAA0B,CAAC,SAM/G,CAAA;AAED,eAAO,MAAM,uBAAuB,GAAI,sBAGrC;IACD,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAClC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAA;CAC7B;kCAEiC,cAAc,CAAC,sBAAsB,CAAC;+BACzC,cAAc,CAAC,4BAA4B,CAAC;kCACzC,cAAc,CAAC,sBAAsB,CAAC;mCACrC,cAAc,CAAC,gCAAgC,CAAC;8BAErD,cAAc,CAAC,0BAA0B,CAAC;CAEvE,CAAA"}
@@ -1,10 +1,4 @@
1
1
  import { mergeObjects } from "../helpers/merge-object.js";
2
- const toggleSecurity = (document) => {
3
- if (!document) {
4
- return;
5
- }
6
- document["x-scalar-set-operation-security"] = !document["x-scalar-set-operation-security"];
7
- };
8
2
  const updateWatchMode = (document, watchMode) => {
9
3
  if (!document) {
10
4
  return;
@@ -61,7 +55,6 @@ const documentMutatorsFactory = ({
61
55
  store
62
56
  }) => {
63
57
  return {
64
- toggleSecurity: () => toggleSecurity(document),
65
58
  updateDocumentInfo: (payload) => updateDocumentInfo(document, payload),
66
59
  updateWatchMode: (payload) => updateWatchMode(document, payload),
67
60
  updateDocumentIcon: (payload) => updateDocumentIcon(document, payload),
@@ -73,7 +66,6 @@ export {
73
66
  createEmptyDocument,
74
67
  deleteDocument,
75
68
  documentMutatorsFactory,
76
- toggleSecurity,
77
69
  updateDocumentIcon,
78
70
  updateDocumentInfo,
79
71
  updateWatchMode
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/mutators/document.ts"],
4
- "sourcesContent": ["import type { WorkspaceStore } from '@/client'\nimport type { DocumentEvents } from '@/events/definitions/document'\nimport { mergeObjects } from '@/helpers/merge-object'\nimport type { WorkspaceDocument } from '@/schemas'\n\n/**\n * Toggle setting selected security schemes at the operation level\n */\nexport const toggleSecurity = (document: WorkspaceDocument | null) => {\n if (!document) {\n return\n }\n\n document['x-scalar-set-operation-security'] = !document['x-scalar-set-operation-security']\n}\n\n/**\n * Updates the \"watch mode\" state of the given document.\n *\n * @param document WorkspaceDocument or null \u2013 The document to modify.\n * @param watchMode boolean \u2013 True enables watch mode, false disables it.\n *\n * If document is null, does nothing.\n */\nexport const updateWatchMode = (document: WorkspaceDocument | null, watchMode: boolean) => {\n if (!document) {\n return\n }\n\n // Set (or unset) the x-scalar-watch-mode property on the document\n document['x-scalar-watch-mode'] = watchMode\n}\n\n/**\n * Updates the document's info object (typically, title, description, version, etc.).\n *\n * Uses a shallow merge: only properties present in payload will be overwritten or added.\n *\n * @param document WorkspaceDocument | null \u2013 The document whose info should be updated.\n * @param payload DocumentEvents['document:update:info'] \u2013 Partial info fields to update/merge.\n *\n * If document is null, does nothing.\n */\nexport const updateDocumentInfo = (\n document: WorkspaceDocument | null,\n payload: DocumentEvents['document:update:info'],\n) => {\n if (!document) {\n return\n }\n // Merge the given payload into the document's info object\n mergeObjects(document.info, payload)\n\n // Update the document title if it is present and the navigation object is present\n // We do this because we don't want to rebuild the entire navigation object if only the title is changed\n if (payload.title && document['x-scalar-navigation']) {\n document['x-scalar-navigation'].title = payload.title\n }\n}\n\n/**\n * Update the document icon and also update the corresponding sidebar entry\n *\n * Does not perform a sidebar rebuild for performance benefit\n */\nexport const updateDocumentIcon = (document: WorkspaceDocument | null, icon: string) => {\n if (!document || !document['x-scalar-navigation']) {\n return\n }\n\n // Update the document icon\n document['x-scalar-icon'] = icon\n // Update the sidebar document icon\n document['x-scalar-navigation'].icon = icon\n}\n\n/**\n * Creates an empty OpenAPI document and adds it to the workspace.\n *\n * - If the store is null, this is a no-op.\n * - The document name must be unique; if already present, callback is called with `false`.\n * - On success, a new OpenAPI 3.1.0 document is added with a basic path and info.\n * - Callback is called with `true` if document is created.\n *\n * @param store WorkspaceStore | null \u2013 The workspace store to add the document to.\n * @param payload DocumentEvents['document:create:empty-document'] \u2013 Contains name, icon, and callback.\n */\nexport const createEmptyDocument = async (\n store: WorkspaceStore | null,\n payload: DocumentEvents['document:create:empty-document'],\n) => {\n if (!store) {\n return\n }\n\n // Check if the document already exists by name for uniqueness\n if (store.workspace.documents[payload.name]) {\n // Document name already exists, call callback with false\n payload.callback?.(false)\n return\n }\n\n // Add a new empty OpenAPI 3.1.0 document with minimal info and icon\n await store.addDocument({\n name: payload.name,\n document: {\n openapi: '3.1.0',\n info: { title: payload.name, version: '1.0.0' },\n paths: {\n '/': {\n get: {},\n },\n },\n 'x-scalar-icon': payload.icon,\n },\n })\n\n // Notify success via callback\n payload.callback?.(true)\n}\n\n/**\n * Deletes a document from the workspace by its name.\n *\n * Safely no-ops if the store is null.\n */\nexport const deleteDocument = (store: WorkspaceStore | null, payload: DocumentEvents['document:delete:document']) => {\n if (!store) {\n return\n }\n\n store.deleteDocument(payload.name)\n}\n\nexport const documentMutatorsFactory = ({\n document,\n store,\n}: {\n document: WorkspaceDocument | null\n store: WorkspaceStore | null\n}) => {\n return {\n toggleSecurity: () => toggleSecurity(document),\n updateDocumentInfo: (payload: DocumentEvents['document:update:info']) => updateDocumentInfo(document, payload),\n updateWatchMode: (payload: DocumentEvents['document:update:watch-mode']) => updateWatchMode(document, payload),\n updateDocumentIcon: (payload: DocumentEvents['document:update:icon']) => updateDocumentIcon(document, payload),\n createEmptyDocument: (payload: DocumentEvents['document:create:empty-document']) =>\n createEmptyDocument(store, payload),\n deleteDocument: (payload: DocumentEvents['document:delete:document']) => deleteDocument(store, payload),\n }\n}\n"],
5
- "mappings": "AAEA,SAAS,oBAAoB;AAMtB,MAAM,iBAAiB,CAAC,aAAuC;AACpE,MAAI,CAAC,UAAU;AACb;AAAA,EACF;AAEA,WAAS,iCAAiC,IAAI,CAAC,SAAS,iCAAiC;AAC3F;AAUO,MAAM,kBAAkB,CAAC,UAAoC,cAAuB;AACzF,MAAI,CAAC,UAAU;AACb;AAAA,EACF;AAGA,WAAS,qBAAqB,IAAI;AACpC;AAYO,MAAM,qBAAqB,CAChC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C7G,qBAAqB,CAAC,YACpB,oBAAoB,OAAO,OAAO;AAAA,IACpC,gBAAgB,CAAC,YAAwD,eAAe,OAAO,OAAO;AAAA,EACxG;AACF;",
4
+ "sourcesContent": ["import type { WorkspaceStore } from '@/client'\nimport type { DocumentEvents } from '@/events/definitions/document'\nimport { mergeObjects } from '@/helpers/merge-object'\nimport type { WorkspaceDocument } from '@/schemas'\n\n/**\n * Updates the \"watch mode\" state of the given document.\n *\n * @param document WorkspaceDocument or null \u2013 The document to modify.\n * @param watchMode boolean \u2013 True enables watch mode, false disables it.\n *\n * If document is null, does nothing.\n */\nexport const updateWatchMode = (document: WorkspaceDocument | null, watchMode: boolean) => {\n if (!document) {\n return\n }\n\n // Set (or unset) the x-scalar-watch-mode property on the document\n document['x-scalar-watch-mode'] = watchMode\n}\n\n/**\n * Updates the document's info object (typically, title, description, version, etc.).\n *\n * Uses a shallow merge: only properties present in payload will be overwritten or added.\n *\n * @param document WorkspaceDocument | null \u2013 The document whose info should be updated.\n * @param payload DocumentEvents['document:update:info'] \u2013 Partial info fields to update/merge.\n *\n * If document is null, does nothing.\n */\nexport const updateDocumentInfo = (\n document: WorkspaceDocument | null,\n payload: DocumentEvents['document:update:info'],\n) => {\n if (!document) {\n return\n }\n // Merge the given payload into the document's info object\n mergeObjects(document.info, payload)\n\n // Update the document title if it is present and the navigation object is present\n // We do this because we don't want to rebuild the entire navigation object if only the title is changed\n if (payload.title && document['x-scalar-navigation']) {\n document['x-scalar-navigation'].title = payload.title\n }\n}\n\n/**\n * Update the document icon and also update the corresponding sidebar entry\n *\n * Does not perform a sidebar rebuild for performance benefit\n */\nexport const updateDocumentIcon = (document: WorkspaceDocument | null, icon: string) => {\n if (!document || !document['x-scalar-navigation']) {\n return\n }\n\n // Update the document icon\n document['x-scalar-icon'] = icon\n // Update the sidebar document icon\n document['x-scalar-navigation'].icon = icon\n}\n\n/**\n * Creates an empty OpenAPI document and adds it to the workspace.\n *\n * - If the store is null, this is a no-op.\n * - The document name must be unique; if already present, callback is called with `false`.\n * - On success, a new OpenAPI 3.1.0 document is added with a basic path and info.\n * - Callback is called with `true` if document is created.\n *\n * @param store WorkspaceStore | null \u2013 The workspace store to add the document to.\n * @param payload DocumentEvents['document:create:empty-document'] \u2013 Contains name, icon, and callback.\n */\nexport const createEmptyDocument = async (\n store: WorkspaceStore | null,\n payload: DocumentEvents['document:create:empty-document'],\n) => {\n if (!store) {\n return\n }\n\n // Check if the document already exists by name for uniqueness\n if (store.workspace.documents[payload.name]) {\n // Document name already exists, call callback with false\n payload.callback?.(false)\n return\n }\n\n // Add a new empty OpenAPI 3.1.0 document with minimal info and icon\n await store.addDocument({\n name: payload.name,\n document: {\n openapi: '3.1.0',\n info: { title: payload.name, version: '1.0.0' },\n paths: {\n '/': {\n get: {},\n },\n },\n 'x-scalar-icon': payload.icon,\n },\n })\n\n // Notify success via callback\n payload.callback?.(true)\n}\n\n/**\n * Deletes a document from the workspace by its name.\n *\n * Safely no-ops if the store is null.\n */\nexport const deleteDocument = (store: WorkspaceStore | null, payload: DocumentEvents['document:delete:document']) => {\n if (!store) {\n return\n }\n\n store.deleteDocument(payload.name)\n}\n\nexport const documentMutatorsFactory = ({\n document,\n store,\n}: {\n document: WorkspaceDocument | null\n store: WorkspaceStore | null\n}) => {\n return {\n updateDocumentInfo: (payload: DocumentEvents['document:update:info']) => updateDocumentInfo(document, payload),\n updateWatchMode: (payload: DocumentEvents['document:update:watch-mode']) => updateWatchMode(document, payload),\n updateDocumentIcon: (payload: DocumentEvents['document:update:icon']) => updateDocumentIcon(document, payload),\n createEmptyDocument: (payload: DocumentEvents['document:create:empty-document']) =>\n createEmptyDocument(store, payload),\n deleteDocument: (payload: DocumentEvents['document:delete:document']) => deleteDocument(store, payload),\n }\n}\n"],
5
+ "mappings": "AAEA,SAAS,oBAAoB;AAWtB,MAAM,kBAAkB,CAAC,UAAoC,cAAuB;AACzF,MAAI,CAAC,UAAU;AACb;AAAA,EACF;AAGA,WAAS,qBAAqB,IA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BAAqB,CAAC,YACpB,oBAAoB,OAAO,OAAO;AAAA,IACpC,gBAAgB,CAAC,YAAwD,eAAe,OAAO,OAAO;AAAA,EACxG;AACF;",
6
6
  "names": []
7
7
  }
@@ -64,6 +64,7 @@ export declare function generateClientMutators(store: WorkspaceStore | null): {
64
64
  active: () => {
65
65
  auth: {
66
66
  updateSelectedSecuritySchemes: (payload: import("../events/definitions/auth.js").AuthEvents["auth:update:selected-security-schemes"]) => Promise<void>;
67
+ clearSelectedSecuritySchemes: (payload: import("../events/definitions/auth.js").AuthEvents["auth:clear:selected-security-schemes"]) => void;
67
68
  updateSecurityScheme: (payload: import("../events/definitions/auth.js").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;
68
69
  updateSecuritySchemeSecrets: (payload: import("../events/definitions/auth.js").AuthEvents["auth:update:security-scheme-secrets"]) => void;
69
70
  clearSecuritySchemeSecrets: (payload: import("../events/definitions/auth.js").AuthEvents["auth:clear:security-scheme-secrets"]) => void;
@@ -82,7 +83,6 @@ export declare function generateClientMutators(store: WorkspaceStore | null): {
82
83
  }) => boolean;
83
84
  };
84
85
  document: {
85
- toggleSecurity: () => void;
86
86
  updateDocumentInfo: (payload: import("../events/definitions/document.js").DocumentEvents["document:update:info"]) => void;
87
87
  updateWatchMode: (payload: import("../events/definitions/document.js").DocumentEvents["document:update:watch-mode"]) => void;
88
88
  updateDocumentIcon: (payload: import("../events/definitions/document.js").DocumentEvents["document:update:icon"]) => void;
@@ -91,7 +91,7 @@ export declare function generateClientMutators(store: WorkspaceStore | null): {
91
91
  };
92
92
  operation: {
93
93
  createOperation: (payload: import("../events/index.js").OperationEvents["operation:create:operation"]) => string | undefined;
94
- updateOperationSummary: (payload: import("../events/index.js").OperationEvents["operation:update:summary"]) => void;
94
+ updateOperationMeta: (payload: import("../events/index.js").OperationEvents["operation:update:meta"]) => void;
95
95
  updateOperationPathMethod: (payload: import("../events/index.js").OperationEvents["operation:update:pathMethod"]) => void;
96
96
  deleteOperation: (payload: import("../events/index.js").OperationEvents["operation:delete:operation"]) => void;
97
97
  createOperationDraftExample: (payload: import("../events/index.js").OperationEvents["operation:create:draft-example"]) => void;
@@ -108,9 +108,11 @@ export declare function generateClientMutators(store: WorkspaceStore | null): {
108
108
  reloadOperationHistory: (payload: import("../events/index.js").OperationEvents["operation:reload:history"]) => void;
109
109
  };
110
110
  server: {
111
- addServer: () => import("../schemas/v3.1/strict/server.js").ServerObject | undefined;
111
+ initializeServers: (payload: import("../events/definitions/server.js").ServerEvents["server:initialize:servers"]) => import("../schemas/v3.1/strict/server.js").ServerObject[] | undefined;
112
+ addServer: (payload: import("../events/definitions/server.js").ServerEvents["server:add:server"]) => import("../schemas/v3.1/strict/server.js").ServerObject | undefined;
112
113
  updateServer: (payload: import("../events/definitions/server.js").ServerEvents["server:update:server"]) => import("../schemas/v3.1/strict/server.js").ServerObject | undefined;
113
114
  deleteServer: (payload: import("../events/definitions/server.js").ServerEvents["server:delete:server"]) => void;
115
+ clearServers: (payload: import("../events/definitions/server.js").ServerEvents["server:clear:servers"]) => void;
114
116
  updateServerVariables: (payload: import("../events/definitions/server.js").ServerEvents["server:update:variables"]) => import("../schemas/v3.1/strict/server-variable.js").ServerVariableObject | undefined;
115
117
  updateSelectedServer: (payload: import("../events/definitions/server.js").ServerEvents["server:update:selected"]) => string | undefined;
116
118
  };
@@ -147,6 +149,7 @@ export declare function generateClientMutators(store: WorkspaceStore | null): {
147
149
  doc: (name: string) => {
148
150
  auth: {
149
151
  updateSelectedSecuritySchemes: (payload: import("../events/definitions/auth.js").AuthEvents["auth:update:selected-security-schemes"]) => Promise<void>;
152
+ clearSelectedSecuritySchemes: (payload: import("../events/definitions/auth.js").AuthEvents["auth:clear:selected-security-schemes"]) => void;
150
153
  updateSecurityScheme: (payload: import("../events/definitions/auth.js").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;
151
154
  updateSecuritySchemeSecrets: (payload: import("../events/definitions/auth.js").AuthEvents["auth:update:security-scheme-secrets"]) => void;
152
155
  clearSecuritySchemeSecrets: (payload: import("../events/definitions/auth.js").AuthEvents["auth:clear:security-scheme-secrets"]) => void;
@@ -165,7 +168,6 @@ export declare function generateClientMutators(store: WorkspaceStore | null): {
165
168
  }) => boolean;
166
169
  };
167
170
  document: {
168
- toggleSecurity: () => void;
169
171
  updateDocumentInfo: (payload: import("../events/definitions/document.js").DocumentEvents["document:update:info"]) => void;
170
172
  updateWatchMode: (payload: import("../events/definitions/document.js").DocumentEvents["document:update:watch-mode"]) => void;
171
173
  updateDocumentIcon: (payload: import("../events/definitions/document.js").DocumentEvents["document:update:icon"]) => void;
@@ -174,7 +176,7 @@ export declare function generateClientMutators(store: WorkspaceStore | null): {
174
176
  };
175
177
  operation: {
176
178
  createOperation: (payload: import("../events/index.js").OperationEvents["operation:create:operation"]) => string | undefined;
177
- updateOperationSummary: (payload: import("../events/index.js").OperationEvents["operation:update:summary"]) => void;
179
+ updateOperationMeta: (payload: import("../events/index.js").OperationEvents["operation:update:meta"]) => void;
178
180
  updateOperationPathMethod: (payload: import("../events/index.js").OperationEvents["operation:update:pathMethod"]) => void;
179
181
  deleteOperation: (payload: import("../events/index.js").OperationEvents["operation:delete:operation"]) => void;
180
182
  createOperationDraftExample: (payload: import("../events/index.js").OperationEvents["operation:create:draft-example"]) => void;
@@ -191,9 +193,11 @@ export declare function generateClientMutators(store: WorkspaceStore | null): {
191
193
  reloadOperationHistory: (payload: import("../events/index.js").OperationEvents["operation:reload:history"]) => void;
192
194
  };
193
195
  server: {
194
- addServer: () => import("../schemas/v3.1/strict/server.js").ServerObject | undefined;
196
+ initializeServers: (payload: import("../events/definitions/server.js").ServerEvents["server:initialize:servers"]) => import("../schemas/v3.1/strict/server.js").ServerObject[] | undefined;
197
+ addServer: (payload: import("../events/definitions/server.js").ServerEvents["server:add:server"]) => import("../schemas/v3.1/strict/server.js").ServerObject | undefined;
195
198
  updateServer: (payload: import("../events/definitions/server.js").ServerEvents["server:update:server"]) => import("../schemas/v3.1/strict/server.js").ServerObject | undefined;
196
199
  deleteServer: (payload: import("../events/definitions/server.js").ServerEvents["server:delete:server"]) => void;
200
+ clearServers: (payload: import("../events/definitions/server.js").ServerEvents["server:clear:servers"]) => void;
197
201
  updateServerVariables: (payload: import("../events/definitions/server.js").ServerEvents["server:update:variables"]) => import("../schemas/v3.1/strict/server-variable.js").ServerVariableObject | undefined;
198
202
  updateSelectedServer: (payload: import("../events/definitions/server.js").ServerEvents["server:update:selected"]) => string | undefined;
199
203
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mutators/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAa9C;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI;IAqC/D;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEH;;;OAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEH;;;;OAIG;gBACS,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAErB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mutators/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAa9C;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI;IAqC/D;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEH;;;OAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEH;;;;OAIG;gBACS,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAErB"}
@@ -7,7 +7,7 @@ export declare const operationMutatorsFactory: ({ document, store, }: {
7
7
  store: WorkspaceStore | null;
8
8
  }) => {
9
9
  createOperation: (payload: OperationEvents["operation:create:operation"]) => string | undefined;
10
- updateOperationSummary: (payload: OperationEvents["operation:update:summary"]) => void;
10
+ updateOperationMeta: (payload: OperationEvents["operation:update:meta"]) => void;
11
11
  updateOperationPathMethod: (payload: OperationEvents["operation:update:pathMethod"]) => void;
12
12
  deleteOperation: (payload: OperationEvents["operation:delete:operation"]) => void;
13
13
  createOperationDraftExample: (payload: OperationEvents["operation:create:draft-example"]) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mutators/operation/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAsBrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAElD,eAAO,MAAM,wBAAwB,GAAI,sBAGtC;IACD,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAClC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAA;CAC7B;+BAE8B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,CAAC;8CAEvC,eAAe,CAAC,mCAAmC,CAAC;wCAE1D,eAAe,CAAC,4BAA4B,CAAC;wCAE7C,eAAe,CAAC,4BAA4B,CAAC;4CAEzC,eAAe,CAAC,iCAAiC,CAAC;qDAEzC,eAAe,CAAC,0CAA0C,CAAC;iDAE/D,eAAe,CAAC,oCAAoC,CAAC;mDAEnD,eAAe,CAAC,wCAAwC,CAAC;oCAExE,WAAW,CAAC,2BAA2B,CAAC;sCAEtC,eAAe,CAAC,0BAA0B,CAAC;CAGhF,CAAA"}
@@ -10,8 +10,8 @@ import {
10
10
  createOperationDraftExample,
11
11
  deleteOperation,
12
12
  deleteOperationExample,
13
- updateOperationPathMethod,
14
- updateOperationSummary
13
+ updateOperationMeta,
14
+ updateOperationPathMethod
15
15
  } from "../../mutators/operation/operation.js";
16
16
  import {
17
17
  deleteAllOperationParameters,
@@ -25,7 +25,7 @@ const operationMutatorsFactory = ({
25
25
  }) => {
26
26
  return {
27
27
  createOperation: (payload) => createOperation(store, payload),
28
- updateOperationSummary: (payload) => updateOperationSummary(store, document, payload),
28
+ updateOperationMeta: (payload) => updateOperationMeta(store, document, payload),
29
29
  updateOperationPathMethod: (payload) => updateOperationPathMethod(document, store, payload),
30
30
  deleteOperation: (payload) => deleteOperation(store, payload),
31
31
  createOperationDraftExample: (payload) => createOperationDraftExample(store, payload),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/mutators/operation/index.ts"],
4
- "sourcesContent": ["import type { WorkspaceStore } from '@/client'\nimport type { HooksEvents } from '@/events/definitions/hooks'\nimport type { OperationEvents } from '@/events/definitions/operation'\nimport {\n updateOperationRequestBodyContentType,\n updateOperationRequestBodyExample,\n updateOperationRequestBodyFormValue,\n} from '@/mutators/operation/body'\nimport { updateOperationExtension } from '@/mutators/operation/extensions'\nimport { addResponseToHistory, reloadOperationHistory } from '@/mutators/operation/history'\nimport {\n createOperation,\n createOperationDraftExample,\n deleteOperation,\n deleteOperationExample,\n updateOperationPathMethod,\n updateOperationSummary,\n} from '@/mutators/operation/operation'\nimport {\n deleteAllOperationParameters,\n deleteOperationParameter,\n updateOperationExtraParameters,\n upsertOperationParameter,\n} from '@/mutators/operation/parameters'\nimport type { WorkspaceDocument } from '@/schemas'\n\nexport const operationMutatorsFactory = ({\n document,\n store,\n}: {\n document: WorkspaceDocument | null\n store: WorkspaceStore | null\n}) => {\n return {\n createOperation: (payload: OperationEvents['operation:create:operation']) => createOperation(store, payload),\n updateOperationSummary: (payload: OperationEvents['operation:update:summary']) =>\n updateOperationSummary(store, document, payload),\n updateOperationPathMethod: (payload: OperationEvents['operation:update:pathMethod']) =>\n updateOperationPathMethod(document, store, payload),\n deleteOperation: (payload: OperationEvents['operation:delete:operation']) => deleteOperation(store, payload),\n createOperationDraftExample: (payload: OperationEvents['operation:create:draft-example']) =>\n createOperationDraftExample(store, payload),\n deleteOperationExample: (payload: OperationEvents['operation:delete:example']) =>\n deleteOperationExample(store, payload),\n updateOperationExtension: (payload: OperationEvents['operation:update:extension']) =>\n updateOperationExtension(document, payload),\n updateOperationExtraParameters: (payload: OperationEvents['operation:update:extra-parameters']) =>\n updateOperationExtraParameters(document, payload),\n upsertOperationParameter: (payload: OperationEvents['operation:upsert:parameter']) =>\n upsertOperationParameter(document, payload),\n deleteOperationParameter: (payload: OperationEvents['operation:delete:parameter']) =>\n deleteOperationParameter(document, payload),\n deleteAllOperationParameters: (payload: OperationEvents['operation:delete-all:parameters']) =>\n deleteAllOperationParameters(document, payload),\n updateOperationRequestBodyContentType: (payload: OperationEvents['operation:update:requestBody:contentType']) =>\n updateOperationRequestBodyContentType(document, payload),\n updateOperationRequestBodyExample: (payload: OperationEvents['operation:update:requestBody:value']) =>\n updateOperationRequestBodyExample(document, payload),\n updateOperationRequestBodyFormValue: (payload: OperationEvents['operation:update:requestBody:formValue']) =>\n updateOperationRequestBodyFormValue(document, payload),\n addResponseToHistory: (payload: HooksEvents['hooks:on:request:complete']) =>\n addResponseToHistory(store, document, payload),\n reloadOperationHistory: (payload: OperationEvents['operation:reload:history']) =>\n reloadOperationHistory(store, document, payload),\n }\n}\n"],
5
- "mappings": "AAGA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gCAAgC;AACzC,SAAS,sBAAsB,8BAA8B;AAC7D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGA,MAAM,2BAA2B,CAAC;AAAA,EACvC;AAAA,EACA;AACF,MAGM;AACJ,SAAO;AAAA,IACL,iBAAiB,CAAC,YAA2D,gBAAgB,OAAO,OAAO;AAAA,IAC3G,wBAAwB,CAAC,YACvB,uBAAuB,OAAO,UAAU,OAAO;AAAA,IACjD,2BAA2B,CAAC,YAC1B,0BAA0B,UAAU,OAAO,OAAO;AAAA,IACpD,iBAAiB,CAAC,YAA2D,gBAAgB,OAAO,OAAO;AAAA,IAC3G,6BAA6B,CAAC,YAC5B,4BAA4B,OAAO,OAAO;AAAA,IAC5C,wBAAwB,CAAC,YACvB,uBAAuB,OAAO,OAAO;AAAA,IACvC,0BAA0B,CAAC,YACzB,yBAAyB,UAAU,OAAO;AAAA,IAC5C,gCAAgC,CAAC,YAC/B,+BAA+B,UAAU,OAAO;AAAA,IAClD,0BAA0B,CAAC,YACzB,yBAAyB,UAAU,OAAO;AAAA,IAC5C,0BAA0B,CAAC,YACzB,yBAAyB,UAAU,OAAO;AAAA,IAC5C,8BAA8B,CAAC,YAC7B,6BAA6B,UAAU,OAAO;AAAA,IAChD,uCAAuC,CAAC,YACtC,sCAAsC,UAAU,OAAO;AAAA,IACzD,mCAAmC,CAAC,YAClC,kCAAkC,UAAU,OAAO;AAAA,IACrD,qCAAqC,CAAC,YACpC,oCAAoC,UAAU,OAAO;AAAA,IACvD,sBAAsB,CAAC,YACrB,qBAAqB,OAAO,UAAU,OAAO;AAAA,IAC/C,wBAAwB,CAAC,YACvB,uBAAuB,OAAO,UAAU,OAAO;AAAA,EACnD;AACF;",
4
+ "sourcesContent": ["import type { WorkspaceStore } from '@/client'\nimport type { HooksEvents } from '@/events/definitions/hooks'\nimport type { OperationEvents } from '@/events/definitions/operation'\nimport {\n updateOperationRequestBodyContentType,\n updateOperationRequestBodyExample,\n updateOperationRequestBodyFormValue,\n} from '@/mutators/operation/body'\nimport { updateOperationExtension } from '@/mutators/operation/extensions'\nimport { addResponseToHistory, reloadOperationHistory } from '@/mutators/operation/history'\nimport {\n createOperation,\n createOperationDraftExample,\n deleteOperation,\n deleteOperationExample,\n updateOperationMeta,\n updateOperationPathMethod,\n} from '@/mutators/operation/operation'\nimport {\n deleteAllOperationParameters,\n deleteOperationParameter,\n updateOperationExtraParameters,\n upsertOperationParameter,\n} from '@/mutators/operation/parameters'\nimport type { WorkspaceDocument } from '@/schemas'\n\nexport const operationMutatorsFactory = ({\n document,\n store,\n}: {\n document: WorkspaceDocument | null\n store: WorkspaceStore | null\n}) => {\n return {\n createOperation: (payload: OperationEvents['operation:create:operation']) => createOperation(store, payload),\n updateOperationMeta: (payload: OperationEvents['operation:update:meta']) =>\n updateOperationMeta(store, document, payload),\n updateOperationPathMethod: (payload: OperationEvents['operation:update:pathMethod']) =>\n updateOperationPathMethod(document, store, payload),\n deleteOperation: (payload: OperationEvents['operation:delete:operation']) => deleteOperation(store, payload),\n createOperationDraftExample: (payload: OperationEvents['operation:create:draft-example']) =>\n createOperationDraftExample(store, payload),\n deleteOperationExample: (payload: OperationEvents['operation:delete:example']) =>\n deleteOperationExample(store, payload),\n updateOperationExtension: (payload: OperationEvents['operation:update:extension']) =>\n updateOperationExtension(document, payload),\n updateOperationExtraParameters: (payload: OperationEvents['operation:update:extra-parameters']) =>\n updateOperationExtraParameters(document, payload),\n upsertOperationParameter: (payload: OperationEvents['operation:upsert:parameter']) =>\n upsertOperationParameter(document, payload),\n deleteOperationParameter: (payload: OperationEvents['operation:delete:parameter']) =>\n deleteOperationParameter(document, payload),\n deleteAllOperationParameters: (payload: OperationEvents['operation:delete-all:parameters']) =>\n deleteAllOperationParameters(document, payload),\n updateOperationRequestBodyContentType: (payload: OperationEvents['operation:update:requestBody:contentType']) =>\n updateOperationRequestBodyContentType(document, payload),\n updateOperationRequestBodyExample: (payload: OperationEvents['operation:update:requestBody:value']) =>\n updateOperationRequestBodyExample(document, payload),\n updateOperationRequestBodyFormValue: (payload: OperationEvents['operation:update:requestBody:formValue']) =>\n updateOperationRequestBodyFormValue(document, payload),\n addResponseToHistory: (payload: HooksEvents['hooks:on:request:complete']) =>\n addResponseToHistory(store, document, payload),\n reloadOperationHistory: (payload: OperationEvents['operation:reload:history']) =>\n reloadOperationHistory(store, document, payload),\n }\n}\n"],
5
+ "mappings": "AAGA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gCAAgC;AACzC,SAAS,sBAAsB,8BAA8B;AAC7D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGA,MAAM,2BAA2B,CAAC;AAAA,EACvC;AAAA,EACA;AACF,MAGM;AACJ,SAAO;AAAA,IACL,iBAAiB,CAAC,YAA2D,gBAAgB,OAAO,OAAO;AAAA,IAC3G,qBAAqB,CAAC,YACpB,oBAAoB,OAAO,UAAU,OAAO;AAAA,IAC9C,2BAA2B,CAAC,YAC1B,0BAA0B,UAAU,OAAO,OAAO;AAAA,IACpD,iBAAiB,CAAC,YAA2D,gBAAgB,OAAO,OAAO;AAAA,IAC3G,6BAA6B,CAAC,YAC5B,4BAA4B,OAAO,OAAO;AAAA,IAC5C,wBAAwB,CAAC,YACvB,uBAAuB,OAAO,OAAO;AAAA,IACvC,0BAA0B,CAAC,YACzB,yBAAyB,UAAU,OAAO;AAAA,IAC5C,gCAAgC,CAAC,YAC/B,+BAA+B,UAAU,OAAO;AAAA,IAClD,0BAA0B,CAAC,YACzB,yBAAyB,UAAU,OAAO;AAAA,IAC5C,0BAA0B,CAAC,YACzB,yBAAyB,UAAU,OAAO;AAAA,IAC5C,8BAA8B,CAAC,YAC7B,6BAA6B,UAAU,OAAO;AAAA,IAChD,uCAAuC,CAAC,YACtC,sCAAsC,UAAU,OAAO;AAAA,IACzD,mCAAmC,CAAC,YAClC,kCAAkC,UAAU,OAAO;AAAA,IACrD,qCAAqC,CAAC,YACpC,oCAAoC,UAAU,OAAO;AAAA,IACvD,sBAAsB,CAAC,YACrB,qBAAqB,OAAO,UAAU,OAAO;AAAA,IAC/C,wBAAwB,CAAC,YACvB,uBAAuB,OAAO,UAAU,OAAO;AAAA,EACnD;AACF;",
6
6
  "names": []
7
7
  }
@@ -19,20 +19,18 @@ import type { WorkspaceDocument } from '../../schemas.js';
19
19
  */
20
20
  export declare const createOperation: (workspaceStore: WorkspaceStore | null, payload: OperationEvents["operation:create:operation"]) => string | undefined;
21
21
  /**
22
- * Updates the `summary` of an operation.
22
+ * Updates the `description` of an operation.
23
23
  * Safely no-ops if the document or operation does not exist.
24
24
  *
25
25
  * Example:
26
26
  * ```ts
27
- * updateOperationSummary(
27
+ * updateOperationDescription(
28
28
  * document,
29
- * {
30
- * meta: { method: 'get', path: '/users/{id}' },
31
- * payload: { summary: 'Get a single user' },
29
+ * { meta: { method: 'get', path: '/users' }, payload: { description: 'Get a single user' },
32
30
  * })
33
31
  * ```
34
32
  */
35
- export declare const updateOperationSummary: (store: WorkspaceStore | null, document: WorkspaceDocument | null, { meta, payload: { summary } }: OperationEvents["operation:update:summary"]) => void;
33
+ export declare const updateOperationMeta: (store: WorkspaceStore | null, document: WorkspaceDocument | null, { meta, payload }: OperationEvents["operation:update:meta"]) => void;
36
34
  /**
37
35
  * Updates the HTTP method and/or path of an operation and moves it to the new location.
38
36
  * This function: