Initial commit: New MoreminiMore website with fresh design
This commit is contained in:
7
node_modules/astro/dist/actions/runtime/entrypoints/client.d.ts
generated
vendored
Normal file
7
node_modules/astro/dist/actions/runtime/entrypoints/client.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
export { ACTION_QUERY_PARAMS } from '../../consts.js';
|
||||
export { ActionError, isActionError, isInputError, } from '../client.js';
|
||||
export type { ActionAPIContext, ActionClient, ActionErrorCode, ActionInputSchema, ActionReturnType, SafeResult, } from '../types.js';
|
||||
export declare function defineAction(): void;
|
||||
export declare function getActionContext(): void;
|
||||
export declare const getActionPath: (action: import("../types.js").ActionClient<any, any, any>) => string;
|
||||
export declare const actions: Record<string | symbol, any>;
|
||||
91
node_modules/astro/dist/actions/runtime/entrypoints/client.js
generated
vendored
Normal file
91
node_modules/astro/dist/actions/runtime/entrypoints/client.js
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
import { shouldAppendTrailingSlash } from "virtual:astro:actions/options";
|
||||
import { internalFetchHeaders } from "virtual:astro:adapter-config/client";
|
||||
import {
|
||||
ActionError,
|
||||
createActionsProxy,
|
||||
createGetActionPath,
|
||||
deserializeActionResult,
|
||||
getActionPathFromString,
|
||||
getActionQueryString
|
||||
} from "../client.js";
|
||||
import { ACTION_QUERY_PARAMS } from "../../consts.js";
|
||||
import {
|
||||
ActionError as ActionError2,
|
||||
isActionError,
|
||||
isInputError
|
||||
} from "../client.js";
|
||||
function defineAction() {
|
||||
throw new Error("[astro:actions] `defineAction()` unexpectedly used on the client.");
|
||||
}
|
||||
function getActionContext() {
|
||||
throw new Error("[astro:actions] `getActionContext()` unexpectedly used on the client.");
|
||||
}
|
||||
const getActionPath = createGetActionPath({
|
||||
baseUrl: import.meta.env.BASE_URL,
|
||||
shouldAppendTrailingSlash
|
||||
});
|
||||
const actions = createActionsProxy({
|
||||
handleAction: async (param, path) => {
|
||||
const headers = new Headers();
|
||||
headers.set("Accept", "application/json");
|
||||
for (const [key, value] of Object.entries(internalFetchHeaders)) {
|
||||
headers.set(key, value);
|
||||
}
|
||||
let body = param;
|
||||
if (!(body instanceof FormData)) {
|
||||
try {
|
||||
body = JSON.stringify(param);
|
||||
} catch (e) {
|
||||
throw new ActionError({
|
||||
code: "BAD_REQUEST",
|
||||
message: `Failed to serialize request body to JSON. Full error: ${e.message}`
|
||||
});
|
||||
}
|
||||
if (body) {
|
||||
headers.set("Content-Type", "application/json");
|
||||
} else {
|
||||
headers.set("Content-Length", "0");
|
||||
}
|
||||
}
|
||||
const rawResult = await fetch(
|
||||
getActionPathFromString({
|
||||
baseUrl: import.meta.env.BASE_URL,
|
||||
shouldAppendTrailingSlash,
|
||||
path: getActionQueryString(path)
|
||||
}),
|
||||
{
|
||||
method: "POST",
|
||||
body,
|
||||
headers
|
||||
}
|
||||
);
|
||||
if (rawResult.status === 204) {
|
||||
return deserializeActionResult({ type: "empty", status: 204 });
|
||||
}
|
||||
const bodyText = await rawResult.text();
|
||||
if (rawResult.ok) {
|
||||
return deserializeActionResult({
|
||||
type: "data",
|
||||
body: bodyText,
|
||||
status: 200,
|
||||
contentType: "application/json+devalue"
|
||||
});
|
||||
}
|
||||
return deserializeActionResult({
|
||||
type: "error",
|
||||
body: bodyText,
|
||||
status: rawResult.status,
|
||||
contentType: "application/json"
|
||||
});
|
||||
}
|
||||
});
|
||||
export {
|
||||
ACTION_QUERY_PARAMS,
|
||||
ActionError2 as ActionError,
|
||||
actions,
|
||||
defineAction,
|
||||
getActionContext,
|
||||
getActionPath,
|
||||
isActionError,
|
||||
isInputError
|
||||
};
|
||||
2
node_modules/astro/dist/actions/runtime/entrypoints/route.d.ts
generated
vendored
Normal file
2
node_modules/astro/dist/actions/runtime/entrypoints/route.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import type { APIRoute } from '../../../types/public/common.js';
|
||||
export declare const POST: APIRoute;
|
||||
23
node_modules/astro/dist/actions/runtime/entrypoints/route.js
generated
vendored
Normal file
23
node_modules/astro/dist/actions/runtime/entrypoints/route.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import { getActionContext } from "../server.js";
|
||||
const POST = async (context) => {
|
||||
const { action, serializeActionResult } = getActionContext(context);
|
||||
if (action?.calledFrom !== "rpc") {
|
||||
return new Response("Not found", { status: 404 });
|
||||
}
|
||||
const result = await action.handler();
|
||||
const serialized = serializeActionResult(result);
|
||||
if (serialized.type === "empty") {
|
||||
return new Response(null, {
|
||||
status: serialized.status
|
||||
});
|
||||
}
|
||||
return new Response(serialized.body, {
|
||||
status: serialized.status,
|
||||
headers: {
|
||||
"Content-Type": serialized.contentType
|
||||
}
|
||||
});
|
||||
};
|
||||
export {
|
||||
POST
|
||||
};
|
||||
6
node_modules/astro/dist/actions/runtime/entrypoints/server.d.ts
generated
vendored
Normal file
6
node_modules/astro/dist/actions/runtime/entrypoints/server.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export { ACTION_QUERY_PARAMS } from '../../consts.js';
|
||||
export { ActionError, isActionError, isInputError } from '../client.js';
|
||||
export { defineAction, getActionContext } from '../server.js';
|
||||
export type { ActionAPIContext, ActionClient, ActionErrorCode, ActionInputSchema, ActionReturnType, SafeResult, } from '../types.js';
|
||||
export declare const getActionPath: (action: import("../types.js").ActionClient<any, any, any>) => string;
|
||||
export declare const actions: Record<string | symbol, any>;
|
||||
33
node_modules/astro/dist/actions/runtime/entrypoints/server.js
generated
vendored
Normal file
33
node_modules/astro/dist/actions/runtime/entrypoints/server.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import { pipelineSymbol } from "../../../core/constants.js";
|
||||
import { ActionCalledFromServerError } from "../../../core/errors/errors-data.js";
|
||||
import { AstroError } from "../../../core/errors/errors.js";
|
||||
import { createGetActionPath, createActionsProxy } from "../client.js";
|
||||
import { shouldAppendTrailingSlash } from "virtual:astro:actions/options";
|
||||
import { ACTION_QUERY_PARAMS } from "../../consts.js";
|
||||
import { ActionError, isActionError, isInputError } from "../client.js";
|
||||
import { defineAction, getActionContext } from "../server.js";
|
||||
const getActionPath = createGetActionPath({
|
||||
baseUrl: import.meta.env.BASE_URL,
|
||||
shouldAppendTrailingSlash
|
||||
});
|
||||
const actions = createActionsProxy({
|
||||
handleAction: async (param, path, context) => {
|
||||
const pipeline = context ? Reflect.get(context, pipelineSymbol) : void 0;
|
||||
if (!pipeline) {
|
||||
throw new AstroError(ActionCalledFromServerError);
|
||||
}
|
||||
const action = await pipeline.getAction(path);
|
||||
if (!action) throw new Error(`Action not found: ${path}`);
|
||||
return action.bind(context)(param);
|
||||
}
|
||||
});
|
||||
export {
|
||||
ACTION_QUERY_PARAMS,
|
||||
ActionError,
|
||||
actions,
|
||||
defineAction,
|
||||
getActionContext,
|
||||
getActionPath,
|
||||
isActionError,
|
||||
isInputError
|
||||
};
|
||||
Reference in New Issue
Block a user