diff --git a/.changeset/few-teachers-impress.md b/.changeset/few-teachers-impress.md deleted file mode 100644 index 0fdcec9bf1b00..0000000000000 --- a/.changeset/few-teachers-impress.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@astrojs/db": patch ---- - -Fixes an issue where `astro:db` could not be used in serverless environments. diff --git a/packages/db/CHANGELOG.md b/packages/db/CHANGELOG.md index 2cfa128ef434b..ec6f5592ccb94 100644 --- a/packages/db/CHANGELOG.md +++ b/packages/db/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/db +## 0.8.4 + +### Patch Changes + +- [#10443](https://github.com/withastro/astro/pull/10443) [`238f047b9d1ebc407f53d61ee61574b380a76ac9`](https://github.com/withastro/astro/commit/238f047b9d1ebc407f53d61ee61574b380a76ac9) Thanks [@lilnasy](https://github.com/lilnasy)! - Fixes an issue where `astro:db` could not be used in serverless environments. + ## 0.8.3 ### Patch Changes diff --git a/packages/db/package.json b/packages/db/package.json index 092e614f029ba..f37eeeb5893b4 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -1,6 +1,6 @@ { "name": "@astrojs/db", - "version": "0.8.3", + "version": "0.8.4", "description": "", "license": "MIT", "type": "module", diff --git a/packages/db/src/core/cli/commands/link/index.ts b/packages/db/src/core/cli/commands/link/index.ts index 0dae1c2189322..b58dff2e75e1f 100644 --- a/packages/db/src/core/cli/commands/link/index.ts +++ b/packages/db/src/core/cli/commands/link/index.ts @@ -5,10 +5,10 @@ import { slug } from 'github-slugger'; import { bgRed, cyan } from 'kleur/colors'; import ora from 'ora'; import prompts from 'prompts'; +import { safeFetch } from '../../../../runtime/utils.js'; import { MISSING_SESSION_ID_ERROR } from '../../../errors.js'; import { PROJECT_ID_FILE, getSessionIdFromFile } from '../../../tokens.js'; import { type Result, getAstroStudioUrl } from '../../../utils.js'; -import { safeFetch } from '../../../../runtime/utils.js'; export async function cmd() { const sessionToken = await getSessionIdFromFile(); diff --git a/packages/db/src/core/cli/commands/push/index.ts b/packages/db/src/core/cli/commands/push/index.ts index fed1e1a70c97b..b678c47f92fdc 100644 --- a/packages/db/src/core/cli/commands/push/index.ts +++ b/packages/db/src/core/cli/commands/push/index.ts @@ -1,10 +1,10 @@ import type { AstroConfig } from 'astro'; import type { Arguments } from 'yargs-parser'; +import { safeFetch } from '../../../../runtime/utils.js'; import { MIGRATION_VERSION } from '../../../consts.js'; import { getManagedAppTokenOrExit } from '../../../tokens.js'; import { type DBConfig, type DBSnapshot } from '../../../types.js'; import { type Result, getRemoteDatabaseUrl } from '../../../utils.js'; -import { safeFetch } from '../../../../runtime/utils.js'; import { createCurrentSnapshot, createEmptySnapshot, diff --git a/packages/db/src/core/cli/migration-queries.ts b/packages/db/src/core/cli/migration-queries.ts index 0474f9bd1c5ee..13d296ce5896a 100644 --- a/packages/db/src/core/cli/migration-queries.ts +++ b/packages/db/src/core/cli/migration-queries.ts @@ -14,6 +14,7 @@ import { schemaTypeToSqlType, } from '../../runtime/queries.js'; import { isSerializedSQL } from '../../runtime/types.js'; +import { safeFetch } from '../../runtime/utils.js'; import { MIGRATION_VERSION } from '../consts.js'; import { RENAME_COLUMN_ERROR, RENAME_TABLE_ERROR } from '../errors.js'; import { columnSchema } from '../schemas.js'; @@ -33,8 +34,6 @@ import { type TextColumn, } from '../types.js'; import { type Result, getRemoteDatabaseUrl } from '../utils.js'; -import { safeFetch } from '../../runtime/utils.js'; - const sqlite = new SQLiteAsyncDialect(); const genTempTableName = customAlphabet('abcdefghijklmnopqrstuvwxyz', 10); diff --git a/packages/db/src/core/tokens.ts b/packages/db/src/core/tokens.ts index 88bb26ec5d300..379a3f68111b7 100644 --- a/packages/db/src/core/tokens.ts +++ b/packages/db/src/core/tokens.ts @@ -4,9 +4,9 @@ import { join } from 'node:path'; import { pathToFileURL } from 'node:url'; import { green } from 'kleur/colors'; import ora from 'ora'; +import { safeFetch } from '../runtime/utils.js'; import { MISSING_PROJECT_ID_ERROR, MISSING_SESSION_ID_ERROR } from './errors.js'; import { getAstroStudioEnv, getAstroStudioUrl } from './utils.js'; -import { safeFetch } from '../runtime/utils.js'; export const SESSION_LOGIN_FILE = pathToFileURL(join(homedir(), '.astro', 'session-token')); export const PROJECT_ID_FILE = pathToFileURL(join(process.cwd(), '.astro', 'link')); diff --git a/packages/db/src/runtime/utils.ts b/packages/db/src/runtime/utils.ts index 32bc60a45a1c7..29160b22df161 100644 --- a/packages/db/src/runtime/utils.ts +++ b/packages/db/src/runtime/utils.ts @@ -15,4 +15,4 @@ export async function safeFetch( } return response; -} \ No newline at end of file +}