@scalar/workspace-store 0.18.0 → 0.19.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 (109) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/client.d.ts.map +1 -1
  3. package/dist/client.js +1 -1
  4. package/dist/client.js.map +2 -2
  5. package/dist/events/bus.d.ts +14 -4
  6. package/dist/events/bus.d.ts.map +1 -1
  7. package/dist/events/bus.js +12 -10
  8. package/dist/events/bus.js.map +2 -2
  9. package/dist/events/definitions/analytics.d.ts +3 -3
  10. package/dist/events/definitions/analytics.d.ts.map +1 -1
  11. package/dist/events/definitions/auth.d.ts +59 -14
  12. package/dist/events/definitions/auth.d.ts.map +1 -1
  13. package/dist/events/definitions/common.d.ts +5 -0
  14. package/dist/events/definitions/common.d.ts.map +1 -0
  15. package/dist/events/definitions/common.js +1 -0
  16. package/dist/events/definitions/common.js.map +7 -0
  17. package/dist/events/definitions/document.d.ts +2 -2
  18. package/dist/events/definitions/environment.d.ts +37 -0
  19. package/dist/events/definitions/environment.d.ts.map +1 -0
  20. package/dist/events/definitions/environment.js +1 -0
  21. package/dist/events/definitions/environment.js.map +7 -0
  22. package/dist/events/definitions/index.d.ts +3 -1
  23. package/dist/events/definitions/index.d.ts.map +1 -1
  24. package/dist/events/definitions/meta.d.ts +9 -3
  25. package/dist/events/definitions/meta.d.ts.map +1 -1
  26. package/dist/events/definitions/operation.d.ts +200 -0
  27. package/dist/events/definitions/operation.d.ts.map +1 -1
  28. package/dist/events/definitions/ui.d.ts +5 -0
  29. package/dist/events/definitions/ui.d.ts.map +1 -1
  30. package/dist/events/index.d.ts +1 -0
  31. package/dist/events/index.d.ts.map +1 -1
  32. package/dist/events/index.js.map +2 -2
  33. package/dist/helpers/generate-unique-value.d.ts +40 -0
  34. package/dist/helpers/generate-unique-value.d.ts.map +1 -0
  35. package/dist/helpers/generate-unique-value.js +42 -0
  36. package/dist/helpers/generate-unique-value.js.map +7 -0
  37. package/dist/helpers/overrides-proxy.d.ts.map +1 -1
  38. package/dist/helpers/overrides-proxy.js +1 -1
  39. package/dist/helpers/overrides-proxy.js.map +2 -2
  40. package/dist/helpers/unpack-proxy.d.ts +1 -1
  41. package/dist/helpers/unpack-proxy.d.ts.map +1 -1
  42. package/dist/helpers/unpack-proxy.js.map +2 -2
  43. package/dist/mutators/auth.d.ts +210 -0
  44. package/dist/mutators/auth.d.ts.map +1 -0
  45. package/dist/mutators/auth.js +223 -0
  46. package/dist/mutators/auth.js.map +7 -0
  47. package/dist/mutators/environment.d.ts +21 -13
  48. package/dist/mutators/environment.d.ts.map +1 -1
  49. package/dist/mutators/environment.js +46 -25
  50. package/dist/mutators/environment.js.map +2 -2
  51. package/dist/mutators/index.d.ts +6 -12
  52. package/dist/mutators/index.d.ts.map +1 -1
  53. package/dist/mutators/index.js +45 -4
  54. package/dist/mutators/index.js.map +2 -2
  55. package/dist/mutators/operation.d.ts +313 -0
  56. package/dist/mutators/operation.d.ts.map +1 -0
  57. package/dist/mutators/operation.js +340 -0
  58. package/dist/mutators/operation.js.map +7 -0
  59. package/dist/schemas/extensions/document/x-scalar-environments.d.ts +52 -0
  60. package/dist/schemas/extensions/document/x-scalar-environments.d.ts.map +1 -0
  61. package/dist/schemas/extensions/document/x-scalar-environments.js +25 -0
  62. package/dist/schemas/extensions/document/x-scalar-environments.js.map +7 -0
  63. package/dist/schemas/extensions/operation/x-scalar-operation-identifiers.d.ts +13 -0
  64. package/dist/schemas/extensions/operation/x-scalar-operation-identifiers.d.ts.map +1 -0
  65. package/dist/schemas/extensions/operation/x-scalar-operation-identifiers.js +9 -0
  66. package/dist/schemas/extensions/operation/x-scalar-operation-identifiers.js.map +7 -0
  67. package/dist/schemas/extensions/operation/x-scalar-selected-content-type.d.ts +21 -0
  68. package/dist/schemas/extensions/operation/x-scalar-selected-content-type.d.ts.map +1 -0
  69. package/dist/schemas/extensions/operation/x-scalar-selected-content-type.js +8 -0
  70. package/dist/schemas/extensions/operation/x-scalar-selected-content-type.js.map +7 -0
  71. package/dist/schemas/extensions/security/x-scalar-selected-security.d.ts +17 -0
  72. package/dist/schemas/extensions/security/x-scalar-selected-security.d.ts.map +1 -0
  73. package/dist/schemas/extensions/security/x-scalar-selected-security.js +14 -0
  74. package/dist/schemas/extensions/security/x-scalar-selected-security.js.map +7 -0
  75. package/dist/schemas/extensions/workspace/x-scalar-active-environment.d.ts +8 -0
  76. package/dist/schemas/extensions/workspace/x-scalar-active-environment.d.ts.map +1 -0
  77. package/dist/schemas/extensions/workspace/x-scalar-active-environment.js +8 -0
  78. package/dist/schemas/extensions/workspace/x-scalar-active-environment.js.map +7 -0
  79. package/dist/schemas/inmemory-workspace.d.ts +56 -24
  80. package/dist/schemas/inmemory-workspace.d.ts.map +1 -1
  81. package/dist/schemas/reference-config/index.d.ts +28 -12
  82. package/dist/schemas/reference-config/index.d.ts.map +1 -1
  83. package/dist/schemas/reference-config/settings.d.ts +28 -12
  84. package/dist/schemas/reference-config/settings.d.ts.map +1 -1
  85. package/dist/schemas/v3.1/strict/openapi-document.d.ts +956 -413
  86. package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
  87. package/dist/schemas/v3.1/strict/openapi-document.js +9 -6
  88. package/dist/schemas/v3.1/strict/openapi-document.js.map +2 -2
  89. package/dist/schemas/v3.1/strict/operation.d.ts +10 -6
  90. package/dist/schemas/v3.1/strict/operation.d.ts.map +1 -1
  91. package/dist/schemas/v3.1/strict/operation.js +9 -7
  92. package/dist/schemas/v3.1/strict/operation.js.map +2 -2
  93. package/dist/schemas/v3.1/strict/request-body.d.ts +6 -3
  94. package/dist/schemas/v3.1/strict/request-body.d.ts.map +1 -1
  95. package/dist/schemas/v3.1/strict/request-body.js +15 -8
  96. package/dist/schemas/v3.1/strict/request-body.js.map +2 -2
  97. package/dist/schemas/workspace-specification/config.d.ts +28 -12
  98. package/dist/schemas/workspace-specification/config.d.ts.map +1 -1
  99. package/dist/schemas/workspace-specification/index.d.ts +28 -12
  100. package/dist/schemas/workspace-specification/index.d.ts.map +1 -1
  101. package/dist/schemas/workspace.d.ts +227 -103
  102. package/dist/schemas/workspace.d.ts.map +1 -1
  103. package/dist/schemas/workspace.js +16 -10
  104. package/dist/schemas/workspace.js.map +2 -2
  105. package/package.json +9 -4
  106. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-environments.d.ts +0 -33
  107. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-environments.d.ts.map +0 -1
  108. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-environments.js +0 -23
  109. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-environments.js.map +0 -7
@@ -1,30 +1,75 @@
1
+ import type { AuthMeta, SecuritySchemeUpdate } from '../../mutators/auth.js';
1
2
  import type { SecurityRequirementObject, SecuritySchemeObject } from '../../schemas/v3.1/strict/openapi-document.js';
2
3
  /** Event definitions for auth */
3
4
  export type AuthEvents = {
4
5
  /**
5
- * Add a new security scheme
6
+ * Update the selected security schemes for a document or specific operation.
7
+ * Triggers when the user picks or adds new auth schemes in the UI.
8
+ * - `selectedRequirements` is the current array of selected security requirement objects.
9
+ * - `newSchemes` lists new security schemes (with names and definitions) to be created and added.
10
+ * - `meta` describes the target (whole document or a specific operation).
6
11
  */
7
- 'add:security-scheme': {
8
- /** The name of the security scheme to add */
12
+ 'auth:update:selected-security-schemes': {
13
+ /** Security requirement objects representing the full updated selection */
14
+ selectedRequirements: SecurityRequirementObject[];
15
+ /** New security scheme definitions to add (name & scheme definition) */
16
+ newSchemes: {
17
+ name: string;
18
+ scheme: SecuritySchemeObject;
19
+ }[];
20
+ /** Meta describing update scope (document or operation) */
21
+ meta: AuthMeta;
22
+ };
23
+ /**
24
+ * Update the currently active authentication tab index for the selected security schemes.
25
+ * Fires when the user changes which authentication method is actively edited in the UI (e.g., switches between multiple selected auth schemes).
26
+ * - `index` is the new active tab index to set.
27
+ * - `meta` describes the update scope (document or specific operation).
28
+ */
29
+ 'auth:update:active-index': {
30
+ /** The index of the auth tab to set as active */
31
+ index: number;
32
+ /** Meta information for the auth update */
33
+ meta: AuthMeta;
34
+ };
35
+ /**
36
+ * Update a security scheme in the OpenAPI document's components object.
37
+ * Use this event to update secret information or configuration for UI-auth flows,
38
+ * such as username, password, tokens for HTTP/ApiKey/OAuth2 schemes.
39
+ */
40
+ 'auth:update:security-scheme': {
41
+ /** The data to update the security scheme with */
42
+ data: SecuritySchemeUpdate;
43
+ /** The name of the security scheme to update */
9
44
  name: string;
10
- /** The payload of the security scheme to add */
11
- scheme: SecuritySchemeObject;
12
45
  };
13
46
  /**
14
- * Delete a security scheme
47
+ * Update the selected scopes for a given security scheme.
48
+ * Triggers when the user selects/deselects scopes for an OAuth2 (or other scopes-supporting) scheme in the UI.
15
49
  */
16
- 'delete:security-scheme': {
17
- /** Name of the security scheme to delete */
50
+ 'auth:update:selected-scopes': {
51
+ /** The id of the security scheme to update the scopes for */
52
+ id: string[];
53
+ /** The name of the security scheme to update the scopes for */
18
54
  name: string;
55
+ /** The scopes to update the selected scopes with */
56
+ scopes: string[];
57
+ /** Meta information for the auth update */
58
+ meta: AuthMeta;
19
59
  };
20
60
  /**
21
- * Select the security schemes
61
+ * Delete one or more security schemes from the OpenAPI document.
62
+ *
63
+ * When triggered, removes the specified security scheme(s) from components.securitySchemes,
64
+ * and also cleans up all associated document-level and operation-level references,
65
+ * including selected security (x-scalar-selected-security) everywhere those schemes appear.
66
+ *
67
+ * - `names`: Array of security scheme names to delete. Array is used to support deleting multiple
68
+ * schemes at once, including multi-scheme (composite/complex) authentication scenarios.
22
69
  */
23
- 'update:selected-security-schemes': {
24
- /** The security schemes to select */
25
- schemes: SecurityRequirementObject;
26
- /** The target at which the security schemes are selected */
27
- target: 'document' | 'operation';
70
+ 'auth:delete:security-scheme': {
71
+ /** Names of the security schemes to delete */
72
+ names: string[];
28
73
  };
29
74
  };
30
75
  //# sourceMappingURL=auth.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAA;AAE7G,iCAAiC;AACjC,MAAM,MAAM,UAAU,GAAG;IACvB;;OAEG;IACH,qBAAqB,EAAE;QACrB,6CAA6C;QAC7C,IAAI,EAAE,MAAM,CAAA;QACZ,gDAAgD;QAChD,MAAM,EAAE,oBAAoB,CAAA;KAC7B,CAAA;IACD;;OAEG;IACH,wBAAwB,EAAE;QACxB,4CAA4C;QAC5C,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IACD;;OAEG;IACH,kCAAkC,EAAE;QAClC,qCAAqC;QACrC,OAAO,EAAE,yBAAyB,CAAA;QAClC,4DAA4D;QAC5D,MAAM,EAAE,UAAU,GAAG,WAAW,CAAA;KACjC,CAAA;CACF,CAAA"}
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;;;;;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,IAAI,EAAE,oBAAoB,CAAA;QAC1B,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"}
@@ -0,0 +1,5 @@
1
+ /** Event discriminator between document and workspace */
2
+ export type CollectionType = {
3
+ collectionType: 'document' | 'workspace';
4
+ };
5
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/common.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,MAAM,MAAM,cAAc,GAAG;IAAE,cAAc,EAAE,UAAU,GAAG,WAAW,CAAA;CAAE,CAAA"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -5,10 +5,10 @@ export type DocumentEvents = {
5
5
  /**
6
6
  * Update any property in the document info object
7
7
  */
8
- 'update:document-info': PartialDeep<InfoObject>;
8
+ 'document:update:info': PartialDeep<InfoObject>;
9
9
  /**
10
10
  * Update the icon of the active document/workspace
11
11
  */
12
- 'update:document-icon': string;
12
+ 'document:update:icon': string;
13
13
  };
14
14
  //# sourceMappingURL=document.d.ts.map
@@ -0,0 +1,37 @@
1
+ import type { CollectionType } from '../../events/definitions/common.js';
2
+ import type { XScalarEnvVar, XScalarEnvironment } from '../../schemas/extensions/document/x-scalar-environments.js';
3
+ /** Event definitions for all things environment related */
4
+ export type EnvironmentEvents = {
5
+ /**
6
+ * Add OR update an environment
7
+ */
8
+ 'environment:upsert:environment': {
9
+ environmentName: string;
10
+ payload: Partial<XScalarEnvironment>;
11
+ /** Only needed when renaming the environment */
12
+ oldEnvironmentName?: string;
13
+ } & CollectionType;
14
+ /**
15
+ * Add or update an environment variable
16
+ */
17
+ 'environment:upsert:environment-variable': {
18
+ environmentName: string;
19
+ variable: XScalarEnvVar;
20
+ /** Only needed for update, omit it for add */
21
+ index?: number;
22
+ } & CollectionType;
23
+ /**
24
+ * Delete an environment
25
+ */
26
+ 'environment:delete:environment': {
27
+ environmentName: string;
28
+ } & CollectionType;
29
+ /**
30
+ * Delete an environment variable by index
31
+ */
32
+ 'environment:delete:environment-variable': {
33
+ environmentName: string;
34
+ index: number;
35
+ } & CollectionType;
36
+ };
37
+ //# sourceMappingURL=environment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/environment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAA;AAE5G,2DAA2D;AAC3D,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;OAEG;IACH,gCAAgC,EAAE;QAChC,eAAe,EAAE,MAAM,CAAA;QACvB,OAAO,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAA;QACpC,gDAAgD;QAChD,kBAAkB,CAAC,EAAE,MAAM,CAAA;KAC5B,GAAG,cAAc,CAAA;IAClB;;OAEG;IACH,yCAAyC,EAAE;QACzC,eAAe,EAAE,MAAM,CAAA;QACvB,QAAQ,EAAE,aAAa,CAAA;QACvB,8CAA8C;QAC9C,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,GAAG,cAAc,CAAA;IAClB;;OAEG;IACH,gCAAgC,EAAE;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE,GAAG,cAAc,CAAA;IAC9E;;OAEG;IACH,yCAAyC,EAAE;QAAE,eAAe,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,cAAc,CAAA;CACvG,CAAA"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=environment.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -1,3 +1,4 @@
1
+ import type { EnvironmentEvents } from '../../events/definitions/environment.js';
1
2
  import type { ServerObject } from '../../schemas/v3.1/strict/openapi-document.js';
2
3
  import type { AnalyticsEvents } from './analytics.js';
3
4
  import type { AuthEvents } from './auth.js';
@@ -6,5 +7,6 @@ import type { MetaEvents } from './meta.js';
6
7
  import type { OperationEvents } from './operation.js';
7
8
  import type { ServerEvents } from './server.js';
8
9
  import type { UIEvents } from './ui.js';
9
- export type ApiReferenceEvents<T extends keyof ServerObject = keyof ServerObject> = AuthEvents & AnalyticsEvents & DocumentEvents & MetaEvents & OperationEvents & ServerEvents<T> & UIEvents;
10
+ export type ApiReferenceEvents<T extends keyof ServerObject = keyof ServerObject> = AuthEvents & AnalyticsEvents & DocumentEvents & EnvironmentEvents & MetaEvents & OperationEvents & ServerEvents<T> & UIEvents;
11
+ export type { CollectionType } from './common.js';
10
12
  //# 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,YAAY,EAAE,MAAM,wCAAwC,CAAA;AAE1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,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f,YAAY,CAAC,CAAC,CAAC,GACf,QAAQ,CAAA;AAEV,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA"}
@@ -1,11 +1,17 @@
1
1
  import type { AvailableClients } from '@scalar/types/snippetz';
2
2
  /** Event definitions for the workspace/document meta */
3
3
  export type MetaEvents = {
4
- /** Update the dark mode theme setting */
4
+ /**
5
+ * Update the dark mode theme setting
6
+ */
5
7
  'update:dark-mode': boolean;
6
- /** Update the active document on the workspace */
8
+ /**
9
+ * Update the active document on the workspace
10
+ */
7
11
  'update:active-document': string;
8
- /** Update the selected client on the workspace */
12
+ /**
13
+ * Update the selected client on the workspace
14
+ */
9
15
  'update:selected-client': AvailableClients[number];
10
16
  };
11
17
  //# sourceMappingURL=meta.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAE9D,wDAAwD;AACxD,MAAM,MAAM,UAAU,GAAG;IACvB,yCAAyC;IACzC,kBAAkB,EAAE,OAAO,CAAA;IAC3B,kDAAkD;IAClD,wBAAwB,EAAE,MAAM,CAAA;IAChC,kDAAkD;IAClD,wBAAwB,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;CACnD,CAAA"}
1
+ {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAE9D,wDAAwD;AACxD,MAAM,MAAM,UAAU,GAAG;IACvB;;OAEG;IACH,kBAAkB,EAAE,OAAO,CAAA;IAC3B;;OAEG;IACH,wBAAwB,EAAE,MAAM,CAAA;IAChC;;OAEG;IACH,wBAAwB,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;CACnD,CAAA"}
@@ -1,3 +1,5 @@
1
+ import type { HttpMethod } from '@scalar/helpers/http/http-methods';
2
+ import type { OperationExampleMeta, OperationMeta } from '../../mutators/index.js';
1
3
  /** Event definitions for the operation */
2
4
  export type OperationEvents = {
3
5
  /**
@@ -7,5 +9,203 @@ export type OperationEvents = {
7
9
  /** The name of the example to select */
8
10
  name: string;
9
11
  };
12
+ /** ------------------------------------------------------------------------------------------------
13
+ * Operation Actions
14
+ * ------------------------------------------------------------------------------------------------ */
15
+ /**
16
+ * Fires when the user requests to send the operation (e.g., triggers "Try It" or sends a request).
17
+ * Contains the OperationExampleMeta, which identifies the operation and the example variant to use.
18
+ */
19
+ 'operation:send:request': {
20
+ meta: OperationExampleMeta;
21
+ };
22
+ /** ------------------------------------------------------------------------------------------------
23
+ * Operation Draft Mutators
24
+ * ------------------------------------------------------------------------------------------------ */
25
+ /**
26
+ * Update the summary for the operation.
27
+ * Triggers when the user edits the summary/description for an endpoint.
28
+ * The new summary is provided in the payload, and meta identifies the operation by HTTP method and path.
29
+ */
30
+ 'operation:update:summary': {
31
+ /** The new summary string to set for the operation. */
32
+ payload: {
33
+ summary: string;
34
+ };
35
+ /** Operation identity for which the summary is being updated (method and path) */
36
+ meta: OperationMeta;
37
+ };
38
+ /**
39
+ * Update the HTTP method for the operation.
40
+ * Triggers when the user changes the HTTP verb (e.g., from GET to POST) in the UI for a given operation.
41
+ */
42
+ 'operation:update:method': {
43
+ payload: {
44
+ /** The new method for the operation */
45
+ method: HttpMethod;
46
+ };
47
+ /** Identifies the target operation by original method and path */
48
+ meta: OperationMeta;
49
+ };
50
+ /**
51
+ * Update the path for the operation.
52
+ * Triggers when the user changes the endpoint path for a given operation in the UI.
53
+ * - `payload.path` is the new path for the operation.
54
+ * - `meta` identifies the operation by its original method and path.
55
+ */
56
+ 'operation:update:path': {
57
+ payload: {
58
+ /** The new path for the operation */
59
+ path: string;
60
+ };
61
+ /** Identifies the target operation by original method and path */
62
+ meta: OperationMeta;
63
+ };
64
+ /** ------------------------------------------------------------------------------------------------
65
+ * Operation Parameters Mutators
66
+ * ------------------------------------------------------------------------------------------------ */
67
+ /**
68
+ * Add a parameter to the operation.
69
+ */
70
+ 'operation:add:parameter': {
71
+ /**
72
+ * The type of the parameter to add. Can be 'path', 'query', 'header', or 'cookie'.
73
+ */
74
+ type: 'path' | 'query' | 'header' | 'cookie';
75
+ /**
76
+ * The payload containing the details of the parameter to add.
77
+ */
78
+ payload: {
79
+ /** The name of the parameter to add */
80
+ key: string;
81
+ /** The example value for the parameter to add */
82
+ value: string;
83
+ /** Whether the parameter is enabled */
84
+ isEnabled: boolean;
85
+ };
86
+ /** Identifies the target operation and example variant for the added parameter */
87
+ meta: OperationExampleMeta;
88
+ };
89
+ /**
90
+ * Update a parameter of the operation.
91
+ * Triggers when the user updates an existing parameter (name, value, or enabled/disabled) in the UI for a given operation.
92
+ */
93
+ 'operation:update:parameter': {
94
+ /**
95
+ * The type of the parameter to update. Can be 'path', 'query', 'header', or 'cookie'.
96
+ */
97
+ type: 'path' | 'query' | 'header' | 'cookie';
98
+ /**
99
+ * The zero-based index of the parameter of the given type being updated within the operation.
100
+ */
101
+ index: number;
102
+ /**
103
+ * Partial payload with new properties for the parameter (optional).
104
+ * - key: The new name of the parameter (if being renamed).
105
+ * - value: The new example value for the parameter.
106
+ * - isEnabled: Whether the parameter is marked as enabled.
107
+ */
108
+ payload: Partial<{
109
+ key: string;
110
+ value: string;
111
+ isEnabled: boolean;
112
+ }>;
113
+ /**
114
+ * Identifies the target operation and example variant for the updated parameter.
115
+ */
116
+ meta: OperationExampleMeta;
117
+ };
118
+ /**
119
+ * Delete a parameter from an operation at the specified index and type.
120
+ * Fires when the user removes a parameter (by type and index) from an operation.
121
+ */
122
+ 'operation:delete:parameter': {
123
+ /** The type of the parameter to delete. Can be 'path', 'query', 'header', or 'cookie'. */
124
+ type: 'path' | 'query' | 'header' | 'cookie';
125
+ /** The zero-based index of the parameter of the given type to be deleted within the operation. */
126
+ index: number;
127
+ /** Identifies the target operation and example variant for the deleted parameter. */
128
+ meta: OperationExampleMeta;
129
+ };
130
+ /**
131
+ * Delete all parameters of a given type from the operation.
132
+ * Fires when the user removes all parameters of a specific type from an operation.
133
+ */
134
+ 'operation:delete-all:parameters': {
135
+ /** The type of the parameters to delete. Can be 'path', 'query', 'header', or 'cookie'. */
136
+ type: 'path' | 'query' | 'header' | 'cookie';
137
+ /** Identifies the target operation for the parameter deletion. */
138
+ meta: OperationMeta;
139
+ };
140
+ /**
141
+ * Update the selected request-body content type for the current example key.
142
+ * Triggers when the user selects a new content type for the request body in the UI.
143
+ */
144
+ 'operation:update:requestBody:contentType': {
145
+ payload: {
146
+ /** The new content type for the request body */
147
+ contentType: string;
148
+ };
149
+ /** Identifies the target operation and example variant for the updated content type */
150
+ meta: OperationExampleMeta;
151
+ };
152
+ /**
153
+ * Update the value for the request body example.
154
+ * Triggers when the user updates the example value for a specific request body content type.
155
+ */
156
+ 'operation:update:requestBody:value': {
157
+ payload: {
158
+ /** The new value for the request body example */
159
+ value: string | File | undefined;
160
+ };
161
+ /** The content type of the request body */
162
+ contentType: string;
163
+ /** Identifies the target operation and example variant for the updated request body value */
164
+ meta: OperationExampleMeta;
165
+ };
166
+ /**
167
+ * Add a form-data row to the request body example.
168
+ * Triggers when the user adds a new form-data row to the request body in the UI.
169
+ */
170
+ 'operation:add:requestBody:formRow': {
171
+ /** The payload containing the details of the form-data row to add */
172
+ payload: Partial<{
173
+ key: string;
174
+ value: string | File;
175
+ }>;
176
+ /** The content type of the request body */
177
+ contentType: string;
178
+ /** Identifies the target operation and example variant for the added form-data row */
179
+ meta: OperationExampleMeta;
180
+ };
181
+ /**
182
+ * Update a form-data row at the specified index for the request body example.
183
+ * Triggers when the user updates an existing form-data row (name, value) in the UI for a given operation.
184
+ */
185
+ 'operation:update:requestBody:formRow': {
186
+ /** The zero-based index of the form-data row to update within the operation. */
187
+ index: number;
188
+ /** The payload containing the details of the form-data row to update */
189
+ payload: Partial<{
190
+ key: string;
191
+ value?: string | File | null;
192
+ }>;
193
+ /** The content type of the request body */
194
+ contentType: string;
195
+ /** Identifies the target operation and example variant for the updated form-data row */
196
+ meta: OperationExampleMeta;
197
+ };
198
+ /**
199
+ * Delete a form-data row from the request body example.
200
+ * Triggers when the user removes a form-data row (by type and index) from the request body in the UI.
201
+ */
202
+ 'operation:delete:requestBody:formRow': {
203
+ /** The zero-based index of the form-data row to delete within the operation. */
204
+ index: number;
205
+ /** The content type of the request body */
206
+ contentType: string;
207
+ /** Identifies the target operation and example variant for the deleted form-data row */
208
+ meta: OperationExampleMeta;
209
+ };
10
210
  };
11
211
  //# sourceMappingURL=operation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/operation.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,yBAAyB,EAAE;QACzB,wCAAwC;QACxC,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;CACF,CAAA"}
1
+ {"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAErE,0CAA0C;AAC1C,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,yBAAyB,EAAE;QACzB,wCAAwC;QACxC,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IAED;;0GAEsG;IACtG;;;OAGG;IACH,wBAAwB,EAAE;QACxB,IAAI,EAAE,oBAAoB,CAAA;KAC3B,CAAA;IAED;;0GAEsG;IACtG;;;;OAIG;IACH,0BAA0B,EAAE;QAC1B,uDAAuD;QACvD,OAAO,EAAE;YACP,OAAO,EAAE,MAAM,CAAA;SAChB,CAAA;QACD,kFAAkF;QAClF,IAAI,EAAE,aAAa,CAAA;KACpB,CAAA;IAED;;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ACH,sCAAsC,EAAE;QACtC,gFAAgF;QAChF,KAAK,EAAE,MAAM,CAAA;QACb,2CAA2C;QAC3C,WAAW,EAAE,MAAM,CAAA;QACnB,wFAAwF;QACxF,IAAI,EAAE,oBAAoB,CAAA;KAC3B,CAAA;CACF,CAAA"}
@@ -48,5 +48,10 @@ export type UIEvents = {
48
48
  /** The id of the nav item to copy the anchor url for */
49
49
  id: string;
50
50
  };
51
+ /** On modal mode hide the modal */
52
+ 'hide:modal': undefined;
53
+ 'import:curl': {
54
+ value: string;
55
+ };
51
56
  };
52
57
  //# sourceMappingURL=ui.d.ts.map
@@ -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,0CAA0C;AAC1C,MAAM,MAAM,QAAQ,GAAG;IACrB;;OAEG;IACH,mBAAmB,EAAE;QACnB,yCAAyC;QACzC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAA;KACnC,CAAA;IACD;;OAEG;IACH,aAAa,EAAE;QACb,+CAA+C;QAC/C,MAAM,EAAE,UAAU,CAAA;QAClB,wCAAwC;QACxC,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IACD;;OAEG;IACH,sBAAsB,EAClB,QAAQ,GACR,WAAW,GACX,eAAe,GACf,QAAQ,GACR,YAAY,GACZ,cAAc,GACd,SAAS,CAAA;IAEb,0EAA0E;IAC1E,iBAAiB,EAAE;QACjB,yCAAyC;QACzC,EAAE,EAAE,MAAM,CAAA;QACV,+CAA+C;QAC/C,IAAI,CAAC,EAAE,OAAO,CAAA;KACf,CAAA;IAED,yGAAyG;IACzG,iBAAiB,EAAE;QACjB,uCAAuC;QACvC,EAAE,EAAE,MAAM,CAAA;KACX,CAAA;IAED,gEAAgE;IAChE,uBAAuB,EAAE;QACvB,kDAAkD;QAClD,EAAE,EAAE,MAAM,CAAA;KACX,CAAA;IAED,4CAA4C;IAC5C,oBAAoB,EAAE;QACpB,0CAA0C;QAC1C,EAAE,EAAE,MAAM,CAAA;KACX,CAAA;IAED,kEAAkE;IAClE,mBAAmB,EAAE;QACnB,wDAAwD;QACxD,EAAE,EAAE,MAAM,CAAA;KACX,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,0CAA0C;AAC1C,MAAM,MAAM,QAAQ,GAAG;IACrB;;OAEG;IACH,mBAAmB,EAAE;QACnB,yCAAyC;QACzC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAA;KACnC,CAAA;IACD;;OAEG;IACH,aAAa,EAAE;QACb,+CAA+C;QAC/C,MAAM,EAAE,UAAU,CAAA;QAClB,wCAAwC;QACxC,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IACD;;OAEG;IACH,sBAAsB,EAClB,QAAQ,GACR,WAAW,GACX,eAAe,GACf,QAAQ,GACR,YAAY,GACZ,cAAc,GACd,SAAS,CAAA;IAEb,0EAA0E;IAC1E,iBAAiB,EAAE;QACjB,yCAAyC;QACzC,EAAE,EAAE,MAAM,CAAA;QACV,+CAA+C;QAC/C,IAAI,CAAC,EAAE,OAAO,CAAA;KACf,CAAA;IAED,yGAAyG;IACzG,iBAAiB,EAAE;QACjB,uCAAuC;QACvC,EAAE,EAAE,MAAM,CAAA;KACX,CAAA;IAED,gEAAgE;IAChE,uBAAuB,EAAE;QACvB,kDAAkD;QAClD,EAAE,EAAE,MAAM,CAAA;KACX,CAAA;IAED,4CAA4C;IAC5C,oBAAoB,EAAE;QACpB,0CAA0C;QAC1C,EAAE,EAAE,MAAM,CAAA;KACX,CAAA;IAED,kEAAkE;IAClE,mBAAmB,EAAE;QACnB,wDAAwD;QACxD,EAAE,EAAE,MAAM,CAAA;KACX,CAAA;IAED,mCAAmC;IACnC,YAAY,EAAE,SAAS,CAAA;IAEvB,aAAa,EAAE;QACb,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;CACF,CAAA"}
@@ -1,4 +1,5 @@
1
1
  export { type WorkspaceEventBus, createWorkspaceEventBus } from './bus.js';
2
+ export type { CollectionType } from './definitions/index.js';
2
3
  export { onCustomEvent } from './listeners.js';
3
4
  export { type ApiReferenceEvent, type ApiReferenceEvents, emitCustomEvent } from './old-definitions.js';
4
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,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,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,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 { onCustomEvent } from './listeners'\nexport { type ApiReferenceEvent, type ApiReferenceEvents, emitCustomEvent } from './old-definitions'\n"],
5
- "mappings": "AACA,SAAiC,+BAA+B;AAChE,SAAS,qBAAqB;AAC9B,SAA0D,uBAAuB;",
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;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Generates a unique value based on a given default value and a validation function.
3
+ *
4
+ * The process works as follows:
5
+ * 1. Optionally transform (e.g., slugify) the default value using a transformation function.
6
+ * 2. Check if this value is unique by executing the provided validation function.
7
+ * 3. If not unique, repeatedly append an incrementing integer (e.g., "my-name 1", "my-name 2", ...) and re-check uniqueness,
8
+ * up to a maximum number of attempts (maxRetries).
9
+ * 4. Returns the first unique value found or undefined if a unique value cannot be generated within the maximum retries.
10
+ *
11
+ * Example:
12
+ * ```ts
13
+ * // Existing names in use
14
+ * const existing = new Set(['foo', 'foo 1', 'foo 2']);
15
+ * const uniqueName = generateUniqueValue({
16
+ * defaultValue: 'foo',
17
+ * validation: (value) => !existing.has(value),
18
+ * // transformation is optional, e.g. (val) => val.toLowerCase().replace(/[^\w]+/g, '-'),
19
+ * maxRetries: 10,
20
+ * });
21
+ * // uniqueName === 'foo 3'
22
+ * ```
23
+ */
24
+ export declare function generateUniqueValue({ defaultValue,
25
+ /** Check function to verify the uniqueness of the value */
26
+ validation,
27
+ /** Transformation function to transform the default value (such as into a slug) */
28
+ transformation, maxRetries, }: {
29
+ /**
30
+ * Value which will be used to derive a new unique value.
31
+ */
32
+ defaultValue: string;
33
+ /** Validate if the new generated value is unique */
34
+ validation: (value: string) => Promise<boolean> | boolean;
35
+ /** Transform the default value to get a new value which will match the schema of the value we need to derive */
36
+ transformation?: (value: string) => string;
37
+ /** The maximum number of retry attempts to generate a unique value. */
38
+ maxRetries: number;
39
+ }): string | undefined;
40
+ //# sourceMappingURL=generate-unique-value.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-unique-value.d.ts","sourceRoot":"","sources":["../../src/helpers/generate-unique-value.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,YAAY;AACZ,2DAA2D;AAC3D,UAAU;AACV,mFAAmF;AACnF,cAAc,EACd,UAAc,GACf,EAAE;IACD;;OAEG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB,oDAAoD;IACpD,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAA;IACzD,gHAAgH;IAChH,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IAC1C,uEAAuE;IACvE,UAAU,EAAE,MAAM,CAAA;CACnB,sBAYA"}
@@ -0,0 +1,42 @@
1
+ function generateUniqueValue({
2
+ defaultValue,
3
+ /** Check function to verify the uniqueness of the value */
4
+ validation,
5
+ /** Transformation function to transform the default value (such as into a slug) */
6
+ transformation,
7
+ maxRetries = 5
8
+ }) {
9
+ const transformed = transformation?.(defaultValue) ?? defaultValue;
10
+ if (validation(transformed)) {
11
+ return transformed;
12
+ }
13
+ return incrementValue({
14
+ value: [transformed, 1],
15
+ validation,
16
+ maxRetries
17
+ });
18
+ }
19
+ function incrementValue({
20
+ value,
21
+ validation,
22
+ maxRetries,
23
+ attempts = 0
24
+ }) {
25
+ if (attempts >= maxRetries) {
26
+ return;
27
+ }
28
+ const incremented = value.join(" ");
29
+ if (validation(incremented)) {
30
+ return incremented;
31
+ }
32
+ return incrementValue({
33
+ value: [value[0], value[1] + 1],
34
+ validation,
35
+ maxRetries,
36
+ attempts: attempts + 1
37
+ });
38
+ }
39
+ export {
40
+ generateUniqueValue
41
+ };
42
+ //# sourceMappingURL=generate-unique-value.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/helpers/generate-unique-value.ts"],
4
+ "sourcesContent": ["/**\n * Generates a unique value based on a given default value and a validation function.\n *\n * The process works as follows:\n * 1. Optionally transform (e.g., slugify) the default value using a transformation function.\n * 2. Check if this value is unique by executing the provided validation function.\n * 3. If not unique, repeatedly append an incrementing integer (e.g., \"my-name 1\", \"my-name 2\", ...) and re-check uniqueness,\n * up to a maximum number of attempts (maxRetries).\n * 4. Returns the first unique value found or undefined if a unique value cannot be generated within the maximum retries.\n *\n * Example:\n * ```ts\n * // Existing names in use\n * const existing = new Set(['foo', 'foo 1', 'foo 2']);\n * const uniqueName = generateUniqueValue({\n * defaultValue: 'foo',\n * validation: (value) => !existing.has(value),\n * // transformation is optional, e.g. (val) => val.toLowerCase().replace(/[^\\w]+/g, '-'),\n * maxRetries: 10,\n * });\n * // uniqueName === 'foo 3'\n * ```\n */\nexport function generateUniqueValue({\n defaultValue,\n /** Check function to verify the uniqueness of the value */\n validation,\n /** Transformation function to transform the default value (such as into a slug) */\n transformation,\n maxRetries = 5,\n}: {\n /**\n * Value which will be used to derive a new unique value.\n */\n defaultValue: string\n /** Validate if the new generated value is unique */\n validation: (value: string) => Promise<boolean> | boolean\n /** Transform the default value to get a new value which will match the schema of the value we need to derive */\n transformation?: (value: string) => string\n /** The maximum number of retry attempts to generate a unique value. */\n maxRetries: number\n}) {\n const transformed = transformation?.(defaultValue) ?? defaultValue\n\n if (validation(transformed)) {\n return transformed\n }\n\n return incrementValue({\n value: [transformed, 1],\n validation,\n maxRetries,\n })\n}\n\n/**\n * Attempts to generate a unique value by appending and incrementing a counter to a base string.\n *\n * On each attempt, appends the next incrementing integer (e.g. \"foo 1\", \"foo 2\", etc.) to the original value,\n * and checks with the validation function whether the candidate value is unique.\n *\n * Continues until a unique value is found, or the maximum number of attempts is reached.\n *\n * Returns the first unique value found, or undefined if a unique value cannot be generated within maxRetries.\n *\n * Example:\n * ```ts\n * const existing = new Set(['bar', 'bar 1']);\n * const result = incrementValue({\n * value: ['bar', 1],\n * validation: (val) => !existing.has(val),\n * maxRetries: 5,\n * });\n * // result === \"bar 2\"\n * ```\n */\nfunction incrementValue({\n value,\n validation,\n maxRetries,\n attempts = 0,\n}: {\n value: [string, number] // [base value, next increment]\n validation: (value: string) => Promise<boolean> | boolean\n maxRetries: number\n attempts?: number\n}) {\n if (attempts >= maxRetries) {\n return\n }\n\n const incremented = value.join(' ')\n\n if (validation(incremented)) {\n return incremented\n }\n\n return incrementValue({\n value: [value[0], value[1] + 1],\n validation,\n maxRetries,\n attempts: attempts + 1,\n })\n}\n"],
5
+ "mappings": "AAuBO,SAAS,oBAAoB;AAAA,EAClC;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA,EACA,aAAa;AACf,GAWG;AACD,QAAM,cAAc,iBAAiB,YAAY,KAAK;AAEtD,MAAI,WAAW,WAAW,GAAG;AAC3B,WAAO;AAAA,EACT;AAEA,SAAO,eAAe;AAAA,IACpB,OAAO,CAAC,aAAa,CAAC;AAAA,IACtB;AAAA,IACA;AAAA,EACF,CAAC;AACH;AAuBA,SAAS,eAAe;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AACb,GAKG;AACD,MAAI,YAAY,YAAY;AAC1B;AAAA,EACF;AAEA,QAAM,cAAc,MAAM,KAAK,GAAG;AAElC,MAAI,WAAW,WAAW,GAAG;AAC3B,WAAO;AAAA,EACT;AAEA,SAAO,eAAe;AAAA,IACpB,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC;AAAA,IAC9B;AAAA,IACA;AAAA,IACA,UAAU,WAAW;AAAA,EACvB,CAAC;AACH;",
6
+ "names": []
7
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"overrides-proxy.d.ts","sourceRoot":"","sources":["../../src/helpers/overrides-proxy.ts"],"names":[],"mappings":"AAGA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CAAC,CAAA;CAC3B,EACD,OAAM;IACJ,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAG5B,KACA,CAgEF,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,KAAK,OAAO,KAAG,OAErD,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAUnD"}
@@ -49,7 +49,7 @@ const isOverridesProxyObject = (obj) => {
49
49
  return typeof obj === "object" && obj !== null && obj[isOverridesProxy] === true;
50
50
  };
51
51
  function unpackOverridesProxy(input) {
52
- if (input[isOverridesProxy]) {
52
+ if (typeof input === "object" && input !== null && input[isOverridesProxy]) {
53
53
  return input[getOverridesTarget];
54
54
  }
55
55
  return input;