// tslint:disable export const schema = { "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { "FunctionRunnerSize": { "enum": [ "m128MiB", "m1GiB", "m256MiB", "m2GiB", "m512MiB" ], "type": "string" }, "Session": { "type": "object", "properties": { "accountId": { "minLength": 1, "type": "string" }, "principal": { "minLength": 1, "type": "string" } }, "propertyOrder": [ "accountId", "principal" ], "required": [ "accountId", "principal" ] }, "ServerOnlyContext": { "type": "object", "properties": { "tags": { "type": "object", "additionalProperties": { "type": "string" }, "propertyOrder": [] }, "logLevel": { "type": "string" }, "logExtra": { "type": "object", "additionalProperties": {}, "propertyOrder": [] }, "sampleRate": { "type": "number" }, "debugId": { "type": "string" }, "session": { "$ref": "#/definitions/Session" } }, "propertyOrder": [ "tags", "logLevel", "logExtra", "sampleRate", "debugId", "session" ], "required": [ "debugId" ] }, "UnauthorizedError": { "type": "object", "properties": { "name": { "type": "string" }, "message": { "type": "string" }, "stack": { "type": "string" } }, "propertyOrder": [ "name", "message", "stack" ], "required": [ "message", "name" ] }, "NotFoundError": { "type": "object", "properties": { "name": { "type": "string" }, "message": { "type": "string" }, "stack": { "type": "string" } }, "propertyOrder": [ "name", "message", "stack" ], "required": [ "message", "name" ] }, "ExistsError": { "type": "object", "properties": { "name": { "type": "string" }, "message": { "type": "string" }, "stack": { "type": "string" } }, "propertyOrder": [ "name", "message", "stack" ], "required": [ "message", "name" ] }, "SubDomain": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "subdomain" ] }, "name": { "type": "string" } }, "propertyOrder": [ "type", "name" ], "required": [ "name", "type" ] }, "CNameDomain": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "cname" ] }, "name": { "format": "hostname", "type": "string" }, "certificate": { "minLength": 1, "type": "string" } }, "propertyOrder": [ "type", "name", "certificate" ], "required": [ "certificate", "name", "type" ] }, "Domain": { "anyOf": [ { "$ref": "#/definitions/SubDomain" }, { "$ref": "#/definitions/CNameDomain" } ] }, "Environment": { "type": "object", "properties": { "name": { "pattern": "^[A-Za-z][A-Za-z_\\d]{0,49}$", "type": "string" }, "domains": { "type": "array", "items": { "anyOf": [ { "$ref": "#/definitions/SubDomain" }, { "$ref": "#/definitions/CNameDomain" } ] } } }, "propertyOrder": [ "name", "domains" ], "required": [ "domains", "name" ] }, "Application": { "type": "object", "properties": { "accountId": { "minLength": 1, "type": "string" }, "id": { "minLength": 1, "type": "string" }, "name": { "description": "Non-unique user friendly name to identify this app", "minLength": 1, "type": "string" }, "createdAt": { "description": "Enables basic storage and retrieval of dates and times.", "type": "string", "format": "date-time", "coerce-date": true }, "updatedAt": { "description": "Enables basic storage and retrieval of dates and times.", "type": "string", "format": "date-time", "coerce-date": true }, "sourceUrl": { "description": "If cloned from template, will hold the template github URL (including the git tag | digest).\nCould be used in the future to track a github repo.", "format": "uri", "type": "string" }, "environments": { "type": "array", "items": { "$ref": "#/definitions/Environment" } } }, "propertyOrder": [ "accountId", "id", "name", "createdAt", "updatedAt", "sourceUrl", "environments" ], "required": [ "accountId", "createdAt", "environments", "id", "name", "updatedAt" ] }, "Template": { "type": "object", "properties": { "id": { "minLength": 1, "type": "string" }, "name": { "minLength": 1, "type": "string" }, "previewImageUrl": { "format": "uri", "type": "string" }, "githubUrl": { "format": "uri", "type": "string" } }, "propertyOrder": [ "id", "name", "previewImageUrl", "githubUrl" ], "required": [ "githubUrl", "id", "name", "previewImageUrl" ] }, "ExternalAccount": { "type": "object", "properties": { "source": { "description": "e.g. github", "minLength": 1, "type": "string" }, "id": { "minLength": 1, "type": "string" } }, "propertyOrder": [ "source", "id" ], "required": [ "id", "source" ] }, "User": { "type": "object", "properties": { "id": { "minLength": 1, "type": "string" }, "fullName": { "minLength": 1, "type": "string" }, "email": { "format": "email", "type": "string" }, "avatarUrl": { "format": "uri", "type": "string" }, "externalAccounts": { "type": "array", "items": { "$ref": "#/definitions/ExternalAccount" } } }, "propertyOrder": [ "id", "fullName", "email", "avatarUrl", "externalAccounts" ], "required": [ "email", "externalAccounts", "fullName", "id" ] }, "TimePeriod": { "description": "Pattern as supported by the ms package", "minLength": 1, "type": "string" }, "InvocationDetails": { "type": "object", "properties": { "durUs": { "type": "number" }, "reqid": { "type": "string" } }, "propertyOrder": [ "durUs", "reqid" ], "required": [ "durUs", "reqid" ] }, "LogRecord": { "type": "object", "properties": { "source": { "type": "string" }, "msg": { "type": "string" }, "isErr": { "type": "boolean" }, "time": { "description": "Enables basic storage and retrieval of dates and times.", "type": "string", "format": "date-time", "coerce-date": true }, "invocation": { "$ref": "#/definitions/InvocationDetails" } }, "propertyOrder": [ "source", "msg", "isErr", "time", "invocation" ], "required": [ "isErr", "msg", "source", "time" ] }, "LogReadOpts": { "type": "object", "properties": { "since": { "description": "Enables basic storage and retrieval of dates and times.", "type": "string", "format": "date-time", "coerce-date": true }, "limit": { "minimum": 1, "maximum": 10000, "type": "number" }, "follow": { "type": "boolean" }, "nextToken": { "description": "Continuation token (received in response)", "minLength": 1, "type": "string" } }, "propertyOrder": [ "since", "limit", "follow", "nextToken" ], "required": [ "follow", "limit", "since" ] }, "LogsResponse": { "type": "object", "properties": { "records": { "type": "array", "items": { "$ref": "#/definitions/LogRecord" } }, "nextToken": { "minLength": 1, "type": "string" } }, "propertyOrder": [ "records", "nextToken" ], "required": [ "records" ] }, "CreateTicketResponse": { "type": "object", "properties": { "ticket": { "minLength": 1, "type": "string" }, "expires": { "description": "Pattern as supported by the ms package", "minLength": 1, "type": "string" } }, "propertyOrder": [ "ticket", "expires" ], "required": [ "expires", "ticket" ] }, "TryTemplateResponse": { "type": "object", "properties": { "token": { "minLength": 1, "type": "string" }, "expiresAt": { "description": "Enables basic storage and retrieval of dates and times.", "type": "string", "format": "date-time", "coerce-date": true }, "domain": { "minLength": 1, "type": "string" } }, "propertyOrder": [ "token", "expiresAt", "domain" ], "required": [ "domain", "expiresAt", "token" ] }, "Lycan": { "type": "object", "properties": { "createTicket": { "description": "Create a ticket for claiming an API key", "type": "object", "properties": { "params": { "type": "object", "properties": {} }, "returns": { "$ref": "#/definitions/CreateTicketResponse" } }, "propertyOrder": [ "params", "returns" ], "required": [ "params", "returns" ] }, "claimTicket": { "description": "Returns an API key in exchange for a valid ticket", "type": "object", "properties": { "params": { "type": "object", "properties": { "ticket": { "type": "string" } }, "propertyOrder": [ "ticket" ], "required": [ "ticket" ] }, "throws": { "$ref": "#/definitions/NotFoundError" }, "returns": { "type": "string" } }, "propertyOrder": [ "params", "throws", "returns" ], "required": [ "params", "returns", "throws" ] }, "listTemplates": { "type": "object", "properties": { "params": { "type": "object", "properties": {} }, "returns": { "type": "array", "items": { "$ref": "#/definitions/Template" } } }, "propertyOrder": [ "params", "returns" ], "required": [ "params", "returns" ] }, "tryTemplate": { "description": "Returns a JWT token for claiming the live template\nwith claimApp", "type": "object", "properties": { "params": { "type": "object", "properties": { "id": { "minLength": 1, "type": "string" } }, "propertyOrder": [ "id" ], "required": [ "id" ] }, "throws": { "$ref": "#/definitions/NotFoundError" }, "returns": { "$ref": "#/definitions/TryTemplateResponse" } }, "propertyOrder": [ "params", "throws", "returns" ], "required": [ "params", "returns", "throws" ] }, "whoami": { "type": "object", "properties": { "params": { "type": "object", "properties": {} }, "returns": { "$ref": "#/definitions/User" }, "throws": { "$ref": "#/definitions/UnauthorizedError" } }, "propertyOrder": [ "params", "returns", "throws" ], "required": [ "params", "returns", "throws" ] }, "listApps": { "type": "object", "properties": { "params": { "type": "object", "properties": {} }, "throws": { "$ref": "#/definitions/UnauthorizedError" }, "returns": { "type": "array", "items": { "$ref": "#/definitions/Application" } } }, "propertyOrder": [ "params", "throws", "returns" ], "required": [ "params", "returns", "throws" ] }, "deployInitial": { "type": "object", "properties": { "params": { "type": "object", "properties": { "env": { "pattern": "^[A-Za-z][A-Za-z_\\d]{0,49}$", "type": "string" }, "name": { "minLength": 1, "type": "string" }, "digest": { "minLength": 1, "type": "string" }, "envVars": { "type": "array", "items": { "type": "array", "items": [ { "type": "string" }, { "type": "string" } ], "minItems": 2, "additionalItems": { "anyOf": [ { "type": "string" }, { "type": "string" } ] } } } }, "propertyOrder": [ "env", "name", "digest", "envVars" ], "required": [ "digest", "env", "envVars", "name" ] }, "throws": { "anyOf": [ { "$ref": "#/definitions/UnauthorizedError" }, { "$ref": "#/definitions/ExistsError" } ] }, "returns": { "$ref": "#/definitions/Application" } }, "propertyOrder": [ "params", "throws", "returns" ], "required": [ "params", "returns", "throws" ] }, "deploy": { "type": "object", "properties": { "params": { "type": "object", "properties": { "appId": { "minLength": 1, "type": "string" }, "env": { "pattern": "^[A-Za-z][A-Za-z_\\d]{0,49}$", "type": "string" }, "digest": { "minLength": 1, "type": "string" }, "envVars": { "type": "array", "items": { "type": "array", "items": [ { "type": "string" }, { "type": "string" } ], "minItems": 2, "additionalItems": { "anyOf": [ { "type": "string" }, { "type": "string" } ] } } } }, "propertyOrder": [ "appId", "env", "digest", "envVars" ], "required": [ "appId", "digest", "env", "envVars" ] }, "throws": { "anyOf": [ { "$ref": "#/definitions/UnauthorizedError" }, { "$ref": "#/definitions/NotFoundError" } ] }, "returns": { "$ref": "#/definitions/Application" } }, "propertyOrder": [ "params", "throws", "returns" ], "required": [ "params", "returns", "throws" ] }, "claimApp": { "description": "Claim an anonymously deployed app into the user account\nusing the token received from tryTemplate", "type": "object", "properties": { "params": { "type": "object", "properties": { "token": { "minLength": 1, "type": "string" } }, "propertyOrder": [ "token" ], "required": [ "token" ] }, "throws": { "anyOf": [ { "$ref": "#/definitions/UnauthorizedError" }, { "$ref": "#/definitions/NotFoundError" } ] }, "returns": { "$ref": "#/definitions/Application" } }, "propertyOrder": [ "params", "throws", "returns" ], "required": [ "params", "returns", "throws" ] }, "getLogs": { "type": "object", "properties": { "params": { "type": "object", "properties": { "appId": { "minLength": 1, "type": "string" }, "env": { "pattern": "^[A-Za-z][A-Za-z_\\d]{0,49}$", "type": "string" }, "opts": { "$ref": "#/definitions/LogReadOpts" } }, "propertyOrder": [ "appId", "env", "opts" ], "required": [ "appId", "env", "opts" ] }, "throws": { "anyOf": [ { "$ref": "#/definitions/UnauthorizedError" }, { "$ref": "#/definitions/NotFoundError" } ] }, "returns": { "$ref": "#/definitions/LogsResponse" } }, "propertyOrder": [ "params", "throws", "returns" ], "required": [ "params", "returns", "throws" ] }, "destroyApp": { "type": "object", "properties": { "params": { "type": "object", "properties": { "appId": { "minLength": 1, "type": "string" } }, "propertyOrder": [ "appId" ], "required": [ "appId" ] }, "throws": { "anyOf": [ { "$ref": "#/definitions/UnauthorizedError" }, { "$ref": "#/definitions/NotFoundError" } ] }, "returns": { "type": "null" } }, "propertyOrder": [ "params", "throws", "returns" ], "required": [ "params", "returns", "throws" ] } }, "propertyOrder": [ "createTicket", "claimTicket", "listTemplates", "tryTemplate", "whoami", "listApps", "deployInitial", "deploy", "claimApp", "getLogs", "destroyApp" ], "required": [ "claimApp", "claimTicket", "createTicket", "deploy", "deployInitial", "destroyApp", "getLogs", "listApps", "listTemplates", "tryTemplate", "whoami" ] } } }; export class InternalServerError extends Error { public readonly name = 'InternalServerError'; } export class UnauthorizedError extends Error { public readonly name = 'UnauthorizedError'; } export class NotFoundError extends Error { public readonly name = 'NotFoundError'; } export class ExistsError extends Error { public readonly name = 'ExistsError'; } export enum FunctionRunnerSize { M128MIB = 'm128MiB', M1GIB = 'm1GiB', M256MIB = 'm256MiB', M2GIB = 'm2GiB', M512MIB = 'm512MiB', } export type Domain = (SubDomain) | (CNameDomain); export interface Session { readonly accountId: string; readonly principal: string; } export interface ServerOnlyContext { readonly tags?: {}; readonly logLevel?: string; readonly logExtra?: {}; readonly sampleRate?: number; readonly debugId: string; readonly session?: Session; } export interface SubDomain { readonly type: "subdomain"; readonly name: string; } export interface CNameDomain { readonly type: "cname"; readonly name: string; readonly certificate: string; } export interface Environment { readonly name: string; readonly domains: Array<(SubDomain) | (CNameDomain)>; } export interface Application { readonly accountId: string; readonly id: string; readonly name: string; readonly createdAt: Date; readonly updatedAt: Date; readonly sourceUrl?: string; readonly environments: Array; } export interface Template { readonly id: string; readonly name: string; readonly previewImageUrl: string; readonly githubUrl: string; } export interface ExternalAccount { readonly source: string; readonly id: string; } export interface User { readonly id: string; readonly fullName: string; readonly email: string; readonly avatarUrl?: string; readonly externalAccounts: Array; } export interface InvocationDetails { readonly durUs: number; readonly reqid: string; } export interface LogRecord { readonly source: string; readonly msg: string; readonly isErr: boolean; readonly time: Date; readonly invocation?: InvocationDetails; } export interface LogReadOpts { readonly since: Date; readonly limit: number; readonly follow: boolean; readonly nextToken?: string; } export interface LogsResponse { readonly records: Array; readonly nextToken?: string; } export interface CreateTicketResponse { readonly ticket: string; readonly expires: string; } export interface TryTemplateResponse { readonly token: string; readonly expiresAt: Date; readonly domain: string; } export interface Lycan { createTicket(): Promise; claimTicket(ticket: string): Promise; listTemplates(): Promise>; tryTemplate(id: string): Promise; whoami(): Promise; listApps(): Promise>; deployInitial(env: string, name: string, digest: string, envVars: Array<[string, string]>): Promise; deploy(appId: string, env: string, digest: string, envVars: Array<[string, string]>): Promise; claimApp(token: string): Promise; getLogs(appId: string, env: string, opts: LogReadOpts): Promise; destroyApp(appId: string): Promise; }