convex 1.43.0-alpha.0 → 1.43.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.
Files changed (54) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/browser.bundle.js +1 -1
  3. package/dist/browser.bundle.js.map +1 -1
  4. package/dist/cjs/cli/lib/localDeployment/run.js +1 -1
  5. package/dist/cjs/cli/lib/localDeployment/run.js.map +2 -2
  6. package/dist/cjs/cli/lib/utils/sentry.js +2 -0
  7. package/dist/cjs/cli/lib/utils/sentry.js.map +2 -2
  8. package/dist/cjs/index.js +1 -1
  9. package/dist/cjs/index.js.map +1 -1
  10. package/dist/cjs/server/database.js.map +1 -1
  11. package/dist/cjs/server/log.js +1 -2
  12. package/dist/cjs/server/log.js.map +2 -2
  13. package/dist/cjs/server/logVars.js +1 -4
  14. package/dist/cjs/server/logVars.js.map +2 -2
  15. package/dist/cjs-types/cli/lib/utils/sentry.d.ts +1 -0
  16. package/dist/cjs-types/cli/lib/utils/sentry.d.ts.map +1 -1
  17. package/dist/cjs-types/index.d.ts +1 -1
  18. package/dist/cjs-types/index.d.ts.map +1 -1
  19. package/dist/cjs-types/server/database.d.ts +14 -0
  20. package/dist/cjs-types/server/database.d.ts.map +1 -1
  21. package/dist/cjs-types/server/log.d.ts.map +1 -1
  22. package/dist/cjs-types/server/logVars.d.ts +0 -6
  23. package/dist/cjs-types/server/logVars.d.ts.map +1 -1
  24. package/dist/cli.bundle.cjs +245 -180
  25. package/dist/cli.bundle.cjs.map +4 -4
  26. package/dist/esm/cli/lib/localDeployment/run.js +2 -2
  27. package/dist/esm/cli/lib/localDeployment/run.js.map +2 -2
  28. package/dist/esm/cli/lib/utils/sentry.js +1 -0
  29. package/dist/esm/cli/lib/utils/sentry.js.map +2 -2
  30. package/dist/esm/index.js +1 -1
  31. package/dist/esm/index.js.map +1 -1
  32. package/dist/esm/server/log.js +2 -3
  33. package/dist/esm/server/log.js.map +2 -2
  34. package/dist/esm/server/logVars.js +1 -3
  35. package/dist/esm/server/logVars.js.map +2 -2
  36. package/dist/esm-types/cli/lib/utils/sentry.d.ts +1 -0
  37. package/dist/esm-types/cli/lib/utils/sentry.d.ts.map +1 -1
  38. package/dist/esm-types/index.d.ts +1 -1
  39. package/dist/esm-types/index.d.ts.map +1 -1
  40. package/dist/esm-types/server/database.d.ts +14 -0
  41. package/dist/esm-types/server/database.d.ts.map +1 -1
  42. package/dist/esm-types/server/log.d.ts.map +1 -1
  43. package/dist/esm-types/server/logVars.d.ts +0 -6
  44. package/dist/esm-types/server/logVars.d.ts.map +1 -1
  45. package/dist/react.bundle.js +1 -1
  46. package/dist/react.bundle.js.map +1 -1
  47. package/package.json +2 -3
  48. package/src/cli/lib/localDeployment/run.ts +2 -2
  49. package/src/cli/lib/utils/sentry.ts +3 -0
  50. package/src/index.ts +1 -1
  51. package/src/server/audit_logging.test.ts +1 -1
  52. package/src/server/database.ts +0 -2
  53. package/src/server/log.ts +1 -4
  54. package/src/server/logVars.ts +0 -7
@@ -144,7 +144,7 @@ async function runLocalBackend(ctx, args) {
144
144
  stdio: "ignore",
145
145
  env: {
146
146
  ...process.env,
147
- SENTRY_DSN: import_sentry.SENTRY_DSN
147
+ SENTRY_DSN: import_sentry.LOCAL_BACKEND_SENTRY_DSN
148
148
  }
149
149
  }).on("exit", (code) => {
150
150
  const why = code === null ? "from signal" : `with code ${code}`;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/cli/lib/localDeployment/run.ts"],
4
- "sourcesContent": ["import { Context } from \"../../../bundler/context.js\";\nimport { logVerbose, logMessage } from \"../../../bundler/log.js\";\nimport {\n LocalDeploymentKind,\n deploymentStateDir,\n loadDeploymentConfig,\n loadUuidForAnonymousUser,\n} from \"./filePaths.js\";\nimport { ensureBackendBinaryDownloaded } from \"./download.js\";\nimport path from \"path\";\nimport child_process from \"child_process\";\nimport detect from \"detect-port\";\nimport { SENTRY_DSN } from \"../utils/sentry.js\";\nimport { createHash } from \"crypto\";\nimport { LocalDeploymentError } from \"./errors.js\";\nimport { LOCAL_BACKEND_INSTANCE_SECRET } from \"./utils.js\";\nimport { DeploymentType, DetailedDeploymentCredentials } from \"../api.js\";\n\nconst DEFAULT_STARTUP_TIMEOUT_SECS = 30;\n\nasync function parseStartupTimeoutSecs(ctx: Context): Promise<number> {\n const raw = process.env.CONVEX_LOCAL_BACKEND_STARTUP_TIMEOUT_SECS;\n if (raw === undefined) {\n return DEFAULT_STARTUP_TIMEOUT_SECS;\n }\n const parsed = Number(raw);\n if (!Number.isFinite(parsed) || parsed <= 0) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: `Invalid CONVEX_LOCAL_BACKEND_STARTUP_TIMEOUT_SECS=${JSON.stringify(raw)}: expected a positive number.`,\n });\n }\n return parsed;\n}\n\nexport async function runLocalBackend(\n ctx: Context,\n args: {\n ports: {\n cloud: number;\n site: number;\n };\n deploymentKind: LocalDeploymentKind;\n deploymentName: string;\n binaryPath: string;\n instanceSecret: string;\n isLatestVersion: boolean;\n },\n): Promise<{\n cleanupHandle: string;\n}> {\n const { ports } = args;\n const deploymentDir = deploymentStateDir(\n ctx,\n args.deploymentKind,\n args.deploymentName,\n );\n ctx.fs.mkdir(deploymentDir, { recursive: true });\n const deploymentNameSha = createHash(\"sha256\")\n .update(args.deploymentName)\n .digest(\"hex\");\n const commandArgs = [\n \"--port\",\n ports.cloud.toString(),\n \"--site-proxy-port\",\n ports.site.toString(),\n \"--sentry-identifier\",\n deploymentNameSha,\n \"--instance-name\",\n args.deploymentName,\n \"--instance-secret\",\n args.instanceSecret,\n \"--local-storage\",\n path.join(deploymentDir, \"convex_local_storage\"),\n \"--beacon-tag\",\n selfHostedEventTag(args.deploymentKind),\n path.join(deploymentDir, \"convex_local_backend.sqlite3\"),\n ];\n if (args.isLatestVersion) {\n // CLI args that were added in later versions of backend go here instead of above\n // since the CLI may run older versions of backend (e.g. when upgrading).\n if (args.deploymentKind === \"anonymous\") {\n const uuid = loadUuidForAnonymousUser(ctx);\n if (uuid !== null) {\n commandArgs.push(\n \"--beacon-fields\",\n JSON.stringify({\n override_uuid: uuid,\n }),\n );\n }\n }\n }\n\n // Check that binary works by running with --help\n try {\n const result = child_process.spawnSync(args.binaryPath, [\n ...commandArgs,\n \"--help\",\n ]);\n if (result.status === 3221225781) {\n const message =\n \"Local backend exited because shared libraries are missing. These may include libraries installed via 'Microsoft Visual C++ Redistributable for Visual Studio.'\";\n return ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: message,\n errForSentry: new LocalDeploymentError(\n \"Local backend exited with code 3221225781\",\n ),\n });\n } else if (result.status !== 0) {\n const message = `Failed to run backend binary, exit code ${result.status}, error: ${result.stderr === null ? \"null\" : result.stderr.toString()}`;\n return ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: message,\n errForSentry: new LocalDeploymentError(message),\n });\n }\n } catch (e) {\n const message = `Failed to run backend binary: ${(e as any).toString()}`;\n return ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: message,\n errForSentry: new LocalDeploymentError(message),\n });\n }\n const commandStr = `${args.binaryPath} ${commandArgs.join(\" \")}`;\n logVerbose(`Starting local backend: \\`${commandStr}\\``);\n const p = child_process\n .spawn(args.binaryPath, commandArgs, {\n stdio: \"ignore\",\n env: {\n ...process.env,\n SENTRY_DSN: SENTRY_DSN,\n },\n })\n .on(\"exit\", (code) => {\n const why = code === null ? \"from signal\" : `with code ${code}`;\n logVerbose(`Local backend exited ${why}, full command \\`${commandStr}\\``);\n });\n const cleanupHandle = ctx.registerCleanup(async () => {\n logVerbose(`Stopping local backend on port ${ports.cloud}`);\n p.kill(\"SIGTERM\");\n });\n\n await ensureBackendRunning(ctx, {\n cloudPort: ports.cloud,\n deploymentName: args.deploymentName,\n maxTimeSecs: await parseStartupTimeoutSecs(ctx),\n });\n\n return {\n cleanupHandle,\n };\n}\n\n/** Crash if correct local backend is not currently listening on the expected port. */\nexport async function assertLocalBackendRunning(\n ctx: Context,\n args: {\n url: string;\n deploymentName: string;\n },\n): Promise<void> {\n logVerbose(`Checking local backend at ${args.url} is running`);\n const result = await fetchLocalBackendStatus(args);\n switch (result.kind) {\n case \"running\":\n return;\n case \"different\":\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: `A different local backend ${result.name} is running at ${args.url}`,\n });\n case \"error\":\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: `Error response code received from local backend ${result.resp.status} ${result.resp.statusText}`,\n });\n case \"not-running\":\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: `Local backend isn't running. (it's not listening at ${args.url})\\nRun \\`npx convex dev\\` in another terminal first.`,\n });\n }\n}\n\n/** Wait for up to maxTimeSecs for the correct local backend to be running on the expected port. */\nexport async function ensureBackendRunning(\n ctx: Context,\n args: {\n cloudPort: number;\n deploymentName: string;\n maxTimeSecs: number;\n },\n): Promise<void> {\n logVerbose(`Ensuring backend running on port ${args.cloudPort} is running`);\n const deploymentUrl = localDeploymentUrl(args.cloudPort);\n let timeElapsedSecs = 0;\n let hasShownWaiting = false;\n while (timeElapsedSecs <= args.maxTimeSecs) {\n if (!hasShownWaiting && timeElapsedSecs > 2) {\n logMessage(\"waiting for local backend to start...\");\n hasShownWaiting = true;\n }\n try {\n const resp = await fetch(`${deploymentUrl}/instance_name`);\n if (resp.status === 200) {\n const text = await resp.text();\n if (text !== args.deploymentName) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: `A different local backend ${text} is running on selected port ${args.cloudPort}`,\n });\n } else {\n // The backend is running!\n return;\n }\n } else {\n await new Promise((resolve) => setTimeout(resolve, 500));\n timeElapsedSecs += 0.5;\n }\n } catch {\n await new Promise((resolve) => setTimeout(resolve, 500));\n timeElapsedSecs += 0.5;\n }\n }\n const base = `Local backend did not start on port ${args.cloudPort} within ${args.maxTimeSecs} seconds.`;\n const message =\n args.maxTimeSecs >= DEFAULT_STARTUP_TIMEOUT_SECS\n ? `${base} If your local database is large, increase the timeout by setting CONVEX_LOCAL_BACKEND_STARTUP_TIMEOUT_SECS (e.g. CONVEX_LOCAL_BACKEND_STARTUP_TIMEOUT_SECS=120).`\n : base;\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: message,\n errForSentry: new LocalDeploymentError(message),\n });\n}\n\nexport async function ensureBackendStopped(\n ctx: Context,\n args: {\n ports: {\n cloud: number;\n site?: number;\n };\n maxTimeSecs: number;\n deploymentName: string;\n // Whether to allow a deployment with a different name to run on this port\n allowOtherDeployments: boolean;\n },\n) {\n logVerbose(`Ensuring backend running on port ${args.ports.cloud} is stopped`);\n let timeElapsedSecs = 0;\n while (timeElapsedSecs < args.maxTimeSecs) {\n const cloudPort = await detect(args.ports.cloud);\n const sitePort =\n args.ports.site === undefined ? undefined : await detect(args.ports.site);\n // Both ports are free\n if (cloudPort === args.ports.cloud && sitePort === args.ports.site) {\n return;\n }\n try {\n const instanceNameResp = await fetch(\n `${localDeploymentUrl(args.ports.cloud)}/instance_name`,\n );\n if (instanceNameResp.ok) {\n const instanceName = await instanceNameResp.text();\n if (instanceName !== args.deploymentName) {\n if (args.allowOtherDeployments) {\n return;\n }\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: `A different local backend ${instanceName} is running on selected port ${args.ports.cloud}`,\n });\n }\n }\n } catch (error: any) {\n logVerbose(`Error checking if backend is running: ${error.message}`);\n // Backend is probably not running\n continue;\n }\n await new Promise((resolve) => setTimeout(resolve, 500));\n timeElapsedSecs += 0.5;\n }\n return ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: `A local backend is still running on port ${args.ports.cloud}. Please stop it and run this command again.`,\n });\n}\n\nexport function localDeploymentUrl(cloudPort: number): string {\n return `http://127.0.0.1:${cloudPort}`;\n}\n\nexport function selfHostedEventTag(\n deploymentKind: LocalDeploymentKind,\n): string {\n return deploymentKind === \"local\" ? \"cli-local-dev\" : \"cli-anonymous-dev\";\n}\n\ntype LocalBackendStatus =\n | { kind: \"running\" }\n | { kind: \"error\"; resp: Response }\n | { kind: \"different\"; name: string }\n | { kind: \"not-running\" };\n\nexport async function fetchLocalBackendStatus(args: {\n url: string;\n deploymentName: string;\n}): Promise<LocalBackendStatus> {\n logVerbose(`Checking local backend at ${args.url} is running`);\n try {\n const resp = await fetch(`${args.url}/instance_name`);\n if (resp.status === 200) {\n const text = await resp.text();\n if (text !== args.deploymentName) {\n return { kind: \"different\", name: text };\n } else {\n return { kind: \"running\" };\n }\n } else {\n return { kind: \"error\", resp };\n }\n } catch {\n return { kind: \"not-running\" };\n }\n}\n\n/** Returns true if the correct local backend is listening. */\nexport async function isLocalBackendRunning(\n url: string,\n deploymentName: string,\n): Promise<boolean> {\n return (\n \"running\" === (await fetchLocalBackendStatus({ url, deploymentName })).kind\n );\n}\n\nexport function shouldUseLocalDeployment(deploymentType: DeploymentType) {\n return deploymentType === \"local\" || deploymentType === \"anonymous\";\n}\n\ninterface WithRunningBackendArgs {\n ctx: Context;\n deployment: {\n deploymentUrl: string;\n deploymentFields: DetailedDeploymentCredentials[\"deploymentFields\"];\n };\n action: () => Promise<void>;\n}\n\n/**\n * If the deployment is a local deployment and not already running, start it\n * for the duration of the action, then stop it.\n */\nexport async function withRunningBackend({\n ctx,\n deployment,\n action,\n}: WithRunningBackendArgs) {\n let cleanup: (() => Promise<void>) | null = null;\n\n if (\n deployment.deploymentFields &&\n shouldUseLocalDeployment(deployment.deploymentFields.deploymentType)\n ) {\n const isRunning = await isLocalBackendRunning(\n deployment.deploymentUrl,\n deployment.deploymentFields.deploymentName,\n );\n if (!isRunning) {\n ({ cleanup } = await startEphemeralLocalBackend(ctx, {\n deploymentType: deployment.deploymentFields.deploymentType,\n deploymentName: deployment.deploymentFields.deploymentName,\n }));\n }\n }\n\n try {\n await action();\n } finally {\n await cleanup?.();\n }\n}\n\n/**\n * Start a local backend for a one-off command using saved deployment config.\n * Returns a cleanup function that stops the backend.\n */\nasync function startEphemeralLocalBackend(\n ctx: Context,\n args: {\n deploymentType: string;\n deploymentName: string;\n },\n): Promise<{ cleanup: () => Promise<void> }> {\n const deploymentKind: LocalDeploymentKind =\n args.deploymentType === \"anonymous\" ? \"anonymous\" : \"local\";\n\n const config = loadDeploymentConfig(ctx, deploymentKind, args.deploymentName);\n if (config === null) {\n return ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: `Local backend isn't running and no saved configuration found.\\nRun \\`npx convex dev\\` first.`,\n });\n }\n\n const { binaryPath } = await ensureBackendBinaryDownloaded(ctx, {\n kind: \"version\",\n version: config.backendVersion,\n });\n\n const instanceSecret = config.instanceSecret ?? LOCAL_BACKEND_INSTANCE_SECRET;\n\n const { cleanupHandle } = await runLocalBackend(ctx, {\n binaryPath,\n ports: config.ports,\n deploymentKind,\n deploymentName: args.deploymentName,\n instanceSecret,\n isLatestVersion: true,\n });\n\n return {\n cleanup: async () => {\n const fn = ctx.removeCleanup(cleanupHandle);\n if (fn) {\n await fn(0);\n }\n },\n };\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,iBAAuC;AACvC,uBAKO;AACP,sBAA8C;AAC9C,kBAAiB;AACjB,2BAA0B;AAC1B,yBAAmB;AACnB,oBAA2B;AAC3B,oBAA2B;AAC3B,oBAAqC;AACrC,mBAA8C;AAG9C,MAAM,+BAA+B;AAErC,eAAe,wBAAwB,KAA+B;AACpE,QAAM,MAAM,QAAQ,IAAI;AACxB,MAAI,QAAQ,QAAW;AACrB,WAAO;AAAA,EACT;AACA,QAAM,SAAS,OAAO,GAAG;AACzB,MAAI,CAAC,OAAO,SAAS,MAAM,KAAK,UAAU,GAAG;AAC3C,WAAO,MAAM,IAAI,MAAM;AAA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M,YAAY,MAAM;AAAA,MACtB,WAAW;AAAA,MACX,WAAW,iBAAiB;AAAA,IAC9B;AACA,QAAI,CAAC,WAAW;AACd,OAAC,EAAE,QAAQ,IAAI,MAAM,2BAA2B,KAAK;AAAA,QACnD,gBAAgB,WAAW,iBAAiB;AAAA,QAC5C,gBAAgB,WAAW,iBAAiB;AAAA,MAC9C,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI;AACF,UAAM,OAAO;AAAA,EACf,UAAE;AACA,UAAM,UAAU;AAAA,EAClB;AACF;AAMA,eAAe,2BACb,KACA,MAI2C;AAC3C,QAAM,iBACJ,KAAK,mBAAmB,cAAc,cAAc;AAEtD,QAAM,aAAS,uCAAqB,KAAK,gBAAgB,KAAK,cAAc;AAC5E,MAAI,WAAW,MAAM;AACnB,WAAO,IAAI,MAAM;AAAA,MACf,UAAU;AAAA,MACV,WAAW;AAAA,MACX,gBAAgB;AAAA;AAAA,IAClB,CAAC;AAAA,EACH;AAEA,QAAM,EAAE,WAAW,IAAI,UAAM,+CAA8B,KAAK;AAAA,IAC9D,MAAM;AAAA,IACN,SAAS,OAAO;AAAA,EAClB,CAAC;AAED,QAAM,iBAAiB,OAAO,kBAAkB;AAEhD,QAAM,EAAE,cAAc,IAAI,MAAM,gBAAgB,KAAK;AAAA,IACnD;AAAA,IACA,OAAO,OAAO;AAAA,IACd;AAAA,IACA,gBAAgB,KAAK;AAAA,IACrB;AAAA,IACA,iBAAiB;AAAA,EACnB,CAAC;AAED,SAAO;AAAA,IACL,SAAS,YAAY;AACnB,YAAM,KAAK,IAAI,cAAc,aAAa;AAC1C,UAAI,IAAI;AACN,cAAM,GAAG,CAAC;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import { Context } from \"../../../bundler/context.js\";\nimport { logVerbose, logMessage } from \"../../../bundler/log.js\";\nimport {\n LocalDeploymentKind,\n deploymentStateDir,\n loadDeploymentConfig,\n loadUuidForAnonymousUser,\n} from \"./filePaths.js\";\nimport { ensureBackendBinaryDownloaded } from \"./download.js\";\nimport path from \"path\";\nimport child_process from \"child_process\";\nimport detect from \"detect-port\";\nimport { LOCAL_BACKEND_SENTRY_DSN } from \"../utils/sentry.js\";\nimport { createHash } from \"crypto\";\nimport { LocalDeploymentError } from \"./errors.js\";\nimport { LOCAL_BACKEND_INSTANCE_SECRET } from \"./utils.js\";\nimport { DeploymentType, DetailedDeploymentCredentials } from \"../api.js\";\n\nconst DEFAULT_STARTUP_TIMEOUT_SECS = 30;\n\nasync function parseStartupTimeoutSecs(ctx: Context): Promise<number> {\n const raw = process.env.CONVEX_LOCAL_BACKEND_STARTUP_TIMEOUT_SECS;\n if (raw === undefined) {\n return DEFAULT_STARTUP_TIMEOUT_SECS;\n }\n const parsed = Number(raw);\n if (!Number.isFinite(parsed) || parsed <= 0) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: `Invalid CONVEX_LOCAL_BACKEND_STARTUP_TIMEOUT_SECS=${JSON.stringify(raw)}: expected a positive number.`,\n });\n }\n return parsed;\n}\n\nexport async function runLocalBackend(\n ctx: Context,\n args: {\n ports: {\n cloud: number;\n site: number;\n };\n deploymentKind: LocalDeploymentKind;\n deploymentName: string;\n binaryPath: string;\n instanceSecret: string;\n isLatestVersion: boolean;\n },\n): Promise<{\n cleanupHandle: string;\n}> {\n const { ports } = args;\n const deploymentDir = deploymentStateDir(\n ctx,\n args.deploymentKind,\n args.deploymentName,\n );\n ctx.fs.mkdir(deploymentDir, { recursive: true });\n const deploymentNameSha = createHash(\"sha256\")\n .update(args.deploymentName)\n .digest(\"hex\");\n const commandArgs = [\n \"--port\",\n ports.cloud.toString(),\n \"--site-proxy-port\",\n ports.site.toString(),\n \"--sentry-identifier\",\n deploymentNameSha,\n \"--instance-name\",\n args.deploymentName,\n \"--instance-secret\",\n args.instanceSecret,\n \"--local-storage\",\n path.join(deploymentDir, \"convex_local_storage\"),\n \"--beacon-tag\",\n selfHostedEventTag(args.deploymentKind),\n path.join(deploymentDir, \"convex_local_backend.sqlite3\"),\n ];\n if (args.isLatestVersion) {\n // CLI args that were added in later versions of backend go here instead of above\n // since the CLI may run older versions of backend (e.g. when upgrading).\n if (args.deploymentKind === \"anonymous\") {\n const uuid = loadUuidForAnonymousUser(ctx);\n if (uuid !== null) {\n commandArgs.push(\n \"--beacon-fields\",\n JSON.stringify({\n override_uuid: uuid,\n }),\n );\n }\n }\n }\n\n // Check that binary works by running with --help\n try {\n const result = child_process.spawnSync(args.binaryPath, [\n ...commandArgs,\n \"--help\",\n ]);\n if (result.status === 3221225781) {\n const message =\n \"Local backend exited because shared libraries are missing. These may include libraries installed via 'Microsoft Visual C++ Redistributable for Visual Studio.'\";\n return ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: message,\n errForSentry: new LocalDeploymentError(\n \"Local backend exited with code 3221225781\",\n ),\n });\n } else if (result.status !== 0) {\n const message = `Failed to run backend binary, exit code ${result.status}, error: ${result.stderr === null ? \"null\" : result.stderr.toString()}`;\n return ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: message,\n errForSentry: new LocalDeploymentError(message),\n });\n }\n } catch (e) {\n const message = `Failed to run backend binary: ${(e as any).toString()}`;\n return ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: message,\n errForSentry: new LocalDeploymentError(message),\n });\n }\n const commandStr = `${args.binaryPath} ${commandArgs.join(\" \")}`;\n logVerbose(`Starting local backend: \\`${commandStr}\\``);\n const p = child_process\n .spawn(args.binaryPath, commandArgs, {\n stdio: \"ignore\",\n env: {\n ...process.env,\n SENTRY_DSN: LOCAL_BACKEND_SENTRY_DSN,\n },\n })\n .on(\"exit\", (code) => {\n const why = code === null ? \"from signal\" : `with code ${code}`;\n logVerbose(`Local backend exited ${why}, full command \\`${commandStr}\\``);\n });\n const cleanupHandle = ctx.registerCleanup(async () => {\n logVerbose(`Stopping local backend on port ${ports.cloud}`);\n p.kill(\"SIGTERM\");\n });\n\n await ensureBackendRunning(ctx, {\n cloudPort: ports.cloud,\n deploymentName: args.deploymentName,\n maxTimeSecs: await parseStartupTimeoutSecs(ctx),\n });\n\n return {\n cleanupHandle,\n };\n}\n\n/** Crash if correct local backend is not currently listening on the expected port. */\nexport async function assertLocalBackendRunning(\n ctx: Context,\n args: {\n url: string;\n deploymentName: string;\n },\n): Promise<void> {\n logVerbose(`Checking local backend at ${args.url} is running`);\n const result = await fetchLocalBackendStatus(args);\n switch (result.kind) {\n case \"running\":\n return;\n case \"different\":\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: `A different local backend ${result.name} is running at ${args.url}`,\n });\n case \"error\":\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: `Error response code received from local backend ${result.resp.status} ${result.resp.statusText}`,\n });\n case \"not-running\":\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: `Local backend isn't running. (it's not listening at ${args.url})\\nRun \\`npx convex dev\\` in another terminal first.`,\n });\n }\n}\n\n/** Wait for up to maxTimeSecs for the correct local backend to be running on the expected port. */\nexport async function ensureBackendRunning(\n ctx: Context,\n args: {\n cloudPort: number;\n deploymentName: string;\n maxTimeSecs: number;\n },\n): Promise<void> {\n logVerbose(`Ensuring backend running on port ${args.cloudPort} is running`);\n const deploymentUrl = localDeploymentUrl(args.cloudPort);\n let timeElapsedSecs = 0;\n let hasShownWaiting = false;\n while (timeElapsedSecs <= args.maxTimeSecs) {\n if (!hasShownWaiting && timeElapsedSecs > 2) {\n logMessage(\"waiting for local backend to start...\");\n hasShownWaiting = true;\n }\n try {\n const resp = await fetch(`${deploymentUrl}/instance_name`);\n if (resp.status === 200) {\n const text = await resp.text();\n if (text !== args.deploymentName) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: `A different local backend ${text} is running on selected port ${args.cloudPort}`,\n });\n } else {\n // The backend is running!\n return;\n }\n } else {\n await new Promise((resolve) => setTimeout(resolve, 500));\n timeElapsedSecs += 0.5;\n }\n } catch {\n await new Promise((resolve) => setTimeout(resolve, 500));\n timeElapsedSecs += 0.5;\n }\n }\n const base = `Local backend did not start on port ${args.cloudPort} within ${args.maxTimeSecs} seconds.`;\n const message =\n args.maxTimeSecs >= DEFAULT_STARTUP_TIMEOUT_SECS\n ? `${base} If your local database is large, increase the timeout by setting CONVEX_LOCAL_BACKEND_STARTUP_TIMEOUT_SECS (e.g. CONVEX_LOCAL_BACKEND_STARTUP_TIMEOUT_SECS=120).`\n : base;\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: message,\n errForSentry: new LocalDeploymentError(message),\n });\n}\n\nexport async function ensureBackendStopped(\n ctx: Context,\n args: {\n ports: {\n cloud: number;\n site?: number;\n };\n maxTimeSecs: number;\n deploymentName: string;\n // Whether to allow a deployment with a different name to run on this port\n allowOtherDeployments: boolean;\n },\n) {\n logVerbose(`Ensuring backend running on port ${args.ports.cloud} is stopped`);\n let timeElapsedSecs = 0;\n while (timeElapsedSecs < args.maxTimeSecs) {\n const cloudPort = await detect(args.ports.cloud);\n const sitePort =\n args.ports.site === undefined ? undefined : await detect(args.ports.site);\n // Both ports are free\n if (cloudPort === args.ports.cloud && sitePort === args.ports.site) {\n return;\n }\n try {\n const instanceNameResp = await fetch(\n `${localDeploymentUrl(args.ports.cloud)}/instance_name`,\n );\n if (instanceNameResp.ok) {\n const instanceName = await instanceNameResp.text();\n if (instanceName !== args.deploymentName) {\n if (args.allowOtherDeployments) {\n return;\n }\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: `A different local backend ${instanceName} is running on selected port ${args.ports.cloud}`,\n });\n }\n }\n } catch (error: any) {\n logVerbose(`Error checking if backend is running: ${error.message}`);\n // Backend is probably not running\n continue;\n }\n await new Promise((resolve) => setTimeout(resolve, 500));\n timeElapsedSecs += 0.5;\n }\n return ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: `A local backend is still running on port ${args.ports.cloud}. Please stop it and run this command again.`,\n });\n}\n\nexport function localDeploymentUrl(cloudPort: number): string {\n return `http://127.0.0.1:${cloudPort}`;\n}\n\nexport function selfHostedEventTag(\n deploymentKind: LocalDeploymentKind,\n): string {\n return deploymentKind === \"local\" ? \"cli-local-dev\" : \"cli-anonymous-dev\";\n}\n\ntype LocalBackendStatus =\n | { kind: \"running\" }\n | { kind: \"error\"; resp: Response }\n | { kind: \"different\"; name: string }\n | { kind: \"not-running\" };\n\nexport async function fetchLocalBackendStatus(args: {\n url: string;\n deploymentName: string;\n}): Promise<LocalBackendStatus> {\n logVerbose(`Checking local backend at ${args.url} is running`);\n try {\n const resp = await fetch(`${args.url}/instance_name`);\n if (resp.status === 200) {\n const text = await resp.text();\n if (text !== args.deploymentName) {\n return { kind: \"different\", name: text };\n } else {\n return { kind: \"running\" };\n }\n } else {\n return { kind: \"error\", resp };\n }\n } catch {\n return { kind: \"not-running\" };\n }\n}\n\n/** Returns true if the correct local backend is listening. */\nexport async function isLocalBackendRunning(\n url: string,\n deploymentName: string,\n): Promise<boolean> {\n return (\n \"running\" === (await fetchLocalBackendStatus({ url, deploymentName })).kind\n );\n}\n\nexport function shouldUseLocalDeployment(deploymentType: DeploymentType) {\n return deploymentType === \"local\" || deploymentType === \"anonymous\";\n}\n\ninterface WithRunningBackendArgs {\n ctx: Context;\n deployment: {\n deploymentUrl: string;\n deploymentFields: DetailedDeploymentCredentials[\"deploymentFields\"];\n };\n action: () => Promise<void>;\n}\n\n/**\n * If the deployment is a local deployment and not already running, start it\n * for the duration of the action, then stop it.\n */\nexport async function withRunningBackend({\n ctx,\n deployment,\n action,\n}: WithRunningBackendArgs) {\n let cleanup: (() => Promise<void>) | null = null;\n\n if (\n deployment.deploymentFields &&\n shouldUseLocalDeployment(deployment.deploymentFields.deploymentType)\n ) {\n const isRunning = await isLocalBackendRunning(\n deployment.deploymentUrl,\n deployment.deploymentFields.deploymentName,\n );\n if (!isRunning) {\n ({ cleanup } = await startEphemeralLocalBackend(ctx, {\n deploymentType: deployment.deploymentFields.deploymentType,\n deploymentName: deployment.deploymentFields.deploymentName,\n }));\n }\n }\n\n try {\n await action();\n } finally {\n await cleanup?.();\n }\n}\n\n/**\n * Start a local backend for a one-off command using saved deployment config.\n * Returns a cleanup function that stops the backend.\n */\nasync function startEphemeralLocalBackend(\n ctx: Context,\n args: {\n deploymentType: string;\n deploymentName: string;\n },\n): Promise<{ cleanup: () => Promise<void> }> {\n const deploymentKind: LocalDeploymentKind =\n args.deploymentType === \"anonymous\" ? \"anonymous\" : \"local\";\n\n const config = loadDeploymentConfig(ctx, deploymentKind, args.deploymentName);\n if (config === null) {\n return ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: `Local backend isn't running and no saved configuration found.\\nRun \\`npx convex dev\\` first.`,\n });\n }\n\n const { binaryPath } = await ensureBackendBinaryDownloaded(ctx, {\n kind: \"version\",\n version: config.backendVersion,\n });\n\n const instanceSecret = config.instanceSecret ?? LOCAL_BACKEND_INSTANCE_SECRET;\n\n const { cleanupHandle } = await runLocalBackend(ctx, {\n binaryPath,\n ports: config.ports,\n deploymentKind,\n deploymentName: args.deploymentName,\n instanceSecret,\n isLatestVersion: true,\n });\n\n return {\n cleanup: async () => {\n const fn = ctx.removeCleanup(cleanupHandle);\n if (fn) {\n await fn(0);\n }\n },\n };\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,iBAAuC;AACvC,uBAKO;AACP,sBAA8C;AAC9C,kBAAiB;AACjB,2BAA0B;AAC1B,yBAAmB;AACnB,oBAAyC;AACzC,oBAA2B;AAC3B,oBAAqC;AACrC,mBAA8C;AAG9C,MAAM,+BAA+B;AAErC,eAAe,wBAAwB,KAA+B;AACpE,QAAM,MAAM,QAAQ,IAAI;AACxB,MAAI,QAAQ,QAAW;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process", "detect"]
7
7
  }
@@ -28,6 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var sentry_exports = {};
30
30
  __export(sentry_exports, {
31
+ LOCAL_BACKEND_SENTRY_DSN: () => LOCAL_BACKEND_SENTRY_DSN,
31
32
  SENTRY_DSN: () => SENTRY_DSN,
32
33
  initSentry: () => initSentry
33
34
  });
@@ -38,6 +39,7 @@ var Sentry = __toESM(require("@sentry/node"), 1);
38
39
  var import__ = require("../../../index.js");
39
40
  var import_util = require("util");
40
41
  const SENTRY_DSN = "https://f9fa0306e3d540079cf40ce8c2ad9644@o1192621.ingest.sentry.io/6390839";
42
+ const LOCAL_BACKEND_SENTRY_DSN = "https://1c77542933b4002e48934a351c84dd38@o1192621.ingest.us.sentry.io/4511826465587200";
41
43
  function initSentry() {
42
44
  if ((!process.env.CI || process.env.VERCEL === "1") && import_config.provisionHost === import_config.productionProvisionHost) {
43
45
  Sentry.init({
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/cli/lib/utils/sentry.ts"],
4
- "sourcesContent": ["import \"@sentry/tracing\";\nimport { productionProvisionHost, provisionHost } from \"../config.js\";\nimport * as Sentry from \"@sentry/node\";\nimport { version } from \"../../../index.js\";\nimport { stripVTControlCharacters } from \"util\";\n\nexport const SENTRY_DSN =\n \"https://f9fa0306e3d540079cf40ce8c2ad9644@o1192621.ingest.sentry.io/6390839\";\n\nexport function initSentry() {\n if (\n (!process.env.CI || process.env.VERCEL === \"1\") &&\n provisionHost === productionProvisionHost\n ) {\n Sentry.init({\n dsn: SENTRY_DSN,\n release: \"cli@\" + version,\n tracesSampleRate: 0.2,\n beforeBreadcrumb: (breadcrumb) => {\n // Strip ANSI color codes from log lines that are sent as breadcrumbs.\n if (breadcrumb.message) {\n breadcrumb.message = stripVTControlCharacters(breadcrumb.message);\n }\n return breadcrumb;\n },\n });\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAO;AACP,oBAAuD;AACvD,aAAwB;AACxB,eAAwB;AACxB,kBAAyC;AAElC,MAAM,aACX;AAEK,SAAS,aAAa;AAC3B,OACG,CAAC,QAAQ,IAAI,MAAM,QAAQ,IAAI,WAAW,QAC3C,gCAAkB,uCAClB;AACA,WAAO,KAAK;AAAA,MACV,KAAK;AAAA,MACL,SAAS,SAAS;AAAA,MAClB,kBAAkB;AAAA,MAClB,kBAAkB,CAAC,eAAe;AAEhC,YAAI,WAAW,SAAS;AACtB,qBAAW,cAAU,sCAAyB,WAAW,OAAO;AAAA,QAClE;AACA,eAAO;AAAA,MACT;AAAA,IACF,CAAC;AAAA,EACH;AACF;",
4
+ "sourcesContent": ["import \"@sentry/tracing\";\nimport { productionProvisionHost, provisionHost } from \"../config.js\";\nimport * as Sentry from \"@sentry/node\";\nimport { version } from \"../../../index.js\";\nimport { stripVTControlCharacters } from \"util\";\n\nexport const SENTRY_DSN =\n \"https://f9fa0306e3d540079cf40ce8c2ad9644@o1192621.ingest.sentry.io/6390839\";\n\nexport const LOCAL_BACKEND_SENTRY_DSN =\n \"https://1c77542933b4002e48934a351c84dd38@o1192621.ingest.us.sentry.io/4511826465587200\";\n\nexport function initSentry() {\n if (\n (!process.env.CI || process.env.VERCEL === \"1\") &&\n provisionHost === productionProvisionHost\n ) {\n Sentry.init({\n dsn: SENTRY_DSN,\n release: \"cli@\" + version,\n tracesSampleRate: 0.2,\n beforeBreadcrumb: (breadcrumb) => {\n // Strip ANSI color codes from log lines that are sent as breadcrumbs.\n if (breadcrumb.message) {\n breadcrumb.message = stripVTControlCharacters(breadcrumb.message);\n }\n return breadcrumb;\n },\n });\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAO;AACP,oBAAuD;AACvD,aAAwB;AACxB,eAAwB;AACxB,kBAAyC;AAElC,MAAM,aACX;AAEK,MAAM,2BACX;AAEK,SAAS,aAAa;AAC3B,OACG,CAAC,QAAQ,IAAI,MAAM,QAAQ,IAAI,WAAW,QAC3C,gCAAkB,uCAClB;AACA,WAAO,KAAK;AAAA,MACV,KAAK;AAAA,MACL,SAAS,SAAS;AAAA,MAClB,kBAAkB;AAAA,MAClB,kBAAkB,CAAC,eAAe;AAEhC,YAAI,WAAW,SAAS;AACtB,qBAAW,cAAU,sCAAyB,WAAW,OAAO;AAAA,QAClE;AACA,eAAO;AAAA,MACT;AAAA,IACF,CAAC;AAAA,EACH;AACF;",
6
6
  "names": []
7
7
  }
package/dist/cjs/index.js CHANGED
@@ -21,5 +21,5 @@ __export(index_exports, {
21
21
  version: () => version
22
22
  });
23
23
  module.exports = __toCommonJS(index_exports);
24
- const version = "1.43.0-alpha.0";
24
+ const version = "1.43.0";
25
25
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["export const version = \"1.43.0-alpha.0\";"],
4
+ "sourcesContent": ["export const version = \"1.43.0\";\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,UAAU;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/server/database.ts"],
4
- "sourcesContent": ["import { GenericId } from \"../values/index.js\";\nimport { CommitTsPlaceholder } from \"../values/value.js\";\nimport {\n DocumentByName,\n GenericDataModel,\n NamedTableInfo,\n TableNamesInDataModel,\n} from \"./data_model.js\";\nimport { QueryInitializer } from \"./query.js\";\nimport { SystemDataModel } from \"./schema.js\";\nimport {\n WithOptionalSystemFields,\n WithoutSystemFields,\n} from \"./system_fields.js\";\n\ninterface BaseDatabaseReader<DataModel extends GenericDataModel> {\n /**\n * Fetch a single document from the database by table name and\n * {@link values.GenericId}.\n *\n * @example\n * ```typescript\n * const user = await ctx.db.get(\"users\", userId);\n * ```\n *\n * @param table - The name of the table to fetch the document from.\n * @param id - The {@link values.GenericId} of the document to fetch from the database.\n * @returns - The {@link GenericDocument} of the document at the given {@link values.GenericId}, or `null` if it no longer exists.\n */\n get<TableName extends TableNamesInDataModel<DataModel>>(\n table: TableName,\n id: GenericId<NonUnion<TableName>>,\n ): Promise<DocumentByName<DataModel, TableName> | null>;\n\n /**\n * Fetch a single document from the database by its {@link values.GenericId}.\n *\n * Supported for backwards compatibility. Prefer `db.get(tableName, id)` in\n * new code, or `db.system.get(tableName, id)` for system tables.\n *\n * @param id - The {@link values.GenericId} of the document to fetch from the database.\n * @returns - The {@link GenericDocument} of the document at the given {@link values.GenericId}, or `null` if it no longer exists.\n */\n get<TableName extends TableNamesInDataModel<DataModel>>(\n id: GenericId<TableName>,\n ): Promise<DocumentByName<DataModel, TableName> | null>;\n\n /**\n * Begin a query for the given table name.\n *\n * Queries don't execute immediately, so calling this method and extending its\n * query are free until the results are actually used.\n *\n * @param tableName - The name of the table to query.\n * @returns - A {@link QueryInitializer} object to start building a query.\n */\n query<TableName extends TableNamesInDataModel<DataModel>>(\n tableName: TableName,\n ): QueryInitializer<NamedTableInfo<DataModel, TableName>>;\n\n /**\n * Returns the string ID format for the ID in a given table, or null if the ID\n * is from a different table or is not a valid ID.\n *\n * This accepts the string ID format as well as the `.toString()` representation\n * of the legacy class-based ID format.\n *\n * This does not guarantee that the ID exists (i.e. `db.get(tableName, id)` may return `null`).\n *\n * @param tableName - The name of the table.\n * @param id - The ID string.\n */\n normalizeId<TableName extends TableNamesInDataModel<DataModel>>(\n tableName: TableName,\n id: string,\n ): GenericId<TableName> | null;\n}\n\ninterface BaseDatabaseReaderWithTable<DataModel extends GenericDataModel> {\n /**\n * Scope the database to a specific table.\n */\n table<TableName extends TableNamesInDataModel<DataModel>>(\n tableName: TableName,\n ): BaseTableReader<DataModel, TableName>;\n}\n\nexport interface BaseTableReader<\n DataModel extends GenericDataModel,\n TableName extends TableNamesInDataModel<DataModel>,\n> {\n /**\n * Fetch a single document from the table by its {@link values.GenericId}.\n *\n * @param id - The {@link values.GenericId} of the document to fetch from the database.\n * @returns - The {@link GenericDocument} of the document at the given {@link values.GenericId}, or `null` if it no longer exists.\n */\n get(\n id: GenericId<TableName>,\n ): Promise<DocumentByName<DataModel, TableName> | null>;\n\n /**\n * Begin a query for the table.\n *\n * Queries don't execute immediately, so calling this method and extending its\n * query are free until the results are actually used.\n *\n * @returns - A {@link QueryInitializer} object to start building a query.\n */\n query(): QueryInitializer<NamedTableInfo<DataModel, TableName>>;\n}\n\n/**\n * An interface to read from the database within Convex query functions.\n *\n * Available as `ctx.db` in queries (read-only) and mutations (read-write).\n * You should generally use the `DatabaseReader` type from\n * `\"./_generated/server\"`.\n *\n * The two entry points are:\n * - {@link GenericDatabaseReader.get}, which fetches a single document\n * by table name and {@link values.GenericId}.\n * - {@link GenericDatabaseReader.query}, which starts building a query.\n *\n * @example\n * ```typescript\n * // Fetch a single document by ID:\n * const user = await ctx.db.get(\"users\", userId);\n *\n * // Query documents with an index:\n * const messages = await ctx.db\n * .query(\"messages\")\n * .withIndex(\"by_channel\", (q) => q.eq(\"channelId\", channelId))\n * .order(\"desc\")\n * .take(50);\n * ```\n *\n * **Best practice:** Use `.withIndex()` instead of `.filter()` for efficient\n * queries. Define indexes in your schema for fields you query frequently.\n *\n * @see https://docs.convex.dev/database/reading-data\n * @public\n */\nexport interface GenericDatabaseReader<\n DataModel extends GenericDataModel,\n> extends BaseDatabaseReader<DataModel> {\n /**\n * An interface to read from the system tables within Convex query functions.\n *\n * System tables include `_storage` (file metadata) and\n * `_scheduled_functions` (scheduled function state). Use `ctx.db.system.get()`\n * and `ctx.db.system.query()` just like regular tables.\n *\n * @example\n * ```typescript\n * // Get file metadata from the _storage system table:\n * const metadata = await ctx.db.system.get(\"_storage\", storageId);\n * // metadata has: _id, _creationTime, contentType, sha256, size\n * ```\n *\n * @public\n */\n system: BaseDatabaseReader<SystemDataModel>;\n}\n\nexport interface GenericDatabaseReaderWithTable<\n DataModel extends GenericDataModel,\n> extends BaseDatabaseReaderWithTable<DataModel> {\n /**\n * An interface to read from the system tables within Convex query functions\n *\n * The two entry points are:\n * - {@link GenericDatabaseReader.get}, which fetches a single document\n * by its {@link values.GenericId}.\n * - {@link GenericDatabaseReader.query}, which starts building a query.\n *\n * @public\n */\n system: BaseDatabaseReaderWithTable<SystemDataModel>;\n}\n\n/**\n * An interface to read from and write to the database within Convex mutation\n * functions.\n *\n * Available as `ctx.db` in mutations. You should generally use the\n * `DatabaseWriter` type from `\"./_generated/server\"`.\n *\n * Extends {@link GenericDatabaseReader}\n * with write operations. All reads and writes within a single mutation are\n * executed **atomically**, you never have to worry about partial writes\n * leaving your data in an inconsistent state.\n *\n * @example\n * ```typescript\n * // Insert a new document:\n * const userId = await ctx.db.insert(\"users\", { name: \"Alice\", email: \"alice@example.com\" });\n *\n * // Update specific fields (shallow merge):\n * await ctx.db.patch(\"users\", userId, { name: \"Alice Smith\" });\n *\n * // Replace entire document (all non-system fields):\n * await ctx.db.replace(\"users\", userId, { name: \"Bob\", email: \"bob@example.com\" });\n *\n * // Delete a document:\n * await ctx.db.delete(\"users\", userId);\n *\n * // Delete multiple documents (collect first, then delete each):\n * const oldTasks = await ctx.db\n * .query(\"tasks\")\n * .withIndex(\"by_completed\", (q) => q.eq(\"completed\", true))\n * .collect();\n * for (const task of oldTasks) {\n * await ctx.db.delete(\"tasks\", task._id);\n * }\n * ```\n *\n * @see https://docs.convex.dev/database/writing-data\n * @public\n */\nexport interface GenericDatabaseWriter<\n DataModel extends GenericDataModel,\n> extends GenericDatabaseReader<DataModel> {\n /**\n * Insert a new document into a table.\n *\n * @example\n * ```typescript\n * const taskId = await ctx.db.insert(\"tasks\", {\n * text: \"Buy groceries\",\n * completed: false,\n * });\n * ```\n *\n * @param table - The name of the table to insert a new document into.\n * @param value - The document to insert. System fields (`_id`, `_creationTime`)\n * are added automatically and should not be included.\n * @returns The {@link values.GenericId} of the new document.\n */\n insert<TableName extends TableNamesInDataModel<DataModel>>(\n table: TableName,\n value: WithoutSystemFields<DocumentByName<DataModel, TableName>>,\n ): Promise<GenericId<TableName>>;\n\n /**\n * Patch an existing document, shallow merging it with the given partial\n * document.\n *\n * New fields are added. Existing fields are overwritten. Fields set to\n * `undefined` are removed. Fields not specified in the patch are left\n * unchanged.\n *\n * This method will throw if the document does not exist.\n *\n * @example\n * ```typescript\n * // Update only the \"completed\" field, leaving other fields unchanged:\n * await ctx.db.patch(\"tasks\", taskId, { completed: true });\n *\n * // Remove an optional field by setting it to undefined:\n * await ctx.db.patch(\"tasks\", taskId, { assignee: undefined });\n * ```\n *\n * **Tip:** Use `patch` for partial updates. Use `replace` when you want to\n * overwrite the entire document.\n *\n * @param table - The name of the table the document is in.\n * @param id - The {@link values.GenericId} of the document to patch.\n * @param value - The partial document to merge into the existing document.\n */\n patch<TableName extends TableNamesInDataModel<DataModel>>(\n table: TableName,\n id: GenericId<NonUnion<TableName>>,\n value: PatchValue<DocumentByName<DataModel, TableName>>,\n ): Promise<void>;\n\n /**\n * Patch an existing document, shallow merging it with the given partial\n * document.\n *\n * New fields are added. Existing fields are overwritten. Fields set to\n * `undefined` are removed. Fields not specified in the patch are left\n * unchanged.\n *\n * This method will throw if the document does not exist.\n *\n * Supported for backwards compatibility. Prefer `db.patch(tableName, id, value)`\n * in new code.\n *\n * @param id - The {@link values.GenericId} of the document to patch.\n * @param value - The partial document to merge into the existing document.\n */\n patch<TableName extends TableNamesInDataModel<DataModel>>(\n id: GenericId<TableName>,\n value: PatchValue<DocumentByName<DataModel, TableName>>,\n ): Promise<void>;\n\n /**\n * Replace the value of an existing document, overwriting its old value\n * completely.\n *\n * Unlike `patch`, which does a shallow merge, `replace` overwrites the\n * entire document. Any fields not included in the new value will be removed\n * (except system fields `_id` and `_creationTime`).\n *\n * This method will throw if the document does not exist.\n *\n * @example\n * ```typescript\n * // Replace the entire document:\n * await ctx.db.replace(\"users\", userId, {\n * name: \"New Name\",\n * email: \"new@example.com\",\n * });\n * ```\n *\n * @param table - The name of the table the document is in.\n * @param id - The {@link values.GenericId} of the document to replace.\n * @param value - The new document. System fields can be omitted.\n */\n replace<TableName extends TableNamesInDataModel<DataModel>>(\n table: TableName,\n id: GenericId<NonUnion<TableName>>,\n value: WithOptionalSystemFields<DocumentByName<DataModel, TableName>>,\n ): Promise<void>;\n\n /**\n * Replace the value of an existing document, overwriting its old value\n * completely.\n *\n * Unlike `patch`, which does a shallow merge, `replace` overwrites the\n * entire document.\n *\n * Supported for backwards compatibility. Prefer `db.replace(tableName, id, value)`\n * in new code.\n *\n * @param id - The {@link values.GenericId} of the document to replace.\n * @param value - The new document. System fields can be omitted.\n */\n replace<TableName extends TableNamesInDataModel<DataModel>>(\n id: GenericId<TableName>,\n value: WithOptionalSystemFields<DocumentByName<DataModel, TableName>>,\n ): Promise<void>;\n\n /**\n * Delete an existing document.\n *\n * @example\n * ```typescript\n * await ctx.db.delete(\"tasks\", taskId);\n * ```\n *\n * @param table - The name of the table the document is in.\n * @param id - The {@link values.GenericId} of the document to remove.\n */\n delete<TableName extends TableNamesInDataModel<DataModel>>(\n table: TableName,\n id: GenericId<NonUnion<TableName>>,\n ): Promise<void>;\n\n /**\n * Delete an existing document.\n *\n * Supported for backwards compatibility. Prefer `db.delete(tableName, id)` in\n * new code.\n *\n * **Note:** Convex queries do not support `.delete()` directly on query\n * results. To delete multiple documents, `.collect()` them first, then\n * delete each one individually.\n *\n * @param id - The {@link values.GenericId} of the document to remove.\n */\n delete(id: GenericId<TableNamesInDataModel<DataModel>>): Promise<void>;\n\n /**\n * Values that are not known until the mutation commits.\n *\n * @internal\n */\n vars: {\n /**\n * The placeholder for the transaction's commit timestamp. Written into a\n * document field via `db.insert`, it resolves at commit to an int64\n * (`bigint`) ordered by commit order. Within the writing mutation,\n * reading the field back yields the placeholder, which cannot be used as\n * a number.\n */\n commitTs: CommitTsPlaceholder;\n };\n}\n\n/**\n * An interface to read from and write to the database within Convex mutation\n * functions.\n *\n * You should generally use the `DatabaseWriter` type from\n * `\"./_generated/server\"`.\n *\n * Convex guarantees that all writes within a single mutation are\n * executed atomically, so you never have to worry about partial writes leaving\n * your data in an inconsistent state. See [the Convex Guide](https://docs.convex.dev/understanding/convex-fundamentals/functions#atomicity-and-optimistic-concurrency-control)\n * for the guarantees Convex provides your functions.\n *\n * @public\n */\nexport interface GenericDatabaseWriterWithTable<\n DataModel extends GenericDataModel,\n> extends GenericDatabaseReaderWithTable<DataModel> {\n /**\n * Scope the database to a specific table.\n */\n table<TableName extends TableNamesInDataModel<DataModel>>(\n tableName: TableName,\n ): BaseTableWriter<DataModel, TableName>;\n}\n\nexport interface BaseTableWriter<\n DataModel extends GenericDataModel,\n TableName extends TableNamesInDataModel<DataModel>,\n> extends BaseTableReader<DataModel, TableName> {\n /**\n * Insert a new document into the table.\n *\n * @param value - The {@link values.Value} to insert into the given table.\n * @returns - {@link values.GenericId} of the new document.\n */\n insert(\n value: WithoutSystemFields<DocumentByName<DataModel, TableName>>,\n ): Promise<GenericId<TableName>>;\n\n /**\n * Patch an existing document, shallow merging it with the given partial\n * document.\n *\n * New fields are added. Existing fields are overwritten. Fields set to\n * `undefined` are removed.\n *\n * @param id - The {@link values.GenericId} of the document to patch.\n * @param value - The partial {@link GenericDocument} to merge into the specified document. If this new value\n * specifies system fields like `_id`, they must match the document's existing field values.\n */\n patch(\n id: GenericId<TableName>,\n value: PatchValue<DocumentByName<DataModel, TableName>>,\n ): Promise<void>;\n\n /**\n * Replace the value of an existing document, overwriting its old value.\n *\n * @param id - The {@link values.GenericId} of the document to replace.\n * @param value - The new {@link GenericDocument} for the document. This value can omit the system fields,\n * and the database will fill them in.\n */\n replace(\n id: GenericId<TableName>,\n value: WithOptionalSystemFields<DocumentByName<DataModel, TableName>>,\n ): Promise<void>;\n\n /**\n * Delete an existing document.\n *\n * @param id - The {@link values.GenericId} of the document to remove.\n */\n delete(id: GenericId<TableName>): Promise<void>;\n}\n\n/**\n * This prevents TypeScript from inferring that the generic `TableName` type is\n * a union type when `table` and `id` disagree.\n */\ntype NonUnion<T> = T extends never // `never` is the bottom type for TypeScript unions\n ? never\n : T;\n\n/**\n * This is like Partial, but it also allows undefined to be passed to optional\n * fields when `exactOptionalPropertyTypes` is enabled in the tsconfig.\n */\ntype PatchValue<T> = {\n [P in keyof T]?: undefined extends T[P] ? T[P] | undefined : T[P];\n};\n"],
4
+ "sourcesContent": ["import { GenericId } from \"../values/index.js\";\nimport { CommitTsPlaceholder } from \"../values/value.js\";\nimport {\n DocumentByName,\n GenericDataModel,\n NamedTableInfo,\n TableNamesInDataModel,\n} from \"./data_model.js\";\nimport { QueryInitializer } from \"./query.js\";\nimport { SystemDataModel } from \"./schema.js\";\nimport {\n WithOptionalSystemFields,\n WithoutSystemFields,\n} from \"./system_fields.js\";\n\ninterface BaseDatabaseReader<DataModel extends GenericDataModel> {\n /**\n * Fetch a single document from the database by table name and\n * {@link values.GenericId}.\n *\n * @example\n * ```typescript\n * const user = await ctx.db.get(\"users\", userId);\n * ```\n *\n * @param table - The name of the table to fetch the document from.\n * @param id - The {@link values.GenericId} of the document to fetch from the database.\n * @returns - The {@link GenericDocument} of the document at the given {@link values.GenericId}, or `null` if it no longer exists.\n */\n get<TableName extends TableNamesInDataModel<DataModel>>(\n table: TableName,\n id: GenericId<NonUnion<TableName>>,\n ): Promise<DocumentByName<DataModel, TableName> | null>;\n\n /**\n * Fetch a single document from the database by its {@link values.GenericId}.\n *\n * Supported for backwards compatibility. Prefer `db.get(tableName, id)` in\n * new code, or `db.system.get(tableName, id)` for system tables.\n *\n * @param id - The {@link values.GenericId} of the document to fetch from the database.\n * @returns - The {@link GenericDocument} of the document at the given {@link values.GenericId}, or `null` if it no longer exists.\n */\n get<TableName extends TableNamesInDataModel<DataModel>>(\n id: GenericId<TableName>,\n ): Promise<DocumentByName<DataModel, TableName> | null>;\n\n /**\n * Begin a query for the given table name.\n *\n * Queries don't execute immediately, so calling this method and extending its\n * query are free until the results are actually used.\n *\n * @param tableName - The name of the table to query.\n * @returns - A {@link QueryInitializer} object to start building a query.\n */\n query<TableName extends TableNamesInDataModel<DataModel>>(\n tableName: TableName,\n ): QueryInitializer<NamedTableInfo<DataModel, TableName>>;\n\n /**\n * Returns the string ID format for the ID in a given table, or null if the ID\n * is from a different table or is not a valid ID.\n *\n * This accepts the string ID format as well as the `.toString()` representation\n * of the legacy class-based ID format.\n *\n * This does not guarantee that the ID exists (i.e. `db.get(tableName, id)` may return `null`).\n *\n * @param tableName - The name of the table.\n * @param id - The ID string.\n */\n normalizeId<TableName extends TableNamesInDataModel<DataModel>>(\n tableName: TableName,\n id: string,\n ): GenericId<TableName> | null;\n}\n\ninterface BaseDatabaseReaderWithTable<DataModel extends GenericDataModel> {\n /**\n * Scope the database to a specific table.\n */\n table<TableName extends TableNamesInDataModel<DataModel>>(\n tableName: TableName,\n ): BaseTableReader<DataModel, TableName>;\n}\n\nexport interface BaseTableReader<\n DataModel extends GenericDataModel,\n TableName extends TableNamesInDataModel<DataModel>,\n> {\n /**\n * Fetch a single document from the table by its {@link values.GenericId}.\n *\n * @param id - The {@link values.GenericId} of the document to fetch from the database.\n * @returns - The {@link GenericDocument} of the document at the given {@link values.GenericId}, or `null` if it no longer exists.\n */\n get(\n id: GenericId<TableName>,\n ): Promise<DocumentByName<DataModel, TableName> | null>;\n\n /**\n * Begin a query for the table.\n *\n * Queries don't execute immediately, so calling this method and extending its\n * query are free until the results are actually used.\n *\n * @returns - A {@link QueryInitializer} object to start building a query.\n */\n query(): QueryInitializer<NamedTableInfo<DataModel, TableName>>;\n}\n\n/**\n * An interface to read from the database within Convex query functions.\n *\n * Available as `ctx.db` in queries (read-only) and mutations (read-write).\n * You should generally use the `DatabaseReader` type from\n * `\"./_generated/server\"`.\n *\n * The two entry points are:\n * - {@link GenericDatabaseReader.get}, which fetches a single document\n * by table name and {@link values.GenericId}.\n * - {@link GenericDatabaseReader.query}, which starts building a query.\n *\n * @example\n * ```typescript\n * // Fetch a single document by ID:\n * const user = await ctx.db.get(\"users\", userId);\n *\n * // Query documents with an index:\n * const messages = await ctx.db\n * .query(\"messages\")\n * .withIndex(\"by_channel\", (q) => q.eq(\"channelId\", channelId))\n * .order(\"desc\")\n * .take(50);\n * ```\n *\n * **Best practice:** Use `.withIndex()` instead of `.filter()` for efficient\n * queries. Define indexes in your schema for fields you query frequently.\n *\n * @see https://docs.convex.dev/database/reading-data\n * @public\n */\nexport interface GenericDatabaseReader<\n DataModel extends GenericDataModel,\n> extends BaseDatabaseReader<DataModel> {\n /**\n * An interface to read from the system tables within Convex query functions.\n *\n * System tables include `_storage` (file metadata) and\n * `_scheduled_functions` (scheduled function state). Use `ctx.db.system.get()`\n * and `ctx.db.system.query()` just like regular tables.\n *\n * @example\n * ```typescript\n * // Get file metadata from the _storage system table:\n * const metadata = await ctx.db.system.get(\"_storage\", storageId);\n * // metadata has: _id, _creationTime, contentType, sha256, size\n * ```\n *\n * @public\n */\n system: BaseDatabaseReader<SystemDataModel>;\n}\n\nexport interface GenericDatabaseReaderWithTable<\n DataModel extends GenericDataModel,\n> extends BaseDatabaseReaderWithTable<DataModel> {\n /**\n * An interface to read from the system tables within Convex query functions\n *\n * The two entry points are:\n * - {@link GenericDatabaseReader.get}, which fetches a single document\n * by its {@link values.GenericId}.\n * - {@link GenericDatabaseReader.query}, which starts building a query.\n *\n * @public\n */\n system: BaseDatabaseReaderWithTable<SystemDataModel>;\n}\n\n/**\n * An interface to read from and write to the database within Convex mutation\n * functions.\n *\n * Available as `ctx.db` in mutations. You should generally use the\n * `DatabaseWriter` type from `\"./_generated/server\"`.\n *\n * Extends {@link GenericDatabaseReader}\n * with write operations. All reads and writes within a single mutation are\n * executed **atomically**, you never have to worry about partial writes\n * leaving your data in an inconsistent state.\n *\n * @example\n * ```typescript\n * // Insert a new document:\n * const userId = await ctx.db.insert(\"users\", { name: \"Alice\", email: \"alice@example.com\" });\n *\n * // Update specific fields (shallow merge):\n * await ctx.db.patch(\"users\", userId, { name: \"Alice Smith\" });\n *\n * // Replace entire document (all non-system fields):\n * await ctx.db.replace(\"users\", userId, { name: \"Bob\", email: \"bob@example.com\" });\n *\n * // Delete a document:\n * await ctx.db.delete(\"users\", userId);\n *\n * // Delete multiple documents (collect first, then delete each):\n * const oldTasks = await ctx.db\n * .query(\"tasks\")\n * .withIndex(\"by_completed\", (q) => q.eq(\"completed\", true))\n * .collect();\n * for (const task of oldTasks) {\n * await ctx.db.delete(\"tasks\", task._id);\n * }\n * ```\n *\n * @see https://docs.convex.dev/database/writing-data\n * @public\n */\nexport interface GenericDatabaseWriter<\n DataModel extends GenericDataModel,\n> extends GenericDatabaseReader<DataModel> {\n /**\n * Insert a new document into a table.\n *\n * @example\n * ```typescript\n * const taskId = await ctx.db.insert(\"tasks\", {\n * text: \"Buy groceries\",\n * completed: false,\n * });\n * ```\n *\n * @param table - The name of the table to insert a new document into.\n * @param value - The document to insert. System fields (`_id`, `_creationTime`)\n * are added automatically and should not be included.\n * @returns The {@link values.GenericId} of the new document.\n */\n insert<TableName extends TableNamesInDataModel<DataModel>>(\n table: TableName,\n value: WithoutSystemFields<DocumentByName<DataModel, TableName>>,\n ): Promise<GenericId<TableName>>;\n\n /**\n * Patch an existing document, shallow merging it with the given partial\n * document.\n *\n * New fields are added. Existing fields are overwritten. Fields set to\n * `undefined` are removed. Fields not specified in the patch are left\n * unchanged.\n *\n * This method will throw if the document does not exist.\n *\n * @example\n * ```typescript\n * // Update only the \"completed\" field, leaving other fields unchanged:\n * await ctx.db.patch(\"tasks\", taskId, { completed: true });\n *\n * // Remove an optional field by setting it to undefined:\n * await ctx.db.patch(\"tasks\", taskId, { assignee: undefined });\n * ```\n *\n * **Tip:** Use `patch` for partial updates. Use `replace` when you want to\n * overwrite the entire document.\n *\n * @param table - The name of the table the document is in.\n * @param id - The {@link values.GenericId} of the document to patch.\n * @param value - The partial document to merge into the existing document.\n */\n patch<TableName extends TableNamesInDataModel<DataModel>>(\n table: TableName,\n id: GenericId<NonUnion<TableName>>,\n value: PatchValue<DocumentByName<DataModel, TableName>>,\n ): Promise<void>;\n\n /**\n * Patch an existing document, shallow merging it with the given partial\n * document.\n *\n * New fields are added. Existing fields are overwritten. Fields set to\n * `undefined` are removed. Fields not specified in the patch are left\n * unchanged.\n *\n * This method will throw if the document does not exist.\n *\n * Supported for backwards compatibility. Prefer `db.patch(tableName, id, value)`\n * in new code.\n *\n * @param id - The {@link values.GenericId} of the document to patch.\n * @param value - The partial document to merge into the existing document.\n */\n patch<TableName extends TableNamesInDataModel<DataModel>>(\n id: GenericId<TableName>,\n value: PatchValue<DocumentByName<DataModel, TableName>>,\n ): Promise<void>;\n\n /**\n * Replace the value of an existing document, overwriting its old value\n * completely.\n *\n * Unlike `patch`, which does a shallow merge, `replace` overwrites the\n * entire document. Any fields not included in the new value will be removed\n * (except system fields `_id` and `_creationTime`).\n *\n * This method will throw if the document does not exist.\n *\n * @example\n * ```typescript\n * // Replace the entire document:\n * await ctx.db.replace(\"users\", userId, {\n * name: \"New Name\",\n * email: \"new@example.com\",\n * });\n * ```\n *\n * @param table - The name of the table the document is in.\n * @param id - The {@link values.GenericId} of the document to replace.\n * @param value - The new document. System fields can be omitted.\n */\n replace<TableName extends TableNamesInDataModel<DataModel>>(\n table: TableName,\n id: GenericId<NonUnion<TableName>>,\n value: WithOptionalSystemFields<DocumentByName<DataModel, TableName>>,\n ): Promise<void>;\n\n /**\n * Replace the value of an existing document, overwriting its old value\n * completely.\n *\n * Unlike `patch`, which does a shallow merge, `replace` overwrites the\n * entire document.\n *\n * Supported for backwards compatibility. Prefer `db.replace(tableName, id, value)`\n * in new code.\n *\n * @param id - The {@link values.GenericId} of the document to replace.\n * @param value - The new document. System fields can be omitted.\n */\n replace<TableName extends TableNamesInDataModel<DataModel>>(\n id: GenericId<TableName>,\n value: WithOptionalSystemFields<DocumentByName<DataModel, TableName>>,\n ): Promise<void>;\n\n /**\n * Delete an existing document.\n *\n * @example\n * ```typescript\n * await ctx.db.delete(\"tasks\", taskId);\n * ```\n *\n * @param table - The name of the table the document is in.\n * @param id - The {@link values.GenericId} of the document to remove.\n */\n delete<TableName extends TableNamesInDataModel<DataModel>>(\n table: TableName,\n id: GenericId<NonUnion<TableName>>,\n ): Promise<void>;\n\n /**\n * Delete an existing document.\n *\n * Supported for backwards compatibility. Prefer `db.delete(tableName, id)` in\n * new code.\n *\n * **Note:** Convex queries do not support `.delete()` directly on query\n * results. To delete multiple documents, `.collect()` them first, then\n * delete each one individually.\n *\n * @param id - The {@link values.GenericId} of the document to remove.\n */\n delete(id: GenericId<TableNamesInDataModel<DataModel>>): Promise<void>;\n\n /**\n * Values that are not known until the mutation commits.\n */\n vars: {\n /**\n * The placeholder for the transaction's commit timestamp. Written into a\n * document field via `db.insert`, it resolves at commit to an int64\n * (`bigint`) ordered by commit order. Within the writing mutation,\n * reading the field back yields the placeholder, which cannot be used as\n * a number.\n */\n commitTs: CommitTsPlaceholder;\n };\n}\n\n/**\n * An interface to read from and write to the database within Convex mutation\n * functions.\n *\n * You should generally use the `DatabaseWriter` type from\n * `\"./_generated/server\"`.\n *\n * Convex guarantees that all writes within a single mutation are\n * executed atomically, so you never have to worry about partial writes leaving\n * your data in an inconsistent state. See [the Convex Guide](https://docs.convex.dev/understanding/convex-fundamentals/functions#atomicity-and-optimistic-concurrency-control)\n * for the guarantees Convex provides your functions.\n *\n * @public\n */\nexport interface GenericDatabaseWriterWithTable<\n DataModel extends GenericDataModel,\n> extends GenericDatabaseReaderWithTable<DataModel> {\n /**\n * Scope the database to a specific table.\n */\n table<TableName extends TableNamesInDataModel<DataModel>>(\n tableName: TableName,\n ): BaseTableWriter<DataModel, TableName>;\n}\n\nexport interface BaseTableWriter<\n DataModel extends GenericDataModel,\n TableName extends TableNamesInDataModel<DataModel>,\n> extends BaseTableReader<DataModel, TableName> {\n /**\n * Insert a new document into the table.\n *\n * @param value - The {@link values.Value} to insert into the given table.\n * @returns - {@link values.GenericId} of the new document.\n */\n insert(\n value: WithoutSystemFields<DocumentByName<DataModel, TableName>>,\n ): Promise<GenericId<TableName>>;\n\n /**\n * Patch an existing document, shallow merging it with the given partial\n * document.\n *\n * New fields are added. Existing fields are overwritten. Fields set to\n * `undefined` are removed.\n *\n * @param id - The {@link values.GenericId} of the document to patch.\n * @param value - The partial {@link GenericDocument} to merge into the specified document. If this new value\n * specifies system fields like `_id`, they must match the document's existing field values.\n */\n patch(\n id: GenericId<TableName>,\n value: PatchValue<DocumentByName<DataModel, TableName>>,\n ): Promise<void>;\n\n /**\n * Replace the value of an existing document, overwriting its old value.\n *\n * @param id - The {@link values.GenericId} of the document to replace.\n * @param value - The new {@link GenericDocument} for the document. This value can omit the system fields,\n * and the database will fill them in.\n */\n replace(\n id: GenericId<TableName>,\n value: WithOptionalSystemFields<DocumentByName<DataModel, TableName>>,\n ): Promise<void>;\n\n /**\n * Delete an existing document.\n *\n * @param id - The {@link values.GenericId} of the document to remove.\n */\n delete(id: GenericId<TableName>): Promise<void>;\n}\n\n/**\n * This prevents TypeScript from inferring that the generic `TableName` type is\n * a union type when `table` and `id` disagree.\n */\ntype NonUnion<T> = T extends never // `never` is the bottom type for TypeScript unions\n ? never\n : T;\n\n/**\n * This is like Partial, but it also allows undefined to be passed to optional\n * fields when `exactOptionalPropertyTypes` is enabled in the tsconfig.\n */\ntype PatchValue<T> = {\n [P in keyof T]?: undefined extends T[P] ? T[P] | undefined : T[P];\n};\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -25,7 +25,6 @@ var import_audit_logging = require("./audit_logging.js");
25
25
  var import_logVars = require("./logVars.js");
26
26
  const log = {
27
27
  audit: import_audit_logging.audit,
28
- vars: import_logVars.vars,
29
- internalVars: import_logVars.internalVars
28
+ vars: import_logVars.vars
30
29
  };
31
30
  //# sourceMappingURL=log.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/server/log.ts"],
4
- "sourcesContent": ["import { audit } from \"./audit_logging.js\";\nimport { internalVars, vars } from \"./logVars.js\";\n\n// Type annotations are needed for the `unique symbol` types in `vars` to typecheck correctly\ninterface Log {\n /**\n * Emit a durable audit log. This functionality is only available for Convex\n * Enterprise (see https://www.convex.dev/enterprise/pricing).\n *\n * Use dynamic variables from `log.vars` to include deferred values that will\n * be resolved when emitting the log. Cached query hits will replay audit logs\n * with updated values.\n * ```ts\n * await log.audit({\n * action: \"document.viewed\",\n * actor: { userId },\n * source: {\n * ip: log.vars.ip,\n * userAgent: log.vars.userAgent,\n * },\n * timestamp: log.vars.now,\n * });\n * ```\n *\n * The log body must be JSON-serializable.\n */\n audit: typeof audit;\n vars: typeof vars;\n /** @internal */\n internalVars: typeof internalVars;\n}\n\nexport const log: Log = {\n audit,\n vars,\n internalVars,\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAsB;AACtB,qBAAmC;AA+B5B,MAAM,MAAW;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AACF;",
4
+ "sourcesContent": ["import { audit } from \"./audit_logging.js\";\nimport { vars } from \"./logVars.js\";\n\n// Type annotations are needed for the `unique symbol` types in `vars` to typecheck correctly\ninterface Log {\n /**\n * Emit a durable audit log. This functionality is only available for Convex\n * Enterprise (see https://www.convex.dev/enterprise/pricing).\n *\n * Use dynamic variables from `log.vars` to include deferred values that will\n * be resolved when emitting the log. Cached query hits will replay audit logs\n * with updated values.\n * ```ts\n * await log.audit({\n * action: \"document.viewed\",\n * actor: { userId },\n * source: {\n * ip: log.vars.ip,\n * userAgent: log.vars.userAgent,\n * },\n * timestamp: log.vars.now,\n * });\n * ```\n *\n * The log body must be JSON-serializable.\n */\n audit: typeof audit;\n vars: typeof vars;\n}\n\nexport const log: Log = {\n audit,\n vars,\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAsB;AACtB,qBAAqB;AA6Bd,MAAM,MAAW;AAAA,EACtB;AAAA,EACA;AACF;",
6
6
  "names": []
7
7
  }
@@ -18,7 +18,6 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var logVars_exports = {};
20
20
  __export(logVars_exports, {
21
- internalVars: () => internalVars,
22
21
  varNames: () => varNames,
23
22
  vars: () => vars
24
23
  });
@@ -46,9 +45,7 @@ const vars = {
46
45
  * Resolved to the current server timestamp, as milliseconds from the
47
46
  * Unix epoch.
48
47
  */
49
- now: NOW
50
- };
51
- const internalVars = {
48
+ now: NOW,
52
49
  /**
53
50
  * If the function was invoked using admin auth (either directly or while
54
51
  * acting as an end user, e.g. from the dashboard), resolved to information
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/server/logVars.ts"],
4
- "sourcesContent": ["const REQUEST_ID = Symbol(\"var.requestId\");\nconst IP = Symbol(\"var.ip\");\nconst USER_AGENT = Symbol(\"var.userAgent\");\nconst NOW = Symbol(\"var.now\");\nconst CONVEX_ACTOR = Symbol(\"var.convexActor\");\n\nexport type LogVar =\n | typeof REQUEST_ID\n | typeof IP\n | typeof USER_AGENT\n | typeof NOW\n | typeof CONVEX_ACTOR;\n\nexport const varNames: Record<symbol, string> = {\n [REQUEST_ID]: \"requestId\",\n [IP]: \"ip\",\n [USER_AGENT]: \"userAgent\",\n [NOW]: \"now\",\n [CONVEX_ACTOR]: \"convexActor\",\n};\n\nexport const vars = {\n /** Resolved to the request ID. */\n requestId: REQUEST_ID,\n /** Resolved to the client's IP address. */\n ip: IP,\n /** Resolved to the client's User-Agent header. */\n userAgent: USER_AGENT,\n /**\n * Resolved to the current server timestamp, as milliseconds from the\n * Unix epoch.\n */\n now: NOW,\n} as const;\n\n/**\n * Internal-only log vars, surfaced via `log.internalVars`. These are kept out\n * of the public `log.vars` surface.\n */\nexport const internalVars = {\n /**\n * If the function was invoked using admin auth (either directly or while\n * acting as an end user, e.g. from the dashboard), resolved to information\n * about the admin. Otherwise, resolved to `null`.\n */\n convexActor: CONVEX_ACTOR,\n} as const;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAAM,aAAa,OAAO,eAAe;AACzC,MAAM,KAAK,OAAO,QAAQ;AAC1B,MAAM,aAAa,OAAO,eAAe;AACzC,MAAM,MAAM,OAAO,SAAS;AAC5B,MAAM,eAAe,OAAO,iBAAiB;AAStC,MAAM,WAAmC;AAAA,EAC9C,CAAC,UAAU,GAAG;AAAA,EACd,CAAC,EAAE,GAAG;AAAA,EACN,CAAC,UAAU,GAAG;AAAA,EACd,CAAC,GAAG,GAAG;AAAA,EACP,CAAC,YAAY,GAAG;AAClB;AAEO,MAAM,OAAO;AAAA;AAAA,EAElB,WAAW;AAAA;AAAA,EAEX,IAAI;AAAA;AAAA,EAEJ,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA,EAKX,KAAK;AACP;AAMO,MAAM,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM1B,aAAa;AACf;",
4
+ "sourcesContent": ["const REQUEST_ID = Symbol(\"var.requestId\");\nconst IP = Symbol(\"var.ip\");\nconst USER_AGENT = Symbol(\"var.userAgent\");\nconst NOW = Symbol(\"var.now\");\nconst CONVEX_ACTOR = Symbol(\"var.convexActor\");\n\nexport type LogVar =\n | typeof REQUEST_ID\n | typeof IP\n | typeof USER_AGENT\n | typeof NOW\n | typeof CONVEX_ACTOR;\n\nexport const varNames: Record<symbol, string> = {\n [REQUEST_ID]: \"requestId\",\n [IP]: \"ip\",\n [USER_AGENT]: \"userAgent\",\n [NOW]: \"now\",\n [CONVEX_ACTOR]: \"convexActor\",\n};\n\nexport const vars = {\n /** Resolved to the request ID. */\n requestId: REQUEST_ID,\n /** Resolved to the client's IP address. */\n ip: IP,\n /** Resolved to the client's User-Agent header. */\n userAgent: USER_AGENT,\n /**\n * Resolved to the current server timestamp, as milliseconds from the\n * Unix epoch.\n */\n now: NOW,\n /**\n * If the function was invoked using admin auth (either directly or while\n * acting as an end user, e.g. from the dashboard), resolved to information\n * about the admin. Otherwise, resolved to `null`.\n */\n convexActor: CONVEX_ACTOR,\n} as const;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAAM,aAAa,OAAO,eAAe;AACzC,MAAM,KAAK,OAAO,QAAQ;AAC1B,MAAM,aAAa,OAAO,eAAe;AACzC,MAAM,MAAM,OAAO,SAAS;AAC5B,MAAM,eAAe,OAAO,iBAAiB;AAStC,MAAM,WAAmC;AAAA,EAC9C,CAAC,UAAU,GAAG;AAAA,EACd,CAAC,EAAE,GAAG;AAAA,EACN,CAAC,UAAU,GAAG;AAAA,EACd,CAAC,GAAG,GAAG;AAAA,EACP,CAAC,YAAY,GAAG;AAClB;AAEO,MAAM,OAAO;AAAA;AAAA,EAElB,WAAW;AAAA;AAAA,EAEX,IAAI;AAAA;AAAA,EAEJ,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA,EAKX,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAML,aAAa;AACf;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,5 @@
1
1
  import "@sentry/tracing";
2
2
  export declare const SENTRY_DSN = "https://f9fa0306e3d540079cf40ce8c2ad9644@o1192621.ingest.sentry.io/6390839";
3
+ export declare const LOCAL_BACKEND_SENTRY_DSN = "https://1c77542933b4002e48934a351c84dd38@o1192621.ingest.us.sentry.io/4511826465587200";
3
4
  export declare function initSentry(): void;
4
5
  //# sourceMappingURL=sentry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sentry.d.ts","sourceRoot":"","sources":["../../../../../src/cli/lib/utils/sentry.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAC;AAMzB,eAAO,MAAM,UAAU,+EACuD,CAAC;AAE/E,wBAAgB,UAAU,SAkBzB"}
1
+ {"version":3,"file":"sentry.d.ts","sourceRoot":"","sources":["../../../../../src/cli/lib/utils/sentry.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAC;AAMzB,eAAO,MAAM,UAAU,+EACuD,CAAC;AAE/E,eAAO,MAAM,wBAAwB,2FACqD,CAAC;AAE3F,wBAAgB,UAAU,SAkBzB"}
@@ -1,2 +1,2 @@
1
- export declare const version = "1.43.0-alpha.0";
1
+ export declare const version = "1.43.0";
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,WAAW,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { GenericId } from "../values/index.js";
2
+ import { CommitTsPlaceholder } from "../values/value.js";
2
3
  import { DocumentByName, GenericDataModel, NamedTableInfo, TableNamesInDataModel } from "./data_model.js";
3
4
  import { QueryInitializer } from "./query.js";
4
5
  import { SystemDataModel } from "./schema.js";
@@ -303,6 +304,19 @@ export interface GenericDatabaseWriter<DataModel extends GenericDataModel> exten
303
304
  * @param id - The {@link values.GenericId} of the document to remove.
304
305
  */
305
306
  delete(id: GenericId<TableNamesInDataModel<DataModel>>): Promise<void>;
307
+ /**
308
+ * Values that are not known until the mutation commits.
309
+ */
310
+ vars: {
311
+ /**
312
+ * The placeholder for the transaction's commit timestamp. Written into a
313
+ * document field via `db.insert`, it resolves at commit to an int64
314
+ * (`bigint`) ordered by commit order. Within the writing mutation,
315
+ * reading the field back yields the placeholder, which cannot be used as
316
+ * a number.
317
+ */
318
+ commitTs: CommitTsPlaceholder;
319
+ };
306
320
  }
307
321
  /**
308
322
  * An interface to read from and write to the database within Convex mutation
@@ -1 +1 @@
1
- {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../../src/server/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,oBAAoB,CAAC;AAE5B,UAAU,kBAAkB,CAAC,SAAS,SAAS,gBAAgB;IAC7D;;;;;;;;;;;;OAYG;IACH,GAAG,CAAC,SAAS,SAAS,qBAAqB,CAAC,SAAS,CAAC,EACpD,KAAK,EAAE,SAAS,EAChB,EAAE,EAAE,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GACjC,OAAO,CAAC,cAAc,CAAC,SAAS,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC;IAExD;;;;;;;;OAQG;IACH,GAAG,CAAC,SAAS,SAAS,qBAAqB,CAAC,SAAS,CAAC,EACpD,EAAE,EAAE,SAAS,CAAC,SAAS,CAAC,GACvB,OAAO,CAAC,cAAc,CAAC,SAAS,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC;IAExD;;;;;;;;OAQG;IACH,KAAK,CAAC,SAAS,SAAS,qBAAqB,CAAC,SAAS,CAAC,EACtD,SAAS,EAAE,SAAS,GACnB,gBAAgB,CAAC,cAAc,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;IAE1D;;;;;;;;;;;OAWG;IACH,WAAW,CAAC,SAAS,SAAS,qBAAqB,CAAC,SAAS,CAAC,EAC5D,SAAS,EAAE,SAAS,EAC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OAAO,KAAK,CAAC;IACpB,IAAI,EAAE,OAAO,IAAI,CAAC;CAGnB;AAED,eAAO,MAAM,GAAG,EAAE,GAIjB,CAAC"}
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/server/log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGpC,UAAU,GAAG;IACX;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,IAAI,EAAE,OAAO,IAAI,CAAC;CACnB;AAED,eAAO,MAAM,GAAG,EAAE,GAGjB,CAAC"}
@@ -17,12 +17,6 @@ export declare const vars: {
17
17
  * Unix epoch.
18
18
  */
19
19
  readonly now: typeof NOW;
20
- };
21
- /**
22
- * Internal-only log vars, surfaced via `log.internalVars`. These are kept out
23
- * of the public `log.vars` surface.
24
- */
25
- export declare const internalVars: {
26
20
  /**
27
21
  * If the function was invoked using admin auth (either directly or while
28
22
  * acting as an end user, e.g. from the dashboard), resolved to information
@@ -1 +1 @@
1
- {"version":3,"file":"logVars.d.ts","sourceRoot":"","sources":["../../../src/server/logVars.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,UAAU,eAA0B,CAAC;AAC3C,QAAA,MAAM,EAAE,eAAmB,CAAC;AAC5B,QAAA,MAAM,UAAU,eAA0B,CAAC;AAC3C,QAAA,MAAM,GAAG,eAAoB,CAAC;AAC9B,QAAA,MAAM,YAAY,eAA4B,CAAC;AAE/C,MAAM,MAAM,MAAM,GACd,OAAO,UAAU,GACjB,OAAO,EAAE,GACT,OAAO,UAAU,GACjB,OAAO,GAAG,GACV,OAAO,YAAY,CAAC;AAExB,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAM3C,CAAC;AAEF,eAAO,MAAM,IAAI;IACf,kCAAkC;;IAElC,2CAA2C;;IAE3C,kDAAkD;;IAElD;;;OAGG;;CAEK,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,YAAY;IACvB;;;;OAIG;;CAEK,CAAC"}
1
+ {"version":3,"file":"logVars.d.ts","sourceRoot":"","sources":["../../../src/server/logVars.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,UAAU,eAA0B,CAAC;AAC3C,QAAA,MAAM,EAAE,eAAmB,CAAC;AAC5B,QAAA,MAAM,UAAU,eAA0B,CAAC;AAC3C,QAAA,MAAM,GAAG,eAAoB,CAAC;AAC9B,QAAA,MAAM,YAAY,eAA4B,CAAC;AAE/C,MAAM,MAAM,MAAM,GACd,OAAO,UAAU,GACjB,OAAO,EAAE,GACT,OAAO,UAAU,GACjB,OAAO,GAAG,GACV,OAAO,YAAY,CAAC;AAExB,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAM3C,CAAC;AAEF,eAAO,MAAM,IAAI;IACf,kCAAkC;;IAElC,2CAA2C;;IAE3C,kDAAkD;;IAElD;;;OAGG;;IAEH;;;;OAIG;;CAEK,CAAC"}