diff --git a/index.d.ts b/index.d.ts index a39a93c..7d16190 100644 --- a/index.d.ts +++ b/index.d.ts @@ -111,7 +111,7 @@ declare global { /** * get current project object - * + * */ project(): { [key: string]: any @@ -119,7 +119,7 @@ declare global { /** * get server config object - * + * */ server(): { api: { @@ -344,6 +344,13 @@ declare global { * get Sentry trace id */ sentryTraceId(): string + + /** + * sleep + * + * @param ms sleep time in milliseconds + */ + sleep(ms: number): void } interface ResponsePackage { @@ -640,7 +647,7 @@ declare global { * * @returns hex hash */ - md5(data:string): string + md5(data: string): string } interface JsonPackage { @@ -680,7 +687,7 @@ declare global { } api(): { - [key: string]: any + [key: string]: any } project(): { diff --git a/schemas/api-config/collection.json b/schemas/api-config/collection.json index 9d7a274..95b6049 100644 --- a/schemas/api-config/collection.json +++ b/schemas/api-config/collection.json @@ -125,6 +125,53 @@ } } ] + }, + "cors": { + "type": "object", + "description": "cors configuration", + "additionalProperties": false, + "properties": { + "merge": { + "type": "boolean", + "description": "merge with global and project cors configuration" + }, + "allowOrigins": { + "type": "array", + "description": "list of allowed origins", + "items": { + "type": "string" + } + }, + "allowMethods": { + "type": "array", + "description": "list of allowed methods", + "items": { + "type": "string" + } + }, + "allowHeaders": { + "type": "array", + "description": "list of allowed headers", + "items": { + "type": "string" + } + }, + "allowCredentials": { + "type": "boolean", + "description": "allow credentials" + }, + "exposeHeaders": { + "type": "array", + "description": "list of exposed headers", + "items": { + "type": "string" + } + }, + "maxAge": { + "type": "integer", + "description": "max age in seconds" + } + } } }, "required": ["name", "permissions"] diff --git a/schemas/api-config/config.json b/schemas/api-config/config.json index 2007fc4..99c4e03 100644 --- a/schemas/api-config/config.json +++ b/schemas/api-config/config.json @@ -77,6 +77,53 @@ } ] } + }, + "cors": { + "type": "object", + "description": "cors configuration", + "additionalProperties": false, + "properties": { + "merge": { + "type": "boolean", + "description": "merge with global cors configuration" + }, + "allowOrigins": { + "type": "array", + "description": "list of allowed origins", + "items": { + "type": "string" + } + }, + "allowMethods": { + "type": "array", + "description": "list of allowed methods", + "items": { + "type": "string" + } + }, + "allowHeaders": { + "type": "array", + "description": "list of allowed headers", + "items": { + "type": "string" + } + }, + "allowCredentials": { + "type": "boolean", + "description": "allow credentials" + }, + "exposeHeaders": { + "type": "array", + "description": "list of exposed headers", + "items": { + "type": "string" + } + }, + "maxAge": { + "type": "integer", + "description": "max age in seconds" + } + } } }, "required": ["namespace"]