Skip to content

Commit

Permalink
Merge branch 'main' into feat/new-toolbar-components
Browse files Browse the repository at this point in the history
  • Loading branch information
Princesseuh authored Apr 29, 2024
2 parents 4718597 + b6f011d commit 20239c1
Show file tree
Hide file tree
Showing 18 changed files with 37 additions and 18 deletions.
7 changes: 7 additions & 0 deletions .changeset/angry-lemons-tie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@astrojs/db": patch
---

Improves the typing of the `asDrizzleTable()` utility

Fixes a type error when passing the output of `defineTable()` to the utility and returns a more detailed type inferred from the columns of the passed table config.
4 changes: 2 additions & 2 deletions .github/workflows/snapshot-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
issues: write
pull-requests: write
steps:
- name: "Check if user has admin access (only admins can publish snapshot releases)."
- name: "Check if user has write access"
uses: "lannonbr/[email protected]"
with:
permission: "admin"
permission: "write"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/@types/astro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import type { AstroTimer } from '../core/config/timer.js';
import type { TSConfig } from '../core/config/tsconfig.js';
import type { AstroCookies } from '../core/cookies/index.js';
import type { AstroIntegrationLogger, Logger, LoggerLevel } from '../core/logger/core.js';
import type { getToolbarServerCommunicationHelpers } from '../integrations/index.js';
import type { getToolbarServerCommunicationHelpers } from '../integrations/hooks.js';
import type { AstroPreferences } from '../preferences/index.js';
import type {
ToolbarAppEventTarget,
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function getViteConfig(inlineConfig: UserConfig) {
import('../core/logger/node.js'),
import('../core/config/index.js'),
import('../core/create-vite.js'),
import('../integrations/index.js'),
import('../integrations/hooks.js'),
import('./vite-plugin-content-listen.js'),
]);
const logger = new Logger({
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/build/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
removeTrailingForwardSlash,
} from '../../core/path.js';
import { toRoutingStrategy } from '../../i18n/utils.js';
import { runHookBuildGenerated } from '../../integrations/index.js';
import { runHookBuildGenerated } from '../../integrations/hooks.js';
import { getOutputDirectory, isServerLikeOutput } from '../../prerender/utils.js';
import type { SSRManifestI18n } from '../app/types.js';
import { NoPrerenderedRoutesWithDomains } from '../errors/errors-data.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
runHookBuildStart,
runHookConfigDone,
runHookConfigSetup,
} from '../../integrations/index.js';
} from '../../integrations/hooks.js';
import { isServerLikeOutput } from '../../prerender/utils.js';
import { resolveConfig } from '../config/config.js';
import { createNodeLogger } from '../config/logging.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/build/plugins/plugin-manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { type Plugin as VitePlugin } from 'vite';
import { getAssetsPrefix } from '../../../assets/utils/getAssetsPrefix.js';
import { normalizeTheLocale } from '../../../i18n/index.js';
import { toRoutingStrategy } from '../../../i18n/utils.js';
import { runHookBuildSsr } from '../../../integrations/index.js';
import { runHookBuildSsr } from '../../../integrations/hooks.js';
import { BEFORE_HYDRATION_SCRIPT_ID, PAGE_SCRIPT_ID } from '../../../vite-plugin-scripts/index.js';
import type {
SSRManifestI18n,
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/build/plugins/plugin-ssr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { join } from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
import type { Plugin as VitePlugin } from 'vite';
import type { AstroAdapter } from '../../../@types/astro.js';
import { isFunctionPerRouteEnabled } from '../../../integrations/index.js';
import { isFunctionPerRouteEnabled } from '../../../integrations/hooks.js';
import { isServerLikeOutput } from '../../../prerender/utils.js';
import { routeIsRedirect } from '../../redirects/index.js';
import { addRollupInput } from '../add-rollup-input.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/build/static-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
import { emptyDir, removeEmptyDirs } from '../../core/fs/index.js';
import { appendForwardSlash, prependForwardSlash, removeFileExtension } from '../../core/path.js';
import { isModeServerWithNoAdapter } from '../../core/util.js';
import { runHookBuildSetup } from '../../integrations/index.js';
import { runHookBuildSetup } from '../../integrations/hooks.js';
import { getOutputDirectory, isServerLikeOutput } from '../../prerender/utils.js';
import { PAGE_SCRIPT_ID } from '../../vite-plugin-scripts/index.js';
import { AstroError, AstroErrorData } from '../errors/index.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/dev/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
runHookConfigSetup,
runHookServerDone,
runHookServerStart,
} from '../../integrations/index.js';
} from '../../integrations/hooks.js';
import { createVite } from '../create-vite.js';
import type { Logger } from '../logger/core.js';
import { apply as applyPolyfill } from '../polyfill.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/preview/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { AstroInlineConfig, PreviewModule, PreviewServer } from '../../@typ
import { AstroIntegrationLogger } from '../../core/logger/core.js';
import { telemetry } from '../../events/index.js';
import { eventCliSession } from '../../events/session.js';
import { runHookConfigDone, runHookConfigSetup } from '../../integrations/index.js';
import { runHookConfigDone, runHookConfigSetup } from '../../integrations/hooks.js';
import { resolveConfig } from '../config/config.js';
import { createNodeLogger } from '../config/logging.js';
import { createSettings } from '../config/settings.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/sync/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { createContentTypesGenerator } from '../../content/index.js';
import { globalContentConfigObserver } from '../../content/utils.js';
import { telemetry } from '../../events/index.js';
import { eventCliSession } from '../../events/session.js';
import { runHookConfigSetup } from '../../integrations/index.js';
import { runHookConfigSetup } from '../../integrations/hooks.js';
import { setUpEnvTs } from '../../vite-plugin-inject-env-ts/index.js';
import { getTimeStat } from '../build/util.js';
import { resolveConfig } from '../config/config.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { buildClientDirectiveEntrypoint } from '../core/client-directive/index.j
import { mergeConfig } from '../core/config/index.js';
import type { AstroIntegrationLogger, Logger } from '../core/logger/core.js';
import { isServerLikeOutput } from '../prerender/utils.js';
import { validateSupportedFeatures } from './astroFeaturesValidation.js';
import { validateSupportedFeatures } from './features-validation.js';

async function withTakingALongTimeMsg<T>({
name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { AstroSettings, InjectedRoute, ResolvedInjectedRoute } from '../@ty
import type { Logger } from '../core/logger/core.js';

import { normalizePath } from 'vite';
import { runHookServerSetup } from '../integrations/index.js';
import { runHookServerSetup } from '../integrations/hooks.js';

/** Connect Astro integrations into Vite, as needed. */
export default function astroIntegrationsContainerPlugin({
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/test/units/integrations/api.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import { validateSupportedFeatures } from '../../../dist/integrations/astroFeaturesValidation.js';
import { runHookBuildSetup, runHookConfigSetup } from '../../../dist/integrations/index.js';
import { validateSupportedFeatures } from '../../../dist/integrations/features-validation.js';
import { runHookBuildSetup, runHookConfigSetup } from '../../../dist/integrations/hooks.js';
import { defaultLogger } from '../test-utils.js';

describe('Integration API', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/db/src/runtime/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
sqliteTable,
text,
} from 'drizzle-orm/sqlite-core';
import { type DBColumn, type DBTable } from '../core/types.js';
import type { DBColumn, DBTable } from '../core/types.js';
import { type SerializedSQL, isSerializedSQL } from './types.js';
import { pathToFileURL } from './utils.js';

Expand Down
14 changes: 13 additions & 1 deletion packages/db/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
export { defineDbIntegration } from './core/utils.js';
export { asDrizzleTable } from './runtime/index.js';
import { tableSchema } from './core/schemas.js';
import type { ColumnsConfig, TableConfig } from './core/types.js';
import { type Table, asDrizzleTable as internal_asDrizzleTable } from './runtime/index.js';

export function asDrizzleTable<
TableName extends string = string,
TColumns extends ColumnsConfig = ColumnsConfig,
>(name: TableName, tableConfig: TableConfig<TColumns>) {
return internal_asDrizzleTable(name, tableSchema.parse(tableConfig)) as Table<
TableName,
TColumns
>;
}

0 comments on commit 20239c1

Please sign in to comment.