@spacefast/common 0.0.13 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/dist/agents/client-registry.d.ts +22 -0
  2. package/dist/agents/client-registry.js +41 -0
  3. package/dist/agents/connect-targets.d.ts +51 -6
  4. package/dist/agents/connect-targets.js +93 -28
  5. package/dist/brand.d.ts +0 -11
  6. package/dist/brand.js +0 -20
  7. package/dist/config/domains.d.ts +15 -6
  8. package/dist/config/domains.js +24 -10
  9. package/dist/config/postgres-budget.d.ts +3 -0
  10. package/dist/config/postgres-budget.js +6 -1
  11. package/dist/config/postgres-budget.json +2 -1
  12. package/dist/contracts/abuse.js +1 -1
  13. package/dist/contracts/access.d.ts +149 -44
  14. package/dist/contracts/access.js +94 -8
  15. package/dist/contracts/activity.js +5 -1
  16. package/dist/contracts/api-keys.js +9 -9
  17. package/dist/contracts/archives.js +11 -11
  18. package/dist/contracts/beta.js +1 -1
  19. package/dist/contracts/builds.js +14 -14
  20. package/dist/contracts/channels.js +2 -2
  21. package/dist/contracts/comments.d.ts +86 -15
  22. package/dist/contracts/comments.js +116 -20
  23. package/dist/contracts/common.d.ts +12 -12
  24. package/dist/contracts/common.js +33 -30
  25. package/dist/contracts/continuation.js +5 -5
  26. package/dist/contracts/data-source-routes.js +1 -1
  27. package/dist/contracts/device-auth.d.ts +6 -6
  28. package/dist/contracts/device-auth.js +12 -12
  29. package/dist/contracts/docs.d.ts +10 -10
  30. package/dist/contracts/domains.js +39 -33
  31. package/dist/contracts/enums.d.ts +2 -10
  32. package/dist/contracts/enums.js +0 -2
  33. package/dist/contracts/error-code-meta.d.ts +116 -47
  34. package/dist/contracts/error-code-meta.js +37 -16
  35. package/dist/contracts/error-codes.d.ts +7 -4
  36. package/dist/contracts/error-codes.js +46 -21
  37. package/dist/contracts/events.d.ts +10 -3
  38. package/dist/contracts/events.js +33 -5
  39. package/dist/contracts/execution.d.ts +26 -0
  40. package/dist/contracts/execution.js +21 -0
  41. package/dist/contracts/feature-lifecycle.d.ts +21 -24
  42. package/dist/contracts/feature-lifecycle.js +28 -26
  43. package/dist/contracts/features.js +4 -4
  44. package/dist/contracts/functions.d.ts +8 -140
  45. package/dist/contracts/functions.js +9 -19
  46. package/dist/contracts/git.d.ts +1 -1
  47. package/dist/contracts/grants.d.ts +96 -79
  48. package/dist/contracts/grants.js +130 -43
  49. package/dist/contracts/ids.d.ts +2 -2
  50. package/dist/contracts/ids.js +2 -4
  51. package/dist/contracts/internal.js +2 -2
  52. package/dist/contracts/mcp.d.ts +17 -556
  53. package/dist/contracts/mcp.js +9 -103
  54. package/dist/contracts/me.js +3 -4
  55. package/dist/contracts/notifications.d.ts +108 -0
  56. package/dist/contracts/notifications.js +54 -0
  57. package/dist/contracts/oauth-resources.d.ts +18 -1
  58. package/dist/contracts/oauth-resources.js +22 -2
  59. package/dist/contracts/operations.d.ts +2 -50
  60. package/dist/contracts/operations.js +0 -19
  61. package/dist/contracts/pages.d.ts +8 -4
  62. package/dist/contracts/pages.js +16 -3
  63. package/dist/contracts/platform.js +10 -8
  64. package/dist/contracts/problem-document.d.ts +14 -0
  65. package/dist/contracts/problem-document.js +35 -0
  66. package/dist/contracts/push-new.d.ts +21 -6
  67. package/dist/contracts/push-new.js +3 -7
  68. package/dist/contracts/resources.d.ts +8 -7
  69. package/dist/contracts/resources.js +9 -6
  70. package/dist/contracts/runtime-api.d.ts +162 -92
  71. package/dist/contracts/runtime-api.js +99 -27
  72. package/dist/contracts/runtime-app.d.ts +41 -11
  73. package/dist/contracts/runtime-app.js +22 -1
  74. package/dist/contracts/runtime-db.d.ts +424 -0
  75. package/dist/contracts/runtime-db.js +108 -0
  76. package/dist/contracts/runtime-storage.d.ts +120 -0
  77. package/dist/contracts/runtime-storage.js +40 -0
  78. package/dist/contracts/sf-config-v1.d.ts +49 -1
  79. package/dist/contracts/sf-config-v1.js +2 -2
  80. package/dist/contracts/sites.d.ts +1 -0
  81. package/dist/contracts/sites.js +20 -12
  82. package/dist/contracts/space-config.d.ts +62 -22
  83. package/dist/contracts/space-config.js +173 -47
  84. package/dist/contracts/spaces.d.ts +79 -45
  85. package/dist/contracts/spaces.js +66 -50
  86. package/dist/contracts/superadmin-spaces.d.ts +13 -2
  87. package/dist/contracts/superadmin-spaces.js +15 -0
  88. package/dist/contracts/superadmin-tenants.js +4 -4
  89. package/dist/contracts/superadmin.d.ts +4 -0
  90. package/dist/contracts/superadmin.js +14 -1
  91. package/dist/contracts/tags.d.ts +17 -17
  92. package/dist/contracts/tags.js +1 -1
  93. package/dist/contracts/teams.js +25 -16
  94. package/dist/contracts/theme-json.js +1 -1
  95. package/dist/contracts/transfers.js +4 -4
  96. package/dist/contracts/variables.js +3 -3
  97. package/dist/contracts/zero.d.ts +204 -338
  98. package/dist/contracts/zero.js +94 -98
  99. package/dist/dashboard-paths/index.d.ts +16 -1
  100. package/dist/dashboard-paths/index.js +18 -0
  101. package/dist/docs/agent-handoff-document.d.ts +2 -2
  102. package/dist/docs/agent-handoff-document.js +8 -7
  103. package/dist/docs/agent-prose.d.ts +22 -3
  104. package/dist/docs/agent-prose.js +221 -51
  105. package/dist/docs/agent-setup.d.ts +13 -10
  106. package/dist/docs/agent-setup.js +279 -53
  107. package/dist/docs/agent-solutions.d.ts +6 -6
  108. package/dist/docs/agent-solutions.js +23 -21
  109. package/dist/docs/catalog.d.ts +29 -74
  110. package/dist/docs/catalog.js +65 -92
  111. package/dist/docs/error-docs.js +293 -221
  112. package/dist/docs/skill-distribution.d.ts +2 -0
  113. package/dist/docs/skill-distribution.js +7 -4
  114. package/dist/docs/skills.d.ts +546 -0
  115. package/dist/docs/skills.js +340 -0
  116. package/dist/utils/browser-credential.d.ts +19 -0
  117. package/dist/utils/browser-credential.js +62 -0
  118. package/dist/utils/comment-avatars.d.ts +7 -0
  119. package/dist/utils/comment-avatars.js +42 -0
  120. package/dist/utils/content-type.d.ts +3 -3
  121. package/dist/utils/content-type.js +38 -61
  122. package/dist/utils/domain-diagnostics.d.ts +5 -5
  123. package/dist/utils/domain-diagnostics.js +21 -10
  124. package/dist/utils/local-space-state.d.ts +78 -4
  125. package/dist/utils/local-space-state.js +383 -82
  126. package/dist/utils/one-shot-replay.d.ts +14 -0
  127. package/dist/utils/one-shot-replay.js +21 -0
  128. package/dist/utils/page-preview.d.ts +7 -0
  129. package/dist/utils/page-preview.js +9 -0
  130. package/dist/utils/pages.d.ts +2 -11
  131. package/dist/utils/pages.js +58 -14
  132. package/dist/utils/publish-form-data.d.ts +22 -0
  133. package/dist/utils/publish-form-data.js +26 -0
  134. package/dist/utils/publish-policy.js +20 -4
  135. package/dist/utils/query-keys.d.ts +7 -4
  136. package/dist/utils/query-keys.js +13 -4
  137. package/dist/utils/runtime-paths.d.ts +3 -0
  138. package/dist/utils/runtime-paths.js +7 -0
  139. package/dist/utils/secure-local-file.d.ts +73 -0
  140. package/dist/utils/secure-local-file.js +1373 -0
  141. package/dist/utils/space-config.d.ts +13 -4
  142. package/dist/utils/space-config.js +123 -15
  143. package/dist/utils/storage-policy.d.ts +20 -0
  144. package/dist/utils/storage-policy.fixtures.json +174 -0
  145. package/dist/utils/storage-policy.js +193 -0
  146. package/dist/utils/upload-session.d.ts +12 -1
  147. package/dist/utils/upload-session.js +37 -2
  148. package/dist/utils/version-file-browser.d.ts +13 -0
  149. package/dist/utils/version-file-browser.js +59 -0
  150. package/package.json +19 -1
  151. package/dist/contracts/mounts.d.ts +0 -142
  152. package/dist/contracts/mounts.js +0 -56
  153. package/dist/utils/asset-fingerprint.d.ts +0 -64
  154. package/dist/utils/asset-fingerprint.js +0 -620
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Returns the canonical MIME essence only when browsers may render the bytes
3
+ * on an authenticated origin. Active document formats (HTML, SVG, XML, and
4
+ * scripts) are intentionally absent; `nosniff` is the other half of this
5
+ * contract at the response boundary.
6
+ */
7
+ export declare function inlineVersionFileContentType(contentType: string | null | undefined): string | null;
8
+ export declare function versionFileContentDisposition(disposition: "attachment" | "inline", filePath: string): string;
9
+ /**
10
+ * A download remains inert even if a user agent ignores attachment handling:
11
+ * the CSP sandbox gives it an opaque origin and permits no script or fetch.
12
+ */
13
+ export declare function versionFileAttachmentHeaders(filePath: string): Record<string, string>;
@@ -0,0 +1,59 @@
1
+ const INLINE_VERSION_FILE_CONTENT_TYPES = new Set([
2
+ "application/pdf",
3
+ "audio/aac",
4
+ "audio/flac",
5
+ "audio/mp4",
6
+ "audio/mpeg",
7
+ "audio/ogg",
8
+ "audio/opus",
9
+ "audio/wav",
10
+ "audio/webm",
11
+ "audio/x-m4a",
12
+ "audio/x-wav",
13
+ "image/apng",
14
+ "image/avif",
15
+ "image/bmp",
16
+ "image/gif",
17
+ "image/jpeg",
18
+ "image/png",
19
+ "image/vnd.microsoft.icon",
20
+ "image/webp",
21
+ "image/x-icon",
22
+ "video/mp4",
23
+ "video/ogg",
24
+ "video/quicktime",
25
+ "video/webm",
26
+ "video/x-m4v",
27
+ ]);
28
+ /**
29
+ * Returns the canonical MIME essence only when browsers may render the bytes
30
+ * on an authenticated origin. Active document formats (HTML, SVG, XML, and
31
+ * scripts) are intentionally absent; `nosniff` is the other half of this
32
+ * contract at the response boundary.
33
+ */
34
+ export function inlineVersionFileContentType(contentType) {
35
+ const essence = contentType?.split(";", 1)[0]?.trim().toLowerCase() ?? "";
36
+ return INLINE_VERSION_FILE_CONTENT_TYPES.has(essence) ? essence : null;
37
+ }
38
+ function dispositionFilename(filePath) {
39
+ const basename = filePath.split("/").findLast(Boolean) ?? "download";
40
+ const ascii = basename
41
+ .replace(/[^\x20-\x7e]/g, "_")
42
+ .replace(/["\\]/g, "_")
43
+ .slice(0, 180);
44
+ return ascii || "download";
45
+ }
46
+ export function versionFileContentDisposition(disposition, filePath) {
47
+ return `${disposition}; filename="${dispositionFilename(filePath)}"`;
48
+ }
49
+ /**
50
+ * A download remains inert even if a user agent ignores attachment handling:
51
+ * the CSP sandbox gives it an opaque origin and permits no script or fetch.
52
+ */
53
+ export function versionFileAttachmentHeaders(filePath) {
54
+ return {
55
+ "content-disposition": versionFileContentDisposition("attachment", filePath),
56
+ "content-security-policy": "default-src 'none'; sandbox; frame-ancestors 'none'",
57
+ "x-content-type-options": "nosniff",
58
+ };
59
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spacefast/common",
3
- "version": "0.0.13",
3
+ "version": "0.0.18",
4
4
  "license": "MIT",
5
5
  "description": "Shared TypeScript contracts and utilities for Spacefast packages.",
6
6
  "repository": {
@@ -20,6 +20,22 @@
20
20
  "brand-assets",
21
21
  "dist"
22
22
  ],
23
+ "spacefastTestCache": {
24
+ "mode": "hermetic",
25
+ "inputs": [
26
+ "../../apps/www/dist/.well-known/agent-card.json",
27
+ "../../apps/www/dist/ai.txt",
28
+ "../../apps/www/dist/llms-full.txt",
29
+ "../../apps/www/dist/llms.txt",
30
+ "../../apps/www/public/skill-references.md",
31
+ "../../apps/www/public/skill.md",
32
+ "../../e2e-tests/fixtures/zero-all-features/api-finalize-request.json",
33
+ "../../e2e-tests/fixtures/zero-all-features/runtime-compiler-finalize-input.json",
34
+ "../../runtime/engine/shared/fonts",
35
+ "../cli/SKILL.md",
36
+ "../cli/references.md"
37
+ ]
38
+ },
23
39
  "exports": {
24
40
  "./brand": {
25
41
  "types": "./dist/brand.d.ts",
@@ -94,6 +110,8 @@
94
110
  "@tanstack/react-query": "^5.101.4",
95
111
  "culori": "^4.0.2",
96
112
  "js-yaml": "^4.1.1",
113
+ "mime": "^4.1.0",
114
+ "parse5": "^7.3.0",
97
115
  "smol-toml": "^1.7.0",
98
116
  "zod": "^4.4.3"
99
117
  }
@@ -1,142 +0,0 @@
1
- import { z } from "zod";
2
- export declare function normalizeMountPathPrefix(value: string): string;
3
- export declare const mountPathPrefixSchema: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
4
- export declare const spaceMountCreateSchema: z.ZodObject<{
5
- sourceVersionId: z.ZodCustom<`ver_${string}`, `ver_${string}`>;
6
- pathPrefix: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
7
- targetSpaceId: z.ZodCustom<`spc_${string}`, `spc_${string}`>;
8
- channel: z.ZodDefault<z.ZodLiteral<"live">>;
9
- }, z.core.$strip>;
10
- export declare const spaceMountSchema: z.ZodObject<{
11
- id: z.ZodCustom<`mnt_${string}`, `mnt_${string}`>;
12
- spaceId: z.ZodCustom<`spc_${string}`, `spc_${string}`>;
13
- sourceVersionId: z.ZodCustom<`ver_${string}`, `ver_${string}`>;
14
- pathPrefix: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
15
- targetSpaceId: z.ZodCustom<`spc_${string}`, `spc_${string}`>;
16
- targetSpaceSlug: z.ZodString;
17
- channel: z.ZodLiteral<"live">;
18
- versionId: z.ZodNullable<z.ZodCustom<`ver_${string}`, `ver_${string}`>>;
19
- targetVersionId: z.ZodNullable<z.ZodCustom<`ver_${string}`, `ver_${string}`>>;
20
- createdAt: z.ZodString;
21
- updatedAt: z.ZodString;
22
- }, z.core.$strip>;
23
- export declare const spaceMountListResponseSchema: z.ZodObject<{
24
- data: z.ZodArray<z.ZodObject<{
25
- id: z.ZodCustom<`mnt_${string}`, `mnt_${string}`>;
26
- spaceId: z.ZodCustom<`spc_${string}`, `spc_${string}`>;
27
- sourceVersionId: z.ZodCustom<`ver_${string}`, `ver_${string}`>;
28
- pathPrefix: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
29
- targetSpaceId: z.ZodCustom<`spc_${string}`, `spc_${string}`>;
30
- targetSpaceSlug: z.ZodString;
31
- channel: z.ZodLiteral<"live">;
32
- versionId: z.ZodNullable<z.ZodCustom<`ver_${string}`, `ver_${string}`>>;
33
- targetVersionId: z.ZodNullable<z.ZodCustom<`ver_${string}`, `ver_${string}`>>;
34
- createdAt: z.ZodString;
35
- updatedAt: z.ZodString;
36
- }, z.core.$strip>>;
37
- }, z.core.$strip>;
38
- export declare const spaceMountResponseSchema: z.ZodObject<{
39
- data: z.ZodObject<{
40
- id: z.ZodCustom<`mnt_${string}`, `mnt_${string}`>;
41
- spaceId: z.ZodCustom<`spc_${string}`, `spc_${string}`>;
42
- sourceVersionId: z.ZodCustom<`ver_${string}`, `ver_${string}`>;
43
- pathPrefix: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
44
- targetSpaceId: z.ZodCustom<`spc_${string}`, `spc_${string}`>;
45
- targetSpaceSlug: z.ZodString;
46
- channel: z.ZodLiteral<"live">;
47
- versionId: z.ZodNullable<z.ZodCustom<`ver_${string}`, `ver_${string}`>>;
48
- targetVersionId: z.ZodNullable<z.ZodCustom<`ver_${string}`, `ver_${string}`>>;
49
- createdAt: z.ZodString;
50
- updatedAt: z.ZodString;
51
- }, z.core.$strip>;
52
- operation: z.ZodNullable<z.ZodObject<{
53
- id: z.ZodString;
54
- kind: z.ZodString;
55
- status: z.ZodEnum<{
56
- failed: "failed";
57
- canceled: "canceled";
58
- queued: "queued";
59
- running: "running";
60
- succeeded: "succeeded";
61
- }>;
62
- resources: z.ZodArray<z.ZodObject<{
63
- type: z.ZodString;
64
- id: z.ZodString;
65
- }, z.core.$strip>>;
66
- progress: z.ZodOptional<z.ZodObject<{
67
- total: z.ZodNumber;
68
- completed: z.ZodNumber;
69
- failed: z.ZodNumber;
70
- }, z.core.$strip>>;
71
- diagnostics: z.ZodOptional<z.ZodArray<z.ZodObject<{
72
- code: z.ZodString;
73
- severity: z.ZodEnum<{
74
- info: "info";
75
- error: "error";
76
- warning: "warning";
77
- }>;
78
- message: z.ZodString;
79
- path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
80
- provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
81
- registrar: "registrar";
82
- wpcloud: "wpcloud";
83
- dns: "dns";
84
- runtime: "runtime";
85
- }>>>;
86
- details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
87
- fix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
88
- retryable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
89
- }, z.core.$strip>>>;
90
- createdAt: z.ZodString;
91
- finishedAt: z.ZodOptional<z.ZodString>;
92
- }, z.core.$strip>>;
93
- }, z.core.$strip>;
94
- export declare const spaceMountDeleteResponseSchema: z.ZodObject<{
95
- data: z.ZodObject<{
96
- id: z.ZodCustom<`mnt_${string}`, `mnt_${string}`>;
97
- deleted: z.ZodLiteral<true>;
98
- }, z.core.$strip>;
99
- operation: z.ZodNullable<z.ZodObject<{
100
- id: z.ZodString;
101
- kind: z.ZodString;
102
- status: z.ZodEnum<{
103
- failed: "failed";
104
- canceled: "canceled";
105
- queued: "queued";
106
- running: "running";
107
- succeeded: "succeeded";
108
- }>;
109
- resources: z.ZodArray<z.ZodObject<{
110
- type: z.ZodString;
111
- id: z.ZodString;
112
- }, z.core.$strip>>;
113
- progress: z.ZodOptional<z.ZodObject<{
114
- total: z.ZodNumber;
115
- completed: z.ZodNumber;
116
- failed: z.ZodNumber;
117
- }, z.core.$strip>>;
118
- diagnostics: z.ZodOptional<z.ZodArray<z.ZodObject<{
119
- code: z.ZodString;
120
- severity: z.ZodEnum<{
121
- info: "info";
122
- error: "error";
123
- warning: "warning";
124
- }>;
125
- message: z.ZodString;
126
- path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
127
- provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
128
- registrar: "registrar";
129
- wpcloud: "wpcloud";
130
- dns: "dns";
131
- runtime: "runtime";
132
- }>>>;
133
- details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
134
- fix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
135
- retryable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
136
- }, z.core.$strip>>>;
137
- createdAt: z.ZodString;
138
- finishedAt: z.ZodOptional<z.ZodString>;
139
- }, z.core.$strip>>;
140
- }, z.core.$strip>;
141
- export type SpaceMountCreate = z.infer<typeof spaceMountCreateSchema>;
142
- export type SpaceMount = z.infer<typeof spaceMountSchema>;
@@ -1,56 +0,0 @@
1
- import { z } from "zod";
2
- import { dataEnvelope, mutationEnvelope } from "./common.js";
3
- import { registeredIdSchema } from "./ids.js";
4
- const RESERVED_MOUNT_PREFIXES = ["/__spacefast", "/__stattic", "/.well-known"];
5
- export function normalizeMountPathPrefix(value) {
6
- const trimmed = value.trim();
7
- if (trimmed === "" || trimmed === "/")
8
- return "/";
9
- return `/${trimmed.replace(/^\/+|\/+$/g, "")}`;
10
- }
11
- export const mountPathPrefixSchema = z
12
- .string()
13
- .min(1)
14
- .max(1024)
15
- .transform(normalizeMountPathPrefix)
16
- .refine((value) => value !== "/", "A mount path must be below the site root.")
17
- .refine((value) => Array.from(value).every((character) => {
18
- const codePoint = character.codePointAt(0) ?? 0;
19
- return codePoint > 0x9f || (codePoint > 0x1f && codePoint !== 0x7f);
20
- }), "Mount path is invalid.")
21
- .refine((value) => !value.includes("\\") && !value.includes("//"), "Mount path is invalid.")
22
- .refine((value) => !value
23
- .split("/")
24
- .filter(Boolean)
25
- .some((segment) => segment === "." || segment === ".."), "Mount path is invalid.")
26
- .refine((value) => !RESERVED_MOUNT_PREFIXES.some((reserved) => value === reserved || value.startsWith(`${reserved}/`)), "Mount path uses a Spacefast-reserved prefix.")
27
- .describe("Normalized path prefix on the website, for example `/docs`.");
28
- export const spaceMountCreateSchema = z.object({
29
- sourceVersionId: registeredIdSchema("ver").describe("Immutable website version whose production activation enables this mount."),
30
- pathPrefix: mountPathPrefixSchema,
31
- targetSpaceId: registeredIdSchema("spc").describe("Explicitly authorized same-team space to mount."),
32
- channel: z
33
- .literal("live")
34
- .default("live")
35
- .describe("Target production channel followed by this mount."),
36
- });
37
- export const spaceMountSchema = z.object({
38
- id: registeredIdSchema("mnt"),
39
- spaceId: registeredIdSchema("spc"),
40
- sourceVersionId: registeredIdSchema("ver"),
41
- pathPrefix: mountPathPrefixSchema,
42
- targetSpaceId: registeredIdSchema("spc"),
43
- targetSpaceSlug: z.string(),
44
- channel: z.literal("live"),
45
- versionId: registeredIdSchema("ver")
46
- .nullable()
47
- .describe("Immutable target version currently serving from the mount."),
48
- targetVersionId: registeredIdSchema("ver")
49
- .nullable()
50
- .describe("Target production-channel version the durable synchronizer is converging toward."),
51
- createdAt: z.string().datetime(),
52
- updatedAt: z.string().datetime(),
53
- });
54
- export const spaceMountListResponseSchema = dataEnvelope(z.array(spaceMountSchema));
55
- export const spaceMountResponseSchema = mutationEnvelope(spaceMountSchema);
56
- export const spaceMountDeleteResponseSchema = mutationEnvelope(z.object({ id: registeredIdSchema("mnt"), deleted: z.literal(true) }));
@@ -1,64 +0,0 @@
1
- export declare const FINGERPRINT_IMMUTABLE_CACHE_CONTROL = "public, max-age=31536000, immutable";
2
- export declare const FINGERPRINT_HASH_LENGTH = 8;
3
- export type FingerprintCandidateFile = {
4
- /** Canonical manifest path (no leading slash). */
5
- path: string;
6
- /** Full lowercase-hex sha256 of the file's bytes. */
7
- sha256?: string | undefined;
8
- /** UTF-8 text for html/css files that may need reference rewriting. */
9
- text?: string | undefined;
10
- };
11
- export type FingerprintSkipReason = "css_cycle" | "alias_collision" | "user_cache_control" | "budget";
12
- export type FingerprintPlan = {
13
- /**
14
- * Alias manifest entries to add, sorted by sourcePath; content is identical
15
- * to sourcePath's. This is also the "what got fingerprinted" relation —
16
- * one array, `path` = the hashed alias, `sourcePath` = the original.
17
- */
18
- aliases: Array<{
19
- path: string;
20
- sourcePath: string;
21
- }>;
22
- /** html/css files whose published content changes (both paths, one blob). */
23
- rewrites: Array<{
24
- path: string;
25
- text: string;
26
- sha256: string;
27
- }>;
28
- /** Eligible-looking files the pass left on the default lane, with reasons. */
29
- skipped: Array<{
30
- path: string;
31
- reason: FingerprintSkipReason;
32
- }>;
33
- };
34
- export type StaticDocumentDependency = {
35
- sourcePath: string;
36
- targetPath: string;
37
- };
38
- /**
39
- * Advisory-only dependency discovery used by finalize diagnostics. It shares
40
- * the exact HTML/CSS tokenizer and URL resolver with asset fingerprinting, then
41
- * adds conservative static JS imports and page links. It never rewrites bytes
42
- * and never changes access automatically.
43
- */
44
- export declare function scanStaticDocumentDependencies(sourcePath: string, text: string): StaticDocumentDependency[];
45
- export declare function planAssetFingerprints(input: {
46
- files: readonly FingerprintCandidateFile[];
47
- /** sha256 as lowercase hex over UTF-8 bytes of `text`. */
48
- hashHex: (text: string) => string;
49
- /**
50
- * True when a user `_headers` Cache-Control rule already covers this URL
51
- * path ("/"-prefixed). Files whose original OR probe-alias path is covered
52
- * are never fingerprinted — user rules always win.
53
- */
54
- pathCoveredByUserCacheControl?: ((urlPath: string) => boolean) | undefined;
55
- /** Extra per-path exclusion (e.g. header-rule budget trimming). */
56
- excludePath?: ((path: string) => boolean) | undefined;
57
- }): FingerprintPlan;
58
- /**
59
- * Merges the generated immutable pins into user `_headers` content. The user
60
- * content is preserved byte-for-byte; generated exact-path rules are appended
61
- * (per-path Cache-Control conflicts are impossible — files covered by a user
62
- * Cache-Control rule are never fingerprinted).
63
- */
64
- export declare function mergeFingerprintHeaders(userHeaders: string | undefined, aliasPaths: readonly string[]): string;