diff --git a/index.d.ts b/index.d.ts index 3ece2df..6f0d4df 100644 --- a/index.d.ts +++ b/index.d.ts @@ -580,6 +580,31 @@ declare global { ): any } + interface CryptoPackage { + /** + * get hex of sha256 hash + * + * @param sata string + * + * @returns hex hash + */ + sha256(data: string): string + } + + interface JsonPackage { + /** + * parse json string to json + * @param str json string + */ + parse(str: string): any + + /** + * stringify json string + * @param json json object + */ + stringify(json: any): string + } + export interface HookContext extends GetHookData, GetHookGetOnlyData, @@ -588,6 +613,7 @@ declare global { request(): { method: string remoteAddr: string + clientIp(): string host: string url: string path: string @@ -616,6 +642,8 @@ declare global { xml: XmlPackage cookie: CookiePackage pdf: PdfPackage + crypto: CryptoPackage + json: JsonPackage } export interface HookException { diff --git a/schemas/api-config/config.json b/schemas/api-config/config.json index 8c32c5e..a535354 100644 --- a/schemas/api-config/config.json +++ b/schemas/api-config/config.json @@ -20,8 +20,13 @@ "additionalProperties": true, "properties": { "imageUrl": { - "type": "string", - "description": "project's teaser image url shown in admin ui" + "description": "project's teaser image url shown in admin ui", + "oneOf": [ + { "type": "string" }, + { + "$ref": "definitions.json#/definitions/evalObject" + } + ] } } },