@superblocksteam/library-shared 1.99.99-next.3 → 2.0.0-SNAPSHOT.295fc0b43e332060
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/dist/computed.d.ts +4 -2
- package/dist/computed.d.ts.map +1 -1
- package/dist/computed.js +1 -1
- package/dist/computed.js.map +1 -1
- package/dist/default-structure.d.ts +12 -0
- package/dist/default-structure.d.ts.map +1 -0
- package/dist/default-structure.js +36 -0
- package/dist/default-structure.js.map +1 -0
- package/dist/event-trigger-constants.d.ts +2 -0
- package/dist/event-trigger-constants.d.ts.map +1 -0
- package/dist/event-trigger-constants.js +2 -0
- package/dist/event-trigger-constants.js.map +1 -0
- package/dist/index.d.ts +18 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -9
- package/dist/index.js.map +1 -1
- package/dist/layout.d.ts +12 -1
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +11 -4
- package/dist/layout.js.map +1 -1
- package/dist/mobx-sync/apply-patch.d.ts.map +1 -1
- package/dist/mobx-sync/apply-patch.js +23 -4
- package/dist/mobx-sync/apply-patch.js.map +1 -1
- package/dist/mobx-sync/to-patch.d.ts.map +1 -1
- package/dist/mobx-sync/to-patch.js.map +1 -1
- package/dist/pages.d.ts +76 -6
- package/dist/pages.d.ts.map +1 -1
- package/dist/pages.js +54 -2
- package/dist/pages.js.map +1 -1
- package/dist/pegs/find-string-interpolation.d.ts +12 -0
- package/dist/pegs/find-string-interpolation.d.ts.map +1 -0
- package/dist/pegs/find-string-interpolation.js +1265 -0
- package/dist/pegs/find-string-interpolation.js.map +1 -0
- package/dist/props/helpers.d.ts +1 -9
- package/dist/props/helpers.d.ts.map +1 -1
- package/dist/props/helpers.js +5 -54
- package/dist/props/helpers.js.map +1 -1
- package/dist/props/prop-types.d.ts +24 -13
- package/dist/props/prop-types.d.ts.map +1 -1
- package/dist/props/prop-types.js.map +1 -1
- package/dist/props/properties-panel.d.ts +61 -26
- package/dist/props/properties-panel.d.ts.map +1 -1
- package/dist/props/properties-panel.js +2 -5
- package/dist/props/properties-panel.js.map +1 -1
- package/dist/props/tailwind-property-keys.d.ts +5 -0
- package/dist/props/tailwind-property-keys.d.ts.map +1 -0
- package/dist/props/tailwind-property-keys.js +234 -0
- package/dist/props/tailwind-property-keys.js.map +1 -0
- package/dist/restart-contract.d.ts +35 -0
- package/dist/restart-contract.d.ts.map +1 -0
- package/dist/restart-contract.js +49 -0
- package/dist/restart-contract.js.map +1 -0
- package/dist/scope.d.ts +2 -0
- package/dist/scope.d.ts.map +1 -1
- package/dist/scope.js +3 -0
- package/dist/scope.js.map +1 -1
- package/dist/testing/default-structure-scope/index.d.ts +8 -0
- package/dist/testing/default-structure-scope/index.d.ts.map +1 -0
- package/dist/testing/default-structure-scope/index.js +62 -0
- package/dist/testing/default-structure-scope/index.js.map +1 -0
- package/dist/testing/fake-editor-channel/fake-artifact.d.ts +41 -0
- package/dist/testing/fake-editor-channel/fake-artifact.d.ts.map +1 -0
- package/dist/testing/fake-editor-channel/fake-artifact.js +74 -0
- package/dist/testing/fake-editor-channel/fake-artifact.js.map +1 -0
- package/dist/testing/fake-editor-channel/index.d.ts +115 -0
- package/dist/testing/fake-editor-channel/index.d.ts.map +1 -0
- package/dist/testing/fake-editor-channel/index.js +292 -0
- package/dist/testing/fake-editor-channel/index.js.map +1 -0
- package/dist/testing/fake-editor-channel/type-pins.d.ts +13 -0
- package/dist/testing/fake-editor-channel/type-pins.d.ts.map +1 -0
- package/dist/testing/fake-editor-channel/type-pins.js +13 -0
- package/dist/testing/fake-editor-channel/type-pins.js.map +1 -0
- package/dist/types/ai.d.ts +1745 -0
- package/dist/types/ai.d.ts.map +1 -0
- package/dist/types/ai.js +445 -0
- package/dist/types/ai.js.map +1 -0
- package/dist/types/apis.d.ts +44 -1
- package/dist/types/apis.d.ts.map +1 -1
- package/dist/types/base-entity-manager.d.ts +15 -0
- package/dist/types/base-entity-manager.d.ts.map +1 -0
- package/dist/types/base-entity-manager.js +2 -0
- package/dist/types/base-entity-manager.js.map +1 -0
- package/dist/types/common.d.ts +4 -1
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/common.js +4 -1
- package/dist/types/common.js.map +1 -1
- package/dist/types/edit-operations.d.ts +26 -35
- package/dist/types/edit-operations.d.ts.map +1 -1
- package/dist/types/edit-operations.js +2 -0
- package/dist/types/edit-operations.js.map +1 -1
- package/dist/types/entities.d.ts +10 -29
- package/dist/types/entities.d.ts.map +1 -1
- package/dist/types/entities.js +0 -5
- package/dist/types/entities.js.map +1 -1
- package/dist/types/errors.d.ts +82 -1
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +18 -1
- package/dist/types/errors.js.map +1 -1
- package/dist/types/events.d.ts +218 -26
- package/dist/types/events.d.ts.map +1 -1
- package/dist/types/events.js +33 -5
- package/dist/types/events.js.map +1 -1
- package/dist/types/index.d.ts +19 -7
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +19 -7
- package/dist/types/index.js.map +1 -1
- package/dist/types/migration.d.ts +240 -0
- package/dist/types/migration.d.ts.map +1 -0
- package/dist/types/migration.js +50 -0
- package/dist/types/migration.js.map +1 -0
- package/dist/types/mobx-shared-state.d.ts +25 -1
- package/dist/types/mobx-shared-state.d.ts.map +1 -1
- package/dist/types/parent-messages.d.ts +44 -14
- package/dist/types/parent-messages.d.ts.map +1 -1
- package/dist/types/persisted-chat-message.d.ts +55 -0
- package/dist/types/persisted-chat-message.d.ts.map +1 -0
- package/dist/types/persisted-chat-message.js +757 -0
- package/dist/types/persisted-chat-message.js.map +1 -0
- package/dist/types/protected-packages.d.ts +54 -0
- package/dist/types/protected-packages.d.ts.map +1 -0
- package/dist/types/protected-packages.js +91 -0
- package/dist/types/protected-packages.js.map +1 -0
- package/dist/types/register-component.d.ts +128 -0
- package/dist/types/register-component.d.ts.map +1 -0
- package/dist/types/register-component.js +45 -0
- package/dist/types/register-component.js.map +1 -0
- package/dist/types/routing.d.ts +68 -0
- package/dist/types/routing.d.ts.map +1 -0
- package/dist/types/routing.js +2 -0
- package/dist/types/routing.js.map +1 -0
- package/dist/types/scope.d.ts +8 -6
- package/dist/types/scope.d.ts.map +1 -1
- package/dist/types/snapshot.d.ts +53 -0
- package/dist/types/snapshot.d.ts.map +1 -0
- package/dist/types/snapshot.js +2 -0
- package/dist/types/snapshot.js.map +1 -0
- package/dist/types/socket-method-names.d.ts +216 -0
- package/dist/types/socket-method-names.d.ts.map +1 -0
- package/dist/types/socket-method-names.js +165 -0
- package/dist/types/socket-method-names.js.map +1 -0
- package/dist/types/socket.d.ts +722 -48
- package/dist/types/socket.d.ts.map +1 -1
- package/dist/types/theme.d.ts +8 -7
- package/dist/types/theme.d.ts.map +1 -1
- package/dist/types/theme.js +5 -6
- package/dist/types/theme.js.map +1 -1
- package/dist/types/tool-permission-response.d.ts +5 -0
- package/dist/types/tool-permission-response.d.ts.map +1 -0
- package/dist/types/tool-permission-response.js +26 -0
- package/dist/types/tool-permission-response.js.map +1 -0
- package/dist/types/vite.d.ts +29 -0
- package/dist/types/vite.d.ts.map +1 -0
- package/dist/types/vite.js +6 -0
- package/dist/types/vite.js.map +1 -0
- package/dist/urls.d.ts +7 -0
- package/dist/urls.d.ts.map +1 -0
- package/dist/urls.js +6 -0
- package/dist/urls.js.map +1 -0
- package/dist/utils/binding-identifier.d.ts +1 -0
- package/dist/utils/binding-identifier.d.ts.map +1 -1
- package/dist/utils/binding-identifier.js +3 -0
- package/dist/utils/binding-identifier.js.map +1 -1
- package/dist/utils/blocks.d.ts +3 -0
- package/dist/utils/blocks.d.ts.map +1 -0
- package/dist/utils/blocks.js +70 -0
- package/dist/utils/blocks.js.map +1 -0
- package/dist/utils/computed-args.d.ts +11 -0
- package/dist/utils/computed-args.d.ts.map +1 -0
- package/dist/utils/computed-args.js +13 -0
- package/dist/utils/computed-args.js.map +1 -0
- package/dist/utils/dev-server-authorization.d.ts +4 -0
- package/dist/utils/dev-server-authorization.d.ts.map +1 -0
- package/dist/utils/dev-server-authorization.js +56 -0
- package/dist/utils/dev-server-authorization.js.map +1 -0
- package/dist/utils/dotted-paths.js +1 -1
- package/dist/utils/dotted-paths.js.map +1 -1
- package/dist/utils/properties.d.ts +12 -9
- package/dist/utils/properties.d.ts.map +1 -1
- package/dist/utils/properties.js +14 -6
- package/dist/utils/properties.js.map +1 -1
- package/dist/utils/routing.d.ts +5 -0
- package/dist/utils/routing.d.ts.map +1 -0
- package/dist/utils/routing.js +16 -0
- package/dist/utils/routing.js.map +1 -0
- package/dist/utils/strings.d.ts +12 -0
- package/dist/utils/strings.d.ts.map +1 -1
- package/dist/utils/strings.js +40 -1
- package/dist/utils/strings.js.map +1 -1
- package/package.json +53 -25
- package/dist/apis.d.ts +0 -2
- package/dist/apis.d.ts.map +0 -1
- package/dist/apis.js +0 -4
- package/dist/apis.js.map +0 -1
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
export const BORDER_RADIUS_PROPERTY_KEYS = [
|
|
2
|
+
"rounded",
|
|
3
|
+
"rounded-tl",
|
|
4
|
+
"rounded-tr",
|
|
5
|
+
"rounded-br",
|
|
6
|
+
"rounded-bl",
|
|
7
|
+
"rounded-t",
|
|
8
|
+
"rounded-r",
|
|
9
|
+
"rounded-b",
|
|
10
|
+
"rounded-l",
|
|
11
|
+
];
|
|
12
|
+
export const BORDER_PROPERTY_KEYS = [
|
|
13
|
+
"border-width",
|
|
14
|
+
"border-t-width",
|
|
15
|
+
"border-r-width",
|
|
16
|
+
"border-b-width",
|
|
17
|
+
"border-l-width",
|
|
18
|
+
// color
|
|
19
|
+
"border-color",
|
|
20
|
+
"border-t-color",
|
|
21
|
+
"border-r-color",
|
|
22
|
+
"border-b-color",
|
|
23
|
+
"border-l-color",
|
|
24
|
+
];
|
|
25
|
+
// Comprehensive list of all supported Tailwind property keys
|
|
26
|
+
export const TAILWIND_PROPERTY_KEYS = [
|
|
27
|
+
// Layout
|
|
28
|
+
"display",
|
|
29
|
+
"position",
|
|
30
|
+
"top",
|
|
31
|
+
"right",
|
|
32
|
+
"bottom",
|
|
33
|
+
"left",
|
|
34
|
+
"visibility",
|
|
35
|
+
"z-index",
|
|
36
|
+
"overflow",
|
|
37
|
+
"overflow-x",
|
|
38
|
+
"overflow-y",
|
|
39
|
+
"overscroll",
|
|
40
|
+
"clear",
|
|
41
|
+
"float",
|
|
42
|
+
// Flexbox & Grid
|
|
43
|
+
"flex-direction",
|
|
44
|
+
"flex-wrap",
|
|
45
|
+
"flex",
|
|
46
|
+
"flex-grow",
|
|
47
|
+
"flex-shrink",
|
|
48
|
+
"flex-basis",
|
|
49
|
+
"order",
|
|
50
|
+
"grid-template-columns",
|
|
51
|
+
"grid-template-rows",
|
|
52
|
+
"grid-column",
|
|
53
|
+
"grid-row",
|
|
54
|
+
"grid-auto-flow",
|
|
55
|
+
"gap",
|
|
56
|
+
"gap-x",
|
|
57
|
+
"gap-y",
|
|
58
|
+
"justify",
|
|
59
|
+
"justify-items",
|
|
60
|
+
"justify-self",
|
|
61
|
+
"align-content",
|
|
62
|
+
"align-items",
|
|
63
|
+
"align-self",
|
|
64
|
+
"place-content",
|
|
65
|
+
"place-items",
|
|
66
|
+
"place-self",
|
|
67
|
+
// Spacing
|
|
68
|
+
"m",
|
|
69
|
+
"mx",
|
|
70
|
+
"my",
|
|
71
|
+
"mt",
|
|
72
|
+
"mr",
|
|
73
|
+
"mb",
|
|
74
|
+
"ml",
|
|
75
|
+
"p",
|
|
76
|
+
"px",
|
|
77
|
+
"py",
|
|
78
|
+
"pt",
|
|
79
|
+
"pr",
|
|
80
|
+
"pb",
|
|
81
|
+
"pl",
|
|
82
|
+
"space-x",
|
|
83
|
+
"space-y",
|
|
84
|
+
// Sizing
|
|
85
|
+
"width",
|
|
86
|
+
"min-width",
|
|
87
|
+
"max-width",
|
|
88
|
+
"height",
|
|
89
|
+
"min-height",
|
|
90
|
+
"max-height",
|
|
91
|
+
"size",
|
|
92
|
+
"aspect-ratio",
|
|
93
|
+
// Typography
|
|
94
|
+
"font-family",
|
|
95
|
+
"font-size",
|
|
96
|
+
"font-weight",
|
|
97
|
+
"font-style",
|
|
98
|
+
"font-variant-numeric",
|
|
99
|
+
"line-height",
|
|
100
|
+
"letter-spacing",
|
|
101
|
+
"text-align",
|
|
102
|
+
"text-color",
|
|
103
|
+
"text-shadow-size",
|
|
104
|
+
"text-shadow-color",
|
|
105
|
+
"text-decoration",
|
|
106
|
+
"text-decoration-color",
|
|
107
|
+
"text-decoration-style",
|
|
108
|
+
"text-decoration-thickness",
|
|
109
|
+
"text-underline-offset",
|
|
110
|
+
"text-transform",
|
|
111
|
+
"text-overflow",
|
|
112
|
+
"text-indent",
|
|
113
|
+
"text-balance",
|
|
114
|
+
"vertical-align",
|
|
115
|
+
"whitespace",
|
|
116
|
+
"word-break",
|
|
117
|
+
"hyphens",
|
|
118
|
+
"content",
|
|
119
|
+
"object-fit",
|
|
120
|
+
"object-position",
|
|
121
|
+
// Backgrounds
|
|
122
|
+
"background-attachment",
|
|
123
|
+
"background-clip",
|
|
124
|
+
"background-color",
|
|
125
|
+
"background-origin",
|
|
126
|
+
"background-position",
|
|
127
|
+
"background-repeat",
|
|
128
|
+
"background-size",
|
|
129
|
+
"background-image",
|
|
130
|
+
"background-gradient-from",
|
|
131
|
+
"background-gradient-via",
|
|
132
|
+
"background-gradient-to",
|
|
133
|
+
// Borders
|
|
134
|
+
...BORDER_RADIUS_PROPERTY_KEYS,
|
|
135
|
+
...BORDER_PROPERTY_KEYS,
|
|
136
|
+
"border-style",
|
|
137
|
+
"border-collapse",
|
|
138
|
+
"border-spacing",
|
|
139
|
+
"divide-width",
|
|
140
|
+
"divide-color",
|
|
141
|
+
"divide-style",
|
|
142
|
+
"outline-width",
|
|
143
|
+
"outline-color",
|
|
144
|
+
"outline-style",
|
|
145
|
+
"outline-offset",
|
|
146
|
+
"ring-width",
|
|
147
|
+
"ring-color",
|
|
148
|
+
"ring-opacity",
|
|
149
|
+
"ring-offset-width",
|
|
150
|
+
"ring-offset-color",
|
|
151
|
+
// Effects
|
|
152
|
+
"box-shadow",
|
|
153
|
+
"box-shadow-color",
|
|
154
|
+
"opacity",
|
|
155
|
+
"mix-blend-mode",
|
|
156
|
+
"background-blend-mode",
|
|
157
|
+
// Filters
|
|
158
|
+
"blur",
|
|
159
|
+
"brightness",
|
|
160
|
+
"contrast",
|
|
161
|
+
"drop-shadow",
|
|
162
|
+
"grayscale",
|
|
163
|
+
"hue-rotate",
|
|
164
|
+
"invert",
|
|
165
|
+
"saturate",
|
|
166
|
+
"sepia",
|
|
167
|
+
"backdrop-blur",
|
|
168
|
+
"backdrop-brightness",
|
|
169
|
+
"backdrop-contrast",
|
|
170
|
+
"backdrop-grayscale",
|
|
171
|
+
"backdrop-hue-rotate",
|
|
172
|
+
"backdrop-invert",
|
|
173
|
+
"backdrop-opacity",
|
|
174
|
+
"backdrop-saturate",
|
|
175
|
+
"backdrop-sepia",
|
|
176
|
+
// Tables
|
|
177
|
+
"border-collapse",
|
|
178
|
+
"border-spacing",
|
|
179
|
+
"table-layout",
|
|
180
|
+
"caption-side",
|
|
181
|
+
"empty-cells",
|
|
182
|
+
// Transitions & Animation
|
|
183
|
+
"transition",
|
|
184
|
+
"transition-delay",
|
|
185
|
+
"transition-duration",
|
|
186
|
+
"transition-property",
|
|
187
|
+
"transition-timing-function",
|
|
188
|
+
"duration",
|
|
189
|
+
"delay",
|
|
190
|
+
"ease",
|
|
191
|
+
"animate",
|
|
192
|
+
// Transforms
|
|
193
|
+
"scale",
|
|
194
|
+
"scale-x",
|
|
195
|
+
"scale-y",
|
|
196
|
+
"rotate",
|
|
197
|
+
"translate-x",
|
|
198
|
+
"translate-y",
|
|
199
|
+
"skew-x",
|
|
200
|
+
"skew-y",
|
|
201
|
+
"transform-origin",
|
|
202
|
+
// Interactivity
|
|
203
|
+
"accent-color",
|
|
204
|
+
"appearance",
|
|
205
|
+
"cursor",
|
|
206
|
+
"caret-color",
|
|
207
|
+
"pointer-events",
|
|
208
|
+
"resize",
|
|
209
|
+
"scroll-behavior",
|
|
210
|
+
"scroll-margin",
|
|
211
|
+
"scroll-padding",
|
|
212
|
+
"scroll-snap-align",
|
|
213
|
+
"scroll-snap-stop",
|
|
214
|
+
"scroll-snap-type",
|
|
215
|
+
"touch-action",
|
|
216
|
+
"user-select",
|
|
217
|
+
"will-change",
|
|
218
|
+
// SVG
|
|
219
|
+
"fill",
|
|
220
|
+
"stroke",
|
|
221
|
+
"stroke-width",
|
|
222
|
+
// Accessibility
|
|
223
|
+
"screen-readers",
|
|
224
|
+
// bg
|
|
225
|
+
"bg-attachment",
|
|
226
|
+
"bg-clip",
|
|
227
|
+
"bg-origin",
|
|
228
|
+
"bg-position",
|
|
229
|
+
"bg-repeat",
|
|
230
|
+
"bg-size",
|
|
231
|
+
"bg-linear",
|
|
232
|
+
"bg-radial",
|
|
233
|
+
];
|
|
234
|
+
//# sourceMappingURL=tailwind-property-keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tailwind-property-keys.js","sourceRoot":"","sources":["../../src/props/tailwind-property-keys.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,SAAS;IACT,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,WAAW;IACX,WAAW;IACX,WAAW;IACX,WAAW;CACH,CAAC;AAEX,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,cAAc;IACd,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,QAAQ;IACR,cAAc;IACd,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;CACR,CAAC;AAEX,6DAA6D;AAC7D,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,SAAS;IACT,SAAS;IACT,UAAU;IACV,KAAK;IACL,OAAO;IACP,QAAQ;IACR,MAAM;IACN,YAAY;IACZ,SAAS;IACT,UAAU;IACV,YAAY;IACZ,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+
/**
|
|
2
|
+
* Child process exit code that asks the `superblocks dev` parent supervisor to
|
|
3
|
+
* respawn the dev server in place (rather than letting the pod be swapped)
|
|
4
|
+
* after an in-place v2->v3 template flip, so the same pod boots the new
|
|
5
|
+
* template. The full exit-code contract is documented in
|
|
6
|
+
* `packages/cli/packages/cli/src/commands/dev-parent.mts`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const RESTART_EXIT_CODE = 98;
|
|
9
|
+
/**
|
|
10
|
+
* Env var the CLI parent sets on every supervised child it spawns. Its presence
|
|
11
|
+
* tells the dev-server runtime that a supervisor is watching for
|
|
12
|
+
* `RESTART_EXIT_CODE` and will respawn the child, so it is safe to self-restart
|
|
13
|
+
* in place after a template flip. Warm-claimed single-process pods have no
|
|
14
|
+
* parent loop and never see this marker, so they keep today's pod-swap behavior.
|
|
15
|
+
*/
|
|
16
|
+
export declare const RESTART_SUPERVISED_ENV = "SUPERBLOCKS_RESTART_SUPERVISED";
|
|
17
|
+
/**
|
|
18
|
+
* Env var the CLI parent stamps on a child it respawns *because the previous
|
|
19
|
+
* child exited with `RESTART_EXIT_CODE`* (an in-place v2->v3 template flip). The
|
|
20
|
+
* respawned dev-server reads it once at boot to tag its boot metric, so Datadog
|
|
21
|
+
* can tell a post-flip in-place restart apart from a normal cold start and prove
|
|
22
|
+
* the child actually booted after the flip. Absent on a first/cold boot.
|
|
23
|
+
*
|
|
24
|
+
* Canonically defined here; the builtins-only CLI parent
|
|
25
|
+
* (`restart-template-env.mts`) keeps a hand-written copy that the drift-guard
|
|
26
|
+
* test pins to this value. Keep the two in sync.
|
|
27
|
+
*/
|
|
28
|
+
export declare const RESTART_REASON_ENV = "SUPERBLOCKS_RESTART_REASON";
|
|
29
|
+
/**
|
|
30
|
+
* The only value the parent writes into `RESTART_REASON_ENV`: an in-place
|
|
31
|
+
* respawn after a template flip. Kept as a closed constant (not free-form text)
|
|
32
|
+
* so it can back a bounded, low-cardinality `boot_kind` metric label.
|
|
33
|
+
*/
|
|
34
|
+
export declare const RESTART_REASON_FLIP_RESTART = "flip_restart";
|
|
35
|
+
//# sourceMappingURL=restart-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restart-contract.d.ts","sourceRoot":"","sources":["../src/restart-contract.ts"],"names":[],"mappings":"AAeA;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,mCAAmC,CAAC;AAEvE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,+BAA+B,CAAC;AAE/D;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Canonical home for the in-place dev-server restart contract — the handshake
|
|
2
|
+
// between the dev-server runtime (which decides to restart and exits) and the
|
|
3
|
+
// `superblocks dev` parent supervisor (which respawns the child).
|
|
4
|
+
//
|
|
5
|
+
// This module intentionally has ZERO imports so it can be pulled in via the
|
|
6
|
+
// dedicated `@superblocksteam/library-shared/restart-contract` subpath without
|
|
7
|
+
// dragging the rest of library-shared's (heavy, frontend) runtime into the
|
|
8
|
+
// Node dev-server process.
|
|
9
|
+
//
|
|
10
|
+
// Two readers cannot import this module and keep their own annotated copies,
|
|
11
|
+
// because they run in the lightweight `superblocks dev` parent which must stay
|
|
12
|
+
// on `node:` builtins only (see dev-parent.mts): `RESTART_EXIT_CODE` in
|
|
13
|
+
// dev-parent.mts and `RESTART_SUPERVISED_ENV` in restart-template-env.mts. Those
|
|
14
|
+
// copies point back here as the source of truth; keep them in sync.
|
|
15
|
+
/**
|
|
16
|
+
* Child process exit code that asks the `superblocks dev` parent supervisor to
|
|
17
|
+
* respawn the dev server in place (rather than letting the pod be swapped)
|
|
18
|
+
* after an in-place v2->v3 template flip, so the same pod boots the new
|
|
19
|
+
* template. The full exit-code contract is documented in
|
|
20
|
+
* `packages/cli/packages/cli/src/commands/dev-parent.mts`.
|
|
21
|
+
*/
|
|
22
|
+
export const RESTART_EXIT_CODE = 98;
|
|
23
|
+
/**
|
|
24
|
+
* Env var the CLI parent sets on every supervised child it spawns. Its presence
|
|
25
|
+
* tells the dev-server runtime that a supervisor is watching for
|
|
26
|
+
* `RESTART_EXIT_CODE` and will respawn the child, so it is safe to self-restart
|
|
27
|
+
* in place after a template flip. Warm-claimed single-process pods have no
|
|
28
|
+
* parent loop and never see this marker, so they keep today's pod-swap behavior.
|
|
29
|
+
*/
|
|
30
|
+
export const RESTART_SUPERVISED_ENV = "SUPERBLOCKS_RESTART_SUPERVISED";
|
|
31
|
+
/**
|
|
32
|
+
* Env var the CLI parent stamps on a child it respawns *because the previous
|
|
33
|
+
* child exited with `RESTART_EXIT_CODE`* (an in-place v2->v3 template flip). The
|
|
34
|
+
* respawned dev-server reads it once at boot to tag its boot metric, so Datadog
|
|
35
|
+
* can tell a post-flip in-place restart apart from a normal cold start and prove
|
|
36
|
+
* the child actually booted after the flip. Absent on a first/cold boot.
|
|
37
|
+
*
|
|
38
|
+
* Canonically defined here; the builtins-only CLI parent
|
|
39
|
+
* (`restart-template-env.mts`) keeps a hand-written copy that the drift-guard
|
|
40
|
+
* test pins to this value. Keep the two in sync.
|
|
41
|
+
*/
|
|
42
|
+
export const RESTART_REASON_ENV = "SUPERBLOCKS_RESTART_REASON";
|
|
43
|
+
/**
|
|
44
|
+
* The only value the parent writes into `RESTART_REASON_ENV`: an in-place
|
|
45
|
+
* respawn after a template flip. Kept as a closed constant (not free-form text)
|
|
46
|
+
* so it can back a bounded, low-cardinality `boot_kind` metric label.
|
|
47
|
+
*/
|
|
48
|
+
export const RESTART_REASON_FLIP_RESTART = "flip_restart";
|
|
49
|
+
//# sourceMappingURL=restart-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restart-contract.js","sourceRoot":"","sources":["../src/restart-contract.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,8EAA8E;AAC9E,kEAAkE;AAClE,EAAE;AACF,4EAA4E;AAC5E,+EAA+E;AAC/E,2EAA2E;AAC3E,2BAA2B;AAC3B,EAAE;AACF,6EAA6E;AAC7E,+EAA+E;AAC/E,wEAAwE;AACxE,iFAAiF;AACjF,oEAAoE;AAEpE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAEpC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,gCAAgC,CAAC;AAEvE;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,4BAA4B,CAAC;AAE/D;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,cAAc,CAAC"}
|
package/dist/scope.d.ts
CHANGED
package/dist/scope.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../src/scope.ts"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,UAEjD"}
|
|
1
|
+
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../src/scope.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,UAEjD;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GACA,SAAS,CAC7E"}
|
package/dist/scope.js
CHANGED
|
@@ -2,4 +2,7 @@ import { generatePredictableId } from "@superblocksteam/shared";
|
|
|
2
2
|
export function getStableScopeId(scopeName) {
|
|
3
3
|
return generatePredictableId(`sc-${scopeName}`);
|
|
4
4
|
}
|
|
5
|
+
export function getStableEntityId(scopeId, entityName) {
|
|
6
|
+
return `SB-${generatePredictableId(scopeId + entityName)}-type`;
|
|
7
|
+
}
|
|
5
8
|
//# sourceMappingURL=scope.js.map
|
package/dist/scope.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../src/scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../src/scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAIhE,MAAM,UAAU,gBAAgB,CAAC,SAAiB;IAChD,OAAO,qBAAqB,CAAC,MAAM,SAAS,EAAE,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAAe,EAAE,UAAkB;IACnE,OAAO,MAAM,qBAAqB,CAAC,OAAO,GAAG,UAAU,CAAC,OAAoB,CAAC;AAC/E,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Node } from "../../pages.js";
|
|
2
|
+
import type { AppScope } from "../../types/scope.js";
|
|
3
|
+
/**
|
|
4
|
+
* The scope a freshly created app boots with: one empty page and an app root
|
|
5
|
+
* holding a bare Outlet.
|
|
6
|
+
*/
|
|
7
|
+
export declare function defaultStructureScope(pageChildren?: Node[]): AppScope;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/testing/default-structure-scope/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,GAAE,IAAI,EAAO,GAAG,QAAQ,CAwDzE"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The scope a freshly created app boots with: one empty page and an app root
|
|
3
|
+
* holding a bare Outlet.
|
|
4
|
+
*/
|
|
5
|
+
export function defaultStructureScope(pageChildren = []) {
|
|
6
|
+
return {
|
|
7
|
+
entities: {},
|
|
8
|
+
pages: {
|
|
9
|
+
Home: {
|
|
10
|
+
entities: {},
|
|
11
|
+
name: "Home",
|
|
12
|
+
roots: [
|
|
13
|
+
{
|
|
14
|
+
id: "page-root",
|
|
15
|
+
kind: "page",
|
|
16
|
+
name: "Home",
|
|
17
|
+
root: {
|
|
18
|
+
children: pageChildren,
|
|
19
|
+
id: "page",
|
|
20
|
+
name: "Home",
|
|
21
|
+
properties: {},
|
|
22
|
+
tagName: "div",
|
|
23
|
+
type: "WidgetNode",
|
|
24
|
+
},
|
|
25
|
+
type: "RootNode",
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
routes: ["/"],
|
|
29
|
+
scopeId: "home",
|
|
30
|
+
scopeName: "Home",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
roots: [
|
|
34
|
+
{
|
|
35
|
+
id: "app-root",
|
|
36
|
+
kind: "app",
|
|
37
|
+
name: "App",
|
|
38
|
+
root: {
|
|
39
|
+
children: [
|
|
40
|
+
{
|
|
41
|
+
children: [],
|
|
42
|
+
id: "outlet",
|
|
43
|
+
name: "Outlet",
|
|
44
|
+
properties: {},
|
|
45
|
+
tagName: "Outlet",
|
|
46
|
+
type: "WidgetNode",
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
id: "app",
|
|
50
|
+
name: "App",
|
|
51
|
+
properties: {},
|
|
52
|
+
tagName: "div",
|
|
53
|
+
type: "WidgetNode",
|
|
54
|
+
},
|
|
55
|
+
type: "RootNode",
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
scopeId: "app",
|
|
59
|
+
scopeName: "App",
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/testing/default-structure-scope/index.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3
|
+
* Lifecycle of the fake app artifact behind draft accept/reject:
|
|
4
|
+
* `pending` (Clark finished a turn and left a draft), `unpublished`
|
|
5
|
+
* (the draft was accepted into a checkpoint), `published` (no draft;
|
|
6
|
+
* the editor shows the last published state).
|
|
7
|
+
*/
|
|
8
|
+
export type FakeArtifactState = "pending" | "unpublished" | "published";
|
|
9
|
+
type DraftDecisionHandlers = {
|
|
10
|
+
aiAcceptDraft: ServerMethods["editor"]["aiAcceptDraft"];
|
|
11
|
+
aiRejectDraft: ServerMethods["editor"]["aiRejectDraft"];
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* In-memory stand-in for the app artifact that draft accept/reject
|
|
15
|
+
* operates on, per the Versions UX row of the Editor UX Surfaces
|
|
16
|
+
* testability table: state toggles pending -> unpublished on accept and
|
|
17
|
+
* pending -> published on reject, readable by tests via `state`.
|
|
18
|
+
*
|
|
19
|
+
* The channel stays strict: spread `handlers` into the
|
|
20
|
+
* `FakeEditorChannel` constructor's `serverHandlers` to bind the draft
|
|
21
|
+
* decision methods, e.g.
|
|
22
|
+
* `new FakeEditorChannel({ serverHandlers: { ...artifact.handlers } })`.
|
|
23
|
+
* Accept on a non-pending artifact rejects, so a test that double-fires
|
|
24
|
+
* accept fails loudly instead of minting a second commit id.
|
|
25
|
+
*/
|
|
26
|
+
export declare class FakeArtifact {
|
|
27
|
+
private nextCommitId;
|
|
28
|
+
private stateValue;
|
|
29
|
+
constructor(initialState?: FakeArtifactState);
|
|
30
|
+
get state(): FakeArtifactState;
|
|
31
|
+
/**
|
|
32
|
+
* Models the out-of-band event of Clark finishing a turn with file
|
|
33
|
+
* changes: draft creation is not a wire method on this channel, so
|
|
34
|
+
* tests stage a new draft here. Besides the constructor's
|
|
35
|
+
* initialState, this is the only way to reach `pending`.
|
|
36
|
+
*/
|
|
37
|
+
stageDraft(): void;
|
|
38
|
+
readonly handlers: DraftDecisionHandlers;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=fake-artifact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fake-artifact.d.ts","sourceRoot":"","sources":["../../../src/testing/fake-editor-channel/fake-artifact.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,aAAa,GAAG,WAAW,CAAC;AAExE,KAAK,qBAAqB,GAAG;IAC3B,aAAa,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,eAAe,CAAC,CAAC;IACxD,aAAa,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,eAAe,CAAC,CAAC;CACzD,CAAC;AAuBF;;;;;;;;;;;;GAYG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,UAAU,CAAoB;gBAE1B,YAAY,GAAE,iBAA+B;IAIzD,IAAI,KAAK,IAAI,iBAAiB,CAE7B;IAED;;;;;OAKG;IACH,UAAU,IAAI,IAAI;IAIlB,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,CAsBtC;CACH"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A real remote handler failure never reaches the caller as an Error
|
|
3
|
+
* instance: the socket serializes it to `{ code, message, stack }` with
|
|
4
|
+
* code 3, and the caller's promise rejects with that parsed plain
|
|
5
|
+
* object. Reject with the same shape so tests see production semantics.
|
|
6
|
+
*
|
|
7
|
+
* Distinct from the channel's remoteHandlerError on purpose: that helper
|
|
8
|
+
* models a thrown SocketErrorException, whose message crosses verbatim,
|
|
9
|
+
* while this models a handler throwing a plain Error, which the socket
|
|
10
|
+
* stringifies to an "Error: "-prefixed message. Production produces both
|
|
11
|
+
* shapes, one per path.
|
|
12
|
+
*/
|
|
13
|
+
const remoteFailure = (message) => {
|
|
14
|
+
const error = new Error(message);
|
|
15
|
+
return Promise.reject({
|
|
16
|
+
code: 3,
|
|
17
|
+
message: error.toString(),
|
|
18
|
+
stack: error.stack,
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* In-memory stand-in for the app artifact that draft accept/reject
|
|
23
|
+
* operates on, per the Versions UX row of the Editor UX Surfaces
|
|
24
|
+
* testability table: state toggles pending -> unpublished on accept and
|
|
25
|
+
* pending -> published on reject, readable by tests via `state`.
|
|
26
|
+
*
|
|
27
|
+
* The channel stays strict: spread `handlers` into the
|
|
28
|
+
* `FakeEditorChannel` constructor's `serverHandlers` to bind the draft
|
|
29
|
+
* decision methods, e.g.
|
|
30
|
+
* `new FakeEditorChannel({ serverHandlers: { ...artifact.handlers } })`.
|
|
31
|
+
* Accept on a non-pending artifact rejects, so a test that double-fires
|
|
32
|
+
* accept fails loudly instead of minting a second commit id.
|
|
33
|
+
*/
|
|
34
|
+
export class FakeArtifact {
|
|
35
|
+
nextCommitId = 1;
|
|
36
|
+
stateValue;
|
|
37
|
+
constructor(initialState = "published") {
|
|
38
|
+
this.stateValue = initialState;
|
|
39
|
+
}
|
|
40
|
+
get state() {
|
|
41
|
+
return this.stateValue;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Models the out-of-band event of Clark finishing a turn with file
|
|
45
|
+
* changes: draft creation is not a wire method on this channel, so
|
|
46
|
+
* tests stage a new draft here. Besides the constructor's
|
|
47
|
+
* initialState, this is the only way to reach `pending`.
|
|
48
|
+
*/
|
|
49
|
+
stageDraft() {
|
|
50
|
+
this.stateValue = "pending";
|
|
51
|
+
}
|
|
52
|
+
handlers = {
|
|
53
|
+
aiAcceptDraft: async () => {
|
|
54
|
+
if (this.stateValue !== "pending") {
|
|
55
|
+
return remoteFailure(`Fake artifact has no pending draft to accept (state: ${this.stateValue})`);
|
|
56
|
+
}
|
|
57
|
+
this.stateValue = "unpublished";
|
|
58
|
+
const commitId = `fake-commit-${this.nextCommitId}`;
|
|
59
|
+
this.nextCommitId += 1;
|
|
60
|
+
return { commitId };
|
|
61
|
+
},
|
|
62
|
+
// The editor's restore flow fires aiRejectDraft as cleanup even when
|
|
63
|
+
// no draft is pending, so a non-pending reject resolves as a no-op
|
|
64
|
+
// instead of throwing. Only pending -> published is a real discard;
|
|
65
|
+
// leaving other states untouched keeps a discard-after-accept bug
|
|
66
|
+
// visible to tests instead of masking it as "published".
|
|
67
|
+
aiRejectDraft: async () => {
|
|
68
|
+
if (this.stateValue === "pending") {
|
|
69
|
+
this.stateValue = "published";
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=fake-artifact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fake-artifact.js","sourceRoot":"","sources":["../../../src/testing/fake-editor-channel/fake-artifact.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;GAWG;AACH,MAAM,aAAa,GAAG,CAAC,OAAe,EAAE,EAAE;IACxC,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IACjC,OAAO,OAAO,CAAC,MAAM,CAAC;QACpB,IAAI,EAAE,CAAC;QACP,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE;QACzB,KAAK,EAAE,KAAK,CAAC,KAAK;KACnB,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,YAAY;IACf,YAAY,GAAG,CAAC,CAAC;IACjB,UAAU,CAAoB;IAEtC,YAAY,eAAkC,WAAW;QACvD,IAAI,CAAC,UAAU,GAAG,YAAY,CAAC;IACjC,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;;;;OAKG;IACH,UAAU;QACR,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC9B,CAAC;IAEQ,QAAQ,GAA0B;QACzC,aAAa,EAAE,KAAK,IAAI,EAAE;YACxB,IAAI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