@samebase/convex-hosting 0.3.2 → 0.4.1

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 (193) hide show
  1. package/CHANGELOG.md +17 -132
  2. package/README.md +188 -406
  3. package/dist/cli/convex.d.ts +63 -0
  4. package/dist/cli/convex.js +108 -0
  5. package/dist/cli/convex.js.map +1 -0
  6. package/dist/cli/files.d.ts +18 -0
  7. package/dist/cli/files.js +106 -0
  8. package/dist/cli/files.js.map +1 -0
  9. package/dist/cli/index.d.ts +1 -11
  10. package/dist/cli/index.js +3 -58
  11. package/dist/cli/index.js.map +1 -1
  12. package/dist/cli/main.d.ts +5 -0
  13. package/dist/cli/main.js +377 -0
  14. package/dist/cli/main.js.map +1 -0
  15. package/dist/client/index.d.ts +8 -115
  16. package/dist/client/index.js +65 -242
  17. package/dist/client/index.js.map +1 -1
  18. package/dist/client/types.d.ts +5 -0
  19. package/dist/client/version-module.d.ts +6 -0
  20. package/dist/component/_generated/api.d.ts +0 -5
  21. package/dist/component/_generated/api.js.map +1 -1
  22. package/dist/component/_generated/component.d.ts +20 -18
  23. package/dist/component/_generated/dataModel.d.ts +0 -1
  24. package/dist/component/_generated/server.d.ts +12 -1
  25. package/dist/component/_generated/server.js +2 -0
  26. package/dist/component/_generated/server.js.map +1 -1
  27. package/dist/component/convex.config.d.ts +0 -1
  28. package/dist/component/lib.d.ts +175 -156
  29. package/dist/component/lib.js +396 -710
  30. package/dist/component/lib.js.map +1 -1
  31. package/dist/component/schema.d.ts +76 -72
  32. package/dist/component/schema.js +35 -59
  33. package/dist/component/schema.js.map +1 -1
  34. package/dist/workers-shared/asset-worker/src/analytics.d.ts +39 -0
  35. package/dist/workers-shared/asset-worker/src/analytics.js +86 -0
  36. package/dist/workers-shared/asset-worker/src/analytics.js.map +1 -0
  37. package/dist/workers-shared/asset-worker/src/compatibility-flags.d.ts +19 -0
  38. package/dist/workers-shared/asset-worker/src/compatibility-flags.js +29 -0
  39. package/dist/workers-shared/asset-worker/src/compatibility-flags.js.map +1 -0
  40. package/dist/workers-shared/asset-worker/src/configuration.d.ts +3 -0
  41. package/dist/workers-shared/asset-worker/src/configuration.js +30 -0
  42. package/dist/workers-shared/asset-worker/src/configuration.js.map +1 -0
  43. package/dist/workers-shared/asset-worker/src/constants.d.ts +1 -0
  44. package/dist/workers-shared/asset-worker/src/constants.js +3 -0
  45. package/dist/workers-shared/asset-worker/src/constants.js.map +1 -0
  46. package/dist/workers-shared/asset-worker/src/handler.d.ts +28 -0
  47. package/dist/workers-shared/asset-worker/src/handler.js +717 -0
  48. package/dist/workers-shared/asset-worker/src/handler.js.map +1 -0
  49. package/dist/workers-shared/asset-worker/src/types.d.ts +13 -0
  50. package/dist/workers-shared/asset-worker/src/types.js +2 -0
  51. package/dist/workers-shared/asset-worker/src/types.js.map +1 -0
  52. package/dist/workers-shared/asset-worker/src/utils/base-path.d.ts +29 -0
  53. package/dist/workers-shared/asset-worker/src/utils/base-path.js +56 -0
  54. package/dist/workers-shared/asset-worker/src/utils/base-path.js.map +1 -0
  55. package/dist/workers-shared/asset-worker/src/utils/headers.d.ts +11 -0
  56. package/dist/workers-shared/asset-worker/src/utils/headers.js +77 -0
  57. package/dist/workers-shared/asset-worker/src/utils/headers.js.map +1 -0
  58. package/dist/workers-shared/asset-worker/src/utils/rules-engine.d.ts +23 -0
  59. package/dist/workers-shared/asset-worker/src/utils/rules-engine.js +133 -0
  60. package/dist/workers-shared/asset-worker/src/utils/rules-engine.js.map +1 -0
  61. package/dist/workers-shared/asset-worker/src/worker.d.ts +14 -0
  62. package/dist/workers-shared/asset-worker/src/worker.js +12 -0
  63. package/dist/workers-shared/asset-worker/src/worker.js.map +1 -0
  64. package/dist/workers-shared/utils/base-path.d.ts +32 -0
  65. package/dist/workers-shared/utils/base-path.js +94 -0
  66. package/dist/workers-shared/utils/base-path.js.map +1 -0
  67. package/dist/workers-shared/utils/configuration/constants.d.ts +15 -0
  68. package/dist/workers-shared/utils/configuration/constants.js +16 -0
  69. package/dist/workers-shared/utils/configuration/constants.js.map +1 -0
  70. package/dist/workers-shared/utils/configuration/constructConfiguration.d.ts +12 -0
  71. package/dist/workers-shared/utils/configuration/constructConfiguration.js +103 -0
  72. package/dist/workers-shared/utils/configuration/constructConfiguration.js.map +1 -0
  73. package/dist/workers-shared/utils/configuration/parseHeaders.d.ts +5 -0
  74. package/dist/workers-shared/utils/configuration/parseHeaders.js +181 -0
  75. package/dist/workers-shared/utils/configuration/parseHeaders.js.map +1 -0
  76. package/dist/workers-shared/utils/configuration/parseRedirects.d.ts +8 -0
  77. package/dist/workers-shared/utils/configuration/parseRedirects.js +129 -0
  78. package/dist/workers-shared/utils/configuration/parseRedirects.js.map +1 -0
  79. package/dist/workers-shared/utils/configuration/parseStaticRouting.d.ts +2 -0
  80. package/dist/workers-shared/utils/configuration/parseStaticRouting.js +94 -0
  81. package/dist/workers-shared/utils/configuration/parseStaticRouting.js.map +1 -0
  82. package/dist/workers-shared/utils/configuration/types.d.ts +38 -0
  83. package/dist/workers-shared/utils/configuration/types.js +2 -0
  84. package/dist/workers-shared/utils/configuration/types.js.map +1 -0
  85. package/dist/workers-shared/utils/configuration/validateURL.d.ts +3 -0
  86. package/dist/workers-shared/utils/configuration/validateURL.js +56 -0
  87. package/dist/workers-shared/utils/configuration/validateURL.js.map +1 -0
  88. package/dist/workers-shared/utils/constants.d.ts +28 -0
  89. package/dist/workers-shared/utils/constants.js +34 -0
  90. package/dist/workers-shared/utils/constants.js.map +1 -0
  91. package/dist/workers-shared/utils/helpers.d.ts +22 -0
  92. package/dist/workers-shared/utils/helpers.js +73 -0
  93. package/dist/workers-shared/utils/helpers.js.map +1 -0
  94. package/dist/workers-shared/utils/responses.d.ts +43 -0
  95. package/dist/workers-shared/utils/responses.js +125 -0
  96. package/dist/workers-shared/utils/responses.js.map +1 -0
  97. package/dist/workers-shared/utils/tracing.d.ts +3 -0
  98. package/dist/workers-shared/utils/tracing.js +29 -0
  99. package/dist/workers-shared/utils/tracing.js.map +1 -0
  100. package/dist/workers-shared/utils/types.d.ts +131 -0
  101. package/dist/workers-shared/utils/types.js +72 -0
  102. package/dist/workers-shared/utils/types.js.map +1 -0
  103. package/package.json +21 -37
  104. package/INTEGRATION.md +0 -399
  105. package/dist/cli/args.d.ts +0 -28
  106. package/dist/cli/args.d.ts.map +0 -1
  107. package/dist/cli/args.js +0 -148
  108. package/dist/cli/args.js.map +0 -1
  109. package/dist/cli/argumentChunks.d.ts +0 -3
  110. package/dist/cli/argumentChunks.d.ts.map +0 -1
  111. package/dist/cli/argumentChunks.js +0 -29
  112. package/dist/cli/argumentChunks.js.map +0 -1
  113. package/dist/cli/collectFiles.d.ts +0 -10
  114. package/dist/cli/collectFiles.d.ts.map +0 -1
  115. package/dist/cli/collectFiles.js +0 -53
  116. package/dist/cli/collectFiles.js.map +0 -1
  117. package/dist/cli/commands.d.ts +0 -8
  118. package/dist/cli/commands.d.ts.map +0 -1
  119. package/dist/cli/commands.js +0 -56
  120. package/dist/cli/commands.js.map +0 -1
  121. package/dist/cli/componentName.d.ts +0 -32
  122. package/dist/cli/componentName.d.ts.map +0 -1
  123. package/dist/cli/componentName.js +0 -43
  124. package/dist/cli/componentName.js.map +0 -1
  125. package/dist/cli/deploy.d.ts +0 -16
  126. package/dist/cli/deploy.d.ts.map +0 -1
  127. package/dist/cli/deploy.js +0 -283
  128. package/dist/cli/deploy.js.map +0 -1
  129. package/dist/cli/deployEnvironment.d.ts +0 -10
  130. package/dist/cli/deployEnvironment.d.ts.map +0 -1
  131. package/dist/cli/deployEnvironment.js +0 -12
  132. package/dist/cli/deployEnvironment.js.map +0 -1
  133. package/dist/cli/index.d.ts.map +0 -1
  134. package/dist/cli/upload.d.ts +0 -22
  135. package/dist/cli/upload.d.ts.map +0 -1
  136. package/dist/cli/upload.js +0 -630
  137. package/dist/cli/upload.js.map +0 -1
  138. package/dist/client/_generated/_ignore.d.ts +0 -1
  139. package/dist/client/_generated/_ignore.d.ts.map +0 -1
  140. package/dist/client/_generated/_ignore.js +0 -3
  141. package/dist/client/_generated/_ignore.js.map +0 -1
  142. package/dist/client/index.d.ts.map +0 -1
  143. package/dist/component/_generated/api.d.ts.map +0 -1
  144. package/dist/component/_generated/component.d.ts.map +0 -1
  145. package/dist/component/_generated/dataModel.d.ts.map +0 -1
  146. package/dist/component/_generated/server.d.ts.map +0 -1
  147. package/dist/component/convex.config.d.ts.map +0 -1
  148. package/dist/component/http.d.ts +0 -4
  149. package/dist/component/http.d.ts.map +0 -1
  150. package/dist/component/http.js +0 -113
  151. package/dist/component/http.js.map +0 -1
  152. package/dist/component/lib.d.ts.map +0 -1
  153. package/dist/component/schema.d.ts.map +0 -1
  154. package/dist/component/serving.d.ts +0 -23
  155. package/dist/component/serving.d.ts.map +0 -1
  156. package/dist/component/serving.js +0 -161
  157. package/dist/component/serving.js.map +0 -1
  158. package/dist/react/index.d.ts +0 -59
  159. package/dist/react/index.d.ts.map +0 -1
  160. package/dist/react/index.js +0 -137
  161. package/dist/react/index.js.map +0 -1
  162. package/src/cli/args.test.ts +0 -79
  163. package/src/cli/args.ts +0 -153
  164. package/src/cli/argumentChunks.test.ts +0 -27
  165. package/src/cli/argumentChunks.ts +0 -40
  166. package/src/cli/collectFiles.test.ts +0 -26
  167. package/src/cli/collectFiles.ts +0 -59
  168. package/src/cli/commands.ts +0 -68
  169. package/src/cli/componentName.test.ts +0 -41
  170. package/src/cli/componentName.ts +0 -46
  171. package/src/cli/deploy.ts +0 -336
  172. package/src/cli/deployEnvironment.test.ts +0 -27
  173. package/src/cli/deployEnvironment.ts +0 -17
  174. package/src/cli/index.ts +0 -65
  175. package/src/cli/upload.ts +0 -837
  176. package/src/client/_generated/_ignore.ts +0 -1
  177. package/src/client/index.test.ts +0 -549
  178. package/src/client/index.ts +0 -344
  179. package/src/client/setup.test.ts +0 -22
  180. package/src/component/_generated/api.ts +0 -54
  181. package/src/component/_generated/component.ts +0 -55
  182. package/src/component/_generated/dataModel.ts +0 -60
  183. package/src/component/_generated/server.ts +0 -156
  184. package/src/component/convex.config.ts +0 -3
  185. package/src/component/http.test.ts +0 -254
  186. package/src/component/http.ts +0 -133
  187. package/src/component/lib.test.ts +0 -1007
  188. package/src/component/lib.ts +0 -862
  189. package/src/component/schema.ts +0 -75
  190. package/src/component/serving.ts +0 -170
  191. package/src/component/setup.test.ts +0 -11
  192. package/src/react/index.tsx +0 -197
  193. package/src/test.ts +0 -23
@@ -1,260 +1,83 @@
1
- import { httpActionGeneric, queryGeneric, } from "convex/server";
2
- import { v } from "convex/values";
3
- import { cacheControlFor, decodeRequestPath, errorResponse, etagMatches, getMimeType, getSetupHtml, isHtmlContentType, } from "../component/serving.js";
4
- const deploymentInfoValidator = v.object({
5
- _id: v.string(),
6
- _creationTime: v.number(),
7
- currentDeploymentId: v.string(),
8
- deployedAt: v.number(),
9
- spaFallback: v.optional(v.boolean()),
10
- });
11
1
  /**
12
- * Register app-owned HTTP routes for the hosted site.
2
+ * Answers `request` with the asset of version `versionId` that Cloudflare's asset handler picks.
13
3
  *
14
- * Prefer mounting the component's own HTTP routes when it can own the URL
15
- * prefix. Use this compatibility mode when existing app HTTP routes must stay
16
- * at the same root. Exact app routes take precedence over this catch-all.
17
- * Assets and deployment state still live in the component.
18
- *
19
- * @example
20
- * ```typescript
21
- * // convex/convex.config.ts
22
- * const app = defineApp();
23
- * app.use(hosting); // no httpPrefix: the app owns HTTP routing
24
- *
25
- * // convex/http.ts
26
- * const http = httpRouter();
27
- * auth.addHttpRoutes(http);
28
- * registerStaticRoutes(http, components.hosting);
29
- * export default http;
30
- * ```
4
+ * Returns `null` when no asset matches, so the app continues (a static site answers 404, a
5
+ * server-rendered site renders the page). A version that does not exist, is still uploading, or
6
+ * is being deleted answers 404, so a half-installed site does not render pages without their
7
+ * files. The first request for a `ready` version marks it live, which deletes the versions that
8
+ * were live before it.
31
9
  */
32
- export function registerStaticRoutes(http, component, { pathPrefix = "/", spaFallback, cdnBaseUrl, } = {}) {
33
- if (!pathPrefix.startsWith("/")) {
34
- throw new Error("pathPrefix must start with /");
35
- }
36
- const normalizedPrefix = pathPrefix === "/" ? "" : pathPrefix.replace(/\/$/, "");
37
- const serveStaticFile = httpActionGeneric(async (ctx, request) => {
38
- const decodedPath = decodeRequestPath(new URL(request.url).pathname);
39
- if (decodedPath === null) {
40
- return errorResponse(400, "Bad Request");
41
- }
42
- let path = decodedPath;
43
- if (normalizedPrefix && path.startsWith(normalizedPrefix)) {
44
- path = path.slice(normalizedPrefix.length) || "/";
45
- }
46
- if (path === "" || path === "/") {
47
- path = "/index.html";
48
- }
49
- const response = await serveAsset(ctx, component, request, path, {
50
- spaFallback,
51
- cdnBaseUrl,
52
- });
53
- if (response)
54
- return response;
55
- if (path === "/index.html") {
56
- return new Response(getSetupHtml(), {
57
- status: 503,
58
- headers: {
59
- "Content-Type": "text/html; charset=utf-8",
60
- "Cache-Control": "no-store",
61
- "Retry-After": "5",
62
- },
63
- });
64
- }
65
- return errorResponse(404, "Not Found");
66
- });
67
- http.route({
68
- pathPrefix: pathPrefix === "/" ? "/" : `${normalizedPrefix}/`,
69
- method: "GET",
70
- handler: serveStaticFile,
10
+ export async function serveAsset(ctx, component, request, versionId) {
11
+ const { state, newestLiveAt, asset } = await ctx.runQuery(component.lib.route, {
12
+ versionId,
13
+ method: request.method,
14
+ url: request.url,
15
+ headers: handlerHeaders(request.headers),
71
16
  });
72
- if (normalizedPrefix) {
73
- http.route({
74
- path: normalizedPrefix,
75
- method: "GET",
76
- handler: serveStaticFile,
17
+ if (state === null || state === "uploading" || state === "deleting") {
18
+ const problem = state === null
19
+ ? "does not exist"
20
+ : state === "uploading"
21
+ ? "is still uploading"
22
+ : "is being deleted";
23
+ return new Response(`Version ${versionId} of the site ${problem}.`, {
24
+ status: 404,
25
+ headers: NO_STORE,
77
26
  });
78
27
  }
79
- }
80
- /**
81
- * Serve an uploaded static file from your own HTTP action, or return null when
82
- * no file matches so the action can continue with its own routing: server
83
- * rendering, prerendered pages, redirects.
84
- *
85
- * Found files get the same response as `registerStaticRoutes`: content type,
86
- * cache headers, ETag revalidation, and legacy CDN redirects. A found file
87
- * whose storage can't be read gets a 500 response. A request path with
88
- * malformed percent-encoding matches no file, so it returns null.
89
- *
90
- * The lookup is exact by default. `/` is not mapped to `/index.html`, and there
91
- * is no SPA fallback, so the SPA shell never answers for a route your action
92
- * handles. To serve the shell, pass `{ path: "/index.html" }`. When your route
93
- * has a prefix, pass `path` with the prefix removed.
94
- *
95
- * @example
96
- * ```typescript
97
- * // convex/http.ts
98
- * const http = httpRouter();
99
- * http.route({
100
- * pathPrefix: "/",
101
- * method: "GET",
102
- * handler: httpAction(async (ctx, request) => {
103
- * const file = await serveStaticAsset(ctx, components.hosting, request);
104
- * if (file) return file;
105
- * return await renderPage(request);
106
- * }),
107
- * });
108
- * export default http;
109
- * ```
110
- */
111
- export async function serveStaticAsset(ctx, component, request, { path, spaFallback = false, cdnBaseUrl, } = {}) {
112
- if (path !== undefined && !path.startsWith("/")) {
113
- throw new Error("path must start with /");
114
- }
115
- const filePath = path ?? decodeRequestPath(new URL(request.url).pathname);
116
- if (filePath === null)
117
- return null;
118
- return await serveAsset(ctx, component, request, filePath, {
119
- spaFallback,
120
- cdnBaseUrl,
121
- });
122
- }
123
- export { decodeRequestPath };
124
- /**
125
- * Serve the uploaded file at `path` (decoded, relative to the mount prefix),
126
- * or return null when no file matches. An undefined `spaFallback` uses the
127
- * deployment's stored setting.
128
- */
129
- async function serveAsset(ctx, component, request, path, { spaFallback, cdnBaseUrl, }) {
130
- const asset = await ctx.runQuery(component.lib.resolveAssetForHttp, {
131
- path,
132
- ...(spaFallback === undefined ? {} : { spaFallback }),
133
- });
134
- if (!asset)
135
- return null;
136
- const contentType = asset.contentType || getMimeType(path);
137
- const cacheControl = cacheControlFor(path);
138
- if (asset.blobId && !isHtmlContentType(contentType)) {
139
- const configuredBase = typeof cdnBaseUrl === "function" ? cdnBaseUrl(request) : cdnBaseUrl;
140
- const baseUrl = configuredBase ?? `${new URL(request.url).origin}/fs/blobs`;
141
- return new Response(null, {
142
- status: 302,
143
- headers: {
144
- Location: `${baseUrl.replace(/\/$/, "")}/${asset.blobId}`,
145
- "Cache-Control": cacheControl,
146
- },
147
- });
148
- }
149
- // TODO(remove in a future major): v1→v2 transitional path. The file still
150
- // lives in the app's own storage (a same-name migration inherited the v1
151
- // row; see the component's resolveAssetForHttp). Serve it directly from app
152
- // storage so the site stays up during migration with no re-upload. Once v1
153
- // app-storage assets are no longer supported, delete this branch.
154
- if (asset.appStorageId) {
155
- if (asset.etag && etagMatches(request.headers.get("If-None-Match"), asset.etag)) {
156
- return new Response(null, {
157
- status: 304,
158
- headers: { ETag: asset.etag, "Cache-Control": cacheControl },
159
- });
160
- }
161
- const blob = await ctx.storage.get(asset.appStorageId);
162
- if (!blob) {
163
- // The component surfaces appStorageId whenever it can't resolve a
164
- // storage URL, which also covers a genuinely deleted file (the two are
165
- // indistinguishable from the component). If it isn't in app storage
166
- // either, treat it as missing, like an empty deployment, rather than
167
- // erroring.
168
- return null;
169
- }
170
- return new Response(blob, {
171
- status: 200,
172
- headers: {
173
- "Content-Type": contentType,
174
- "Cache-Control": cacheControl,
175
- ...(asset.etag ? { ETag: asset.etag } : {}),
176
- "X-Content-Type-Options": "nosniff",
177
- },
28
+ // Only the pushed code knows which version the deployment runs, so its first request reports it.
29
+ if (state === "ready") {
30
+ await ctx.runMutation(component.lib.markLive, {
31
+ versionId,
32
+ expectedNewestLiveAt: newestLiveAt,
178
33
  });
179
34
  }
180
- if (!asset.storageUrl) {
181
- return errorResponse(500, "Asset not available");
182
- }
183
- if (asset.etag && etagMatches(request.headers.get("If-None-Match"), asset.etag)) {
184
- return new Response(null, {
185
- status: 304,
186
- headers: { ETag: asset.etag, "Cache-Control": cacheControl },
187
- });
35
+ if (asset === null)
36
+ return null;
37
+ const headers = new Headers();
38
+ for (const { name, value } of asset.headers)
39
+ headers.append(name, value);
40
+ if (asset.bodyUrl === null)
41
+ return new Response(null, { status: asset.status, headers });
42
+ // An app cannot read a component's storage, so the body comes from the storage URL.
43
+ let stored;
44
+ try {
45
+ stored = await fetch(asset.bodyUrl);
188
46
  }
189
- const storageResponse = await fetch(asset.storageUrl);
190
- if (!storageResponse.ok || !storageResponse.body) {
191
- return errorResponse(500, "Storage error");
47
+ catch {
48
+ return badGateway();
192
49
  }
193
- return new Response(storageResponse.body, {
194
- status: 200,
195
- headers: {
196
- "Content-Type": contentType,
197
- "Cache-Control": cacheControl,
198
- ...(asset.etag ? { ETag: asset.etag } : {}),
199
- "X-Content-Type-Options": "nosniff",
200
- },
201
- });
50
+ // A deploy deleted the file between the query and the fetch.
51
+ if (stored.status === 404)
52
+ return new Response(null, { status: 404, headers: NO_STORE });
53
+ if (!stored.ok)
54
+ return badGateway();
55
+ return new Response(stored.body, { status: asset.status, headers });
202
56
  }
203
57
  /**
204
- * Expose a query that clients can subscribe to for live reload on deploy.
205
- * This is only needed if you use `UpdateBanner` / `useDeploymentUpdates` from
206
- * `@samebase/convex-hosting/react`. If you don't surface deployment updates
207
- * in your app, you don't need to call this.
208
- *
209
- * @example
210
- * ```typescript
211
- * // convex/hosting.ts
212
- * import { exposeDeploymentQuery } from "@samebase/convex-hosting";
213
- * import { components } from "./_generated/api";
214
- *
215
- * export const { getCurrentDeployment } = exposeDeploymentQuery(
216
- * components.hosting,
217
- * );
218
- * ```
58
+ * The request headers that Cloudflare's handler reads. It reads only the presence of
59
+ * `Authorization` and `Range`, so their values (a credential, for one) stay out of the query.
219
60
  */
220
- export function exposeDeploymentQuery(component) {
221
- return {
222
- getCurrentDeployment: queryGeneric({
223
- args: {},
224
- returns: v.union(deploymentInfoValidator, v.null()),
225
- handler: async (ctx) => {
226
- const deployment = await ctx.runQuery(component.lib.getCurrentDeployment, {});
227
- if (!deployment)
228
- return null;
229
- // Cleanup accounting is private component state. Returning it through
230
- // this public wrapper would fail the narrower response validator.
231
- const deploymentWithCleanup = deployment;
232
- const { pendingBlobCleanupCount: _pending, ...publicDeployment } = deploymentWithCleanup;
233
- return publicDeployment;
234
- },
235
- }),
236
- };
61
+ function handlerHeaders(headers) {
62
+ const picked = {};
63
+ for (const name of ["if-none-match", "sec-fetch-mode"]) {
64
+ const value = headers.get(name);
65
+ if (value !== null)
66
+ picked[name] = value;
67
+ }
68
+ for (const name of ["authorization", "range"]) {
69
+ if (headers.has(name))
70
+ picked[name] = "";
71
+ }
72
+ return picked;
237
73
  }
238
74
  /**
239
- * Derive the Convex cloud URL from a `.convex.site` hostname.
240
- * Useful when your frontend is served by this component and needs
241
- * to connect to its own Convex backend without an explicit env var.
242
- *
243
- * @example
244
- * ```typescript
245
- * import { getConvexUrl } from "@samebase/convex-hosting";
246
- *
247
- * const convexUrl = import.meta.env.VITE_CONVEX_URL ?? getConvexUrl();
248
- * const convex = new ConvexReactClient(convexUrl);
249
- * ```
75
+ * For the answers that no uploaded file gives. The deployment's Cloudflare front caches 404 answers
76
+ * on static paths, so without it a script requested seconds before its upload ended would stay
77
+ * missing for hours (the 0.3.2 incident).
250
78
  */
251
- export function getConvexUrl() {
252
- if (typeof window === "undefined") {
253
- throw new Error("getConvexUrl() can only be called in a browser context");
254
- }
255
- if (window.location.hostname.endsWith(".convex.site")) {
256
- return `https://${window.location.hostname.replace(".convex.site", ".convex.cloud")}`;
257
- }
258
- throw new Error("Unable to derive Convex URL. Please set VITE_CONVEX_URL environment variable.");
79
+ const NO_STORE = { "Cache-Control": "no-store" };
80
+ function badGateway() {
81
+ return new Response(null, { status: 502, headers: NO_STORE });
259
82
  }
260
83
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,YAAY,GAIb,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,CAAC,EAAkB,MAAM,eAAe,CAAC;AAElD,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,WA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EAAE,CAAC,CAAC;AAChE,CAAC"}
@@ -0,0 +1,5 @@
1
+ // An import cannot include a script declaration file, and the wildcard module in it needs an
2
+ // ambient context, so this is the one reference directive in the package.
3
+ // oxlint-disable-next-line typescript/triple-slash-reference
4
+ /// <reference path="./version-module.d.ts" />
5
+ export * from "./index.js";
@@ -0,0 +1,6 @@
1
+ // Ambient declaration of the module that `convex-hosting deploy` writes, so an app typechecks on a
2
+ // fresh clone, before its first deploy. Script file on purpose: a wildcard module name is only allowed
3
+ // in an ambient context.
4
+ declare module "*/.convex-hosting/version.js" {
5
+ export const versionId: string;
6
+ }
@@ -6,14 +6,10 @@
6
6
  * To regenerate, run `npx convex dev`.
7
7
  * @module
8
8
  */
9
- import type * as http from "../http.js";
10
9
  import type * as lib from "../lib.js";
11
- import type * as serving from "../serving.js";
12
10
  import type { ApiFromModules, FilterApi, FunctionReference } from "convex/server";
13
11
  declare const fullApi: ApiFromModules<{
14
- http: typeof http;
15
12
  lib: typeof lib;
16
- serving: typeof serving;
17
13
  }>;
18
14
  /**
19
15
  * A utility for referencing Convex functions in your app's public API.
@@ -35,4 +31,3 @@ export declare const api: FilterApi<typeof fullApi, FunctionReference<any, "publ
35
31
  export declare const internal: FilterApi<typeof fullApi, FunctionReference<any, "internal">>;
36
32
  export declare const components: {};
37
33
  export {};
38
- //# sourceMappingURL=api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/component/_generated/api.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG;AAWH,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,OAAO,GAIR,MAAa,CAAC;AAEnB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,GAAG,GAGZ,MAAa,CAAC;AAElB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAGjB,MAAa,CAAC;AAElB,MAAM,CAAC,MAAM,UAAU,GAAG,iBAAiB,EAAmB,CAAC"}
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/component/_generated/api.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG;AASH,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,OAAO,GAER,MAAa,CAAC;AAEnB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,GAAG,GAGZ,MAAa,CAAC;AAElB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAGjB,MAAa,CAAC;AAElB,MAAM,CAAC,MAAM,UAAU,GAAG,iBAAiB,EAAmB,CAAC"}
@@ -20,24 +20,26 @@ import type { FunctionReference } from "convex/server";
20
20
  */
21
21
  export type ComponentApi<Name extends string | undefined = string | undefined> = {
22
22
  lib: {
23
- getCurrentDeployment: FunctionReference<"query", "internal", {}, {
24
- _creationTime: number;
25
- _id: string;
26
- currentDeploymentId: string;
27
- deployedAt: number;
28
- pendingBlobCleanupCount?: number;
29
- spaFallback?: boolean;
30
- } | null, Name>;
31
- resolveAssetForHttp: FunctionReference<"query", "internal", {
32
- path: string;
33
- spaFallback?: boolean;
23
+ markLive: FunctionReference<"mutation", "internal", {
24
+ expectedNewestLiveAt: number | null;
25
+ versionId: string;
26
+ }, null, Name>;
27
+ route: FunctionReference<"query", "internal", {
28
+ headers: Record<string, string>;
29
+ method: string;
30
+ url: string;
31
+ versionId: string;
34
32
  }, {
35
- appStorageId?: string;
36
- blobId?: string;
37
- contentType: string;
38
- etag?: string;
39
- storageUrl?: string;
40
- } | null, Name>;
33
+ asset: null | {
34
+ bodyUrl: string | null;
35
+ headers: Array<{
36
+ name: string;
37
+ value: string;
38
+ }>;
39
+ status: number;
40
+ };
41
+ newestLiveAt: number | null;
42
+ state: "uploading" | "ready" | "live" | "deleting" | null;
43
+ }, Name>;
41
44
  };
42
45
  };
43
- //# sourceMappingURL=component.d.ts.map
@@ -43,4 +43,3 @@ export type Id<TableName extends TableNames | SystemTableNames> = GenericId<Tabl
43
43
  * `mutationGeneric` to make them type-safe.
44
44
  */
45
45
  export type DataModel = DataModelFromSchemaDefinition<typeof schema>;
46
- //# sourceMappingURL=dataModel.d.ts.map
@@ -8,6 +8,16 @@
8
8
  */
9
9
  import type { ActionBuilder, HttpActionBuilder, MutationBuilder, QueryBuilder, GenericActionCtx, GenericMutationCtx, GenericQueryCtx, GenericDatabaseReader, GenericDatabaseWriter } from "convex/server";
10
10
  import type { DataModel } from "./dataModel.js";
11
+ /**
12
+ * Typesafe environment variables.
13
+ *
14
+ * This includes platform-provided env vars and any variables declared in
15
+ * `convex.config.ts`.
16
+ */
17
+ type Env = {
18
+ readonly CONVEX_CLOUD_URL: string;
19
+ readonly CONVEX_SITE_URL: string;
20
+ };
11
21
  /**
12
22
  * Define a query in this Convex app's public API.
13
23
  *
@@ -75,6 +85,7 @@ export declare const internalAction: ActionBuilder<DataModel, "internal">;
75
85
  * @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
76
86
  */
77
87
  export declare const httpAction: HttpActionBuilder;
88
+ export declare const env: Env;
78
89
  /**
79
90
  * A set of services for use within Convex query functions.
80
91
  *
@@ -118,4 +129,4 @@ export type DatabaseReader = GenericDatabaseReader<DataModel>;
118
129
  * for the guarantees Convex provides your functions.
119
130
  */
120
131
  export type DatabaseWriter = GenericDatabaseWriter<DataModel>;
121
- //# sourceMappingURL=server.d.ts.map
132
+ export {};
@@ -75,4 +75,6 @@ export const internalAction = internalActionGeneric;
75
75
  * @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
76
76
  */
77
77
  export const httpAction = httpActionGeneric;
78
+ export const env = globalThis
79
+ .process.env;
78
80
  //# sourceMappingURL=server.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/component/_generated/server.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG;AAaH,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,eAAe,CAAC;AAGvB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,KAAK,GAAsC,YAAY,CAAC;AAErE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GACxB,oBAAoB,CAAC;AAEvB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAyC,eAAe,CAAC;AAE9E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAC3B,uBAAuB,CAAC;AAE1B;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,MAAM,GAAuC,aAAa,CAAC;AAExE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GACzB,qBAAqB,CAAC;AAExB;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,UAAU,GAAsB,iBAAiB,CAAC"}
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/component/_generated/server.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG;AAaH,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,eAAe,CAAC;AAcvB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,KAAK,GAAsC,YAAY,CAAC;AAErE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GACxB,oBAAoB,CAAC;AAEvB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAyC,eAAe,CAAC;AAE9E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAC3B,uBAAuB,CAAC;AAE1B;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,MAAM,GAAuC,aAAa,CAAC;AAExE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GACzB,qBAAqB,CAAC;AAExB;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,UAAU,GAAsB,iBAAiB,CAAC;AAC/D,MAAM,CAAC,MAAM,GAAG,GAAS,UAAmD;KACzE,OAAO,CAAC,GAAG,CAAC"}
@@ -1,3 +1,2 @@
1
1
  declare const _default: import("convex/server").ComponentDefinition<any, {}>;
2
2
  export default _default;
3
- //# sourceMappingURL=convex.config.d.ts.map