@scalar/workspace-store 0.18.1 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +1 -1
- package/dist/client.js.map +2 -2
- package/dist/events/definitions/auth.d.ts +77 -14
- package/dist/events/definitions/auth.d.ts.map +1 -1
- package/dist/events/definitions/document.d.ts +5 -1
- package/dist/events/definitions/document.d.ts.map +1 -1
- package/dist/events/definitions/index.d.ts +1 -2
- package/dist/events/definitions/index.d.ts.map +1 -1
- package/dist/events/definitions/operation.d.ts +200 -0
- package/dist/events/definitions/operation.d.ts.map +1 -1
- package/dist/events/definitions/server.d.ts +20 -28
- package/dist/events/definitions/server.d.ts.map +1 -1
- package/dist/events/definitions/ui.d.ts +5 -0
- package/dist/events/definitions/ui.d.ts.map +1 -1
- package/dist/events/index.d.ts +2 -2
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js.map +2 -2
- package/dist/helpers/generate-unique-value.d.ts +40 -0
- package/dist/helpers/generate-unique-value.d.ts.map +1 -0
- package/dist/helpers/generate-unique-value.js +42 -0
- package/dist/helpers/generate-unique-value.js.map +7 -0
- package/dist/helpers/overrides-proxy.d.ts.map +1 -1
- package/dist/helpers/overrides-proxy.js +1 -1
- package/dist/helpers/overrides-proxy.js.map +2 -2
- package/dist/helpers/unpack-proxy.d.ts +1 -1
- package/dist/helpers/unpack-proxy.d.ts.map +1 -1
- package/dist/helpers/unpack-proxy.js.map +2 -2
- package/dist/mutators/auth.d.ts +147 -0
- package/dist/mutators/auth.d.ts.map +1 -0
- package/dist/mutators/auth.js +156 -0
- package/dist/mutators/auth.js.map +7 -0
- package/dist/mutators/document.d.ts +6 -0
- package/dist/mutators/document.d.ts.map +1 -0
- package/dist/mutators/document.js +10 -0
- package/dist/mutators/document.js.map +7 -0
- package/dist/mutators/index.d.ts +12 -7
- package/dist/mutators/index.d.ts.map +1 -1
- package/dist/mutators/index.js +74 -1
- package/dist/mutators/index.js.map +3 -3
- package/dist/mutators/operation.d.ts +313 -0
- package/dist/mutators/operation.d.ts.map +1 -0
- package/dist/mutators/operation.js +340 -0
- package/dist/mutators/operation.js.map +7 -0
- package/dist/mutators/server.d.ts +43 -8
- package/dist/mutators/server.d.ts.map +1 -1
- package/dist/mutators/server.js +112 -20
- package/dist/mutators/server.js.map +2 -2
- package/dist/navigation/helpers/traverse-document.d.ts +1 -0
- package/dist/navigation/helpers/traverse-document.d.ts.map +1 -1
- package/dist/navigation/helpers/traverse-document.js +2 -1
- package/dist/navigation/helpers/traverse-document.js.map +2 -2
- package/dist/plugins/client/persistence.d.ts +2 -1
- package/dist/plugins/client/persistence.d.ts.map +1 -1
- package/dist/plugins/client/persistence.js +11 -9
- package/dist/plugins/client/persistence.js.map +2 -2
- package/dist/schemas/extensions/document/x-scalar-document-security.d.ts +13 -0
- package/dist/schemas/extensions/document/x-scalar-document-security.d.ts.map +1 -0
- package/dist/schemas/extensions/document/x-scalar-document-security.js +8 -0
- package/dist/schemas/extensions/document/x-scalar-document-security.js.map +7 -0
- package/dist/schemas/extensions/operation/x-scalar-operation-identifiers.d.ts +13 -0
- package/dist/schemas/extensions/operation/x-scalar-operation-identifiers.d.ts.map +1 -0
- package/dist/schemas/extensions/operation/x-scalar-operation-identifiers.js +9 -0
- package/dist/schemas/extensions/operation/x-scalar-operation-identifiers.js.map +7 -0
- package/dist/schemas/extensions/operation/x-scalar-selected-content-type.d.ts +21 -0
- package/dist/schemas/extensions/operation/x-scalar-selected-content-type.d.ts.map +1 -0
- package/dist/schemas/extensions/operation/x-scalar-selected-content-type.js +8 -0
- package/dist/schemas/extensions/operation/x-scalar-selected-content-type.js.map +7 -0
- package/dist/schemas/extensions/security/x-scalar-selected-security.d.ts +17 -0
- package/dist/schemas/extensions/security/x-scalar-selected-security.d.ts.map +1 -0
- package/dist/schemas/extensions/security/x-scalar-selected-security.js +14 -0
- package/dist/schemas/extensions/security/x-scalar-selected-security.js.map +7 -0
- package/dist/schemas/extensions/server/x-scalar-selected-server.d.ts +8 -0
- package/dist/schemas/extensions/server/x-scalar-selected-server.d.ts.map +1 -0
- package/dist/schemas/extensions/server/x-scalar-selected-server.js +8 -0
- package/dist/schemas/extensions/server/x-scalar-selected-server.js.map +7 -0
- package/dist/schemas/inmemory-workspace.d.ts +44 -8
- package/dist/schemas/inmemory-workspace.d.ts.map +1 -1
- package/dist/schemas/navigation.d.ts +5 -0
- package/dist/schemas/navigation.d.ts.map +1 -1
- package/dist/schemas/navigation.js +1 -0
- package/dist/schemas/navigation.js.map +2 -2
- package/dist/schemas/reference-config/index.d.ts +22 -4
- package/dist/schemas/reference-config/index.d.ts.map +1 -1
- package/dist/schemas/reference-config/settings.d.ts +22 -4
- package/dist/schemas/reference-config/settings.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/openapi-document.d.ts +752 -138
- package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/openapi-document.js +12 -1
- package/dist/schemas/v3.1/strict/openapi-document.js.map +2 -2
- package/dist/schemas/v3.1/strict/operation.d.ts +10 -6
- package/dist/schemas/v3.1/strict/operation.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/operation.js +9 -7
- package/dist/schemas/v3.1/strict/operation.js.map +2 -2
- package/dist/schemas/v3.1/strict/request-body.d.ts +6 -3
- package/dist/schemas/v3.1/strict/request-body.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/request-body.js +15 -8
- package/dist/schemas/v3.1/strict/request-body.js.map +2 -2
- package/dist/schemas/workspace-specification/config.d.ts +22 -4
- package/dist/schemas/workspace-specification/config.d.ts.map +1 -1
- package/dist/schemas/workspace-specification/index.d.ts +22 -4
- package/dist/schemas/workspace-specification/index.d.ts.map +1 -1
- package/dist/schemas/workspace.d.ts +154 -28
- package/dist/schemas/workspace.d.ts.map +1 -1
- package/package.json +5 -5
- package/dist/helpers/debounce.d.ts +0 -28
- package/dist/helpers/debounce.d.ts.map +0 -1
- package/dist/helpers/debounce.js +0 -31
- package/dist/helpers/debounce.js.map +0 -7
|
@@ -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,YA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,MAAM,CAAA;QACnB,sFAAsF;QACtF,IAAI,EAAE,oBAAoB,CAAA;KAC3B,CAAA;IAED;;;OAGG;IACH,sCAAsC,EAAE;QACtC,gFAAgF;QAChF,KAAK,EAAE,MAAM,CAAA;QACb,wEAAwE;QACxE,OAAO,EAAE,OAAO,CAAC;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAA;SAAE,CAAC,CAAA;QAC/D,2CAA2C;QAC3C,WAAW,EAAE,MAAM,CAAA;QACnB,wFAAwF;QACxF,IAAI,EAAE,oBAAoB,CAAA;KAC3B,CAAA;IAED;;;OAGG;IACH,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"}
|
|
@@ -1,50 +1,42 @@
|
|
|
1
1
|
import type { ServerObject } from '../../schemas/v3.1/strict/openapi-document.js';
|
|
2
|
-
export type ServerEvents
|
|
2
|
+
export type ServerEvents = {
|
|
3
3
|
/**
|
|
4
|
-
* Add a new server to the document
|
|
4
|
+
* Add a new blank server to the document
|
|
5
5
|
*/
|
|
6
|
-
'add:server':
|
|
7
|
-
/** The new server payload to add */
|
|
8
|
-
server: ServerObject;
|
|
9
|
-
};
|
|
6
|
+
'server:add:server': undefined;
|
|
10
7
|
/**
|
|
11
|
-
*
|
|
8
|
+
* Update the entire server object
|
|
12
9
|
*/
|
|
13
|
-
'
|
|
14
|
-
/** The
|
|
15
|
-
|
|
10
|
+
'server:update:server': {
|
|
11
|
+
/** The index of the server to update */
|
|
12
|
+
index: number;
|
|
13
|
+
/** The new server payload to update */
|
|
14
|
+
server: Partial<ServerObject>;
|
|
16
15
|
};
|
|
17
16
|
/**
|
|
18
|
-
*
|
|
17
|
+
* Delete a server from the document
|
|
19
18
|
*/
|
|
20
|
-
'
|
|
21
|
-
/** The
|
|
22
|
-
|
|
19
|
+
'server:delete:server': {
|
|
20
|
+
/** The index of the server to delete */
|
|
21
|
+
index: number;
|
|
23
22
|
};
|
|
24
23
|
/**
|
|
25
24
|
* Update the selected server variable for the document
|
|
26
25
|
*/
|
|
27
|
-
'update:
|
|
26
|
+
'server:update:variables': {
|
|
27
|
+
/** The index of the server to update */
|
|
28
|
+
index: number;
|
|
28
29
|
/** The key of the variable to update */
|
|
29
30
|
key: string;
|
|
30
31
|
/** The new value of the variable */
|
|
31
32
|
value: string;
|
|
32
33
|
};
|
|
33
34
|
/**
|
|
34
|
-
* Update the selected server
|
|
35
|
-
*/
|
|
36
|
-
'update:selected-server-properties': {
|
|
37
|
-
/** The key of the property to update */
|
|
38
|
-
key: T;
|
|
39
|
-
/** The new value of the property */
|
|
40
|
-
value: ServerObject[T];
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Replace all servers in the document
|
|
35
|
+
* Update the selected server for the document
|
|
44
36
|
*/
|
|
45
|
-
'update:
|
|
46
|
-
/** The
|
|
47
|
-
|
|
37
|
+
'server:update:selected': {
|
|
38
|
+
/** The index of the server to update */
|
|
39
|
+
index: number;
|
|
48
40
|
};
|
|
49
41
|
};
|
|
50
42
|
//# sourceMappingURL=server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AAE1E,MAAM,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AAE1E,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,mBAAmB,EAAE,SAAS,CAAA;IAC9B;;OAEG;IACH,sBAAsB,EAAE;QACtB,wCAAwC;QACxC,KAAK,EAAE,MAAM,CAAA;QACb,uCAAuC;QACvC,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;KAC9B,CAAA;IACD;;OAEG;IACH,sBAAsB,EAAE;QACtB,wCAAwC;QACxC,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;IACD;;OAEG;IACH,yBAAyB,EAAE;QACzB,wCAAwC;QACxC,KAAK,EAAE,MAAM,CAAA;QACb,wCAAwC;QACxC,GAAG,EAAE,MAAM,CAAA;QACX,oCAAoC;QACpC,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;IACD;;OAEG;IACH,wBAAwB,EAAE;QACxB,wCAAwC;QACxC,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;CACF,CAAA"}
|
|
@@ -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"}
|
package/dist/events/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { type WorkspaceEventBus, createWorkspaceEventBus } from './bus.js';
|
|
2
|
-
export type { CollectionType } from './definitions/index.js';
|
|
2
|
+
export type { ApiReferenceEvents, CollectionType } from './definitions/index.js';
|
|
3
3
|
export { onCustomEvent } from './listeners.js';
|
|
4
|
-
export {
|
|
4
|
+
export { emitCustomEvent } from './old-definitions.js';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,OAAO,CAAA;AACvE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,OAAO,CAAA;AACvE,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA"}
|
package/dist/events/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/events/index.ts"],
|
|
4
|
-
"sourcesContent": ["// biome-ignore lint/performance/noBarrelFile: Entry point for /events\nexport { type WorkspaceEventBus, createWorkspaceEventBus } from './bus'\nexport type { CollectionType } from './definitions'\nexport { onCustomEvent } from './listeners'\nexport {
|
|
5
|
-
"mappings": "AACA,SAAiC,+BAA+B;AAEhE,SAAS,qBAAqB;AAC9B,
|
|
4
|
+
"sourcesContent": ["// biome-ignore lint/performance/noBarrelFile: Entry point for /events\nexport { type WorkspaceEventBus, createWorkspaceEventBus } from './bus'\nexport type { ApiReferenceEvents, CollectionType } from './definitions'\nexport { onCustomEvent } from './listeners'\nexport { emitCustomEvent } from './old-definitions'\n"],
|
|
5
|
+
"mappings": "AACA,SAAiC,+BAA+B;AAEhE,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -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,eAAO,MAAM,kBAAkB,eAA+B,CAAA;AAE9D;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,WAAW,CAAC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;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;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/helpers/overrides-proxy.ts"],
|
|
4
|
-
"sourcesContent": ["import { isObject } from '@/helpers/general'\n\nconst isOverridesProxy = Symbol('isOverridesProxy')\nexport const getOverridesTarget = Symbol('getOverridesTarget')\n\n/**\n * Recursively makes all properties of a type optional.\n *\n * - If T is an object, recursively applies DeepPartial to each property, making them optional.\n * - Otherwise, T is returned as-is.\n *\n * @template T - The type to make deeply partial (optional).\n * @example\n * type Example = { a: { b: number } }\n * type PartialExample = DeepPartial<Example>\n * // Result: { a?: { b?: number } }\n */\nexport type DeepPartial<T> = T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T\n\n/**\n * Creates a proxy object that overlays \"overrides\" on top of a target object.\n *\n * - When reading a property, if an override exists, it is returned; otherwise, the original value is returned.\n * - When writing to a property, if an override exists, it is updated; otherwise, the original object is updated.\n * - This works recursively for nested objects, so overrides can be deeply partial.\n * - Special symbols are used to identify the proxy and to access the original target.\n *\n * @template T - The type of the target object.\n * @param target - The original object to proxy.\n * @param overrides - An optional object containing override values (deeply partial).\n * @returns A proxy object that reflects overrides on top of the target.\n *\n * @example\n * const original = { a: 1, b: { c: 2 } }\n * const overrides = { b: { c: 42 } }\n * const proxy = createOverridesProxy(original, { overrides })\n *\n * console.log(proxy.a) // 1 (from original)\n * console.log(proxy.b.c) // 42 (from overrides)\n *\n * proxy.a = 100\n * console.log(original.a) // 100\n *\n * proxy.b.c = 99\n * console.log(overrides.b.c) // 99\n */\nexport const createOverridesProxy = <T extends Record<string, unknown>>(\n target: T,\n options?: {\n overrides?: DeepPartial<T>\n },\n args: {\n cache: WeakMap<object, any>\n } = {\n cache: new WeakMap(),\n },\n): T => {\n if (!target || typeof target !== 'object') {\n return target\n }\n\n // Return existing proxy for the same target to ensure referential stability\n if (args.cache.has(target)) {\n return args.cache.get(target)!\n }\n\n const { overrides } = options ?? {}\n\n // Proxy handler to intercept get/set operations\n const handler: ProxyHandler<T> = {\n get(target, prop, receiver) {\n // Special symbol to identify this as an overrides proxy\n if (prop === isOverridesProxy) {\n return true\n }\n\n // Special symbol to access the original target object\n if (prop === getOverridesTarget) {\n return target\n }\n\n const value = Reflect.get(target, prop, receiver)\n\n // Return early if the value is already an overrides proxy\n if (isOverridesProxyObject(value)) {\n return value\n }\n\n // If the value is not an object, return the override if it exists, else the original value\n if (!isObject(value)) {\n return Reflect.get(overrides ?? {}, prop) ?? value\n }\n\n // For nested objects, recursively create a proxy with the corresponding overrides\n return createOverridesProxy(value, { overrides: Reflect.get(overrides ?? {}, prop) }, args)\n },\n\n set(target, prop, value, receiver) {\n // Prevent setting special symbols\n if (prop === isOverridesProxy || prop === getOverridesTarget) {\n return false\n }\n\n // If an override exists for this property, update it\n const hasOverride = overrides && Reflect.has(overrides, prop)\n\n if (hasOverride && overrides && typeof overrides === 'object') {\n ;(overrides as any)[prop] = value\n return true\n }\n\n // Otherwise, update the original target\n return Reflect.set(target, prop, value, receiver)\n },\n }\n\n // Return the proxy object\n const proxy = new Proxy<T>(target, handler)\n args.cache.set(target, proxy)\n return proxy\n}\n\nexport const isOverridesProxyObject = (obj: unknown): boolean => {\n return typeof obj === 'object' && obj !== null && (obj as { [isOverridesProxy]: boolean })[isOverridesProxy] === true\n}\n\n/**\n * Unpacks an object from the overrides proxy, returning the original (unproxied) target object.\n * If the input is not an overrides proxy, returns the object as-is.\n *\n * @param input - The potentially proxied object\n * @returns The original unproxied target object or the input object\n */\nexport function unpackOverridesProxy<T>(input: T): T {\n if ((input as T & { [isOverridesProxy]: boolean | undefined })[isOverridesProxy]) {\n return (input as T & { [getOverridesTarget]: T })[getOverridesTarget]\n }\n\n return input\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,gBAAgB;AAEzB,MAAM,mBAAmB,OAAO,kBAAkB;AAC3C,MAAM,qBAAqB,OAAO,oBAAoB;AA2CtD,MAAM,uBAAuB,CAClC,QACA,SAGA,OAEI;AAAA,EACF,OAAO,oBAAI,QAAQ;AACrB,MACM;AACN,MAAI,CAAC,UAAU,OAAO,WAAW,UAAU;AACzC,WAAO;AAAA,EACT;AAGA,MAAI,KAAK,MAAM,IAAI,MAAM,GAAG;AAC1B,WAAO,KAAK,MAAM,IAAI,MAAM;AAAA,EAC9B;AAEA,QAAM,EAAE,UAAU,IAAI,WAAW,CAAC;AAGlC,QAAM,UAA2B;AAAA,IAC/B,IAAIA,SAAQ,MAAM,UAAU;AAE1B,UAAI,SAAS,kBAAkB;AAC7B,eAAO;AAAA,MACT;AAGA,UAAI,SAAS,oBAAoB;AAC/B,eAAOA;AAAA,MACT;AAEA,YAAM,QAAQ,QAAQ,IAAIA,SAAQ,MAAM,QAAQ;AAGhD,UAAI,uBAAuB,KAAK,GAAG;AACjC,eAAO;AAAA,MACT;AAGA,UAAI,CAAC,SAAS,KAAK,GAAG;AACpB,eAAO,QAAQ,IAAI,aAAa,CAAC,GAAG,IAAI,KAAK;AAAA,MAC/C;AAGA,aAAO,qBAAqB,OAAO,EAAE,WAAW,QAAQ,IAAI,aAAa,CAAC,GAAG,IAAI,EAAE,GAAG,IAAI;AAAA,IAC5F;AAAA,IAEA,IAAIA,SAAQ,MAAM,OAAO,UAAU;AAEjC,UAAI,SAAS,oBAAoB,SAAS,oBAAoB;AAC5D,eAAO;AAAA,MACT;AAGA,YAAM,cAAc,aAAa,QAAQ,IAAI,WAAW,IAAI;AAE5D,UAAI,eAAe,aAAa,OAAO,cAAc,UAAU;AAC7D;AAAC,QAAC,UAAkB,IAAI,IAAI;AAC5B,eAAO;AAAA,MACT;AAGA,aAAO,QAAQ,IAAIA,SAAQ,MAAM,OAAO,QAAQ;AAAA,IAClD;AAAA,EACF;AAGA,QAAM,QAAQ,IAAI,MAAS,QAAQ,OAAO;AAC1C,OAAK,MAAM,IAAI,QAAQ,KAAK;AAC5B,SAAO;AACT;AAEO,MAAM,yBAAyB,CAAC,QAA0B;AAC/D,SAAO,OAAO,QAAQ,YAAY,QAAQ,QAAS,IAAwC,gBAAgB,MAAM;AACnH;AASO,SAAS,qBAAwB,OAAa;AACnD,
|
|
4
|
+
"sourcesContent": ["import { isObject } from '@/helpers/general'\n\nconst isOverridesProxy = Symbol('isOverridesProxy')\nexport const getOverridesTarget = Symbol('getOverridesTarget')\n\n/**\n * Recursively makes all properties of a type optional.\n *\n * - If T is an object, recursively applies DeepPartial to each property, making them optional.\n * - Otherwise, T is returned as-is.\n *\n * @template T - The type to make deeply partial (optional).\n * @example\n * type Example = { a: { b: number } }\n * type PartialExample = DeepPartial<Example>\n * // Result: { a?: { b?: number } }\n */\nexport type DeepPartial<T> = T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T\n\n/**\n * Creates a proxy object that overlays \"overrides\" on top of a target object.\n *\n * - When reading a property, if an override exists, it is returned; otherwise, the original value is returned.\n * - When writing to a property, if an override exists, it is updated; otherwise, the original object is updated.\n * - This works recursively for nested objects, so overrides can be deeply partial.\n * - Special symbols are used to identify the proxy and to access the original target.\n *\n * @template T - The type of the target object.\n * @param target - The original object to proxy.\n * @param overrides - An optional object containing override values (deeply partial).\n * @returns A proxy object that reflects overrides on top of the target.\n *\n * @example\n * const original = { a: 1, b: { c: 2 } }\n * const overrides = { b: { c: 42 } }\n * const proxy = createOverridesProxy(original, { overrides })\n *\n * console.log(proxy.a) // 1 (from original)\n * console.log(proxy.b.c) // 42 (from overrides)\n *\n * proxy.a = 100\n * console.log(original.a) // 100\n *\n * proxy.b.c = 99\n * console.log(overrides.b.c) // 99\n */\nexport const createOverridesProxy = <T extends Record<string, unknown>>(\n target: T,\n options?: {\n overrides?: DeepPartial<T>\n },\n args: {\n cache: WeakMap<object, any>\n } = {\n cache: new WeakMap(),\n },\n): T => {\n if (!target || typeof target !== 'object') {\n return target\n }\n\n // Return existing proxy for the same target to ensure referential stability\n if (args.cache.has(target)) {\n return args.cache.get(target)!\n }\n\n const { overrides } = options ?? {}\n\n // Proxy handler to intercept get/set operations\n const handler: ProxyHandler<T> = {\n get(target, prop, receiver) {\n // Special symbol to identify this as an overrides proxy\n if (prop === isOverridesProxy) {\n return true\n }\n\n // Special symbol to access the original target object\n if (prop === getOverridesTarget) {\n return target\n }\n\n const value = Reflect.get(target, prop, receiver)\n\n // Return early if the value is already an overrides proxy\n if (isOverridesProxyObject(value)) {\n return value\n }\n\n // If the value is not an object, return the override if it exists, else the original value\n if (!isObject(value)) {\n return Reflect.get(overrides ?? {}, prop) ?? value\n }\n\n // For nested objects, recursively create a proxy with the corresponding overrides\n return createOverridesProxy(value, { overrides: Reflect.get(overrides ?? {}, prop) }, args)\n },\n\n set(target, prop, value, receiver) {\n // Prevent setting special symbols\n if (prop === isOverridesProxy || prop === getOverridesTarget) {\n return false\n }\n\n // If an override exists for this property, update it\n const hasOverride = overrides && Reflect.has(overrides, prop)\n\n if (hasOverride && overrides && typeof overrides === 'object') {\n ;(overrides as any)[prop] = value\n return true\n }\n\n // Otherwise, update the original target\n return Reflect.set(target, prop, value, receiver)\n },\n }\n\n // Return the proxy object\n const proxy = new Proxy<T>(target, handler)\n args.cache.set(target, proxy)\n return proxy\n}\n\nexport const isOverridesProxyObject = (obj: unknown): boolean => {\n return typeof obj === 'object' && obj !== null && (obj as { [isOverridesProxy]: boolean })[isOverridesProxy] === true\n}\n\n/**\n * Unpacks an object from the overrides proxy, returning the original (unproxied) target object.\n * If the input is not an overrides proxy, returns the object as-is.\n *\n * @param input - The potentially proxied object\n * @returns The original unproxied target object or the input object\n */\nexport function unpackOverridesProxy<T>(input: T): T {\n if (\n typeof input === 'object' &&\n input !== null &&\n (input as T & { [isOverridesProxy]: boolean | undefined })[isOverridesProxy]\n ) {\n return (input as T & { [getOverridesTarget]: T })[getOverridesTarget]\n }\n\n return input\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,gBAAgB;AAEzB,MAAM,mBAAmB,OAAO,kBAAkB;AAC3C,MAAM,qBAAqB,OAAO,oBAAoB;AA2CtD,MAAM,uBAAuB,CAClC,QACA,SAGA,OAEI;AAAA,EACF,OAAO,oBAAI,QAAQ;AACrB,MACM;AACN,MAAI,CAAC,UAAU,OAAO,WAAW,UAAU;AACzC,WAAO;AAAA,EACT;AAGA,MAAI,KAAK,MAAM,IAAI,MAAM,GAAG;AAC1B,WAAO,KAAK,MAAM,IAAI,MAAM;AAAA,EAC9B;AAEA,QAAM,EAAE,UAAU,IAAI,WAAW,CAAC;AAGlC,QAAM,UAA2B;AAAA,IAC/B,IAAIA,SAAQ,MAAM,UAAU;AAE1B,UAAI,SAAS,kBAAkB;AAC7B,eAAO;AAAA,MACT;AAGA,UAAI,SAAS,oBAAoB;AAC/B,eAAOA;AAAA,MACT;AAEA,YAAM,QAAQ,QAAQ,IAAIA,SAAQ,MAAM,QAAQ;AAGhD,UAAI,uBAAuB,KAAK,GAAG;AACjC,eAAO;AAAA,MACT;AAGA,UAAI,CAAC,SAAS,KAAK,GAAG;AACpB,eAAO,QAAQ,IAAI,aAAa,CAAC,GAAG,IAAI,KAAK;AAAA,MAC/C;AAGA,aAAO,qBAAqB,OAAO,EAAE,WAAW,QAAQ,IAAI,aAAa,CAAC,GAAG,IAAI,EAAE,GAAG,IAAI;AAAA,IAC5F;AAAA,IAEA,IAAIA,SAAQ,MAAM,OAAO,UAAU;AAEjC,UAAI,SAAS,oBAAoB,SAAS,oBAAoB;AAC5D,eAAO;AAAA,MACT;AAGA,YAAM,cAAc,aAAa,QAAQ,IAAI,WAAW,IAAI;AAE5D,UAAI,eAAe,aAAa,OAAO,cAAc,UAAU;AAC7D;AAAC,QAAC,UAAkB,IAAI,IAAI;AAC5B,eAAO;AAAA,MACT;AAGA,aAAO,QAAQ,IAAIA,SAAQ,MAAM,OAAO,QAAQ;AAAA,IAClD;AAAA,EACF;AAGA,QAAM,QAAQ,IAAI,MAAS,QAAQ,OAAO;AAC1C,OAAK,MAAM,IAAI,QAAQ,KAAK;AAC5B,SAAO;AACT;AAEO,MAAM,yBAAyB,CAAC,QAA0B;AAC/D,SAAO,OAAO,QAAQ,YAAY,QAAQ,QAAS,IAAwC,gBAAgB,MAAM;AACnH;AASO,SAAS,qBAAwB,OAAa;AACnD,MACE,OAAO,UAAU,YACjB,UAAU,QACT,MAA0D,gBAAgB,GAC3E;AACA,WAAQ,MAA0C,kBAAkB;AAAA,EACtE;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": ["target"]
|
|
7
7
|
}
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* Unpacks special vue reactivity & override & detect-changes & magic proxy from an input object or array,
|
|
3
3
|
* returning the "raw" plain object or array.
|
|
4
4
|
*/
|
|
5
|
-
export declare const unpackProxyObject: <T
|
|
5
|
+
export declare const unpackProxyObject: <T>(input: T) => T;
|
|
6
6
|
//# sourceMappingURL=unpack-proxy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unpack-proxy.d.ts","sourceRoot":"","sources":["../../src/helpers/unpack-proxy.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"unpack-proxy.d.ts","sourceRoot":"","sources":["../../src/helpers/unpack-proxy.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,EAAE,OAAO,CAAC,KAAG,CACsB,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/helpers/unpack-proxy.ts"],
|
|
4
|
-
"sourcesContent": ["import { getRaw } from '@scalar/json-magic/magic-proxy'\nimport { toRaw } from 'vue'\n\nimport { unpackDetectChangesProxy } from '@/helpers/detect-changes-proxy'\nimport { unpackOverridesProxy } from '@/helpers/overrides-proxy'\n\n/**\n * Unpacks special vue reactivity & override & detect-changes & magic proxy from an input object or array,\n * returning the \"raw\" plain object or array.\n */\nexport const unpackProxyObject = <T
|
|
5
|
-
"mappings": "AAAA,SAAS,cAAc;AACvB,SAAS,aAAa;AAEtB,SAAS,gCAAgC;AACzC,SAAS,4BAA4B;AAM9B,MAAM,oBAAoB,
|
|
4
|
+
"sourcesContent": ["import { getRaw } from '@scalar/json-magic/magic-proxy'\nimport { toRaw } from 'vue'\n\nimport { unpackDetectChangesProxy } from '@/helpers/detect-changes-proxy'\nimport { unpackOverridesProxy } from '@/helpers/overrides-proxy'\n\n/**\n * Unpacks special vue reactivity & override & detect-changes & magic proxy from an input object or array,\n * returning the \"raw\" plain object or array.\n */\nexport const unpackProxyObject = <T>(input: T): T =>\n unpackDetectChangesProxy(toRaw(getRaw(unpackOverridesProxy(input))))\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,cAAc;AACvB,SAAS,aAAa;AAEtB,SAAS,gCAAgC;AACzC,SAAS,4BAA4B;AAM9B,MAAM,oBAAoB,CAAI,UACnC,yBAAyB,MAAM,OAAO,qBAAqB,KAAK,CAAC,CAAC,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|