@dbx-tools/shared-appkit 0.0.0-stage → 0.9.188

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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,49 @@
1
- # Temporary Holding Version
1
+ # @dbx-tools/shared-appkit
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Browser-safe schemas, route constants, and client configuration contracts for
4
+ dbx-tools AppKit extensions.
5
+
6
+ ## Build a browser debug capture request
7
+
8
+ `@dbx-tools/appkit` publishes the optional debug-capture plugin configuration,
9
+ and `@dbx-tools/ui/react` consumes these contracts to record browser events.
10
+ Applications normally enable the route through `createApp({ debug: "auto" })`,
11
+ which is active only when `NODE_ENV=development`.
12
+
13
+ ```ts
14
+ import {
15
+ DebugCaptureClientConfigSchema,
16
+ DebugCaptureRequestSchema,
17
+ debugCaptureRoute,
18
+ } from "@dbx-tools/shared-appkit/debug";
19
+ ```
20
+
21
+ Capture requests are bounded and contain scalar diagnostics only. The browser
22
+ recorder does not send form values or printable key content.
23
+
24
+ ## Resolve the browser capture endpoint
25
+
26
+ Use the published client configuration instead of hard-coding an AppKit route.
27
+ The route helper normalizes a configured base path and appends the capture
28
+ resource path.
29
+
30
+ ```ts
31
+ import {
32
+ DebugCaptureClientConfigSchema,
33
+ debugCaptureRoute,
34
+ } from "@dbx-tools/shared-appkit/debug";
35
+
36
+ const config = DebugCaptureClientConfigSchema.parse({
37
+ basePath: "/api/debug-capture",
38
+ });
39
+ const endpoint = debugCaptureRoute(config.basePath);
40
+ ```
41
+
42
+ The resulting endpoint is `/api/debug-capture/captures` for the default AppKit
43
+ plugin configuration.
44
+
45
+ ## Validate debug requests
46
+
47
+ Use `DebugCaptureRequestSchema` on route handlers or tests that accept browser
48
+ debug payloads. The schema keeps the wire contract browser-safe while the node
49
+ package owns persistence and any server-side processing.
package/index.debug.ts ADDED
@@ -0,0 +1,7 @@
1
+ // GENERATED by projen watch - DO NOT EDIT.
2
+ // Regenerated from the exporting modules in ./src.
3
+ // Hand edits are overwritten on the next watch; this file is read-only.
4
+
5
+ export * as contracts from "./src/debug/contracts.ts";
6
+ export { DEBUG_CAPTURE_PLUGIN_NAME, DEBUG_CAPTURE_ROUTE, DEBUG_CAPTURE_DEFAULT_BASE_PATH, debugCaptureRoute, DebugCaptureScalarSchema, DebugCaptureEventSchema, DebugCaptureEventsSchema, DebugCaptureIdSchema, DebugCaptureRequestSchema, DebugCaptureStartResponseSchema, DebugCaptureAppendResponseSchema, DebugCaptureStopResponseSchema, DebugCaptureClientConfigSchema } from "./src/debug/contracts.ts";
7
+ export type { DebugCaptureScalar, DebugCaptureEvent, DebugCaptureRequest, DebugCaptureClientConfig } from "./src/debug/contracts.ts";
package/index.ts ADDED
@@ -0,0 +1,6 @@
1
+ // GENERATED by projen watch - DO NOT EDIT.
2
+ // Regenerated from the exporting modules in ./src.
3
+ // Hand edits are overwritten on the next watch; this file is read-only.
4
+
5
+ export const PACKAGE_IDENTIFIER = "@dbx-tools/shared-appkit";
6
+ export const PACKAGE_VERSION = "0.9.188";
package/lib/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare const PACKAGE_IDENTIFIER = "@dbx-tools/shared-appkit";
2
+ export declare const PACKAGE_VERSION = "0.9.188";
@@ -0,0 +1,3 @@
1
+ export * as contracts from "./src/debug/contracts.ts";
2
+ export { DEBUG_CAPTURE_PLUGIN_NAME, DEBUG_CAPTURE_ROUTE, DEBUG_CAPTURE_DEFAULT_BASE_PATH, debugCaptureRoute, DebugCaptureScalarSchema, DebugCaptureEventSchema, DebugCaptureEventsSchema, DebugCaptureIdSchema, DebugCaptureRequestSchema, DebugCaptureStartResponseSchema, DebugCaptureAppendResponseSchema, DebugCaptureStopResponseSchema, DebugCaptureClientConfigSchema } from "./src/debug/contracts.ts";
3
+ export type { DebugCaptureScalar, DebugCaptureEvent, DebugCaptureRequest, DebugCaptureClientConfig } from "./src/debug/contracts.ts";
@@ -0,0 +1,6 @@
1
+ // GENERATED by projen watch - DO NOT EDIT.
2
+ // Regenerated from the exporting modules in ./src.
3
+ // Hand edits are overwritten on the next watch; this file is read-only.
4
+ export * as contracts from "./src/debug/contracts.js";
5
+ export { DEBUG_CAPTURE_PLUGIN_NAME, DEBUG_CAPTURE_ROUTE, DEBUG_CAPTURE_DEFAULT_BASE_PATH, debugCaptureRoute, DebugCaptureScalarSchema, DebugCaptureEventSchema, DebugCaptureEventsSchema, DebugCaptureIdSchema, DebugCaptureRequestSchema, DebugCaptureStartResponseSchema, DebugCaptureAppendResponseSchema, DebugCaptureStopResponseSchema, DebugCaptureClientConfigSchema } from "./src/debug/contracts.js";
6
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZGVidWcuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9pbmRleC5kZWJ1Zy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSwyQ0FBMkM7QUFDM0MsbURBQW1EO0FBQ25ELHdFQUF3RTtBQUV4RSxPQUFPLEtBQUssU0FBUyxNQUFNLDBCQUEwQixDQUFDO0FBQ3RELE9BQU8sRUFBRSx5QkFBeUIsRUFBRSxtQkFBbUIsRUFBRSwrQkFBK0IsRUFBRSxpQkFBaUIsRUFBRSx3QkFBd0IsRUFBRSx1QkFBdUIsRUFBRSx3QkFBd0IsRUFBRSxvQkFBb0IsRUFBRSx5QkFBeUIsRUFBRSwrQkFBK0IsRUFBRSxnQ0FBZ0MsRUFBRSw4QkFBOEIsRUFBRSw4QkFBOEIsRUFBRSxNQUFNLDBCQUEwQixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLy8gR0VORVJBVEVEIGJ5IHByb2plbiB3YXRjaCAtIERPIE5PVC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
2
+ // Regenerated from the exporting modules in ./src.
3
+ // Hand edits are overwritten on the next watch; this file is read-only.
4
+ export const PACKAGE_IDENTIFIER = "@dbx-tools/shared-appkit";
5
+ export const PACKAGE_VERSION = "0.9.188";
6
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSwyQ0FBMkM7QUFDM0MsbURBQW1EO0FBQ25ELHdFQUF3RTtBQUV4RSxNQUFNLENBQUMsTUFBTSxrQkFBa0IsR0FBRywwQkFBMEIsQ0FBQztBQUM3RCxNQUFNLENBQUMsTUFBTSxlQUFlLEdBQUcsU0FBUyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLy8gR0VORVJBVEVEIGJ5IHByb2plbiB3YXRjaCAtIERPIE5PVCBFRElULlxuLy8gUmVnZW5lcmF0ZWQgZnJvbSB0aGUgZXhwb3J0aW5nIG1vZHVsZXMgaW4gLi9zcmMuXG4vLyBIYW5kIGVkaXRzIGFyZSBvdmVyd3JpdHRlbiBvbiB0aGUgbmV4dCB3YXRjaDsgdGhpcyBmaWxlIGlzIHJlYWQtb25seS5cblxuZXhwb3J0IGNvbnN0IFBBQ0tBR0VfSURFTlRJRklFUiA9IFwiQGRieC10b29scy9zaGFyZWQtYXBwa2l0XCI7XG5leHBvcnQgY29uc3QgUEFDS0FHRV9WRVJTSU9OID0gXCIwLjkuMTg4XCI7XG4iXX0=
@@ -0,0 +1,75 @@
1
+ import { z } from "zod";
2
+ /** Registered AppKit plugin name for browser debug capture. */
3
+ export declare const DEBUG_CAPTURE_PLUGIN_NAME = "debugCapture";
4
+ /** Route segment registered beneath the debug-capture plugin base path. */
5
+ export declare const DEBUG_CAPTURE_ROUTE = "/captures";
6
+ /** Default AppKit mount for the debug-capture plugin. */
7
+ export declare const DEBUG_CAPTURE_DEFAULT_BASE_PATH = "/api/debug-capture";
8
+ /** Build the browser debug-capture endpoint from a published plugin base path. */
9
+ export declare function debugCaptureRoute(basePath?: string): string;
10
+ /** Scalar value allowed in debug capture metadata and event snapshots. */
11
+ export declare const DebugCaptureScalarSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
12
+ /** Scalar value allowed in debug capture metadata and event snapshots. */
13
+ export type DebugCaptureScalar = z.infer<typeof DebugCaptureScalarSchema>;
14
+ /** One timestamped browser diagnostic event. */
15
+ export declare const DebugCaptureEventSchema: z.ZodObject<{
16
+ at: z.ZodNumber;
17
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
18
+ sequence: z.ZodNumber;
19
+ type: z.ZodString;
20
+ }, z.core.$strict>;
21
+ /** One timestamped browser diagnostic event. */
22
+ export type DebugCaptureEvent = z.infer<typeof DebugCaptureEventSchema>;
23
+ /** Bounded event batch accepted by append and stop requests. */
24
+ export declare const DebugCaptureEventsSchema: z.ZodArray<z.ZodObject<{
25
+ at: z.ZodNumber;
26
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
27
+ sequence: z.ZodNumber;
28
+ type: z.ZodString;
29
+ }, z.core.$strict>>;
30
+ /** Capture identifier generated by the AppKit debug plugin. */
31
+ export declare const DebugCaptureIdSchema: z.ZodString;
32
+ /** Request body accepted by the debug-capture route. */
33
+ export declare const DebugCaptureRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
34
+ action: z.ZodLiteral<"start">;
35
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
36
+ }, z.core.$strict>, z.ZodObject<{
37
+ action: z.ZodLiteral<"append">;
38
+ captureId: z.ZodString;
39
+ events: z.ZodArray<z.ZodObject<{
40
+ at: z.ZodNumber;
41
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
42
+ sequence: z.ZodNumber;
43
+ type: z.ZodString;
44
+ }, z.core.$strict>>;
45
+ }, z.core.$strict>, z.ZodObject<{
46
+ action: z.ZodLiteral<"stop">;
47
+ captureId: z.ZodString;
48
+ events: z.ZodArray<z.ZodObject<{
49
+ at: z.ZodNumber;
50
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
51
+ sequence: z.ZodNumber;
52
+ type: z.ZodString;
53
+ }, z.core.$strict>>;
54
+ }, z.core.$strict>], "action">;
55
+ /** Request body accepted by the debug-capture route. */
56
+ export type DebugCaptureRequest = z.infer<typeof DebugCaptureRequestSchema>;
57
+ /** Response returned after starting a browser debug capture. */
58
+ export declare const DebugCaptureStartResponseSchema: z.ZodObject<{
59
+ captureId: z.ZodString;
60
+ }, z.core.$strict>;
61
+ /** Response returned after appending browser debug events. */
62
+ export declare const DebugCaptureAppendResponseSchema: z.ZodObject<{
63
+ ok: z.ZodLiteral<true>;
64
+ }, z.core.$strict>;
65
+ /** Response returned after stopping a browser debug capture. */
66
+ export declare const DebugCaptureStopResponseSchema: z.ZodObject<{
67
+ captureId: z.ZodString;
68
+ ok: z.ZodLiteral<true>;
69
+ }, z.core.$strict>;
70
+ /** Browser-safe configuration published by the AppKit debug-capture plugin. */
71
+ export declare const DebugCaptureClientConfigSchema: z.ZodObject<{
72
+ basePath: z.ZodString;
73
+ }, z.core.$strict>;
74
+ /** Browser-safe configuration published by the AppKit debug-capture plugin. */
75
+ export type DebugCaptureClientConfig = z.infer<typeof DebugCaptureClientConfigSchema>;
@@ -0,0 +1,99 @@
1
+ import { z } from "zod";
2
+ /** Registered AppKit plugin name for browser debug capture. */
3
+ export const DEBUG_CAPTURE_PLUGIN_NAME = "debugCapture";
4
+ /** Route segment registered beneath the debug-capture plugin base path. */
5
+ export const DEBUG_CAPTURE_ROUTE = "/captures";
6
+ /** Default AppKit mount for the debug-capture plugin. */
7
+ export const DEBUG_CAPTURE_DEFAULT_BASE_PATH = "/api/debug-capture";
8
+ /** Build the browser debug-capture endpoint from a published plugin base path. */
9
+ export function debugCaptureRoute(basePath = DEBUG_CAPTURE_DEFAULT_BASE_PATH) {
10
+ return `${basePath.replace(/\/+$/, "")}${DEBUG_CAPTURE_ROUTE}`;
11
+ }
12
+ /** Scalar value allowed in debug capture metadata and event snapshots. */
13
+ export const DebugCaptureScalarSchema = z
14
+ .union([z.string().max(500), z.number().finite(), z.boolean(), z.null()])
15
+ .describe("Bounded scalar diagnostic value safe to serialize as JSON.");
16
+ /** One timestamped browser diagnostic event. */
17
+ export const DebugCaptureEventSchema = z
18
+ .object({
19
+ at: z
20
+ .number()
21
+ .finite()
22
+ .nonnegative()
23
+ .describe("Milliseconds elapsed since this capture started."),
24
+ data: z
25
+ .record(z.string().max(80), DebugCaptureScalarSchema)
26
+ .optional()
27
+ .describe("Browser, viewport, target, and selected element measurements."),
28
+ sequence: z.number().int().nonnegative().describe("Monotonic event sequence number."),
29
+ type: z.string().min(1).max(80).describe("Normalized browser or recorder event name."),
30
+ })
31
+ .strict()
32
+ .describe("One browser debug-capture event.");
33
+ /** Bounded event batch accepted by append and stop requests. */
34
+ export const DebugCaptureEventsSchema = z
35
+ .array(DebugCaptureEventSchema)
36
+ .max(200)
37
+ .describe("Ordered browser diagnostic events uploaded in one request.");
38
+ /** Capture identifier generated by the AppKit debug plugin. */
39
+ export const DebugCaptureIdSchema = z
40
+ .string()
41
+ .regex(/^vp-[a-z0-9]+-[a-f0-9]{8}$/)
42
+ .describe("Opaque browser debug-capture identifier.");
43
+ /** Request body accepted by the debug-capture route. */
44
+ export const DebugCaptureRequestSchema = z
45
+ .discriminatedUnion("action", [
46
+ z
47
+ .object({
48
+ action: z.literal("start").describe("Start a new capture."),
49
+ metadata: z
50
+ .record(z.string().max(80), DebugCaptureScalarSchema)
51
+ .describe("Initial application, route, device, and browser metadata."),
52
+ })
53
+ .strict(),
54
+ z
55
+ .object({
56
+ action: z.literal("append").describe("Append buffered events."),
57
+ captureId: DebugCaptureIdSchema,
58
+ events: DebugCaptureEventsSchema,
59
+ })
60
+ .strict(),
61
+ z
62
+ .object({
63
+ action: z.literal("stop").describe("Append final events and close the capture."),
64
+ captureId: DebugCaptureIdSchema,
65
+ events: DebugCaptureEventsSchema,
66
+ })
67
+ .strict(),
68
+ ])
69
+ .describe("Start, append, or stop request for a browser debug capture.");
70
+ /** Response returned after starting a browser debug capture. */
71
+ export const DebugCaptureStartResponseSchema = z
72
+ .object({
73
+ captureId: DebugCaptureIdSchema,
74
+ })
75
+ .strict()
76
+ .describe("New browser debug-capture identifier.");
77
+ /** Response returned after appending browser debug events. */
78
+ export const DebugCaptureAppendResponseSchema = z
79
+ .object({
80
+ ok: z.literal(true).describe("Whether the event batch was persisted."),
81
+ })
82
+ .strict()
83
+ .describe("Browser debug-capture append result.");
84
+ /** Response returned after stopping a browser debug capture. */
85
+ export const DebugCaptureStopResponseSchema = z
86
+ .object({
87
+ captureId: DebugCaptureIdSchema,
88
+ ok: z.literal(true).describe("Whether the capture was closed."),
89
+ })
90
+ .strict()
91
+ .describe("Completed browser debug-capture result.");
92
+ /** Browser-safe configuration published by the AppKit debug-capture plugin. */
93
+ export const DebugCaptureClientConfigSchema = z
94
+ .object({
95
+ basePath: z.string().min(1).describe("AppKit mount containing the capture route."),
96
+ })
97
+ .strict()
98
+ .describe("Browser-safe AppKit debug-capture configuration.");
99
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJhY3RzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2RlYnVnL2NvbnRyYWN0cy50cyJdLCJuYW1lcyI6W10sI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hbCh0cnVlKS5kZXNjcmliZShcIldoZXRoZXIgdGhlIGNhcHR1cmUgd2FzIGNsb3NlZC5cIiksXG4gIH0pXG4gIC5zdHJpY3QoKVxuICAuZGVzY3JpYmUoXCJDb21wbGV0ZWQgYnJvd3NlciBkZWJ1Zy1jYXB0dXJlIHJlc3VsdC5cIik7XG5cbi8qKiBCcm93c2VyLXNhZmUgY29uZmlndXJhdGlvbiBwdWJsaXNoZWQgYnkgdGhlIEFwcEtpdCBkZWJ1Zy1jYXB0dXJlIHBsdWdpbi4gKi9cbmV4cG9ydCBjb25zdCBEZWJ1Z0NhcHR1cmVDbGllbnRDb25maWdTY2hlbWEgPSB6XG4gIC5vYmplY3Qoe1xuICAgIGJhc2VQYXRoOiB6LnN0cmluZygpLm1pbigxKS5kZXNjcmliZShcIkFwcEtpdCBtb3VudCBjb250YWluaW5nIHRoZSBjYXB0dXJlIHJvdXRlLlwiKSxcbiAgfSlcbiAgLnN0cmljdCgpXG4gIC5kZXNjcmliZShcIkJyb3dzZXItc2FmZSBBcHBLaXQgZGVidWctY2FwdHVyZSBjb25maWd1cmF0aW9uLlwiKTtcblxuLyoqIEJyb3dzZXItc2FmZSBjb25maWd1cmF0aW9uIHB1Ymxpc2hlZCBieSB0aGUgQXBwS2l0IGRlYnVnLWNhcHR1cmUgcGx1Z2luLiAqL1xuZXhwb3J0IHR5cGUgRGVidWdDYXB0dXJlQ2xpZW50Q29uZmlnID0gei5pbmZlcjx0eXBlb2YgRGVidWdDYXB0dXJlQ2xpZW50Q29uZmlnU2NoZW1hPjtcbiJdfQ==
@@ -0,0 +1 @@
1
+ {"root":["../src/debug/contracts.ts","../index.debug.ts","../index.ts"],"version":"5.9.3"}
package/package.json CHANGED
@@ -1,6 +1,70 @@
1
1
  {
2
2
  "name": "@dbx-tools/shared-appkit",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "description": "Browser-safe contracts for dbx-tools AppKit plugins and development diagnostics",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/reggie-db/dbx-tools.git",
7
+ "directory": "packages/js/shared/appkit"
8
+ },
9
+ "scripts": {
10
+ "build": "projen build",
11
+ "compile": "projen compile",
12
+ "default": "projen default",
13
+ "package": "projen package",
14
+ "post-compile": "projen post-compile",
15
+ "pre-compile": "projen pre-compile",
16
+ "prepack": "projen prepack",
17
+ "test": "projen test",
18
+ "watch": "projen watch",
19
+ "projen": "projen"
20
+ },
21
+ "devDependencies": {
22
+ "typescript": "^5.9.3"
23
+ },
24
+ "dependencies": {
25
+ "zod": "4.3.6"
26
+ },
27
+ "main": "./lib/index.js",
28
+ "license": "Apache-2.0",
29
+ "publishConfig": {
30
+ "access": "public",
31
+ "main": "./lib/index.js",
32
+ "types": "./lib/index.d.ts",
33
+ "exports": {
34
+ ".": {
35
+ "types": "./lib/index.d.ts",
36
+ "default": "./lib/index.js"
37
+ },
38
+ "./debug": {
39
+ "types": "./lib/index.debug.d.ts",
40
+ "default": "./lib/index.debug.js"
41
+ },
42
+ "./package.json": "./package.json"
43
+ }
44
+ },
45
+ "version": "0.9.188",
46
+ "types": "./lib/index.d.ts",
47
+ "dbxToolsConfig": {
48
+ "tags": [
49
+ "shared"
50
+ ]
51
+ },
52
+ "type": "module",
53
+ "exports": {
54
+ ".": {
55
+ "types": "./lib/index.d.ts",
56
+ "default": "./lib/index.js"
57
+ },
58
+ "./debug": {
59
+ "types": "./lib/index.debug.d.ts",
60
+ "default": "./lib/index.debug.js"
61
+ },
62
+ "./package.json": "./package.json"
63
+ },
64
+ "files": [
65
+ "index*.ts",
66
+ "src",
67
+ "lib"
68
+ ],
69
+ "//": "~~ Generated by projen. To modify, edit .projenrc.js and run \"bunx projen\"."
70
+ }
@@ -0,0 +1,123 @@
1
+ import { z } from "zod";
2
+
3
+ /** Registered AppKit plugin name for browser debug capture. */
4
+ export const DEBUG_CAPTURE_PLUGIN_NAME = "debugCapture";
5
+
6
+ /** Route segment registered beneath the debug-capture plugin base path. */
7
+ export const DEBUG_CAPTURE_ROUTE = "/captures";
8
+
9
+ /** Default AppKit mount for the debug-capture plugin. */
10
+ export const DEBUG_CAPTURE_DEFAULT_BASE_PATH = "/api/debug-capture";
11
+
12
+ /** Build the browser debug-capture endpoint from a published plugin base path. */
13
+ export function debugCaptureRoute(basePath = DEBUG_CAPTURE_DEFAULT_BASE_PATH): string {
14
+ return `${basePath.replace(/\/+$/, "")}${DEBUG_CAPTURE_ROUTE}`;
15
+ }
16
+
17
+ /** Scalar value allowed in debug capture metadata and event snapshots. */
18
+ export const DebugCaptureScalarSchema = z
19
+ .union([z.string().max(500), z.number().finite(), z.boolean(), z.null()])
20
+ .describe("Bounded scalar diagnostic value safe to serialize as JSON.");
21
+
22
+ /** Scalar value allowed in debug capture metadata and event snapshots. */
23
+ export type DebugCaptureScalar = z.infer<typeof DebugCaptureScalarSchema>;
24
+
25
+ /** One timestamped browser diagnostic event. */
26
+ export const DebugCaptureEventSchema = z
27
+ .object({
28
+ at: z
29
+ .number()
30
+ .finite()
31
+ .nonnegative()
32
+ .describe("Milliseconds elapsed since this capture started."),
33
+ data: z
34
+ .record(z.string().max(80), DebugCaptureScalarSchema)
35
+ .optional()
36
+ .describe("Browser, viewport, target, and selected element measurements."),
37
+ sequence: z.number().int().nonnegative().describe("Monotonic event sequence number."),
38
+ type: z.string().min(1).max(80).describe("Normalized browser or recorder event name."),
39
+ })
40
+ .strict()
41
+ .describe("One browser debug-capture event.");
42
+
43
+ /** One timestamped browser diagnostic event. */
44
+ export type DebugCaptureEvent = z.infer<typeof DebugCaptureEventSchema>;
45
+
46
+ /** Bounded event batch accepted by append and stop requests. */
47
+ export const DebugCaptureEventsSchema = z
48
+ .array(DebugCaptureEventSchema)
49
+ .max(200)
50
+ .describe("Ordered browser diagnostic events uploaded in one request.");
51
+
52
+ /** Capture identifier generated by the AppKit debug plugin. */
53
+ export const DebugCaptureIdSchema = z
54
+ .string()
55
+ .regex(/^vp-[a-z0-9]+-[a-f0-9]{8}$/)
56
+ .describe("Opaque browser debug-capture identifier.");
57
+
58
+ /** Request body accepted by the debug-capture route. */
59
+ export const DebugCaptureRequestSchema = z
60
+ .discriminatedUnion("action", [
61
+ z
62
+ .object({
63
+ action: z.literal("start").describe("Start a new capture."),
64
+ metadata: z
65
+ .record(z.string().max(80), DebugCaptureScalarSchema)
66
+ .describe("Initial application, route, device, and browser metadata."),
67
+ })
68
+ .strict(),
69
+ z
70
+ .object({
71
+ action: z.literal("append").describe("Append buffered events."),
72
+ captureId: DebugCaptureIdSchema,
73
+ events: DebugCaptureEventsSchema,
74
+ })
75
+ .strict(),
76
+ z
77
+ .object({
78
+ action: z.literal("stop").describe("Append final events and close the capture."),
79
+ captureId: DebugCaptureIdSchema,
80
+ events: DebugCaptureEventsSchema,
81
+ })
82
+ .strict(),
83
+ ])
84
+ .describe("Start, append, or stop request for a browser debug capture.");
85
+
86
+ /** Request body accepted by the debug-capture route. */
87
+ export type DebugCaptureRequest = z.infer<typeof DebugCaptureRequestSchema>;
88
+
89
+ /** Response returned after starting a browser debug capture. */
90
+ export const DebugCaptureStartResponseSchema = z
91
+ .object({
92
+ captureId: DebugCaptureIdSchema,
93
+ })
94
+ .strict()
95
+ .describe("New browser debug-capture identifier.");
96
+
97
+ /** Response returned after appending browser debug events. */
98
+ export const DebugCaptureAppendResponseSchema = z
99
+ .object({
100
+ ok: z.literal(true).describe("Whether the event batch was persisted."),
101
+ })
102
+ .strict()
103
+ .describe("Browser debug-capture append result.");
104
+
105
+ /** Response returned after stopping a browser debug capture. */
106
+ export const DebugCaptureStopResponseSchema = z
107
+ .object({
108
+ captureId: DebugCaptureIdSchema,
109
+ ok: z.literal(true).describe("Whether the capture was closed."),
110
+ })
111
+ .strict()
112
+ .describe("Completed browser debug-capture result.");
113
+
114
+ /** Browser-safe configuration published by the AppKit debug-capture plugin. */
115
+ export const DebugCaptureClientConfigSchema = z
116
+ .object({
117
+ basePath: z.string().min(1).describe("AppKit mount containing the capture route."),
118
+ })
119
+ .strict()
120
+ .describe("Browser-safe AppKit debug-capture configuration.");
121
+
122
+ /** Browser-safe configuration published by the AppKit debug-capture plugin. */
123
+ export type DebugCaptureClientConfig = z.infer<typeof DebugCaptureClientConfigSchema>;