@valbuild/shared 0.152.0 → 0.153.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.
@@ -10,7 +10,7 @@ var wrapNativeSuper = require('../../dist/wrapNativeSuper-8673414f.cjs.prod.js')
10
10
  var zodValidationError = require('zod-validation-error');
11
11
  var fp = require('@valbuild/core/fp');
12
12
  var patch = require('@valbuild/core/patch');
13
- var getSitemapTree = require('../../dist/getSitemapTree-6b9024d1.cjs.prod.js');
13
+ var getSitemapTree = require('../../dist/getSitemapTree-a4738117.cjs.prod.js');
14
14
  var FlexSearch = require('flexsearch');
15
15
  var utils = require('../../dist/utils-32bcaca2.cjs.prod.js');
16
16
 
@@ -1879,6 +1879,70 @@ var SketchErrorZ = zod.z.object({
1879
1879
  });
1880
1880
  /** The most text a sketchpad holds, in UTF-8 bytes: a page, not a site. */
1881
1881
  var SKETCHPAD_MAX_TEXT_LENGTH = 256 * 1024;
1882
+
1883
+ /**
1884
+ * A manifest as the server answers it: what each module IS on the server
1885
+ * (`GET /manifest`, and the same answer on `/stat` when the Studio asks for it
1886
+ * there -- one function on the server answers both, `manifestAnswer`).
1887
+ */
1888
+ var ManifestJson = zod.z.object({
1889
+ project: ProjectVersionSchema,
1890
+ modules: zod.z.record(ModuleFilePath, ModuleVersionSchema),
1891
+ /** This answer's ETag, as the header has it. */
1892
+ tag: zod.z.string().optional(),
1893
+ /**
1894
+ * Present on a delta only: the `seq` of the manifest it is
1895
+ * relative to, whose modules that are not named here did not
1896
+ * move. Absent: every module is named.
1897
+ */
1898
+ since: zod.z.number().optional(),
1899
+ /**
1900
+ * The build that answered is a previous build still answering
1901
+ * (http mode: the content service counted a newer one live).
1902
+ * Its versions are right for its own bases, which the site does
1903
+ * not serve any more: a Studio does not move to them, and asks
1904
+ * again. Optional: absent from a live build and a server of the
1905
+ * release before.
1906
+ */
1907
+ superseded: zod.z["boolean"]().optional(),
1908
+ /**
1909
+ * The answering build's `val.modules` registry, as an entry a
1910
+ * Studio can import (`valModulesEntryPath`), and the Val it
1911
+ * runs: where a Studio opened on another build takes this
1912
+ * build's code in without reloading the page. Only a build the
1913
+ * platform made and names (`publishBuild`) has one. Optional
1914
+ * both ways: absent from any other server (local development,
1915
+ * where HMR brings the code; a self-hosted deploy) and from a
1916
+ * server of the release before, and ignored by a Studio of the
1917
+ * release before.
1918
+ */
1919
+ registry: zod.z.object({
1920
+ entry: zod.z.string(),
1921
+ core: zod.z.string()
1922
+ }).optional()
1923
+ });
1924
+ /**
1925
+ * The manifest a `/stat` answer carries, when the request said which one the
1926
+ * Studio holds (`manifest` on the request): what `GET /manifest` would have
1927
+ * answered for it, so another editor's keystroke costs no manifest request.
1928
+ *
1929
+ * - A manifest, whole or a delta. A delta names the ETag it is relative to
1930
+ * (`sinceTag`): a Studio uses it only while it holds exactly that one.
1931
+ * - `unchanged`: the manifest the request named, at `seq`, is still the
1932
+ * one for this answer's `seq`. Decided by `seq` alone, and not read: a
1933
+ * Studio reads a manifest only for a stat whose `seq` moved. It keeps the
1934
+ * next request naming the same manifest.
1935
+ *
1936
+ * Optional: absent from a server of the release before, and from an answer
1937
+ * to a request that did not ask, and then the Studio reads `GET /manifest`.
1938
+ */
1939
+ var StatManifest = zod.z.union([ManifestJson.extend({
1940
+ sinceTag: zod.z.string().optional()
1941
+ }), zod.z.object({
1942
+ unchanged: zod.z.literal(true),
1943
+ tag: zod.z.string(),
1944
+ seq: zod.z.number()
1945
+ })]);
1882
1946
  var Api = {
1883
1947
  "/draft/enable": {
1884
1948
  GET: {
@@ -2265,42 +2329,7 @@ var Api = {
2265
2329
  json: GenericError
2266
2330
  }), zod.z.object({
2267
2331
  status: zod.z.literal(200),
2268
- json: zod.z.object({
2269
- project: ProjectVersionSchema,
2270
- modules: zod.z.record(ModuleFilePath, ModuleVersionSchema),
2271
- /** This answer's ETag, as the header has it. */
2272
- tag: zod.z.string().optional(),
2273
- /**
2274
- * Present on a delta only: the `seq` of the manifest it is
2275
- * relative to, whose modules that are not named here did not
2276
- * move. Absent: every module is named.
2277
- */
2278
- since: zod.z.number().optional(),
2279
- /**
2280
- * The build that answered is a previous build still answering
2281
- * (http mode: the content service counted a newer one live).
2282
- * Its versions are right for its own bases, which the site does
2283
- * not serve any more: a Studio does not move to them, and asks
2284
- * again. Optional: absent from a live build and a server of the
2285
- * release before.
2286
- */
2287
- superseded: zod.z["boolean"]().optional(),
2288
- /**
2289
- * The answering build's `val.modules` registry, as an entry a
2290
- * Studio can import (`valModulesEntryPath`), and the Val it
2291
- * runs: where a Studio opened on another build takes this
2292
- * build's code in without reloading the page. Only a build the
2293
- * platform made and names (`publishBuild`) has one. Optional
2294
- * both ways: absent from any other server (local development,
2295
- * where HMR brings the code; a self-hosted deploy) and from a
2296
- * server of the release before, and ignored by a Studio of the
2297
- * release before.
2298
- */
2299
- registry: zod.z.object({
2300
- entry: zod.z.string(),
2301
- core: zod.z.string()
2302
- }).optional()
2303
- })
2332
+ json: ManifestJson
2304
2333
  }),
2305
2334
  /*
2306
2335
  * Nothing moved since the ETag the client sent. No body on the wire;
@@ -2317,23 +2346,24 @@ var Api = {
2317
2346
  req: {
2318
2347
  body: zod.z.object({
2319
2348
  /**
2320
- * @deprecated Echoed by the Studio, and compared by the fs and
2321
- * memory long poll to see that another build answers. This
2322
- * release's Studio reads each module's version from
2323
- * `GET /manifest`; goes once the long poll compares the echoed
2324
- * version instead (see "Release-delayed deletions" in
2349
+ * @deprecated Echoed by a Studio of the release that shipped the
2350
+ * one content model, whose fs and memory long poll compared it to
2351
+ * see another build; a Studio of the release after echoes
2352
+ * {@link version} instead, and this only when it was sent. The
2353
+ * request field goes once no Studio sends it (see
2354
+ * "Release-delayed deletions" in
2325
2355
  * `docs/plans/one-content-model.md`).
2326
2356
  */
2327
- sourcesSha: zod.z.string(),
2357
+ sourcesSha: zod.z.string().optional(),
2358
+ /** @deprecated As `sourcesSha`. */
2359
+ schemaSha: zod.z.string().optional(),
2328
2360
  /**
2329
- * @deprecated Echoed by the Studio, and compared by the fs and
2330
- * memory long poll to see that another build answers. This
2331
- * release's Studio reads each module's version from
2332
- * `GET /manifest`; goes once the long poll compares the echoed
2333
- * version instead (see "Release-delayed deletions" in
2334
- * `docs/plans/one-content-model.md`).
2361
+ * The `version` the last answer carried: what the fs and memory
2362
+ * long poll compare to see another build (the build the chain is
2363
+ * relative to, `ValOps.chainBuild`). Optional: a Studio of the
2364
+ * release before echoes the shas.
2335
2365
  */
2336
- schemaSha: zod.z.string(),
2366
+ version: ProjectVersionSchema.optional(),
2337
2367
  baseSha: zod.z.string(),
2338
2368
  patches: zod.z.array(zod.z.string()).optional(),
2339
2369
  /**
@@ -2342,7 +2372,17 @@ var Api = {
2342
2372
  * jsonValues module's source is markers and the content sits behind a
2343
2373
  * thunk that `JSON.stringify` drops.
2344
2374
  */
2345
- jsonEntriesSha: zod.z.string().optional()
2375
+ jsonEntriesSha: zod.z.string().optional(),
2376
+ /**
2377
+ * The manifest the Studio holds, by its ETag and `seq`, so the
2378
+ * answer can carry what moved since (`manifest` on the answer):
2379
+ * `null` when it holds none and can take one. Absent from a
2380
+ * Studio of the release before, which reads `GET /manifest`.
2381
+ */
2382
+ manifest: zod.z.object({
2383
+ tag: zod.z.string(),
2384
+ seq: zod.z.number()
2385
+ }).nullable().optional()
2346
2386
  }).nullable(),
2347
2387
  cookies: {
2348
2388
  val_session: zod.z.string().optional()
@@ -2363,21 +2403,16 @@ var Api = {
2363
2403
  type: zod.z.union([zod.z.literal("request-again"), zod.z.literal("no-change"), zod.z.literal("did-change")]),
2364
2404
  baseSha: zod.z.string(),
2365
2405
  /**
2366
- * @deprecated Read by a Studio of the release before
2367
- * (`BaseAlignment`, `SchemaFreshnessWatch`); this release's
2368
- * only echoes it, and reads each module's version from
2369
- * `GET /manifest`. Goes in two steps (see "Release-delayed
2370
- * deletions" in `docs/plans/one-content-model.md`).
2371
- */
2372
- schemaSha: zod.z.string(),
2373
- /**
2374
- * @deprecated Read by a Studio of the release before
2375
- * (`BaseAlignment`, `SchemaFreshnessWatch`); this release's
2376
- * only echoes it, and reads each module's version from
2377
- * `GET /manifest`. Goes in two steps (see "Release-delayed
2378
- * deletions" in `docs/plans/one-content-model.md`).
2406
+ * @deprecated Still sent, for a Studio of the release that
2407
+ * shipped the one content model, which echoes it; a Studio of
2408
+ * the release after reads it as optional and echoes `version`.
2409
+ * The server stops sending it in the release after that (see
2410
+ * "Release-delayed deletions" in
2411
+ * `docs/plans/one-content-model.md`).
2379
2412
  */
2380
- sourcesSha: zod.z.string(),
2413
+ schemaSha: zod.z.string().optional(),
2414
+ /** @deprecated As `schemaSha`. */
2415
+ sourcesSha: zod.z.string().optional(),
2381
2416
  patches: zod.z.array(PatchId),
2382
2417
  /**
2383
2418
  * Of `patches`, the ones that have already SHIPPED.
@@ -2481,28 +2516,25 @@ var Api = {
2481
2516
  * answers, the higher `seq` is the newer. Optional: a server
2482
2517
  * that predates versions sends none.
2483
2518
  */
2484
- version: ProjectVersionSchema.optional()
2519
+ version: ProjectVersionSchema.optional(),
2520
+ /** See {@link StatManifest}. */
2521
+ manifest: StatManifest.optional()
2485
2522
  }), zod.z.object({
2486
2523
  type: zod.z.literal("use-websocket"),
2487
2524
  url: zod.z.string(),
2488
2525
  nonce: zod.z.string(),
2489
2526
  baseSha: zod.z.string(),
2490
2527
  /**
2491
- * @deprecated Read by a Studio of the release before
2492
- * (`BaseAlignment`, `SchemaFreshnessWatch`); this release's
2493
- * only echoes it, and reads each module's version from
2494
- * `GET /manifest`. Goes in two steps (see "Release-delayed
2495
- * deletions" in `docs/plans/one-content-model.md`).
2496
- */
2497
- schemaSha: zod.z.string(),
2498
- /**
2499
- * @deprecated Read by a Studio of the release before
2500
- * (`BaseAlignment`, `SchemaFreshnessWatch`); this release's
2501
- * only echoes it, and reads each module's version from
2502
- * `GET /manifest`. Goes in two steps (see "Release-delayed
2503
- * deletions" in `docs/plans/one-content-model.md`).
2528
+ * @deprecated Still sent, for a Studio of the release that
2529
+ * shipped the one content model, which echoes it; a Studio of
2530
+ * the release after reads it as optional and echoes `version`.
2531
+ * The server stops sending it in the release after that (see
2532
+ * "Release-delayed deletions" in
2533
+ * `docs/plans/one-content-model.md`).
2504
2534
  */
2505
- sourcesSha: zod.z.string(),
2535
+ schemaSha: zod.z.string().optional(),
2536
+ /** @deprecated As `schemaSha`. */
2537
+ sourcesSha: zod.z.string().optional(),
2506
2538
  /**
2507
2539
  * The commit this deployment was built from.
2508
2540
  *
@@ -2630,7 +2662,9 @@ var Api = {
2630
2662
  * answers, the higher `seq` is the newer. Optional: a server
2631
2663
  * that predates versions sends none.
2632
2664
  */
2633
- version: ProjectVersionSchema.optional()
2665
+ version: ProjectVersionSchema.optional(),
2666
+ /** See {@link StatManifest}. */
2667
+ manifest: StatManifest.optional()
2634
2668
  })])
2635
2669
  })])
2636
2670
  }
@@ -3195,81 +3229,6 @@ var Api = {
3195
3229
  })])
3196
3230
  }
3197
3231
  },
3198
- /**
3199
- * @deprecated The whole tree. Nothing of this release asks it: the Studio
3200
- * reads modules by version (`GET /manifest`, `GET /modules/~`), the draft
3201
- * readers and MCP read the head in-process. Kept, with `exclude_patches`
3202
- * (`BaseAlignment`'s fetch) and the ignored `validate_sources` and
3203
- * `validate_binary_files`, for a Studio of the release before; goes in the
3204
- * release after the one that ships this (see "Release-delayed deletions"
3205
- * in `docs/plans/one-content-model.md`).
3206
- */
3207
- "/sources/~": {
3208
- PUT: {
3209
- req: {
3210
- path: zod.z.string().optional(),
3211
- query: {
3212
- validate_sources: onlyOneBooleanQueryParam.optional(),
3213
- validate_binary_files: onlyOneBooleanQueryParam.optional(),
3214
- exclude_patches: onlyOneBooleanQueryParam.optional(),
3215
- apply_patches: onlyOneBooleanQueryParam.optional()
3216
- },
3217
- cookies: {
3218
- val_session: zod.z.string().optional()
3219
- }
3220
- },
3221
- res: zod.z.union([unauthorizedResponse, zod.z.object({
3222
- status: zod.z.literal(401),
3223
- json: GenericError
3224
- }), zod.z.object({
3225
- status: zod.z.literal(500),
3226
- json: zod.z.object({
3227
- message: zod.z.string(),
3228
- details: zod.z.union([zod.z.array(ModulesError), GenericError])
3229
- })
3230
- }), zod.z.object({
3231
- status: zod.z.literal(409),
3232
- json: zod.z.object({
3233
- message: zod.z.string()
3234
- })
3235
- }), zod.z.object({
3236
- status: zod.z.literal(400),
3237
- json: zod.z.object({
3238
- message: zod.z.string(),
3239
- details: zod.z.array(ModulesError)
3240
- })
3241
- }), zod.z.object({
3242
- status: zod.z.literal(200),
3243
- json: zod.z.object({
3244
- schemaSha: zod.z.string(),
3245
- sourcesSha: zod.z.string(),
3246
- modules: zod.z.record(ModuleFilePath, zod.z.object({
3247
- preview: zod.z.any().optional(),
3248
- // TODO: improve this type
3249
- source: zod.z.any().optional(),
3250
- //.optional(), // TODO: Json zod type
3251
- baseSource: zod.z.any().optional(),
3252
- // pre-patch source for compare view; only set when the server applies patches (apply_patches=true) and the module has pending patches
3253
- patches: zod.z.object({
3254
- applied: zod.z.array(PatchId),
3255
- skipped: zod.z.array(PatchId).optional(),
3256
- errors: zod.z.record(PatchId, GenericError).optional()
3257
- }).optional(),
3258
- validationErrors: zod.z.record(zod.z.string(), zod.z.array(ValidationError)).optional(),
3259
- /**
3260
- * The version of `source` as answered: with the chain the
3261
- * server applied, or the empty chain when it applied none
3262
- * (`apply_patches=false`). Optional: an older server sends
3263
- * none.
3264
- */
3265
- version: ModuleVersionSchema.optional()
3266
- })),
3267
- /** The project version this tree was read at. See `/stat`. */
3268
- project: ProjectVersionSchema.optional()
3269
- })
3270
- })])
3271
- }
3272
- },
3273
3232
  /**
3274
3233
  * One module by version: phase 6 of `docs/plans/one-content-model.md`
3275
3234
  * ("The Studio loads everything from one place"). `GET /modules/~<path>`,
@@ -11885,7 +11844,7 @@ exports.getPageRouterSitemapTree = getSitemapTree.getPageRouterSitemapTree;
11885
11844
  exports.getPageRouterSourceFolder = getSitemapTree.getPageRouterSourceFolder;
11886
11845
  exports.getPatternFromModuleFilePath = getSitemapTree.getPatternFromModuleFilePath;
11887
11846
  exports.getTanStackRouterSourceFolder = getSitemapTree.getTanStackRouterSourceFolder;
11888
- exports.isDesignTabOrigin = getSitemapTree.isDesignTabOrigin;
11847
+ exports.isCanvasSelectionColor = getSitemapTree.isCanvasSelectionColor;
11889
11848
  exports.isQuickPreviewFiles = getSitemapTree.isQuickPreviewFiles;
11890
11849
  exports.isTanStackRoutesFolder = getSitemapTree.isTanStackRoutesFolder;
11891
11850
  exports.isValCanvasFrame = getSitemapTree.isValCanvasFrame;
@@ -11894,7 +11853,6 @@ exports.isValCanvasStudioMessage = getSitemapTree.isValCanvasStudioMessage;
11894
11853
  exports.modifierLabel = getSitemapTree.modifierLabel;
11895
11854
  exports.pageLocationOf = getSitemapTree.pageLocationOf;
11896
11855
  exports.parseRoutePattern = getSitemapTree.parseRoutePattern;
11897
- exports.quickPreviewSiteOrigin = getSitemapTree.quickPreviewSiteOrigin;
11898
11856
  exports.readPageSnapshot = getSitemapTree.readPageSnapshot;
11899
11857
  exports.restoreScroll = getSitemapTree.restoreScroll;
11900
11858
  exports.screenshotPage = getSitemapTree.screenshotPage;
@@ -11930,6 +11888,7 @@ exports.JSONValue = JSONValue;
11930
11888
  exports.JSON_ENTRIES_BATCH_MAX = JSON_ENTRIES_BATCH_MAX;
11931
11889
  exports.LOCAL_FILE_IN_REMOTE_PROJECT_HINT = LOCAL_FILE_IN_REMOTE_PROJECT_HINT;
11932
11890
  exports.LOCAL_FILE_IN_REMOTE_PROJECT_WARNING = LOCAL_FILE_IN_REMOTE_PROJECT_WARNING;
11891
+ exports.ManifestJson = ManifestJson;
11933
11892
  exports.ModuleComparison = ModuleComparison;
11934
11893
  exports.ModuleVersionSchema = ModuleVersionSchema;
11935
11894
  exports.NEVER_ENCODED = NEVER_ENCODED;
@@ -11987,6 +11946,7 @@ exports.SerializedVideoSchema = SerializedVideoSchema;
11987
11946
  exports.SharedValConfig = SharedValConfig;
11988
11947
  exports.Sketchpad = Sketchpad;
11989
11948
  exports.SketchpadSummary = SketchpadSummary;
11949
+ exports.StatManifest = StatManifest;
11990
11950
  exports.VAL_CLIENT_HEADER = VAL_CLIENT_HEADER;
11991
11951
  exports.VAL_ENABLE_COOKIE_NAME = VAL_ENABLE_COOKIE_NAME;
11992
11952
  exports.VAL_GREEN_RAMP = VAL_GREEN_RAMP;