gemi 0.66.0 → 0.68.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.
- package/dist/ai/Agent.d.ts +66 -17
- package/dist/ai/Agent.d.ts.map +1 -1
- package/dist/ai/AgentController.d.ts +22 -1
- package/dist/ai/AgentController.d.ts.map +1 -1
- package/dist/ai/client/index.d.ts +1 -1
- package/dist/ai/client/index.d.ts.map +1 -1
- package/dist/ai/client/index.js +32 -1
- package/dist/ai/client/index.js.map +1 -1
- package/dist/ai/index.d.ts +1 -1
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +10 -10
- package/dist/ai/index.js.map +5 -5
- package/dist/ai/live/harness.d.ts +0 -3
- package/dist/ai/live/harness.d.ts.map +1 -1
- package/dist/ai/types.d.ts +27 -0
- package/dist/ai/types.d.ts.map +1 -1
- package/dist/ai/useChat.d.ts +18 -1
- package/dist/ai/useChat.d.ts.map +1 -1
- package/dist/{chunk-qttk7k60.js → chunk-02gmyqq0.js} +1 -1
- package/dist/{chunk-w6fnt1xv.js → chunk-0wvcafz0.js} +2 -2
- package/dist/{chunk-w6fnt1xv.js.map → chunk-0wvcafz0.js.map} +1 -1
- package/dist/{chunk-se5ekvgb.js → chunk-43asnfa8.js} +1 -1
- package/dist/{chunk-gyc91g26.js → chunk-a85vdr77.js} +1 -1
- package/dist/{chunk-nxg51m0q.js → chunk-j3p8c0xp.js} +1 -1
- package/dist/{chunk-nxg51m0q.js.map → chunk-j3p8c0xp.js.map} +2 -2
- package/dist/chunk-z7vmrf00.js +5 -0
- package/dist/{chunk-a85fn4zf.js.map → chunk-z7vmrf00.js.map} +4 -4
- package/dist/facades/index.js +1 -1
- package/dist/http/HttpRequest.d.ts +18 -3
- package/dist/http/HttpRequest.d.ts.map +1 -1
- package/dist/http/index.js +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/kernel/index.js +1 -1
- package/dist/server/index.js +1 -1
- package/dist/services/file-storage/drivers/FileSystemDriver.d.ts +23 -1
- package/dist/services/file-storage/drivers/FileSystemDriver.d.ts.map +1 -1
- package/dist/services/index.js +1 -1
- package/dist/services/mcp/McpRegistry.d.ts +13 -3
- package/dist/services/mcp/McpRegistry.d.ts.map +1 -1
- package/dist/services/mcp/toAgentTools.d.ts +12 -3
- package/dist/services/mcp/toAgentTools.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-a85fn4zf.js +0 -5
- /package/dist/{chunk-qttk7k60.js.map → chunk-02gmyqq0.js.map} +0 -0
- /package/dist/{chunk-se5ekvgb.js.map → chunk-43asnfa8.js.map} +0 -0
- /package/dist/{chunk-gyc91g26.js.map → chunk-a85vdr77.js.map} +0 -0
|
@@ -9,17 +9,17 @@
|
|
|
9
9
|
"import { RequestBreakerError } from \"./Error\";\nimport type { HttpRequest } from \"./HttpRequest\";\n\ntype MiddlewareResult = Partial<{\n headers: Record<string, string>;\n cookies: Record<string, string>;\n}>;\n\nexport type MiddlewareReturnType =\n | void\n | Promise<MiddlewareResult>\n | MiddlewareResult;\n\nexport type RouterMiddleware = (\n req: HttpRequest,\n ctx: any,\n) => MiddlewareReturnType;\n\nexport class ValidationError extends RequestBreakerError {\n errors: Record<string, string[]> = {};\n constructor(errors: Record<string, string[]>) {\n super(\"Validation error\");\n this.name = \"ValidationError\";\n this.errors = errors;\n this.payload = {\n api: {\n status: 400,\n data: {\n error: {\n kind: \"validation_error\",\n messages: errors,\n },\n },\n headers: {\n \"Content-Type\": \"application/json\",\n },\n },\n view: {\n status: 400,\n },\n };\n }\n}\n",
|
|
10
10
|
"/**\n * The requests the api dispatcher built itself, on a model's behalf, rather\n * than received from a client.\n *\n * Keyed on the `Request` object, not carried in it. A header was the obvious\n * alternative and it is forgeable by construction: anything the synthetic\n * request can carry, a real client can send. Only a module holding this set can\n * add to it, and it is deliberately not re-exported from `http/index.ts`, so no\n * inbound request can put itself here. The only writer is\n * `ApiRouteDispatcher.dispatchAs`, and it marks only the requests it built.\n * App code can call `dispatchAs` — it is trusted — but cannot mark a request of\n * its own.\n *\n * The object, rather than a flag on the request context, because the two\n * places an app asks the question sit on either side of `RequestContext.run`:\n * `onRequestStart` fires before the dispatcher opens the request's store, and a\n * handler's `new SomeRequest()` builds a second `HttpRequest` from inside it.\n * Both wrap the same raw `Request`, so both get the same answer, and nothing has\n * to remember to copy a field from one to the other.\n *\n * A `WeakMap`, so a dispatched request is forgotten with the request. The\n * value is the initiator's client address; see `dispatchedClientAddress`.\n */\nconst dispatched = new WeakMap<Request, { clientAddress: string }>();\n\n/**\n * `clientAddress` is required so the one writer cannot mark a request without\n * saying whose rate-limit budget it spends.\n */\nexport function markModelOriginated(req: Request, clientAddress: string) {\n dispatched.set(req, { clientAddress });\n}\n\nexport function isModelOriginated(req: Request): boolean {\n return dispatched.has(req);\n}\n\n/**\n * The client address `clientIp` resolved from the initiator, for a request the\n * dispatcher built; `undefined` for any other.\n *\n * It rides here for the same reason the marker does. The synthetic request\n * carries credentials only, so it has no `x-forwarded-for`, and\n * `RateLimitMiddleware` would key every tool call from every user on\n * `unknown:<route>`: one budget, which one user's agent loop can spend for\n * everyone. Copying the initiator's `x-forwarded-for` instead would move a\n * client-written header onto a request the server built. Carrying the value\n * `clientIp` already derived from the initiator gives a tool call exactly the\n * address the user's own direct request gets, and nothing more.\n */\nexport function dispatchedClientAddress(req: Request): string | undefined {\n return dispatched.get(req)?.clientAddress;\n}\n",
|
|
11
11
|
"// Type-only: `services/router` imports from `http`, so a runtime import here\n// would be circular.\nimport type { ResolvedDomain } from \"../services/router/DomainResolver\";\n\n// Keyed by the raw Request, so the domain `App.fetch` resolved reaches the\n// dispatcher, and every `HttpRequest` built over that Request, without a\n// second AsyncLocalStorage that a streaming render would step outside of.\nconst domains = new WeakMap<Request, ResolvedDomain>();\n\nexport function setRequestDomain(req: Request, domain: ResolvedDomain) {\n domains.set(req, domain);\n}\n\n/** The host group `req` was routed by, or `null` when `route.domains` is not configured. */\nexport function requestDomain(req: Request): ResolvedDomain | null {\n return domains.get(req) ?? null;\n}\n",
|
|
12
|
-
"import { parseCookieHeader } from \"./getCookies\";\nimport { isModelOriginated } from \"./modelOriginated\";\nimport { parseRangeHeader } from \"./range\";\nimport { RequestContext } from \"./requestContext\";\nimport { requestDomain } from \"./requestDomain\";\nimport { ValidationError } from \"./Router\";\nimport type { ResolvedDomain } from \"../services/router/DomainResolver\";\n\nclass Input<T> {\n constructor(private data: T) {}\n\n public get<K extends keyof T>(key: K): T[K] {\n return this.data[key];\n }\n\n public has(key: keyof T) {\n return this.data[key] !== undefined;\n }\n\n public toJSON(): T {\n return this.data;\n }\n}\n\n// Formats B KB MB GB TB\n// e.g parseFileSizeString(\"1MB\") => 1024 * 1024\nfunction parseFileSizeString(size: string) {\n const [number, unit] = size.match(/\\d+|\\D+/g) ?? [];\n if (!number || !unit) {\n return 0;\n }\n const fileSize = Number.parseInt(number);\n switch (unit) {\n case \"B\":\n return fileSize;\n case \"KB\":\n return fileSize * 1024;\n case \"MB\":\n return fileSize * 1024 * 1024;\n case \"GB\":\n return fileSize * 1024 * 1024 * 1024;\n case \"TB\":\n return fileSize * 1024 * 1024 * 1024 * 1024;\n default:\n return 0;\n }\n}\n\n// Formats png, jpg, ttf, excel, csv, word, pdf, json\n// Eg. png => image/png\nfunction parseFileTypeString(type: string) {\n switch (type) {\n case \"image\":\n return \"image\";\n case \"png\":\n return \"image/png\";\n case \"jpg\":\n return \"image/jpeg\";\n case \"jpeg\":\n return \"image/jpeg\";\n case \"ttf\":\n return \"font/ttf\";\n case \"excel\":\n return \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\";\n case \"csv\":\n return \"text/csv\";\n case \"word\":\n return \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\";\n case \"pdf\":\n return \"application/pdf\";\n case \"json\":\n return \"application/json\";\n default:\n return type;\n }\n}\n\nfunction validate(ruleName: string) {\n const [rule, param] = ruleName.split(\":\");\n switch (rule) {\n case \"required\":\n return (value: any) => {\n if (value instanceof Blob) {\n return value.size > 0;\n }\n return value !== null && value !== undefined && value?.length > 0;\n };\n case \"password\":\n return (value: any) => {\n // min 8 characters\n // at least one uppercase letter,\n // at least one lowercase letter and one number\n // at least one special character\n const passwordRegex =\n /^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9]).{8,}$/;\n return passwordRegex.test(value);\n };\n\n case \"number\":\n return (value: any) => {\n if (typeof value !== \"number\") return false;\n\n return !Number.isNaN(value);\n };\n case \"min\":\n return (value: any) => {\n return value?.length >= Number.parseInt(param);\n };\n case \"max\":\n return (value: any) => {\n return value?.length <= Number.parseInt(param);\n };\n case \"email\":\n return (value: any) => {\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n return emailRegex.test(value);\n };\n case \"file\":\n return (value: any) => {\n return value instanceof Blob;\n };\n case \"fileType\":\n return (value: Blob) => {\n if (value instanceof Blob) {\n const parsedType = parseFileTypeString(param);\n return value.type.startsWith(parsedType);\n }\n };\n\n case \"fileSize\":\n return (value: Blob) => {\n if (value instanceof Blob) {\n const absoluteSize = parseFileSizeString(param);\n return value.size <= absoluteSize;\n }\n };\n default:\n return () => true;\n }\n}\n\ntype StringType = \"string\";\ntype NumberType = \"number\";\ntype BooleanType = \"boolean\";\ntype MinLengthType = `min:${number}`;\ntype MaxLengthType = `max:${number}`;\ntype RequiredType = \"required\";\ntype FileType = \"file\";\ntype FileTypeType = \"fileType:${string}\";\ntype FileSizeType = \"fileSize:${string}\";\ntype SchemaKey =\n | StringType\n | NumberType\n | BooleanType\n | MinLengthType\n | MaxLengthType\n | RequiredType\n | FileType\n | FileTypeType\n | FileSizeType;\n\nexport type Schema<T extends Body> = Record<\n keyof T,\n Partial<Record<SchemaKey, string>>\n>;\n\nexport type Body = Record<string, any>;\nexport type HttpRequestKind = \"view\" | \"api\";\n\nexport class HttpRequest<\n T extends Body = Record<string, never>,\n Params = Record<string, never>,\n> {\n kind: HttpRequestKind;\n rawRequest: Request;\n headers: Omit<Headers, \"set\" | \"delete\">;\n cookies: Omit<Map<string, string>, \"set\" | \"delete\">;\n search: Input<any>;\n schema: any = {};\n routePath: string;\n params: Params;\n /**\n * The `route.domains` group this request was routed by — `domain.params`\n * holds a `:param` subdomain's value, or what `custom.resolve` returned for\n * a custom domain. `null` when the app declares no `route.domains`.\n *\n * Kept apart from `params`, which are the path's alone.\n */\n domain: ResolvedDomain | null;\n\n constructor(\n req?: Request,\n params?: any,\n kind?: HttpRequestKind,\n routePath?: string,\n ) {\n if (!req) {\n const _req = RequestContext.getStore().req;\n this.params = _req.params as any;\n this.rawRequest = _req.rawRequest;\n this.kind = _req.kind;\n this.routePath = _req.routePath;\n this.domain = _req.domain ?? null;\n } else {\n this.params = params;\n this.rawRequest = req;\n this.routePath = routePath;\n this.kind = kind ?? \"api\";\n this.domain = requestDomain(req);\n }\n\n this.headers = this.rawRequest.headers;\n\n const cookies = parseCookieHeader(this.rawRequest.headers.get(\"Cookie\"));\n const url = new URL(this.rawRequest.url);\n const map = new Map<string, string | string[]>();\n for (const [key, value] of url.searchParams) {\n if (map.has(key)) {\n const currentValue = map.get(key);\n if (Array.isArray(currentValue)) {\n currentValue.push(value);\n map.set(key, currentValue);\n } else {\n map.set(key, [currentValue, value]);\n }\n } else {\n map.set(key, value);\n }\n }\n const _params = Object.fromEntries(map.entries());\n this.search = new Input(_params);\n this.cookies = cookies;\n }\n\n locale() {\n return RequestContext.getStore().locale;\n }\n\n ctx() {\n return RequestContext.getStore();\n }\n\n /**\n * Whether the framework dispatched this request in-process for a model — a\n * tool call — rather than a client sending it. Readable in `onRequestStart`,\n * in middleware and in the handler alike.\n *\n * No header or cookie can make this true; see `http/modelOriginated.ts`.\n */\n isModelOriginated(): boolean {\n return isModelOriginated(this.rawRequest);\n }\n\n /**\n * The parsed `Range` header, or `null` when absent or unusable. Pass it to\n * `FileStorage.read(name, { range })` to range explicitly; inside a\n * `this.stream()` route `read()` already picks it up on its own.\n */\n range() {\n return parseRangeHeader(this.rawRequest.headers.get(\"Range\"));\n }\n\n refine(_input: any): any {\n return {};\n }\n\n private async parseBody() {\n let inputMap = new Input<T>({} as T);\n if (this.rawRequest.headers.get(\"Content-Type\") === \"application/json\") {\n const body = await this.rawRequest.json();\n inputMap = new Input<T>(body as T);\n }\n if (\n this.rawRequest.headers.get(\"Content-Type\") ===\n \"application/x-www-form-urlencoded\"\n ) {\n const body = (await this.rawRequest.formData()) as any; // TODO: fix type\n inputMap = new Input<T>(body as T);\n }\n\n if (\n this.rawRequest.headers\n .get(\"Content-Type\")\n ?.startsWith(\"multipart/form-data\")\n ) {\n const body = (await this.rawRequest.formData()) as any; // TODO: fix type\n const _inputMap = new Map<string, any>();\n for (const [key, value] of body.entries()) {\n if (_inputMap.has(key)) {\n const currentValue = _inputMap.get(key);\n if (Array.isArray(currentValue)) {\n currentValue.push(value);\n _inputMap.set(key, currentValue);\n } else {\n _inputMap.set(key, [currentValue, value] as any);\n }\n } else {\n _inputMap.set(key, value as T[keyof T]);\n }\n }\n inputMap = new Input<T>(Object.fromEntries(_inputMap.entries()) as T);\n }\n return inputMap;\n }\n\n private validateInput(input: Input<T>) {\n const errors: Record<string, string[]> = {};\n for (const [key, rules] of Object.entries(this.schema)) {\n for (const [rule, message] of Object.entries(rules)) {\n const validator = validate(rule);\n\n let _message = message;\n let _isValid = false;\n if (typeof message === \"function\") {\n _message = message(input.get(key));\n _isValid = typeof _message === \"undefined\";\n } else {\n _isValid = validator(input.get(key));\n }\n\n if (_isValid) {\n continue;\n }\n\n if (!input.get(key) && !Object.keys(rules).includes(\"required\")) {\n continue;\n }\n\n if (!errors[key]) {\n errors[key] = [];\n }\n\n if (rule === \"required\") {\n errors[key] = [String(_message)];\n continue;\n }\n\n errors[key].push(String(_message));\n }\n }\n\n for (const [key, value] of Object.entries(\n this.refine(input.toJSON()) ?? {},\n )) {\n if (!errors[key]) {\n errors[key] = [];\n }\n errors[key] = [...(errors[key] ?? []), value as string];\n }\n\n if (Object.keys(errors).length > 0) {\n throw new ValidationError(errors);\n }\n\n return input;\n }\n\n async input(): Promise<Input<T>> {\n return this.validateInput(await this.parseBody());\n }\n\n async safeInput(): Promise<{\n isValid: boolean;\n errors: Record<string, string[]>;\n input: Input<T>;\n }> {\n const input = await this.parseBody();\n try {\n this.validateInput(input);\n return {\n isValid: true,\n errors: {},\n input,\n };\n } catch (err) {\n if (!(err instanceof ValidationError)) {\n throw err;\n }\n return {\n isValid: false,\n errors: err.errors,\n input,\n };\n }\n }\n}\n",
|
|
12
|
+
"import { parseCookieHeader } from \"./getCookies\";\nimport { isModelOriginated } from \"./modelOriginated\";\nimport { parseRangeHeader } from \"./range\";\nimport { RequestContext } from \"./requestContext\";\nimport { requestDomain } from \"./requestDomain\";\nimport { ValidationError } from \"./Router\";\nimport type { ResolvedDomain } from \"../services/router/DomainResolver\";\n\nclass Input<T> {\n constructor(private data: T) {}\n\n public get<K extends keyof T>(key: K): T[K] {\n return this.data[key];\n }\n\n public has(key: keyof T) {\n return this.data[key] !== undefined;\n }\n\n public toJSON(): T {\n return this.data;\n }\n}\n\n// Formats B KB MB GB TB\n// e.g parseFileSizeString(\"1MB\") => 1024 * 1024\nfunction parseFileSizeString(size: string) {\n const [number, unit] = size.match(/\\d+|\\D+/g) ?? [];\n if (!number || !unit) {\n return 0;\n }\n const fileSize = Number.parseInt(number);\n switch (unit) {\n case \"B\":\n return fileSize;\n case \"KB\":\n return fileSize * 1024;\n case \"MB\":\n return fileSize * 1024 * 1024;\n case \"GB\":\n return fileSize * 1024 * 1024 * 1024;\n case \"TB\":\n return fileSize * 1024 * 1024 * 1024 * 1024;\n default:\n return 0;\n }\n}\n\n// Formats png, jpg, ttf, excel, csv, word, pdf, json\n// Eg. png => image/png\nfunction parseFileTypeString(type: string) {\n switch (type) {\n case \"image\":\n return \"image\";\n case \"png\":\n return \"image/png\";\n case \"jpg\":\n return \"image/jpeg\";\n case \"jpeg\":\n return \"image/jpeg\";\n case \"ttf\":\n return \"font/ttf\";\n case \"excel\":\n return \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\";\n case \"csv\":\n return \"text/csv\";\n case \"word\":\n return \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\";\n case \"pdf\":\n return \"application/pdf\";\n case \"json\":\n return \"application/json\";\n default:\n return type;\n }\n}\n\n/** The length of the things that have one — `undefined` for everything else,\n * rather than the `undefined` that arithmetic silently turns into `false`. */\nfunction lengthOf(value: any): number | undefined {\n if (typeof value === \"string\" || Array.isArray(value)) return value.length;\n return undefined;\n}\n\nfunction isNumber(value: any): value is number {\n return typeof value === \"number\" && !Number.isNaN(value);\n}\n\nfunction validate(ruleName: string) {\n const [rule, param] = ruleName.split(\":\");\n switch (rule) {\n /**\n * Present. Not \"non-empty for the two types that happen to have `.length`\".\n *\n * This used to end in `value?.length > 0`, which is `undefined > 0` — so\n * `false` — for every value that is not a string, an array or a Blob. A\n * number failed it. A boolean failed it. A plain object failed it, which on\n * a typed `HttpRequest<{ theme: { … } }>` is the ordinary case, and the app\n * saw a 400 on a request that was correct.\n *\n * `0` and `false` PASS. They are values someone sent, and a rule called\n * `required` asks whether the field is there, not whether it is truthy —\n * conflating those is how a checkbox set to \"no\" and a quantity of zero get\n * rejected as missing. Emptiness is still emptiness where the concept\n * applies: `\"\"` and `[]` fail, as they did before, and so does a zero-byte\n * upload.\n *\n * `{}` passes. It is an object that was sent; whether its contents are\n * adequate is a question for the rules on its fields, not for this one.\n */\n case \"required\":\n return (value: any) => {\n if (value instanceof Blob) {\n return value.size > 0;\n }\n if (value === null || value === undefined) {\n return false;\n }\n if (typeof value === \"string\" || Array.isArray(value)) {\n return value.length > 0;\n }\n return true;\n };\n case \"password\":\n return (value: any) => {\n // min 8 characters\n // at least one uppercase letter,\n // at least one lowercase letter and one number\n // at least one special character\n const passwordRegex = /^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9]).{8,}$/;\n return passwordRegex.test(value);\n };\n\n case \"number\":\n return (value: any) => {\n if (typeof value !== \"number\") return false;\n\n return !Number.isNaN(value);\n };\n /**\n * Length, and only length. `min:3` is \"at least three characters\", never\n * \"at least three\".\n *\n * ONE NAME, ONE COMPARISON, deliberately. The tempting fix was to overload\n * these by runtime type — length for a string, magnitude for a number — and\n * that is the shape `required` was already in: a rule whose meaning depends\n * on what it is handed, which reads fine until the value's type is not the\n * one the author pictured. `gte` / `lte` below say which comparison they\n * make in their names, so nothing has to be inferred.\n *\n * Written out rather than left as `value?.length >= n` so that a number\n * fails here for a stated reason instead of by arithmetic on `undefined`.\n */\n case \"min\":\n return (value: any) => {\n const length = lengthOf(value);\n return length !== undefined && length >= Number.parseInt(param);\n };\n case \"max\":\n return (value: any) => {\n const length = lengthOf(value);\n return length !== undefined && length <= Number.parseInt(param);\n };\n /** Magnitude, for numbers. The counterpart `min` / `max` deliberately are not. */\n case \"gte\":\n return (value: any) => isNumber(value) && value >= Number(param);\n case \"lte\":\n return (value: any) => isNumber(value) && value <= Number(param);\n case \"email\":\n return (value: any) => {\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n return emailRegex.test(value);\n };\n case \"file\":\n return (value: any) => {\n return value instanceof Blob;\n };\n case \"fileType\":\n return (value: Blob) => {\n if (value instanceof Blob) {\n const parsedType = parseFileTypeString(param);\n return value.type.startsWith(parsedType);\n }\n };\n\n case \"fileSize\":\n return (value: Blob) => {\n if (value instanceof Blob) {\n const absoluteSize = parseFileSizeString(param);\n return value.size <= absoluteSize;\n }\n };\n default:\n return () => true;\n }\n}\n\n/**\n * The rule table, for `http/validate.test.ts`.\n *\n * Exported under this name rather than as `validate` because it is not part of\n * the framework's surface — nothing outside this file should be building\n * predicates by hand — and because a rule table whose only test goes through a\n * constructed `HttpRequest` is one whose gaps are invisible. The bug this\n * guards against was a predicate that was wrong for every type but two.\n */\nexport const __validateForTests = validate;\n\ntype StringType = \"string\";\ntype NumberType = \"number\";\ntype BooleanType = \"boolean\";\ntype MinLengthType = `min:${number}`;\ntype MaxLengthType = `max:${number}`;\n/** Magnitude, for numbers — see `validate`'s `min` case for why these are not\n * the same rule wearing different names. */\ntype GreaterOrEqualType = `gte:${number}`;\ntype LessOrEqualType = `lte:${number}`;\ntype RequiredType = \"required\";\ntype FileType = \"file\";\n// Backticks, not quotes. These two were written with double quotes, which makes\n// them the *literal text* `fileType:${string}` rather than a template literal\n// type — so `fileType:image/png`, the only way anyone would ever write the rule,\n// did not typecheck, while the runtime handled it perfectly well.\ntype FileTypeType = `fileType:${string}`;\ntype FileSizeType = `fileSize:${string}`;\ntype SchemaKey =\n | StringType\n | NumberType\n | BooleanType\n | MinLengthType\n | MaxLengthType\n | GreaterOrEqualType\n | LessOrEqualType\n | RequiredType\n | FileType\n | FileTypeType\n | FileSizeType;\n\nexport type Schema<T extends Body> = Record<keyof T, Partial<Record<SchemaKey, string>>>;\n\nexport type Body = Record<string, any>;\nexport type HttpRequestKind = \"view\" | \"api\";\n\nexport class HttpRequest<T extends Body = Record<string, never>, Params = Record<string, never>> {\n kind: HttpRequestKind;\n rawRequest: Request;\n headers: Omit<Headers, \"set\" | \"delete\">;\n cookies: Omit<Map<string, string>, \"set\" | \"delete\">;\n search: Input<any>;\n schema: any = {};\n routePath: string;\n params: Params;\n /**\n * The `route.domains` group this request was routed by — `domain.params`\n * holds a `:param` subdomain's value, or what `custom.resolve` returned for\n * a custom domain. `null` when the app declares no `route.domains`.\n *\n * Kept apart from `params`, which are the path's alone.\n */\n domain: ResolvedDomain | null;\n\n constructor(req?: Request, params?: any, kind?: HttpRequestKind, routePath?: string) {\n if (!req) {\n const _req = RequestContext.getStore().req;\n this.params = _req.params as any;\n this.rawRequest = _req.rawRequest;\n this.kind = _req.kind;\n this.routePath = _req.routePath;\n this.domain = _req.domain ?? null;\n } else {\n this.params = params;\n this.rawRequest = req;\n this.routePath = routePath;\n this.kind = kind ?? \"api\";\n this.domain = requestDomain(req);\n }\n\n this.headers = this.rawRequest.headers;\n\n const cookies = parseCookieHeader(this.rawRequest.headers.get(\"Cookie\"));\n const url = new URL(this.rawRequest.url);\n const map = new Map<string, string | string[]>();\n for (const [key, value] of url.searchParams) {\n if (map.has(key)) {\n const currentValue = map.get(key);\n if (Array.isArray(currentValue)) {\n currentValue.push(value);\n map.set(key, currentValue);\n } else {\n map.set(key, [currentValue, value]);\n }\n } else {\n map.set(key, value);\n }\n }\n const _params = Object.fromEntries(map.entries());\n this.search = new Input(_params);\n this.cookies = cookies;\n }\n\n locale() {\n return RequestContext.getStore().locale;\n }\n\n ctx() {\n return RequestContext.getStore();\n }\n\n /**\n * Whether the framework dispatched this request in-process for a model — a\n * tool call — rather than a client sending it. Readable in `onRequestStart`,\n * in middleware and in the handler alike.\n *\n * No header or cookie can make this true; see `http/modelOriginated.ts`.\n */\n isModelOriginated(): boolean {\n return isModelOriginated(this.rawRequest);\n }\n\n /**\n * The parsed `Range` header, or `null` when absent or unusable. Pass it to\n * `FileStorage.read(name, { range })` to range explicitly; inside a\n * `this.stream()` route `read()` already picks it up on its own.\n */\n range() {\n return parseRangeHeader(this.rawRequest.headers.get(\"Range\"));\n }\n\n refine(_input: any): any {\n return {};\n }\n\n private async parseBody() {\n let inputMap = new Input<T>({} as T);\n if (this.rawRequest.headers.get(\"Content-Type\") === \"application/json\") {\n const body = await this.rawRequest.json();\n inputMap = new Input<T>(body as T);\n }\n if (this.rawRequest.headers.get(\"Content-Type\") === \"application/x-www-form-urlencoded\") {\n const body = (await this.rawRequest.formData()) as any; // TODO: fix type\n inputMap = new Input<T>(body as T);\n }\n\n if (this.rawRequest.headers.get(\"Content-Type\")?.startsWith(\"multipart/form-data\")) {\n const body = (await this.rawRequest.formData()) as any; // TODO: fix type\n const _inputMap = new Map<string, any>();\n for (const [key, value] of body.entries()) {\n if (_inputMap.has(key)) {\n const currentValue = _inputMap.get(key);\n if (Array.isArray(currentValue)) {\n currentValue.push(value);\n _inputMap.set(key, currentValue);\n } else {\n _inputMap.set(key, [currentValue, value] as any);\n }\n } else {\n _inputMap.set(key, value as T[keyof T]);\n }\n }\n inputMap = new Input<T>(Object.fromEntries(_inputMap.entries()) as T);\n }\n return inputMap;\n }\n\n private validateInput(input: Input<T>) {\n const errors: Record<string, string[]> = {};\n for (const [key, rules] of Object.entries(this.schema)) {\n for (const [rule, message] of Object.entries(rules)) {\n const validator = validate(rule);\n\n let _message = message;\n let _isValid = false;\n if (typeof message === \"function\") {\n _message = message(input.get(key));\n _isValid = typeof _message === \"undefined\";\n } else {\n _isValid = validator(input.get(key));\n }\n\n if (_isValid) {\n continue;\n }\n\n if (!input.get(key) && !Object.keys(rules).includes(\"required\")) {\n continue;\n }\n\n if (!errors[key]) {\n errors[key] = [];\n }\n\n if (rule === \"required\") {\n errors[key] = [String(_message)];\n continue;\n }\n\n errors[key].push(String(_message));\n }\n }\n\n for (const [key, value] of Object.entries(this.refine(input.toJSON()) ?? {})) {\n if (!errors[key]) {\n errors[key] = [];\n }\n errors[key] = [...(errors[key] ?? []), value as string];\n }\n\n if (Object.keys(errors).length > 0) {\n throw new ValidationError(errors);\n }\n\n return input;\n }\n\n async input(): Promise<Input<T>> {\n return this.validateInput(await this.parseBody());\n }\n\n async safeInput(): Promise<{\n isValid: boolean;\n errors: Record<string, string[]>;\n input: Input<T>;\n }> {\n const input = await this.parseBody();\n try {\n this.validateInput(input);\n return {\n isValid: true,\n errors: {},\n input,\n };\n } catch (err) {\n if (!(err instanceof ValidationError)) {\n throw err;\n }\n return {\n isValid: false,\n errors: err.errors,\n input,\n };\n }\n }\n}\n",
|
|
13
13
|
"import { RequestBreakerError } from \"./Error\";\nimport { formatUnsatisfiedContentRange } from \"./range\";\n\nexport class AuthorizationError extends RequestBreakerError {\n private error: string;\n constructor(error: string = \"Not authorized\") {\n super(error);\n this.name = \"AuthorizationError\";\n this.error = error;\n this.payload = {\n api: {\n status: 401,\n data: { error: this.error },\n },\n view: {},\n };\n }\n}\n\n/**\n * A signed-in user who is not allowed to do this. Thrown by `Auth.guard()`.\n *\n * 403, not 401: a 401 tells the client to re-authenticate, so a client that\n * sends a 401 to the sign-in page would loop a signed-in user without the role\n * straight back to where they started. A request with no user at all is\n * `AuthenticationError`, which stays 401.\n */\nexport class InsufficientPermissionsError extends RequestBreakerError {\n /**\n * The status of `payload.api`, which answers API routes and `.json` view\n * navigations alike. Before 0.63 it was 401, and a shipped native client may\n * still branch on that — it cannot be rolled forward in the same deploy as\n * the server. Such an app sets this back to 401 once at boot, and removes the\n * line when its clients handle 403:\n *\n * ```ts\n * InsufficientPermissionsError.apiStatus = 401;\n * ```\n *\n * A full page load answers 403 either way; before 0.63 it fell through to\n * the view dispatcher's 400 default, which no client could have relied on.\n */\n static apiStatus: 401 | 403 = 403;\n\n private error: string;\n constructor(error: string = \"Insufficient permissions\") {\n super(error);\n this.name = \"InsufficientPermissionsError\";\n this.error = error;\n this.payload = {\n api: {\n status: InsufficientPermissionsError.apiStatus,\n data: { error: this.error },\n },\n // Without a status a view request would fall through to the\n // dispatcher's 400 default.\n view: { status: 403 },\n };\n }\n}\n\n/**\n * A `Range` that cannot be satisfied against the object's current size.\n *\n * Extends `RequestBreakerError` so a bare `FileStorage.read()` inside an\n * ordinary route still produces a correct 416 — and, importantly, so it does\n * not trip `onRequestFail`. A 416 is the client's header being wrong about the\n * object, not a server failure.\n */\nexport class RangeNotSatisfiableError extends RequestBreakerError {\n constructor(public total: number) {\n super(\"Range not satisfiable\");\n this.name = \"RangeNotSatisfiableError\";\n this.payload = {\n api: {\n status: 416,\n data: { error: { message: \"Range not satisfiable\" } },\n headers: {\n \"Content-Range\": formatUnsatisfiedContentRange(total),\n \"Accept-Ranges\": \"bytes\",\n // Decided by the client's own Range against the object's current\n // length, so it must never be replayed from a cache to a request\n // that did not ask for that window.\n \"Cache-Control\": \"no-store\",\n },\n },\n view: {},\n };\n }\n}\n\nexport class FileNotFoundError extends RequestBreakerError {\n constructor(public fileName: string) {\n super(\"File not found\");\n this.name = \"FileNotFoundError\";\n this.payload = {\n api: {\n status: 404,\n data: { error: { message: \"Not found\" } },\n headers: { \"Cache-Control\": \"no-store\" },\n },\n view: {},\n };\n }\n}\n\n/**\n * No signed-in user. A 401 to an API client; a view request is sent to\n * `redirectTo` instead — a 302 for a page load, and a `Redirect` directive for\n * a `.json` navigation, so the client router follows it rather than leaving\n * the previous page on screen.\n *\n * `redirectTo` is the whole location, intended-URL parameter included.\n * `AuthenticationMiddleware` and `Auth.user()` build it from the request and\n * the `auth.signInPath` config; code throwing this by hand can pass its own.\n */\nexport class AuthenticationError extends RequestBreakerError {\n constructor(options: { redirectTo?: string } = {}) {\n super(\"Authentication error\");\n this.name = \"AuthenticationError\";\n const location = options.redirectTo ?? \"/auth/sign-in\";\n this.payload = {\n api: {\n status: 401,\n data: { error: \"Authentication error\" },\n },\n viewData: {\n status: 200,\n data: {},\n // A refusal is per-visitor, and this one answers 200 so that\n // `loadRoutePayload` reads it at all — which makes it exactly the\n // shape a shared cache would happily store and replay to the next\n // visitor. The `view` payload below says the same thing.\n headers: {\n \"Cache-Control\": \"private, no-cache, no-store, max-age=0, must-revalidate\",\n },\n directive: { kind: \"Redirect\", path: location },\n },\n view: {\n status: 302,\n headers: {\n \"Cache-Control\":\n \"private, no-cache, no-store, max-age=0, must-revalidate\",\n Location: location,\n },\n },\n };\n }\n}\n",
|
|
14
14
|
"import type { ServiceToken } from \"../container/Container\";\nimport { app } from \"../foundation/app\";\n\n/**\n * Base for the facades that front a container binding. A subclass names the\n * service it proxies with `getFacadeAccessor()` and reaches the live instance\n * through `this.getFacadeRoot()`, so the binding is resolved per call against\n * the Application for the current async context — never captured at module\n * load, which is what makes a facade swappable in tests.\n *\n * Two deliberate divergences from `Illuminate\\Support\\Facades\\Facade`:\n *\n * 1. No `__callStatic`. TypeScript has no typed equivalent, and a Proxy would\n * erase the very signatures that make these facades worth having. Subclasses\n * therefore declare explicit statics that forward to `getFacadeRoot()`.\n *\n * 2. `getFacadeAccessor()` is public, not protected. `getFacadeRoot()` types\n * its `this` structurally in order to infer the service type from the\n * accessor's return, and a protected static is not structurally assignable\n * to that.\n *\n * Facades that resolve nothing from the container — Cookie, Redirect, Url,\n * Meta — do not extend this class.\n */\nexport abstract class Facade {\n static getFacadeAccessor(): ServiceToken<any> {\n throw new Error(\n `Facade [${this.name}] does not implement getFacadeAccessor().`,\n );\n }\n\n static getFacadeRoot<T>(this: {\n getFacadeAccessor(): ServiceToken<T>;\n }): T {\n return app(this.getFacadeAccessor());\n }\n}\n",
|
|
15
15
|
"import { FileNotFoundError } from \"../../../http/errors\";\nimport type {\n IFileStorageDriver,\n PutFileOptions,\n PutFileParams,\n ReadFileParams,\n ReadResult,\n} from \"./types\";\n\nexport abstract class FileStorageDriver implements IFileStorageDriver {\n abstract fetch(params: ReadFileParams | string): Promise<Response>;\n abstract put(\n params: PutFileParams | Blob,\n options?: PutFileOptions,\n ): Promise<string>;\n abstract list(folder: string): Promise<any>;\n\n /**\n * Default `read()` for drivers that only implement `fetch()`.\n *\n * Deliberately not abstract: every driver written before `read()` existed\n * keeps compiling and gains working range support for free. It is not\n * *efficient* though — to serve a range it buffers the whole object so the\n * framework can slice it, which saves no bandwidth from the backend. Any\n * driver whose backend can range natively should override this.\n */\n async read(input: ReadFileParams | string): Promise<ReadResult> {\n const params = typeof input === \"string\" ? { name: input } : input;\n const response = await this.fetch({\n name: params.name,\n bucket: params.bucket,\n });\n\n if (!response.ok) {\n throw new FileNotFoundError(params.name);\n }\n\n const type =\n response.headers.get(\"Content-Type\") ?? \"application/octet-stream\";\n const etag = response.headers.get(\"ETag\") ?? undefined;\n const lastModifiedHeader = response.headers.get(\"Last-Modified\");\n const lastModified = lastModifiedHeader\n ? new Date(lastModifiedHeader)\n : undefined;\n\n if (params.range) {\n const blob = await response.blob();\n return {\n body: blob,\n start: 0,\n end: blob.size - 1,\n total: blob.size,\n // The range was not applied by the backend. Reporting `false` hands\n // the slicing to `createStreamResponse`, which has the total in hand.\n partial: false,\n type,\n etag,\n lastModified,\n name: params.name,\n };\n }\n\n const contentLength = Number(response.headers.get(\"Content-Length\"));\n const total = Number.isFinite(contentLength) ? contentLength : 0;\n\n return {\n body: response.body,\n start: 0,\n end: total - 1,\n total,\n partial: false,\n type,\n etag,\n lastModified,\n name: params.name,\n };\n }\n\n /**\n * Total size of an object. Used to resolve suffix ranges on backends without\n * native suffix support, and to report the total on a 416. Override with a\n * HEAD-style request wherever one is available.\n */\n async size(params: ReadFileParams | string): Promise<number> {\n const name = typeof params === \"string\" ? params : params.name;\n const bucket = typeof params === \"string\" ? undefined : params.bucket;\n const response = await this.fetch({ name, bucket });\n if (!response.ok) {\n throw new FileNotFoundError(name);\n }\n const contentLength = Number(response.headers.get(\"Content-Length\"));\n if (Number.isFinite(contentLength)) {\n await response.body?.cancel();\n return contentLength;\n }\n return (await response.blob()).size;\n }\n}\n",
|
|
16
|
-
"import type {
|
|
16
|
+
"import type { PutFileOptions, PutFileParams, ReadFileParams, ReadResult } from \"./types\";\nimport { FileStorageDriver } from \"./FileStorageDriver\";\nimport { readdir } from \"fs/promises\";\nimport { resolveRange } from \"../../../http/range\";\nimport { FileNotFoundError, RangeNotSatisfiableError } from \"../../../http/errors\";\nimport { projectRoot } from \"../../../support/discover\";\n\nexport class FileSystemDriver extends FileStorageDriver {\n private readonly configured?: string;\n\n constructor(folderPath?: string) {\n super();\n this.configured = folderPath;\n }\n\n /**\n * Computed per read, not baked into a constructor default.\n *\n * This is the second time this exact bug has been written in this repository,\n * and `LogManager.logsDirPath` carries the first one's post-mortem: a driver\n * is constructed when `app/config/filesystem.ts` is evaluated, and that\n * happens *before* the http layer sets `ROOT_DIR`. So the old default,\n * `` `${process.env.ROOT_DIR}/storage` ``, interpolated `undefined` and froze\n * it — measured, `new FileSystemDriver().folderPath` was `\"undefined/storage\"`\n * with `ROOT_DIR` unset, and stayed `\"undefined/storage\"` after the server set\n * it a moment later.\n *\n * It fails quietly, which is what makes it worth a comment rather than a\n * one-line fix: reads and writes both used the same wrong folder, so nothing\n * threw and nothing 404'd. Files simply accumulated in a stray `undefined/`\n * directory beside the project, and the only way to notice was to look.\n *\n * `projectRoot()` is the same rule `httpProd` computes `ROOT_DIR` from, so an\n * explicit folder still wins and an app that configured nothing now gets the\n * directory it always meant.\n */\n private get folderPath(): string {\n return this.configured ?? `${projectRoot()}/storage`;\n }\n\n async put(params: PutFileParams | Blob, { signal }: PutFileOptions = {}) {\n signal?.throwIfAborted();\n\n let body: Blob | File | Buffer;\n let name: string;\n\n if (params instanceof Blob) {\n body = params;\n name = `${Bun.randomUUIDv7()}.${params.type.split(\"/\")[1].split(\";\")[0]}`;\n } else {\n body = params.body;\n name = params.name;\n }\n\n const buffer =\n body instanceof Buffer\n ? body\n : body instanceof Blob || body instanceof File\n ? Buffer.from(await body.arrayBuffer())\n : \"\";\n\n const path = `${this.folderPath}/${name}`;\n\n // `Bun.write` takes no signal, and a local write is not worth interrupting\n // halfway, so the last chance to abort is once the body has been read.\n signal?.throwIfAborted();\n await Bun.write(path, buffer as any);\n\n return name;\n }\n\n async fetch(params: ReadFileParams | string) {\n let bucket = process.env.BUCKET_NAME;\n let name: string | undefined;\n\n if (typeof params === \"string\") {\n name = params;\n } else {\n bucket = params.bucket ?? bucket;\n name = params.name;\n }\n\n if (!name) {\n throw new Error(\"Object name has to be specified\");\n }\n\n const path = `${this.folderPath}/${name}`;\n const file = Bun.file(path);\n const result = Bun.file(path).stream();\n const date = new Date(file.lastModified).toUTCString();\n\n return new Response(result, {\n headers: {\n \"Content-Type\": file.type,\n \"Content-Length\": String(file.size),\n \"Cache-Control\": \"private, max-age=12000, must-revalidate\",\n // TODO: fix this.\n \"Last-Modified\": date,\n },\n });\n }\n\n async read(input: ReadFileParams | string): Promise<ReadResult> {\n const params = typeof input === \"string\" ? { name: input } : input;\n const { name, range = null } = params;\n\n if (!name) {\n throw new Error(\"Object name has to be specified\");\n }\n\n const file = Bun.file(`${this.folderPath}/${name}`);\n\n // `Bun.file()` is lazy. Without this the response commits with a 200 and\n // the ENOENT only surfaces once the stream is pulled, as an unhandled\n // rejection with the status already on the wire.\n if (!(await file.exists())) {\n throw new FileNotFoundError(name);\n }\n\n const total = file.size;\n const resolved = range ? resolveRange(range, total) : null;\n\n if (range && !resolved) {\n throw new RangeNotSatisfiableError(total);\n }\n\n const start = resolved?.start ?? 0;\n const end = resolved ? resolved.end : total - 1;\n\n return {\n // A BunFile slice stays lazy and keeps a known size, so Bun can send it\n // with a real Content-Length instead of falling back to chunked.\n body: resolved ? file.slice(start, end + 1) : file,\n start,\n end,\n total,\n partial: Boolean(resolved),\n type: file.type || \"application/octet-stream\",\n lastModified: new Date(file.lastModified),\n name,\n };\n }\n\n async size(params: ReadFileParams | string) {\n const name = typeof params === \"string\" ? params : params.name;\n const file = Bun.file(`${this.folderPath}/${name}`);\n if (!(await file.exists())) {\n throw new FileNotFoundError(name);\n }\n return file.size;\n }\n\n async list() {\n const files = await readdir(this.folderPath);\n\n return files;\n }\n}\n",
|
|
17
17
|
"import type { FileStorageDriver } from \"./drivers/FileStorageDriver\";\nimport { FileSystemDriver } from \"./drivers/FileSystemDriver\";\n\n// Config key: `filesystem`. Derived from `FileStorageServiceProvider`.\nexport interface FilesystemConfig {\n driver?: FileStorageDriver;\n}\n\nexport function defineFilesystemConfig(\n config: FilesystemConfig,\n): FilesystemConfig {\n return config;\n}\n\nexport function filesystemConfigDefaults(): Required<FilesystemConfig> {\n return {\n driver: new FileSystemDriver(),\n };\n}\n",
|
|
18
18
|
"import type { FileStorageDriver } from \"./drivers/FileStorageDriver\";\nimport { filesystemConfigDefaults, type FilesystemConfig } from \"./config\";\n\nexport class FilesystemManager {\n static token = \"filesystem\";\n\n readonly driver: FileStorageDriver;\n\n constructor(config: FilesystemConfig = {}) {\n this.driver = config.driver ?? filesystemConfigDefaults().driver;\n }\n}\n",
|
|
19
19
|
"//@ts-ignore - type-only; the module itself is loaded on first use by `metadata()`.\nimport type sharp from \"sharp\";\n\nimport { Buffer } from \"node:buffer\";\nimport { loadSharp } from \"../support/sharp\";\nimport type { Prettify } from \"../utils/type\";\n\nimport { RequestContext } from \"../http/requestContext\";\nimport type { ByteRange } from \"../http/range\";\nimport type {\n PutFileOptions,\n PutFileParams,\n ReadFileParams,\n ReadResult,\n} from \"../services/file-storage/drivers/types\";\nimport { FilesystemManager } from \"../services/file-storage/FilesystemManager\";\nimport { Facade } from \"./Facade\";\n\ntype Metadata = Prettify<sharp.Metadata>;\n\nexport class Storage extends Facade {\n static getFacadeAccessor() {\n return FilesystemManager;\n }\n\n /**\n * Stores a file and returns its object name. Pass `{ signal }` to cancel the\n * upload, e.g. with the incoming request's signal or `AbortSignal.timeout()`.\n */\n static async put(params: PutFileParams | Blob, options: PutFileOptions = {}) {\n return this.getFacadeRoot().driver.put(params, options);\n }\n\n static async metadata(obj: Blob | File): Promise<Partial<Metadata>> {\n const buffer = Buffer.from(await obj.arrayBuffer());\n // Outside the catch: the empty object below means \"this blob is not an\n // image sharp can read\", and a missing `sharp` install must not be able to\n // hide behind it.\n const sharp = await loadSharp(\"Storage.metadata()\");\n try {\n return await sharp(buffer).metadata();\n } catch {\n return {};\n }\n }\n\n static async fetch(params: ReadFileParams | string) {\n return this.getFacadeRoot().driver.fetch(params);\n }\n\n /**\n * Reads an object as bytes plus metadata, pushing any byte range down to the\n * storage backend so a seek transfers one window rather than the whole file.\n *\n * The range is resolved in this order: an explicit `options.range`, then a\n * `range` on `params`, then the in-flight request's `Range` header when this\n * is called inside a `this.stream()` route. Pass `{ range: null }` to force a\n * full read inside a stream route.\n */\n static async read(\n params: ReadFileParams | string,\n options: { range?: ByteRange | null } = {},\n ): Promise<ReadResult> {\n const base: ReadFileParams =\n typeof params === \"string\" ? { name: params } : { ...params };\n\n const range =\n \"range\" in options\n ? (options.range ?? null)\n : base.range !== undefined\n ? base.range\n : (RequestContext.getStore()?.rangeRequest ?? null);\n\n return this.getFacadeRoot().driver.read({\n ...base,\n range,\n });\n }\n static list(folder: string) {\n return this.getFacadeRoot().driver.list(folder);\n }\n static delete() {}\n}\n",
|
|
20
20
|
"// @ts-ignore - `sharp` is a peer dependency; only its types are wanted here.\nimport type sharpNamespace from \"sharp\";\n\n/**\n * `sharp`, imported on first use rather than at module load.\n *\n * Three modules need it — the `Sharp` optimization driver, the `Storage` facade\n * and the OG-image branch of `ViewRouteDispatcher` — and all three are reachable\n * from the `gemi/services` and `gemi/facades` barrels, which are also the only\n * door an application has to `CronJob`, `Job`, `DB` and `Lang`. A static import\n * made every one of those imports load a native binary (#403).\n *\n * `sharp` is the only one of the four that can be genuinely absent — it is a\n * peer dependency, so an install can skip its platform binary — which is why\n * the failure gets a message naming the caller rather than a bare resolution\n * error. `usedBy` is that name, written as the caller reads in a stack trace.\n *\n * No memo: the module registry already caches a resolved `import()`, and\n * caching the *failure* would make every later call report the first call's\n * stack instead of its own.\n */\nexport async function loadSharp(usedBy: string): Promise<typeof sharpNamespace> {\n try {\n // @ts-ignore - peer dependency, resolved out of the application's own tree\n return (await import(\"sharp\")).default;\n } catch (error) {\n throw new Error(\n `${usedBy} requires the 'sharp' package. Install it with \\`bun add sharp\\`.`,\n { cause: error },\n );\n }\n}\n"
|
|
21
21
|
],
|
|
22
|
-
"mappings": ";uIAEO,AAAM,LAAW,OACf,MAAO,aAEd,WAAW,EAAG,EAChB,CAIO,MAAe,UAA2B,CAAW,CAM5D,CCFO,SAAS,CAAiB,CAAC,EAAwD,CACxF,IAAM,EAAU,IAAI,IACpB,GAAI,CAAC,EACH,OAAO,EAET,QAAW,KAAQ,EAAO,MAAM,GAAG,EAAG,CACpC,IAAM,EAAK,EAAK,QAAQ,GAAG,EAC3B,GAAI,IAAO,GAAI,SACf,IAAM,EAAO,EAAK,MAAM,EAAG,CAAE,EAAE,KAAK,EACpC,GAAI,CAAC,EAAM,SACX,EAAQ,IAAI,EAAM,EAAK,MAAM,EAAK,CAAC,EAAE,KAAK,CAAC,EAE7C,OAAO,EAGF,SAAS,CAAU,CAAC,EAAmC,CAC5D,OAAO,EAAkB,EAAI,QAAQ,IAAI,QAAQ,CAAC,ECTpD,SAAS,CAAY,CAAC,EAA4B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AAM,CAAM,EAAE,SAAS,EACpC,KAAM,CACN,MAAO,CAAC,eAIC,MAAK,CAAC,EAAiC,CAClD,OAAO,KAAK,cAAc,EAAE,OAAO,MAAM,CAAM,cAYpC,KAAI,CACf,EACA,EAAwC,CAAC,EACpB,CACrB,IAAM,EACJ,OAAO,IAAW,SAAW,CAAE,KAAM,CAAO,EAAI,IAAK,CAAO,EAExD,EACJ,UAAW,EACN,EAAQ,OAAS,KAClB,EAAK,QAAU,OACb,EAAK,MACJ,EAAe,SAAS,GAAG,cAAgB,KAEpD,OAAO,KAAK,cAAc,EAAE,OAAO,KAAK,IACnC,EACH,OACF,CAAC,QAEI,KAAI,CAAC,EAAgB,CAC1B,OAAO,KAAK,cAAc,EAAE,OAAO,KAAK,CAAM,QAEzC,OAAM,EAAG,EAClB",
|
|
23
|
+
"debugId": "C0A9090C5FDB18C164756E2164756E21",
|
|
24
24
|
"names": []
|
|
25
25
|
}
|
package/dist/facades/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ac as c,Bc as d,Cc as e,Dc as g,Ec as h,Gc as i,Hc as j,Ic as k,Kc as l,Mc as m,Wc as n,Xc as o,Yc as p,qc as a}from"../chunk-
|
|
2
|
+
import{Ac as c,Bc as d,Cc as e,Dc as g,Ec as h,Gc as i,Hc as j,Ic as k,Kc as l,Mc as m,Wc as n,Xc as o,Yc as p,qc as a}from"../chunk-43asnfa8.js";import"../chunk-7438nrkm.js";import"../chunk-r77f1482.js";import{Ze as b,ef as f}from"../chunk-z7vmrf00.js";import"../chunk-g2ywq30n.js";import"../chunk-87c0cy5v.js";import"../chunk-ftaxfq7p.js";import"../chunk-7xc64j6p.js";import"../chunk-70y8wajy.js";import"../chunk-tn71d46d.js";import"../chunk-pcxxnnad.js";import"../chunk-p5m0da00.js";import"../chunk-5g1j29p2.js";import"../chunk-2dvjj3ad.js";import"../chunk-9ch1q7nd.js";import"../chunk-r6v21jn6.js";export{h as Url,f as Storage,l as Redis,a as Redirect,m as RateLimiter,g as Query,j as Meta,i as Log,e as Lang,n as Features,b as Facade,p as DB,k as Cookie,o as ConnectionQueries,c as Broadcast,d as Auth};
|
|
3
3
|
|
|
4
4
|
//# debugId=DF217F75A647957864756E2164756E21
|
|
@@ -6,16 +6,31 @@ declare class Input<T> {
|
|
|
6
6
|
has(key: keyof T): boolean;
|
|
7
7
|
toJSON(): T;
|
|
8
8
|
}
|
|
9
|
+
declare function validate(ruleName: string): (value: any) => boolean;
|
|
10
|
+
/**
|
|
11
|
+
* The rule table, for `http/validate.test.ts`.
|
|
12
|
+
*
|
|
13
|
+
* Exported under this name rather than as `validate` because it is not part of
|
|
14
|
+
* the framework's surface — nothing outside this file should be building
|
|
15
|
+
* predicates by hand — and because a rule table whose only test goes through a
|
|
16
|
+
* constructed `HttpRequest` is one whose gaps are invisible. The bug this
|
|
17
|
+
* guards against was a predicate that was wrong for every type but two.
|
|
18
|
+
*/
|
|
19
|
+
export declare const __validateForTests: typeof validate;
|
|
9
20
|
type StringType = "string";
|
|
10
21
|
type NumberType = "number";
|
|
11
22
|
type BooleanType = "boolean";
|
|
12
23
|
type MinLengthType = `min:${number}`;
|
|
13
24
|
type MaxLengthType = `max:${number}`;
|
|
25
|
+
/** Magnitude, for numbers — see `validate`'s `min` case for why these are not
|
|
26
|
+
* the same rule wearing different names. */
|
|
27
|
+
type GreaterOrEqualType = `gte:${number}`;
|
|
28
|
+
type LessOrEqualType = `lte:${number}`;
|
|
14
29
|
type RequiredType = "required";
|
|
15
30
|
type FileType = "file";
|
|
16
|
-
type FileTypeType =
|
|
17
|
-
type FileSizeType =
|
|
18
|
-
type SchemaKey = StringType | NumberType | BooleanType | MinLengthType | MaxLengthType | RequiredType | FileType | FileTypeType | FileSizeType;
|
|
31
|
+
type FileTypeType = `fileType:${string}`;
|
|
32
|
+
type FileSizeType = `fileSize:${string}`;
|
|
33
|
+
type SchemaKey = StringType | NumberType | BooleanType | MinLengthType | MaxLengthType | GreaterOrEqualType | LessOrEqualType | RequiredType | FileType | FileTypeType | FileSizeType;
|
|
19
34
|
export type Schema<T extends Body> = Record<keyof T, Partial<Record<SchemaKey, string>>>;
|
|
20
35
|
export type Body = Record<string, any>;
|
|
21
36
|
export type HttpRequestKind = "view" | "api";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpRequest.d.ts","sourceRoot":"","sources":["../../http/HttpRequest.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAExE,cAAM,KAAK,CAAC,CAAC;IACC,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,CAAC;IAEpB,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAIpC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC;IAIhB,MAAM,IAAI,CAAC;CAGnB;
|
|
1
|
+
{"version":3,"file":"HttpRequest.d.ts","sourceRoot":"","sources":["../../http/HttpRequest.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAExE,cAAM,KAAK,CAAC,CAAC;IACC,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,CAAC;IAEpB,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAIpC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC;IAIhB,MAAM,IAAI,CAAC;CAGnB;AAkED,iBAAS,QAAQ,CAAC,QAAQ,EAAE,MAAM,WAuBb,GAAG,aAoFvB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,iBAAW,CAAC;AAE3C,KAAK,UAAU,GAAG,QAAQ,CAAC;AAC3B,KAAK,UAAU,GAAG,QAAQ,CAAC;AAC3B,KAAK,WAAW,GAAG,SAAS,CAAC;AAC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CAAC;IACnB,MAAM,EAAE,GAAG,CAAM;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf;;;;;;OAMG;IACH,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;gBAElB,GAAG,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,eAAe,EAAE,SAAS,CAAC,EAAE,MAAM;IAuCnF,MAAM;IAIN,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIH;;;;;;OAMG;IACH,iBAAiB,IAAI,OAAO;IAI5B;;;;OAIG;IACH,KAAK;IAIL,MAAM,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG;YAIV,SAAS;IAgCvB,OAAO,CAAC,aAAa;IAkDf,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAI1B,SAAS,IAAI,OAAO,CAAC;QACzB,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QACjC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;KACjB,CAAC;CAoBH"}
|
package/dist/http/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ad as I,Bd as J,Cd as K,kc as m,lc as n,mc as o,nc as u,oc as v,pc as w,pd as C,qd as D,rc as x,rd as E,sc as y,tc as z,uc as A,vc as B,xd as F,yd as G,zd as H}from"../chunk-
|
|
2
|
+
import{Ad as I,Bd as J,Cd as K,kc as m,lc as n,mc as o,nc as u,oc as v,pc as w,pd as C,qd as D,rc as x,rd as E,sc as y,tc as z,uc as A,vc as B,xd as F,yd as G,zd as H}from"../chunk-43asnfa8.js";import"../chunk-7438nrkm.js";import"../chunk-r77f1482.js";import{Ce as a,De as b,Fe as c,Ie as d,Je as e,Ke as f,Le as g,Me as h,Ne as i,Re as j,Se as k,Te as l,Ue as p,Ve as q,We as r,Xe as s,Ye as t}from"../chunk-z7vmrf00.js";import"../chunk-g2ywq30n.js";import"../chunk-87c0cy5v.js";import"../chunk-ftaxfq7p.js";import"../chunk-7xc64j6p.js";import"../chunk-70y8wajy.js";import"../chunk-tn71d46d.js";import"../chunk-pcxxnnad.js";import"../chunk-p5m0da00.js";import"../chunk-5g1j29p2.js";import"../chunk-2dvjj3ad.js";import"../chunk-9ch1q7nd.js";import"../chunk-r6v21jn6.js";export{f as toRangeHeaderValue,m as toMiddlewareList,e as resolveRange,d as parseRangeHeader,g as parseContentRange,B as middlewareConfigDefaults,c as getCookies,i as formatUnsatisfiedContentRange,h as formatContentRange,A as defineMiddlewareConfig,n as createUnsatisfiableResponse,o as createStreamResponse,x as createFileResponse,E as clientIp,y as ViewRouter,k as ValidationError,b as ResourceController,j as RequestBreakerError,D as RateLimitMiddleware,C as RateLimitExceededError,r as RangeNotSatisfiableError,J as PoliciesServiceProvider,K as Policies,z as Middleware,w as McpRouter,v as McpRouteDeclaration,q as InsufficientPermissionsError,l as HttpRequest,s as FileNotFoundError,H as CorsMiddleware,a as Controller,G as CacheMiddleware,I as CSRFMiddleware,p as AuthorizationError,F as AuthenticationMiddleware,t as AuthenticationError,u as ApiRouter};
|
|
3
3
|
|
|
4
4
|
//# debugId=04E45E874725863164756E2164756E21
|
package/dist/i18n/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{aa as R}from"../chunk-q1nq7n6y.js";import"../chunk-9a8qz3s7.js";import{Wa as L}from"../chunk-adj6dnvj.js";import{hc as E,ic as V}from"../chunk-p0m3qgs5.js";import"../chunk-z4k18gnp.js";import{Cc as j}from"../chunk-
|
|
2
|
+
import{aa as R}from"../chunk-q1nq7n6y.js";import"../chunk-9a8qz3s7.js";import{Wa as L}from"../chunk-adj6dnvj.js";import{hc as E,ic as V}from"../chunk-p0m3qgs5.js";import"../chunk-z4k18gnp.js";import{Cc as j}from"../chunk-43asnfa8.js";import"../chunk-7438nrkm.js";import"../chunk-r77f1482.js";import"../chunk-z7vmrf00.js";import"../chunk-g2ywq30n.js";import"../chunk-87c0cy5v.js";import"../chunk-ftaxfq7p.js";import"../chunk-7xc64j6p.js";import"../chunk-70y8wajy.js";import{ag as X}from"../chunk-tn71d46d.js";import"../chunk-pcxxnnad.js";import"../chunk-p5m0da00.js";import"../chunk-5g1j29p2.js";import"../chunk-2dvjj3ad.js";import"../chunk-9ch1q7nd.js";import"../chunk-r6v21jn6.js";import{createElement as J,Fragment as M,isValidElement as U}from"react";function $(q,B){let G=Object.values(B).some((z)=>typeof z==="function"&&U(z(""))),Q=/{{([^{}]+?)(?::([^{}\[\]]+?))?(?:\[(.*?)\])?}}/g;if(!G)return q.replace(Q,(W,O,_,Z)=>{let C=O.includes(":")?O.split(":")[0]:O,H=B[C];if(H===void 0)return W;if(typeof H==="function"){let K=H(Z!==void 0?Z:"");if(U(K))throw Error("JSX returned in string context");return String(K)}if(_)switch(_.toLowerCase()){case"number":return Number(H).toString();case"string":return String(H);case"boolean":return Boolean(H).toString();default:return String(H)}return String(H)});else{let z=[],W=0,O=null;while((O=Q.exec(q))!==null){let[_,Z,C,H]=O,F=O.index,K=Z.includes(":")?Z.split(":")[0]:Z;if(F>W)z.push(q.substring(W,F));let Y=B[K];if(Y===void 0)z.push(_);else if(typeof Y==="function"){let A=Y(H!==void 0?H:"");z.push(A)}else if(C)switch(C.toLowerCase()){case"number":z.push(Number(Y).toString());break;case"string":z.push(String(Y));break;case"boolean":z.push(Boolean(Y).toString());break;default:z.push(String(Y))}else z.push(String(Y));W=F+_.length}if(W<q.length)z.push(q.substring(W));return J(M,{},...z)}}class P{name;dictionary;constructor(q,B){this.name=q;this.dictionary=B}reference(q){if(typeof window<"u")throw Error("Cannot use reference in the browser");if(!this.dictionary?.[q])throw Error(`Translation not found for ${String(q)}`);return this.dictionary[q]}render(q,...B){let{locale:G=j.locale(),params:Q}={params:{},...B[0]};if(typeof window<"u")throw Error("Cannot use render in the browser");if(!this.dictionary?.[q]?.[G])throw Error(`Translation not found for ${String(q)} in ${String(G)}`);return $(this.dictionary[q][G],Q??{})}static create(q,B){return new P(q,B)}static text(q,...B){let{locale:G=j.locale(),params:Q}={params:{},...B?.[0]};if(!q?.[G])throw Error(`Translation not found for ${String(G)}`);return $(q[G],Q??{})}}async function N(q,B,...G){let{locale:Q=j.locale(),params:z}={params:{},...G[0]},O=(await q.load(String(Q)))[B];if(typeof O!=="string")throw Error(`Translation not found for "${B}" in "${String(Q)}" (dictionary ${q.id})`);return $(O,z??{})}export{V as translationConfigDefaults,N as translate,E as defineTranslationConfig,R as defineDictionary,X as Translator,L as TranslationServiceProvider,P as Dictionary};
|
|
3
3
|
|
|
4
4
|
//# debugId=05D26B4E06225F6C64756E2164756E21
|
package/dist/kernel/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ya as D}from"../chunk-3pwn2r6s.js";import{Va as i}from"../chunk-sqc6fkqt.js";import{Wa as y}from"../chunk-adj6dnvj.js";import{$a as e,Bb as d,Eb as p,Hb as c,Za as U,_a as m,ab as k,bb as A,hb as w,ib as g,kb as P,lb as S,mb as h,nb as R,qb as u,rb as l,ub as v}from"../chunk-
|
|
2
|
+
import{ya as D}from"../chunk-3pwn2r6s.js";import{Va as i}from"../chunk-sqc6fkqt.js";import{Wa as y}from"../chunk-adj6dnvj.js";import{$a as e,Bb as d,Eb as p,Hb as c,Za as U,_a as m,ab as k,bb as A,hb as w,ib as g,kb as P,lb as S,mb as h,nb as R,qb as u,rb as l,ub as v}from"../chunk-j3p8c0xp.js";import"../chunk-hq496pa4.js";import"../chunk-fmcq21hg.js";import{cc as r}from"../chunk-7wgk7q33.js";import"../chunk-p0m3qgs5.js";import"../chunk-z4k18gnp.js";import{cd as x,id as B,jd as I,md as L,nd as E,od as s,sd as C,td as K,ud as t,vd as o,yc as Yj,zc as a}from"../chunk-43asnfa8.js";import{Gd as n}from"../chunk-7438nrkm.js";import{Xd as b}from"../chunk-r77f1482.js";import{Qe as _,Te as V}from"../chunk-z7vmrf00.js";import{hf as F}from"../chunk-g2ywq30n.js";import"../chunk-87c0cy5v.js";import"../chunk-ftaxfq7p.js";import"../chunk-7xc64j6p.js";import"../chunk-70y8wajy.js";import"../chunk-2bb3rdqq.js";import"../chunk-tn71d46d.js";import{cg as H,dg as f}from"../chunk-pcxxnnad.js";import{eg as T}from"../chunk-p5m0da00.js";import"../chunk-5g1j29p2.js";import"../chunk-731etrh2.js";import"../chunk-2dvjj3ad.js";import{rg as q}from"../chunk-9ch1q7nd.js";import"../chunk-r6v21jn6.js";function Jj(j){let W=j.headers.get("Cache-Control")?.toLowerCase()??"";return/(^|[\s,])(public|s-maxage)\b/.test(W)}var Nj=new Set,Wj={refusal:null,apply:(j)=>j,carried:null};async function M(j){let W=f(x);if(W.config.global.length===0)return Wj;let{pathname:X}=new URL(j.url),N=q(X),z=new V(j,{},N?"api":"view","");return await F.run(z,async()=>{let Y=F.getStore(),{headers:Z,cookies:zj}=Y,$=(J)=>{if(!Jj(J))return K(J,Z,zj);let G=new Headers(Z);return G.delete("Set-Cookie"),K(J,G,Nj)};try{return await W.runGlobalMiddleware(),{refusal:null,apply:$,carried:{user:Y.user}}}catch(J){let G=!N&&X.endsWith(".json");if(J?.kind===_){let O=N?C(J.payload.api):G?E(J.payload.viewData??J.payload.api):L(J.payload.view);return{refusal:$(O),apply:$,carried:null}}if(b(J)){console.error(J);let O=N||G?B():L(I());return{refusal:$(O),apply:$,carried:null}}throw J}finally{Y.destroy()}})}var Q=[R,l,D,w,c,k,g,u,S,m,P,p,v,h,y,d,A];class jj{config={};providers=[];services=[];serviceInstances=[];serviceTokens=new Set;servicesBooted=!1;models=[];app=new H;boot(){if(this.models.length>0)i(...this.models);else Xj();this.app.config.merge(this.config),H.setInstance(this.app),this.app.registerMany([...Q,...this.providers]),this.registerServices()}registerServices(){let j=this.serviceTokens;this.serviceInstances=[],this.serviceTokens=new Set,this.servicesBooted=!1;let W=new Map;for(let X of this.services){let N=typeof X==="function"?new X:X,z=N.constructor;if(!z.token)throw Error(`Service [${z.name}] is listed in \`services\` but does not declare a \`static token\`.`);let Y=W.get(z.token);if(Y)throw Error(`Services [${Y}] and [${z.name}] both declare the token "${z.token}". Tokens are the container's keys, so they must be unique.`);W.set(z.token,z.name);let Z=z;if(!j.has(z.token)&&this.app.bound(Z))throw Error(`Service [${z.name}] declares the token "${z.token}", which is already bound in the container by the framework or a provider. Binding it would replace that service everywhere, so pick a token nothing else owns.`);this.app.instance(Z,N),this.serviceInstances.push(N),this.serviceTokens.add(z.token)}}async waitForBoot(){await this.app.boot(),await this.bootServices(),e(this.app)}async bootServices(){if(this.servicesBooted)return;for(let j of this.serviceInstances)await j.boot();this.servicesBooted=!0}shutdown(j){return this.run(()=>this.app.shutdown(j))}run(j){return T.run(this.app,j)}resolve(j){return this.app.make(j)}apiRoutes(){return this.app.make(t)}viewRoutes(){return this.app.make(s)}domains(){return this.app.make(o)}broadcast(){return this.app.make(a)}queue(){return this.app.make(r)}globalMiddleware(j){return M(j)}destroy(){if(this.app.resolved(U))this.app.make(U).stop();if(this.app.flush(),H.getInstance()===this.app)H.setInstance(void 0);T.disable()}}function Xj(){if(Bun.env.NODE_ENV==="production")return;let j=n();if(j.length===0)return;console.warn(`[gemi] ${j.length} model${j.length===1?" is":"s are"} registered, but Kernel.models is empty.
|
|
3
3
|
Nested relation reads resolve a model by name, so a policy on a subclass that does not own its
|
|
4
4
|
`+" name is skipped inside every include \u2014 scoped at the root, "+`unscoped in an include, with nothing
|
|
5
5
|
to notice it. Declaring the modules registers each class under its own name and audits the set:
|
package/dist/server/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{wa as Y}from"../chunk-8z37k28d.js";import{xa as L}from"../chunk-wzqxtrpt.js";import{hg as b,jg as C,kg as Q,lg as V,mg as X}from"../chunk-731etrh2.js";import{qg as K}from"../chunk-2dvjj3ad.js";import"../chunk-9ch1q7nd.js";import{xg as J}from"../chunk-r6v21jn6.js";class Z{app;instrumentation;handleSignals;server;stopping;settings;constructor(z){this.app=new L({kernel:z.kernel}),this.handleSignals=z.handleSignals??!0,this.instrumentation=V(z.instrumentation??((B,$)=>$(B)))}async start(){process.env.ROOT_DIR=K();let z=Bun.env.NODE_ENV==="production";if(z){if(this.handleSignals)X(()=>this.stop());this.settings=C()}if(await this.app.waitForBoot(),z){let{httpProd:B}=await import("../chunk-
|
|
2
|
+
import{wa as Y}from"../chunk-8z37k28d.js";import{xa as L}from"../chunk-wzqxtrpt.js";import{hg as b,jg as C,kg as Q,lg as V,mg as X}from"../chunk-731etrh2.js";import{qg as K}from"../chunk-2dvjj3ad.js";import"../chunk-9ch1q7nd.js";import{xg as J}from"../chunk-r6v21jn6.js";class Z{app;instrumentation;handleSignals;server;stopping;settings;constructor(z){this.app=new L({kernel:z.kernel}),this.handleSignals=z.handleSignals??!0,this.instrumentation=V(z.instrumentation??((B,$)=>$(B)))}async start(){process.env.ROOT_DIR=K();let z=Bun.env.NODE_ENV==="production";if(z){if(this.handleSignals)X(()=>this.stop());this.settings=C()}if(await this.app.waitForBoot(),z){let{httpProd:B}=await import("../chunk-02gmyqq0.js");this.server=await B(this.app,this.instrumentation.bind(this))}else{Y();let{httpDev:B}=await import("../chunk-a85vdr77.js");this.server=await B(this.app,this.instrumentation.bind(this))}return this.server}stop(z={}){return this.stopping??=Q({server:this.server,shutdownProviders:(B)=>this.app.shutdown(B),settings:{...this.settings??C(),...z}}),this.stopping}}export{b as isShuttingDown,Z as Server};
|
|
3
3
|
|
|
4
4
|
//# debugId=58E7CE0DE71CEE0464756E2164756E21
|
|
@@ -1,8 +1,30 @@
|
|
|
1
1
|
import type { PutFileOptions, PutFileParams, ReadFileParams, ReadResult } from "./types";
|
|
2
2
|
import { FileStorageDriver } from "./FileStorageDriver";
|
|
3
3
|
export declare class FileSystemDriver extends FileStorageDriver {
|
|
4
|
-
private
|
|
4
|
+
private readonly configured?;
|
|
5
5
|
constructor(folderPath?: string);
|
|
6
|
+
/**
|
|
7
|
+
* Computed per read, not baked into a constructor default.
|
|
8
|
+
*
|
|
9
|
+
* This is the second time this exact bug has been written in this repository,
|
|
10
|
+
* and `LogManager.logsDirPath` carries the first one's post-mortem: a driver
|
|
11
|
+
* is constructed when `app/config/filesystem.ts` is evaluated, and that
|
|
12
|
+
* happens *before* the http layer sets `ROOT_DIR`. So the old default,
|
|
13
|
+
* `` `${process.env.ROOT_DIR}/storage` ``, interpolated `undefined` and froze
|
|
14
|
+
* it — measured, `new FileSystemDriver().folderPath` was `"undefined/storage"`
|
|
15
|
+
* with `ROOT_DIR` unset, and stayed `"undefined/storage"` after the server set
|
|
16
|
+
* it a moment later.
|
|
17
|
+
*
|
|
18
|
+
* It fails quietly, which is what makes it worth a comment rather than a
|
|
19
|
+
* one-line fix: reads and writes both used the same wrong folder, so nothing
|
|
20
|
+
* threw and nothing 404'd. Files simply accumulated in a stray `undefined/`
|
|
21
|
+
* directory beside the project, and the only way to notice was to look.
|
|
22
|
+
*
|
|
23
|
+
* `projectRoot()` is the same rule `httpProd` computes `ROOT_DIR` from, so an
|
|
24
|
+
* explicit folder still wins and an app that configured nothing now gets the
|
|
25
|
+
* directory it always meant.
|
|
26
|
+
*/
|
|
27
|
+
private get folderPath();
|
|
6
28
|
put(params: PutFileParams | Blob, { signal }?: PutFileOptions): Promise<string>;
|
|
7
29
|
fetch(params: ReadFileParams | string): Promise<Response>;
|
|
8
30
|
read(input: ReadFileParams | string): Promise<ReadResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileSystemDriver.d.ts","sourceRoot":"","sources":["../../../../services/file-storage/drivers/FileSystemDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"FileSystemDriver.d.ts","sourceRoot":"","sources":["../../../../services/file-storage/drivers/FileSystemDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAMxD,qBAAa,gBAAiB,SAAQ,iBAAiB;IACrD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAS;gBAEzB,UAAU,CAAC,EAAE,MAAM;IAK/B;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,OAAO,KAAK,UAAU,GAErB;IAEK,GAAG,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,EAAE,EAAE,MAAM,EAAE,GAAE,cAAmB;IA+BjE,KAAK,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM;IA+BrC,IAAI,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAyCzD,IAAI,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM;IASpC,IAAI;CAKX"}
|
package/dist/services/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ya as AW}from"../chunk-zytmxty5.js";import{Ab as vW,Bb as IW,Cb as TW,Db as hW,Eb as qW,Fb as PW,Gb as wW,Hb as yW,Za as A6,_a as GW,ab as $W,bb as XW,cb as m4,db as zW,eb as BW,fb as xW,gb as MW,hb as jW,ib as NW,jb as U,kb as LW,lb as DW,mb as FW,nb as OW,ob as HW,pb as UW,qb as SW,rb as fW,sb as RW,tb as kW,ub as _W,vb as i4,wb as o4,xb as A1,yb as CW,zb as bW}from"../chunk-
|
|
2
|
+
import{Ya as AW}from"../chunk-zytmxty5.js";import{Ab as vW,Bb as IW,Cb as TW,Db as hW,Eb as qW,Fb as PW,Gb as wW,Hb as yW,Za as A6,_a as GW,ab as $W,bb as XW,cb as m4,db as zW,eb as BW,fb as xW,gb as MW,hb as jW,ib as NW,jb as U,kb as LW,lb as DW,mb as FW,nb as OW,ob as HW,pb as UW,qb as SW,rb as fW,sb as RW,tb as kW,ub as _W,vb as i4,wb as o4,xb as A1,yb as CW,zb as bW}from"../chunk-j3p8c0xp.js";import"../chunk-hq496pa4.js";import{Kb as u6,Lb as d6,Mb as p6,Nb as l6,Ob as n6,Pb as i6,Qb as o6,Rb as s6,Sb as a6,Tb as t6,Ub as r6,Vb as e6,Wb as WW,Xb as YW,Yb as JW,Zb as ZW}from"../chunk-fmcq21hg.js";import{$b as g6,_b as V6,ac as c6,bc as E6,cc as m6}from"../chunk-7wgk7q33.js";import{hc as QW,ic as KW}from"../chunk-p0m3qgs5.js";import"../chunk-z4k18gnp.js";import{$c as U6,Fc as K6,Jc as N1,Lc as X6,Nc as z6,Oc as B6,Pc as x6,Qc as M6,Rc as j6,Sc as N6,Tc as L6,Uc as D6,Vc as F6,Zc as O6,_c as H6,ad as S6,bd as f6,cd as R6,dd as k6,ed as _6,fd as C6,hd as b6,od as v6,qc as C0,uc as r0,ud as I6,vc as e0,wc as W6,wd as T6,xc as Y6,zc as J6}from"../chunk-43asnfa8.js";import"../chunk-7438nrkm.js";import"../chunk-r77f1482.js";import{$e as Y1,Je as y1,Ke as P1,Le as W1,We as V,Xe as v,af as Z6,bf as G6,cf as $6,df as Q6}from"../chunk-z7vmrf00.js";import"../chunk-g2ywq30n.js";import"../chunk-87c0cy5v.js";import"../chunk-ftaxfq7p.js";import"../chunk-7xc64j6p.js";import"../chunk-70y8wajy.js";import{Wf as h6,Xf as q6,Yf as P6,Zf as w6,_f as y6}from"../chunk-2bb3rdqq.js";import"../chunk-tn71d46d.js";import{dg as g}from"../chunk-pcxxnnad.js";import"../chunk-p5m0da00.js";import"../chunk-5g1j29p2.js";import"../chunk-731etrh2.js";import"../chunk-2dvjj3ad.js";import"../chunk-9ch1q7nd.js";import{xg as d4}from"../chunk-r6v21jn6.js";import{Buffer as u4}from"buffer";class p4 extends Y1{client;config;constructor(...W){super();this.config=W}async connect(){let W=await import("../chunk-ex9ns7pf.js");return this.client??=new W.S3Client(...this.config),{sdk:W,client:this.client}}async put(W,{signal:Y}={}){Y?.throwIfAborted();let J,Z,G,$=process.env.BUCKET_NAME;if(W instanceof Blob)J=W,G=`${Bun.randomUUIDv7()}.${W.type.split("/")[1].split(";")[0]}`,Z=W.type;else J=W.body,G=W.name,$=W.bucket??$,Z=W.contentType||(J instanceof Blob||J instanceof File?J.type:void 0);Z=Z||void 0;let Q=J instanceof u4?J:J instanceof Blob||J instanceof File?u4.from(await J.arrayBuffer()):"",{sdk:K,client:z}=await this.connect();return Y?.throwIfAborted(),await z.send(new K.PutObjectCommand({Bucket:$,Key:G,Body:Q,ContentType:Z}),{abortSignal:Y}),G}async list(W){let{sdk:Y,client:J}=await this.connect();return await J.send(new Y.ListObjectsV2Command({Bucket:process.env.BUCKET_NAME,Prefix:W}))}async fetch(W){let Y=process.env.BUCKET_NAME,J;if(typeof W==="string")J=W;else Y=W.bucket??Y,J=W.name;if(!J)throw Error("Object name has to be specified");let{sdk:Z,client:G}=await this.connect(),$=await G.send(new Z.GetObjectCommand({Bucket:Y,Key:J}));return new Response($.Body.transformToWebStream(),{headers:{"Content-Type":$.ContentType,"Content-Length":$.ContentLength.toString(),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":$.LastModified?.toUTCString()||"",ETag:$.ETag||""}})}async read(W){let Y=typeof W==="string"?{name:W}:W,J=Y.bucket??process.env.BUCKET_NAME,{name:Z,range:G=null}=Y;if(!Z)throw Error("Object name has to be specified");let{sdk:$,client:Q}=await this.connect(),K;try{K=await Q.send(new $.GetObjectCommand({Bucket:J,Key:Z,Range:G?P1(G):void 0}))}catch(M){if(M?.name==="InvalidRange"||M?.$metadata?.httpStatusCode===416)throw new V(await this.size({name:Z,bucket:J}));if(M?.name==="NoSuchKey"||M?.$metadata?.httpStatusCode===404)throw new v(Z);throw M}let z=W1(K.ContentRange),X=Boolean(z)&&K.$metadata?.httpStatusCode===206,x=z?.total??K.ContentLength??0;return{body:K.Body.transformToWebStream(),start:z?.start??0,end:z?.end??x-1,total:x,partial:X,type:K.ContentType??"application/octet-stream",etag:K.ETag||void 0,lastModified:K.LastModified,name:Z}}async size(W){let Y=typeof W==="string"?W:W.name,J=(typeof W==="string"?void 0:W.bucket)??process.env.BUCKET_NAME,{sdk:Z,client:G}=await this.connect();try{return(await G.send(new Z.HeadObjectCommand({Bucket:J,Key:Y}))).ContentLength??0}catch($){if($?.name==="NotFound"||$?.$metadata?.httpStatusCode===404)throw new v(Y);throw $}}}import{Buffer as l4}from"buffer";import{Readable as T0}from"stream";function w1(W){return W?.statusCode===404||W?.details?.errorCode==="BlobNotFound"||W?.code==="BlobNotFound"}function h0(W){return W?.statusCode===416||W?.details?.errorCode==="InvalidRange"||W?.code==="InvalidRange"}class n4 extends Y1{config;serviceClientPromise=null;constructor(W={}){super();this.config=W}async serviceClient(){if(this.config.serviceClient)return this.config.serviceClient;return this.serviceClientPromise??=(async()=>{let W;try{W=await import("@azure/storage-blob")}catch{throw Error("AzureBlobDriver requires the '@azure/storage-blob' package. Install it with `bun add @azure/storage-blob`, or pass a pre-built `serviceClient`.")}let Y=this.config.connectionString??process.env.AZURE_STORAGE_CONNECTION_STRING;if(this.config.url)return new W.BlobServiceClient(this.config.url,this.config.credential);if(Y)return W.BlobServiceClient.fromConnectionString(Y);throw Error("AzureBlobDriver needs a connection string (AZURE_STORAGE_CONNECTION_STRING), a `url`, or a `serviceClient`.")})(),this.serviceClientPromise}async blob(W,Y){if(!W)throw Error("Object name has to be specified");let J=Y??this.config.container??process.env.BUCKET_NAME;if(!J)throw Error("AzureBlobDriver needs a container name, from `bucket`, the `container` config, or BUCKET_NAME.");return(await this.serviceClient()).getContainerClient(J).getBlockBlobClient(W)}async put(W,{signal:Y}={}){Y?.throwIfAborted();let J,Z,G,$;if(W instanceof Blob)J=W,G=`${Bun.randomUUIDv7()}.${W.type.split("/")[1].split(";")[0]}`,Z=W.type;else J=W.body,G=W.name,$=W.bucket,Z=W.contentType??(J instanceof Blob||J instanceof File?J.type:void 0);let Q=J instanceof l4?J:l4.from(await J.arrayBuffer()),K=await this.blob(G,$);return Y?.throwIfAborted(),await K.uploadData(Q,{blobHTTPHeaders:Z?{blobContentType:Z}:void 0,abortSignal:Y}),G}async list(W){let Y=this.config.container??process.env.BUCKET_NAME,Z=(await this.serviceClient()).getContainerClient(Y),G=[];for await(let $ of Z.listBlobsFlat({prefix:W}))G.push($.name);return G}async fetch(W){let Y=await this.read(typeof W==="string"?{name:W}:{name:W.name,bucket:W.bucket});return new Response(Y.body,{headers:{"Content-Type":Y.type,"Content-Length":String(Y.total),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":Y.lastModified?.toUTCString()??"",ETag:Y.etag??""}})}async read(W){let Y=typeof W==="string"?{name:W}:W,{name:J,bucket:Z,range:G=null}=Y,$=await this.blob(J,Z),Q,K,z=G?.kind==="suffix"||G?.kind==="offset"&&G.end===null&&G.start===0;if(G&&z){let k=await this.size({name:J,bucket:Z}),e=y1(G,k);if(!e)throw new V(k);Q=e.start,K=e.length}else if(G?.kind==="offset")Q=G.start,K=G.end===null?void 0:G.end-G.start+1;let X;try{X=await $.download(Q,K)}catch(k){if(h0(k))throw new V(await this.size({name:J,bucket:Z}));if(w1(k))throw new v(J);throw k}let x=W1(X.contentRange),M=Boolean(x),R=x?.total??X.contentLength??0;return{body:await q0(X),start:x?.start??0,end:x?.end??R-1,total:R,partial:M,type:X.contentType??"application/octet-stream",etag:X.etag||void 0,lastModified:X.lastModified,name:J}}async size(W){let Y=typeof W==="string"?W:W.name,J=typeof W==="string"?void 0:W.bucket,Z=await this.blob(Y,J);try{return(await Z.getProperties()).contentLength??0}catch(G){if(w1(G))throw new v(Y);throw G}}async delete(W){let Y=typeof W==="string"?W:W.name,J=typeof W==="string"?void 0:W.bucket,Z=await this.blob(Y,J);try{await Z.delete()}catch(G){if(w1(G))throw new v(Y);throw G}}}async function q0(W){if(W.blobBody)return await W.blobBody;if(W.readableStreamBody)return T0.toWeb(W.readableStreamBody);return null}var P0=`
|
|
3
3
|
local currentKey = KEYS[1]
|
|
4
4
|
local previousKey = KEYS[2]
|
|
5
5
|
local limit = tonumber(ARGV[1])
|
|
@@ -5,11 +5,21 @@ import type { HttpRequest } from "../../http/HttpRequest";
|
|
|
5
5
|
import type { McpMethod, McpRouter } from "../../http/McpRouter";
|
|
6
6
|
import type { ApiRouteDispatcher } from "../router/ApiRouteDispatcher";
|
|
7
7
|
/**
|
|
8
|
-
* Who a tool call runs as. Always an argument, never read from
|
|
8
|
+
* Who a tool call runs as. Always an argument to the registry, never read from
|
|
9
|
+
* ambient state by it.
|
|
9
10
|
*
|
|
10
11
|
* `local` is an agent running in this server, and `req` is the request that
|
|
11
|
-
* started its run — `
|
|
12
|
-
* tool was built, which is what lets one set of tools serve every
|
|
12
|
+
* started its run — read by `toAgentTools` at the moment the tool executes,
|
|
13
|
+
* not when the tool was built, which is what lets one set of tools serve every
|
|
14
|
+
* user's run.
|
|
15
|
+
*
|
|
16
|
+
* That producer *does* read ambient state, since a run no longer carries a
|
|
17
|
+
* request (see `AgentContext`), and the boundary is what keeps that from
|
|
18
|
+
* mattering here: the registry is handed a caller and dispatches as that
|
|
19
|
+
* caller, so a second producer — a job, a test, v2's remote client — supplies
|
|
20
|
+
* one however it likes, and a run with no ambient request is refused by
|
|
21
|
+
* `toAgentTools` before the registry is reached rather than dispatching as
|
|
22
|
+
* nobody.
|
|
13
23
|
* The call is dispatched with that request's credentials, so it runs as that
|
|
14
24
|
* user, through that route's middleware.
|
|
15
25
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpRegistry.d.ts","sourceRoot":"","sources":["../../../services/mcp/McpRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAsC,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;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X,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,EACb,GAAG,CAAC,EAAE,WAAW,GAChB,OAAO,CAAC,OAAO,CAAC;IA6DnB,OAAO,CAAC,IAAI;YAyHE,QAAQ;YAkCR,QAAQ;IAmCtB;;;OAGG;YACW,IAAI;CAQnB"}
|
|
@@ -5,9 +5,18 @@ import type { McpRegistry, McpToolFilter } from "./McpRegistry";
|
|
|
5
5
|
* v1's only projection.
|
|
6
6
|
*
|
|
7
7
|
* Build them once and hand them to `Agent.create`. None of them holds a user:
|
|
8
|
-
* the caller is `{ kind: "local", req
|
|
9
|
-
* executes, so the same tools run as
|
|
10
|
-
* the reason the caller is not an
|
|
8
|
+
* the caller is `{ kind: "local", req }`, where `req` is the request the run is
|
|
9
|
+
* executing inside, taken when the tool executes, so the same tools run as
|
|
10
|
+
* whichever user's run calls them. That is the reason the caller is not an
|
|
11
|
+
* argument here.
|
|
12
|
+
*
|
|
13
|
+
* AMBIENT, AND ONLY HERE. A run is not given a request (see `AgentContext`),
|
|
14
|
+
* but these tools have no other way to act as a user: the route is dispatched
|
|
15
|
+
* with the initiator's own credentials, and those live on the request. A run
|
|
16
|
+
* started by `AgentController` executes inside its request, which the run holds
|
|
17
|
+
* open until it settles, so the request is there to read. A run started from a
|
|
18
|
+
* job or a script has none, and these tools refuse there with a sentence
|
|
19
|
+
* saying so rather than dispatching as nobody.
|
|
11
20
|
*
|
|
12
21
|
* `requiresApproval` comes from the route's meta, where the app wrote it down;
|
|
13
22
|
* it is never inferred from the verb.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toAgentTools.d.ts","sourceRoot":"","sources":["../../../services/mcp/toAgentTools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"toAgentTools.d.ts","sourceRoot":"","sources":["../../../services/mcp/toAgentTools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9D,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,aAAa,GAAG,YAAY,EAAE,CAkB1F"}
|
package/package.json
CHANGED
package/dist/chunk-a85fn4zf.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{hf as C}from"./chunk-g2ywq30n.js";import{dg as w}from"./chunk-pcxxnnad.js";import{xg as u}from"./chunk-r6v21jn6.js";class V{static kind="controller";constructor(){}}class b extends V{}function j(H){let K=new Map;if(!H)return K;for(let R of H.split(";")){let P=R.indexOf("=");if(P===-1)continue;let J=R.slice(0,P).trim();if(!J)continue;K.set(J,R.slice(P+1).trim())}return K}function o(H){return j(H.headers.get("cookie"))}function Z(H){if(!/^\d+$/.test(H))return null;let K=Number(H);return Number.isSafeInteger(K)?K:null}function z(H){if(!H)return null;let K=H.trim();if(!/^bytes=/i.test(K))return null;let P=K.slice(6).split(",").map((W)=>W.trim()).filter((W)=>W!=="");if(P.length!==1)return null;let J=P[0],T=J.indexOf("-");if(T===-1)return null;let G=J.slice(0,T),O=J.slice(T+1);if(G===""){let W=Z(O);if(W===null)return null;return{kind:"suffix",suffixLength:W}}let D=Z(G);if(D===null)return null;if(O==="")return{kind:"offset",start:D,end:null};let Q=Z(O);if(Q===null||Q<D)return null;return{kind:"offset",start:D,end:Q}}function E(H,K){if(!Number.isFinite(K)||K<=0)return null;let R,P;if(H.kind==="suffix"){if(H.suffixLength<=0)return null;R=Math.max(0,K-H.suffixLength),P=K-1}else{if(H.start>=K)return null;if(R=H.start,P=H.end===null?K-1:Math.min(H.end,K-1),P<R)return null}return{start:R,end:P,length:P-R+1}}function s(H){if(H.kind==="suffix")return`bytes=-${H.suffixLength}`;return H.end===null?`bytes=${H.start}-`:`bytes=${H.start}-${H.end}`}function t(H){if(!H)return null;let K=/^bytes\s+(\d+)-(\d+)\/(\d+)$/i.exec(H.trim());if(!K)return null;let R=Z(K[1]),P=Z(K[2]),J=Z(K[3]);if(R===null||P===null||J===null||P<R)return null;return{start:R,end:P,total:J}}function r(H,K,R){return`bytes ${H}-${K}/${R}`}function q(H){return`bytes */${H}`}var e="GEMI_REQUEST_BREAKER_ERROR";class X extends Error{kind="GEMI_REQUEST_BREAKER_ERROR";payload={api:{},view:{}}}class U extends X{errors={};constructor(H){super("Validation error");this.name="ValidationError",this.errors=H,this.payload={api:{status:400,data:{error:{kind:"validation_error",messages:H}},headers:{"Content-Type":"application/json"}},view:{status:400}}}}var x=new WeakMap;function PH(H,K){x.set(H,{clientAddress:K})}function I(H){return x.has(H)}function JH(H){return x.get(H)?.clientAddress}var S=new WeakMap;function DH(H,K){S.set(H,K)}function _(H){return S.get(H)??null}class ${data;constructor(H){this.data=H}get(H){return this.data[H]}has(H){return this.data[H]!==void 0}toJSON(){return this.data}}function c(H){let[K,R]=H.match(/\d+|\D+/g)??[];if(!K||!R)return 0;let P=Number.parseInt(K);switch(R){case"B":return P;case"KB":return P*1024;case"MB":return P*1024*1024;case"GB":return P*1024*1024*1024;case"TB":return P*1024*1024*1024*1024;default:return 0}}function f(H){switch(H){case"image":return"image";case"png":return"image/png";case"jpg":return"image/jpeg";case"jpeg":return"image/jpeg";case"ttf":return"font/ttf";case"excel":return"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";case"csv":return"text/csv";case"word":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case"pdf":return"application/pdf";case"json":return"application/json";default:return H}}function v(H){let[K,R]=H.split(":");switch(K){case"required":return(P)=>{if(P instanceof Blob)return P.size>0;return P!==null&&P!==void 0&&P?.length>0};case"password":return(P)=>{return/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9]).{8,}$/.test(P)};case"number":return(P)=>{if(typeof P!=="number")return!1;return!Number.isNaN(P)};case"min":return(P)=>{return P?.length>=Number.parseInt(R)};case"max":return(P)=>{return P?.length<=Number.parseInt(R)};case"email":return(P)=>{return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(P)};case"file":return(P)=>{return P instanceof Blob};case"fileType":return(P)=>{if(P instanceof Blob){let J=f(R);return P.type.startsWith(J)}};case"fileSize":return(P)=>{if(P instanceof Blob){let J=c(R);return P.size<=J}};default:return()=>!0}}class g{kind;rawRequest;headers;cookies;search;schema={};routePath;params;domain;constructor(H,K,R,P){if(!H){let D=C.getStore().req;this.params=D.params,this.rawRequest=D.rawRequest,this.kind=D.kind,this.routePath=D.routePath,this.domain=D.domain??null}else this.params=K,this.rawRequest=H,this.routePath=P,this.kind=R??"api",this.domain=_(H);this.headers=this.rawRequest.headers;let J=j(this.rawRequest.headers.get("Cookie")),T=new URL(this.rawRequest.url),G=new Map;for(let[D,Q]of T.searchParams)if(G.has(D)){let W=G.get(D);if(Array.isArray(W))W.push(Q),G.set(D,W);else G.set(D,[W,Q])}else G.set(D,Q);let O=Object.fromEntries(G.entries());this.search=new $(O),this.cookies=J}locale(){return C.getStore().locale}ctx(){return C.getStore()}isModelOriginated(){return I(this.rawRequest)}range(){return z(this.rawRequest.headers.get("Range"))}refine(H){return{}}async parseBody(){let H=new $({});if(this.rawRequest.headers.get("Content-Type")==="application/json"){let K=await this.rawRequest.json();H=new $(K)}if(this.rawRequest.headers.get("Content-Type")==="application/x-www-form-urlencoded"){let K=await this.rawRequest.formData();H=new $(K)}if(this.rawRequest.headers.get("Content-Type")?.startsWith("multipart/form-data")){let K=await this.rawRequest.formData(),R=new Map;for(let[P,J]of K.entries())if(R.has(P)){let T=R.get(P);if(Array.isArray(T))T.push(J),R.set(P,T);else R.set(P,[T,J])}else R.set(P,J);H=new $(Object.fromEntries(R.entries()))}return H}validateInput(H){let K={};for(let[R,P]of Object.entries(this.schema))for(let[J,T]of Object.entries(P)){let G=v(J),O=T,D=!1;if(typeof T==="function")O=T(H.get(R)),D=typeof O>"u";else D=G(H.get(R));if(D)continue;if(!H.get(R)&&!Object.keys(P).includes("required"))continue;if(!K[R])K[R]=[];if(J==="required"){K[R]=[String(O)];continue}K[R].push(String(O))}for(let[R,P]of Object.entries(this.refine(H.toJSON())??{})){if(!K[R])K[R]=[];K[R]=[...K[R]??[],P]}if(Object.keys(K).length>0)throw new U(K);return H}async input(){return this.validateInput(await this.parseBody())}async safeInput(){let H=await this.parseBody();try{return this.validateInput(H),{isValid:!0,errors:{},input:H}}catch(K){if(!(K instanceof U))throw K;return{isValid:!1,errors:K.errors,input:H}}}}class h extends X{error;constructor(H="Not authorized"){super(H);this.name="AuthorizationError",this.error=H,this.payload={api:{status:401,data:{error:this.error}},view:{}}}}class F extends X{static apiStatus=403;error;constructor(H="Insufficient permissions"){super(H);this.name="InsufficientPermissionsError",this.error=H,this.payload={api:{status:F.apiStatus,data:{error:this.error}},view:{status:403}}}}class A extends X{total;constructor(H){super("Range not satisfiable");this.total=H;this.name="RangeNotSatisfiableError",this.payload={api:{status:416,data:{error:{message:"Range not satisfiable"}},headers:{"Content-Range":q(H),"Accept-Ranges":"bytes","Cache-Control":"no-store"}},view:{}}}}class Y extends X{fileName;constructor(H){super("File not found");this.fileName=H;this.name="FileNotFoundError",this.payload={api:{status:404,data:{error:{message:"Not found"}},headers:{"Cache-Control":"no-store"}},view:{}}}}class m extends X{constructor(H={}){super("Authentication error");this.name="AuthenticationError";let K=H.redirectTo??"/auth/sign-in";this.payload={api:{status:401,data:{error:"Authentication error"}},viewData:{status:200,data:{},headers:{"Cache-Control":"private, no-cache, no-store, max-age=0, must-revalidate"},directive:{kind:"Redirect",path:K}},view:{status:302,headers:{"Cache-Control":"private, no-cache, no-store, max-age=0, must-revalidate",Location:K}}}}}class L{static getFacadeAccessor(){throw Error(`Facade [${this.name}] does not implement getFacadeAccessor().`)}static getFacadeRoot(){return w(this.getFacadeAccessor())}}class B{async read(H){let K=typeof H==="string"?{name:H}:H,R=await this.fetch({name:K.name,bucket:K.bucket});if(!R.ok)throw new Y(K.name);let P=R.headers.get("Content-Type")??"application/octet-stream",J=R.headers.get("ETag")??void 0,T=R.headers.get("Last-Modified"),G=T?new Date(T):void 0;if(K.range){let Q=await R.blob();return{body:Q,start:0,end:Q.size-1,total:Q.size,partial:!1,type:P,etag:J,lastModified:G,name:K.name}}let O=Number(R.headers.get("Content-Length")),D=Number.isFinite(O)?O:0;return{body:R.body,start:0,end:D-1,total:D,partial:!1,type:P,etag:J,lastModified:G,name:K.name}}async size(H){let K=typeof H==="string"?H:H.name,R=typeof H==="string"?void 0:H.bucket,P=await this.fetch({name:K,bucket:R});if(!P.ok)throw new Y(K);let J=Number(P.headers.get("Content-Length"));if(Number.isFinite(J))return await P.body?.cancel(),J;return(await P.blob()).size}}import{readdir as d}from"fs/promises";class M extends B{folderPath;constructor(H=`${process.env.ROOT_DIR}/storage`){super();this.folderPath=H}async put(H,{signal:K}={}){K?.throwIfAborted();let R,P;if(H instanceof Blob)R=H,P=`${Bun.randomUUIDv7()}.${H.type.split("/")[1].split(";")[0]}`;else R=H.body,P=H.name;let J=R instanceof Buffer?R:R instanceof Blob||R instanceof File?Buffer.from(await R.arrayBuffer()):"",T=`${this.folderPath}/${P}`;return K?.throwIfAborted(),await Bun.write(T,J),P}async fetch(H){let K=process.env.BUCKET_NAME,R;if(typeof H==="string")R=H;else K=H.bucket??K,R=H.name;if(!R)throw Error("Object name has to be specified");let P=`${this.folderPath}/${R}`,J=Bun.file(P),T=Bun.file(P).stream(),G=new Date(J.lastModified).toUTCString();return new Response(T,{headers:{"Content-Type":J.type,"Content-Length":String(J.size),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":G}})}async read(H){let K=typeof H==="string"?{name:H}:H,{name:R,range:P=null}=K;if(!R)throw Error("Object name has to be specified");let J=Bun.file(`${this.folderPath}/${R}`);if(!await J.exists())throw new Y(R);let T=J.size,G=P?E(P,T):null;if(P&&!G)throw new A(T);let O=G?.start??0,D=G?G.end:T-1;return{body:G?J.slice(O,D+1):J,start:O,end:D,total:T,partial:Boolean(G),type:J.type||"application/octet-stream",lastModified:new Date(J.lastModified),name:R}}async size(H){let K=typeof H==="string"?H:H.name,R=Bun.file(`${this.folderPath}/${K}`);if(!await R.exists())throw new Y(K);return R.size}async list(){return await d(this.folderPath)}}function IH(H){return H}function k(){return{driver:new M}}class N{static token="filesystem";driver;constructor(H={}){this.driver=H.driver??k().driver}}import{Buffer as i}from"buffer";async function y(H){try{return(await import("sharp")).default}catch(K){throw Error(`${H} requires the 'sharp' package. Install it with \`bun add sharp\`.`,{cause:K})}}class p extends L{static getFacadeAccessor(){return N}static async put(H,K={}){return this.getFacadeRoot().driver.put(H,K)}static async metadata(H){let K=i.from(await H.arrayBuffer()),R=await y("Storage.metadata()");try{return await R(K).metadata()}catch{return{}}}static async fetch(H){return this.getFacadeRoot().driver.fetch(H)}static async read(H,K={}){let R=typeof H==="string"?{name:H}:{...H},P="range"in K?K.range??null:R.range!==void 0?R.range:C.getStore()?.rangeRequest??null;return this.getFacadeRoot().driver.read({...R,range:P})}static list(H){return this.getFacadeRoot().driver.list(H)}static delete(){}}
|
|
3
|
-
export{V as Ce,b as De,j as Ee,o as Fe,PH as Ge,JH as He,z as Ie,E as Je,s as Ke,t as Le,r as Me,q as Ne,DH as Oe,_ as Pe,e as Qe,X as Re,U as Se,g as Te,h as Ue,F as Ve,A as We,Y as Xe,m as Ye,L as Ze,y as _e,B as $e,M as af,IH as bf,k as cf,N as df,p as ef};
|
|
4
|
-
|
|
5
|
-
//# debugId=7B77BADDECDA05E464756E2164756E21
|
|
File without changes
|
|
File without changes
|
|
File without changes
|