Repository: withastro/astro
File: packages/astro/src/core/base-pipeline.ts (TypeScript)

Code before:
			if (this.manifest.checkOrigin) {
				// this middleware must be placed at the beginning because it needs to block incoming requests
				internalMiddlewares.unshift(createOriginCheckMiddleware());
			}
			this.resolvedMiddleware = sequence(...internalMiddlewares);
			return this.resolvedMiddleware;
		} else {
			this.resolvedMiddleware = NOOP_MIDDLEWARE_FN;
			return this.resolvedMiddleware;
		}
	}

	setActions(actions: SSRActions) {
		this.resolvedActions = actions;
	}

	async getActions(): Promise<SSRActions> {
		if (this.resolvedActions) {
			return this.resolvedActions;
		} else if (this.actions) {
			return this.actions();
		}
		return NOOP_ACTIONS_MOD;
	}

	async getSessionDriver(): Promise<SSRSessionDriver> {
		// Return cached value if already resolved (including null)
		if (this.resolvedSessionDriver !== undefined) {
			return this.resolvedSessionDriver;
		}

		// Try to load the driver from the manifest
		if (this.sessionDriver) {
			const driverModule = await this.sessionDriver();
			this.resolvedSessionDriver = driverModule?.default || null;
			return this.resolvedSessionDriver;
		}

		// No driver configured
		this.resolvedSessionDriver = null;
		return null;
	}

	async getAction(path: string): Promise<ActionClient<unknown, ActionAccept, ZodType>> {
		const pathKeys = path.split('.').map((key) => decodeURIComponent(key));
		let { server } = await this.getActions();

		if (!server || !(typeof server === 'object')) {
			throw new TypeError(
				`Expected \`server\` export in actions file to be an object. Received ${typeof server}.`,
			);

Review comment (suggestion):
```suggestion
	async getSessionDriver(): Promise<SessionDriver | null> {
```

Code after:
				// this middleware must be placed at the beginning because it needs to block incoming requests
				internalMiddlewares.unshift(createOriginCheckMiddleware());
			}
			this.resolvedMiddleware = sequence(...internalMiddlewares);
			return this.resolvedMiddleware;
		} else {
			this.resolvedMiddleware = NOOP_MIDDLEWARE_FN;
			return this.resolvedMiddleware;
		}
	}

	setActions(actions: SSRActions) {
		this.resolvedActions = actions;
	}

	async getActions(): Promise<SSRActions> {
		if (this.resolvedActions) {
			return this.resolvedActions;
		} else if (this.actions) {
			return this.actions();
		}
		return NOOP_ACTIONS_MOD;
	}

	async getSessionDriver(): Promise<SessionDriver | null> {
		// Return cached value if already resolved (including null)
		if (this.resolvedSessionDriver !== undefined) {
			return this.resolvedSessionDriver;
		}

		// Try to load the driver from the manifest
		if (this.sessionDriver) {
			const driverModule = await this.sessionDriver();
			this.resolvedSessionDriver = driverModule?.default || null;
			return this.resolvedSessionDriver;
		}

		// No driver configured
		this.resolvedSessionDriver = null;
		return null;
	}

	async getAction(path: string): Promise<ActionClient<unknown, ActionAccept, ZodType>> {
		const pathKeys = path.split('.').map((key) => decodeURIComponent(key));
		let { server } = await this.getActions();

		if (!server || !(typeof server === 'object')) {
			throw new TypeError(
				`Expected \`server\` export in actions file to be an object. Received ${typeof server}.`,
			);
		}