Compare commits
12
Commits
4e13d4ab9a
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
22b1417799 | ||
|
|
7cdc0ab719 | ||
|
|
e8cf990959 | ||
|
|
3ef0d86290 | ||
|
|
c3106e7e1e | ||
|
|
77c6891c6f | ||
|
|
85c7a5d99d | ||
|
|
e935dc7cc1 | ||
|
|
9fa0aff643 | ||
|
|
a6d2d6bcca | ||
|
|
18a76b04d5 | ||
|
|
11069d83d4 |
No files matched your search
@@ -3,6 +3,19 @@ name: demo-action
|
||||
|
||||
meta:
|
||||
label: { de: Demo Aktion, en: Demo Action }
|
||||
# The action shows up in GET /_openapi/:project as /_actions/demo-action,
|
||||
# with the same override block a collection uses.
|
||||
openapi:
|
||||
get:
|
||||
summary: { de: Demo-Aktion lesen, en: Read the demo action }
|
||||
parameters:
|
||||
- name: verbose
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: boolean
|
||||
post:
|
||||
summary: { de: Demo-Aktion ausführen, en: Run the demo action }
|
||||
methods:
|
||||
get:
|
||||
query:
|
||||
|
||||
Vendored
+294
-3
@@ -100,6 +100,14 @@ declare global {
|
||||
enabled?: boolean
|
||||
maxDocs?: number
|
||||
maxMemoryMB?: number
|
||||
/**
|
||||
* Obergrenze der Index-Kandidaten, die gegen den Query-Filter geprüft
|
||||
* werden, bevor die Suche auf den regulären Pfad zurückfällt.
|
||||
* 0 = Server-Default (`search.inMemory.maxFilterCandidates`, 500000),
|
||||
* negativ = keine Kappe. Die Prüfung läuft gestückelt und stoppt, sobald
|
||||
* die angeforderte Seite voll ist.
|
||||
*/
|
||||
maxFilterCandidates?: number
|
||||
}
|
||||
|
||||
export interface NgramConfig {
|
||||
@@ -515,10 +523,48 @@ declare global {
|
||||
description?: LocalizedText
|
||||
group?: string
|
||||
hide?: boolean
|
||||
/** OpenAPI overrides, same shape a collection uses in `meta.openapi` (#40). */
|
||||
openapi?: OpenapiMeta
|
||||
methods?: Record<string, ActionMethodMeta>
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
/** `meta.openapi` of a collection or an action (GET /_openapi/:project). */
|
||||
export interface OpenapiMeta {
|
||||
/** Hide the whole collection or action from the generated spec. */
|
||||
disabled?: boolean
|
||||
/** GET: collection list, or the action itself (/_actions/{name}). */
|
||||
get?: OpenapiOperationMeta
|
||||
/** Single-entry GET of a collection (/{collection}/{id}); unused by actions. */
|
||||
getOne?: OpenapiOperationMeta
|
||||
/** POST: collection create, or the action itself (/_actions/{name}). */
|
||||
post?: OpenapiOperationMeta
|
||||
put?: OpenapiOperationMeta
|
||||
delete?: OpenapiOperationMeta
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
export interface OpenapiOperationMeta {
|
||||
/** Drop this operation from the spec. */
|
||||
disabled?: boolean
|
||||
tags?: string[]
|
||||
summary?: LocalizedText
|
||||
description?: LocalizedText
|
||||
parameters?: OpenapiParameter[]
|
||||
responses?: { [status: string]: any }
|
||||
security?: Array<{ [tokenName: string]: string[] }>
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
export interface OpenapiParameter {
|
||||
name: string
|
||||
in: "query" | "header" | "path" | "cookie"
|
||||
description?: LocalizedText
|
||||
required?: boolean
|
||||
schema?: { type?: string; [key: string]: any }
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
export interface ActionMethodMeta {
|
||||
query?: {
|
||||
title?: LocalizedText
|
||||
@@ -963,9 +1009,39 @@ declare global {
|
||||
file?: string
|
||||
|
||||
/**
|
||||
* execution timeout in seconds
|
||||
* Abbruch nach dieser Zeit. Nackte Zahl = Millisekunden (Altform),
|
||||
* String = Go-Duration ("30s", "5m").
|
||||
*/
|
||||
timeout?: number
|
||||
timeout?: number | string
|
||||
|
||||
/**
|
||||
* Überschreibt die Projekt-Engine für diesen Job.
|
||||
*/
|
||||
engine?: "" | "goja" | "v8"
|
||||
}
|
||||
|
||||
/**
|
||||
* Konfigurierte Arbeitseinheit (`tasks:` im Projekt), gestartet über
|
||||
* `context.enqueue(name, data?)` — kein cron, anders als ein Job.
|
||||
* Im Task-Skript: `context.task` (diese Konfiguration) und die globale
|
||||
* Variable `data` (der Payload aus enqueue).
|
||||
*/
|
||||
interface TaskConfig {
|
||||
/** verbindlicher Task-Name im YAML (nicht der Dateiname) */
|
||||
name: string
|
||||
type: "javascript"
|
||||
/** Pfad relativ zum Projektverzeichnis */
|
||||
file?: string
|
||||
timeout?: number | string
|
||||
/** überschreibt die Projekt-Engine für diesen Task */
|
||||
engine?: "" | "goja" | "v8"
|
||||
/** maximal gleichzeitig laufende Instanzen (pro Prozess) */
|
||||
concurrency?: number
|
||||
/** Wiederholungen nach einem Fehler */
|
||||
retries?: number
|
||||
backoffBase?: number | string
|
||||
backoffMax?: number | string
|
||||
meta?: any
|
||||
}
|
||||
|
||||
interface JobData {
|
||||
@@ -1146,6 +1222,22 @@ declare global {
|
||||
maxTokensPerRequest?: number
|
||||
}[]
|
||||
}
|
||||
/**
|
||||
* JS-Engine und Betriebsgrenzen (server.js.*). `js.timeout` ist
|
||||
* eine Go-Duration ("5m"), `js.v8.wait` ebenfalls ("1s").
|
||||
*/
|
||||
js?: {
|
||||
engine?: "" | "goja" | "v8"
|
||||
timeout?: string
|
||||
memoryLimitMB?: number
|
||||
v8?: {
|
||||
poolSize?: number
|
||||
maxSessions?: number
|
||||
wait?: string
|
||||
maxOldSpaceMB?: number
|
||||
maxYoungSpaceMB?: number
|
||||
}
|
||||
}
|
||||
/** Raw JSON of config.Server.Embedding (apiKey/modelPath stripped, JSON tags decide) */
|
||||
embedding?: EmbeddingConfig
|
||||
audit?: {
|
||||
@@ -1286,6 +1378,26 @@ declare global {
|
||||
html?: string
|
||||
attach?: string | string[]
|
||||
}): void
|
||||
|
||||
/**
|
||||
* Wie `sendMail`, aber als Promise (Mailserver-Latenz blockiert den
|
||||
* Hook-Lauf nicht).
|
||||
*/
|
||||
sendMailAsync(options: {
|
||||
host?: string
|
||||
username?: string
|
||||
password?: string
|
||||
to: string | string[]
|
||||
cc?: string | string[]
|
||||
bcc?: string | string[]
|
||||
subject?: string
|
||||
from: string
|
||||
fromName?: string
|
||||
replyTo?: string
|
||||
plain?: string
|
||||
html?: string
|
||||
attach?: string | string[]
|
||||
}): Promise<void>
|
||||
}
|
||||
|
||||
interface FsPackage {
|
||||
@@ -1316,6 +1428,21 @@ declare global {
|
||||
*/
|
||||
writeFile(path: string, data: string | any): null
|
||||
|
||||
/**
|
||||
* Wie `readFile`, aber als Promise.
|
||||
*/
|
||||
readFileAsync(
|
||||
path: string,
|
||||
options?: {
|
||||
bytes: boolean // if true return []byte instead of string
|
||||
}
|
||||
): Promise<string | any>
|
||||
|
||||
/**
|
||||
* Wie `writeFile`, aber als Promise.
|
||||
*/
|
||||
writeFileAsync(path: string, data: string | any): Promise<null>
|
||||
|
||||
/**
|
||||
* stat file or directory
|
||||
*
|
||||
@@ -1354,6 +1481,12 @@ declare global {
|
||||
*/
|
||||
remove(path: string): void
|
||||
|
||||
/**
|
||||
* Wie `remove`, aber als Promise (große Bäume blockieren den
|
||||
* JS-Thread nicht).
|
||||
*/
|
||||
removeAsync(path: string): Promise<void>
|
||||
|
||||
/**
|
||||
* copy file or directory
|
||||
*
|
||||
@@ -1361,6 +1494,12 @@ declare global {
|
||||
* @param dest
|
||||
*/
|
||||
copy(src: string, dest: string): void
|
||||
|
||||
/**
|
||||
* Wie `copy`, aber als Promise (rekursives Kopieren läuft außerhalb
|
||||
* des JS-Threads).
|
||||
*/
|
||||
copyAsync(src: string, dest: string): Promise<void>
|
||||
}
|
||||
|
||||
interface TplPackage {
|
||||
@@ -1406,6 +1545,31 @@ declare global {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wie `fetch`, aber als Promise (eigener Eventloop-Slot, blockiert den
|
||||
* Hook-Lauf nicht). Signatur und Ergebnis sind identisch.
|
||||
*/
|
||||
fetchAsync(
|
||||
url: string,
|
||||
options?: {
|
||||
method?: string
|
||||
headers?: { [key: string]: string }
|
||||
body?: string
|
||||
/** timeout in seconds (default 10) */
|
||||
timeout?: number
|
||||
}
|
||||
): Promise<{
|
||||
status: number
|
||||
statusText: string
|
||||
headers: { [key: string]: string }
|
||||
trailer: { [key: string]: string }
|
||||
url: string
|
||||
body: {
|
||||
text(): string
|
||||
json(): any
|
||||
}
|
||||
}>
|
||||
|
||||
/**
|
||||
* streaming http request — response body is NOT read into memory.
|
||||
* Use body.read() to read line by line (ideal for SSE / newline-delimited
|
||||
@@ -1434,6 +1598,31 @@ declare global {
|
||||
close(): void
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wie `fetchStream`, aber das Reader-Objekt kommt als Promise.
|
||||
* `read()` bleibt synchron und liest die nächste Zeile.
|
||||
*/
|
||||
fetchStreamAsync(
|
||||
url: string,
|
||||
options?: {
|
||||
method?: string
|
||||
headers?: { [key: string]: string }
|
||||
body?: string
|
||||
/** timeout in seconds (default 0 = no timeout, hook timeout controls duration) */
|
||||
timeout?: number
|
||||
}
|
||||
): Promise<{
|
||||
status: number
|
||||
statusText: string
|
||||
headers: { [key: string]: string }
|
||||
body: {
|
||||
/** returns the next line as string, or null at EOF */
|
||||
read(): string | null
|
||||
/** explicitly closes the response body (auto-closed at EOF) */
|
||||
close(): void
|
||||
}
|
||||
}>
|
||||
}
|
||||
|
||||
interface DebugPackage {
|
||||
@@ -1611,6 +1800,11 @@ declare global {
|
||||
targetFile: string,
|
||||
filters: ImageFilterParams[]
|
||||
): void
|
||||
|
||||
/**
|
||||
* Wie `filter`, aber als Promise (CPU-/IO-lastig).
|
||||
*/
|
||||
filterAsync(sourceFile: string, targetFile: string, filters: ImageFilterParams[]): Promise<void>
|
||||
}
|
||||
|
||||
interface XmlPackage {
|
||||
@@ -1762,10 +1956,42 @@ declare global {
|
||||
mode?: "text" | "image" | "pdf"
|
||||
bytes?: any // []byte of watermark image
|
||||
file?: string // file for pdf watermark
|
||||
text?: string // text for text watermark
|
||||
text?: string
|
||||
rotation?: number
|
||||
}
|
||||
): any
|
||||
|
||||
/**
|
||||
* Wie `fromHTML`, aber als Promise (PDF-Rendering ist langsam).
|
||||
*/
|
||||
fromHTMLAsync(
|
||||
html: string,
|
||||
options?: {
|
||||
copies?: number
|
||||
dpi?: number
|
||||
grayscale?: boolean
|
||||
imageDpi?: number
|
||||
imageQuality?: number
|
||||
lowQuality?: boolean
|
||||
marginBottom?: number
|
||||
marginLeft?: number
|
||||
marginRight?: number
|
||||
marginTop?: number
|
||||
orientation?: "portrait" | "landscape"
|
||||
pageSize?: string
|
||||
noPdfCompression?: boolean
|
||||
[key: string]: any
|
||||
}
|
||||
): Promise<any>
|
||||
|
||||
/**
|
||||
* Wie `cpu`, aber als Promise.
|
||||
*/
|
||||
cpuAsync(
|
||||
command: "watermark" | "stamp" | "merge" | "rotate" | "create",
|
||||
pdfData: any | any[],
|
||||
options?: { [key: string]: any }
|
||||
): Promise<any>
|
||||
}
|
||||
|
||||
/** Byte encodings shared by the crypto/base64 hook helpers. */
|
||||
@@ -2207,6 +2433,44 @@ declare global {
|
||||
? { output: string; exitCode: number }
|
||||
: { stdout: string; stderr: string; exitCode: number }
|
||||
: string
|
||||
|
||||
/**
|
||||
* Wie `command`, aber als Promise. Externe Prozesse können lange
|
||||
* laufen; der Hook-Lauf wartet nicht blockierend.
|
||||
*/
|
||||
commandAsync(
|
||||
cmd: string,
|
||||
options?: {
|
||||
args?: string[]
|
||||
stdin?: string
|
||||
dir?: string
|
||||
env?: string[]
|
||||
timeout?: number
|
||||
returnObject?: boolean
|
||||
combineOutput?: boolean
|
||||
}
|
||||
): Promise<string>
|
||||
|
||||
commandAsync<
|
||||
T extends {
|
||||
args?: string[]
|
||||
stdin?: string
|
||||
dir?: string
|
||||
env?: string[]
|
||||
timeout?: number
|
||||
returnObject?: boolean
|
||||
combineOutput?: boolean
|
||||
},
|
||||
>(
|
||||
cmd: string,
|
||||
options: T
|
||||
): Promise<
|
||||
T["returnObject"] extends true
|
||||
? T["combineOutput"] extends true
|
||||
? { output: string; exitCode: number }
|
||||
: { stdout: string; stderr: string; exitCode: number }
|
||||
: string
|
||||
>
|
||||
}
|
||||
|
||||
/** RFC 4648 encoding variant shared by the base64 helpers. */
|
||||
@@ -2485,6 +2749,29 @@ declare global {
|
||||
|
||||
export interface HookContext
|
||||
extends GetHookData, GetHookGetOnlyData, PostHookData, JobData {
|
||||
/**
|
||||
* Task-Konfiguration, wenn der Code als Task läuft (`tasks:`).
|
||||
* Der Payload aus `context.enqueue(name, data)` steht im Skript als
|
||||
* globale Variable `data`.
|
||||
*/
|
||||
task?: TaskConfig
|
||||
|
||||
/**
|
||||
* Registriert eine Funktion, die **nach** dem Lauf läuft
|
||||
* (max. 2 s pro Funktion). Bei HTTP-Hooks nach dem Response-Write
|
||||
* (die Antwort wartet nie), bei Jobs und Tasks direkt nach dem Lauf.
|
||||
* Fehler ändern die Antwort nie.
|
||||
*/
|
||||
after(fn: () => void | Promise<void>): void
|
||||
|
||||
/**
|
||||
* Reiht einen konfigurierten Task ein (durable, eigener Lauf).
|
||||
* Der Name wird gegen `tasks:` geprüft (fail fast); `data` muss
|
||||
* JSON-serialisierbar und begrenzt sein.
|
||||
*/
|
||||
enqueue(task: string, data?: any): void
|
||||
|
||||
|
||||
request(): {
|
||||
method: string
|
||||
remoteAddr: string
|
||||
@@ -2589,6 +2876,8 @@ declare global {
|
||||
/** Masked verified address, e.g. `a***@example.com`. */
|
||||
email?: string
|
||||
emailVerified: boolean
|
||||
/** False when the server switched the e-mail factor off (allowEmailFallback). */
|
||||
emailAvailable: boolean
|
||||
/** Server forces an e-mail code although no factor is enrolled. */
|
||||
emailFallback: boolean
|
||||
recoveryCodesRemaining: number
|
||||
@@ -2719,6 +3008,8 @@ declare global {
|
||||
export interface AdminWebAuthnCredentialView {
|
||||
id: string
|
||||
label: string
|
||||
/** passkey = discoverable, security_key = non-resident; empty for legacy credentials. */
|
||||
kind?: "passkey" | "security_key"
|
||||
transports?: AdminAuthenticatorTransport[]
|
||||
aaguid?: string
|
||||
createdAt: string
|
||||
|
||||
@@ -428,6 +428,10 @@
|
||||
"hide": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"openapi": {
|
||||
"$ref": "openapi.schema.json",
|
||||
"description": "OpenAPI overrides for this action, same shape a collection uses in meta.openapi. The action appears as path /_actions/{name} with its get/post operations."
|
||||
},
|
||||
"methods": {
|
||||
"type": "object",
|
||||
"patternProperties": {
|
||||
|
||||
@@ -395,6 +395,10 @@
|
||||
"maxMemoryMB": {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"maxFilterCandidates": {
|
||||
"type": "integer",
|
||||
"description": "Obergrenze der Index-Kandidaten, die gegen den Query-Filter in MongoDB geprüft werden, bevor die Suche auf den regulären Pfad zurückfällt. 0 = Server-Default (search.inMemory.maxFilterCandidates, 500000), negativ = keine Kappe."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,8 +36,29 @@
|
||||
"type": "string"
|
||||
},
|
||||
"timeout": {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
"description": "Abbruch nach dieser Zeit. Akzeptiert Millisekunden (500) oder eine Go-Duration (\"500ms\", \"2s\").",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"pattern": "^([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$"
|
||||
}
|
||||
]
|
||||
},
|
||||
"engine": {
|
||||
"description": "Überschreibt die Projekt-Engine für diesen Hook.",
|
||||
"enum": [
|
||||
"",
|
||||
"goja",
|
||||
"v8"
|
||||
]
|
||||
},
|
||||
"ignoreRequestCancel": {
|
||||
"description": "Hook läuft weiter, wenn der Client die Verbindung abbricht (z. B. SSE).",
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -142,4 +163,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,16 +18,33 @@
|
||||
"type": "string"
|
||||
},
|
||||
"timeout": {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
"description": "Abbruch nach dieser Zeit. Akzeptiert Millisekunden (30000) oder eine Go-Duration (\"30s\", \"5m\").",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"pattern": "^([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$"
|
||||
}
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
},
|
||||
"engine": {
|
||||
"description": "Überschreibt die Projekt-Engine für diesen Job.",
|
||||
"enum": [
|
||||
"",
|
||||
"goja",
|
||||
"v8"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"file"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "openapi.schema.json",
|
||||
"title": "Tibi OpenAPI collection config",
|
||||
"description": "OpenAPI metadata for a collection, used to generate the project's OpenAPI 3.0 spec via /_openapi/:project",
|
||||
"title": "Tibi OpenAPI entity config",
|
||||
"description": "OpenAPI metadata for a collection or an action, used to generate the project's OpenAPI 3.0 spec via /_openapi/:project. Actions appear as /_actions/{name} and use get/post.",
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
"definitions": {
|
||||
@@ -161,27 +161,27 @@
|
||||
"properties": {
|
||||
"disabled": {
|
||||
"type": "boolean",
|
||||
"description": "Exclude this entire collection from the generated OpenAPI spec"
|
||||
"description": "Exclude this entire collection or action from the generated OpenAPI spec"
|
||||
},
|
||||
"get": {
|
||||
"$ref": "#/definitions/operationObject",
|
||||
"description": "OpenAPI operation overrides for the list endpoint (GET /{collection})"
|
||||
"description": "OpenAPI operation overrides for the GET endpoint: list for a collection (GET /{collection}), the action itself for an action (GET /_actions/{name})"
|
||||
},
|
||||
"getOne": {
|
||||
"$ref": "#/definitions/operationObject",
|
||||
"description": "OpenAPI operation overrides for the single-entry endpoint (GET /{collection}/{id})"
|
||||
"description": "OpenAPI operation overrides for the single-entry endpoint of a collection (GET /{collection}/{id}); unused by actions"
|
||||
},
|
||||
"post": {
|
||||
"$ref": "#/definitions/operationObject",
|
||||
"description": "OpenAPI operation overrides for the create endpoint (POST /{collection})"
|
||||
"description": "OpenAPI operation overrides for the POST endpoint: create for a collection (POST /{collection}), the action itself for an action (POST /_actions/{name})"
|
||||
},
|
||||
"put": {
|
||||
"$ref": "#/definitions/operationObject",
|
||||
"description": "OpenAPI operation overrides for the update endpoint (PUT /{collection}/{id})"
|
||||
"description": "OpenAPI operation overrides for the update endpoint of a collection (PUT /{collection}/{id}); unused by actions"
|
||||
},
|
||||
"delete": {
|
||||
"$ref": "#/definitions/operationObject",
|
||||
"description": "OpenAPI operation overrides for the delete endpoint (DELETE /{collection}/{id})"
|
||||
"description": "OpenAPI operation overrides for the delete endpoint of a collection (DELETE /{collection}/{id}); unused by actions"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -181,6 +181,20 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"tasks": {
|
||||
"description": "Benannte Arbeitseinheiten für context.enqueue (kein cron). Name im YAML, nicht der Dateiname.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"$ref": "task.schema.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"jobs": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
@@ -412,6 +426,18 @@
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"jsEngine": {
|
||||
"description": "JS-Engine für dieses Projekt (überschreibt server.js.engine).",
|
||||
"enum": [
|
||||
"",
|
||||
"goja",
|
||||
"v8"
|
||||
]
|
||||
},
|
||||
"jsGojaSyncPromise": {
|
||||
"description": "Legacy-Promise-Semantik von goja (synchron gepumpte Promises). Default true (P6a, verhaltensneutral); nach der Migration false für spec-konforme Promises wie V8. V8 ignoriert den Wert.",
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -434,4 +460,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "task.schema.json",
|
||||
"title": "Tibi task config",
|
||||
"description": "Konfigurierte Arbeitseinheit für context.enqueue. Anders als ein Job hat ein Task kein cron-Feld: er wird ausschließlich per enqueue gestartet. Der Name steht im YAML und ist der stabile Vertrag, gegen den enqueue prüft.",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"patternProperties": {
|
||||
"^x-": {}
|
||||
},
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "Verbindlicher Task-Name (nicht der Dateiname). Eindeutig pro Projekt; eine Dublette ist ein Ladefehler.",
|
||||
"type": "string",
|
||||
"pattern": "^[a-z][a-z0-9._-]{0,63}$"
|
||||
},
|
||||
"type": {
|
||||
"const": "javascript"
|
||||
},
|
||||
"file": {
|
||||
"type": "string",
|
||||
"description": "Pfad relativ zum Projektverzeichnis (api/), wie bei Jobs."
|
||||
},
|
||||
"timeout": {
|
||||
"description": "Abbruch nach dieser Zeit. Akzeptiert Millisekunden (5000) oder eine Go-Duration (\"5s\", \"2m\").",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"pattern": "^([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$"
|
||||
}
|
||||
]
|
||||
},
|
||||
"engine": {
|
||||
"description": "Überschreibt die Projekt-Engine für diesen Task.",
|
||||
"enum": [
|
||||
"",
|
||||
"goja",
|
||||
"v8"
|
||||
]
|
||||
},
|
||||
"concurrency": {
|
||||
"description": "Maximal gleichzeitig laufende Instanzen dieses Tasks (prozesslokal; der Server läuft pro Projekt singulär).",
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"default": 1
|
||||
},
|
||||
"retries": {
|
||||
"description": "Anzahl der Wiederholungen nach einem Fehler. 0 = keine Wiederholung.",
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"default": 0
|
||||
},
|
||||
"backoffBase": {
|
||||
"description": "Wartezeit vor dem ersten Retry (verdoppelt sich je Versuch).",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"pattern": "^([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$"
|
||||
}
|
||||
]
|
||||
},
|
||||
"backoffMax": {
|
||||
"description": "Obergrenze der Backoff-Wartezeit.",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"pattern": "^([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$"
|
||||
}
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
"type",
|
||||
"file"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
// Compile-time contract test for the action OpenAPI overrides (#40): an action
|
||||
// meta carries the same meta.openapi block a collection uses.
|
||||
|
||||
const meta: ActionMeta = {
|
||||
label: { de: "Kontaktformular", en: "Contact Form" },
|
||||
openapi: {
|
||||
disabled: false,
|
||||
get: {
|
||||
summary: { de: "Formular abrufen", en: "Get the form" },
|
||||
parameters: [
|
||||
{
|
||||
name: "lang",
|
||||
in: "query",
|
||||
required: false,
|
||||
schema: { type: "string" },
|
||||
},
|
||||
],
|
||||
responses: { "200": { description: "OK" } },
|
||||
security: [{ "X-Api-Token": [] }],
|
||||
},
|
||||
post: {
|
||||
summary: { de: "Formular senden", en: "Submit the form" },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
const info: ActionInfo = {
|
||||
name: "contact-form",
|
||||
meta,
|
||||
permissions: {
|
||||
public: { methods: { post: { allow: true } } },
|
||||
},
|
||||
}
|
||||
|
||||
type _MetaIsOpenapi = Expect<Equal<NonNullable<ActionInfo["meta"]>["openapi"], OpenapiMeta | undefined>>
|
||||
type _SummaryIsLocalized = Expect<Equal<NonNullable<OpenapiMeta["get"]>["summary"], LocalizedText | undefined>>
|
||||
|
||||
const disabled: boolean | undefined = meta.openapi?.post?.disabled
|
||||
type _DisabledIsBoolean = Expect<Equal<typeof disabled, boolean | undefined>>
|
||||
|
||||
// @ts-expect-error `in` is limited to the OpenAPI parameter locations
|
||||
const badParameter: OpenapiParameter = { name: "lang", in: "body" }
|
||||
|
||||
declare const expectTrue: Expect<true>
|
||||
void expectTrue
|
||||
void info
|
||||
void badParameter
|
||||
Reference in new issue
Block a user