{"version":3,"sources":["../src/util/constants.ts","../src/util/lists.ts","../src/util/types.ts","../src/rest/types/ignite.ts","../src/util/size.ts"],"names":["prefix","id","expectedPrefix","Regions","RuntimeType","ContainerState","RolloutState","RestartPolicy","VolumeFormat","BuildEnvironmentType","ContainerStrategy","BuildMethod","GatewayType","DomainState","BuildState"],"mappings":";0IASO,IAAM,iBAAmB,qBAMnB,WAAa,OAAO,OAAW,IAM/B,cAAgB,OAAO,KAAS,ICnBtC,SAAS,WAAW,KAAgB,KAAmC,CAC7E,OAAI,cACI,IAAI,KAAK,WAAW,QAAS,CAAC,IAAI,CAAC,EAAE,OAAO,IAAI,EAGjD,KAAK,KAAK,IAAI,CACtB,CCmDO,IAAM,YAAc,CAC1B,CACC,OAAQ,OACR,YAAa,OACd,EACA,CACC,OAAQ,UACR,YAAa,SACd,EACA,CACC,OAAQ,KACR,YAAa,iBACd,EACA,CACC,OAAQ,OACR,YAAa,OACd,EACA,CACC,OAAQ,KACR,YAAa,gBACd,EACA,CACC,OAAQ,MACR,YAAa,eACd,EACA,CACC,OAAQ,MACR,YAAa,4BACd,EACA,CACC,OAAQ,YACR,YAAa,kBACd,EACA,CACC,OAAQ,YACR,YAAa,WACd,EACA,CACC,OAAQ,aACR,YAAa,mBACd,EACA,CACC,OAAQ,SACR,YAAa,oBACd,EACA,CACC,OAAQ,QACR,YAAa,kBACd,EACA,CACC,OAAQ,SACR,YAAa,mBACd,EACA,CACC,OAAQ,UACR,YAAa,SACd,EACA,CACC,OAAQ,SACR,YAAa,sBACd,EACA,CACC,OAAQ,aACR,YAAa,0CACd,EACA,CACC,OAAQ,QACR,YAAa,yBACd,EACA,CACC,OAAQ,UACR,YAAa,0BACd,EACA,CACC,OAAQ,eACR,YAAa,oCACd,EACA,CACC,OAAQ,UACR,YAAa,0CACd,EACA,CACC,OAAQ,UACR,YAAa,uCACd,EACA,CACC,OAAQ,mBACR,YAAa,iCACd,EACA,CACC,OAAQ,cACR,YAAa,0BACd,EACA,CACC,OAAQ,QACR,YAAa,oDACd,EACA,CACC,OAAQ,aACR,YAAa,0BACd,CACD,EAoDO,SAAS,iBACf,OACA,OACc,CACd,OAAI,OACI,SAAW,OAGZ,YAAY,KAAK,CAAC,CAAC,OAAQ,CAAC,IAAM,IAAM,MAAM,CACtD,CAUO,SAAS,WACf,QACA,OACmB,CACnB,OAAI,MAAM,QAAQ,MAAM,EAChB,OAAO,KAAK,GAAK,WAAW,QAAS,CAAC,CAAC,EAG1C,QAIA,OAIE,QAAQ,WAAW,GAAG,SAAS,EAH9B,YAAY,KAAK,CAAC,CAAC,OAAAA,OAAM,IAAM,QAAQ,WAAW,GAAGA,UAAS,CAAC,EAJ/D,EAQT,CAUO,SAAS,YAAkCC,IAAY,OAAY,CACzE,GAAI,QAAU,CAAC,WAAWA,IAAI,MAAM,EACnC,MAAM,IAAI,MAAM,YAAYA,2BAA0B,QAAQ,EAG/D,GAAM,CAAC,MAAM,EAAIA,IAAG,MAAM,GAAG,EAE7B,GAAI,CAAC,QAAU,CAAC,iBAAiB,OAAQ,MAAM,EAAG,CACjD,IAAM,QAAU,OACb,YAAYA,wCAAuC,YACnD,YAAYA,wCAAuC,YAEtD,MAAM,IAAI,MAAM,OAAO,EAGxB,OAAO,MACR,CAWO,SAAS,GACf,QACA,OACQ,CACR,gBAAS,QAAS,MAAM,EACjB,OACR,CASO,SAAS,SACf,QACA,OACA,QAC2B,CAC3B,IAAM,eACL,SAAW,OACR,eACA,MAAM,QAAQ,MAAM,EACpB,WAAW,OAAQ,aAAa,EAChC,OAEJ,GAAI,CAAC,QACJ,MAAM,IAAI,MACT,SACC,yDAAyD,8BAA8B,UACzF,EAGD,GAAI,CAAC,WAAW,QAAS,MAAM,EAAG,CACjC,IAAMC,gBACL,SAAW,OACR,OACA,MAAM,QAAQ,MAAM,EACpB,WAAW,OAAQ,aAAa,EAChC,OAEJ,MAAM,IAAI,MACT,SAAW,eAAe,uBAAuBA,oBAClD,EAEF,CC3UA,maAgBO,IAAK,SAAAC,WACXA,SAAA,UAAY,YADDA,WAAA,aAQA,aAAAC,eAIXA,aAAA,UAAY,YAKZA,aAAA,WAAa,aAKbA,aAAA,SAAW,WAdAA,eAAA,iBAqBA,gBAAAC,kBAIXA,gBAAA,QAAU,UAKVA,gBAAA,QAAU,UAKVA,gBAAA,QAAU,UAKVA,gBAAA,OAAS,SAKTA,gBAAA,YAAc,cAKdA,gBAAA,OAAS,SA7BEA,kBAAA,oBAoCA,cAAAC,gBACXA,cAAA,QAAU,UACVA,cAAA,SAAW,WACXA,cAAA,OAAS,SAHEA,gBAAA,kBAUA,eAAAC,iBACXA,eAAA,MAAQ,QACRA,eAAA,OAAS,SACTA,eAAA,WAAa,aAHFA,iBAAA,mBAUA,cAAAC,gBACXA,cAAA,KAAO,OACPA,cAAA,IAAM,MAFKA,gBAAA,kBA4TA,sBAAAC,wBACXA,sBAAA,SAAW,WACXA,sBAAA,WAAa,aAFFA,wBAAA,0BAgPA,mBAAAC,qBAIXA,mBAAA,OAAS,SAJEA,qBAAA,uBAkMA,aAAAC,eACXA,aAAA,OAAS,SACTA,aAAA,IAAM,MAFKA,eAAA,iBASA,aAAAC,eAIXA,aAAA,SAAW,WAKXA,aAAA,SAAW,WATAA,eAAA,iBA+EA,aAAAC,eACXA,aAAA,QAAU,UACVA,aAAA,YAAc,cACdA,aAAA,WAAa,aAHFA,eAAA,iBAUA,YAAAC,cACXA,YAAA,WAAa,aACbA,YAAA,QAAU,UACVA,YAAA,OAAS,SACTA,YAAA,UAAY,YACZA,YAAA,UAAY,YACZA,YAAA,kBAAoB,oBANTA,cAAA,gBCj7BL,IAAM,UAAY,CAAC,KAAM,KAAM,KAAM,GAAG,EA0BxC,SAAS,kBAAkB,MAAwC,CACzE,OAAO,UAAU,KAAK,MAChB,MAAM,SAAS,IAAI,EAIjB,CAAC,MAAM,WAAW,MAAM,MAAM,EAAG,CAAC,KAAK,MAAM,CAAC,CAAC,EAH9C,EAIR,CACF,CAEA,IAAM,YAAwC,CAC7C,EAAG,EACH,GAAI,KACJ,GAAI,KAAO,KACX,GAAI,KAAO,KAAO,IACnB,EASO,SAAS,MAAM,KAAc,KAAiB,IAAqB,CACzE,MAAO,GAAG,OAAO,MAClB,CAQO,SAAS,UAAU,KAA8B,CACvD,OAAO,MAAM,KAAM,IAAI,CACxB,CAQO,SAAS,UAAU,KAA8B,CACvD,OAAO,MAAM,KAAM,IAAI,CACxB,CAQO,SAAS,UAAU,KAA8B,CACvD,OAAO,MAAM,KAAM,IAAI,CACxB,CAOO,SAAS,UAAU,KAAc,CACvC,KAAO,KAAK,YAAY,EAExB,IAAM,KAAO,UAAU,KAAK,GAAK,KAAK,SAAS,CAAC,CAAC,EACjD,GAAI,CAAC,KACJ,MAAM,IAAI,MAAM,iBAAiB,MAAM,EAGxC,IAAM,IAAM,WAAW,KAAK,MAAM,EAAG,CAAC,KAAK,MAAM,CAAC,EAClD,GAAI,MAAM,GAAG,EACZ,MAAM,IAAI,MAAM,iBAAiB,MAAM,EAGxC,OAAO,YAAY,IAAI,EAAI,GAC5B,CAMO,IAAM,MAAQ","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 {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 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","/**\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"]}