{"version":3,"sources":["../../src/util/constants.ts","../../src/util/fetch.ts","../../src/util/urls.ts","../../src/util/lists.ts","../../src/util/types.ts","../../src/rest/types/api.ts","../../src/rest/types/channels.ts","../../src/rest/types/ignite.ts","../../src/rest/types/pipe.ts","../../src/rest/types/projects.ts","../../src/rest/types/registry.ts","../../src/rest/types/users.ts","../../src/rest/client.ts","../../src/sdks/index.ts","../../src/sdks/channels.ts","../../src/sdks/ignite.ts","../../src/util/size.ts","../../src/util/crypto.ts","../../src/util/webhooks.ts","../../src/sdks/pipe.ts","../../src/sdks/projects.ts","../../src/sdks/registry.ts","../../src/sdks/users.ts","../../src/sdks/fleet.ts","../../src/hop.ts","../../src/permissions.ts","../../src/rest/types/fleet.ts"],"names":["Headers","Request","Response","prefix","id","expectedPrefix","ChannelType","Regions","RuntimeType","ContainerState","RolloutState","RestartPolicy","VolumeFormat","BuildEnvironmentType","ContainerStrategy","BuildMethod","GatewayType","DomainState","BuildState","ProjectTier","ProjectType","channels","create","deployment","groups","keys","token","members","webhooks","webhook","secret","secrets","PROJECT_PERMISSION","FleetSchedulingState","FleetStatus"],"mappings":";0IASO,IAAM,iBAAmB,qBAMnB,WAAa,OAAO,OAAW,IAM/B,cAAgB,OAAO,KAAS,ICrB7C,UAAY,aAAc,cAEnB,IAAM,iBAAmB,OAAO,WAAW,MAAU,IAE/C,MAAQ,iBAAmB,WAAW,MAAiB,iBACvDA,SAAU,iBAAmB,WAAW,QAAmB,iBAC3DC,SAAU,iBAAmB,WAAW,QAAmB,iBAC3DC,UAAW,iBACrB,WAAW,SACF,kBCPL,SAAS,KAAK,EAAW,CAC/B,OAAO,EAAE,WAAW,CAAC,IAAM,GAAK,EAAI,IAAM,CAC3C,CAEO,SAAS,cAAc,OAAgB,CAC7C,QAAW,KAAK,OACf,MAAO,GAGR,MAAO,EACR,CAEO,SAAS,KAAK,EAAW,EAAW,CAC1C,OAAO,EAAI,KAAK,CAAC,CAClB,CAQO,SAAS,YAAY,MAA8B,CACzD,I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B,mBACtB,sBAAsB,YACtB,sBAAsB,eACtB,sBAAsB,gBACtB,sBAAsB,UACtB,sBAAsB,gBACvB,MACC,sBAAsB,gBACtB,sBAAsB,mBACtB,sBAAsB,eACtB,sBAAsB,YACtB,sBAAsB,sBACtB,sBAAsB,eACtB,sBAAsB,gBACtB,sBAAsB,cACtB,sBAAsB,gBACtB,sBAAsB,eACtB,sBAAsB,eACxB,EAMa,YAAc,CAC1B,IAAI,MAAe,KAAc,CAChC,OAAO,OAAO,KAAK,EAAI,OAAO,IAAI,CACnC,EAEA,KAAK,MAAe,KAAc,CACjC,MAAO,GAAQ,OAAO,KAAK,EAAI,OAAO,IAAI,EAC3C,EAEA,SAAS,MAAe,KAAc,CACrC,OAAO,OAAO,KAAK,EAAI,CAAC,OAAO,IAAI,CACpC,CACD,ECjOO,IAAK,sBAAAC,wBACXA,sBAAA,YAAc,cACdA,sBAAA,cAAgB,gBAFLA,wBAAA,0BAQA,aAAAC,eACXA,aAAA,OAAS,SACTA,aAAA,QAAU,UAFCA,eAAA","sourcesContent":["// Runtime specific globals\n// only exist so we can have type safety in this file\ndeclare const Bun: object | undefined;\ndeclare const Deno: object | undefined;\n\n/**\n * The default base URL for Hop's API.\n * @public\n */\nexport const DEFAULT_BASE_URL = 'https://api.hop.io';\n\n/**\n * If we are in the browser.\n * @public\n */\nexport const IS_BROWSER = typeof window !== 'undefined';\n\n/**\n * If this runtiem supports the Intl API\n * @public\n */\nexport const SUPPORTS_INTL = typeof Intl !== 'undefined';\n","import * as ponyfill from 'cross-fetch';\n\nexport const HAS_NATIVE_FETCH = typeof globalThis.fetch !== 'undefined';\n\nexport const fetch = HAS_NATIVE_FETCH ? globalThis.fetch : ponyfill.default;\nexport const Headers = HAS_NATIVE_FETCH ? globalThis.Headers : ponyfill.Headers;\nexport const Request = HAS_NATIVE_FETCH ? globalThis.Request : ponyfill.Request;\nexport const Response = HAS_NATIVE_FETCH\n\t? globalThis.Response\n\t: ponyfill.Response;\n","import type {ExtractRouteParams, Query} from '../rest/index.ts';\n\nexport function lead(x: string) {\n\treturn x.charCodeAt(0) === 47 ? x : '/' + x;\n}\n\nexport function isObjectEmpty(object: object) {\n\tfor (const _ in object) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\nexport function join(a: string, b: string) {\n\treturn a + lead(b);\n}\n\n/**\n * Generates a querystring to append to a URL. This function will include the ? character.\n * @param query - An object of query params to be encoded\n * @public\n * @returns A string of query params\n */\nexport function querystring(query: Query<string>): string {\n\tconst usefulQuery = Object.entries(query).filter(\n\t\t(entry): entry is [string, string | number] => {\n\t\t\tconst [, value] = entry;\n\n\t\t\treturn value !== undefined;\n\t\t},\n\t);\n\n\tif (usefulQuery.length === 0) {\n\t\treturn '';\n\t}\n\n\tconst INITIAL_QUERYSTRING = '?';\n\n\treturn usefulQuery.reduce((acc, [key, value]) => {\n\t\tif (value === undefined) {\n\t\t\treturn acc;\n\t\t}\n\n\t\tconst result = `${key}=${value.toString()}`;\n\n\t\tif (acc === INITIAL_QUERYSTRING) {\n\t\t\treturn INITIAL_QUERYSTRING + result;\n\t\t}\n\n\t\treturn acc + '&' + result;\n\t}, INITIAL_QUERYSTRING);\n}\n\nexport function createURLBuilder(base: string) {\n\tconst regex = /:[^/?#]+/g;\n\n\treturn <Path extends string>(path: Path, query: Query<Path>) => {\n\t\tquery = {...query};\n\n\t\tconst urlWithParams = path.replace(regex, param => {\n\t\t\tparam = param.substring(1);\n\n\t\t\tif (param in query) {\n\t\t\t\tconst {[param]: value, ...rest} = query;\n\t\t\t\tquery = rest as ExtractRouteParams<Path>;\n\n\t\t\t\tif (value === undefined) {\n\t\t\t\t\tthrow new Error(`URL param ${param} is undefined`);\n\t\t\t\t}\n\n\t\t\t\tif (typeof value === 'number') {\n\t\t\t\t\treturn value.toString();\n\t\t\t\t}\n\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\tthrow new Error(`Missing param ${param}.`);\n\t\t});\n\n\t\tconst urlWithSearch = isObjectEmpty(query)\n\t\t\t? urlWithParams\n\t\t\t: `${urlWithParams}${querystring(query as Query<string>)}`;\n\n\t\treturn join(base, urlWithSearch);\n\t};\n}\n","import {SUPPORTS_INTL} from './constants.ts';\n\nexport function formatList(list: string[], type: Intl.ListFormatType): string {\n\tif (SUPPORTS_INTL) {\n\t\treturn new Intl.ListFormat('en-US', {type}).format(list);\n\t}\n\n\treturn list.join(', ');\n}\n","import {formatList} from './lists.ts';\nimport type {POSSIBLE_EVENTS} from './webhooks.ts';\n\n/**\n * All methods the Hop API accepts\n * @public\n */\nexport type Method = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';\n\n/**\n * An empty response type\n * @public\n */\nexport type Empty = void;\n\n/**\n * Makes individual properties optional in a type\n * @public\n */\nexport type MakeOptional<T, K extends keyof T> = Omit<T, K> &\n\tPartial<Pick<T, K>>;\n\n/**\n * Tag a type to make it unique\n * @public\n */\nexport type Tag<T, Name extends string> = T & {\n\t/**\n\t * Mark a type as having a specific name in the API\n\t * @internal\n\t */\n\t___tag: Name;\n};\n\n/**\n * An ISO 8601 date strings\n * @public\n */\nexport type Timestamp = Tag<string, 'timestamp'>;\n\n/**\n * Creates a record of params required for a given URL/path\n * @public\n */\nexport type ExtractRouteParams<T extends string> = string extends T\n\t? Record<string, string | number | undefined>\n\t: T extends `${string}:${infer Param}/${infer Rest}`\n\t? {[k in Param | keyof ExtractRouteParams<Rest>]: string | number}\n\t: T extends `${string}:${infer Param}`\n\t? {[k in Param]: string | number}\n\t: {};\n\n// Technically, `channel`, it should be here, but channel IDs can also\n// be any random string if a developer decides to set it. For this reason,\n// channel is not included as a valid ID in this list\n/**\n * An array of all IDs that can be used in the API\n * @public\n */\nexport const ID_PREFIXES = [\n\t{\n\t\tprefix: 'user',\n\t\tdescription: 'Users',\n\t},\n\t{\n\t\tprefix: 'project',\n\t\tdescription: 'Project',\n\t},\n\t{\n\t\tprefix: 'pm',\n\t\tdescription: 'Project Members',\n\t},\n\t{\n\t\tprefix: 'role',\n\t\tdescription: 'Roles',\n\t},\n\t{\n\t\tprefix: 'pi',\n\t\tdescription: 'Project Invite',\n\t},\n\t{\n\t\tprefix: 'ptk',\n\t\tdescription: 'Project token',\n\t},\n\t{\n\t\tprefix: 'pat',\n\t\tdescription: 'User personal access token',\n\t},\n\t{\n\t\tprefix: 'container',\n\t\tdescription: 'Ignite container',\n\t},\n\t{\n\t\tprefix: 'pipe_room',\n\t\tdescription: 'Pipe room',\n\t},\n\t{\n\t\tprefix: 'deployment',\n\t\tdescription: 'Ignite deployment',\n\t},\n\t{\n\t\tprefix: 'bearer',\n\t\tdescription: 'Users bearer token',\n\t},\n\t{\n\t\tprefix: 'ptkid',\n\t\tdescription: 'Project token ID',\n\t},\n\t{\n\t\tprefix: 'secret',\n\t\tdescription: 'Project secret ID',\n\t},\n\t{\n\t\tprefix: 'gateway',\n\t\tdescription: 'Gateway',\n\t},\n\t{\n\t\tprefix: 'domain',\n\t\tdescription: 'Domain for a gateway',\n\t},\n\t{\n\t\tprefix: 'leap_token',\n\t\tdescription: 'Token for connecting to leap as a client',\n\t},\n\t{\n\t\tprefix: 'build',\n\t\tdescription: 'Build ID for build logs',\n\t},\n\t{\n\t\tprefix: 'rollout',\n\t\tdescription: 'Rollout ID for rollouts.',\n\t},\n\t{\n\t\tprefix: 'health_check',\n\t\tdescription: 'Health check ID for health checks.',\n\t},\n\t{\n\t\tprefix: 'session',\n\t\tdescription: 'Session ID for sessions on your account.',\n\t},\n\t{\n\t\tprefix: 'webhook',\n\t\tdescription: 'Webhook ID for webhooks on a project.',\n\t},\n\t{\n\t\tprefix: 'deployment_group',\n\t\tdescription: 'Group ID for Ignite deployments',\n\t},\n\t{\n\t\tprefix: 'fleet_group',\n\t\tdescription: 'Group ID for fleet nodes',\n\t},\n\t{\n\t\tprefix: 'event',\n\t\tdescription: 'Event ID for events sent by webhooks on a project.',\n\t},\n\t{\n\t\tprefix: 'fleet_node',\n\t\tdescription: 'Node ID for a fleet node',\n\t},\n] as const;\n\n/**\n * A union of all ID prefixes used within the API\n * @public\n */\nexport type IdPrefixes = (typeof ID_PREFIXES)[number]['prefix'];\n\n/**\n * A Hop ID is a string that starts with a prefix and a underscore, followed by some unique text.\n * It is a Pika ID — https://github.com/hopinc/pika\n * @public\n */\nexport type Id<T extends IdPrefixes> = `${T}_${string}`;\n\n/**\n * A hop.sh domain (*.hop.sh)\n * @public\n */\nexport type HopShDomain = `${string}.hop.sh`;\n\n/**\n * A domain used with internal gateways (*.hop.sh)\n * @public\n */\nexport type InternalHopDomain = `${string}.hop`;\n\n/**\n * Any/all IDs that are used within the API\n * @public\n */\nexport type AnyId = Id<IdPrefixes>;\n\n/**\n * A union of all possible webhook groups\n */\nexport type PossibleWebhookGroups = keyof typeof POSSIBLE_EVENTS;\n\n/**\n * A union of all possible webhook event IDs\n */\nexport type PossibleWebhookIDs =\n\t(typeof POSSIBLE_EVENTS)[PossibleWebhookGroups][number]['id'];\n\n/**\n * Checks if a string is a valid Hop ID prefix\n *\n * @public\n * @param prefix - A string that is a potential prefix\n * @param expect - An expected prefix to check against\n * @returns - Whether the prefix is valid\n */\nexport function validateIdPrefix<T extends IdPrefixes = IdPrefixes>(\n\tprefix: string,\n\texpect?: T,\n): prefix is T {\n\tif (expect) {\n\t\treturn prefix === expect;\n\t}\n\n\treturn ID_PREFIXES.some(({prefix: p}) => p === prefix);\n}\n\n/**\n * Validates that a string is a valid ID\n *\n * @public\n * @param maybeId - A string that might be an id\n * @param prefix - Optionally an id prefix to check against\n * @returns true if the string is an id\n */\nexport function validateId<T extends IdPrefixes = IdPrefixes>(\n\tmaybeId: string | undefined | null,\n\tprefix?: T | T[],\n): maybeId is Id<T> {\n\tif (Array.isArray(prefix)) {\n\t\treturn prefix.some(p => validateId(maybeId, p));\n\t}\n\n\tif (!maybeId) {\n\t\treturn false;\n\t}\n\n\tif (!prefix) {\n\t\treturn ID_PREFIXES.some(({prefix}) => maybeId.startsWith(`${prefix}_`));\n\t}\n\n\treturn maybeId.startsWith(`${prefix}_`);\n}\n\n/**\n * Gets the prefix of an ID\n *\n * @public\n * @param id - A full ID to extract the prefix from\n * @param expect - An expected prefix to check against\n * @returns - The prefix of the ID\n */\nexport function getIdPrefix<T extends IdPrefixes>(id: string, expect?: T) {\n\tif (expect && !validateId(id, expect)) {\n\t\tthrow new Error(`Expected ${id} to be an id of type ${expect}`);\n\t}\n\n\tconst [prefix] = id.split('_');\n\n\tif (!prefix || !validateIdPrefix(prefix, expect)) {\n\t\tconst message = expect\n\t\t\t? `Expected ${id} to be a valid id with a prefix \\`${expect}\\`.`\n\t\t\t: `Expected ${id} to be a valid id. Found prefix \\`${prefix}\\`.`;\n\n\t\tthrow new Error(message);\n\t}\n\n\treturn prefix;\n}\n\n/**\n * Casts a string to an ID and asserts that it is of the correct type.\n * This function will throw if the string is not a valid ID.\n *\n * @public\n * @param maybeId - Cast and assert that a string is an id\n * @param prefix - Optionally an prefix or array of prefixes to check against\n * @returns - The ID cast to the correct type\n */\nexport function id<T extends IdPrefixes = IdPrefixes>(\n\tmaybeId: string | undefined | null,\n\tprefix?: T | T[],\n): Id<T> {\n\tassertId(maybeId, prefix);\n\treturn maybeId;\n}\n\n/**\n * Asserts that a string is a valid ID\n * @public\n * @param maybeId - A string that is possibly an ID\n * @param prefix - A prefix or array of prefixes to check against\n * @param message - An error message to throw if the ID is invalid\n */\nexport function assertId<T extends IdPrefixes = IdPrefixes>(\n\tmaybeId: string | undefined | null,\n\tprefix?: T | T[],\n\tmessage?: string,\n): asserts maybeId is Id<T> {\n\tconst expectedPrefix =\n\t\tprefix === undefined\n\t\t\t? '<any prefix>'\n\t\t\t: Array.isArray(prefix)\n\t\t\t? formatList(prefix, 'disjunction')\n\t\t\t: prefix;\n\n\tif (!maybeId) {\n\t\tthrow new Error(\n\t\t\tmessage ??\n\t\t\t\t`No value specified trying to assert an ID. Expected \\`${expectedPrefix}\\` and found ${maybeId}.`,\n\t\t);\n\t}\n\n\tif (!validateId(maybeId, prefix)) {\n\t\tconst expectedPrefix =\n\t\t\tprefix === undefined\n\t\t\t\t? undefined\n\t\t\t\t: Array.isArray(prefix)\n\t\t\t\t? formatList(prefix, 'disjunction')\n\t\t\t\t: prefix;\n\n\t\tthrow new Error(\n\t\t\tmessage ?? `Invalid id: ${maybeId}. Expected \\`${expectedPrefix}\\`.`,\n\t\t);\n\t}\n}\n","import * as Channels from './channels.ts';\nimport * as Ignite from './ignite.ts';\nimport * as Pipe from './pipe.ts';\nimport * as Projects from './projects.ts';\nimport * as Registry from './registry.ts';\nimport * as Users from './users.ts';\n\nexport {\n\t/**\n\t * Namespace containing information about channels\n\t * @public\n\t */\n\tChannels,\n\n\t/**\n\t * Namespace containing information about Ignite\n\t * @public\n\t */\n\tIgnite,\n\n\t/**\n\t * Namespace containing information about Pipe\n\t * @public\n\t */\n\tPipe,\n\n\t/**\n\t * Namespace containing information about projects\n\t * @public\n\t */\n\tProjects,\n\n\t/**\n\t * Namespace containing information about the registry\n\t * @public\n\t */\n\tRegistry,\n\n\t/**\n\t * Namespace containing information about users\n\t * @public\n\t */\n\tUsers,\n};\n","import type {Empty, Id, Timestamp} from '../../util/types.ts';\nimport type {Endpoint} from '../endpoints.ts';\nimport type {Project} from './projects.ts';\n\n/**\n * Types that a channel can be\n * @public\n */\nexport enum ChannelType {\n\tPRIVATE = 'private',\n\tPUBLIC = 'public',\n\tUNPROTECTED = 'unprotected',\n}\n\n/**\n * Generic state type of a channel\n * @public\n */\nexport type AnyStateObject = Record<string, unknown>;\n\n/**\n * @deprecated Use {@link AnyStateObject} instead\n * @public\n */\nexport type State = AnyStateObject;\n\n/**\n * Definition of a channel\n * @public\n */\nexport interface Channel {\n\t/**\n\t * The ID of the channel\n\t */\n\tid: string;\n\n\t/**\n\t * The project it is associated with\n\t */\n\tproject: Project;\n\n\t/**\n\t * State metadata\n\t */\n\tstate: AnyStateObject;\n\n\t/**\n\t * Capabilities of the channel\n\t */\n\tcapabilities: number;\n\n\t/**\n\t * When this channel was created\n\t */\n\tcreated_at: Timestamp;\n\n\t/**\n\t * The type of this channel\n\t */\n\ttype: ChannelType;\n}\n\n/**\n * A token for a channel\n * @public\n */\nexport interface ChannelToken {\n\t/**\n\t * The ID for the token\n\t */\n\tid: Id<'leap_token'>;\n\n\t/**\n\t * State for this token\n\t */\n\tstate: AnyStateObject;\n\n\t/**\n\t * The project this channel token is associated with\n\t */\n\tproject_id: Id<'project'>;\n\n\t/**\n\t * If this token is currently online (e.g. active heartbeat and connected to leap)\n\t */\n\tis_online: boolean;\n}\n\n/**\n * Endpoints for channels\n * @public\n */\nexport type ChannelEndpoints =\n\t| Endpoint<\n\t\t\t'POST',\n\t\t\t'/v1/channels',\n\t\t\t{channel: Channel},\n\t\t\t{type: ChannelType; state: Record<string, any> | null}\n\t  >\n\t| Endpoint<\n\t\t\t'PUT',\n\t\t\t'/v1/channels/:channel_id',\n\t\t\t{channel: Channel},\n\t\t\t{type: ChannelType; state: Record<string, any> | null}\n\t  >\n\t| Endpoint<\n\t\t\t'POST',\n\t\t\t'/v1/channels/tokens',\n\t\t\t{token: ChannelToken},\n\t\t\t{state: AnyStateObject}\n\t  >\n\t| Endpoint<'DELETE', '/v1/channels/:channel_id', Empty>\n\t| Endpoint<'GET', '/v1/channels/:channel_id', {channel: Channel}>\n\t| Endpoint<'GET', '/v1/channels/:channel_id/tokens', {tokens: ChannelToken[]}>\n\t| Endpoint<\n\t\t\t'POST',\n\t\t\t'/v1/channels/tokens/:token/messages',\n\t\t\tEmpty,\n\t\t\t{e: string; d: unknown}\n\t  >\n\t| Endpoint<'PUT', '/v1/channels/:channel_id/subscribers/:token', Empty>\n\t| Endpoint<'DELETE', '/v1/channels/:channel_id/subscribers/:token', Empty>\n\t| Endpoint<'PATCH', '/v1/channels/:channel_id/state', Empty, AnyStateObject>\n\t| Endpoint<'PUT', '/v1/channels/:channel_id/state', Empty, AnyStateObject>\n\t| Endpoint<'GET', '/v1/channels/:channel_id/state', {state: AnyStateObject}>\n\t| Endpoint<\n\t\t\t'POST',\n\t\t\t'/v1/channels/:channel_id/messages',\n\t\t\tEmpty,\n\t\t\t{e: string; d: unknown}\n\t  >\n\t| Endpoint<'GET', '/v1/channels', {channels: Channel[]}>\n\t| Endpoint<'GET', '/v1/channels/tokens/:token', {token: ChannelToken}>\n\t| Endpoint<\n\t\t\t'PATCH',\n\t\t\t'/v1/channels/tokens/:token',\n\t\t\t{token: ChannelToken},\n\t\t\t{expiresAt?: Timestamp | null; state: ChannelToken['state']}\n\t  >\n\t| Endpoint<'DELETE', '/v1/channels/tokens/:token', Empty>\n\t| Endpoint<\n\t\t\t'GET',\n\t\t\t'/v1/channels/:channel_id/stats',\n\t\t\t{stats: {online_count: number}}\n\t  >;\n","import type {ByteSizeString} from '../../util/index.ts';\nimport type {\n\tEmpty,\n\tHopShDomain,\n\tId,\n\tInternalHopDomain,\n\tMakeOptional,\n\tTimestamp,\n} from '../../util/types.ts';\nimport type {Endpoint} from '../endpoints.ts';\nimport type {Node} from './fleet.ts';\n\n/**\n * All regions that Hop operates in\n * @public\n */\nexport enum Regions {\n\tUS_EAST_1 = 'us-east-1',\n}\n\n/**\n * Runtime types are used to describe the type of a deployment or container\n * @public\n */\nexport enum RuntimeType {\n\t/**\n\t * Ephemeral deployments/containers are sort of fire and forget. Containers won't restart if they exit but they can still be terminated programatically.\n\t */\n\tEPHEMERAL = 'ephemeral',\n\n\t/**\n\t * Persistent deployments/containers will restart if they exit. They can also be started and stopped programmatically.\n\t */\n\tPERSISTENT = 'persistent',\n\n\t/**\n\t * Stateful deployments/containers can only run one container at a time, and will have a persistent volume attached.\n\t */\n\tSTATEFUL = 'stateful',\n}\n\n/**\n * An enum of states a container can be in\n * @public\n */\nexport enum ContainerState {\n\t/**\n\t * The container is pending creation\n\t */\n\tPENDING = 'pending',\n\n\t/**\n\t * The container is running\n\t */\n\tRUNNING = 'running',\n\n\t/**\n\t * The container is stopped\n\t */\n\tSTOPPED = 'stopped',\n\n\t/**\n\t * The container's entrypoint failed (e.g. exited with a non-zero exit code)\n\t */\n\tFAILED = 'failed',\n\n\t/**\n\t * The container is being deleted\n\t */\n\tTERMINATING = 'terminating',\n\n\t/**\n\t * The container exited (e.g. with a zero exit code)\n\t */\n\tEXITED = 'exited',\n}\n\n/**\n * Rollout state for deployments\n * @public\n */\nexport enum RolloutState {\n\tPENDING = 'pending',\n\tFINISHED = 'finished',\n\tFAILED = 'failed',\n}\n\n/**\n * Restart policy for deployments\n * @public\n */\nexport enum RestartPolicy {\n\tNEVER = 'never',\n\tALWAYS = 'always',\n\tON_FAILURE = 'on-failure',\n}\n\n/**\n * Formats of volumes\n * @public\n */\nexport enum VolumeFormat {\n\tEXT4 = 'ext4',\n\tXFS = 'xfs',\n}\n\n/**\n * A definition of a volume\n * @public\n */\nexport interface VolumeDefinition {\n\t/**\n\t * The format of the volume\n\t */\n\tfs: VolumeFormat;\n\n\t/**\n\t * The size of the volume in bytes\n\t */\n\tsize: ByteSizeString;\n\n\t/**\n\t * The mount point of the volume\n\t */\n\tmount_path: string;\n}\n\nexport interface ContainerMetrics {\n\tcpu_usage_percent: number;\n\tmemory_usage_percent: number;\n\tmemory_usage_bytes: number;\n}\n\n/**\n * The definition of a container\n * @public\n */\nexport interface Container {\n\t/**\n\t * The ID of the container\n\t */\n\tid: Id<'container'>;\n\n\t/**\n\t * The time this container was created\n\t */\n\tcreated_at: Timestamp;\n\n\t/**\n\t * The region this container runs in\n\t */\n\tregion: Regions;\n\n\t/**\n\t * Information about uptime/downtime for this container\n\t */\n\tuptime: {\n\t\t/**\n\t\t * The last time this container was started at\n\t\t */\n\t\tlast_start: Timestamp;\n\t};\n\n\t/**\n\t * Metrics for this container\n\t */\n\tmetrics: ContainerMetrics | null;\n\n\t/**\n\t * Information about the container\n\t */\n\tmetadata: {\n\t\t/**\n\t\t * The last exit code\n\t\t */\n\t\tlast_exit_code?: number;\n\t};\n\n\t/**\n\t * Overrides that were provided manually to the container\n\t */\n\n\toverrides: {\n\t\tresources?: Partial<Resources>;\n\t} | null;\n\n\t/**\n\t * The type of this container\n\t */\n\ttype: RuntimeType;\n\n\t/**\n\t * The volume definition for this container\n\t */\n\tvolume: VolumeDefinition | null;\n\n\t/**\n\t * The internal IP of the container\n\t */\n\tinternal_ip: string;\n\n\t/**\n\t * The ID of the deployment this container is associated with\n\t */\n\tdeployment_id: Id<'deployment'>;\n\n\t/**\n\t * The state this container is in\n\t */\n\tstate: ContainerState;\n}\n\n/**\n * A definition of a deployment\n * @public\n */\nexport interface Deployment {\n\t/**\n\t * The ID of the deployment\n\t */\n\tid: Id<'deployment'>;\n\n\t/**\n\t * The name of the deployment\n\t */\n\tname: string;\n\n\t/**\n\t * The amount of containers this deployment is currently running\n\t */\n\tcontainer_count: number;\n\n\t/**\n\t * The time this deployment was created at\n\t */\n\tcreated_at: Timestamp;\n\n\t/**\n\t * The config for this deployment\n\t */\n\tconfig: Omit<DeploymentConfig, 'name' | 'target'>;\n\n\t/**\n\t * Current active rollout for deployment\n\t * @deprecated Use {@link Deployment.latest_rollout} instead\n\t */\n\tactive_rollout: DeploymentRollout | null;\n\n\t/**\n\t * Current active build for deployment\n\t */\n\tactive_build: Build | null;\n\n\t/**\n\t * The ID of the build currently being used in production by this deployment.\n\t * This will change if another build has been promoted to production.\n\t */\n\tbuild_id: Build['id'] | null;\n\n\t/**\n\t * Current active rollout for deployment\n\t */\n\tlatest_rollout: DeploymentRollout | null;\n\n\t/**\n\t * The amount of containers in the running state\n\t */\n\trunning_container_count: number;\n\n\t/**\n\t * The target amount of containers a deployment should run\n\t */\n\ttarget_container_count: number;\n\n\t/**\n\t * Metadata for deployment\n\t */\n\tmetadata: DeploymentMetadata | null;\n\n\t/**\n\t * Build cache settings for deployment\n\t */\n\tbuild_cache_enabled: boolean;\n\n\t/**\n\t * Build settings for deployment\n\t */\n\tbuild_settings?: BuildSettings;\n\n\t/**\n\t * The group the deployment belongs in\n\t */\n\tgroup_id: Id<'deployment_group'> | null;\n\n\t/**\n\t * Target node for deployment, if its undefined its inferred as Hop\n\t */\n\ttarget?: DeploymentTarget | undefined;\n}\n\n/**\n * A definition of a build's settings\n * @public\n */\nexport interface BuildSettings {\n\t/**\n\t * Root directory for build\n\t */\n\troot_directory?: string;\n\n\t/**\n\t * Specifies where the dockerfile is located\n\t */\n\tdockerfile?: string;\n}\n\n/**\n * Deployment metadata\n * @public\n */\nexport interface DeploymentMetadata {\n\t/**\n\t * Ports that have been found by container's runtime.\n\t */\n\tcontainer_port_mappings: Record<Id<'container'>, string[]>;\n\t/**\n\t * Whether a user has ignored the onboarding process.\n\t */\n\tignored_boarding?: boolean;\n\t/**\n\t * Whether the deployment was created from a preset.\n\t */\n\tcreated_from_preset?: string;\n\t/**\n\t * Whether a gateway has been created for the deployment.\n\t */\n\tcreated_first_gateway?: boolean;\n\t/**\n\t * Whether a user has acknowledged the ports that have been found by container's runtime.\n\t */\n\tports_acked?: string[];\n}\n\n/**\n * Deployment metadata\n * @deprecated Use {@link DeploymentMetadata} instead\n * @public\n */\nexport type DeploymentMetaData = DeploymentMetadata;\n\n/**\n * Metadata attached to a build\n * @public\n */\nexport interface BuildMetadata {\n\t/**\n\t * Account type of repo owner\n\t */\n\taccount_type?: 'user' | 'organization';\n\n\t/**\n\t * Author information about build\n\t */\n\tauthor?: {\n\t\t/**\n\t\t * Author's Pfp\n\t\t */\n\t\tavatar_url: string;\n\n\t\t/**\n\t\t * Author's username\n\t\t */\n\t\tusername: string;\n\t};\n\n\t/**\n\t * Repo ID for build\n\t */\n\trepo_id: number;\n\n\t/**\n\t * Repo name for build\n\t */\n\trepo_name: string;\n\n\t/**\n\t * Repo branch for build\n\t */\n\tbranch: string;\n\n\t/**\n\t * commit SHA for build\n\t */\n\tcommit_sha: string;\n\n\t/**\n\t * commit message for build\n\t */\n\tcommit_msg: string;\n\n\t/**\n\t * commit URL for build\n\t */\n\tcommit_url?: string;\n}\n\n/**\n * Metadata attached to a build\n * @deprecated Use {@link BuildMetadata} instead\n * @public\n */\nexport type BuildMetaData = BuildMetadata;\n\n/**\n * The inferred environment type of a build\n * @public\n */\nexport enum BuildEnvironmentType {\n\tNIXPACKS = 'nixpacks',\n\tDOCKERFILE = 'dockerfile',\n}\n\n/**\n * The validated nixpacks plan for this build\n * @public\n */\nexport interface NixPlan {\n\tlanguage: string | null;\n\tpkgs: string[] | null;\n\tcmds: {\n\t\tbuild: string | null;\n\t\tstart: string | null;\n\t\tinstall: string | null;\n\t};\n}\n\n/**\n * Build environment contians information about the\n * language and build commands used to build the deployment\n * @public\n */\nexport interface BuildEnvironment {\n\ttype: BuildEnvironmentType;\n\tnix_plan?: NixPlan | null;\n}\n\n/**\n * Why the uploaded build content was rejected\n * @public\n */\nexport interface ValidationFailure {\n\treason: string;\n\thelp_link: string | null;\n}\n\n/**\n * A build is a single build of a deployment\n * @public\n */\nexport interface Build {\n\t/**\n\t * ID of the build\n\t */\n\tid: Id<'build'>;\n\n\t/**\n\t * Deployment ID for build\n\t */\n\tdeployment_id: Id<'deployment'>;\n\n\t/**\n\t * Metadata pertaining to build (mostly for GitHub)\n\t */\n\tmetadata: BuildMetadata | null;\n\n\t/**\n\t * Build method (GitHub or CLI)\n\t */\n\tmethod: BuildMethod;\n\n\t/**\n\t * Timestamp of when the build was created/queued\n\t */\n\tcreated_at?: Timestamp;\n\n\t/**\n\t * Timestamp of when the build has started\n\t */\n\tstarted_at: Timestamp | null;\n\n\t/**\n\t * Timestamp of when the build has finished\n\t */\n\tfinished_at: Timestamp | null;\n\n\t/**\n\t * Digest for image\n\t */\n\tdigest: string | null;\n\n\t/**\n\t * State of the build\n\t */\n\tstate: BuildState;\n\n\t/**\n\t * Environment for build\n\t */\n\tenvironment: BuildEnvironment | null;\n\n\t/**\n\t * Validation failure for build; present if build state is VALIDATION_FAILED\n\t */\n\tvalidation_failure: ValidationFailure | null;\n}\n\n/**\n * Information about a deployment's health check configuration\n * @public\n */\nexport type HealthCheck = {\n\t/**\n\t * The ID of health check\n\t */\n\tid: Id<'health_check'>;\n\n\t/**\n\t * Protocol for health check\n\t */\n\tprotocol: 'http';\n\n\t/**\n\t * Path for health check\n\t */\n\tpath: string;\n\n\t/**\n\t * Port for health check\n\t */\n\tport: number;\n\n\t/**\n\t * Interval for health check. This is how often the health check will be performed in seconds\n\t */\n\tinterval: number;\n\n\t/**\n\t * How long to wait for a response before considering the health check failed in milliseconds\n\t */\n\ttimeout: number;\n\n\t/**\n\t * How long we should wait when the container starts before performing the first health check.\n\t * This is useful for containers that take a while to start up, for example when running migrations.\n\t * This value is in seconds\n\t */\n\tinitial_delay: number;\n\n\t/**\n\t * Maximum number of consecutive failures before the container is considered unhealthy\n\t */\n\tmax_retries: number;\n\n\t/**\n\t * When the health check was created\n\t */\n\tcreated_at: Timestamp;\n};\n\nexport type Group = {\n\t/**\n\t * The ID of the group\n\t */\n\tid: Id<'deployment_group'>;\n\t/**\n\t * The name of the group\n\t */\n\tname: string;\n\t/**\n\t * The ID of the project the group belongs to\n\t */\n\tproject_id: Id<'project'>;\n\t/**\n\t * The position of the group in the list\n\t */\n\tposition: number;\n\t/**\n\t * The date the group was created\n\t */\n\tcreated_at: Timestamp;\n};\n\n/**\n * A deployment rollout\n * @public\n */\nexport type DeploymentRollout = {\n\t/**\n\t * The rollout ID for rollout\n\t */\n\tid: Id<'rollout'>;\n\n\t/**\n\t * The deployment ID for rollout\n\t */\n\tdeployment_id: Id<'deployment'>;\n\n\t/**\n\t * How many containers are being recreated\n\t */\n\tcount: number;\n\n\t/**\n\t * When the rollout took place\n\t */\n\tcreated_at: Timestamp;\n\t/**\n\t * The state of the rollout\n\t */\n\tstate: RolloutState;\n\n\t/**\n\t * The build that triggered the rollout\n\t */\n\tbuild: Build | null;\n\n\t/**\n\t * Container ID that the rollout is pertaining to\n\t */\n\tinit_container_id: string | null;\n\n\t/**\n\t * If a health check failed (causing the rollout to fail)\n\t */\n\thealth_check_failed: boolean;\n\n\t/**\n\t * Last time latest rollout was updated\n\t */\n\tlast_updated_at: Timestamp;\n\n\t/**\n\t * Has the rollout been acknowledged by a user\n\t */\n\tacknowledged: boolean;\n};\n\n/**\n * Data required to create a deployment\n * @internal\n */\nexport type CreateDeploymentConfig = MakeOptional<DeploymentConfig, 'cmd'>;\n\n/**\n * The strategy for scaling multiple containers.\n * @public\n */\nexport enum ContainerStrategy {\n\t/**\n\t * Add containers yourself with the API or Console\n\t */\n\tMANUAL = 'manual',\n\n\t/**\n\t * Have Hop automatically scale containers based on load\n\t */\n\t// AUTOSCALE = 'autoscale',\n}\n\n/**\n * A deployment's config\n * @public\n */\nexport interface DeploymentConfig {\n\t/**\n\t * The name of the deployment\n\t */\n\tname: string;\n\n\t/**\n\t * The strategy for scaling multiple containers.\n\t */\n\tcontainer_strategy: ContainerStrategy;\n\n\t/**\n\t * The type of this deployment\n\t */\n\ttype: RuntimeType;\n\n\t/**\n\t * The version of this config\n\t */\n\tversion: '12-12-2022';\n\n\t/**\n\t * Entrypoint command for the image\n\t */\n\tcmd?: string[];\n\n\t/**\n\t * The docker image config for this deployment\n\t */\n\timage: Image;\n\n\t/**\n\t * Environment variables for this deployment\n\t */\n\tenv: Record<string, string>;\n\n\t/**\n\t * Resources allocated to this deployment\n\t */\n\tresources: Resources;\n\n\t/**\n\t * Restart policy for this deployment\n\t */\n\trestart_policy: RestartPolicy;\n\n\t/**\n\t * The volume definition for this deployment\n\t *\n\t * This can only be used when .type is 'stateful'\n\t */\n\tvolume?: VolumeDefinition;\n\n\t/**\n\t * Entrypoint for this deployment\n\t */\n\tentrypoint?: string[];\n\n\t/**\n\t * Target node for deployment, if its undefined its inferred as Hop\n\t */\n\ttarget?: DeploymentTarget | undefined;\n}\n\n/**\n * Docker image config\n * @public\n */\nexport interface Image {\n\t/**\n\t * The name of the docker image\n\t */\n\tname: string | null;\n\n\t/**\n\t * Authorization required for the registry to access this image\n\t * This is not required if you use Hop's own registry.\n\t */\n\tauth: Auth | null;\n\n\t/**\n\t * GitHub repo information (if applicable)\n\t */\n\tgh_repo: ImageGHRepo | null;\n}\n\nexport interface DeploymentTarget {\n\t/**\n\t * The type of target (Hop, Fleet Node) (fleet group coming later)\n\t */\n\ttype: 'hop' | 'fleet_node';\n\t/**\n\t * The data of the target\n\t */\n\tdata: Node | null;\n}\n\n/**\n * Docker image registry authorization\n * @public\n */\nexport interface Auth {\n\tusername: string;\n\tpassword: string;\n}\n\n/**\n * GitHub repo type sent from API (NOT USED IN IMAGES)\n * @public\n */\nexport interface GHRepo {\n\tid: number;\n\tfull_name: string;\n\tprivate: boolean;\n\tdefault_branch: string;\n\taccount_name: string;\n}\n\n/**\n * GitHub repo partial used for images\n * @public\n */\nexport interface ImageGHRepo {\n\trepo_id: number;\n\tfull_name: string;\n\tbranch: string;\n}\n\n/**\n * Resources allocated to a deployment\n * @public\n */\nexport interface Resources {\n\t/**\n\t * Amount of vCPU to allocate\n\t */\n\tvcpu: number;\n\n\t/**\n\t * Amount of memory to allocate in a readible format\n\t * You can use the `parseSize` function to convert this to bytes.\n\t */\n\tram: ByteSizeString;\n}\n\n/**\n * Logs from a container\n * @public\n */\nexport interface ContainerLog {\n\t/**\n\t * The timestamp of the log\n\t */\n\ttimestamp: Timestamp;\n\n\t/**\n\t * The log message\n\t */\n\tmessage: string;\n\n\t/**\n\t * The ID of the document in elasticsearch. You probably won't have to use this, but\n\t * it might be useful for React keys, for example, as they are unique.\n\t */\n\tnonce: string;\n\n\t/**\n\t * The level of the log\n\t *\n\t * (\"error\" and \"log\" are for backwards compatibility, new logs will be \"stdout\" and \"stderr\")\n\t */\n\tlevel: 'stdout' | 'stderr' | 'error' | 'info';\n}\n\n/**\n * Types of build methods supported by Hop\n * @public\n */\nexport enum BuildMethod {\n\tGITHUB = 'github',\n\tCLI = 'cli',\n}\n\n/**\n * Types of gateways supported by Hop\n * @public\n */\nexport enum GatewayType {\n\t/**\n\t * The gateway can only be accessed inside of a project's network\n\t */\n\tINTERNAL = 'internal',\n\n\t/**\n\t * The gateway can be accessed from the internet\n\t */\n\tEXTERNAL = 'external',\n}\n\n/**\n * Gateways are used to connect services to the internet or a private network\n * @public\n */\nexport interface Gateway {\n\t/**\n\t * The ID of the gateway\n\t */\n\tid: Id<'gateway'>;\n\n\t/**\n\t * The type of the gateway\n\t */\n\ttype: GatewayType;\n\n\t/**\n\t * The name of the gateway\n\t */\n\tname: string;\n\n\t/**\n\t * The protocol for this gateway (Only for external)\n\t *\n\t * @alpha Currently, hop only supports HTTP. This will eventually change to an enum\n\t */\n\tprotocol: 'http' | null;\n\n\t/**\n\t * The deployment this gateway is associated with\n\t */\n\tdeployment_id: Id<'deployment'>;\n\n\t/**\n\t * The date this gateway was created\n\t */\n\tcreated_at: Timestamp;\n\n\t/**\n\t * Domain automatically assigned by Hop\n\t */\n\thopsh_domain: HopShDomain | null;\n\n\t/**\n\t * Determines if the hop.sh domain is current active.\n\t */\n\thopsh_domain_enabled: boolean;\n\n\t/**\n\t * Internal domain assigned by user upon gateway creation\n\t */\n\tinternal_domain: InternalHopDomain | null;\n\n\t/**\n\t * Port the Gateway targets (Only for external gateways)\n\t */\n\ttarget_port: number | null;\n\n\t/**\n\t * Domains associated with this gateway\n\t */\n\tdomains: Domain[];\n}\n\n/**\n * An enum of states a domain can be in\n * @public\n */\nexport enum DomainState {\n\tPENDING = 'pending',\n\tVALID_CNAME = 'valid_cname',\n\tSSL_ACTIVE = 'ssl_active',\n}\n\n/**\n * An enum of states a build can be in\n * @public\n */\nexport enum BuildState {\n\tVALIDATING = 'validating',\n\tPENDING = 'pending',\n\tFAILED = 'failed',\n\tSUCCEEDED = 'succeeded',\n\tCANCELLED = 'cancelled',\n\tVALIDATION_FAILED = 'validation_failed',\n}\n\n/**\n * A domain is a DNS record that points to a gateway\n * @public\n */\nexport interface Domain {\n\t/**\n\t * The ID of the domain\n\t */\n\tid: Id<'domain'>;\n\n\t/**\n\t * The domain name\n\t */\n\tdomain: string;\n\n\t/**\n\t * The domain state\n\t */\n\tstate: DomainState;\n\n\t/**\n\t * The date this domain was created\n\t */\n\tcreated_at: Timestamp;\n\n\t/**\n\t * Where the domain redirects to and its status code, null if N/A\n\t */\n\tredirect: DomainRedirect | null;\n}\n\n/**\n * A redirect setup for a domain\n * @public\n */\nexport interface DomainRedirect {\n\turl: string;\n\tstatus_code: 301 | 302 | 307 | 308;\n}\n\n/**\n * All endpoints for the Ignite API\n * @public\n */\nexport type IgniteEndpoints =\n\t| Endpoint<\n\t\t\t'GET',\n\t\t\t'/v1/ignite/deployments',\n\t\t\t{deployments: Deployment[]; groups: Group[]}\n\t  >\n\t| Endpoint<\n\t\t\t'GET',\n\t\t\t'/v1/ignite/deployments/:deployment_id/containers',\n\t\t\t{containers: Container[]}\n\t  >\n\t| Endpoint<\n\t\t\t'POST',\n\t\t\t'/v1/ignite/deployments/:deployment_id/containers',\n\t\t\t{container: Container}\n\t  >\n\t| Endpoint<\n\t\t\t'POST',\n\t\t\t'/v1/ignite/deployments/:deployment_id/containers/:container_id',\n\t\t\tnever,\n\t\t\t{\n\t\t\t\t/**\n\t\t\t\t * The ID of the deployment\n\t\t\t\t */\n\t\t\t\tdeployment_id: Id<'deployment'>;\n\n\t\t\t\t/**\n\t\t\t\t * The ID of the container\n\t\t\t\t */\n\t\t\t\tcontainer_id: Id<'container'>;\n\t\t\t}\n\t  >\n\t| Endpoint<\n\t\t\t'POST',\n\t\t\t'/v1/ignite/deployments',\n\t\t\t{deployment: Deployment},\n\t\t\tCreateDeploymentConfig\n\t  >\n\t| Endpoint<'DELETE', '/v1/ignite/deployments/:deployment_id', Empty>\n\t| Endpoint<\n\t\t\t'DELETE',\n\t\t\t'/v1/ignite/containers/:container_id',\n\t\t\tEmpty | {container: Container}\n\t  >\n\t| Endpoint<\n\t\t\t'GET',\n\t\t\t'/v1/ignite/containers/:container_id/logs',\n\t\t\t{logs: ContainerLog[]}\n\t  >\n\t| Endpoint<'GET', '/v1/ignite/deployments/search', {deployment: Deployment}>\n\t| Endpoint<\n\t\t\t'GET',\n\t\t\t'/v1/ignite/deployments/:deployment_id',\n\t\t\t{deployment: Deployment}\n\t  >\n\t| Endpoint<\n\t\t\t'PUT',\n\t\t\t'/v1/ignite/containers/:container_id/state',\n\t\t\tEmpty,\n\t\t\t{\n\t\t\t\t/**\n\t\t\t\t * The state to update the container to\n\t\t\t\t */\n\t\t\t\tpreferred_state: ContainerState.STOPPED | ContainerState.RUNNING;\n\t\t\t}\n\t  >\n\t| Endpoint<\n\t\t\t'POST',\n\t\t\t'/v1/ignite/gateways/:gateway_id/domains',\n\t\t\tEmpty,\n\t\t\t{domain: string}\n\t  >\n\t| Endpoint<'GET', '/v1/ignite/gateways/:gateway_id', {gateway: Gateway}>\n\t| Endpoint<\n\t\t\t'GET',\n\t\t\t'/v1/ignite/deployments/:deployment_id/gateways',\n\t\t\t{gateways: Gateway[]}\n\t  >\n\t| Endpoint<\n\t\t\t'POST',\n\t\t\t'/v1/ignite/deployments/:deployment_id/gateways',\n\t\t\t{gateway: Gateway},\n\t\t\t{\n\t\t\t\ttype: GatewayType;\n\t\t\t\ttarget_port: number;\n\t\t\t\tprotocol: Gateway['protocol'];\n\t\t\t\tname: string;\n\t\t\t}\n\t  >\n\t| Endpoint<\n\t\t\t'PATCH',\n\t\t\t'/v1/ignite/deployments/:deployment_id',\n\t\t\t{deployment: Deployment},\n\t\t\tPartial<DeploymentConfig>\n\t  >\n\t| Endpoint<\n\t\t\t'PATCH',\n\t\t\t'/v1/ignite/deployments/:deployment_id/metadata',\n\t\t\t{deployment: Deployment},\n\t\t\tPartial<DeploymentMetadata>\n\t  >\n\t| Endpoint<\n\t\t\t'POST',\n\t\t\t'/v1/ignite/deployments/:deployment_id/rollouts',\n\t\t\t{rollout: DeploymentRollout}\n\t  >\n\t| Endpoint<\n\t\t\t'POST',\n\t\t\t'/v1/ignite/deployments/:deployment_id/health-check',\n\t\t\t{health_check: HealthCheck},\n\t\t\tOmit<HealthCheck, 'id'>\n\t  >\n\t| Endpoint<\n\t\t\t'GET',\n\t\t\t'/v1/ignite/deployments/:deployment_id/storage',\n\t\t\tRecord<\n\t\t\t\t'volume' | 'build_cache',\n\t\t\t\tRecord<'provisioned_size' | 'used_size', number> | null\n\t\t\t>\n\t  >\n\t| Endpoint<\n\t\t\t'PATCH',\n\t\t\t'/v1/ignite/deployments/:deployment_id/health-check',\n\t\t\t{health_check: HealthCheck},\n\t\t\tPartial<Omit<HealthCheck, 'id'>>\n\t  >\n\t| Endpoint<'DELETE', '/v1/ignite/domains/:domain_id', Empty>\n\t| Endpoint<'GET', '/v1/ignite/domains/:domain_id', {domain: Domain}>\n\t| Endpoint<\n\t\t\t'POST',\n\t\t\t'/v1/ignite/groups',\n\t\t\t{group: Group},\n\t\t\t{\n\t\t\t\tname: string;\n\t\t\t\tdeployment_ids: Id<'deployment'>[];\n\t\t\t\tposition?: number | undefined;\n\t\t\t}\n\t  >\n\t| Endpoint<\n\t\t\t'PATCH',\n\t\t\t'/v1/ignite/groups/:group_id',\n\t\t\t{group: Group},\n\t\t\t{\n\t\t\t\tname?: string | undefined;\n\t\t\t\tposition?: number | undefined;\n\t\t\t}\n\t  >\n\t| Endpoint<\n\t\t\t'PUT',\n\t\t\t'/v1/ignite/groups/:group_id/deployments/:deployment_id',\n\t\t\t{group: Group}\n\t  >\n\t| Endpoint<'DELETE', '/v1/ignite/groups/:group_id', Empty>\n\t| Endpoint<'DELETE', '/v1/ignite/deployments/:deployment_id/group', Empty>;\n","import type {Empty, Id, Timestamp} from '../../util/types.ts';\nimport type {Endpoint} from '../endpoints.ts';\nimport type {Regions} from './ignite.ts';\n\n/**\n * A protocol that can be used to deliver a stream\n * @public\n */\nexport type DeliveryProtocol = 'webrtc' | 'hls';\n\n/**\n * A room that you can stream to\n * @public\n */\nexport interface Room {\n\t/**\n\t * The ID of this stream\n\t */\n\tid: Id<'pipe_room'>;\n\n\t/**\n\t * The name of this room\n\t */\n\tname: string;\n\n\t/**\n\t * The unix timestamp of when this stream was created\n\t */\n\tcreated_at: Timestamp;\n\n\t/**\n\t * Protocol you can stream with\n\t */\n\tingest_protocol: 'rtmp';\n\n\t/**\n\t * Protocols that are supported by this room to the client\n\t */\n\tdelivery_protocols: DeliveryProtocol[];\n\n\t/**\n\t * A join token to subscribe into this room\n\t */\n\tjoin_token: string;\n\n\t/**\n\t * The region that the stream url is located in\n\t */\n\tingest_region: Regions;\n\n\t/**\n\t * The URL that you can stream to\n\t */\n\tingest_endpoint: string;\n\n\t/**\n\t * The state of the stream currently\n\t */\n\tstate: 'live' | 'offline';\n}\n\n/**\n * The endpoints for the pipe API\n * @public\n */\nexport type PipeEndpoints =\n\t| Endpoint<'GET', '/v1/pipe/rooms', {rooms: Room[]}>\n\t| Endpoint<\n\t\t\t'POST',\n\t\t\t'/v1/pipe/rooms',\n\t\t\t{room: Room},\n\t\t\t{\n\t\t\t\t/**\n\t\t\t\t * The name of the stream\n\t\t\t\t */\n\t\t\t\tname: string;\n\n\t\t\t\tingest_protocol: 'rtmp' | 'rtp';\n\n\t\t\t\tdelivery_protocols: DeliveryProtocol[];\n\n\t\t\t\tregion: Regions;\n\n\t\t\t\tephemeral: boolean;\n\n\t\t\t\tllhls_config?:\n\t\t\t\t\t| {\n\t\t\t\t\t\t\twcl_delay: number;\n\t\t\t\t\t\t\tartificial_delay: number;\n\t\t\t\t\t\t\tmax_playout_bitrate_preset: string;\n\t\t\t\t\t  }\n\t\t\t\t\t| undefined;\n\t\t\t}\n\t  >\n\t| Endpoint<'DELETE', '/v1/pipe/rooms/:room_id', Empty>;\n","import type {\n\tEmpty,\n\tId,\n\tPossibleWebhookIDs,\n\tTimestamp,\n} from '../../util/types.ts';\nimport type {Endpoint} from '../endpoints.ts';\nimport type {\n\tBuild,\n\tContainer,\n\tContainerMetrics,\n\tDeployment,\n\tDeploymentRollout,\n\tGateway,\n\tHealthCheck,\n} from './ignite.ts';\nimport type {User} from './users.ts';\n\n/**\n * A member is a partial user with information about their membership in a project\n * @public\n */\nexport type Member = Omit<User, 'email' | 'id'> & {\n\t/**\n\t * The ID of the project member\n\t */\n\tid: Id<'pm'>;\n\n\t/**\n\t * The role that this member has in a project\n\t */\n\trole: MemberRole;\n\n\t/**\n\t * If user has multi-factor authentication enabled.\n\t */\n\tmfa_enabled: boolean;\n\n\t/**\n\t * The date that this member joined the project\n\t */\n\tjoined_at: Timestamp;\n};\n\n/**\n * A project tier\n * @public\n */\nexport enum ProjectTier {\n\tFREE = 'free',\n\tPAID = 'paid',\n}\n\n/**\n * A role that a member can have in a project\n * @public\n */\nexport interface MemberRole {\n\t/**\n\t * The ID of the role\n\t */\n\tid: Id<'role'>;\n\n\t/**\n\t * The name of the role\n\t */\n\tname: string;\n\n\t/**\n\t * The flags for this role\n\t */\n\tflags: number;\n}\n\n/**\n * A project token for a project\n * @public\n */\nexport interface ProjectToken {\n\t/**\n\t * The Id of the project token\n\t */\n\tid: Id<'ptkid'>;\n\n\t/**\n\t * The key value. This will likely have half of the key obfuscated\n\t */\n\ttoken: Id<'ptk'>;\n\n\t/**\n\t * The time this project token was created\n\t */\n\tcreated_at: Timestamp;\n\n\t/**\n\t * Permissions and flags that this project token can perform\n\t */\n\tflags: number;\n}\n\n/**\n * Type of a project\n * @public\n */\nexport enum ProjectType {\n\t/**\n\t * A standard project type\n\t */\n\tREGULAR = 'regular',\n\n\t/**\n\t * A personal project are created when you register an account\n\t */\n\tPERSONAL = 'personal',\n}\n\n/**\n * A project on Hop\n * @public\n */\nexport interface Project {\n\t/**\n\t * The ID of the project\n\t */\n\tid: Id<'project'>;\n\n\t/**\n\t * The name of the project\n\t */\n\tname: string;\n\n\t/**\n\t * The tier this project is\n\t */\n\ttier: ProjectTier;\n\n\t/**\n\t * The time this project was created at\n\t */\n\tcreated_at: Timestamp;\n\n\t/**\n\t * An icon for this project\n\t */\n\ticon: string | null;\n\n\t/**\n\t * The registry namespace for this project\n\t */\n\tnamespace: string;\n\n\t/**\n\t * The type of this project. Either regular or personal\n\t */\n\ttype: ProjectType;\n\n\tdefault_quotas: DefaultQuotas;\n\n\tquota_overrides: QuotaOverrides;\n\n\tquota_usage: QuotaUsage;\n}\n\n/**\n * Default quotas for a project\n * @public\n */\nexport interface DefaultQuotas {\n\tvcpu: number;\n\tram: number;\n\tvolume: number;\n}\n\n/**\n * Quota overrides for a project\n * @public\n */\nexport interface QuotaOverrides {}\n\n/**\n * Current usage of a quota for a project\n * @public\n */\nexport interface QuotaUsage {\n\tvcpu: number;\n\tram: number;\n\tvolume: number;\n}\n\n/**\n * A secret is a key/value pair that can be used to store sensitive information\n * @public\n */\nexport interface Secret {\n\t/**\n\t * The ID of the secret\n\t */\n\tid: Id<'secret'>;\n\n\t/**\n\t * The name of the secret\n\t */\n\tname: string;\n\n\t/**\n\t * A digest hash of the secret\n\t */\n\tdigest: string;\n\n\t/**\n\t * The time this secret was created at\n\t */\n\tcreated_at: Timestamp;\n\n\t/**\n\t * Deployment IDs this secret is used by\n\t */\n\tin_use_by: Id<'deployment'>[];\n}\n\n/**\n * Webhooks are used to send an event to an endpoint when something within Hop happens.\n * @public\n */\nexport interface Webhook {\n\t/**\n\t * The time this webhook was created at\n\t */\n\tcreated_at: Timestamp;\n\t/**\n\t * The events that this webhook is subscribed to\n\t */\n\tevents: PossibleWebhookIDs[];\n\t/**\n\t * The ID of the webhook\n\t */\n\tid: Id<'webhook'>;\n\t/**\n\t * The ID of the project this webhook is for\n\t */\n\tproject_id: Id<'project'>;\n\t/**\n\t * The secret for this webhook\n\t * @warning This is censored after creation\n\t * @example whsec_xxxxxxxx\n\t */\n\tsecret: string;\n\t/**\n\t * The type of the webhook\n\t */\n\ttype: 'http';\n\t/**\n\t * The URL that this webhook will send events to, acts as an endpoint\n\t */\n\twebhook_url: string;\n}\n\n/**\n * An event is sent from a webhook to an endpoint\n */\n\nexport interface HealthCheckEventUpdate {\n\tstate: 'failed' | 'succeeded' | 'pending';\n\tcontainer_id: string;\n\tdeployment_id: string;\n}\n\nexport type EventDataMap = {\n\t'ignite.deployment.container.updated': Container;\n\t'ignite.deployment.container.created': Container;\n\t'ignite.deployment.container.deleted': Container;\n\t'ignite.deployment.created': Deployment;\n\t'ignite.deployment.updated': Deployment;\n\t'ignite.deployment.deleted': Deployment;\n\t'ignite.deployment.build.created': Build;\n\t'ignite.deployment.build.updated': Build;\n\t'ignite.deployment.rollout.created': DeploymentRollout;\n\t'ignite.deployment.rollout.updated': DeploymentRollout;\n\t'ignite.deployment.container.metrics_update': ContainerMetrics;\n\t'ignite.deployment.healthcheck.created': HealthCheck;\n\t'ignite.deployment.healthcheck.updated': HealthCheck;\n\t'ignite.deployment.healthcheck.deleted': HealthCheck;\n\t'ignite.deployment.healthcheck.events.failed': HealthCheckEventUpdate;\n\t'ignite.deployment.healthcheck.events.succeeded': HealthCheckEventUpdate;\n\t'ignite.deployment.gateway.created': Gateway;\n\t'ignite.deployment.gateway.updated': Gateway;\n\t'ignite.deployment.gateway.deleted': Gateway;\n\t'project.updated': Project;\n\t'project.member.created': Member;\n\t'project.member.updated': Member;\n\t'project.member.deleted': Member;\n\t'project.tokens.created': ProjectToken;\n\t'project.tokens.deleted': ProjectToken;\n\t'project.secrets.created': Secret;\n\t'project.secrets.updated': Secret;\n\t'project.secrets.deleted': Secret;\n\t[key: string]: unknown;\n};\n\ntype Events<E> = E[keyof E];\n\nexport type Event = Events<{\n\t[Key in PossibleWebhookIDs]: {\n\t\twebhook_id: Id<'webhook'>;\n\t\t/**\n\t\t * The ID of the project that this event is for\n\t\t */\n\t\tproject_id: Id<'project'>;\n\t\t/**\n\t\t * The time this event occurred at\n\t\t */\n\t\toccurred_at: string;\n\t\t/**\n\t\t * The ID of the event\n\t\t */\n\t\tid: Id<'event'>;\n\t\t/**\n\t\t * The event that occurred\n\t\t */\n\t\tevent: Key;\n\t\t/**\n\t\t * The data the belongs to the event\n\t\t */\n\t\tdata: EventDataMap[Key];\n\t};\n}>;\n\nexport type ProjectsEndpoints =\n\t| Endpoint<\n\t\t\t'DELETE',\n\t\t\t'/v1/projects/:project_id/tokens/:project_token_id',\n\t\t\tEmpty\n\t  >\n\t| Endpoint<'DELETE', '/v1/projects/@this/tokens/:project_token_id', Empty>\n\t| Endpoint<\n\t\t\t'GET',\n\t\t\t'/v1/projects/:project_id/members/@me',\n\t\t\t{project_member: Member}\n\t  >\n\t| Endpoint<\n\t\t\t'GET',\n\t\t\t'/v1/projects/:project_id/tokens',\n\t\t\t{project_tokens: ProjectToken[]}\n\t  >\n\t| Endpoint<\n\t\t\t'GET',\n\t\t\t'/v1/projects/@this/tokens',\n\t\t\t{project_tokens: ProjectToken[]}\n\t  >\n\t| Endpoint<'GET', '/v1/projects/:project_id/members', {members: Member[]}>\n\t| Endpoint<'GET', '/v1/projects/@this/members', {members: Member[]}>\n\t| Endpoint<\n\t\t\t'POST',\n\t\t\t'/v1/projects/:project_id/tokens',\n\t\t\t{project_token: ProjectToken & {project: Project}},\n\t\t\t{flags: number}\n\t  >\n\t| Endpoint<\n\t\t\t'POST',\n\t\t\t'/v1/projects/@this/tokens',\n\t\t\t{project_token: ProjectToken & {project: Project}},\n\t\t\t{flags: number}\n\t  >\n\t| Endpoint<\n\t\t\t'PUT',\n\t\t\t'/v1/projects/:project_id/secrets/:name',\n\t\t\t{secret: Secret},\n\t\t\tstring\n\t  >\n\t| Endpoint<\n\t\t\t'PUT',\n\t\t\t'/v1/projects/@this/secrets/:name',\n\t\t\t{secret: Secret},\n\t\t\tstring\n\t  >\n\t| Endpoint<'GET', '/v1/projects/:project_id/secrets', {secrets: Secret[]}>\n\t| Endpoint<'GET', '/v1/projects/@this/secrets', {secrets: Secret[]}>\n\t| Endpoint<'DELETE', '/v1/projects/:project_id/secrets/:secret_id', Empty>\n\t| Endpoint<'DELETE', '/v1/projects/@this/secrets/:secret_id', Empty>\n\t| Endpoint<'GET', '/v1/projects/:project_id/webhooks', {webhooks: Webhook[]}>\n\t| Endpoint<'GET', '/v1/projects/@this/webhooks', {webhooks: Webhook[]}>\n\t| Endpoint<\n\t\t\t'POST',\n\t\t\t'/v1/projects/:project_id/webhooks',\n\t\t\t{webhook: Webhook},\n\t\t\t{\n\t\t\t\twebhook_url: string;\n\t\t\t\tevents: PossibleWebhookIDs[];\n\t\t\t}\n\t  >\n\t| Endpoint<\n\t\t\t'POST',\n\t\t\t'/v1/projects/@this/webhooks',\n\t\t\t{\n\t\t\t\twebhook: Webhook;\n\t\t\t},\n\t\t\t{\n\t\t\t\twebhook_url: string;\n\t\t\t\tevents: PossibleWebhookIDs[];\n\t\t\t}\n\t  >\n\t| Endpoint<\n\t\t\t'PATCH',\n\t\t\t'/v1/projects/:project_id/webhooks/:webhook_id',\n\t\t\t{webhook: Webhook},\n\t\t\t{\n\t\t\t\twebhook_url: string | undefined;\n\t\t\t\tevents: PossibleWebhookIDs[] | undefined;\n\t\t\t}\n\t  >\n\t| Endpoint<\n\t\t\t'PATCH',\n\t\t\t'/v1/projects/@this/webhooks/:webhook_id',\n\t\t\t{\n\t\t\t\twebhook: Webhook;\n\t\t\t},\n\t\t\t{\n\t\t\t\twebhook_url: string | undefined;\n\t\t\t\tevents: PossibleWebhookIDs[] | undefined;\n\t\t\t}\n\t  >\n\t| Endpoint<'DELETE', '/v1/projects/:project_id/webhooks/:webhook_id', Empty>\n\t| Endpoint<'DELETE', '/v1/projects/@this/webhooks/:webhook_id', Empty>\n\t| Endpoint<\n\t\t\t'POST',\n\t\t\t'/v1/projects/:project_id/webhooks/:webhook_id/regenerate',\n\t\t\t{secret: Webhook['secret']}\n\t  >\n\t| Endpoint<\n\t\t\t'POST',\n\t\t\t'/v1/projects/@this/webhooks/:webhook_id/regenerate',\n\t\t\t{secret: Webhook['secret']}\n\t  >;\n","import type {Empty} from '../../util/types.ts';\nimport type {Endpoint} from '../endpoints.ts';\n\n/**\n * All endpoints for Hop's Docker registry\n * @public\n */\nexport type RegistryEndpoints =\n\t| Endpoint<'DELETE', '/v1/registry/images/:image', Empty>\n\t| Endpoint<'GET', '/v1/registry/images', {images: string[]}>\n\t| Endpoint<\n\t\t\t'GET',\n\t\t\t'/v1/registry/images/:image/manifests',\n\t\t\t{\n\t\t\t\tmanifests: {\n\t\t\t\t\tdigest: {\n\t\t\t\t\t\tdigest: string;\n\t\t\t\t\t\tsize: number;\n\t\t\t\t\t\tuploaded: string;\n\t\t\t\t\t};\n\t\t\t\t\ttag: string | null;\n\t\t\t\t}[];\n\t\t\t}\n\t  >;\n","import type {Empty, Id, Timestamp} from '../../util/types.ts';\nimport type {Endpoint} from '../endpoints.ts';\nimport type {MemberRole, Project} from './projects.ts';\n\n/**\n * A user object\n * @public\n */\nexport interface User {\n\t/**\n\t * The ID of the user\n\t */\n\tid: Id<'user'>;\n\n\t/**\n\t * The name of the user. Think of this as a display name\n\t */\n\tname: string;\n\n\t/**\n\t * A unqiue username for the user\n\t */\n\tusername: string;\n\n\t/**\n\t * The email of the user\n\t */\n\temail: string;\n\n  /**\n   * The date the user was created\n   */\n  created_at: Timestamp;\n}\n\n/**\n * Self User Object\n * @public\n */\nexport interface SelfUser extends User {\n\t/**\n\t * If user has verified their email\n\t */\n\temail_verified: boolean;\n\n\t/**\n\t * If user has enabled totp authentication\n\t */\n\ttotp_enabled: boolean;\n\n\t/**\n\t * If user has enabled webauthn authentication\n\t */\n\twebauthn_enabled: boolean;\n\n\t/**\n\t * If user has enabled mfa authentication\n\t */\n\tmfa_enabled: boolean;\n\n\t/**\n\t * If user is an admin\n\t */\n\tadmin: boolean;\n}\n\n/**\n * A personal access token\n * @public\n */\nexport interface PAT {\n\t/**\n\t * The ID of the pat\n\t */\n\tid: Id<'pat'>;\n\n\t/**\n\t * The name of the pat\n\t */\n\tname: string | null;\n\n\t/**\n\t * The pat token\n\t *\n\t * @alpha This value will be partially censored if it\n\t */\n\tpat: string;\n\n\t/**\n\t * The date the pat was created\n\t */\n\tcreated_at: Timestamp;\n}\n\n/**\n * All user endpoints\n * @public\n */\nexport type UserEndpoints =\n\t| Endpoint<\n\t\t\t'GET',\n\t\t\t'/v1/users/@me',\n\t\t\t{\n\t\t\t\tprojects: Project[];\n\t\t\t\tuser: SelfUser;\n\t\t\t\tproject_member_role_map: Record<Id<'project'>, MemberRole>;\n\t\t\t\tleap_token: string | null;\n\t\t\t}\n\t  >\n\t| Endpoint<'POST', '/v1/users/@me/pats', {pat: PAT}, {name: string}>\n\t| Endpoint<'GET', '/v1/users/@me/pats', {pats: PAT[]}>\n\t| Endpoint<'DELETE', '/v1/users/@me/pats/:pat_id', Empty>;\n","import {IS_BROWSER} from '../util/constants.ts';\nimport {fetch, Headers, Request} from '../util/fetch.ts';\nimport type {ExtractRouteParams} from '../util/index.ts';\nimport {createURLBuilder} from '../util/urls.ts';\nimport type {APIResponse, Endpoints, ErroredAPIResponse} from './endpoints.ts';\nimport {getIdPrefix, type Id, type Method} from './types/index.ts';\n\n/**\n * A valid ID prefix supported by the Hop API for authetication\n * @public\n */\nexport type APIAuthenticationPrefix = 'ptk' | 'bearer' | 'pat';\n\n/**\n * Extract an endpoint from a given method and path\n * @public\n */\nexport type ExtractEndpoint<\n\tMethod extends string,\n\tPath extends string,\n> = Extract<Endpoints, {path: Path; method: Method}>;\n\n/**\n * Pull all paths for a given method\n * @internal\n */\nexport type PathsFor<M extends Method> = Extract<\n\tEndpoints,\n\t{method: M}\n>['path'];\n\n/**\n * All possible authentication ID types\n * @public\n */\nexport type APIAuthentication = Id<APIAuthenticationPrefix>;\n\n/**\n * Validates that an authentication prefix is valid\n * @param auth - The prefix to validate\n * @returns `true` if the prefix is valid, `false` otherwise\n * @public\n */\nexport function validateAPIAuthentication(\n\tauth: string,\n): auth is APIAuthenticationPrefix {\n\treturn auth === 'bearer' || auth === 'pat' || auth === 'ptk';\n}\n\n/**\n * Options passed to the API client.\n * This will usually come from Hop#constructor in most cases\n * @public\n */\nexport interface APIClientOptions {\n\treadonly baseUrl: string;\n\treadonly authentication: APIAuthentication;\n}\n\n/**\n * An error that occurred as a response from the Hop API.\n * @public\n */\nexport class HopAPIError extends Error {\n\tpublic readonly status: number;\n\n\tconstructor(\n\t\tpublic readonly request: Request,\n\t\tpublic readonly response: Response,\n\t\tpublic readonly data: ErroredAPIResponse,\n\t) {\n\t\tsuper(data.error.message);\n\n\t\tthis.status = response.status;\n\t}\n}\n\n/**\n * Generate a query object that includes typed URL params\n * @public\n */\nexport type Query<Path extends string> = ExtractRouteParams<Path> &\n\tRecord<string, string | number | undefined>;\n\n/**\n * API Client that is responsible for handling all requests\n * @public\n */\nexport class APIClient {\n\tpublic static getAuthType(auth: APIAuthentication) {\n\t\tconst prefix = getIdPrefix(auth);\n\n\t\tif (!validateAPIAuthentication(prefix)) {\n\t\t\tthrow new Error(`Invalid authentication type: ${prefix}`);\n\t\t}\n\n\t\treturn prefix;\n\t}\n\n\tprivate readonly options;\n\tprivate agent: import('node:https').Agent | null;\n\n\tpublic readonly authType;\n\tpublic readonly url;\n\n\tconstructor(options: APIClientOptions) {\n\t\tthis.options = options;\n\t\tthis.authType = APIClient.getAuthType(options.authentication);\n\t\tthis.url = createURLBuilder(options.baseUrl);\n\n\t\t// Be careful when using this property. It will only\n\t\t// have a value in Node.js environments. This is because\n\t\t// we add code at build time\n\t\tthis.agent = null;\n\t}\n\n\tasync get<Path extends PathsFor<'GET'>>(\n\t\tpath: Path,\n\t\tquery: Query<Path>,\n\t\tinit?: RequestInit,\n\t) {\n\t\treturn this.request<Extract<Endpoints, {path: Path; method: 'GET'}>['res']>(\n\t\t\t'GET',\n\t\t\tpath,\n\t\t\tundefined,\n\t\t\tquery,\n\t\t\tinit,\n\t\t);\n\t}\n\n\tpost<Path extends Extract<Endpoints, {method: 'POST'}>['path']>(\n\t\tpath: Path,\n\t\tbody: Extract<Endpoints, {path: Path; method: 'POST'}>['body'],\n\t\tquery: Query<Path>,\n\t\tinit?: RequestInit,\n\t) {\n\t\treturn this.request<\n\t\t\tExtract<Endpoints, {path: Path; method: 'POST'}>['res']\n\t\t>('POST', path, body, query, init);\n\t}\n\n\tput<Path extends Extract<Endpoints, {method: 'PUT'}>['path']>(\n\t\tpath: Path,\n\t\tbody: Extract<Endpoints, {path: Path; method: 'PUT'}>['body'],\n\t\tquery: Query<Path>,\n\t\tinit?: RequestInit,\n\t) {\n\t\treturn this.request<Extract<Endpoints, {path: Path; method: 'PUT'}>['res']>(\n\t\t\t'PUT',\n\t\t\tpath,\n\t\t\tbody,\n\t\t\tquery,\n\t\t\tinit,\n\t\t);\n\t}\n\n\tpatch<Path extends Extract<Endpoints, {method: 'PATCH'}>['path']>(\n\t\tpath: Path,\n\t\tbody: Extract<Endpoints, {path: Path; method: 'PATCH'}>['body'],\n\t\tquery: Query<Path>,\n\t\tinit?: RequestInit,\n\t) {\n\t\treturn this.request<\n\t\t\tExtract<Endpoints, {path: Path; method: 'PATCH'}>['res']\n\t\t>('PATCH', path, body, query, init);\n\t}\n\n\tdelete<Path extends Extract<Endpoints, {method: 'DELETE'}>['path']>(\n\t\tpath: Path,\n\t\tbody: Extract<Endpoints, {path: Path; method: 'DELETE'}>['body'],\n\t\tquery: Query<Path>,\n\t\tinit?: RequestInit,\n\t) {\n\t\treturn this.request<\n\t\t\tExtract<Endpoints, {path: Path; method: 'DELETE'}>['res']\n\t\t>('DELETE', path, body, query, init);\n\t}\n\n\tasync raw<T>(request: Request) {\n\t\trequest.headers.set('Authorization', this.options.authentication);\n\n\t\tif (!IS_BROWSER) {\n\t\t\trequest.headers.set('User-Agent', 'Hop-API-Client');\n\t\t}\n\n\t\treturn this.executeRequest<T>(request);\n\t}\n\n\tprivate async executeRequest<T>(request: Request): Promise<T> {\n\t\tif (TSUP_IS_NODE) {\n\t\t\tif (!this.agent) {\n\t\t\t\tconst https = await import('https');\n\t\t\t\tthis.agent = new https.Agent({keepAlive: true});\n\t\t\t}\n\t\t}\n\n\t\tconst response = await fetch(request, {\n\t\t\tkeepalive: true,\n\t\t\theaders: request.headers,\n\n\t\t\t// @ts-expect-error Targeting multiple runtimes, this will only work in node\n\t\t\tagent: this.agent,\n\t\t});\n\n\t\tif (\n\t\t\tresponse.status === 204 ||\n\t\t\t!response.headers.get('Content-Type')?.includes('application/json')\n\t\t) {\n\t\t\t// Probably a DELETE request with no body returned, so return undefined here\n\t\t\t// This cast is (prolly) safe because endpoints that return nothing\n\t\t\t// are typed as `Empty`\n\t\t\treturn undefined as unknown as T;\n\t\t}\n\n\t\tconst result = await (response.json() as Promise<APIResponse<T>>).catch(\n\t\t\t(error: Error): ErroredAPIResponse => {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: {\n\t\t\t\t\t\tcode: 'local_client_error',\n\t\t\t\t\t\tmessage: error.message,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t},\n\t\t);\n\n\t\tif (!result.success) {\n\t\t\tthrow new HopAPIError(request, response, result);\n\t\t}\n\n\t\treturn result.data;\n\t}\n\n\tprivate async request<T>(\n\t\tmethod: Method,\n\t\tpath: string,\n\t\tbody: unknown,\n\t\tquery: Record<string, string | number | undefined> = {},\n\t\tinit: RequestInit = {},\n\t) {\n\t\tconst url = this.url(path, query);\n\n\t\tconst headers = new Headers({\n\t\t\t...(init?.headers ?? {}),\n\t\t\tAuthorization: this.options.authentication,\n\t\t});\n\n\t\tif (!IS_BROWSER) {\n\t\t\theaders.set('User-Agent', 'Hop-API-Client');\n\t\t}\n\n\t\t// Treat falsy values as valid body\n\t\t// only undefined is not\n\t\tif (body !== undefined) {\n\t\t\tif (method === 'GET') {\n\t\t\t\tthrow new Error('Cannot send a GET request with a body');\n\t\t\t}\n\n\t\t\theaders.set('Content-Type', 'application/json');\n\t\t}\n\n\t\tconst request = new Request(url, {\n\t\t\tmethod,\n\t\t\tbody: body ? JSON.stringify(body) : null,\n\t\t\theaders,\n\t\t\t...init,\n\t\t});\n\n\t\treturn this.executeRequest<T>(request);\n\t}\n}\n","export * from './channels.ts';\nexport * from './ignite.ts';\nexport * from './pipe.ts';\nexport * from './projects.ts';\nexport * from './registry.ts';\nexport * from './users.ts';\nexport * from './fleet.ts';\n","import {create} from '@onehop/json-methods';\nimport type {API, Id} from '../rest/index.ts';\nimport {sdk} from './create.ts';\n\n/**\n * New state to set to a channel, or a callback function that will produce the new state\n * @public\n */\nexport type SetStateAction<T extends API.Channels.AnyStateObject> =\n\t| T\n\t| ((oldState: T) => T | Promise<T>);\n\n/**\n * Channels SDK client\n * @public\n */\nexport const channels = sdk(client => {\n\tconst Channels = create<API.Channels.Channel>().methods({\n\t\tasync setState<T extends API.Channels.AnyStateObject>(\n\t\t\tstate: SetStateAction<T>,\n\t\t) {\n\t\t\tawait updateState(this.id, state, 'set');\n\t\t},\n\n\t\tasync patchState<T extends API.Channels.AnyStateObject>(\n\t\t\tstate: SetStateAction<T>,\n\t\t) {\n\t\t\tawait updateState(this.id, state, 'patch');\n\t\t},\n\n\t\tasync subscribeToken(token: Id<'leap_token'>) {\n\t\t\tawait channelsSDK.subscribeToken(this.id, token);\n\t\t},\n\n\t\tasync subscribeTokens(tokens: Id<'leap_token'>[] | Set<Id<'leap_token'>>) {\n\t\t\tawait channelsSDK.subscribeTokens(this.id, tokens);\n\t\t},\n\n\t\tasync removeToken(token: Id<'leap_token'>) {\n\t\t\tawait channelsSDK.removeToken(this.id, token);\n\t\t},\n\n\t\tasync publishMessage(name: string, data: unknown) {\n\t\t\tawait channelsSDK.publishMessage(this.id, name, data);\n\t\t},\n\t});\n\n\tasync function updateState<T extends API.Channels.AnyStateObject>(\n\t\tchannelId: API.Channels.Channel['id'],\n\t\tnewState: SetStateAction<T>,\n\t\tmode: 'patch' | 'set',\n\t) {\n\t\tlet state: API.Channels.AnyStateObject;\n\n\t\tif (typeof newState === 'function') {\n\t\t\tconst {state: oldState} = await client.get(\n\t\t\t\t'/v1/channels/:channel_id/state',\n\t\t\t\t{channel_id: channelId},\n\t\t\t);\n\n\t\t\tstate = await newState(oldState as T);\n\t\t} else {\n\t\t\tstate = newState;\n\t\t}\n\n\t\tif (mode === 'patch') {\n\t\t\tawait client.patch('/v1/channels/:channel_id/state', state, {\n\t\t\t\tchannel_id: channelId,\n\t\t\t});\n\t\t} else {\n\t\t\tawait client.put('/v1/channels/:channel_id/state', state, {\n\t\t\t\tchannel_id: channelId,\n\t\t\t});\n\t\t}\n\t}\n\n\tconst channelsSDK = {\n\t\t/**\n\t\t * Creates a new channel\n\t\t *\n\t\t * @param type - The type of the channel to create\n\t\t * @param id - An ID to assign to the channel (optional, set this to `undefined` or `null` if you do not want to specify an ID)\n\t\t * @param project - A project ID (if necessary) to assign this to\n\t\t */\n\t\tasync create<T extends API.Channels.AnyStateObject>(\n\t\t\ttype: API.Channels.ChannelType,\n\t\t\tid?: string | null,\n\t\t\toptions?: {state?: T} | null,\n\t\t\tproject?: Id<'project'>,\n\t\t) {\n\t\t\tif (!project && client.authType !== 'ptk') {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Project must be provided when creating a channel with bearer or PAT auth',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst {channel} = id\n\t\t\t\t? await client.put(\n\t\t\t\t\t\t'/v1/channels/:channel_id',\n\t\t\t\t\t\t{type, state: options?.state ?? {}},\n\t\t\t\t\t\t{project, channel_id: id},\n\t\t\t\t  )\n\t\t\t\t: await client.post(\n\t\t\t\t\t\t'/v1/channels',\n\t\t\t\t\t\t{type, state: options?.state ?? {}},\n\t\t\t\t\t\t{project},\n\t\t\t\t  );\n\n\t\t\treturn Channels.from(channel);\n\t\t},\n\n\t\tasync get(id: API.Channels.Channel['id']) {\n\t\t\tconst {channel} = await client.get('/v1/channels/:channel_id', {\n\t\t\t\tchannel_id: id,\n\t\t\t});\n\n\t\t\treturn Channels.from(channel);\n\t\t},\n\n\t\t/**\n\t\t * Get all channels for a project\n\t\t *\n\t\t * @param project - An optional project ID if authenticating with a PAT or Bearer\n\t\t */\n\t\tasync getAll(project?: Id<'project'>) {\n\t\t\tconst {channels} = await client.get('/v1/channels', {project});\n\t\t\treturn channels.map(Channels.from);\n\t\t},\n\n\t\tasync subscribeToken(\n\t\t\tchannel: API.Channels.Channel | API.Channels.Channel['id'],\n\t\t\ttoken: Id<'leap_token'>,\n\t\t) {\n\t\t\tconst id = typeof channel === 'object' ? channel.id : channel;\n\n\t\t\tawait client.put(\n\t\t\t\t'/v1/channels/:channel_id/subscribers/:token',\n\t\t\t\tundefined,\n\t\t\t\t{channel_id: id, token},\n\t\t\t);\n\t\t},\n\n\t\tasync removeToken(\n\t\t\tchannel: API.Channels.Channel | API.Channels.Channel['id'],\n\t\t\ttoken: Id<'leap_token'>,\n\t\t) {\n\t\t\tconst id = typeof channel === 'object' ? channel.id : channel;\n\n\t\t\tawait client.delete(\n\t\t\t\t'/v1/channels/:channel_id/subscribers/:token',\n\t\t\t\tundefined,\n\t\t\t\t{channel_id: id, token},\n\t\t\t);\n\t\t},\n\n\t\tasync subscribeTokens(\n\t\t\tchannel: API.Channels.Channel | API.Channels.Channel['id'],\n\t\t\ttokens: Iterable<Id<'leap_token'>>,\n\t\t) {\n\t\t\tconst promises: Array<Promise<void>> = [];\n\n\t\t\tfor (const subscription of tokens) {\n\t\t\t\tpromises.push(this.subscribeToken(channel, subscription));\n\t\t\t}\n\n\t\t\tawait Promise.allSettled(promises);\n\t\t},\n\n\t\tasync removeTokens(\n\t\t\tchannel: API.Channels.Channel | API.Channels.Channel['id'],\n\t\t\ttokens: Iterable<Id<'leap_token'>>,\n\t\t) {\n\t\t\tconst promises: Array<Promise<void>> = [];\n\n\t\t\tfor (const subscription of tokens) {\n\t\t\t\tpromises.push(this.removeToken(channel, subscription));\n\t\t\t}\n\n\t\t\tawait Promise.allSettled(promises);\n\t\t},\n\n\t\tasync getAllTokens(\n\t\t\tchannel: API.Channels.Channel['id'] | API.Channels.Channel,\n\t\t) {\n\t\t\tconst id = typeof channel === 'object' ? channel.id : channel;\n\n\t\t\tconst {tokens} = await client.get('/v1/channels/:channel_id/tokens', {\n\t\t\t\tchannel_id: id,\n\t\t\t});\n\n\t\t\treturn tokens;\n\t\t},\n\n\t\tasync setState<\n\t\t\tT extends API.Channels.AnyStateObject = API.Channels.AnyStateObject,\n\t\t>(\n\t\t\tchannel: API.Channels.Channel | API.Channels.Channel['id'],\n\t\t\tstate: SetStateAction<T>,\n\t\t) {\n\t\t\tconst id = typeof channel === 'object' ? channel.id : channel;\n\t\t\treturn updateState(id, state, 'set');\n\t\t},\n\n\t\tasync patchState<T extends API.Channels.AnyStateObject>(\n\t\t\tchannel: API.Channels.Channel | API.Channels.Channel['id'],\n\t\t\tstate: SetStateAction<T>,\n\t\t) {\n\t\t\tconst id = typeof channel === 'object' ? channel.id : channel;\n\t\t\treturn updateState(id, state, 'patch');\n\t\t},\n\n\t\t/**\n\t\t * Publishes a new event to a channel\n\t\t *\n\t\t * @param channel - The channel to publish to\n\t\t * @param event - The event name\n\t\t * @param data - The data for this event\n\t\t */\n\t\tasync publishMessage<T>(\n\t\t\tchannel: API.Channels.Channel | API.Channels.Channel['id'],\n\t\t\tevent: string,\n\t\t\tdata: T,\n\t\t) {\n\t\t\tconst id = typeof channel === 'object' ? channel.id : channel;\n\n\t\t\tawait client.post(\n\t\t\t\t'/v1/channels/:channel_id/messages',\n\t\t\t\t{e: event, d: data},\n\t\t\t\t{channel_id: id},\n\t\t\t);\n\t\t},\n\n\t\tasync delete(id: API.Channels.Channel['id']) {\n\t\t\tawait client.delete('/v1/channels/:channel_id', undefined, {\n\t\t\t\tchannel_id: id,\n\t\t\t});\n\t\t},\n\n\t\tasync getStats(id: API.Channels.Channel['id']) {\n\t\t\tconst {stats} = await client.get('/v1/channels/:channel_id/stats', {\n\t\t\t\tchannel_id: id,\n\t\t\t});\n\n\t\t\treturn stats;\n\t\t},\n\n\t\ttokens: {\n\t\t\tasync delete(token: Id<'leap_token'>) {\n\t\t\t\tawait client.delete('/v1/channels/tokens/:token', undefined, {\n\t\t\t\t\ttoken,\n\t\t\t\t});\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Creates a new channel token for a project\n\t\t\t *\n\t\t\t * @param state - The state to set on the token\n\t\t\t * @param project - The project to attach this token to\n\t\t\t */\n\t\t\tasync create(\n\t\t\t\tstate: API.Channels.AnyStateObject = {},\n\t\t\t\tproject?: Id<'project'>,\n\t\t\t) {\n\t\t\t\tif (!project && client.authType !== 'ptk') {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t'Project must be provided when creating a channel token with bearer or PAT auth',\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst {token} = await client.post(\n\t\t\t\t\t'/v1/channels/tokens',\n\t\t\t\t\t{state},\n\t\t\t\t\t{project},\n\t\t\t\t);\n\n\t\t\t\treturn token;\n\t\t\t},\n\n\t\t\tasync setState(\n\t\t\t\tid: Id<'leap_token'>,\n\t\t\t\tstate: API.Channels.ChannelToken['state'],\n\t\t\t) {\n\t\t\t\tconst {token} = await client.patch(\n\t\t\t\t\t'/v1/channels/tokens/:token',\n\t\t\t\t\t{state},\n\t\t\t\t\t{token: id},\n\t\t\t\t);\n\n\t\t\t\treturn token;\n\t\t\t},\n\n\t\t\tasync get(id: Id<'leap_token'>) {\n\t\t\t\tconst {token} = await client.get('/v1/channels/tokens/:token', {\n\t\t\t\t\ttoken: id,\n\t\t\t\t});\n\n\t\t\t\treturn token;\n\t\t\t},\n\n\t\t\tasync isOnline(idOrToken: Id<'leap_token'> | API.Channels.ChannelToken) {\n\t\t\t\tif (typeof idOrToken === 'object') {\n\t\t\t\t\treturn idOrToken.is_online;\n\t\t\t\t}\n\n\t\t\t\tconst {token} = await client.get('/v1/channels/tokens/:token', {\n\t\t\t\t\ttoken: idOrToken,\n\t\t\t\t});\n\n\t\t\t\treturn token.is_online;\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Publishes a direct message to a single token\n\t\t\t * @param token - The token to publish a direct message to\n\t\t\t * @param event - The event name\n\t\t\t * @param data - The data for this event\n\t\t\t */\n\t\t\tasync publishDirectMessage<T>(\n\t\t\t\ttoken: Id<'leap_token'>,\n\t\t\t\tevent: string,\n\t\t\t\tdata: T,\n\t\t\t) {\n\t\t\t\tawait client.post(\n\t\t\t\t\t'/v1/channels/tokens/:token/messages',\n\t\t\t\t\t{e: event, d: data},\n\t\t\t\t\t{token},\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t};\n\n\treturn channelsSDK;\n});\n","import {create, type Infer} from '@onehop/json-methods';\nimport {API, assertId, type Id} from '../rest/index.ts';\nimport {\n\tGatewayType,\n\tRuntimeType,\n\ttype Deployment,\n\ttype DeploymentConfig,\n\ttype DeploymentMetadata,\n\ttype Gateway,\n} from '../rest/types/ignite.ts';\nimport {parseSize, validateId} from '../util/index.ts';\nimport {sdk} from './create.ts';\n\nconst SIX_MB_IN_BYTES = 6 * 1024 * 1024;\n\n/**\n * Ignite SDK client\n * @public\n */\nexport const ignite = sdk(client => {\n\tconst Gateways = create<API.Ignite.Gateway>().methods({\n\t\tasync addDomain(domain: string) {\n\t\t\tawait client.post(\n\t\t\t\t'/v1/ignite/gateways/:gateway_id/domains',\n\t\t\t\t{domain},\n\t\t\t\t{gateway_id: this.id},\n\t\t\t);\n\t\t},\n\n\t\tasync deleteDomain(domainId: Id<'domain'>) {\n\t\t\tawait client.delete('/v1/ignite/domains/:domain_id', undefined, {\n\t\t\t\tdomain_id: domainId,\n\t\t\t});\n\t\t},\n\t});\n\n\tconst Deployments = create<API.Ignite.Deployment>().methods({\n\t\tgetContainers() {\n\t\t\treturn igniteSDK.deployments.getContainers(this.id);\n\t\t},\n\n\t\tdelete() {\n\t\t\treturn igniteSDK.deployments.delete(this.id);\n\t\t},\n\n\t\tcreateContainer() {\n\t\t\treturn igniteSDK.containers.create(this.id);\n\t\t},\n\n\t\tcreateGateway(\n\t\t\tconfig:\n\t\t\t\t| {\n\t\t\t\t\t\ttype: API.Ignite.GatewayType.EXTERNAL;\n\t\t\t\t\t\tprotocol: API.Ignite.Gateway['protocol'];\n\t\t\t\t\t\tname: string;\n\t\t\t\t\t\ttargetPort: number;\n\t\t\t\t  }\n\t\t\t\t| {\n\t\t\t\t\t\ttype: API.Ignite.GatewayType.INTERNAL;\n\t\t\t\t\t\tprotocol: API.Ignite.Gateway['protocol'];\n\t\t\t\t\t\tname: string;\n\t\t\t\t\t\ttargetPort: number;\n\t\t\t\t\t\tinternalDomain: string;\n\t\t\t\t  },\n\t\t) {\n\t\t\treturn igniteSDK.gateways.create(this.id, config);\n\t\t},\n\n\t\tgetStorageStats() {\n\t\t\treturn igniteSDK.deployments.getStorageStats(this.id);\n\t\t},\n\t});\n\n\t/**\n\t * Creates a new deployment.\n\t * You should use this overload if you are authorizing with a bearer or pat.\n\t *\n\t * @param configOrProject - The project ID to create the deployment in.\n\t * @param bearerOrPatConfig - The deployment config to create.\n\t */\n\tasync function createDeployment(\n\t\tconfigOrProject: Id<'project'>,\n\t\tbearerOrPatConfig: API.Ignite.CreateDeploymentConfig,\n\t): Promise<Infer<typeof Deployments>>;\n\n\t/**\n\t * Create a new deployment. You should use this overload if you are authorizing with a project token and\n\t * not with a bearer or pat.\n\t *\n\t * @param configOrProject - The config for this deployment.\n\t */\n\tasync function createDeployment(\n\t\tconfigOrProject: API.Ignite.CreateDeploymentConfig,\n\t): Promise<Infer<typeof Deployments>>;\n\n\tasync function createDeployment(\n\t\tconfigOrProject: Id<'project'> | API.Ignite.CreateDeploymentConfig,\n\t\tbearerOrPatConfig?: API.Ignite.CreateDeploymentConfig,\n\t): Promise<Infer<typeof Deployments>> {\n\t\tlet config: API.Ignite.CreateDeploymentConfig;\n\t\tlet project: Id<'project'> | undefined = undefined;\n\n\t\tif (typeof configOrProject === 'object') {\n\t\t\tif (client.authType === 'ptk') {\n\t\t\t\tconfig = configOrProject;\n\t\t\t} else {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'First argument must be the project ID when using bearer authentication to create deployments.',\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tif (!bearerOrPatConfig) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Second argument must be the deployment config when using bearer authentication to create deployments.',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (client.authType === 'bearer' || client.authType === 'pat') {\n\t\t\t\tproject = configOrProject;\n\t\t\t\tconfig = bearerOrPatConfig;\n\t\t\t} else {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Only argument must be the config when using secret authentication to create deployments.',\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Hop's runtime requires a minimum of 6mb of memory per container\n\t\t// It's useful to validate this at the SDK level as well as API level.\n\t\tif (parseSize(config.resources.ram) <= SIX_MB_IN_BYTES) {\n\t\t\tthrow new Error(\n\t\t\t\t'Allocated memory must be greater than 6MB when creating a deployment.',\n\t\t\t);\n\t\t}\n\n\t\tif (config.volume && config.type !== RuntimeType.STATEFUL) {\n\t\t\tthrow new Error(\n\t\t\t\t'Cannot create a deployment with a volume that is not stateful.',\n\t\t\t);\n\t\t}\n\n\t\tconst {deployment} = await client.post('/v1/ignite/deployments', config, {\n\t\t\tproject,\n\t\t});\n\n\t\treturn Deployments.from(deployment);\n\t}\n\n\tasync function updateContainerState(\n\t\tcontainer: Id<'container'>,\n\t\tstate:\n\t\t\t| API.Ignite.ContainerState.RUNNING\n\t\t\t| API.Ignite.ContainerState.STOPPED,\n\t) {\n\t\tawait client.put(\n\t\t\t'/v1/ignite/containers/:container_id/state',\n\t\t\t{preferred_state: state},\n\t\t\t{container_id: container},\n\t\t);\n\t}\n\n\t/**\n\t * Gets a deployment by name\n\t *\n\t * @param projectId - The project ID. You only need to provide this if you are getting by name.\n\t * @param name - The deployment name to get\n\t */\n\tasync function getDeployment(\n\t\tname: string,\n\t\tprojectId?: Id<'project'>,\n\t): Promise<Infer<typeof Deployments>>;\n\n\t/**\n\t * Gets a deployment by id\n\t *\n\t * @param id - The deployment ID\n\t */\n\tasync function getDeployment(\n\t\tid: Id<'deployment'>,\n\t\tprojectId?: Id<'project'>,\n\t): Promise<Infer<typeof Deployments>>;\n\n\tasync function getDeployment(\n\t\tidOrName: Id<'deployment'> | string,\n\t\tprojectId?: Id<'project'>,\n\t): Promise<Infer<typeof Deployments>> {\n\t\tif (!validateId(idOrName, 'deployment')) {\n\t\t\tconst {deployment} = await client.get('/v1/ignite/deployments/search', {\n\t\t\t\tname: idOrName,\n\t\t\t\tproject: projectId,\n\t\t\t});\n\n\t\t\treturn Deployments.from(deployment);\n\t\t}\n\n\t\tassertId(idOrName, 'deployment', 'You must provide a valid deployment ID.');\n\n\t\tconst {deployment} = await client.get(\n\t\t\t'/v1/ignite/deployments/:deployment_id',\n\t\t\t{\n\t\t\t\tdeployment_id: idOrName,\n\t\t\t\tproject: projectId,\n\t\t\t},\n\t\t);\n\n\t\treturn Deployments.from(deployment);\n\t}\n\n\t/**\n\t * Deletes a container and recreates it after deletion\n\t *\n\t * @param container_id - The ID of the container to delete\n\t * @param options - Options object\n\t */\n\tasync function deleteContainer(\n\t\tcontainer_id: Id<'container'>,\n\t\toptions: {recreate: true},\n\t): Promise<API.Ignite.Container>;\n\n\t/**\n\t * Deletes a container. This will not recreate the container.\n\t *\n\t * @param container - The ID of the container to delete\n\t * @param options - Options object\n\t */\n\tasync function deleteContainer(\n\t\tcontainer_id: Id<'container'>,\n\t\toptions?: {recreate?: false},\n\t): Promise<undefined>;\n\n\t/**\n\t * Deletes a container, and optionally recreates it after deletion\n\t *\n\t * @param container - The ID of the container to delete\n\t * @param options - Options object\n\t */\n\tasync function deleteContainer(\n\t\tcontainer_id: Id<'container'>,\n\t\toptions: {\n\t\t\trecreate?: boolean;\n\t\t} = {},\n\t) {\n\t\tconst d = await client.delete(\n\t\t\t'/v1/ignite/containers/:container_id',\n\t\t\tundefined,\n\t\t\t{container_id, recreate: options.recreate ? 'true' : undefined},\n\t\t);\n\n\t\tif (!d) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn d.container;\n\t}\n\n\tconst deploymentGateways = {\n\t\t/**\n\t\t * Fetches all gateways attached to a deployment\n\t\t *\n\t\t * @param deploymentId - The ID of the deployment to fetch gateways for\n\t\t */\n\t\tasync getAll(deploymentId: Id<'deployment'>) {\n\t\t\tconst {gateways} = await client.get(\n\t\t\t\t'/v1/ignite/deployments/:deployment_id/gateways',\n\t\t\t\t{deployment_id: deploymentId},\n\t\t\t);\n\n\t\t\treturn gateways.map(Gateways.from);\n\t\t},\n\n\t\t/**\n\t\t * Creates and attaches a gateway to a deployment\n\t\t *\n\t\t * @param deployment - The deployment to create a gateway on\n\t\t * @param type - The type of the gateway to create, either internal or external\n\t\t * @param protocol - The protocol that the gateway will listen for\n\t\t * @param targetPort - The port to listen on\n\t\t */\n\t\tasync create(\n\t\t\tdeployment: Deployment | Deployment['id'],\n\t\t\tconfig:\n\t\t\t\t| {\n\t\t\t\t\t\ttype: GatewayType.EXTERNAL;\n\t\t\t\t\t\tprotocol: Gateway['protocol'];\n\t\t\t\t\t\ttargetPort: number;\n\t\t\t\t\t\tname: string;\n\t\t\t\t  }\n\t\t\t\t| {\n\t\t\t\t\t\ttype: GatewayType.INTERNAL;\n\t\t\t\t\t\tprotocol: Gateway['protocol'];\n\t\t\t\t\t\ttargetPort: number;\n\t\t\t\t\t\tname: string;\n\t\t\t\t\t\tinternalDomain: string;\n\t\t\t\t  },\n\t\t) {\n\t\t\tconst deploymentId =\n\t\t\t\ttypeof deployment === 'object' ? deployment.id : deployment;\n\n\t\t\tconst body =\n\t\t\t\tconfig.type === GatewayType.EXTERNAL\n\t\t\t\t\t? {...config, target_port: config.targetPort}\n\t\t\t\t\t: {\n\t\t\t\t\t\t\t...config,\n\t\t\t\t\t\t\ttarget_port: config.targetPort,\n\t\t\t\t\t\t\tinternal_domain: config.internalDomain,\n\t\t\t\t\t  };\n\n\t\t\tconst {gateway} = await client.post(\n\t\t\t\t'/v1/ignite/deployments/:deployment_id/gateways',\n\t\t\t\tbody,\n\t\t\t\t{deployment_id: deploymentId},\n\t\t\t);\n\n\t\t\treturn Gateways.from(gateway);\n\t\t},\n\t};\n\n\tconst groups = {\n\t\tasync create(\n\t\t\tname: string,\n\t\t\toptions?: Partial<{\n\t\t\t\tdeploymentIds: Id<'deployment'>[];\n\t\t\t\tposition: number;\n\t\t\t}>,\n\t\t\tprojectId?: Id<'project'>,\n\t\t) {\n\t\t\tif (client.authType !== 'ptk' && !projectId) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Project ID is required for Bearer or PAT authentication',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst {group} = await client.post(\n\t\t\t\t'/v1/ignite/groups',\n\t\t\t\t{\n\t\t\t\t\tname,\n\t\t\t\t\tdeployment_ids: options?.deploymentIds ?? [],\n\t\t\t\t\tposition: options?.position,\n\t\t\t\t},\n\t\t\t\tprojectId ? {project: projectId} : {},\n\t\t\t);\n\n\t\t\treturn group;\n\t\t},\n\n\t\tasync edit(\n\t\t\tgroupId: Id<'deployment_group'>,\n\t\t\t{\n\t\t\t\tname,\n\t\t\t\tposition,\n\t\t\t}: {name?: string | undefined; position?: number | undefined},\n\t\t\tprojectId?: Id<'project'>,\n\t\t) {\n\t\t\tif (client.authType !== 'ptk' && !projectId) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Project ID is required for Bearer or PAT authentication',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst {group} = await client.patch(\n\t\t\t\t'/v1/ignite/groups/:group_id',\n\t\t\t\t{\n\t\t\t\t\tname,\n\t\t\t\t\tposition,\n\t\t\t\t},\n\t\t\t\t{group_id: groupId, ...(projectId ? {project: projectId} : {})},\n\t\t\t);\n\n\t\t\treturn group;\n\t\t},\n\n\t\t/**\n\t\t * Moves a deployment to a group, or removes it if groupId is null\n\t\t */\n\t\tasync move(\n\t\t\tdeploymentId: Id<'deployment'>,\n\t\t\tgroupId: Id<'deployment_group'> | null,\n\t\t\tprojectId?: Id<'project'>,\n\t\t) {\n\t\t\tif (client.authType !== 'ptk' && !projectId) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Project ID is required for Bearer or PAT authentication',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (groupId === null) {\n\t\t\t\tawait client.delete(\n\t\t\t\t\t'/v1/ignite/deployments/:deployment_id/group',\n\t\t\t\t\tundefined,\n\t\t\t\t\t{\n\t\t\t\t\t\tdeployment_id: deploymentId,\n\t\t\t\t\t\t...(projectId ? {project: projectId} : {}),\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst {group} = await client.put(\n\t\t\t\t'/v1/ignite/groups/:group_id/deployments/:deployment_id',\n\t\t\t\tundefined,\n\t\t\t\t{\n\t\t\t\t\tgroup_id: groupId,\n\t\t\t\t\tdeployment_id: deploymentId,\n\t\t\t\t\t...(projectId ? {project: projectId} : {}),\n\t\t\t\t},\n\t\t\t);\n\n\t\t\treturn group;\n\t\t},\n\n\t\tasync delete(groupId: Id<'deployment_group'>, projectId?: Id<'project'>) {\n\t\t\tif (client.authType !== 'ptk' && !projectId) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Project ID is required for Bearer or PAT authentication',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tawait client.delete('/v1/ignite/groups/:group_id', undefined, {\n\t\t\t\tgroup_id: groupId,\n\t\t\t\t...(projectId ? {project: projectId} : {}),\n\t\t\t});\n\t\t},\n\t};\n\n\tconst igniteSDK = {\n\t\tgroups,\n\n\t\tdomains: {\n\t\t\tdelete: async (id: Id<'domain'>) => {\n\t\t\t\tawait client.delete('/v1/ignite/domains/:domain_id', undefined, {\n\t\t\t\t\tdomain_id: id,\n\t\t\t\t});\n\t\t\t},\n\n\t\t\tget: async (id: Id<'domain'>) => {\n\t\t\t\tconst {domain} = await client.get('/v1/ignite/domains/:domain_id', {\n\t\t\t\t\tdomain_id: id,\n\t\t\t\t});\n\n\t\t\t\treturn domain;\n\t\t\t},\n\t\t},\n\n\t\tgateways: {\n\t\t\t...deploymentGateways,\n\n\t\t\t/**\n\t\t\t * Adds a domain to a gateway\n\t\t\t *\n\t\t\t * @param gatewayId - The ID of the gateway\n\t\t\t * @param domain - The full name of the domain\n\t\t\t */\n\t\t\tasync addDomain(gatewayId: Id<'gateway'>, domain: string) {\n\t\t\t\tawait client.post(\n\t\t\t\t\t'/v1/ignite/gateways/:gateway_id/domains',\n\t\t\t\t\t{domain},\n\t\t\t\t\t{gateway_id: gatewayId},\n\t\t\t\t);\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Fetches a gateway by ID\n\t\t\t *\n\t\t\t * @param gatewayId - The ID of the gateway to retrieve\n\t\t\t */\n\t\t\tasync get(gatewayId: Id<'gateway'>) {\n\t\t\t\tconst {gateway} = await client.get('/v1/ignite/gateways/:gateway_id', {\n\t\t\t\t\tgateway_id: gatewayId,\n\t\t\t\t});\n\n\t\t\t\treturn gateway;\n\t\t\t},\n\t\t},\n\n\t\thealthChecks: {\n\t\t\tcreate: async (\n\t\t\t\tdeployment: Id<'deployment'>,\n\t\t\t\tconfig: Omit<API.Ignite.HealthCheck, 'id'>,\n\t\t\t) => {\n\t\t\t\tconst {health_check: check} = await client.post(\n\t\t\t\t\t'/v1/ignite/deployments/:deployment_id/health-check',\n\t\t\t\t\tconfig,\n\t\t\t\t\t{deployment_id: deployment},\n\t\t\t\t);\n\n\t\t\t\treturn check;\n\t\t\t},\n\n\t\t\tupdate: async (\n\t\t\t\tdeployment: Id<'deployment'>,\n\t\t\t\tconfig: Partial<Omit<API.Ignite.HealthCheck, 'id'>>,\n\t\t\t) => {\n\t\t\t\tawait client.patch(\n\t\t\t\t\t'/v1/ignite/deployments/:deployment_id/health-check',\n\t\t\t\t\tconfig,\n\t\t\t\t\t{deployment_id: deployment},\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\n\t\tdeployments: {\n\t\t\tcreate: createDeployment,\n\t\t\tget: getDeployment,\n\n\t\t\tasync rollout(id: Id<'deployment'>) {\n\t\t\t\tconst {rollout} = await client.post(\n\t\t\t\t\t'/v1/ignite/deployments/:deployment_id/rollouts',\n\t\t\t\t\tundefined,\n\t\t\t\t\t{deployment_id: id},\n\t\t\t\t);\n\n\t\t\t\treturn rollout;\n\t\t\t},\n\n\t\t\tasync getStorageStats(id: Id<'deployment'>) {\n\t\t\t\treturn client.get('/v1/ignite/deployments/:deployment_id/storage', {\n\t\t\t\t\tdeployment_id: id,\n\t\t\t\t});\n\t\t\t},\n\n\t\t\tasync update(\n\t\t\t\tdeploymentId: Id<'deployment'>,\n\t\t\t\tconfig: Partial<DeploymentConfig>,\n\t\t\t) {\n\t\t\t\tconst {deployment} = await client.patch(\n\t\t\t\t\t'/v1/ignite/deployments/:deployment_id',\n\t\t\t\t\tconfig,\n\t\t\t\t\t{deployment_id: deploymentId},\n\t\t\t\t);\n\n\t\t\t\treturn deployment;\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Get all containers for a deployment\n\t\t\t *\n\t\t\t * @param deployment - The ID of the deployment to get\n\t\t\t * @returns A list of all containers for that project\n\t\t\t */\n\t\t\tasync getContainers(deployment: Id<'deployment'>) {\n\t\t\t\tconst {containers} = await client.get(\n\t\t\t\t\t'/v1/ignite/deployments/:deployment_id/containers',\n\t\t\t\t\t{deployment_id: deployment},\n\t\t\t\t);\n\n\t\t\t\treturn containers;\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Gets all deployments for a project\n\t\t\t *\n\t\t\t * @param projectId - The project ID to list deployments for. You only need to provide this if you are using bearer or PAT authentication.\n\t\t\t * @returns A list of deployments for the given project.\n\t\t\t */\n\t\t\tasync getAll(projectId?: Id<'project'>) {\n\t\t\t\tif (client.authType !== 'ptk' && !projectId) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t'Project ID is required for Bearer or PAT authentication',\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif (client.authType === 'ptk' && projectId) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t'Project ID is not required for secret authentication',\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst {deployments, groups} = await client.get(\n\t\t\t\t\t'/v1/ignite/deployments',\n\t\t\t\t\tprojectId ? {project: projectId} : {},\n\t\t\t\t);\n\n\t\t\t\treturn {\n\t\t\t\t\tdeployments: deployments.map(Deployments.from),\n\t\t\t\t\tgroups,\n\t\t\t\t};\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Deletes a deployment\n\t\t\t *\n\t\t\t * @param deployment - The ID of the deployment\n\t\t\t */\n\t\t\tasync delete(deployment: Id<'deployment'>) {\n\t\t\t\tawait client.delete(\n\t\t\t\t\t'/v1/ignite/deployments/:deployment_id',\n\t\t\t\t\tundefined,\n\t\t\t\t\t{deployment_id: deployment},\n\t\t\t\t);\n\t\t\t},\n\n\t\t\tasync patchMetadata(\n\t\t\t\tdeploymentId: Id<'deployment'>,\n\t\t\t\tmetadata: Partial<DeploymentMetadata>,\n\t\t\t) {\n\t\t\t\tconst {deployment} = await client.patch(\n\t\t\t\t\t'/v1/ignite/deployments/:deployment_id/metadata',\n\t\t\t\t\tmetadata,\n\t\t\t\t\t{deployment_id: deploymentId},\n\t\t\t\t);\n\n\t\t\t\treturn deployment;\n\t\t\t},\n\t\t},\n\n\t\tcontainers: {\n\t\t\tdelete: deleteContainer,\n\n\t\t\t/**\n\t\t\t * Get the logs for a container\n\t\t\t *\n\t\t\t * @param container - The ID of the container\n\t\t\t * @returns\n\t\t\t */\n\t\t\tasync getLogs(\n\t\t\t\tcontainer: Id<'container'>,\n\t\t\t\toptions: Partial<{\n\t\t\t\t\tsortBy: 'timestamp';\n\t\t\t\t\torderBy: 'desc' | 'asc';\n\t\t\t\t\tlimit: number;\n\t\t\t\t\toffset: number;\n\t\t\t\t}> = {},\n\t\t\t) {\n\t\t\t\tconst {logs} = await client.get(\n\t\t\t\t\t'/v1/ignite/containers/:container_id/logs',\n\t\t\t\t\t{container_id: container, ...options},\n\t\t\t\t);\n\n\t\t\t\treturn logs;\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Stop a container\n\t\t\t * @param container - The ID of the container\n\t\t\t */\n\t\t\tasync stop(container: Id<'container'>) {\n\t\t\t\tawait updateContainerState(\n\t\t\t\t\tcontainer,\n\t\t\t\t\tAPI.Ignite.ContainerState.STOPPED,\n\t\t\t\t);\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Start a container\n\t\t\t * @param container - The ID of the container\n\t\t\t */\n\t\t\tasync start(container: Id<'container'>) {\n\t\t\t\tawait updateContainerState(\n\t\t\t\t\tcontainer,\n\t\t\t\t\tAPI.Ignite.ContainerState.RUNNING,\n\t\t\t\t);\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Creates a container\n\t\t\t *\n\t\t\t * @param deployment - The ID of a deployment to create a container in.\n\t\t\t * @returns The newly created container.\n\t\t\t */\n\t\t\tasync create(deployment: Id<'deployment'>) {\n\t\t\t\tconst {container} = await client.post(\n\t\t\t\t\t'/v1/ignite/deployments/:deployment_id/containers',\n\t\t\t\t\tundefined,\n\t\t\t\t\t{deployment_id: deployment},\n\t\t\t\t);\n\n\t\t\t\treturn container;\n\t\t\t},\n\t\t},\n\t};\n\n\treturn igniteSDK;\n});\n","/**\n * API parsable byte size units strings\n * @public\n */\nexport const byteUnits = ['GB', 'MB', 'KB', 'B'] as const;\n\n/**\n * Byte size unit type\n * @public\n */\nexport type ByteUnit = (typeof byteUnits)[number];\n\n/**\n * A string representing a byte size\n * @public\n */\nexport type ByteSizeString = `${number}${ByteUnit}`;\n\n/**\n * @deprecated Use {@link ByteSizeString} instead\n * @public\n */\nexport type ByteString = ByteSizeString;\n\n/**\n * Validates if a string is a valid byte size string\n * @param value - A string to validate if it is a valid byte size string\n * @returns If the string is a valid byte size string\n * @public\n */\nexport function isValidByteString(value: string): value is ByteSizeString {\n\treturn byteUnits.some(unit => {\n\t\tif (!value.endsWith(unit)) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn !isNaN(parseFloat(value.slice(0, -unit.length)));\n\t});\n}\n\nconst multipliers: Record<ByteUnit, number> = {\n\tB: 1,\n\tKB: 1024,\n\tMB: 1024 * 1024,\n\tGB: 1024 * 1024 * 1024,\n};\n\n/**\n * Helper function to converts a numerical size to a valid byte size string\n * @param size - A size to convert to a valid byte size string\n * @param unit - An optional unit to as the size unit. Defaults to B\n * @returns a byte size string\n * @public\n */\nexport function bytes(size: number, unit: ByteUnit = 'B'): ByteSizeString {\n\treturn `${size}${unit}`;\n}\n\n/**\n * Converts a kilobyte size to a byte size string\n * @param size - Kilobytes to convert to a byte size string\n * @returns a byte size string\n * @public\n */\nexport function kilobytes(size: number): ByteSizeString {\n\treturn bytes(size, 'KB');\n}\n\n/**\n * Converts a megabyte size to a byte size string\n * @param size - Megabytes to convert to a byte size string\n * @returns a byte size string\n * @public\n */\nexport function megabytes(size: number): ByteSizeString {\n\treturn bytes(size, 'MB');\n}\n\n/**\n * Converts a gigabyte size to a byte size string\n * @param size - Gigabytes to convert to a byte size string\n * @returns a byte size string\n * @public\n */\nexport function gigabytes(size: number): ByteSizeString {\n\treturn bytes(size, 'GB');\n}\n\n/**\n * Parses a byte size string into bytes\n * @param size - The size of anything in gigabytes, megabytes, kilobytes or bytes\n * @public\n */\nexport function parseSize(size: string) {\n\tsize = size.toUpperCase();\n\n\tconst unit = byteUnits.find(u => size.endsWith(u));\n\tif (!unit) {\n\t\tthrow new Error(`Invalid size: ${size}`);\n\t}\n\n\tconst num = parseFloat(size.slice(0, -unit.length));\n\tif (isNaN(num)) {\n\t\tthrow new Error(`Invalid size: ${size}`);\n\t}\n\n\treturn multipliers[unit] * num;\n}\n\n/**\n * @deprecated Use {@link byteUnits} instead\n * @public\n */\nexport const units = byteUnits;\n","import * as cryptoPonyfill from 'uncrypto';\n\nexport const HAS_NATIVE_CRYPTO = typeof globalThis.crypto !== 'undefined';\nexport const crypto = HAS_NATIVE_CRYPTO ? globalThis.crypto : cryptoPonyfill;\n","import type {Event} from '..';\nimport {crypto} from './crypto';\n\nexport const POSSIBLE_EVENTS = {\n\t// These are not yet implemented\n\t/* \tChannels: [\n\t\t{\n\t\t\tid: 'channel.created',\n\t\t\tname: 'Created',\n\t\t},\n\t\t{\n\t\t\tid: 'channel.updated',\n\t\t\tname: 'Updated',\n\t\t},\n\t\t{\n\t\t\tid: 'channel.deleted',\n\t\t\tname: 'Deleted',\n\t\t},\n\t\t{\n\t\t\tid: 'channel.client.connected',\n\t\t\tname: 'Client Connected',\n\t\t},\n\t\t{\n\t\t\tid: 'channel.client.disconnected',\n\t\t\tname: 'Client Disconnected',\n\t\t},\n\t], */\n\tIgnite: [\n\t\t{\n\t\t\tid: 'ignite.deployment.created',\n\t\t\tname: 'Deployment Created',\n\t\t},\n\t\t{\n\t\t\tid: 'ignite.deployment.updated',\n\t\t\tname: 'Deployment Updated',\n\t\t},\n\t\t{\n\t\t\tid: 'ignite.deployment.deleted',\n\t\t\tname: 'Deployment Deleted',\n\t\t},\n\t\t{\n\t\t\tid: 'ignite.deployment.build.created',\n\t\t\tname: 'Build Created',\n\t\t},\n\t\t{\n\t\t\tid: 'ignite.deployment.build.started',\n\t\t\tname: 'Build Started',\n\t\t},\n\t\t{\n\t\t\tid: 'ignite.deployment.build.updated',\n\t\t\tname: 'Build Updated',\n\t\t},\n\t\t{\n\t\t\tid: 'ignite.deployment.build.completed',\n\t\t\tname: 'Build Completed',\n\t\t},\n\t\t{\n\t\t\tid: 'ignite.deployment.build.failed',\n\t\t\tname: 'Build Failed',\n\t\t},\n\t\t{\n\t\t\tid: 'ignite.deployment.build.cancelled',\n\t\t\tname: 'Build Cancelled',\n\t\t},\n\t\t{\n\t\t\tid: 'ignite.deployment.rollout.created',\n\t\t\tname: 'Rollout Created',\n\t\t},\n\t\t{\n\t\t\tid: 'ignite.deployment.rollout.updated',\n\t\t\tname: 'Rollout Updated',\n\t\t},\n\t\t{\n\t\t\tid: 'ignite.deployment.container.created',\n\t\t\tname: 'Container Created',\n\t\t},\n\t\t{\n\t\t\tid: 'ignite.deployment.container.updated',\n\t\t\tname: 'Container Updated',\n\t\t},\n\t\t{\n\t\t\tid: 'ignite.deployment.container.metrics_update',\n\t\t\tname: 'Container Metrics Update',\n\t\t},\n\t\t{\n\t\t\tid: 'ignite.deployment.container.deleted',\n\t\t\tname: 'Container Deleted',\n\t\t},\n\t\t{\n\t\t\tid: 'ignite.deployment.healthcheck.created',\n\t\t\tname: 'Healthcheck Created',\n\t\t},\n\t\t{\n\t\t\tid: 'ignite.deployment.healthcheck.updated',\n\t\t\tname: 'Healthcheck Updated',\n\t\t},\n\t\t{\n\t\t\tid: 'ignite.deployment.healthcheck.deleted',\n\t\t\tname: 'Healthcheck Deleted',\n\t\t},\n\t\t{\n\t\t\tid: 'ignite.deployment.healthcheck.events.failed',\n\t\t\tname: 'Healthcheck Events Failed',\n\t\t},\n\t\t{\n\t\t\tid: 'ignite.deployment.healthcheck.events.succeeded',\n\t\t\tname: 'Healthcheck Events Succeeded',\n\t\t},\n\t\t{\n\t\t\tid: 'ignite.deployment.gateway.created',\n\t\t\tname: 'Gateway Created',\n\t\t},\n\t\t{\n\t\t\tid: 'ignite.deployment.gateway.updated',\n\t\t\tname: 'Gateway Updated',\n\t\t},\n\t\t{\n\t\t\tid: 'ignite.deployment.gateway.deleted',\n\t\t\tname: 'Gateway Deleted',\n\t\t},\n\t],\n\tProject: [\n\t\t{\n\t\t\tid: 'project.updated',\n\t\t\tname: 'Updated',\n\t\t},\n\t\t{\n\t\t\tid: 'project.member.created',\n\t\t\tname: 'Member Created',\n\t\t},\n\t\t{\n\t\t\tid: 'project.member.updated',\n\t\t\tname: 'Member Updated',\n\t\t},\n\t\t{\n\t\t\tid: 'project.member.deleted',\n\t\t\tname: 'Member Deleted',\n\t\t},\n\t\t{\n\t\t\tid: 'project.tokens.created',\n\t\t\tname: 'Token Created',\n\t\t},\n\t\t{\n\t\t\tid: 'project.tokens.deleted',\n\t\t\tname: 'Token Deleted',\n\t\t},\n\t\t{\n\t\t\tid: 'project.secrets.created',\n\t\t\tname: 'Secret Created',\n\t\t},\n\t\t{\n\t\t\tid: 'project.secrets.updated',\n\t\t\tname: 'Secret Updated',\n\t\t},\n\t\t{\n\t\t\tid: 'project.secrets.deleted',\n\t\t\tname: 'Secret Deleted',\n\t\t},\n\t\t{\n\t\t\tid: 'project.finance.transaction',\n\t\t\tname: 'Finance Transaction',\n\t\t},\n\t],\n} as const;\n\n// Todo: maybe add type-fest/readonly-deep to keep the as const but also keep a structure type\n\n/**\n * Utility function to verify hmac signatures\n *\n * @param body The stringed body received from the request\n * @param signature The signature from the X-Hop-Hooks-Signature\n * @param secret The secret provided upon webhook creation to verify the signature. (e.x: whsec_xxxxx)\n */\nexport async function verifyHmac(\n\tbody: string,\n\tsignature: string,\n\tsecret: string,\n) {\n\tconst encoder = new TextEncoder();\n\tconst encodedBody = encoder.encode(body);\n\n\tconst key = await crypto.subtle.importKey(\n\t\t'raw',\n\t\tencoder.encode(secret),\n\t\t{name: 'HMAC', hash: 'SHA-256'},\n\t\tfalse,\n\t\t['sign'],\n\t);\n\n\tconst signatureBuffer = await crypto.subtle.sign('HMAC', key, encodedBody);\n\n\tconst finalSig = Array.from(new Uint8Array(signatureBuffer))\n\t\t.map(byte => byte.toString(16).padStart(2, '0'))\n\t\t.join('');\n\n\treturn signature.toLowerCase() === finalSig;\n}\n\n/**\n * Utility function that returns a type-safe webhook event, throws if signature is invalid.\n *\n * @param body The stringed body received from the request\n * @param signature The signature from the X-Hop-Hooks-Signature\n * @param secret The secret provided upon webhook creation to verify the signature. (e.x: whsec_xxxxx)\n */\nexport async function constructEvent(\n\tbody: string,\n\tsignature: string,\n\tsecret: string,\n) {\n\tconst hmacVerified = await verifyHmac(body, signature, secret);\n\tif (!hmacVerified) {\n\t\tthrow new Error('Invalid signature');\n\t}\n\n\tconst event = JSON.parse(body) as Event;\n\treturn event;\n}\n","import {create} from '@onehop/json-methods';\nimport type {API, Id} from '../rest/index.ts';\nimport {Regions} from '../rest/types/ignite.ts';\nimport type {DeliveryProtocol} from '../rest/types/pipe.ts';\nimport {sdk} from './create.ts';\n\n/**\n * Pipe SDK client\n * @public\n */\nexport const pipe = sdk(client => {\n\tconst Rooms = create<API.Pipe.Room>().methods({\n\t\tasync delete() {\n\t\t\tawait pipeSDK.rooms.delete(this.id);\n\t\t},\n\t});\n\n\tconst pipeSDK = {\n\t\trooms: {\n\t\t\tasync getAll(project?: Id<'project'>) {\n\t\t\t\tif (!project && client.authType !== 'ptk') {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t'You must provide ID project id when using a bearer or pat token.',\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst {rooms} = await client.get('/v1/pipe/rooms', {project});\n\n\t\t\t\treturn rooms.map(Rooms.from);\n\t\t\t},\n\n\t\t\tasync create(\n\t\t\t\tname: string,\n\t\t\t\toptions: {\n\t\t\t\t\tdeliveryProtocols: DeliveryProtocol[];\n\t\t\t\t\tephemeral?: boolean;\n\t\t\t\t\tingestProtocol: 'rtmp' | 'rtp';\n\t\t\t\t\thlsConfig?: {\n\t\t\t\t\t\twcl_delay: number;\n\t\t\t\t\t\tartificial_delay: number;\n\t\t\t\t\t\tmax_playout_bitrate_preset: string;\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t) {\n\t\t\t\tconst {room} = await client.post(\n\t\t\t\t\t'/v1/pipe/rooms',\n\t\t\t\t\t{\n\t\t\t\t\t\tname,\n\n\t\t\t\t\t\tingest_protocol: options.ingestProtocol,\n\t\t\t\t\t\tregion: Regions.US_EAST_1,\n\n\t\t\t\t\t\tephemeral: options.ephemeral ?? false,\n\n\t\t\t\t\t\tdelivery_protocols: options.deliveryProtocols,\n\t\t\t\t\t\tllhls_config: options.hlsConfig,\n\t\t\t\t\t},\n\t\t\t\t\t{},\n\t\t\t\t);\n\n\t\t\t\treturn Rooms.from(room);\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Deletes a Pipe room\n\t\t\t *\n\t\t\t * @param room - The ID of the Pipe room to delete.\n\t\t\t */\n\t\t\tasync delete(room: Id<'pipe_room'>) {\n\t\t\t\tawait client.delete('/v1/pipe/rooms/:room_id', undefined, {\n\t\t\t\t\troom_id: room,\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t};\n\n\treturn pipeSDK;\n});\n","import {constructEvent} from '../index.ts';\nimport type {API, Endpoints, Id} from '../rest/index.ts';\nimport {Request} from '../util/fetch.ts';\nimport type {PossibleWebhookIDs} from '../util/types.ts';\nimport {sdk} from './create.ts';\n\n/**\n * Projects SDK client\n * @public\n */\nexport const projects = sdk(client => {\n\tconst tokens = {\n\t\t/**\n\t\t * Deletes a project token by its ID\n\t\t *\n\t\t * @param projectTokenId - The ID of the project token to delete\n\t\t */\n\t\tasync delete(projectTokenId: Id<'ptkid'>, project?: Id<'project'>) {\n\t\t\tif (client.authType !== 'ptk' && !project) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Project ID is required for bearer or PAT authentication to delete a project token',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tawait client.delete(\n\t\t\t\tproject\n\t\t\t\t\t? '/v1/projects/:project_id/tokens/:project_token_id'\n\t\t\t\t\t: '/v1/projects/@this/tokens/:project_token_id',\n\t\t\t\tundefined,\n\t\t\t\tproject\n\t\t\t\t\t? {project_id: project, project_token_id: projectTokenId}\n\t\t\t\t\t: {project_token_id: projectTokenId},\n\t\t\t);\n\t\t},\n\n\t\t/**\n\t\t * Get all project tokens for a project\n\t\t *\n\t\t * @param projectId - The project to fetch secrets for\n\t\t * @returns An array of all secrets for the project\n\t\t */\n\t\tasync get(projectId?: Id<'project'>) {\n\t\t\tif (client.authType !== 'ptk' && !projectId) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Project ID is required for bearer or PAT authentication',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (!projectId) {\n\t\t\t\tconst {project_tokens: keys} = await client.get(\n\t\t\t\t\t'/v1/projects/@this/tokens',\n\t\t\t\t\t{},\n\t\t\t\t);\n\n\t\t\t\treturn keys;\n\t\t\t}\n\n\t\t\tconst {project_tokens: keys} = await client.get(\n\t\t\t\t'/v1/projects/:project_id/tokens',\n\t\t\t\t{project_id: projectId},\n\t\t\t);\n\n\t\t\treturn keys;\n\t\t},\n\n\t\t/**\n\t\t * Creates a new project token\n\t\t *\n\t\t * @param projectId - The project to create a key for\n\t\t * @param flags - Permissions for this flag\n\t\t * @returns A newly created project token\n\t\t */\n\t\tasync create(flags: number, projectId?: Id<'project'>) {\n\t\t\tif (!projectId && client.authType !== 'ptk') {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Project ID is required for bearer or PAT authentication to create a project token',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (!projectId) {\n\t\t\t\tconst {project_token: token} = await client.post(\n\t\t\t\t\t'/v1/projects/@this/tokens',\n\t\t\t\t\t{flags},\n\t\t\t\t\t{},\n\t\t\t\t);\n\n\t\t\t\treturn token;\n\t\t\t}\n\n\t\t\tconst {project_token: token} = await client.post(\n\t\t\t\t'/v1/projects/:project_id/tokens',\n\t\t\t\t{flags},\n\t\t\t\t{project_id: projectId},\n\t\t\t);\n\n\t\t\treturn token;\n\t\t},\n\t};\n\n\tconst webhooks = {\n\t\tconstructEvent,\n\t\tasync getAll(projectId?: Id<'project'>) {\n\t\t\tif (client.authType !== 'ptk' && !projectId) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Project ID is required for bearer or PAT authentication to fetch all project members',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (projectId) {\n\t\t\t\tconst {webhooks} = await client.get(\n\t\t\t\t\t'/v1/projects/:project_id/webhooks',\n\t\t\t\t\t{\n\t\t\t\t\t\tproject_id: projectId,\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\treturn webhooks;\n\t\t\t}\n\n\t\t\tconst {webhooks} = await client.get('/v1/projects/@this/webhooks', {});\n\n\t\t\treturn webhooks;\n\t\t},\n\n\t\tasync create(\n\t\t\twebhook_url: string,\n\t\t\tevents: PossibleWebhookIDs[],\n\t\t\tprojectId?: Id<'project'>,\n\t\t) {\n\t\t\tif (client.authType !== 'ptk' && !projectId) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Project ID is required for bearer or PAT authentication to create a webhook',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (projectId) {\n\t\t\t\tconst {webhook} = await client.post(\n\t\t\t\t\t'/v1/projects/:project_id/webhooks',\n\t\t\t\t\t{\n\t\t\t\t\t\twebhook_url,\n\t\t\t\t\t\tevents,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tproject_id: projectId,\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\treturn webhook;\n\t\t\t}\n\n\t\t\tconst {webhook} = await client.post(\n\t\t\t\t'/v1/projects/@this/webhooks',\n\t\t\t\t{\n\t\t\t\t\twebhook_url,\n\t\t\t\t\tevents,\n\t\t\t\t},\n\t\t\t\t{},\n\t\t\t);\n\n\t\t\treturn webhook;\n\t\t},\n\n\t\tasync edit(\n\t\t\twebhookId: Id<'webhook'>,\n\t\t\t{\n\t\t\t\tevents,\n\t\t\t\twebhookUrl,\n\t\t\t}: {\n\t\t\t\twebhookUrl?: string | undefined;\n\t\t\t\tevents?: PossibleWebhookIDs[] | undefined;\n\t\t\t},\n\t\t\tprojectId?: Id<'project'>,\n\t\t) {\n\t\t\tif (client.authType !== 'ptk' && !projectId) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Project ID is required for bearer or PAT authentication to edit a webhook',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (projectId) {\n\t\t\t\tconst {webhook} = await client.patch(\n\t\t\t\t\t'/v1/projects/:project_id/webhooks/:webhook_id',\n\t\t\t\t\t{\n\t\t\t\t\t\twebhook_url: webhookUrl,\n\t\t\t\t\t\tevents,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tproject_id: projectId,\n\t\t\t\t\t\twebhook_id: webhookId,\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\treturn webhook;\n\t\t\t}\n\n\t\t\tconst {webhook} = await client.patch(\n\t\t\t\t'/v1/projects/@this/webhooks/:webhook_id',\n\t\t\t\t{\n\t\t\t\t\twebhook_url: webhookUrl,\n\t\t\t\t\tevents,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\twebhook_id: webhookId,\n\t\t\t\t},\n\t\t\t);\n\n\t\t\treturn webhook;\n\t\t},\n\n\t\tasync delete(webhookId: Id<'webhook'>, projectId?: Id<'project'>) {\n\t\t\tif (client.authType !== 'ptk' && !projectId) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Project ID is required for bearer or PAT authentication to delete a webhook',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (projectId) {\n\t\t\t\tawait client.delete(\n\t\t\t\t\t'/v1/projects/:project_id/webhooks/:webhook_id',\n\t\t\t\t\tundefined,\n\t\t\t\t\t{\n\t\t\t\t\t\tproject_id: projectId,\n\t\t\t\t\t\twebhook_id: webhookId,\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tawait client.delete(\n\t\t\t\t'/v1/projects/@this/webhooks/:webhook_id',\n\t\t\t\tundefined,\n\t\t\t\t{\n\t\t\t\t\twebhook_id: webhookId,\n\t\t\t\t},\n\t\t\t);\n\t\t},\n\n\t\tasync regenerateSecret(\n\t\t\twebhookId: Id<'webhook'>,\n\t\t\tprojectId?: Id<'project'>,\n\t\t) {\n\t\t\tif (client.authType !== 'ptk' && !projectId) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Project ID is required for bearer or PAT authentication to regenerate a webhook secret',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (projectId) {\n\t\t\t\tconst {secret} = await client.post(\n\t\t\t\t\t'/v1/projects/:project_id/webhooks/:webhook_id/regenerate',\n\t\t\t\t\tundefined,\n\t\t\t\t\t{\n\t\t\t\t\t\tproject_id: projectId,\n\t\t\t\t\t\twebhook_id: webhookId,\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\treturn secret;\n\t\t\t}\n\n\t\t\tconst {secret} = await client.post(\n\t\t\t\t'/v1/projects/@this/webhooks/:webhook_id/regenerate',\n\t\t\t\tundefined,\n\t\t\t\t{\n\t\t\t\t\twebhook_id: webhookId,\n\t\t\t\t},\n\t\t\t);\n\n\t\t\treturn secret;\n\t\t},\n\t};\n\n\tconst projectsSDK = {\n\t\tasync getAllMembers(projectId?: Id<'project'>) {\n\t\t\tif (client.authType !== 'ptk' && !projectId) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Project ID is required for bearer or PAT authentication to fetch all project members',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (projectId) {\n\t\t\t\tconst {members} = await client.get('/v1/projects/:project_id/members', {\n\t\t\t\t\tproject_id: projectId,\n\t\t\t\t});\n\n\t\t\t\treturn members;\n\t\t\t}\n\n\t\t\tconst {members} = await client.get('/v1/projects/@this/members', {});\n\n\t\t\treturn members;\n\t\t},\n\n\t\t/**\n\t\t * Fetch the currently authorized member from a project.\n\t\t * You cannot use this route if you are authorizing with a project token as there is no user attached to it.\n\t\t *\n\t\t * @param projectId - The project ID to fetch a member from\n\t\t * @returns The member authorized by the SDK\n\t\t */\n\t\tasync getCurrentMember(projectId: Id<'project'>) {\n\t\t\tif (client.authType === 'ptk') {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'You cannot resolve a member from a project token! You must use a bearer or pat token',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst {project_member: member} = await client.get(\n\t\t\t\t'/v1/projects/:project_id/members/@me',\n\t\t\t\t{project_id: projectId},\n\t\t\t);\n\n\t\t\treturn member;\n\t\t},\n\n\t\t/**\n\t\t * @deprecated Use {@link projectsSDK.tokens} instead\n\t\t */\n\t\tprojectTokens: tokens,\n\n\t\ttokens,\n\n\t\twebhooks,\n\n\t\tsecrets: {\n\t\t\t/**\n\t\t\t * Gets all secrets in a project\n\t\t\t *\n\t\t\t * @param projectId - The project to fetch secrets for\n\t\t\t */\n\t\t\tasync getAll(projectId?: Id<'project'>) {\n\t\t\t\tif (client.authType !== 'ptk' && !projectId) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t'Project ID is required for bearer or PAT authentication to fetch all secrets',\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif (!projectId) {\n\t\t\t\t\tconst {secrets} = await client.get('/v1/projects/@this/secrets', {});\n\n\t\t\t\t\treturn secrets;\n\t\t\t\t}\n\n\t\t\t\tconst {secrets} = await client.get('/v1/projects/:project_id/secrets', {\n\t\t\t\t\tproject_id: projectId,\n\t\t\t\t});\n\n\t\t\t\treturn secrets;\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Creates a new project secret\n\t\t\t *\n\t\t\t * @param name - The name of the secret\n\t\t\t * @param value - The value of the secret\n\t\t\t * @param projectId - The project to create the secret in\n\t\t\t */\n\t\t\tasync create(name: string, value: string, projectId?: Id<'project'>) {\n\t\t\t\tif (client.authType !== 'ptk' && !projectId) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t'Project ID is required for bearer or PAT authentication to create a secret',\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst url = client.url('/v1/projects/@this/secrets/:name', {\n\t\t\t\t\tname,\n\t\t\t\t\tproject: projectId,\n\t\t\t\t});\n\n\t\t\t\tconst request = new Request(url, {\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t'Content-Type': 'text/plain',\n\t\t\t\t\t},\n\t\t\t\t\tbody: value,\n\t\t\t\t\tmethod: 'PUT',\n\t\t\t\t});\n\n\t\t\t\tconst {secret} = await client.raw<\n\t\t\t\t\tExtract<\n\t\t\t\t\t\tEndpoints,\n\t\t\t\t\t\t{method: 'PUT'; path: '/v1/projects/@this/secrets/:name'}\n\t\t\t\t\t>['res']\n\t\t\t\t>(request);\n\n\t\t\t\treturn secret;\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Deletes a secret from a project\n\t\t\t *\n\t\t\t * @param id - The secret ID to delete\n\t\t\t * @param projectId - The project to delete the secret from\n\t\t\t */\n\t\t\tasync delete(\n\t\t\t\tid: Id<'secret'> | API.Projects.Secret['name'],\n\t\t\t\tprojectId?: Id<'project'>,\n\t\t\t) {\n\t\t\t\tif (client.authType !== 'ptk' && !projectId) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t'Project ID is required for bearer or PAT authentication to delete a secret',\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif (!projectId) {\n\t\t\t\t\tawait client.delete(\n\t\t\t\t\t\t'/v1/projects/@this/secrets/:secret_id',\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tsecret_id: id,\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tawait client.delete(\n\t\t\t\t\t'/v1/projects/:project_id/secrets/:secret_id',\n\t\t\t\t\tundefined,\n\t\t\t\t\t{secret_id: id, project_id: projectId},\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t};\n\n\treturn projectsSDK;\n});\n","import type {Id} from '../rest/index.ts';\nimport {sdk} from './create.ts';\n\n/**\n * Registry SDK client\n * @public\n */\nexport const registry = sdk(client => {\n\treturn {\n\t\timages: {\n\t\t\tasync getAll(project?: Id<'project'>) {\n\t\t\t\tif (!project && client.authType !== 'ptk') {\n\t\t\t\t\tthrow new Error('Project is required when using a PAT or bearer');\n\t\t\t\t}\n\n\t\t\t\tconst {images} = await client.get('/v1/registry/images', {\n\t\t\t\t\tproject,\n\t\t\t\t});\n\n\t\t\t\treturn images;\n\t\t\t},\n\n\t\t\tasync getManifest(image: string, project?: Id<'project'>) {\n\t\t\t\tif (!project && client.authType !== 'ptk') {\n\t\t\t\t\tthrow new Error('Project is required when using a PAT or bearer');\n\t\t\t\t}\n\n\t\t\t\tconst {manifests} = await client.get(\n\t\t\t\t\t'/v1/registry/images/:image/manifests',\n\t\t\t\t\t{image, project},\n\t\t\t\t);\n\n\t\t\t\treturn manifests;\n\t\t\t},\n\n\t\t\tasync delete(image: string, project?: Id<'project'>) {\n\t\t\t\tif (!project && client.authType !== 'ptk') {\n\t\t\t\t\tthrow new Error('Project is required when using a PAT or bearer');\n\t\t\t\t}\n\n\t\t\t\tawait client.delete('/v1/registry/images/:image', undefined, {\n\t\t\t\t\timage,\n\t\t\t\t\tproject,\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t};\n});\n","import type {Id} from '../util/types.ts';\nimport {sdk} from './create.ts';\n\n/**\n * Users SDK client\n * @public\n */\nexport const users = sdk(client => ({\n\tme: {\n\t\t/**\n\t\t * Gets the current user\n\t\t *\n\t\t * @returns The current user authorized by the SDK\n\t\t */\n\t\tasync get() {\n\t\t\tif (client.authType === 'ptk') {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'You cannot resolve a user from a project token! You must use a Bearer or PAT.',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst me = await client.get('/v1/users/@me', {});\n\n\t\t\treturn me;\n\t\t},\n\n\t\tpats: {\n\t\t\t/**\n\t\t\t * Creates a PAT for the current user\n\t\t\t *\n\t\t\t * @returns The created PAT\n\t\t\t */\n\t\t\tasync create(name: string) {\n\t\t\t\tif (client.authType === 'ptk') {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t'You cannot create a PAT from a project token! You must use a Bearer or PAT.',\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst {pat} = await client.post('/v1/users/@me/pats', {name}, {});\n\n\t\t\t\treturn pat;\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Fetches all PATs for this user\n\t\t\t *\n\t\t\t * @returns A list of all pats\n\t\t\t */\n\t\t\tasync getAll() {\n\t\t\t\tif (client.authType === 'ptk') {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t'You cannot get all PATs from a project token! You must use a Bearer or PAT.',\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst {pats} = await client.get('/v1/users/@me/pats', {});\n\n\t\t\t\treturn pats;\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Deletes a pat\n\t\t\t *\n\t\t\t * @param id - The ID of the pat to delete\n\t\t\t */\n\t\t\tasync delete(id: Id<'pat'>) {\n\t\t\t\tif (client.authType === 'ptk') {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t'You cannot delete a PAT from a project token! You must use a Bearer or PAT.',\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tawait client.delete(`/v1/users/@me/pats/:pat_id`, undefined, {\n\t\t\t\t\tpat_id: id,\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t},\n}));\n","import {create} from '@onehop/json-methods';\nimport type {FleetSchedulingState, Id, Node} from '..';\nimport {sdk} from './create';\n\nexport const fleet = sdk(client => {\n\tconst Nodes = create<Node>().methods({\n\t\tasync deleteNode() {\n\t\t\treturn await fleetSDK.deleteNode(this.id, this.project_id);\n\t\t},\n\n\t\tasync editNode(data: {schedulingState: FleetSchedulingState}) {\n\t\t\treturn await fleetSDK.editNode(this.id, data, this.project_id);\n\t\t},\n\n\t\tasync regenerateToken() {\n\t\t\treturn await fleetSDK.regenerateToken(this.id, this.project_id);\n\t\t},\n\t});\n\n\tconst fleetSDK = {\n\t\tasync getNodes(projectId?: Id<'project'>) {\n\t\t\tif (client.authType !== 'ptk' && !projectId) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Project ID is required for bearer or PAT authentication to get all fleet nodes.',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst {nodes} = await client.get('/v1/fleet/nodes', {\n\t\t\t\tproject: projectId,\n\t\t\t});\n\n\t\t\treturn nodes.map(n => Nodes.from(n));\n\t\t},\n\n\t\tasync createNode(\n\t\t\tname: string,\n\t\t\tschedulingState: FleetSchedulingState,\n\t\t\tprojectId?: Id<'project'>,\n\t\t) {\n\t\t\tif (client.authType !== 'ptk' && !projectId) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Project ID is required for bearer or PAT authentication to patch a fleet node.',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst {node, token} = await client.post(\n\t\t\t\t'/v1/fleet/nodes',\n\t\t\t\t{\n\t\t\t\t\tname,\n\t\t\t\t\tscheduling_state: schedulingState,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproject: projectId,\n\t\t\t\t},\n\t\t\t);\n\n\t\t\treturn {node: Nodes.from(node), token};\n\t\t},\n\n\t\tasync regenerateToken(nodeId: Id<'fleet_node'>, projectId: Id<'project'>) {\n\t\t\tconst {token} = await client.post(\n\t\t\t\t'/v1/fleet/nodes/:node_id/token',\n\t\t\t\tundefined,\n\t\t\t\t{\n\t\t\t\t\tnode_id: nodeId,\n\t\t\t\t\tproject: projectId,\n\t\t\t\t},\n\t\t\t);\n\n\t\t\treturn token;\n\t\t},\n\n\t\tasync editNode(\n\t\t\tnodeId: Id<'fleet_node'>,\n\t\t\tdata: {\n\t\t\t\tschedulingState: FleetSchedulingState;\n\t\t\t},\n\t\t\tprojectId?: Id<'project'>,\n\t\t) {\n\t\t\tif (client.authType !== 'ptk' && !projectId) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Project ID is required for bearer or PAT authentication to edit a fleet node.',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst {node} = await client.patch(\n\t\t\t\t'/v1/fleet/nodes/:node_id',\n\t\t\t\t{\n\t\t\t\t\tscheduling_state: data.schedulingState,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tnode_id: nodeId,\n\t\t\t\t\tproject: projectId,\n\t\t\t\t},\n\t\t\t);\n\n\t\t\treturn node;\n\t\t},\n\n\t\tasync deleteNode(nodeId: Id<'fleet_node'>, projectId?: Id<'project'>) {\n\t\t\tif (client.authType !== 'ptk' && !projectId) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Project ID is required for bearer or PAT authentication to delete a fleet node.',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tawait client.delete('/v1/fleet/nodes/:node_id', undefined, {\n\t\t\t\tnode_id: nodeId,\n\t\t\t\tproject: projectId,\n\t\t\t});\n\t\t},\n\t};\n\n\treturn fleetSDK;\n});\n","import {\n\ttype APIAuthentication,\n\tAPIClient,\n\ttype APIClientOptions,\n} from './rest/client.ts';\nimport {\n\tchannels,\n\tfleet,\n\tignite,\n\tpipe,\n\tprojects,\n\tregistry,\n\tusers,\n} from './sdks/index.ts';\nimport {DEFAULT_BASE_URL} from './util/constants.ts';\n\n/**\n * Partial options for the Hop client\n * @public\n */\nexport type PartialAPIOptions = Partial<\n\tOmit<APIClientOptions, 'authentication'>\n> &\n\tPick<APIClientOptions, 'authentication'>;\n\n/**\n * Root class containing all methods and types for interacting with the Hop platform.\n * This will be the entrypoint for most users of the Hop SDK.\n *\n * @public\n *\n * @example\n * ```ts\n * const hop = new Hop(bearerTokenOrPATOrProjectToken);\n * await hop.ignite.containers.create(deploymentId);\n * ```\n */\nexport class Hop {\n\tpublic readonly client: APIClient;\n\n\tpublic readonly ignite;\n\tpublic readonly users;\n\tpublic readonly projects;\n\tpublic readonly pipe;\n\tpublic readonly registry;\n\tpublic readonly channels;\n\tpublic readonly fleet;\n\n\tconstructor(options: PartialAPIOptions);\n\tconstructor(authentication: APIAuthentication, baseurl?: string);\n\n\tconstructor(\n\t\tauthenticationOrOptions: APIAuthentication | PartialAPIOptions,\n\t\tbaseUrl = DEFAULT_BASE_URL,\n\t) {\n\t\tif (\n\t\t\t!authenticationOrOptions ||\n\t\t\t(typeof authenticationOrOptions === 'object' &&\n\t\t\t\t!authenticationOrOptions.authentication)\n\t\t) {\n\t\t\tthrow new Error(\n\t\t\t\t'Missing authentication token to `new Hop()` — please provide a valid Project Token, User Bearer or Personal Access Token',\n\t\t\t);\n\t\t}\n\n\t\tthis.client = new APIClient(\n\t\t\ttypeof authenticationOrOptions === 'object'\n\t\t\t\t? {baseUrl: DEFAULT_BASE_URL, ...authenticationOrOptions}\n\t\t\t\t: {authentication: authenticationOrOptions, baseUrl},\n\t\t);\n\n\t\tthis.ignite = ignite(this.client);\n\t\tthis.users = users(this.client);\n\t\tthis.projects = projects(this.client);\n\t\tthis.pipe = pipe(this.client);\n\t\tthis.registry = registry(this.client);\n\t\tthis.channels = channels(this.client);\n\t\tthis.fleet = fleet(this.client);\n\t}\n}\n","/**\n * A list of all permissions and their representative names\n * @public\n */\nexport enum PROJECT_PERMISSION {\n\tADD_MEMBER = 'add_member',\n\tREMOVE_MEMBER = 'remove_member',\n\tGET_PROJECT_MEMBERS = 'get_project_members',\n\tDELETE_PROJECT = 'delete_project',\n\tDELETE_DEPLOYMENT = 'delete_deployment',\n\tDELETE_CONTAINER = 'delete_container',\n\tUPDATE_CONTAINER_STATE = 'update_container_state',\n\tREAD_DEPLOYMENTS = 'read_deployments',\n\tCREATE_DEPLOYMENT = 'create_deployment',\n\tCREATE_CONTAINER = 'create_container',\n\tUPDATE_CONTAINER_CONFIG = 'update_container_config',\n\tCREATE_ROOM = 'create_room',\n\tREAD_ROOM = 'read_room',\n\tDELETE_ROOM = 'delete_room',\n\tCREATE_ROOM_PRODUCER = 'create_room_producer',\n\tCREATE_PROJECT_TOKEN = 'create_project_token',\n\tDELETE_PROJECT_TOKEN = 'delete_project_token',\n\tREAD_PROJECT_TOKENS = 'read_project_tokens',\n\tREAD_CONTAINER_LOGS = 'read_container_logs',\n\tCREATE_PROJECT_SECRET = 'create_project_secret',\n\tREAD_PROJECT_SECRETS = 'read_project_secrets',\n\tDELETE_PROJECT_SECRET = 'delete_project_secret',\n\tGET_REGISTRY_IMAGES = 'get_registry_images',\n\tCREATE_CHANNEL = 'create_channel',\n\tCREATE_CHANNEL_TOKEN = 'create_channel_token',\n\tCREATE_LEAP_TOKEN = 'create_leap_token',\n\tCREATE_GATEWAY = 'create_gateway',\n\tADD_DOMAIN = 'add_domain',\n\tDELETE_CHANNELS = 'delete_channels',\n\tUPDATE_CHANNEL_STATE = 'update_channel_state',\n\tPUBLISH_CHANNEL_MESSAGES = 'publish_channel_messages',\n\tREAD_CHANNELS = 'read_channels',\n\tREAD_LEAP_TOKENS = 'read_leap_tokens',\n\tMANAGE_CHANNEL_SUBSCRIBERS = 'manage_channel_subscribers',\n\tUPDATE_LEAP_TOKEN = 'update_leap_token',\n\tDELETE_DOMAIN = 'delete_domain',\n\tDELETE_GATEWAY = 'delete_gateway',\n\tGET_INTERNAL_DOMAIN = 'get_internal_domain',\n\tMESSAGE_TOKEN = 'message_token',\n\tROLLOUT = 'rollout',\n\tREQUEST_QUOTA_INCREASE = 'request_quota_increase',\n\tREAD_BILLING = 'read_billing',\n\tREAD_GATEWAYS = 'read_gateways',\n\tDELETE_REGISTRY_IMAGES = 'delete_registry_images',\n\tCONTAINER_SSH = 'container_ssh',\n\tTUNNEL_DEPLOYMENT = 'tunnel_deployment',\n\tCREATE_WEBHOOK = 'create_webhook',\n\tDELETE_WEBHOOK = 'delete_webhook',\n\tUPDATE_WEBHOOK = 'update_webhook',\n\tREAD_WEBHOOKS = 'read_webhooks',\n}\n\n/**\n * Individual bitwise permissions\n * @public\n */\nexport const permissionsMap = {\n\t[PROJECT_PERMISSION.ADD_MEMBER]: 1n << 0n,\n\t[PROJECT_PERMISSION.REMOVE_MEMBER]: 1n << 1n,\n\t[PROJECT_PERMISSION.GET_PROJECT_MEMBERS]: 1n << 2n,\n\t[PROJECT_PERMISSION.DELETE_PROJECT]: 1n << 3n,\n\t[PROJECT_PERMISSION.DELETE_DEPLOYMENT]: 1n << 4n,\n\t[PROJECT_PERMISSION.DELETE_CONTAINER]: 1n << 5n,\n\t[PROJECT_PERMISSION.UPDATE_CONTAINER_STATE]: 1n << 6n,\n\t[PROJECT_PERMISSION.READ_DEPLOYMENTS]: 1n << 7n,\n\t[PROJECT_PERMISSION.CREATE_DEPLOYMENT]: 1n << 8n,\n\t[PROJECT_PERMISSION.CREATE_CONTAINER]: 1n << 9n,\n\t[PROJECT_PERMISSION.UPDATE_CONTAINER_CONFIG]: 1n << 10n,\n\t[PROJECT_PERMISSION.CREATE_ROOM]: 1n << 11n,\n\t[PROJECT_PERMISSION.READ_ROOM]: 1n << 12n,\n\t[PROJECT_PERMISSION.DELETE_ROOM]: 1n << 13n,\n\t[PROJECT_PERMISSION.CREATE_ROOM_PRODUCER]: 1n << 14n,\n\t[PROJECT_PERMISSION.CREATE_PROJECT_TOKEN]: 1n << 15n,\n\t[PROJECT_PERMISSION.DELETE_PROJECT_TOKEN]: 1n << 16n,\n\t[PROJECT_PERMISSION.READ_PROJECT_TOKENS]: 1n << 17n,\n\t[PROJECT_PERMISSION.READ_CONTAINER_LOGS]: 1n << 18n,\n\t[PROJECT_PERMISSION.CREATE_PROJECT_SECRET]: 1n << 19n,\n\t[PROJECT_PERMISSION.READ_PROJECT_SECRETS]: 1n << 20n,\n\t[PROJECT_PERMISSION.DELETE_PROJECT_SECRET]: 1n << 21n,\n\t[PROJECT_PERMISSION.GET_REGISTRY_IMAGES]: 1n << 22n,\n\t[PROJECT_PERMISSION.CREATE_CHANNEL_TOKEN]: 1n << 24n,\n\t[PROJECT_PERMISSION.CREATE_GATEWAY]: 1n << 25n,\n\t[PROJECT_PERMISSION.ADD_DOMAIN]: 1n << 26n,\n\t[PROJECT_PERMISSION.DELETE_CHANNELS]: 1n << 27n,\n\t[PROJECT_PERMISSION.UPDATE_CHANNEL_STATE]: 1n << 28n,\n\t[PROJECT_PERMISSION.READ_CHANNELS]: 1n << 29n,\n\t[PROJECT_PERMISSION.PUBLISH_CHANNEL_MESSAGES]: 1n << 30n,\n\t[PROJECT_PERMISSION.MANAGE_CHANNEL_SUBSCRIBERS]: 1n << 31n,\n\t[PROJECT_PERMISSION.DELETE_DOMAIN]: 1n << 32n,\n\t[PROJECT_PERMISSION.DELETE_GATEWAY]: 1n << 33n,\n\t[PROJECT_PERMISSION.GET_INTERNAL_DOMAIN]: 1n << 34n,\n\t[PROJECT_PERMISSION.CREATE_LEAP_TOKEN]: 1n << 35n,\n\t[PROJECT_PERMISSION.READ_LEAP_TOKENS]: 1n << 36n,\n\t[PROJECT_PERMISSION.UPDATE_LEAP_TOKEN]: 1n << 37n,\n\t[PROJECT_PERMISSION.MESSAGE_TOKEN]: 1n << 38n,\n\t[PROJECT_PERMISSION.CREATE_CHANNEL]: 1n << 39n,\n\t[PROJECT_PERMISSION.ROLLOUT]: 1n << 40n,\n\t[PROJECT_PERMISSION.REQUEST_QUOTA_INCREASE]: 1n << 41n,\n\t[PROJECT_PERMISSION.READ_BILLING]: 1n << 42n,\n\t[PROJECT_PERMISSION.READ_GATEWAYS]: 1n << 43n,\n\t[PROJECT_PERMISSION.DELETE_REGISTRY_IMAGES]: 1n << 44n,\n\t[PROJECT_PERMISSION.CONTAINER_SSH]: 1n << 45n,\n\t[PROJECT_PERMISSION.TUNNEL_DEPLOYMENT]: 1n << 46n,\n\t[PROJECT_PERMISSION.CREATE_WEBHOOK]: 1n << 47n,\n\t[PROJECT_PERMISSION.DELETE_WEBHOOK]: 1n << 48n,\n\t[PROJECT_PERMISSION.UPDATE_WEBHOOK]: 1n << 49n,\n\t[PROJECT_PERMISSION.READ_WEBHOOKS]: 1n << 50n,\n};\n\n/**\n * Broader permission map\n * @public\n */\nexport const BROAD_PERMISSIONS_MAP = {\n\tMANAGE_MEMBERS:\n\t\tpermissionsMap.add_member |\n\t\tpermissionsMap.remove_member |\n\t\tpermissionsMap.get_project_members,\n\tMANAGE_PROJECT_TOKENS:\n\t\tpermissionsMap.create_project_token |\n\t\tpermissionsMap.delete_project_token |\n\t\tpermissionsMap.read_project_tokens,\n\tMANAGE_DEPLOYMENTS:\n\t\tpermissionsMap.create_container |\n\t\tpermissionsMap.delete_container |\n\t\tpermissionsMap.update_container_state |\n\t\tpermissionsMap.read_container_logs |\n\t\tpermissionsMap.update_container_config |\n\t\tpermissionsMap.add_domain |\n\t\tpermissionsMap.delete_domain |\n\t\tpermissionsMap.create_deployment |\n\t\tpermissionsMap.delete_deployment |\n\t\tpermissionsMap.read_deployments |\n\t\tpermissionsMap.rollout |\n\t\tpermissionsMap.delete_gateway |\n\t\tpermissionsMap.get_internal_domain |\n\t\tpermissionsMap.container_ssh |\n\t\tpermissionsMap.read_gateways |\n\t\tpermissionsMap.tunnel_deployment,\n\tMANAGE_PIPE:\n\t\tpermissionsMap.create_room |\n\t\tpermissionsMap.delete_room |\n\t\tpermissionsMap.read_room,\n\tMANAGE_SECRETS:\n\t\tpermissionsMap.create_project_secret |\n\t\tpermissionsMap.delete_project_secret |\n\t\tpermissionsMap.read_project_secrets,\n\tMANAGE_CHANNELS:\n\t\tpermissionsMap.create_leap_token |\n\t\tpermissionsMap.create_channel_token |\n\t\tpermissionsMap.create_gateway |\n\t\tpermissionsMap.read_leap_tokens |\n\t\tpermissionsMap.update_leap_token |\n\t\tpermissionsMap.create_channel |\n\t\tpermissionsMap.delete_channels |\n\t\tpermissionsMap.update_channel_state |\n\t\tpermissionsMap.read_channels |\n\t\tpermissionsMap.publish_channel_messages |\n\t\tpermissionsMap.manage_channel_subscribers |\n\t\tpermissionsMap.message_token,\n\tMANAGE_REGISTRY:\n\t\tpermissionsMap.get_registry_images | permissionsMap.delete_registry_images,\n\tREAD_ONLY:\n\t\tpermissionsMap.read_deployments |\n\t\tpermissionsMap.read_container_logs |\n\t\tpermissionsMap.read_room |\n\t\tpermissionsMap.read_channels |\n\t\tpermissionsMap.read_project_tokens |\n\t\tpermissionsMap.read_project_secrets |\n\t\tpermissionsMap.read_leap_tokens |\n\t\tpermissionsMap.get_project_members |\n\t\tpermissionsMap.read_gateways,\n\tMANAGE_QUOTAS: permissionsMap.request_quota_increase,\n\tMANAGE_ROLLOUTS: permissionsMap.rollout,\n\tMANAGE_BILLING: permissionsMap.read_billing,\n\tMANAGE_WEBHOOKS:\n\t\tpermissionsMap.create_webhook |\n\t\tpermissionsMap.delete_webhook |\n\t\tpermissionsMap.update_webhook |\n\t\tpermissionsMap.read_webhooks,\n};\n\n/**\n * Bitwise role flags that a user can be as part of a project\n * @public\n */\nexport const roles = {\n\tviewer: BROAD_PERMISSIONS_MAP.READ_ONLY,\n\teditor:\n\t\tBROAD_PERMISSIONS_MAP.MANAGE_CHANNELS |\n\t\tBROAD_PERMISSIONS_MAP.MANAGE_DEPLOYMENTS |\n\t\tBROAD_PERMISSIONS_MAP.MANAGE_PIPE |\n\t\tBROAD_PERMISSIONS_MAP.MANAGE_SECRETS |\n\t\tBROAD_PERMISSIONS_MAP.MANAGE_REGISTRY |\n\t\tBROAD_PERMISSIONS_MAP.READ_ONLY |\n\t\tBROAD_PERMISSIONS_MAP.MANAGE_WEBHOOKS,\n\towner:\n\t\tBROAD_PERMISSIONS_MAP.MANAGE_CHANNELS |\n\t\tBROAD_PERMISSIONS_MAP.MANAGE_DEPLOYMENTS |\n\t\tBROAD_PERMISSIONS_MAP.MANAGE_MEMBERS |\n\t\tBROAD_PERMISSIONS_MAP.MANAGE_PIPE |\n\t\tBROAD_PERMISSIONS_MAP.MANAGE_PROJECT_TOKENS |\n\t\tBROAD_PERMISSIONS_MAP.MANAGE_SECRETS |\n\t\tBROAD_PERMISSIONS_MAP.MANAGE_REGISTRY |\n\t\tBROAD_PERMISSIONS_MAP.MANAGE_QUOTAS |\n\t\tBROAD_PERMISSIONS_MAP.MANAGE_ROLLOUTS |\n\t\tBROAD_PERMISSIONS_MAP.MANAGE_BILLING |\n\t\tBROAD_PERMISSIONS_MAP.MANAGE_WEBHOOKS,\n};\n\n/**\n * Permission utility functions\n * @public\n */\nexport const permissions = {\n\tadd(value: bigint, flag: bigint) {\n\t\treturn BigInt(value) | BigInt(flag);\n\t},\n\n\ttest(value: bigint, flag: bigint) {\n\t\treturn Boolean(BigInt(value) & BigInt(flag));\n\t},\n\n\tsubtract(value: bigint, flag: bigint) {\n\t\treturn BigInt(value) & ~BigInt(flag);\n\t},\n};\n","import type {Empty, Id, Timestamp} from '.';\nimport type {Endpoint} from '..';\n\n/**\n * Fleet scheduling state (schedulable/unschedulable)\n */\nexport enum FleetSchedulingState {\n\tSCHEDULABLE = 'schedulable',\n\tUNSCHEDULABLE = 'unschedulable',\n}\n\n/**\n * Fleet status (online/offline)\n */\nexport enum FleetStatus {\n\tONLINE = 'online',\n\tOFFLINE = 'offline',\n}\n\n/**\n * Fleet node\n */\nexport interface Node {\n\t/**\n\t * Node ID\n\t *\n\t * @example \"fleet_node_xxx\"\n\t */\n\tid: Id<'fleet_node'>;\n\t/**\n\t * Project ID containing the node\n\t *\n\t * @example \"project_xxx\"\n\t */\n\tproject_id: Id<'project'>;\n\t/**\n\t * Fleet group ID containing the node\n\t *\n\t * @example \"fleet_group_xxx\"\n\t */\n\tfleet_group: Id<'fleet_group'> | null;\n\t/**\n\t * Node name shown in the dashboard\n\t */\n\tname: string;\n\t/**\n\t * Scheduling state of the node (schedulable/unschedulable)\n\t */\n\tscheduling_state: FleetSchedulingState;\n\t/**\n\t * Status of the node (online/offline)\n\t */\n\tstatus: FleetStatus;\n\t/**\n\t * The last time the node sent a heartbeat (Used to determine if the node is alive)\n\t */\n\tlast_heartbeat: Timestamp;\n\t/**\n\t * Node metadata\n\t */\n\tmetadata: NodeMetadata | null;\n\n\t/**\n\t * Whether if the node is bootstrapped and initialized\n\t */\n\tbootstrapped: boolean;\n\n\t/**\n\t * When the node was created\n\t */\n\tcreated_at: Timestamp;\n}\n\nexport interface NodeMetadata {\n\t/**\n\t * The node's public IP addresses (includes IPv4 and IPv6)\n\t */\n\tpublic_ips: NodeIP[];\n\n\t/**\n\t * The country the node is located in\n\t */\n\tcountry: string;\n\n\t/**\n\t * The hostname of the node\n\t */\n\thostname: string;\n\n\t/**\n\t * The node's architecture\n\t *\n\t * @example \"x86_64\"\n\t */\n\tarch: string;\n\n\t/**\n\t * The node's operating system version\n\t */\n\tos: string;\n\n\t/**\n\t * The engine used to run deployments on the node\n\t *\n\t * @example \"podman\"\n\t */\n\tengine: 'podman';\n}\n\nexport interface NodeIP {\n\t/**\n\t * IP Address\n\t */\n\tip: string;\n\n\t/**\n\t * IP Address Type\n\t */\n\ttype: 'ipv4' | 'ipv6';\n}\n\nexport type TargetID = Id<'fleet_node'> | Id<'fleet_group'> | null;\n\nexport type FleetEndpoints =\n\t| Endpoint<'GET', '/v1/fleet/nodes', {nodes: Node[]}>\n\t| Endpoint<\n\t\t\t'POST',\n\t\t\t'/v1/fleet/nodes',\n\t\t\t{node: Node; token: string},\n\t\t\t{\n\t\t\t\tname: string;\n\t\t\t\tscheduling_state: FleetSchedulingState;\n\t\t\t}\n\t  >\n\t| Endpoint<'POST', '/v1/fleet/nodes/:node_id/token', {token: string}>\n\t| Endpoint<'DELETE', '/v1/fleet/nodes/:node_id', Empty>\n\t| Endpoint<\n\t\t\t'PATCH',\n\t\t\t'/v1/fleet/nodes/:node_id',\n\t\t\t{node: Node},\n\t\t\t{\n\t\t\t\tscheduling_state: FleetSchedulingState;\n\t\t\t}\n\t  >;\n"]}