From 603d7fc863b6d8b87bc3f66bae326b53fa525406 Mon Sep 17 00:00:00 2001 From: Justin Bennett Date: Mon, 24 Jul 2023 12:28:34 -0400 Subject: [PATCH 1/8] Progress in migrating to @msw/next --- client/msw-handlers.ts | 368 ++++---- generator/client/msw-handlers.ts | 67 +- package-lock.json | 1427 ++++++------------------------ package.json | 2 +- 4 files changed, 511 insertions(+), 1353 deletions(-) diff --git a/client/msw-handlers.ts b/client/msw-handlers.ts index a7d4b10..045a860 100644 --- a/client/msw-handlers.ts +++ b/client/msw-handlers.ts @@ -9,14 +9,13 @@ */ import { - compose, - context, - ResponseComposition, - ResponseTransformer, rest, - RestContext, RestHandler, - RestRequest, + HttpResponse, + StrictResponse, + delay as doDelay, + DefaultBodyType, + PathParams, } from "msw"; import type { SnakeCasedPropertiesDeep as Snakify } from "type-fest"; import { z, ZodSchema } from "zod"; @@ -24,7 +23,7 @@ import type * as Api from "./Api"; import { snakeify } from "./util"; import * as schema from "./validate"; -type HandlerResult = Json | ResponseTransformer>; +type HandlerResult = Json | StrictResponse>; type StatusCode = number; /** @@ -33,16 +32,15 @@ type StatusCode = number; * * @see https://mswjs.io/docs/basics/response-transformer#custom-transformer */ -export function json( +export function json( body: B, options: { status?: number; delay?: number } = {} -): ResponseTransformer { +): StrictResponse { const { status = 200, delay = 0 } = options; - return compose( - context.status(status), - context.json(body), - context.delay(delay) - ); + if (delay) { + doDelay(delay); + } + return HttpResponse.json(body, { status }); } // these are used for turning our nice JS-ified API types back into the original @@ -64,823 +62,817 @@ export type Json = Snakify>; export interface MSWHandlers { /** `POST /device/auth` */ - deviceAuthRequest: (params: { req: RestRequest }) => StatusCode; + deviceAuthRequest: (params: { req: Request }) => StatusCode; /** `POST /device/confirm` */ deviceAuthConfirm: (params: { body: Json; - req: RestRequest; + req: Request; }) => StatusCode; /** `POST /device/token` */ - deviceAccessToken: (params: { req: RestRequest }) => StatusCode; + deviceAccessToken: (params: { req: Request }) => StatusCode; /** `POST /login/:siloName/saml/:providerName` */ loginSaml: (params: { path: Api.LoginSamlPathParams; - req: RestRequest; + req: Request; }) => StatusCode; /** `GET /v1/certificates` */ certificateList: (params: { query: Api.CertificateListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/certificates` */ certificateCreate: (params: { body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/certificates/:certificate` */ certificateView: (params: { path: Api.CertificateViewPathParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `DELETE /v1/certificates/:certificate` */ certificateDelete: (params: { path: Api.CertificateDeletePathParams; - req: RestRequest; + req: Request; }) => StatusCode; /** `GET /v1/disks` */ diskList: (params: { query: Api.DiskListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/disks` */ diskCreate: (params: { query: Api.DiskCreateQueryParams; body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/disks/:disk` */ diskView: (params: { path: Api.DiskViewPathParams; query: Api.DiskViewQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `DELETE /v1/disks/:disk` */ diskDelete: (params: { path: Api.DiskDeletePathParams; query: Api.DiskDeleteQueryParams; - req: RestRequest; + req: Request; }) => StatusCode; /** `POST /v1/disks/:disk/bulk-write` */ diskBulkWriteImport: (params: { path: Api.DiskBulkWriteImportPathParams; query: Api.DiskBulkWriteImportQueryParams; body: Json; - req: RestRequest; + req: Request; }) => StatusCode; /** `POST /v1/disks/:disk/bulk-write-start` */ diskBulkWriteImportStart: (params: { path: Api.DiskBulkWriteImportStartPathParams; query: Api.DiskBulkWriteImportStartQueryParams; - req: RestRequest; + req: Request; }) => StatusCode; /** `POST /v1/disks/:disk/bulk-write-stop` */ diskBulkWriteImportStop: (params: { path: Api.DiskBulkWriteImportStopPathParams; query: Api.DiskBulkWriteImportStopQueryParams; - req: RestRequest; + req: Request; }) => StatusCode; /** `POST /v1/disks/:disk/finalize` */ diskFinalizeImport: (params: { path: Api.DiskFinalizeImportPathParams; query: Api.DiskFinalizeImportQueryParams; body: Json; - req: RestRequest; + req: Request; }) => StatusCode; /** `POST /v1/disks/:disk/import` */ diskImportBlocksFromUrl: (params: { path: Api.DiskImportBlocksFromUrlPathParams; query: Api.DiskImportBlocksFromUrlQueryParams; body: Json; - req: RestRequest; + req: Request; }) => StatusCode; /** `GET /v1/disks/:disk/metrics/:metric` */ diskMetricsList: (params: { path: Api.DiskMetricsListPathParams; query: Api.DiskMetricsListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/groups` */ groupList: (params: { query: Api.GroupListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/groups/:groupId` */ groupView: (params: { path: Api.GroupViewPathParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/images` */ imageList: (params: { query: Api.ImageListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/images` */ imageCreate: (params: { query: Api.ImageCreateQueryParams; body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/images/:image` */ imageView: (params: { path: Api.ImageViewPathParams; query: Api.ImageViewQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `DELETE /v1/images/:image` */ imageDelete: (params: { path: Api.ImageDeletePathParams; query: Api.ImageDeleteQueryParams; - req: RestRequest; + req: Request; }) => StatusCode; /** `POST /v1/images/:image/demote` */ imageDemote: (params: { path: Api.ImageDemotePathParams; query: Api.ImageDemoteQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/images/:image/promote` */ imagePromote: (params: { path: Api.ImagePromotePathParams; query: Api.ImagePromoteQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/instances` */ instanceList: (params: { query: Api.InstanceListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/instances` */ instanceCreate: (params: { query: Api.InstanceCreateQueryParams; body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/instances/:instance` */ instanceView: (params: { path: Api.InstanceViewPathParams; query: Api.InstanceViewQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `DELETE /v1/instances/:instance` */ instanceDelete: (params: { path: Api.InstanceDeletePathParams; query: Api.InstanceDeleteQueryParams; - req: RestRequest; + req: Request; }) => StatusCode; /** `GET /v1/instances/:instance/disks` */ instanceDiskList: (params: { path: Api.InstanceDiskListPathParams; query: Api.InstanceDiskListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/instances/:instance/disks/attach` */ instanceDiskAttach: (params: { path: Api.InstanceDiskAttachPathParams; query: Api.InstanceDiskAttachQueryParams; body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/instances/:instance/disks/detach` */ instanceDiskDetach: (params: { path: Api.InstanceDiskDetachPathParams; query: Api.InstanceDiskDetachQueryParams; body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/instances/:instance/external-ips` */ instanceExternalIpList: (params: { path: Api.InstanceExternalIpListPathParams; query: Api.InstanceExternalIpListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/instances/:instance/migrate` */ instanceMigrate: (params: { path: Api.InstanceMigratePathParams; query: Api.InstanceMigrateQueryParams; body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/instances/:instance/reboot` */ instanceReboot: (params: { path: Api.InstanceRebootPathParams; query: Api.InstanceRebootQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/instances/:instance/serial-console` */ instanceSerialConsole: (params: { path: Api.InstanceSerialConsolePathParams; query: Api.InstanceSerialConsoleQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/instances/:instance/serial-console/stream` */ instanceSerialConsoleStream: (params: { path: Api.InstanceSerialConsoleStreamPathParams; query: Api.InstanceSerialConsoleStreamQueryParams; - req: RestRequest; + req: Request; }) => StatusCode; /** `POST /v1/instances/:instance/start` */ instanceStart: (params: { path: Api.InstanceStartPathParams; query: Api.InstanceStartQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/instances/:instance/stop` */ instanceStop: (params: { path: Api.InstanceStopPathParams; query: Api.InstanceStopQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/ip-pools` */ projectIpPoolList: (params: { query: Api.ProjectIpPoolListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/ip-pools/:pool` */ projectIpPoolView: (params: { path: Api.ProjectIpPoolViewPathParams; query: Api.ProjectIpPoolViewQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/login/:siloName/local` */ loginLocal: (params: { path: Api.LoginLocalPathParams; body: Json; - req: RestRequest; + req: Request; }) => StatusCode; /** `POST /v1/logout` */ - logout: (params: { req: RestRequest }) => StatusCode; + logout: (params: { req: Request }) => StatusCode; /** `GET /v1/me` */ - currentUserView: (params: { - req: RestRequest; - }) => HandlerResult; + currentUserView: (params: { req: Request }) => HandlerResult; /** `GET /v1/me/groups` */ currentUserGroups: (params: { query: Api.CurrentUserGroupsQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/me/ssh-keys` */ currentUserSshKeyList: (params: { query: Api.CurrentUserSshKeyListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/me/ssh-keys` */ currentUserSshKeyCreate: (params: { body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/me/ssh-keys/:sshKey` */ currentUserSshKeyView: (params: { path: Api.CurrentUserSshKeyViewPathParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `DELETE /v1/me/ssh-keys/:sshKey` */ currentUserSshKeyDelete: (params: { path: Api.CurrentUserSshKeyDeletePathParams; - req: RestRequest; + req: Request; }) => StatusCode; /** `GET /v1/metrics/:metricName` */ siloMetric: (params: { path: Api.SiloMetricPathParams; query: Api.SiloMetricQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/network-interfaces` */ instanceNetworkInterfaceList: (params: { query: Api.InstanceNetworkInterfaceListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/network-interfaces` */ instanceNetworkInterfaceCreate: (params: { query: Api.InstanceNetworkInterfaceCreateQueryParams; body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/network-interfaces/:interface` */ instanceNetworkInterfaceView: (params: { path: Api.InstanceNetworkInterfaceViewPathParams; query: Api.InstanceNetworkInterfaceViewQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `PUT /v1/network-interfaces/:interface` */ instanceNetworkInterfaceUpdate: (params: { path: Api.InstanceNetworkInterfaceUpdatePathParams; query: Api.InstanceNetworkInterfaceUpdateQueryParams; body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `DELETE /v1/network-interfaces/:interface` */ instanceNetworkInterfaceDelete: (params: { path: Api.InstanceNetworkInterfaceDeletePathParams; query: Api.InstanceNetworkInterfaceDeleteQueryParams; - req: RestRequest; + req: Request; }) => StatusCode; /** `GET /v1/policy` */ - policyView: (params: { - req: RestRequest; - }) => HandlerResult; + policyView: (params: { req: Request }) => HandlerResult; /** `PUT /v1/policy` */ policyUpdate: (params: { body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/projects` */ projectList: (params: { query: Api.ProjectListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/projects` */ projectCreate: (params: { body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/projects/:project` */ projectView: (params: { path: Api.ProjectViewPathParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `PUT /v1/projects/:project` */ projectUpdate: (params: { path: Api.ProjectUpdatePathParams; body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `DELETE /v1/projects/:project` */ projectDelete: (params: { path: Api.ProjectDeletePathParams; - req: RestRequest; + req: Request; }) => StatusCode; /** `GET /v1/projects/:project/policy` */ projectPolicyView: (params: { path: Api.ProjectPolicyViewPathParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `PUT /v1/projects/:project/policy` */ projectPolicyUpdate: (params: { path: Api.ProjectPolicyUpdatePathParams; body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/snapshots` */ snapshotList: (params: { query: Api.SnapshotListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/snapshots` */ snapshotCreate: (params: { query: Api.SnapshotCreateQueryParams; body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/snapshots/:snapshot` */ snapshotView: (params: { path: Api.SnapshotViewPathParams; query: Api.SnapshotViewQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `DELETE /v1/snapshots/:snapshot` */ snapshotDelete: (params: { path: Api.SnapshotDeletePathParams; query: Api.SnapshotDeleteQueryParams; - req: RestRequest; + req: Request; }) => StatusCode; /** `GET /v1/system/hardware/disks` */ physicalDiskList: (params: { query: Api.PhysicalDiskListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/system/hardware/racks` */ rackList: (params: { query: Api.RackListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/system/hardware/racks/:rackId` */ rackView: (params: { path: Api.RackViewPathParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/system/hardware/sleds` */ sledList: (params: { query: Api.SledListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/system/hardware/sleds/:sledId` */ sledView: (params: { path: Api.SledViewPathParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/system/hardware/sleds/:sledId/disks` */ sledPhysicalDiskList: (params: { path: Api.SledPhysicalDiskListPathParams; query: Api.SledPhysicalDiskListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/system/hardware/sleds/:sledId/instances` */ sledInstanceList: (params: { path: Api.SledInstanceListPathParams; query: Api.SledInstanceListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/system/hardware/switch-port` */ networkingSwitchPortList: (params: { query: Api.NetworkingSwitchPortListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/system/hardware/switch-port/:port/settings` */ networkingSwitchPortApplySettings: (params: { path: Api.NetworkingSwitchPortApplySettingsPathParams; query: Api.NetworkingSwitchPortApplySettingsQueryParams; body: Json; - req: RestRequest; + req: Request; }) => StatusCode; /** `DELETE /v1/system/hardware/switch-port/:port/settings` */ networkingSwitchPortClearSettings: (params: { path: Api.NetworkingSwitchPortClearSettingsPathParams; query: Api.NetworkingSwitchPortClearSettingsQueryParams; - req: RestRequest; + req: Request; }) => StatusCode; /** `GET /v1/system/hardware/switches` */ switchList: (params: { query: Api.SwitchListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/system/hardware/switches/:switchId` */ switchView: (params: { path: Api.SwitchViewPathParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/system/identity-providers` */ siloIdentityProviderList: (params: { query: Api.SiloIdentityProviderListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/system/identity-providers/local/users` */ localIdpUserCreate: (params: { query: Api.LocalIdpUserCreateQueryParams; body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `DELETE /v1/system/identity-providers/local/users/:userId` */ localIdpUserDelete: (params: { path: Api.LocalIdpUserDeletePathParams; query: Api.LocalIdpUserDeleteQueryParams; - req: RestRequest; + req: Request; }) => StatusCode; /** `POST /v1/system/identity-providers/local/users/:userId/set-password` */ localIdpUserSetPassword: (params: { path: Api.LocalIdpUserSetPasswordPathParams; query: Api.LocalIdpUserSetPasswordQueryParams; body: Json; - req: RestRequest; + req: Request; }) => StatusCode; /** `POST /v1/system/identity-providers/saml` */ samlIdentityProviderCreate: (params: { query: Api.SamlIdentityProviderCreateQueryParams; body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/system/identity-providers/saml/:provider` */ samlIdentityProviderView: (params: { path: Api.SamlIdentityProviderViewPathParams; query: Api.SamlIdentityProviderViewQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/system/ip-pools` */ ipPoolList: (params: { query: Api.IpPoolListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/system/ip-pools` */ ipPoolCreate: (params: { body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/system/ip-pools/:pool` */ ipPoolView: (params: { path: Api.IpPoolViewPathParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `PUT /v1/system/ip-pools/:pool` */ ipPoolUpdate: (params: { path: Api.IpPoolUpdatePathParams; body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `DELETE /v1/system/ip-pools/:pool` */ ipPoolDelete: (params: { path: Api.IpPoolDeletePathParams; - req: RestRequest; + req: Request; }) => StatusCode; /** `GET /v1/system/ip-pools/:pool/ranges` */ ipPoolRangeList: (params: { path: Api.IpPoolRangeListPathParams; query: Api.IpPoolRangeListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/system/ip-pools/:pool/ranges/add` */ ipPoolRangeAdd: (params: { path: Api.IpPoolRangeAddPathParams; body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/system/ip-pools/:pool/ranges/remove` */ ipPoolRangeRemove: (params: { path: Api.IpPoolRangeRemovePathParams; body: Json; - req: RestRequest; + req: Request; }) => StatusCode; /** `GET /v1/system/ip-pools-service` */ - ipPoolServiceView: (params: { - req: RestRequest; - }) => HandlerResult; + ipPoolServiceView: (params: { req: Request }) => HandlerResult; /** `GET /v1/system/ip-pools-service/ranges` */ ipPoolServiceRangeList: (params: { query: Api.IpPoolServiceRangeListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/system/ip-pools-service/ranges/add` */ ipPoolServiceRangeAdd: (params: { body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/system/ip-pools-service/ranges/remove` */ ipPoolServiceRangeRemove: (params: { body: Json; - req: RestRequest; + req: Request; }) => StatusCode; /** `GET /v1/system/metrics/:metricName` */ systemMetric: (params: { path: Api.SystemMetricPathParams; query: Api.SystemMetricQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/system/networking/address-lot` */ networkingAddressLotList: (params: { query: Api.NetworkingAddressLotListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/system/networking/address-lot` */ networkingAddressLotCreate: (params: { body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `DELETE /v1/system/networking/address-lot/:addressLot` */ networkingAddressLotDelete: (params: { path: Api.NetworkingAddressLotDeletePathParams; - req: RestRequest; + req: Request; }) => StatusCode; /** `GET /v1/system/networking/address-lot/:addressLot/blocks` */ networkingAddressLotBlockList: (params: { path: Api.NetworkingAddressLotBlockListPathParams; query: Api.NetworkingAddressLotBlockListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/system/networking/loopback-address` */ networkingLoopbackAddressList: (params: { query: Api.NetworkingLoopbackAddressListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/system/networking/loopback-address` */ networkingLoopbackAddressCreate: (params: { body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `DELETE /v1/system/networking/loopback-address/:rackId/:switchLocation/:address/:subnetMask` */ networkingLoopbackAddressDelete: (params: { path: Api.NetworkingLoopbackAddressDeletePathParams; - req: RestRequest; + req: Request; }) => StatusCode; /** `GET /v1/system/networking/switch-port-settings` */ networkingSwitchPortSettingsList: (params: { query: Api.NetworkingSwitchPortSettingsListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/system/networking/switch-port-settings` */ networkingSwitchPortSettingsCreate: (params: { body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `DELETE /v1/system/networking/switch-port-settings` */ networkingSwitchPortSettingsDelete: (params: { query: Api.NetworkingSwitchPortSettingsDeleteQueryParams; - req: RestRequest; + req: Request; }) => StatusCode; /** `GET /v1/system/networking/switch-port-settings/:port` */ networkingSwitchPortSettingsView: (params: { path: Api.NetworkingSwitchPortSettingsViewPathParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/system/policy` */ systemPolicyView: (params: { - req: RestRequest; + req: Request; }) => HandlerResult; /** `PUT /v1/system/policy` */ systemPolicyUpdate: (params: { body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/system/roles` */ roleList: (params: { query: Api.RoleListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/system/roles/:roleName` */ roleView: (params: { path: Api.RoleViewPathParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/system/silos` */ siloList: (params: { query: Api.SiloListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/system/silos` */ siloCreate: (params: { body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/system/silos/:silo` */ siloView: (params: { path: Api.SiloViewPathParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `DELETE /v1/system/silos/:silo` */ siloDelete: (params: { path: Api.SiloDeletePathParams; - req: RestRequest; + req: Request; }) => StatusCode; /** `GET /v1/system/silos/:silo/policy` */ siloPolicyView: (params: { path: Api.SiloPolicyViewPathParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `PUT /v1/system/silos/:silo/policy` */ siloPolicyUpdate: (params: { path: Api.SiloPolicyUpdatePathParams; body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/system/users` */ siloUserList: (params: { query: Api.SiloUserListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/system/users/:userId` */ siloUserView: (params: { path: Api.SiloUserViewPathParams; query: Api.SiloUserViewQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/system/users-builtin` */ userBuiltinList: (params: { query: Api.UserBuiltinListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/system/users-builtin/:user` */ userBuiltinView: (params: { path: Api.UserBuiltinViewPathParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/users` */ userList: (params: { query: Api.UserListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/vpc-firewall-rules` */ vpcFirewallRulesView: (params: { query: Api.VpcFirewallRulesViewQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `PUT /v1/vpc-firewall-rules` */ vpcFirewallRulesUpdate: (params: { query: Api.VpcFirewallRulesUpdateQueryParams; body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/vpc-router-routes` */ vpcRouterRouteList: (params: { query: Api.VpcRouterRouteListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/vpc-router-routes` */ vpcRouterRouteCreate: (params: { query: Api.VpcRouterRouteCreateQueryParams; body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/vpc-router-routes/:route` */ vpcRouterRouteView: (params: { path: Api.VpcRouterRouteViewPathParams; query: Api.VpcRouterRouteViewQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `PUT /v1/vpc-router-routes/:route` */ vpcRouterRouteUpdate: (params: { path: Api.VpcRouterRouteUpdatePathParams; query: Api.VpcRouterRouteUpdateQueryParams; body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `DELETE /v1/vpc-router-routes/:route` */ vpcRouterRouteDelete: (params: { path: Api.VpcRouterRouteDeletePathParams; query: Api.VpcRouterRouteDeleteQueryParams; - req: RestRequest; + req: Request; }) => StatusCode; /** `GET /v1/vpc-routers` */ vpcRouterList: (params: { query: Api.VpcRouterListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/vpc-routers` */ vpcRouterCreate: (params: { query: Api.VpcRouterCreateQueryParams; body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/vpc-routers/:router` */ vpcRouterView: (params: { path: Api.VpcRouterViewPathParams; query: Api.VpcRouterViewQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `PUT /v1/vpc-routers/:router` */ vpcRouterUpdate: (params: { path: Api.VpcRouterUpdatePathParams; query: Api.VpcRouterUpdateQueryParams; body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `DELETE /v1/vpc-routers/:router` */ vpcRouterDelete: (params: { path: Api.VpcRouterDeletePathParams; query: Api.VpcRouterDeleteQueryParams; - req: RestRequest; + req: Request; }) => StatusCode; /** `GET /v1/vpc-subnets` */ vpcSubnetList: (params: { query: Api.VpcSubnetListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/vpc-subnets` */ vpcSubnetCreate: (params: { query: Api.VpcSubnetCreateQueryParams; body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/vpc-subnets/:subnet` */ vpcSubnetView: (params: { path: Api.VpcSubnetViewPathParams; query: Api.VpcSubnetViewQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `PUT /v1/vpc-subnets/:subnet` */ vpcSubnetUpdate: (params: { path: Api.VpcSubnetUpdatePathParams; query: Api.VpcSubnetUpdateQueryParams; body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `DELETE /v1/vpc-subnets/:subnet` */ vpcSubnetDelete: (params: { path: Api.VpcSubnetDeletePathParams; query: Api.VpcSubnetDeleteQueryParams; - req: RestRequest; + req: Request; }) => StatusCode; /** `GET /v1/vpc-subnets/:subnet/network-interfaces` */ vpcSubnetListNetworkInterfaces: (params: { path: Api.VpcSubnetListNetworkInterfacesPathParams; query: Api.VpcSubnetListNetworkInterfacesQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/vpcs` */ vpcList: (params: { query: Api.VpcListQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `POST /v1/vpcs` */ vpcCreate: (params: { query: Api.VpcCreateQueryParams; body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `GET /v1/vpcs/:vpc` */ vpcView: (params: { path: Api.VpcViewPathParams; query: Api.VpcViewQueryParams; - req: RestRequest; + req: Request; }) => HandlerResult; /** `PUT /v1/vpcs/:vpc` */ vpcUpdate: (params: { path: Api.VpcUpdatePathParams; query: Api.VpcUpdateQueryParams; body: Json; - req: RestRequest; + req: Request; }) => HandlerResult; /** `DELETE /v1/vpcs/:vpc` */ vpcDelete: (params: { path: Api.VpcDeletePathParams; query: Api.VpcDeleteQueryParams; - req: RestRequest; + req: Request; }) => StatusCode; } @@ -891,8 +883,12 @@ function validateBody(schema: S, body: unknown) { } return { bodyErr: json(result.error.issues, { status: 400 }) }; } -function validateParams(schema: S, req: RestRequest) { - const rawParams = new URLSearchParams(req.url.search); +function validateParams( + schema: S, + req: Request, + pathParams: PathParams +) { + const rawParams = new URLSearchParams(new URL(req.url).search); const params: [string, unknown][] = []; // Ensure numeric params like `limit` are parsed as numbers @@ -901,7 +897,7 @@ function validateParams(schema: S, req: RestRequest) { } const result = schema.safeParse({ - path: req.params, + path: pathParams, query: Object.fromEntries(params), }); @@ -922,18 +918,24 @@ const handler = paramSchema: ZodSchema | null, bodySchema: ZodSchema | null ) => - async (req: RestRequest, res: ResponseComposition, ctx: RestContext) => { + async ({ + request: req, + params: pathParams, + }: { + request: Request; + params: PathParams; + }) => { const { params, paramsErr } = paramSchema - ? validateParams(paramSchema, req) + ? validateParams(paramSchema, req, pathParams) : { params: {}, paramsErr: undefined }; - if (paramsErr) return res(paramsErr); + if (paramsErr) return json(paramsErr, { status: 400 }); const { path, query } = params; const { body, bodyErr } = bodySchema ? validateBody(bodySchema, await req.json()) : { body: undefined, bodyErr: undefined }; - if (bodyErr) return res(bodyErr); + if (bodyErr) return json(bodyErr, { status: 400 }); try { // TypeScript can't narrow the handler down because there's not an explicit relationship between the schema @@ -943,24 +945,24 @@ const handler = { path, query, body, req }, ]); if (typeof result === "number") { - return res(ctx.status(result)); + return new HttpResponse(null, { status: result }); } if (typeof result === "function") { - return res(result as ResponseTransformer); + return result(); } - return res(json(result)); + return json(result); } catch (thrown) { if (typeof thrown === "number") { - return res(ctx.status(thrown)); + return new HttpResponse(null, { status: thrown }); } if (typeof thrown === "function") { - return res(thrown as ResponseTransformer); + return thrown(); } if (typeof thrown === "string") { - return res(json({ message: thrown }, { status: 400 })); + return json({ message: thrown }, { status: 400 }); } console.error("Unexpected mock error", thrown); - return res(json({ message: "Unknown Server Error" }, { status: 500 })); + return json({ message: "Unknown Server Error" }, { status: 500 }); } }; diff --git a/generator/client/msw-handlers.ts b/generator/client/msw-handlers.ts index 35ebde7..f84506d 100644 --- a/generator/client/msw-handlers.ts +++ b/generator/client/msw-handlers.ts @@ -7,7 +7,6 @@ */ import type { OpenAPIV3 } from "openapi-types"; -import { OpenAPIV3 as O } from "openapi-types"; import { initIO } from "../io"; import { refToSchemaName } from "../schema/base"; import { snakeToCamel, snakeToPascal } from "../util"; @@ -36,14 +35,13 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) { w(` import { - compose, - context, - ResponseComposition, - ResponseTransformer, rest, - RestContext, RestHandler, - RestRequest, + HttpResponse, + StrictResponse, + delay as doDelay, + DefaultBodyType, + PathParams, } from "msw"; import type { SnakeCasedPropertiesDeep as Snakify } from "type-fest"; import { z, ZodSchema } from "zod"; @@ -51,7 +49,7 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) { import { snakeify } from "./util"; import * as schema from "./validate"; - type HandlerResult = Json | ResponseTransformer> + type HandlerResult = Json | StrictResponse>; type StatusCode = number /** @@ -60,12 +58,15 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) { * * @see https://mswjs.io/docs/basics/response-transformer#custom-transformer */ - export function json( + export function json( body: B, options: { status?: number; delay?: number } = {} - ): ResponseTransformer { - const { status = 200, delay = 0 } = options - return compose(context.status(status), context.json(body), context.delay(delay)) + ): StrictResponse { + const { status = 200, delay = 0 } = options; + if (delay) { + doDelay(delay); + } + return HttpResponse.json(body, { status }); } @@ -120,7 +121,7 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) { const queryParamsType = queryParams?.length ? `query: Api.${snakeToPascal(opId)}QueryParams,` : ""; - const params = `params: { ${pathParamsType} ${queryParamsType} ${body} req: RestRequest }`; + const params = `params: { ${pathParamsType} ${queryParamsType} ${body} req: Request }`; const resultType = successType === "void" ? "StatusCode" : `HandlerResult<${successType}>`; @@ -138,8 +139,8 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) { } return { bodyErr: json(result.error.issues, { status: 400 }) } } - function validateParams(schema: S, req: RestRequest) { - const rawParams = new URLSearchParams(req.url.search) + function validateParams(schema: S, req: Request, pathParams: PathParams) { + const rawParams = new URLSearchParams(new URL(req.url).search) const params: [string, unknown][] = [] // Ensure numeric params like \`limit\` are parsed as numbers @@ -148,7 +149,7 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) { } const result = schema.safeParse({ - path: req.params, + path: pathParams, query: Object.fromEntries(params), }) @@ -164,14 +165,24 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) { } const handler = (handler: MSWHandlers[keyof MSWHandlers], paramSchema: ZodSchema | null, bodySchema: ZodSchema | null) => - async (req: RestRequest, res: ResponseComposition, ctx: RestContext) => { - const { params, paramsErr } = paramSchema ? validateParams(paramSchema, req) : { params: {}, paramsErr: undefined } - if (paramsErr) return res(paramsErr) + async ({ + request: req, + params: pathParams, + }: { + request: Request; + params: PathParams; + }) => { + const { params, paramsErr } = paramSchema + ? validateParams(paramSchema, req, pathParams) + : { params: {}, paramsErr: undefined }; + if (paramsErr) return json(paramsErr, { status: 400 }); const { path, query } = params - const { body, bodyErr } = bodySchema ? validateBody(bodySchema, await req.json()) : { body: undefined, bodyErr: undefined } - if (bodyErr) return res(bodyErr) + const { body, bodyErr } = bodySchema + ? validateBody(bodySchema, await req.json()) + : { body: undefined, bodyErr: undefined }; + if (bodyErr) return json(bodyErr, { status: 400 }); try { // TypeScript can't narrow the handler down because there's not an explicit relationship between the schema @@ -179,24 +190,24 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) { // relevant schema is required if and only if the handler has a type that matches the inferred schema const result = await (handler as any).apply(null, [{path, query, body, req}]) if (typeof result === "number") { - return res(ctx.status(result)) + return new HttpResponse(null, { status: result }); } if (typeof result === "function") { - return res(result as ResponseTransformer) + return result(); } - return res(json(result)) + return json(result); } catch (thrown) { if (typeof thrown === 'number') { - return res(ctx.status(thrown)) + return new HttpResponse(null, { status: thrown }); } if (typeof thrown === "function") { - return res(thrown as ResponseTransformer) + return thrown(); } if (typeof thrown === "string") { - return res(json({ message: thrown }, { status: 400 })) + return json({ message: thrown }, { status: 400 }); } console.error('Unexpected mock error', thrown) - return res(json({ message: 'Unknown Server Error' }, { status: 500 })) + return json({ message: "Unknown Server Error" }, { status: 500 }); } } diff --git a/package-lock.json b/package-lock.json index 1f02e21..82c5f74 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "devDependencies": { "@types/node": "^18.7.20", "esbuild-register": "^3.3.3", - "msw": "^1.2.1", + "msw": "^0.0.0-fetch.rc-15", "openapi-types": "^12.0.2", "prettier": "2.7.1", "swagger-parser": "^10.0.3", @@ -70,6 +70,33 @@ "openapi-types": ">=7" } }, + "node_modules/@bundled-es-modules/cookie": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@bundled-es-modules/cookie/-/cookie-2.0.0.tgz", + "integrity": "sha512-Or6YHg/kamKHpxULAdSqhGqnWFneIXu1NKvvfBBzKGwpVsYuFIQ5aBPHDnnoR3ghW1nvSkALd+EF9iMtY7Vjxw==", + "dev": true, + "dependencies": { + "cookie": "^0.5.0" + } + }, + "node_modules/@bundled-es-modules/js-levenshtein": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@bundled-es-modules/js-levenshtein/-/js-levenshtein-2.0.1.tgz", + "integrity": "sha512-DERMS3yfbAljKsQc0U2wcqGKUWpdFjwqWuoMugEJlqBnKO180/n+4SR/J8MRDt1AN48X1ovgoD9KrdVXcaa3Rg==", + "dev": true, + "dependencies": { + "js-levenshtein": "^1.1.6" + } + }, + "node_modules/@bundled-es-modules/statuses": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@bundled-es-modules/statuses/-/statuses-1.0.1.tgz", + "integrity": "sha512-yn7BklA5acgcBr+7w064fGV+SGIFySjCKpqjcWgBAIfrAkY+4GQTJJHQMeT3V/sgz23VTEVV8TtOmkvJAhFVfg==", + "dev": true, + "dependencies": { + "statuses": "^2.0.1" + } + }, "node_modules/@esbuild/android-arm": { "version": "0.17.18", "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.18.tgz", @@ -434,35 +461,29 @@ "license": "MIT" }, "node_modules/@mswjs/cookies": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/@mswjs/cookies/-/cookies-0.2.2.tgz", - "integrity": "sha512-mlN83YSrcFgk7Dm1Mys40DLssI1KdJji2CMKN8eOlBqsTADYzj2+jWzsANsUTFbxDMWPD5e9bfA1RGqBpS3O1g==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@mswjs/cookies/-/cookies-1.0.0.tgz", + "integrity": "sha512-TdXoBdI+h/EDTsVLCX/34s4+9U0sWi92qFnIGUEikpMCSKLhBeujovyYVSoORNbYgsBH5ga7/tfxyWcEZAxiYA==", "dev": true, - "dependencies": { - "@types/set-cookie-parser": "^2.4.0", - "set-cookie-parser": "^2.4.6" - }, "engines": { "node": ">=14" } }, "node_modules/@mswjs/interceptors": { - "version": "0.17.6", - "resolved": "https://registry.npmjs.org/@mswjs/interceptors/-/interceptors-0.17.6.tgz", - "integrity": "sha512-201pBIWehTURb6q8Gheu4Zhvd3Ox1U4BJq5KiOQsYzkWyfiOG4pwcz5hPZIEryztgrf8/sdwABpvY757xMmfrQ==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@mswjs/interceptors/-/interceptors-0.23.0.tgz", + "integrity": "sha512-JytvDa7pBbxXvCTXBYQs+0eE6MqxpqH/H4peRNY6zVAlvJ6d/hAWLHAef1D9lWN4zuIigN0VkakGOAUrX7FWLg==", "dev": true, "dependencies": { - "@open-draft/until": "^1.0.3", - "@types/debug": "^4.1.7", - "@xmldom/xmldom": "^0.8.3", - "debug": "^4.3.3", + "@open-draft/deferred-promise": "^2.1.0", + "@open-draft/logger": "^0.3.0", + "@open-draft/until": "^2.0.0", "headers-polyfill": "^3.1.0", "outvariant": "^1.2.1", - "strict-event-emitter": "^0.2.4", - "web-encoding": "^1.1.5" + "strict-event-emitter": "^0.5.0" }, "engines": { - "node": ">=14" + "node": ">=18" } }, "node_modules/@nodelib/fs.scandir": { @@ -497,10 +518,26 @@ "node": ">= 8" } }, + "node_modules/@open-draft/deferred-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@open-draft/deferred-promise/-/deferred-promise-2.1.0.tgz", + "integrity": "sha512-Rzd5JrXZX8zErHzgcGyngh4fmEbSHqTETdGj9rXtejlqMIgXFlyKBA7Jn1Xp0Ls0M0Y22+xHcWiEzbmdWl0BOA==", + "dev": true + }, + "node_modules/@open-draft/logger": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@open-draft/logger/-/logger-0.3.0.tgz", + "integrity": "sha512-X2g45fzhxH238HKO4xbSr7+wBS8Fvw6ixhTDuvLd5mqh6bJJCFAPwU9mPDxbcrRtfxv4u5IHCEH77BmxvXmmxQ==", + "dev": true, + "dependencies": { + "is-node-process": "^1.2.0", + "outvariant": "^1.4.0" + } + }, "node_modules/@open-draft/until": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@open-draft/until/-/until-1.0.3.tgz", - "integrity": "sha512-Aq58f5HiWdyDlFffbbSjAlv596h/cOnt2DO1w3DOC7OJ5EHs0hd/nycJfiu9RJbT6Yk6F1knnRRXNSpxoIVZ9Q==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@open-draft/until/-/until-2.1.0.tgz", + "integrity": "sha512-U69T3ItWHvLwGg5eJ0n3I62nWuE6ilHlmz7zM0npLBRvPRd7e6NYmg54vvRtP5mZG7kZqZCFVdsTWo7BPtBujg==", "dev": true }, "node_modules/@tootallnate/once": { @@ -543,15 +580,6 @@ "integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==", "dev": true }, - "node_modules/@types/debug": { - "version": "4.1.7", - "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.7.tgz", - "integrity": "sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg==", - "dev": true, - "dependencies": { - "@types/ms": "*" - } - }, "node_modules/@types/form-data": { "version": "0.0.33", "dev": true, @@ -573,12 +601,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/ms": { - "version": "0.7.31", - "resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.31.tgz", - "integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==", - "dev": true - }, "node_modules/@types/node": { "version": "18.7.20", "dev": true, @@ -591,14 +613,11 @@ "optional": true, "peer": true }, - "node_modules/@types/set-cookie-parser": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/@types/set-cookie-parser/-/set-cookie-parser-2.4.2.tgz", - "integrity": "sha512-fBZgytwhYAUkj/jC/FAV4RQ5EerRup1YQsXQCh8rZfiHkc4UahC192oH0smGwsXol3cL3A5oETuAHeQHmhXM4w==", - "dev": true, - "dependencies": { - "@types/node": "*" - } + "node_modules/@types/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-vVRgv7WXbhIZzILgr58b4Ki2uqpN/dlVCUBWCMkPbMDlV1CrQrgCl5hnIoUlMrgymGcTmdfVqbs1yWj/IRIRtQ==", + "dev": true }, "node_modules/@vitest/expect": { "version": "0.32.2", @@ -669,22 +688,6 @@ "url": "https://opencollective.com/vitest" } }, - "node_modules/@xmldom/xmldom": { - "version": "0.8.7", - "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.7.tgz", - "integrity": "sha512-sI1Ly2cODlWStkINzqGrZ8K6n+MTSbAeQnAipGyL+KZCXuHaRlj2gyyy8B/9MvsFFqN7XHryQnB2QwhzvJXovg==", - "dev": true, - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/@zxing/text-encoding": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/@zxing/text-encoding/-/text-encoding-0.9.0.tgz", - "integrity": "sha512-U/4aVJ2mxI0aDNI8Uq0wEhMgY+u4CNtEb0om3+y3+niDAsoTCOB33UF0sxpzqzdqXLqmvc+vZyAt4O8pPdfkwA==", - "dev": true, - "optional": true - }, "node_modules/abab": { "version": "2.0.6", "dev": true, @@ -855,18 +858,6 @@ "optional": true, "peer": true }, - "node_modules/available-typed-arrays": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", - "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/balanced-match": { "version": "1.0.2", "dev": true, @@ -1016,6 +1007,8 @@ "version": "1.0.2", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "function-bind": "^1.1.1", "get-intrinsic": "^1.0.2" @@ -1055,9 +1048,9 @@ } }, "node_modules/chalk": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", - "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, "dependencies": { "ansi-styles": "^4.1.0", @@ -1247,9 +1240,9 @@ } }, "node_modules/cookie": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", - "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", + "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", "dev": true, "engines": { "node": ">= 0.6" @@ -1417,22 +1410,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/define-properties": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz", - "integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==", - "dev": true, - "dependencies": { - "has-property-descriptors": "^1.0.0", - "object-keys": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/delayed-stream": { "version": "1.0.0", "dev": true, @@ -1495,61 +1472,6 @@ "url": "https://github.com/fb55/entities?sponsor=1" } }, - "node_modules/es-abstract": { - "version": "1.20.4", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.4.tgz", - "integrity": "sha512-0UtvRN79eMe2L+UNEF1BwRe364sj/DXhQ/k5FmivgoSdpM90b8Jc0mDzKMGo7QS0BVbOP/bTwBKNnDc9rNzaPA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "function.prototype.name": "^1.1.5", - "get-intrinsic": "^1.1.3", - "get-symbol-description": "^1.0.0", - "has": "^1.0.3", - "has-property-descriptors": "^1.0.0", - "has-symbols": "^1.0.3", - "internal-slot": "^1.0.3", - "is-callable": "^1.2.7", - "is-negative-zero": "^2.0.2", - "is-regex": "^1.1.4", - "is-shared-array-buffer": "^1.0.2", - "is-string": "^1.0.7", - "is-weakref": "^1.0.2", - "object-inspect": "^1.12.2", - "object-keys": "^1.1.1", - "object.assign": "^4.1.4", - "regexp.prototype.flags": "^1.4.3", - "safe-regex-test": "^1.0.0", - "string.prototype.trimend": "^1.0.5", - "string.prototype.trimstart": "^1.0.5", - "unbox-primitive": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/es-to-primitive": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", - "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", - "dev": true, - "dependencies": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/esbuild": { "version": "0.17.18", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.18.tgz", @@ -1668,15 +1590,6 @@ "node": ">=0.10.0" } }, - "node_modules/events": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", - "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", - "dev": true, - "engines": { - "node": ">=0.8.x" - } - }, "node_modules/execa": { "version": "5.1.1", "dev": true, @@ -1787,15 +1700,6 @@ "node": ">=8" } }, - "node_modules/for-each": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", - "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", - "dev": true, - "dependencies": { - "is-callable": "^1.1.3" - } - }, "node_modules/form-data": { "version": "2.5.1", "dev": true, @@ -1811,6 +1715,19 @@ "node": ">= 0.12" } }, + "node_modules/formdata-node": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.4.1.tgz", + "integrity": "sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==", + "dev": true, + "dependencies": { + "node-domexception": "1.0.0", + "web-streams-polyfill": "4.0.0-beta.3" + }, + "engines": { + "node": ">= 12.20" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "dev": true, @@ -1833,34 +1750,9 @@ "node_modules/function-bind": { "version": "1.1.1", "dev": true, - "license": "MIT" - }, - "node_modules/function.prototype.name": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz", - "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.0", - "functions-have-names": "^1.2.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/functions-have-names": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", - "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/get-caller-file": { "version": "2.0.5", @@ -1884,6 +1776,8 @@ "version": "1.1.3", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "function-bind": "^1.1.1", "has": "^1.0.3", @@ -1914,22 +1808,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/get-symbol-description": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", - "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/glob": { "version": "7.1.6", "dev": true, @@ -1980,9 +1858,9 @@ } }, "node_modules/graphql": { - "version": "16.6.0", - "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.6.0.tgz", - "integrity": "sha512-KPIBPDlW7NxrbT/eh4qPXz5FiFdL5UbaA0XUNz2Rp3Z3hqBSkbj0GVjwFDztsWVauZUWsbKHgMg++sk8UX0bkw==", + "version": "16.7.1", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.7.1.tgz", + "integrity": "sha512-DRYR9tf+UGU0KOsMcKAlXeFfX89UiiIZ0dRU3mR0yJfu6OjZqUcp68NnFLnqQU5RexygFoDy1EW+ccOYcPfmHg==", "dev": true, "engines": { "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" @@ -2008,6 +1886,8 @@ "version": "1.0.3", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "function-bind": "^1.1.1" }, @@ -2015,15 +1895,6 @@ "node": ">= 0.4.0" } }, - "node_modules/has-bigints": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", - "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -2033,37 +1904,12 @@ "node": ">=8" } }, - "node_modules/has-property-descriptors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", - "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", - "dev": true, - "dependencies": { - "get-intrinsic": "^1.1.1" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/has-symbols": { "version": "1.0.3", "dev": true, "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-tostringtag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", - "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", - "dev": true, - "dependencies": { - "has-symbols": "^1.0.2" - }, + "optional": true, + "peer": true, "engines": { "node": ">= 0.4" }, @@ -2251,48 +2097,6 @@ "node": ">=12.0.0" } }, - "node_modules/internal-slot": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", - "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", - "dev": true, - "dependencies": { - "get-intrinsic": "^1.1.0", - "has": "^1.0.3", - "side-channel": "^1.0.4" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/is-arguments": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", - "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-bigint": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", - "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", - "dev": true, - "dependencies": { - "has-bigints": "^1.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-binary-path": { "version": "2.1.0", "dev": true, @@ -2304,49 +2108,6 @@ "node": ">=8" } }, - "node_modules/is-boolean-object": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", - "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-callable": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", - "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-date-object": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", - "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", - "dev": true, - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-extglob": { "version": "2.1.1", "dev": true, @@ -2364,21 +2125,6 @@ "node": ">=8" } }, - "node_modules/is-generator-function": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", - "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", - "dev": true, - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-glob": { "version": "4.0.3", "dev": true, @@ -2399,18 +2145,6 @@ "node": ">=8" } }, - "node_modules/is-negative-zero": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", - "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-node-process": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/is-node-process/-/is-node-process-1.2.0.tgz", @@ -2425,21 +2159,6 @@ "node": ">=0.12.0" } }, - "node_modules/is-number-object": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", - "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", - "dev": true, - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-potential-custom-element-name": { "version": "1.0.1", "dev": true, @@ -2447,34 +2166,6 @@ "optional": true, "peer": true }, - "node_modules/is-regex": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", - "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-shared-array-buffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", - "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-stream": { "version": "2.0.1", "dev": true, @@ -2486,55 +2177,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-string": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", - "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", - "dev": true, - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-symbol": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", - "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", - "dev": true, - "dependencies": { - "has-symbols": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-typed-array": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.9.tgz", - "integrity": "sha512-kfrlnTTn8pZkfpJMUgYD7YZ3qzeJgWUn8XfVYBARc4wnmNOmLbmuuaAs3q5fvB0UJOn6yHAKaGTPM7d6ezoD/A==", - "dev": true, - "dependencies": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "es-abstract": "^1.20.0", - "for-each": "^0.3.3", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-unicode-supported": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", @@ -2547,18 +2189,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-weakref": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", - "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/isarray": { "version": "1.0.0", "dev": true, @@ -2918,21 +2548,25 @@ "license": "MIT" }, "node_modules/msw": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/msw/-/msw-1.2.1.tgz", - "integrity": "sha512-bF7qWJQSmKn6bwGYVPXOxhexTCGD5oJSZg8yt8IBClxvo3Dx/1W0zqE1nX9BSWmzRsCKWfeGWcB/vpqV6aclpw==", + "version": "0.0.0-fetch.rc-15", + "resolved": "https://registry.npmjs.org/msw/-/msw-0.0.0-fetch.rc-15.tgz", + "integrity": "sha512-apgcCzSmsbJ1rUDpmhrjQAZDzEwOvfZD2VyBZVu6YMD+ovm8ow1buVzRE25IvzrtfIklN/fDbVavTa5lhqX4uQ==", "dev": true, "hasInstallScript": true, "dependencies": { - "@mswjs/cookies": "^0.2.2", - "@mswjs/interceptors": "^0.17.5", - "@open-draft/until": "^1.0.3", + "@bundled-es-modules/cookie": "^2.0.0", + "@bundled-es-modules/js-levenshtein": "^2.0.1", + "@bundled-es-modules/statuses": "^1.0.1", + "@mswjs/cookies": "^1.0.0", + "@mswjs/interceptors": "^0.23.0", + "@open-draft/until": "^2.1.0", "@types/cookie": "^0.4.1", "@types/js-levenshtein": "^1.1.1", - "chalk": "4.1.1", + "@types/statuses": "^2.0.1", + "chalk": "^4.1.2", "chokidar": "^3.4.2", - "cookie": "^0.4.2", - "graphql": "^15.0.0 || ^16.0.0", + "formdata-node": "4.4.1", + "graphql": "^15.0.0 || ^16.7.0", "headers-polyfill": "^3.1.2", "inquirer": "^8.2.0", "is-node-process": "^1.2.0", @@ -2940,7 +2574,7 @@ "node-fetch": "^2.6.7", "outvariant": "^1.4.0", "path-to-regexp": "^6.2.0", - "strict-event-emitter": "^0.4.3", + "strict-event-emitter": "^0.5.0", "type-fest": "^2.19.0", "yargs": "^17.3.1" }, @@ -2948,14 +2582,14 @@ "msw": "cli/index.js" }, "engines": { - "node": ">=14" + "node": ">=18" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/mswjs" }, "peerDependencies": { - "typescript": ">= 4.4.x <= 5.0.x" + "typescript": ">= 4.4.x <= 5.1.x" }, "peerDependenciesMeta": { "typescript": { @@ -2963,12 +2597,6 @@ } } }, - "node_modules/msw/node_modules/strict-event-emitter": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/strict-event-emitter/-/strict-event-emitter-0.4.6.tgz", - "integrity": "sha512-12KWeb+wixJohmnwNFerbyiBrAlq5qJLwIt38etRtKtmmHyDSoGlIqFE9wx+4IwG0aDjI7GV8tc8ZccjWZZtTg==", - "dev": true - }, "node_modules/msw/node_modules/type-fest": { "version": "2.19.0", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", @@ -3015,6 +2643,25 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, + "node_modules/node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "github", + "url": "https://paypal.me/jimmywarting" + } + ], + "engines": { + "node": ">=10.5.0" + } + }, "node_modules/node-fetch": { "version": "2.6.7", "dev": true, @@ -3072,33 +2719,8 @@ "version": "1.12.2", "dev": true, "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/object.assign": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", - "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "has-symbols": "^1.0.3", - "object-keys": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, + "optional": true, + "peer": true, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -3513,23 +3135,6 @@ "node": ">=8.10.0" } }, - "node_modules/regexp.prototype.flags": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz", - "integrity": "sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "functions-have-names": "^1.2.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -3637,20 +3242,6 @@ "dev": true, "license": "MIT" }, - "node_modules/safe-regex-test": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", - "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.3", - "is-regex": "^1.1.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/safer-buffer": { "version": "2.1.2", "dev": true, @@ -3684,12 +3275,6 @@ "node": ">=10" } }, - "node_modules/set-cookie-parser": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.5.1.tgz", - "integrity": "sha512-1jeBGaKNGdEq4FgIrORu/N570dwoPYio8lSoYLWmX7sQ//0JY08Xh9o5pBcgmHQ/MbsYp/aZnOe1s1lIsbLprQ==", - "dev": true - }, "node_modules/shebang-command": { "version": "2.0.0", "dev": true, @@ -3713,6 +3298,8 @@ "version": "1.0.4", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "call-bind": "^1.0.0", "get-intrinsic": "^1.0.2", @@ -3765,6 +3352,15 @@ "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", "dev": true }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/std-env": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.3.3.tgz", @@ -3772,13 +3368,10 @@ "dev": true }, "node_modules/strict-event-emitter": { - "version": "0.2.7", - "resolved": "https://registry.npmjs.org/strict-event-emitter/-/strict-event-emitter-0.2.7.tgz", - "integrity": "sha512-TavbHJ87WD2tDbKI7bTrmc6U4J4Qjh8E9fVvFkIFw2gCu34Wxstn2Yas0+4D78FJN8DOTEzxiT+udBdraRk4UQ==", - "dev": true, - "dependencies": { - "events": "^3.3.0" - } + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/strict-event-emitter/-/strict-event-emitter-0.5.0.tgz", + "integrity": "sha512-sqnMpVJLSB3daNO6FcvsEk4Mq5IJeAwDeH80DP1S8+pgxrF6yZnE1+VeapesGled7nEcIkz1Ax87HzaIy+02kA==", + "dev": true }, "node_modules/string_decoder": { "version": "1.1.1", @@ -3802,34 +3395,6 @@ "node": ">=8" } }, - "node_modules/string.prototype.trimend": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz", - "integrity": "sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.19.5" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/string.prototype.trimstart": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz", - "integrity": "sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.19.5" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -4240,21 +3805,6 @@ "integrity": "sha512-TrY6DsjTQQgyS3E3dBaOXf0TpPD8u9FVrVYmKVegJuFw51n/YB9XPt+U6ydzFG5ZIN7+DIjPbNmXoBj9esYhgQ==", "dev": true }, - "node_modules/unbox-primitive": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", - "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "has-bigints": "^1.0.2", - "has-symbols": "^1.0.3", - "which-boxed-primitive": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/universalify": { "version": "0.2.0", "dev": true, @@ -4276,20 +3826,6 @@ "requires-port": "^1.0.0" } }, - "node_modules/util": { - "version": "0.12.4", - "resolved": "https://registry.npmjs.org/util/-/util-0.12.4.tgz", - "integrity": "sha512-bxZ9qtSlGUWSOy9Qa9Xgk11kSslpuZwaxCg4sNIDj6FLucDab2JxnHwyNTCpHMtK1MjoQiWQ6DiUMZYbSrO+Sw==", - "dev": true, - "dependencies": { - "inherits": "^2.0.3", - "is-arguments": "^1.0.4", - "is-generator-function": "^1.0.7", - "is-typed-array": "^1.1.3", - "safe-buffer": "^5.1.2", - "which-typed-array": "^1.1.2" - } - }, "node_modules/util-deprecate": { "version": "1.0.2", "dev": true, @@ -4493,16 +4029,13 @@ "defaults": "^1.0.3" } }, - "node_modules/web-encoding": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/web-encoding/-/web-encoding-1.1.5.tgz", - "integrity": "sha512-HYLeVCdJ0+lBYV2FvNZmv3HJ2Nt0QYXqZojk3d9FJOLkwnuhzM9tmamh8d7HPM8QqjKH8DeHkFTx+CFlWpZZDA==", + "node_modules/web-streams-polyfill": { + "version": "4.0.0-beta.3", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz", + "integrity": "sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==", "dev": true, - "dependencies": { - "util": "^0.12.3" - }, - "optionalDependencies": { - "@zxing/text-encoding": "0.9.0" + "engines": { + "node": ">= 14" } }, "node_modules/webidl-conversions": { @@ -4569,46 +4102,10 @@ "isexe": "^2.0.0" }, "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/which-boxed-primitive": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", - "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", - "dev": true, - "dependencies": { - "is-bigint": "^1.0.1", - "is-boolean-object": "^1.1.0", - "is-number-object": "^1.0.4", - "is-string": "^1.0.5", - "is-symbol": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/which-typed-array": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.8.tgz", - "integrity": "sha512-Jn4e5PItbcAHyLoRDwvPj1ypu27DJbtdYXUa5zsinrUx77Uvfb0cXwwnGMTn7cjUfhhqgVQnVJCwF+7cgU7tpw==", - "dev": true, - "dependencies": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "es-abstract": "^1.20.0", - "for-each": "^0.3.3", - "has-tostringtag": "^1.0.0", - "is-typed-array": "^1.1.9" + "node-which": "bin/node-which" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">= 8" } }, "node_modules/why-is-node-running": { @@ -4827,6 +4324,33 @@ "z-schema": "^5.0.1" } }, + "@bundled-es-modules/cookie": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@bundled-es-modules/cookie/-/cookie-2.0.0.tgz", + "integrity": "sha512-Or6YHg/kamKHpxULAdSqhGqnWFneIXu1NKvvfBBzKGwpVsYuFIQ5aBPHDnnoR3ghW1nvSkALd+EF9iMtY7Vjxw==", + "dev": true, + "requires": { + "cookie": "^0.5.0" + } + }, + "@bundled-es-modules/js-levenshtein": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@bundled-es-modules/js-levenshtein/-/js-levenshtein-2.0.1.tgz", + "integrity": "sha512-DERMS3yfbAljKsQc0U2wcqGKUWpdFjwqWuoMugEJlqBnKO180/n+4SR/J8MRDt1AN48X1ovgoD9KrdVXcaa3Rg==", + "dev": true, + "requires": { + "js-levenshtein": "^1.1.6" + } + }, + "@bundled-es-modules/statuses": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@bundled-es-modules/statuses/-/statuses-1.0.1.tgz", + "integrity": "sha512-yn7BklA5acgcBr+7w064fGV+SGIFySjCKpqjcWgBAIfrAkY+4GQTJJHQMeT3V/sgz23VTEVV8TtOmkvJAhFVfg==", + "dev": true, + "requires": { + "statuses": "^2.0.1" + } + }, "@esbuild/android-arm": { "version": "0.17.18", "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.18.tgz", @@ -4992,29 +4516,23 @@ "dev": true }, "@mswjs/cookies": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/@mswjs/cookies/-/cookies-0.2.2.tgz", - "integrity": "sha512-mlN83YSrcFgk7Dm1Mys40DLssI1KdJji2CMKN8eOlBqsTADYzj2+jWzsANsUTFbxDMWPD5e9bfA1RGqBpS3O1g==", - "dev": true, - "requires": { - "@types/set-cookie-parser": "^2.4.0", - "set-cookie-parser": "^2.4.6" - } + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@mswjs/cookies/-/cookies-1.0.0.tgz", + "integrity": "sha512-TdXoBdI+h/EDTsVLCX/34s4+9U0sWi92qFnIGUEikpMCSKLhBeujovyYVSoORNbYgsBH5ga7/tfxyWcEZAxiYA==", + "dev": true }, "@mswjs/interceptors": { - "version": "0.17.6", - "resolved": "https://registry.npmjs.org/@mswjs/interceptors/-/interceptors-0.17.6.tgz", - "integrity": "sha512-201pBIWehTURb6q8Gheu4Zhvd3Ox1U4BJq5KiOQsYzkWyfiOG4pwcz5hPZIEryztgrf8/sdwABpvY757xMmfrQ==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@mswjs/interceptors/-/interceptors-0.23.0.tgz", + "integrity": "sha512-JytvDa7pBbxXvCTXBYQs+0eE6MqxpqH/H4peRNY6zVAlvJ6d/hAWLHAef1D9lWN4zuIigN0VkakGOAUrX7FWLg==", "dev": true, "requires": { - "@open-draft/until": "^1.0.3", - "@types/debug": "^4.1.7", - "@xmldom/xmldom": "^0.8.3", - "debug": "^4.3.3", + "@open-draft/deferred-promise": "^2.1.0", + "@open-draft/logger": "^0.3.0", + "@open-draft/until": "^2.0.0", "headers-polyfill": "^3.1.0", "outvariant": "^1.2.1", - "strict-event-emitter": "^0.2.4", - "web-encoding": "^1.1.5" + "strict-event-emitter": "^0.5.0" } }, "@nodelib/fs.scandir": { @@ -5037,10 +4555,26 @@ "fastq": "^1.6.0" } }, + "@open-draft/deferred-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@open-draft/deferred-promise/-/deferred-promise-2.1.0.tgz", + "integrity": "sha512-Rzd5JrXZX8zErHzgcGyngh4fmEbSHqTETdGj9rXtejlqMIgXFlyKBA7Jn1Xp0Ls0M0Y22+xHcWiEzbmdWl0BOA==", + "dev": true + }, + "@open-draft/logger": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@open-draft/logger/-/logger-0.3.0.tgz", + "integrity": "sha512-X2g45fzhxH238HKO4xbSr7+wBS8Fvw6ixhTDuvLd5mqh6bJJCFAPwU9mPDxbcrRtfxv4u5IHCEH77BmxvXmmxQ==", + "dev": true, + "requires": { + "is-node-process": "^1.2.0", + "outvariant": "^1.4.0" + } + }, "@open-draft/until": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@open-draft/until/-/until-1.0.3.tgz", - "integrity": "sha512-Aq58f5HiWdyDlFffbbSjAlv596h/cOnt2DO1w3DOC7OJ5EHs0hd/nycJfiu9RJbT6Yk6F1knnRRXNSpxoIVZ9Q==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@open-draft/until/-/until-2.1.0.tgz", + "integrity": "sha512-U69T3ItWHvLwGg5eJ0n3I62nWuE6ilHlmz7zM0npLBRvPRd7e6NYmg54vvRtP5mZG7kZqZCFVdsTWo7BPtBujg==", "dev": true }, "@tootallnate/once": { @@ -5077,15 +4611,6 @@ "integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==", "dev": true }, - "@types/debug": { - "version": "4.1.7", - "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.7.tgz", - "integrity": "sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg==", - "dev": true, - "requires": { - "@types/ms": "*" - } - }, "@types/form-data": { "version": "0.0.33", "dev": true, @@ -5105,12 +4630,6 @@ "version": "7.0.9", "dev": true }, - "@types/ms": { - "version": "0.7.31", - "resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.31.tgz", - "integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==", - "dev": true - }, "@types/node": { "version": "18.7.20", "dev": true @@ -5121,14 +4640,11 @@ "optional": true, "peer": true }, - "@types/set-cookie-parser": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/@types/set-cookie-parser/-/set-cookie-parser-2.4.2.tgz", - "integrity": "sha512-fBZgytwhYAUkj/jC/FAV4RQ5EerRup1YQsXQCh8rZfiHkc4UahC192oH0smGwsXol3cL3A5oETuAHeQHmhXM4w==", - "dev": true, - "requires": { - "@types/node": "*" - } + "@types/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-vVRgv7WXbhIZzILgr58b4Ki2uqpN/dlVCUBWCMkPbMDlV1CrQrgCl5hnIoUlMrgymGcTmdfVqbs1yWj/IRIRtQ==", + "dev": true }, "@vitest/expect": { "version": "0.32.2", @@ -5184,19 +4700,6 @@ "pretty-format": "^27.5.1" } }, - "@xmldom/xmldom": { - "version": "0.8.7", - "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.7.tgz", - "integrity": "sha512-sI1Ly2cODlWStkINzqGrZ8K6n+MTSbAeQnAipGyL+KZCXuHaRlj2gyyy8B/9MvsFFqN7XHryQnB2QwhzvJXovg==", - "dev": true - }, - "@zxing/text-encoding": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/@zxing/text-encoding/-/text-encoding-0.9.0.tgz", - "integrity": "sha512-U/4aVJ2mxI0aDNI8Uq0wEhMgY+u4CNtEb0om3+y3+niDAsoTCOB33UF0sxpzqzdqXLqmvc+vZyAt4O8pPdfkwA==", - "dev": true, - "optional": true - }, "abab": { "version": "2.0.6", "dev": true, @@ -5312,12 +4815,6 @@ "optional": true, "peer": true }, - "available-typed-arrays": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", - "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", - "dev": true - }, "balanced-match": { "version": "1.0.2", "dev": true @@ -5415,6 +4912,8 @@ "call-bind": { "version": "1.0.2", "dev": true, + "optional": true, + "peer": true, "requires": { "function-bind": "^1.1.1", "get-intrinsic": "^1.0.2" @@ -5446,9 +4945,9 @@ } }, "chalk": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", - "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, "requires": { "ansi-styles": "^4.1.0", @@ -5580,9 +5079,9 @@ } }, "cookie": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", - "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", + "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", "dev": true }, "core-util-is": { @@ -5707,16 +5206,6 @@ "clone": "^1.0.2" } }, - "define-properties": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz", - "integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==", - "dev": true, - "requires": { - "has-property-descriptors": "^1.0.0", - "object-keys": "^1.1.1" - } - }, "delayed-stream": { "version": "1.0.0", "dev": true, @@ -5757,49 +5246,6 @@ "optional": true, "peer": true }, - "es-abstract": { - "version": "1.20.4", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.4.tgz", - "integrity": "sha512-0UtvRN79eMe2L+UNEF1BwRe364sj/DXhQ/k5FmivgoSdpM90b8Jc0mDzKMGo7QS0BVbOP/bTwBKNnDc9rNzaPA==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "function.prototype.name": "^1.1.5", - "get-intrinsic": "^1.1.3", - "get-symbol-description": "^1.0.0", - "has": "^1.0.3", - "has-property-descriptors": "^1.0.0", - "has-symbols": "^1.0.3", - "internal-slot": "^1.0.3", - "is-callable": "^1.2.7", - "is-negative-zero": "^2.0.2", - "is-regex": "^1.1.4", - "is-shared-array-buffer": "^1.0.2", - "is-string": "^1.0.7", - "is-weakref": "^1.0.2", - "object-inspect": "^1.12.2", - "object-keys": "^1.1.1", - "object.assign": "^4.1.4", - "regexp.prototype.flags": "^1.4.3", - "safe-regex-test": "^1.0.0", - "string.prototype.trimend": "^1.0.5", - "string.prototype.trimstart": "^1.0.5", - "unbox-primitive": "^1.0.2" - } - }, - "es-to-primitive": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", - "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", - "dev": true, - "requires": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - } - }, "esbuild": { "version": "0.17.18", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.18.tgz", @@ -5876,12 +5322,6 @@ "version": "2.0.3", "dev": true }, - "events": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", - "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", - "dev": true - }, "execa": { "version": "5.1.1", "dev": true, @@ -5965,15 +5405,6 @@ "to-regex-range": "^5.0.1" } }, - "for-each": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", - "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", - "dev": true, - "requires": { - "is-callable": "^1.1.3" - } - }, "form-data": { "version": "2.5.1", "dev": true, @@ -5985,6 +5416,16 @@ "mime-types": "^2.1.12" } }, + "formdata-node": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.4.1.tgz", + "integrity": "sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==", + "dev": true, + "requires": { + "node-domexception": "1.0.0", + "web-streams-polyfill": "4.0.0-beta.3" + } + }, "fs.realpath": { "version": "1.0.0", "dev": true @@ -5998,25 +5439,9 @@ }, "function-bind": { "version": "1.1.1", - "dev": true - }, - "function.prototype.name": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz", - "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==", "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.0", - "functions-have-names": "^1.2.2" - } - }, - "functions-have-names": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", - "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", - "dev": true + "optional": true, + "peer": true }, "get-caller-file": { "version": "2.0.5", @@ -6033,6 +5458,8 @@ "get-intrinsic": { "version": "1.1.3", "dev": true, + "optional": true, + "peer": true, "requires": { "function-bind": "^1.1.1", "has": "^1.0.3", @@ -6049,16 +5476,6 @@ "version": "6.0.1", "dev": true }, - "get-symbol-description": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", - "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.1" - } - }, "glob": { "version": "7.1.6", "dev": true, @@ -6091,9 +5508,9 @@ } }, "graphql": { - "version": "16.6.0", - "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.6.0.tgz", - "integrity": "sha512-KPIBPDlW7NxrbT/eh4qPXz5FiFdL5UbaA0XUNz2Rp3Z3hqBSkbj0GVjwFDztsWVauZUWsbKHgMg++sk8UX0bkw==", + "version": "16.7.1", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.7.1.tgz", + "integrity": "sha512-DRYR9tf+UGU0KOsMcKAlXeFfX89UiiIZ0dRU3mR0yJfu6OjZqUcp68NnFLnqQU5RexygFoDy1EW+ccOYcPfmHg==", "dev": true }, "happy-dom": { @@ -6114,43 +5531,23 @@ "has": { "version": "1.0.3", "dev": true, + "optional": true, + "peer": true, "requires": { "function-bind": "^1.1.1" } }, - "has-bigints": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", - "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", - "dev": true - }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, - "has-property-descriptors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", - "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", - "dev": true, - "requires": { - "get-intrinsic": "^1.1.1" - } - }, "has-symbols": { "version": "1.0.3", - "dev": true - }, - "has-tostringtag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", - "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", "dev": true, - "requires": { - "has-symbols": "^1.0.2" - } + "optional": true, + "peer": true }, "he": { "version": "1.2.0", @@ -6281,36 +5678,6 @@ "wrap-ansi": "^7.0.0" } }, - "internal-slot": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", - "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", - "dev": true, - "requires": { - "get-intrinsic": "^1.1.0", - "has": "^1.0.3", - "side-channel": "^1.0.4" - } - }, - "is-arguments": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", - "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - } - }, - "is-bigint": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", - "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", - "dev": true, - "requires": { - "has-bigints": "^1.0.1" - } - }, "is-binary-path": { "version": "2.1.0", "dev": true, @@ -6318,31 +5685,6 @@ "binary-extensions": "^2.0.0" } }, - "is-boolean-object": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", - "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - } - }, - "is-callable": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", - "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", - "dev": true - }, - "is-date-object": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", - "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", - "dev": true, - "requires": { - "has-tostringtag": "^1.0.0" - } - }, "is-extglob": { "version": "2.1.1", "dev": true @@ -6353,15 +5695,6 @@ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true }, - "is-generator-function": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", - "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", - "dev": true, - "requires": { - "has-tostringtag": "^1.0.0" - } - }, "is-glob": { "version": "4.0.3", "dev": true, @@ -6375,12 +5708,6 @@ "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", "dev": true }, - "is-negative-zero": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", - "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", - "dev": true - }, "is-node-process": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/is-node-process/-/is-node-process-1.2.0.tgz", @@ -6391,90 +5718,22 @@ "version": "7.0.0", "dev": true }, - "is-number-object": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", - "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", - "dev": true, - "requires": { - "has-tostringtag": "^1.0.0" - } - }, "is-potential-custom-element-name": { "version": "1.0.1", "dev": true, "optional": true, "peer": true }, - "is-regex": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", - "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - } - }, - "is-shared-array-buffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", - "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", - "dev": true, - "requires": { - "call-bind": "^1.0.2" - } - }, "is-stream": { "version": "2.0.1", "dev": true }, - "is-string": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", - "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", - "dev": true, - "requires": { - "has-tostringtag": "^1.0.0" - } - }, - "is-symbol": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", - "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", - "dev": true, - "requires": { - "has-symbols": "^1.0.2" - } - }, - "is-typed-array": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.9.tgz", - "integrity": "sha512-kfrlnTTn8pZkfpJMUgYD7YZ3qzeJgWUn8XfVYBARc4wnmNOmLbmuuaAs3q5fvB0UJOn6yHAKaGTPM7d6ezoD/A==", - "dev": true, - "requires": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "es-abstract": "^1.20.0", - "for-each": "^0.3.3", - "has-tostringtag": "^1.0.0" - } - }, "is-unicode-supported": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", "dev": true }, - "is-weakref": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", - "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", - "dev": true, - "requires": { - "call-bind": "^1.0.2" - } - }, "isarray": { "version": "1.0.0", "dev": true, @@ -6734,20 +5993,24 @@ "dev": true }, "msw": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/msw/-/msw-1.2.1.tgz", - "integrity": "sha512-bF7qWJQSmKn6bwGYVPXOxhexTCGD5oJSZg8yt8IBClxvo3Dx/1W0zqE1nX9BSWmzRsCKWfeGWcB/vpqV6aclpw==", + "version": "0.0.0-fetch.rc-15", + "resolved": "https://registry.npmjs.org/msw/-/msw-0.0.0-fetch.rc-15.tgz", + "integrity": "sha512-apgcCzSmsbJ1rUDpmhrjQAZDzEwOvfZD2VyBZVu6YMD+ovm8ow1buVzRE25IvzrtfIklN/fDbVavTa5lhqX4uQ==", "dev": true, "requires": { - "@mswjs/cookies": "^0.2.2", - "@mswjs/interceptors": "^0.17.5", - "@open-draft/until": "^1.0.3", + "@bundled-es-modules/cookie": "^2.0.0", + "@bundled-es-modules/js-levenshtein": "^2.0.1", + "@bundled-es-modules/statuses": "^1.0.1", + "@mswjs/cookies": "^1.0.0", + "@mswjs/interceptors": "^0.23.0", + "@open-draft/until": "^2.1.0", "@types/cookie": "^0.4.1", "@types/js-levenshtein": "^1.1.1", - "chalk": "4.1.1", + "@types/statuses": "^2.0.1", + "chalk": "^4.1.2", "chokidar": "^3.4.2", - "cookie": "^0.4.2", - "graphql": "^15.0.0 || ^16.0.0", + "formdata-node": "4.4.1", + "graphql": "^15.0.0 || ^16.7.0", "headers-polyfill": "^3.1.2", "inquirer": "^8.2.0", "is-node-process": "^1.2.0", @@ -6755,17 +6018,11 @@ "node-fetch": "^2.6.7", "outvariant": "^1.4.0", "path-to-regexp": "^6.2.0", - "strict-event-emitter": "^0.4.3", + "strict-event-emitter": "^0.5.0", "type-fest": "^2.19.0", "yargs": "^17.3.1" }, "dependencies": { - "strict-event-emitter": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/strict-event-emitter/-/strict-event-emitter-0.4.6.tgz", - "integrity": "sha512-12KWeb+wixJohmnwNFerbyiBrAlq5qJLwIt38etRtKtmmHyDSoGlIqFE9wx+4IwG0aDjI7GV8tc8ZccjWZZtTg==", - "dev": true - }, "type-fest": { "version": "2.19.0", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", @@ -6795,6 +6052,12 @@ "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", "dev": true }, + "node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", + "dev": true + }, "node-fetch": { "version": "2.6.7", "dev": true, @@ -6825,25 +6088,9 @@ }, "object-inspect": { "version": "1.12.2", - "dev": true - }, - "object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true - }, - "object.assign": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", - "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "has-symbols": "^1.0.3", - "object-keys": "^1.1.1" - } + "optional": true, + "peer": true }, "once": { "version": "1.4.0", @@ -7105,17 +6352,6 @@ "picomatch": "^2.2.1" } }, - "regexp.prototype.flags": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz", - "integrity": "sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "functions-have-names": "^1.2.2" - } - }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -7181,17 +6417,6 @@ "version": "5.1.2", "dev": true }, - "safe-regex-test": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", - "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.3", - "is-regex": "^1.1.4" - } - }, "safer-buffer": { "version": "2.1.2", "dev": true @@ -7214,12 +6439,6 @@ "lru-cache": "^6.0.0" } }, - "set-cookie-parser": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.5.1.tgz", - "integrity": "sha512-1jeBGaKNGdEq4FgIrORu/N570dwoPYio8lSoYLWmX7sQ//0JY08Xh9o5pBcgmHQ/MbsYp/aZnOe1s1lIsbLprQ==", - "dev": true - }, "shebang-command": { "version": "2.0.0", "dev": true, @@ -7234,6 +6453,8 @@ "side-channel": { "version": "1.0.4", "dev": true, + "optional": true, + "peer": true, "requires": { "call-bind": "^1.0.0", "get-intrinsic": "^1.0.2", @@ -7270,6 +6491,12 @@ "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", "dev": true }, + "statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "dev": true + }, "std-env": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.3.3.tgz", @@ -7277,13 +6504,10 @@ "dev": true }, "strict-event-emitter": { - "version": "0.2.7", - "resolved": "https://registry.npmjs.org/strict-event-emitter/-/strict-event-emitter-0.2.7.tgz", - "integrity": "sha512-TavbHJ87WD2tDbKI7bTrmc6U4J4Qjh8E9fVvFkIFw2gCu34Wxstn2Yas0+4D78FJN8DOTEzxiT+udBdraRk4UQ==", - "dev": true, - "requires": { - "events": "^3.3.0" - } + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/strict-event-emitter/-/strict-event-emitter-0.5.0.tgz", + "integrity": "sha512-sqnMpVJLSB3daNO6FcvsEk4Mq5IJeAwDeH80DP1S8+pgxrF6yZnE1+VeapesGled7nEcIkz1Ax87HzaIy+02kA==", + "dev": true }, "string_decoder": { "version": "1.1.1", @@ -7303,28 +6527,6 @@ "strip-ansi": "^6.0.1" } }, - "string.prototype.trimend": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz", - "integrity": "sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.19.5" - } - }, - "string.prototype.trimstart": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz", - "integrity": "sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.19.5" - } - }, "strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -7622,18 +6824,6 @@ "integrity": "sha512-TrY6DsjTQQgyS3E3dBaOXf0TpPD8u9FVrVYmKVegJuFw51n/YB9XPt+U6ydzFG5ZIN7+DIjPbNmXoBj9esYhgQ==", "dev": true }, - "unbox-primitive": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", - "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "has-bigints": "^1.0.2", - "has-symbols": "^1.0.3", - "which-boxed-primitive": "^1.0.2" - } - }, "universalify": { "version": "0.2.0", "dev": true, @@ -7650,20 +6840,6 @@ "requires-port": "^1.0.0" } }, - "util": { - "version": "0.12.4", - "resolved": "https://registry.npmjs.org/util/-/util-0.12.4.tgz", - "integrity": "sha512-bxZ9qtSlGUWSOy9Qa9Xgk11kSslpuZwaxCg4sNIDj6FLucDab2JxnHwyNTCpHMtK1MjoQiWQ6DiUMZYbSrO+Sw==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "is-arguments": "^1.0.4", - "is-generator-function": "^1.0.7", - "is-typed-array": "^1.1.3", - "safe-buffer": "^5.1.2", - "which-typed-array": "^1.1.2" - } - }, "util-deprecate": { "version": "1.0.2", "dev": true @@ -7766,15 +6942,11 @@ "defaults": "^1.0.3" } }, - "web-encoding": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/web-encoding/-/web-encoding-1.1.5.tgz", - "integrity": "sha512-HYLeVCdJ0+lBYV2FvNZmv3HJ2Nt0QYXqZojk3d9FJOLkwnuhzM9tmamh8d7HPM8QqjKH8DeHkFTx+CFlWpZZDA==", - "dev": true, - "requires": { - "@zxing/text-encoding": "0.9.0", - "util": "^0.12.3" - } + "web-streams-polyfill": { + "version": "4.0.0-beta.3", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz", + "integrity": "sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==", + "dev": true }, "webidl-conversions": { "version": "7.0.0", @@ -7824,33 +6996,6 @@ "isexe": "^2.0.0" } }, - "which-boxed-primitive": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", - "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", - "dev": true, - "requires": { - "is-bigint": "^1.0.1", - "is-boolean-object": "^1.1.0", - "is-number-object": "^1.0.4", - "is-string": "^1.0.5", - "is-symbol": "^1.0.3" - } - }, - "which-typed-array": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.8.tgz", - "integrity": "sha512-Jn4e5PItbcAHyLoRDwvPj1ypu27DJbtdYXUa5zsinrUx77Uvfb0cXwwnGMTn7cjUfhhqgVQnVJCwF+7cgU7tpw==", - "dev": true, - "requires": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "es-abstract": "^1.20.0", - "for-each": "^0.3.3", - "has-tostringtag": "^1.0.0", - "is-typed-array": "^1.1.9" - } - }, "why-is-node-running": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.2.2.tgz", diff --git a/package.json b/package.json index d42caf3..7512d1f 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "devDependencies": { "@types/node": "^18.7.20", "esbuild-register": "^3.3.3", - "msw": "^1.2.1", + "msw": "^0.0.0-fetch.rc-15", "openapi-types": "^12.0.2", "prettier": "2.7.1", "swagger-parser": "^10.0.3", From 446ccc5eeb568ac7ceb299e85d827939d9dce14d Mon Sep 17 00:00:00 2001 From: Justin Bennett Date: Mon, 24 Jul 2023 14:00:34 -0400 Subject: [PATCH 2/8] Remove delay from json --- generator/client/msw-handlers.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/generator/client/msw-handlers.ts b/generator/client/msw-handlers.ts index f84506d..9f0f4b2 100644 --- a/generator/client/msw-handlers.ts +++ b/generator/client/msw-handlers.ts @@ -60,12 +60,9 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) { */ export function json( body: B, - options: { status?: number; delay?: number } = {} + options: { status?: number } = {} ): StrictResponse { - const { status = 200, delay = 0 } = options; - if (delay) { - doDelay(delay); - } + const { status = 200 } = options; return HttpResponse.json(body, { status }); } From e438dd3cbcbf2bd35ab487dee7caca04d66654e0 Mon Sep 17 00:00:00 2001 From: Justin Bennett Date: Mon, 24 Jul 2023 14:19:03 -0400 Subject: [PATCH 3/8] Remove json helper --- client/msw-handlers.ts | 34 ++++++++++---------------------- generator/client/msw-handlers.ts | 29 +++++++-------------------- 2 files changed, 17 insertions(+), 46 deletions(-) diff --git a/client/msw-handlers.ts b/client/msw-handlers.ts index 045a860..3befd85 100644 --- a/client/msw-handlers.ts +++ b/client/msw-handlers.ts @@ -26,23 +26,6 @@ import * as schema from "./validate"; type HandlerResult = Json | StrictResponse>; type StatusCode = number; -/** - * Custom transformer: convenience function for setting response `status` and/or - * `delay`. - * - * @see https://mswjs.io/docs/basics/response-transformer#custom-transformer - */ -export function json( - body: B, - options: { status?: number; delay?: number } = {} -): StrictResponse { - const { status = 200, delay = 0 } = options; - if (delay) { - doDelay(delay); - } - return HttpResponse.json(body, { status }); -} - // these are used for turning our nice JS-ified API types back into the original // API JSON types (snake cased and dates as strings) for use in our mock API @@ -881,7 +864,7 @@ function validateBody(schema: S, body: unknown) { if (result.success) { return { body: result.data as Json> }; } - return { bodyErr: json(result.error.issues, { status: 400 }) }; + return { bodyErr: HttpResponse.json(result.error.issues, { status: 400 }) }; } function validateParams( schema: S, @@ -909,7 +892,7 @@ function validateParams( // exist if there's no valid name const { issues } = result.error; const status = issues.some((e) => e.path[0] === "path") ? 404 : 400; - return { paramsErr: json(issues, { status }) }; + return { paramsErr: HttpResponse.json(issues, { status }) }; } const handler = @@ -928,14 +911,14 @@ const handler = const { params, paramsErr } = paramSchema ? validateParams(paramSchema, req, pathParams) : { params: {}, paramsErr: undefined }; - if (paramsErr) return json(paramsErr, { status: 400 }); + if (paramsErr) return HttpResponse.json(paramsErr, { status: 400 }); const { path, query } = params; const { body, bodyErr } = bodySchema ? validateBody(bodySchema, await req.json()) : { body: undefined, bodyErr: undefined }; - if (bodyErr) return json(bodyErr, { status: 400 }); + if (bodyErr) return HttpResponse.json(bodyErr, { status: 400 }); try { // TypeScript can't narrow the handler down because there's not an explicit relationship between the schema @@ -950,7 +933,7 @@ const handler = if (typeof result === "function") { return result(); } - return json(result); + return HttpResponse.json(result); } catch (thrown) { if (typeof thrown === "number") { return new HttpResponse(null, { status: thrown }); @@ -959,10 +942,13 @@ const handler = return thrown(); } if (typeof thrown === "string") { - return json({ message: thrown }, { status: 400 }); + return HttpResponse.json({ message: thrown }, { status: 400 }); } console.error("Unexpected mock error", thrown); - return json({ message: "Unknown Server Error" }, { status: 500 }); + return HttpResponse.json( + { message: "Unknown Server Error" }, + { status: 500 } + ); } }; diff --git a/generator/client/msw-handlers.ts b/generator/client/msw-handlers.ts index 9f0f4b2..dbcffdb 100644 --- a/generator/client/msw-handlers.ts +++ b/generator/client/msw-handlers.ts @@ -52,21 +52,6 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) { type HandlerResult = Json | StrictResponse>; type StatusCode = number - /** - * Custom transformer: convenience function for setting response \`status\` and/or - * \`delay\`. - * - * @see https://mswjs.io/docs/basics/response-transformer#custom-transformer - */ - export function json( - body: B, - options: { status?: number } = {} - ): StrictResponse { - const { status = 200 } = options; - return HttpResponse.json(body, { status }); - } - - // these are used for turning our nice JS-ified API types back into the original // API JSON types (snake cased and dates as strings) for use in our mock API @@ -134,7 +119,7 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) { if (result.success) { return { body: result.data as Json> } } - return { bodyErr: json(result.error.issues, { status: 400 }) } + return { bodyErr: HttpResponse.json(result.error.issues, { status: 400 }) } } function validateParams(schema: S, req: Request, pathParams: PathParams) { const rawParams = new URLSearchParams(new URL(req.url).search) @@ -158,7 +143,7 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) { // exist if there's no valid name const { issues } = result.error const status = issues.some(e => e.path[0] === 'path') ? 404 : 400 - return { paramsErr: json(issues, { status }) } + return { paramsErr: HttpResponse.json(issues, { status }) } } const handler = (handler: MSWHandlers[keyof MSWHandlers], paramSchema: ZodSchema | null, bodySchema: ZodSchema | null) => @@ -172,14 +157,14 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) { const { params, paramsErr } = paramSchema ? validateParams(paramSchema, req, pathParams) : { params: {}, paramsErr: undefined }; - if (paramsErr) return json(paramsErr, { status: 400 }); + if (paramsErr) return HttpResponse.json(paramsErr, { status: 400 }); const { path, query } = params const { body, bodyErr } = bodySchema ? validateBody(bodySchema, await req.json()) : { body: undefined, bodyErr: undefined }; - if (bodyErr) return json(bodyErr, { status: 400 }); + if (bodyErr) return HttpResponse.json(bodyErr, { status: 400 }); try { // TypeScript can't narrow the handler down because there's not an explicit relationship between the schema @@ -192,7 +177,7 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) { if (typeof result === "function") { return result(); } - return json(result); + return HttpResponse.json(result); } catch (thrown) { if (typeof thrown === 'number') { return new HttpResponse(null, { status: thrown }); @@ -201,10 +186,10 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) { return thrown(); } if (typeof thrown === "string") { - return json({ message: thrown }, { status: 400 }); + return HttpResponse.json({ message: thrown }, { status: 400 }); } console.error('Unexpected mock error', thrown) - return json({ message: "Unknown Server Error" }, { status: 500 }); + return HttpResponse.json({ message: "Unknown Server Error" }, { status: 500 }); } } From 5b23d0a41dd106231b0de89346bd07ee9a7855e1 Mon Sep 17 00:00:00 2001 From: Justin Bennett Date: Wed, 1 Nov 2023 11:42:37 -0400 Subject: [PATCH 4/8] Update to MSW 2.0 --- client/msw-handlers.ts | 477 +++++++++++++++++++++---------- generator/client/msw-handlers.ts | 10 +- package-lock.json | 112 ++++---- package.json | 2 +- 4 files changed, 381 insertions(+), 220 deletions(-) diff --git a/client/msw-handlers.ts b/client/msw-handlers.ts index 3befd85..9e53893 100644 --- a/client/msw-handlers.ts +++ b/client/msw-handlers.ts @@ -9,8 +9,8 @@ */ import { - rest, - RestHandler, + http, + HttpHandler, HttpResponse, StrictResponse, delay as doDelay, @@ -45,61 +45,77 @@ export type Json = Snakify>; export interface MSWHandlers { /** `POST /device/auth` */ - deviceAuthRequest: (params: { req: Request }) => StatusCode; + deviceAuthRequest: (params: { + req: Request; + cookies: Record; + }) => StatusCode; /** `POST /device/confirm` */ deviceAuthConfirm: (params: { body: Json; req: Request; + cookies: Record; }) => StatusCode; /** `POST /device/token` */ - deviceAccessToken: (params: { req: Request }) => StatusCode; + deviceAccessToken: (params: { + req: Request; + cookies: Record; + }) => StatusCode; /** `POST /login/:siloName/saml/:providerName` */ loginSaml: (params: { path: Api.LoginSamlPathParams; req: Request; + cookies: Record; }) => StatusCode; /** `GET /v1/certificates` */ certificateList: (params: { query: Api.CertificateListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/certificates` */ certificateCreate: (params: { body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/certificates/:certificate` */ certificateView: (params: { path: Api.CertificateViewPathParams; req: Request; + cookies: Record; }) => HandlerResult; /** `DELETE /v1/certificates/:certificate` */ certificateDelete: (params: { path: Api.CertificateDeletePathParams; req: Request; + cookies: Record; }) => StatusCode; /** `GET /v1/disks` */ diskList: (params: { query: Api.DiskListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/disks` */ diskCreate: (params: { query: Api.DiskCreateQueryParams; body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/disks/:disk` */ diskView: (params: { path: Api.DiskViewPathParams; query: Api.DiskViewQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `DELETE /v1/disks/:disk` */ diskDelete: (params: { path: Api.DiskDeletePathParams; query: Api.DiskDeleteQueryParams; req: Request; + cookies: Record; }) => StatusCode; /** `POST /v1/disks/:disk/bulk-write` */ diskBulkWriteImport: (params: { @@ -107,18 +123,21 @@ export interface MSWHandlers { query: Api.DiskBulkWriteImportQueryParams; body: Json; req: Request; + cookies: Record; }) => StatusCode; /** `POST /v1/disks/:disk/bulk-write-start` */ diskBulkWriteImportStart: (params: { path: Api.DiskBulkWriteImportStartPathParams; query: Api.DiskBulkWriteImportStartQueryParams; req: Request; + cookies: Record; }) => StatusCode; /** `POST /v1/disks/:disk/bulk-write-stop` */ diskBulkWriteImportStop: (params: { path: Api.DiskBulkWriteImportStopPathParams; query: Api.DiskBulkWriteImportStopQueryParams; req: Request; + cookies: Record; }) => StatusCode; /** `POST /v1/disks/:disk/finalize` */ diskFinalizeImport: (params: { @@ -126,6 +145,7 @@ export interface MSWHandlers { query: Api.DiskFinalizeImportQueryParams; body: Json; req: Request; + cookies: Record; }) => StatusCode; /** `POST /v1/disks/:disk/import` */ diskImportBlocksFromUrl: (params: { @@ -133,86 +153,101 @@ export interface MSWHandlers { query: Api.DiskImportBlocksFromUrlQueryParams; body: Json; req: Request; + cookies: Record; }) => StatusCode; /** `GET /v1/disks/:disk/metrics/:metric` */ diskMetricsList: (params: { path: Api.DiskMetricsListPathParams; query: Api.DiskMetricsListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/groups` */ groupList: (params: { query: Api.GroupListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/groups/:groupId` */ groupView: (params: { path: Api.GroupViewPathParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/images` */ imageList: (params: { query: Api.ImageListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/images` */ imageCreate: (params: { query: Api.ImageCreateQueryParams; body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/images/:image` */ imageView: (params: { path: Api.ImageViewPathParams; query: Api.ImageViewQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `DELETE /v1/images/:image` */ imageDelete: (params: { path: Api.ImageDeletePathParams; query: Api.ImageDeleteQueryParams; req: Request; + cookies: Record; }) => StatusCode; /** `POST /v1/images/:image/demote` */ imageDemote: (params: { path: Api.ImageDemotePathParams; query: Api.ImageDemoteQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/images/:image/promote` */ imagePromote: (params: { path: Api.ImagePromotePathParams; query: Api.ImagePromoteQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/instances` */ instanceList: (params: { query: Api.InstanceListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/instances` */ instanceCreate: (params: { query: Api.InstanceCreateQueryParams; body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/instances/:instance` */ instanceView: (params: { path: Api.InstanceViewPathParams; query: Api.InstanceViewQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `DELETE /v1/instances/:instance` */ instanceDelete: (params: { path: Api.InstanceDeletePathParams; query: Api.InstanceDeleteQueryParams; req: Request; + cookies: Record; }) => StatusCode; /** `GET /v1/instances/:instance/disks` */ instanceDiskList: (params: { path: Api.InstanceDiskListPathParams; query: Api.InstanceDiskListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/instances/:instance/disks/attach` */ instanceDiskAttach: (params: { @@ -220,6 +255,7 @@ export interface MSWHandlers { query: Api.InstanceDiskAttachQueryParams; body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/instances/:instance/disks/detach` */ instanceDiskDetach: (params: { @@ -227,12 +263,14 @@ export interface MSWHandlers { query: Api.InstanceDiskDetachQueryParams; body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/instances/:instance/external-ips` */ instanceExternalIpList: (params: { path: Api.InstanceExternalIpListPathParams; query: Api.InstanceExternalIpListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/instances/:instance/migrate` */ instanceMigrate: (params: { @@ -240,105 +278,129 @@ export interface MSWHandlers { query: Api.InstanceMigrateQueryParams; body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/instances/:instance/reboot` */ instanceReboot: (params: { path: Api.InstanceRebootPathParams; query: Api.InstanceRebootQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/instances/:instance/serial-console` */ instanceSerialConsole: (params: { path: Api.InstanceSerialConsolePathParams; query: Api.InstanceSerialConsoleQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/instances/:instance/serial-console/stream` */ instanceSerialConsoleStream: (params: { path: Api.InstanceSerialConsoleStreamPathParams; query: Api.InstanceSerialConsoleStreamQueryParams; req: Request; + cookies: Record; }) => StatusCode; /** `POST /v1/instances/:instance/start` */ instanceStart: (params: { path: Api.InstanceStartPathParams; query: Api.InstanceStartQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/instances/:instance/stop` */ instanceStop: (params: { path: Api.InstanceStopPathParams; query: Api.InstanceStopQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/ip-pools` */ projectIpPoolList: (params: { query: Api.ProjectIpPoolListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/ip-pools/:pool` */ projectIpPoolView: (params: { path: Api.ProjectIpPoolViewPathParams; query: Api.ProjectIpPoolViewQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/login/:siloName/local` */ loginLocal: (params: { path: Api.LoginLocalPathParams; body: Json; req: Request; + cookies: Record; }) => StatusCode; /** `POST /v1/logout` */ - logout: (params: { req: Request }) => StatusCode; + logout: (params: { + req: Request; + cookies: Record; + }) => StatusCode; /** `GET /v1/me` */ - currentUserView: (params: { req: Request }) => HandlerResult; + currentUserView: (params: { + req: Request; + cookies: Record; + }) => HandlerResult; /** `GET /v1/me/groups` */ currentUserGroups: (params: { query: Api.CurrentUserGroupsQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/me/ssh-keys` */ currentUserSshKeyList: (params: { query: Api.CurrentUserSshKeyListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/me/ssh-keys` */ currentUserSshKeyCreate: (params: { body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/me/ssh-keys/:sshKey` */ currentUserSshKeyView: (params: { path: Api.CurrentUserSshKeyViewPathParams; req: Request; + cookies: Record; }) => HandlerResult; /** `DELETE /v1/me/ssh-keys/:sshKey` */ currentUserSshKeyDelete: (params: { path: Api.CurrentUserSshKeyDeletePathParams; req: Request; + cookies: Record; }) => StatusCode; /** `GET /v1/metrics/:metricName` */ siloMetric: (params: { path: Api.SiloMetricPathParams; query: Api.SiloMetricQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/network-interfaces` */ instanceNetworkInterfaceList: (params: { query: Api.InstanceNetworkInterfaceListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/network-interfaces` */ instanceNetworkInterfaceCreate: (params: { query: Api.InstanceNetworkInterfaceCreateQueryParams; body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/network-interfaces/:interface` */ instanceNetworkInterfaceView: (params: { path: Api.InstanceNetworkInterfaceViewPathParams; query: Api.InstanceNetworkInterfaceViewQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `PUT /v1/network-interfaces/:interface` */ instanceNetworkInterfaceUpdate: (params: { @@ -346,121 +408,146 @@ export interface MSWHandlers { query: Api.InstanceNetworkInterfaceUpdateQueryParams; body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `DELETE /v1/network-interfaces/:interface` */ instanceNetworkInterfaceDelete: (params: { path: Api.InstanceNetworkInterfaceDeletePathParams; query: Api.InstanceNetworkInterfaceDeleteQueryParams; req: Request; + cookies: Record; }) => StatusCode; /** `GET /v1/policy` */ - policyView: (params: { req: Request }) => HandlerResult; + policyView: (params: { + req: Request; + cookies: Record; + }) => HandlerResult; /** `PUT /v1/policy` */ policyUpdate: (params: { body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/projects` */ projectList: (params: { query: Api.ProjectListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/projects` */ projectCreate: (params: { body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/projects/:project` */ projectView: (params: { path: Api.ProjectViewPathParams; req: Request; + cookies: Record; }) => HandlerResult; /** `PUT /v1/projects/:project` */ projectUpdate: (params: { path: Api.ProjectUpdatePathParams; body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `DELETE /v1/projects/:project` */ projectDelete: (params: { path: Api.ProjectDeletePathParams; req: Request; + cookies: Record; }) => StatusCode; /** `GET /v1/projects/:project/policy` */ projectPolicyView: (params: { path: Api.ProjectPolicyViewPathParams; req: Request; + cookies: Record; }) => HandlerResult; /** `PUT /v1/projects/:project/policy` */ projectPolicyUpdate: (params: { path: Api.ProjectPolicyUpdatePathParams; body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/snapshots` */ snapshotList: (params: { query: Api.SnapshotListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/snapshots` */ snapshotCreate: (params: { query: Api.SnapshotCreateQueryParams; body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/snapshots/:snapshot` */ snapshotView: (params: { path: Api.SnapshotViewPathParams; query: Api.SnapshotViewQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `DELETE /v1/snapshots/:snapshot` */ snapshotDelete: (params: { path: Api.SnapshotDeletePathParams; query: Api.SnapshotDeleteQueryParams; req: Request; + cookies: Record; }) => StatusCode; /** `GET /v1/system/hardware/disks` */ physicalDiskList: (params: { query: Api.PhysicalDiskListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/system/hardware/racks` */ rackList: (params: { query: Api.RackListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/system/hardware/racks/:rackId` */ rackView: (params: { path: Api.RackViewPathParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/system/hardware/sleds` */ sledList: (params: { query: Api.SledListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/system/hardware/sleds/:sledId` */ sledView: (params: { path: Api.SledViewPathParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/system/hardware/sleds/:sledId/disks` */ sledPhysicalDiskList: (params: { path: Api.SledPhysicalDiskListPathParams; query: Api.SledPhysicalDiskListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/system/hardware/sleds/:sledId/instances` */ sledInstanceList: (params: { path: Api.SledInstanceListPathParams; query: Api.SledInstanceListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/system/hardware/switch-port` */ networkingSwitchPortList: (params: { query: Api.NetworkingSwitchPortListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/system/hardware/switch-port/:port/settings` */ networkingSwitchPortApplySettings: (params: { @@ -468,39 +555,46 @@ export interface MSWHandlers { query: Api.NetworkingSwitchPortApplySettingsQueryParams; body: Json; req: Request; + cookies: Record; }) => StatusCode; /** `DELETE /v1/system/hardware/switch-port/:port/settings` */ networkingSwitchPortClearSettings: (params: { path: Api.NetworkingSwitchPortClearSettingsPathParams; query: Api.NetworkingSwitchPortClearSettingsQueryParams; req: Request; + cookies: Record; }) => StatusCode; /** `GET /v1/system/hardware/switches` */ switchList: (params: { query: Api.SwitchListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/system/hardware/switches/:switchId` */ switchView: (params: { path: Api.SwitchViewPathParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/system/identity-providers` */ siloIdentityProviderList: (params: { query: Api.SiloIdentityProviderListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/system/identity-providers/local/users` */ localIdpUserCreate: (params: { query: Api.LocalIdpUserCreateQueryParams; body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `DELETE /v1/system/identity-providers/local/users/:userId` */ localIdpUserDelete: (params: { path: Api.LocalIdpUserDeletePathParams; query: Api.LocalIdpUserDeleteQueryParams; req: Request; + cookies: Record; }) => StatusCode; /** `POST /v1/system/identity-providers/local/users/:userId/set-password` */ localIdpUserSetPassword: (params: { @@ -508,245 +602,294 @@ export interface MSWHandlers { query: Api.LocalIdpUserSetPasswordQueryParams; body: Json; req: Request; + cookies: Record; }) => StatusCode; /** `POST /v1/system/identity-providers/saml` */ samlIdentityProviderCreate: (params: { query: Api.SamlIdentityProviderCreateQueryParams; body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/system/identity-providers/saml/:provider` */ samlIdentityProviderView: (params: { path: Api.SamlIdentityProviderViewPathParams; query: Api.SamlIdentityProviderViewQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/system/ip-pools` */ ipPoolList: (params: { query: Api.IpPoolListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/system/ip-pools` */ ipPoolCreate: (params: { body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/system/ip-pools/:pool` */ ipPoolView: (params: { path: Api.IpPoolViewPathParams; req: Request; + cookies: Record; }) => HandlerResult; /** `PUT /v1/system/ip-pools/:pool` */ ipPoolUpdate: (params: { path: Api.IpPoolUpdatePathParams; body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `DELETE /v1/system/ip-pools/:pool` */ ipPoolDelete: (params: { path: Api.IpPoolDeletePathParams; req: Request; + cookies: Record; }) => StatusCode; /** `GET /v1/system/ip-pools/:pool/ranges` */ ipPoolRangeList: (params: { path: Api.IpPoolRangeListPathParams; query: Api.IpPoolRangeListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/system/ip-pools/:pool/ranges/add` */ ipPoolRangeAdd: (params: { path: Api.IpPoolRangeAddPathParams; body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/system/ip-pools/:pool/ranges/remove` */ ipPoolRangeRemove: (params: { path: Api.IpPoolRangeRemovePathParams; body: Json; req: Request; + cookies: Record; }) => StatusCode; /** `GET /v1/system/ip-pools-service` */ - ipPoolServiceView: (params: { req: Request }) => HandlerResult; + ipPoolServiceView: (params: { + req: Request; + cookies: Record; + }) => HandlerResult; /** `GET /v1/system/ip-pools-service/ranges` */ ipPoolServiceRangeList: (params: { query: Api.IpPoolServiceRangeListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/system/ip-pools-service/ranges/add` */ ipPoolServiceRangeAdd: (params: { body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/system/ip-pools-service/ranges/remove` */ ipPoolServiceRangeRemove: (params: { body: Json; req: Request; + cookies: Record; }) => StatusCode; /** `GET /v1/system/metrics/:metricName` */ systemMetric: (params: { path: Api.SystemMetricPathParams; query: Api.SystemMetricQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/system/networking/address-lot` */ networkingAddressLotList: (params: { query: Api.NetworkingAddressLotListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/system/networking/address-lot` */ networkingAddressLotCreate: (params: { body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `DELETE /v1/system/networking/address-lot/:addressLot` */ networkingAddressLotDelete: (params: { path: Api.NetworkingAddressLotDeletePathParams; req: Request; + cookies: Record; }) => StatusCode; /** `GET /v1/system/networking/address-lot/:addressLot/blocks` */ networkingAddressLotBlockList: (params: { path: Api.NetworkingAddressLotBlockListPathParams; query: Api.NetworkingAddressLotBlockListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/system/networking/loopback-address` */ networkingLoopbackAddressList: (params: { query: Api.NetworkingLoopbackAddressListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/system/networking/loopback-address` */ networkingLoopbackAddressCreate: (params: { body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `DELETE /v1/system/networking/loopback-address/:rackId/:switchLocation/:address/:subnetMask` */ networkingLoopbackAddressDelete: (params: { path: Api.NetworkingLoopbackAddressDeletePathParams; req: Request; + cookies: Record; }) => StatusCode; /** `GET /v1/system/networking/switch-port-settings` */ networkingSwitchPortSettingsList: (params: { query: Api.NetworkingSwitchPortSettingsListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/system/networking/switch-port-settings` */ networkingSwitchPortSettingsCreate: (params: { body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `DELETE /v1/system/networking/switch-port-settings` */ networkingSwitchPortSettingsDelete: (params: { query: Api.NetworkingSwitchPortSettingsDeleteQueryParams; req: Request; + cookies: Record; }) => StatusCode; /** `GET /v1/system/networking/switch-port-settings/:port` */ networkingSwitchPortSettingsView: (params: { path: Api.NetworkingSwitchPortSettingsViewPathParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/system/policy` */ systemPolicyView: (params: { req: Request; + cookies: Record; }) => HandlerResult; /** `PUT /v1/system/policy` */ systemPolicyUpdate: (params: { body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/system/roles` */ roleList: (params: { query: Api.RoleListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/system/roles/:roleName` */ roleView: (params: { path: Api.RoleViewPathParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/system/silos` */ siloList: (params: { query: Api.SiloListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/system/silos` */ siloCreate: (params: { body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/system/silos/:silo` */ siloView: (params: { path: Api.SiloViewPathParams; req: Request; + cookies: Record; }) => HandlerResult; /** `DELETE /v1/system/silos/:silo` */ siloDelete: (params: { path: Api.SiloDeletePathParams; req: Request; + cookies: Record; }) => StatusCode; /** `GET /v1/system/silos/:silo/policy` */ siloPolicyView: (params: { path: Api.SiloPolicyViewPathParams; req: Request; + cookies: Record; }) => HandlerResult; /** `PUT /v1/system/silos/:silo/policy` */ siloPolicyUpdate: (params: { path: Api.SiloPolicyUpdatePathParams; body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/system/users` */ siloUserList: (params: { query: Api.SiloUserListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/system/users/:userId` */ siloUserView: (params: { path: Api.SiloUserViewPathParams; query: Api.SiloUserViewQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/system/users-builtin` */ userBuiltinList: (params: { query: Api.UserBuiltinListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/system/users-builtin/:user` */ userBuiltinView: (params: { path: Api.UserBuiltinViewPathParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/users` */ userList: (params: { query: Api.UserListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/vpc-firewall-rules` */ vpcFirewallRulesView: (params: { query: Api.VpcFirewallRulesViewQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `PUT /v1/vpc-firewall-rules` */ vpcFirewallRulesUpdate: (params: { query: Api.VpcFirewallRulesUpdateQueryParams; body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/vpc-router-routes` */ vpcRouterRouteList: (params: { query: Api.VpcRouterRouteListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/vpc-router-routes` */ vpcRouterRouteCreate: (params: { query: Api.VpcRouterRouteCreateQueryParams; body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/vpc-router-routes/:route` */ vpcRouterRouteView: (params: { path: Api.VpcRouterRouteViewPathParams; query: Api.VpcRouterRouteViewQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `PUT /v1/vpc-router-routes/:route` */ vpcRouterRouteUpdate: (params: { @@ -754,29 +897,34 @@ export interface MSWHandlers { query: Api.VpcRouterRouteUpdateQueryParams; body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `DELETE /v1/vpc-router-routes/:route` */ vpcRouterRouteDelete: (params: { path: Api.VpcRouterRouteDeletePathParams; query: Api.VpcRouterRouteDeleteQueryParams; req: Request; + cookies: Record; }) => StatusCode; /** `GET /v1/vpc-routers` */ vpcRouterList: (params: { query: Api.VpcRouterListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/vpc-routers` */ vpcRouterCreate: (params: { query: Api.VpcRouterCreateQueryParams; body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/vpc-routers/:router` */ vpcRouterView: (params: { path: Api.VpcRouterViewPathParams; query: Api.VpcRouterViewQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `PUT /v1/vpc-routers/:router` */ vpcRouterUpdate: (params: { @@ -784,29 +932,34 @@ export interface MSWHandlers { query: Api.VpcRouterUpdateQueryParams; body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `DELETE /v1/vpc-routers/:router` */ vpcRouterDelete: (params: { path: Api.VpcRouterDeletePathParams; query: Api.VpcRouterDeleteQueryParams; req: Request; + cookies: Record; }) => StatusCode; /** `GET /v1/vpc-subnets` */ vpcSubnetList: (params: { query: Api.VpcSubnetListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/vpc-subnets` */ vpcSubnetCreate: (params: { query: Api.VpcSubnetCreateQueryParams; body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/vpc-subnets/:subnet` */ vpcSubnetView: (params: { path: Api.VpcSubnetViewPathParams; query: Api.VpcSubnetViewQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `PUT /v1/vpc-subnets/:subnet` */ vpcSubnetUpdate: (params: { @@ -814,35 +967,41 @@ export interface MSWHandlers { query: Api.VpcSubnetUpdateQueryParams; body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `DELETE /v1/vpc-subnets/:subnet` */ vpcSubnetDelete: (params: { path: Api.VpcSubnetDeletePathParams; query: Api.VpcSubnetDeleteQueryParams; req: Request; + cookies: Record; }) => StatusCode; /** `GET /v1/vpc-subnets/:subnet/network-interfaces` */ vpcSubnetListNetworkInterfaces: (params: { path: Api.VpcSubnetListNetworkInterfacesPathParams; query: Api.VpcSubnetListNetworkInterfacesQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/vpcs` */ vpcList: (params: { query: Api.VpcListQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `POST /v1/vpcs` */ vpcCreate: (params: { query: Api.VpcCreateQueryParams; body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `GET /v1/vpcs/:vpc` */ vpcView: (params: { path: Api.VpcViewPathParams; query: Api.VpcViewQueryParams; req: Request; + cookies: Record; }) => HandlerResult; /** `PUT /v1/vpcs/:vpc` */ vpcUpdate: (params: { @@ -850,12 +1009,14 @@ export interface MSWHandlers { query: Api.VpcUpdateQueryParams; body: Json; req: Request; + cookies: Record; }) => HandlerResult; /** `DELETE /v1/vpcs/:vpc` */ vpcDelete: (params: { path: Api.VpcDeletePathParams; query: Api.VpcDeleteQueryParams; req: Request; + cookies: Record; }) => StatusCode; } @@ -952,37 +1113,37 @@ const handler = } }; -export function makeHandlers(handlers: MSWHandlers): RestHandler[] { +export function makeHandlers(handlers: MSWHandlers): HttpHandler[] { return [ - rest.post( + http.post( "/device/auth", handler(handlers["deviceAuthRequest"], null, null) ), - rest.post( + http.post( "/device/confirm", handler(handlers["deviceAuthConfirm"], null, schema.DeviceAuthVerify) ), - rest.post( + http.post( "/device/token", handler(handlers["deviceAccessToken"], null, null) ), - rest.post( + http.post( "/login/:siloName/saml/:providerName", handler(handlers["loginSaml"], schema.LoginSamlParams, null) ), - rest.get( + http.get( "/v1/certificates", handler(handlers["certificateList"], schema.CertificateListParams, null) ), - rest.post( + http.post( "/v1/certificates", handler(handlers["certificateCreate"], null, schema.CertificateCreate) ), - rest.get( + http.get( "/v1/certificates/:certificate", handler(handlers["certificateView"], schema.CertificateViewParams, null) ), - rest.delete( + http.delete( "/v1/certificates/:certificate", handler( handlers["certificateDelete"], @@ -990,11 +1151,11 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.get( + http.get( "/v1/disks", handler(handlers["diskList"], schema.DiskListParams, null) ), - rest.post( + http.post( "/v1/disks", handler( handlers["diskCreate"], @@ -1002,15 +1163,15 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.DiskCreate ) ), - rest.get( + http.get( "/v1/disks/:disk", handler(handlers["diskView"], schema.DiskViewParams, null) ), - rest.delete( + http.delete( "/v1/disks/:disk", handler(handlers["diskDelete"], schema.DiskDeleteParams, null) ), - rest.post( + http.post( "/v1/disks/:disk/bulk-write", handler( handlers["diskBulkWriteImport"], @@ -1018,7 +1179,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.ImportBlocksBulkWrite ) ), - rest.post( + http.post( "/v1/disks/:disk/bulk-write-start", handler( handlers["diskBulkWriteImportStart"], @@ -1026,7 +1187,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.post( + http.post( "/v1/disks/:disk/bulk-write-stop", handler( handlers["diskBulkWriteImportStop"], @@ -1034,7 +1195,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.post( + http.post( "/v1/disks/:disk/finalize", handler( handlers["diskFinalizeImport"], @@ -1042,7 +1203,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.FinalizeDisk ) ), - rest.post( + http.post( "/v1/disks/:disk/import", handler( handlers["diskImportBlocksFromUrl"], @@ -1050,23 +1211,23 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.ImportBlocksFromUrl ) ), - rest.get( + http.get( "/v1/disks/:disk/metrics/:metric", handler(handlers["diskMetricsList"], schema.DiskMetricsListParams, null) ), - rest.get( + http.get( "/v1/groups", handler(handlers["groupList"], schema.GroupListParams, null) ), - rest.get( + http.get( "/v1/groups/:groupId", handler(handlers["groupView"], schema.GroupViewParams, null) ), - rest.get( + http.get( "/v1/images", handler(handlers["imageList"], schema.ImageListParams, null) ), - rest.post( + http.post( "/v1/images", handler( handlers["imageCreate"], @@ -1074,27 +1235,27 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.ImageCreate ) ), - rest.get( + http.get( "/v1/images/:image", handler(handlers["imageView"], schema.ImageViewParams, null) ), - rest.delete( + http.delete( "/v1/images/:image", handler(handlers["imageDelete"], schema.ImageDeleteParams, null) ), - rest.post( + http.post( "/v1/images/:image/demote", handler(handlers["imageDemote"], schema.ImageDemoteParams, null) ), - rest.post( + http.post( "/v1/images/:image/promote", handler(handlers["imagePromote"], schema.ImagePromoteParams, null) ), - rest.get( + http.get( "/v1/instances", handler(handlers["instanceList"], schema.InstanceListParams, null) ), - rest.post( + http.post( "/v1/instances", handler( handlers["instanceCreate"], @@ -1102,19 +1263,19 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.InstanceCreate ) ), - rest.get( + http.get( "/v1/instances/:instance", handler(handlers["instanceView"], schema.InstanceViewParams, null) ), - rest.delete( + http.delete( "/v1/instances/:instance", handler(handlers["instanceDelete"], schema.InstanceDeleteParams, null) ), - rest.get( + http.get( "/v1/instances/:instance/disks", handler(handlers["instanceDiskList"], schema.InstanceDiskListParams, null) ), - rest.post( + http.post( "/v1/instances/:instance/disks/attach", handler( handlers["instanceDiskAttach"], @@ -1122,7 +1283,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.DiskPath ) ), - rest.post( + http.post( "/v1/instances/:instance/disks/detach", handler( handlers["instanceDiskDetach"], @@ -1130,7 +1291,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.DiskPath ) ), - rest.get( + http.get( "/v1/instances/:instance/external-ips", handler( handlers["instanceExternalIpList"], @@ -1138,7 +1299,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.post( + http.post( "/v1/instances/:instance/migrate", handler( handlers["instanceMigrate"], @@ -1146,11 +1307,11 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.InstanceMigrate ) ), - rest.post( + http.post( "/v1/instances/:instance/reboot", handler(handlers["instanceReboot"], schema.InstanceRebootParams, null) ), - rest.get( + http.get( "/v1/instances/:instance/serial-console", handler( handlers["instanceSerialConsole"], @@ -1158,7 +1319,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.get( + http.get( "/v1/instances/:instance/serial-console/stream", handler( handlers["instanceSerialConsoleStream"], @@ -1166,15 +1327,15 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.post( + http.post( "/v1/instances/:instance/start", handler(handlers["instanceStart"], schema.InstanceStartParams, null) ), - rest.post( + http.post( "/v1/instances/:instance/stop", handler(handlers["instanceStop"], schema.InstanceStopParams, null) ), - rest.get( + http.get( "/v1/ip-pools", handler( handlers["projectIpPoolList"], @@ -1182,7 +1343,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.get( + http.get( "/v1/ip-pools/:pool", handler( handlers["projectIpPoolView"], @@ -1190,7 +1351,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.post( + http.post( "/v1/login/:siloName/local", handler( handlers["loginLocal"], @@ -1198,9 +1359,9 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.UsernamePasswordCredentials ) ), - rest.post("/v1/logout", handler(handlers["logout"], null, null)), - rest.get("/v1/me", handler(handlers["currentUserView"], null, null)), - rest.get( + http.post("/v1/logout", handler(handlers["logout"], null, null)), + http.get("/v1/me", handler(handlers["currentUserView"], null, null)), + http.get( "/v1/me/groups", handler( handlers["currentUserGroups"], @@ -1208,7 +1369,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.get( + http.get( "/v1/me/ssh-keys", handler( handlers["currentUserSshKeyList"], @@ -1216,11 +1377,11 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.post( + http.post( "/v1/me/ssh-keys", handler(handlers["currentUserSshKeyCreate"], null, schema.SshKeyCreate) ), - rest.get( + http.get( "/v1/me/ssh-keys/:sshKey", handler( handlers["currentUserSshKeyView"], @@ -1228,7 +1389,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.delete( + http.delete( "/v1/me/ssh-keys/:sshKey", handler( handlers["currentUserSshKeyDelete"], @@ -1236,11 +1397,11 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.get( + http.get( "/v1/metrics/:metricName", handler(handlers["siloMetric"], schema.SiloMetricParams, null) ), - rest.get( + http.get( "/v1/network-interfaces", handler( handlers["instanceNetworkInterfaceList"], @@ -1248,7 +1409,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.post( + http.post( "/v1/network-interfaces", handler( handlers["instanceNetworkInterfaceCreate"], @@ -1256,7 +1417,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.InstanceNetworkInterfaceCreate ) ), - rest.get( + http.get( "/v1/network-interfaces/:interface", handler( handlers["instanceNetworkInterfaceView"], @@ -1264,7 +1425,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.put( + http.put( "/v1/network-interfaces/:interface", handler( handlers["instanceNetworkInterfaceUpdate"], @@ -1272,7 +1433,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.InstanceNetworkInterfaceUpdate ) ), - rest.delete( + http.delete( "/v1/network-interfaces/:interface", handler( handlers["instanceNetworkInterfaceDelete"], @@ -1280,24 +1441,24 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.get("/v1/policy", handler(handlers["policyView"], null, null)), - rest.put( + http.get("/v1/policy", handler(handlers["policyView"], null, null)), + http.put( "/v1/policy", handler(handlers["policyUpdate"], null, schema.SiloRolePolicy) ), - rest.get( + http.get( "/v1/projects", handler(handlers["projectList"], schema.ProjectListParams, null) ), - rest.post( + http.post( "/v1/projects", handler(handlers["projectCreate"], null, schema.ProjectCreate) ), - rest.get( + http.get( "/v1/projects/:project", handler(handlers["projectView"], schema.ProjectViewParams, null) ), - rest.put( + http.put( "/v1/projects/:project", handler( handlers["projectUpdate"], @@ -1305,11 +1466,11 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.ProjectUpdate ) ), - rest.delete( + http.delete( "/v1/projects/:project", handler(handlers["projectDelete"], schema.ProjectDeleteParams, null) ), - rest.get( + http.get( "/v1/projects/:project/policy", handler( handlers["projectPolicyView"], @@ -1317,7 +1478,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.put( + http.put( "/v1/projects/:project/policy", handler( handlers["projectPolicyUpdate"], @@ -1325,11 +1486,11 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.ProjectRolePolicy ) ), - rest.get( + http.get( "/v1/snapshots", handler(handlers["snapshotList"], schema.SnapshotListParams, null) ), - rest.post( + http.post( "/v1/snapshots", handler( handlers["snapshotCreate"], @@ -1337,35 +1498,35 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.SnapshotCreate ) ), - rest.get( + http.get( "/v1/snapshots/:snapshot", handler(handlers["snapshotView"], schema.SnapshotViewParams, null) ), - rest.delete( + http.delete( "/v1/snapshots/:snapshot", handler(handlers["snapshotDelete"], schema.SnapshotDeleteParams, null) ), - rest.get( + http.get( "/v1/system/hardware/disks", handler(handlers["physicalDiskList"], schema.PhysicalDiskListParams, null) ), - rest.get( + http.get( "/v1/system/hardware/racks", handler(handlers["rackList"], schema.RackListParams, null) ), - rest.get( + http.get( "/v1/system/hardware/racks/:rackId", handler(handlers["rackView"], schema.RackViewParams, null) ), - rest.get( + http.get( "/v1/system/hardware/sleds", handler(handlers["sledList"], schema.SledListParams, null) ), - rest.get( + http.get( "/v1/system/hardware/sleds/:sledId", handler(handlers["sledView"], schema.SledViewParams, null) ), - rest.get( + http.get( "/v1/system/hardware/sleds/:sledId/disks", handler( handlers["sledPhysicalDiskList"], @@ -1373,11 +1534,11 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.get( + http.get( "/v1/system/hardware/sleds/:sledId/instances", handler(handlers["sledInstanceList"], schema.SledInstanceListParams, null) ), - rest.get( + http.get( "/v1/system/hardware/switch-port", handler( handlers["networkingSwitchPortList"], @@ -1385,7 +1546,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.post( + http.post( "/v1/system/hardware/switch-port/:port/settings", handler( handlers["networkingSwitchPortApplySettings"], @@ -1393,7 +1554,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.SwitchPortApplySettings ) ), - rest.delete( + http.delete( "/v1/system/hardware/switch-port/:port/settings", handler( handlers["networkingSwitchPortClearSettings"], @@ -1401,15 +1562,15 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.get( + http.get( "/v1/system/hardware/switches", handler(handlers["switchList"], schema.SwitchListParams, null) ), - rest.get( + http.get( "/v1/system/hardware/switches/:switchId", handler(handlers["switchView"], schema.SwitchViewParams, null) ), - rest.get( + http.get( "/v1/system/identity-providers", handler( handlers["siloIdentityProviderList"], @@ -1417,7 +1578,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.post( + http.post( "/v1/system/identity-providers/local/users", handler( handlers["localIdpUserCreate"], @@ -1425,7 +1586,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.UserCreate ) ), - rest.delete( + http.delete( "/v1/system/identity-providers/local/users/:userId", handler( handlers["localIdpUserDelete"], @@ -1433,7 +1594,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.post( + http.post( "/v1/system/identity-providers/local/users/:userId/set-password", handler( handlers["localIdpUserSetPassword"], @@ -1441,7 +1602,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.UserPassword ) ), - rest.post( + http.post( "/v1/system/identity-providers/saml", handler( handlers["samlIdentityProviderCreate"], @@ -1449,7 +1610,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.SamlIdentityProviderCreate ) ), - rest.get( + http.get( "/v1/system/identity-providers/saml/:provider", handler( handlers["samlIdentityProviderView"], @@ -1457,19 +1618,19 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.get( + http.get( "/v1/system/ip-pools", handler(handlers["ipPoolList"], schema.IpPoolListParams, null) ), - rest.post( + http.post( "/v1/system/ip-pools", handler(handlers["ipPoolCreate"], null, schema.IpPoolCreate) ), - rest.get( + http.get( "/v1/system/ip-pools/:pool", handler(handlers["ipPoolView"], schema.IpPoolViewParams, null) ), - rest.put( + http.put( "/v1/system/ip-pools/:pool", handler( handlers["ipPoolUpdate"], @@ -1477,15 +1638,15 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.IpPoolUpdate ) ), - rest.delete( + http.delete( "/v1/system/ip-pools/:pool", handler(handlers["ipPoolDelete"], schema.IpPoolDeleteParams, null) ), - rest.get( + http.get( "/v1/system/ip-pools/:pool/ranges", handler(handlers["ipPoolRangeList"], schema.IpPoolRangeListParams, null) ), - rest.post( + http.post( "/v1/system/ip-pools/:pool/ranges/add", handler( handlers["ipPoolRangeAdd"], @@ -1493,7 +1654,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.IpRange ) ), - rest.post( + http.post( "/v1/system/ip-pools/:pool/ranges/remove", handler( handlers["ipPoolRangeRemove"], @@ -1501,11 +1662,11 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.IpRange ) ), - rest.get( + http.get( "/v1/system/ip-pools-service", handler(handlers["ipPoolServiceView"], null, null) ), - rest.get( + http.get( "/v1/system/ip-pools-service/ranges", handler( handlers["ipPoolServiceRangeList"], @@ -1513,19 +1674,19 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.post( + http.post( "/v1/system/ip-pools-service/ranges/add", handler(handlers["ipPoolServiceRangeAdd"], null, schema.IpRange) ), - rest.post( + http.post( "/v1/system/ip-pools-service/ranges/remove", handler(handlers["ipPoolServiceRangeRemove"], null, schema.IpRange) ), - rest.get( + http.get( "/v1/system/metrics/:metricName", handler(handlers["systemMetric"], schema.SystemMetricParams, null) ), - rest.get( + http.get( "/v1/system/networking/address-lot", handler( handlers["networkingAddressLotList"], @@ -1533,7 +1694,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.post( + http.post( "/v1/system/networking/address-lot", handler( handlers["networkingAddressLotCreate"], @@ -1541,7 +1702,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.AddressLotCreate ) ), - rest.delete( + http.delete( "/v1/system/networking/address-lot/:addressLot", handler( handlers["networkingAddressLotDelete"], @@ -1549,7 +1710,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.get( + http.get( "/v1/system/networking/address-lot/:addressLot/blocks", handler( handlers["networkingAddressLotBlockList"], @@ -1557,7 +1718,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.get( + http.get( "/v1/system/networking/loopback-address", handler( handlers["networkingLoopbackAddressList"], @@ -1565,7 +1726,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.post( + http.post( "/v1/system/networking/loopback-address", handler( handlers["networkingLoopbackAddressCreate"], @@ -1573,7 +1734,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.LoopbackAddressCreate ) ), - rest.delete( + http.delete( "/v1/system/networking/loopback-address/:rackId/:switchLocation/:address/:subnetMask", handler( handlers["networkingLoopbackAddressDelete"], @@ -1581,7 +1742,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.get( + http.get( "/v1/system/networking/switch-port-settings", handler( handlers["networkingSwitchPortSettingsList"], @@ -1589,7 +1750,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.post( + http.post( "/v1/system/networking/switch-port-settings", handler( handlers["networkingSwitchPortSettingsCreate"], @@ -1597,7 +1758,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.SwitchPortSettingsCreate ) ), - rest.delete( + http.delete( "/v1/system/networking/switch-port-settings", handler( handlers["networkingSwitchPortSettingsDelete"], @@ -1605,7 +1766,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.get( + http.get( "/v1/system/networking/switch-port-settings/:port", handler( handlers["networkingSwitchPortSettingsView"], @@ -1613,43 +1774,43 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.get( + http.get( "/v1/system/policy", handler(handlers["systemPolicyView"], null, null) ), - rest.put( + http.put( "/v1/system/policy", handler(handlers["systemPolicyUpdate"], null, schema.FleetRolePolicy) ), - rest.get( + http.get( "/v1/system/roles", handler(handlers["roleList"], schema.RoleListParams, null) ), - rest.get( + http.get( "/v1/system/roles/:roleName", handler(handlers["roleView"], schema.RoleViewParams, null) ), - rest.get( + http.get( "/v1/system/silos", handler(handlers["siloList"], schema.SiloListParams, null) ), - rest.post( + http.post( "/v1/system/silos", handler(handlers["siloCreate"], null, schema.SiloCreate) ), - rest.get( + http.get( "/v1/system/silos/:silo", handler(handlers["siloView"], schema.SiloViewParams, null) ), - rest.delete( + http.delete( "/v1/system/silos/:silo", handler(handlers["siloDelete"], schema.SiloDeleteParams, null) ), - rest.get( + http.get( "/v1/system/silos/:silo/policy", handler(handlers["siloPolicyView"], schema.SiloPolicyViewParams, null) ), - rest.put( + http.put( "/v1/system/silos/:silo/policy", handler( handlers["siloPolicyUpdate"], @@ -1657,27 +1818,27 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.SiloRolePolicy ) ), - rest.get( + http.get( "/v1/system/users", handler(handlers["siloUserList"], schema.SiloUserListParams, null) ), - rest.get( + http.get( "/v1/system/users/:userId", handler(handlers["siloUserView"], schema.SiloUserViewParams, null) ), - rest.get( + http.get( "/v1/system/users-builtin", handler(handlers["userBuiltinList"], schema.UserBuiltinListParams, null) ), - rest.get( + http.get( "/v1/system/users-builtin/:user", handler(handlers["userBuiltinView"], schema.UserBuiltinViewParams, null) ), - rest.get( + http.get( "/v1/users", handler(handlers["userList"], schema.UserListParams, null) ), - rest.get( + http.get( "/v1/vpc-firewall-rules", handler( handlers["vpcFirewallRulesView"], @@ -1685,7 +1846,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.put( + http.put( "/v1/vpc-firewall-rules", handler( handlers["vpcFirewallRulesUpdate"], @@ -1693,7 +1854,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.VpcFirewallRuleUpdateParams ) ), - rest.get( + http.get( "/v1/vpc-router-routes", handler( handlers["vpcRouterRouteList"], @@ -1701,7 +1862,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.post( + http.post( "/v1/vpc-router-routes", handler( handlers["vpcRouterRouteCreate"], @@ -1709,7 +1870,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.RouterRouteCreate ) ), - rest.get( + http.get( "/v1/vpc-router-routes/:route", handler( handlers["vpcRouterRouteView"], @@ -1717,7 +1878,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.put( + http.put( "/v1/vpc-router-routes/:route", handler( handlers["vpcRouterRouteUpdate"], @@ -1725,7 +1886,7 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.RouterRouteUpdate ) ), - rest.delete( + http.delete( "/v1/vpc-router-routes/:route", handler( handlers["vpcRouterRouteDelete"], @@ -1733,11 +1894,11 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.get( + http.get( "/v1/vpc-routers", handler(handlers["vpcRouterList"], schema.VpcRouterListParams, null) ), - rest.post( + http.post( "/v1/vpc-routers", handler( handlers["vpcRouterCreate"], @@ -1745,11 +1906,11 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.VpcRouterCreate ) ), - rest.get( + http.get( "/v1/vpc-routers/:router", handler(handlers["vpcRouterView"], schema.VpcRouterViewParams, null) ), - rest.put( + http.put( "/v1/vpc-routers/:router", handler( handlers["vpcRouterUpdate"], @@ -1757,15 +1918,15 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.VpcRouterUpdate ) ), - rest.delete( + http.delete( "/v1/vpc-routers/:router", handler(handlers["vpcRouterDelete"], schema.VpcRouterDeleteParams, null) ), - rest.get( + http.get( "/v1/vpc-subnets", handler(handlers["vpcSubnetList"], schema.VpcSubnetListParams, null) ), - rest.post( + http.post( "/v1/vpc-subnets", handler( handlers["vpcSubnetCreate"], @@ -1773,11 +1934,11 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.VpcSubnetCreate ) ), - rest.get( + http.get( "/v1/vpc-subnets/:subnet", handler(handlers["vpcSubnetView"], schema.VpcSubnetViewParams, null) ), - rest.put( + http.put( "/v1/vpc-subnets/:subnet", handler( handlers["vpcSubnetUpdate"], @@ -1785,11 +1946,11 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { schema.VpcSubnetUpdate ) ), - rest.delete( + http.delete( "/v1/vpc-subnets/:subnet", handler(handlers["vpcSubnetDelete"], schema.VpcSubnetDeleteParams, null) ), - rest.get( + http.get( "/v1/vpc-subnets/:subnet/network-interfaces", handler( handlers["vpcSubnetListNetworkInterfaces"], @@ -1797,23 +1958,23 @@ export function makeHandlers(handlers: MSWHandlers): RestHandler[] { null ) ), - rest.get( + http.get( "/v1/vpcs", handler(handlers["vpcList"], schema.VpcListParams, null) ), - rest.post( + http.post( "/v1/vpcs", handler(handlers["vpcCreate"], schema.VpcCreateParams, schema.VpcCreate) ), - rest.get( + http.get( "/v1/vpcs/:vpc", handler(handlers["vpcView"], schema.VpcViewParams, null) ), - rest.put( + http.put( "/v1/vpcs/:vpc", handler(handlers["vpcUpdate"], schema.VpcUpdateParams, schema.VpcUpdate) ), - rest.delete( + http.delete( "/v1/vpcs/:vpc", handler(handlers["vpcDelete"], schema.VpcDeleteParams, null) ), diff --git a/generator/client/msw-handlers.ts b/generator/client/msw-handlers.ts index dbcffdb..7ff256e 100644 --- a/generator/client/msw-handlers.ts +++ b/generator/client/msw-handlers.ts @@ -35,8 +35,8 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) { w(` import { - rest, - RestHandler, + http, + HttpHandler, HttpResponse, StrictResponse, delay as doDelay, @@ -103,7 +103,7 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) { const queryParamsType = queryParams?.length ? `query: Api.${snakeToPascal(opId)}QueryParams,` : ""; - const params = `params: { ${pathParamsType} ${queryParamsType} ${body} req: Request }`; + const params = `params: { ${pathParamsType} ${queryParamsType} ${body} req: Request, cookies: Record }`; const resultType = successType === "void" ? "StatusCode" : `HandlerResult<${successType}>`; @@ -196,7 +196,7 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) { export function makeHandlers( handlers: MSWHandlers, - ): RestHandler[] { + ): HttpHandler[] { return [`); for (const { path, method, opId, conf } of iterPathConfig(spec.paths)) { const handler = snakeToCamel(opId); @@ -210,7 +210,7 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) { : "null"; w( - `rest.${method}('${formatPath( + `http.${method}('${formatPath( path )}', handler(handlers['${handler}'], ${paramSchema}, ${bodySchema})),` ); diff --git a/package-lock.json b/package-lock.json index 82c5f74..25d35ad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "devDependencies": { "@types/node": "^18.7.20", "esbuild-register": "^3.3.3", - "msw": "^0.0.0-fetch.rc-15", + "msw": "^2.0.0", "openapi-types": "^12.0.2", "prettier": "2.7.1", "swagger-parser": "^10.0.3", @@ -470,17 +470,17 @@ } }, "node_modules/@mswjs/interceptors": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@mswjs/interceptors/-/interceptors-0.23.0.tgz", - "integrity": "sha512-JytvDa7pBbxXvCTXBYQs+0eE6MqxpqH/H4peRNY6zVAlvJ6d/hAWLHAef1D9lWN4zuIigN0VkakGOAUrX7FWLg==", + "version": "0.25.7", + "resolved": "https://registry.npmjs.org/@mswjs/interceptors/-/interceptors-0.25.7.tgz", + "integrity": "sha512-U7iFYs/qU/5jfz1VDpoYz3xqX9nzhsBXw7q923dv6GiGTy+m2ZLhD33L80R/shHOW/YWjeH6k16GbIHGw+bAng==", "dev": true, "dependencies": { - "@open-draft/deferred-promise": "^2.1.0", + "@open-draft/deferred-promise": "^2.2.0", "@open-draft/logger": "^0.3.0", "@open-draft/until": "^2.0.0", - "headers-polyfill": "^3.1.0", + "is-node-process": "^1.2.0", "outvariant": "^1.2.1", - "strict-event-emitter": "^0.5.0" + "strict-event-emitter": "^0.5.1" }, "engines": { "node": ">=18" @@ -519,9 +519,9 @@ } }, "node_modules/@open-draft/deferred-promise": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@open-draft/deferred-promise/-/deferred-promise-2.1.0.tgz", - "integrity": "sha512-Rzd5JrXZX8zErHzgcGyngh4fmEbSHqTETdGj9rXtejlqMIgXFlyKBA7Jn1Xp0Ls0M0Y22+xHcWiEzbmdWl0BOA==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@open-draft/deferred-promise/-/deferred-promise-2.2.0.tgz", + "integrity": "sha512-CecwLWx3rhxVQF6V4bAgPS5t+So2sTbPgAzafKkVizyi7tlwpcFpdFqq+wqF2OwNBmqFuu6tOyouTuxgpMfzmA==", "dev": true }, "node_modules/@open-draft/logger": { @@ -614,9 +614,9 @@ "peer": true }, "node_modules/@types/statuses": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@types/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-vVRgv7WXbhIZzILgr58b4Ki2uqpN/dlVCUBWCMkPbMDlV1CrQrgCl5hnIoUlMrgymGcTmdfVqbs1yWj/IRIRtQ==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/statuses/-/statuses-2.0.3.tgz", + "integrity": "sha512-NwCYScf83RIwCyi5/9cXocrJB//xrqMh5PMw3mYTSFGaI3DuVjBLfO/PCk7QVAC3Da8b9NjxNmTO9Aj9T3rl/Q==", "dev": true }, "node_modules/@vitest/expect": { @@ -1858,9 +1858,9 @@ } }, "node_modules/graphql": { - "version": "16.7.1", - "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.7.1.tgz", - "integrity": "sha512-DRYR9tf+UGU0KOsMcKAlXeFfX89UiiIZ0dRU3mR0yJfu6OjZqUcp68NnFLnqQU5RexygFoDy1EW+ccOYcPfmHg==", + "version": "16.8.1", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.8.1.tgz", + "integrity": "sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw==", "dev": true, "engines": { "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" @@ -1928,9 +1928,9 @@ } }, "node_modules/headers-polyfill": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/headers-polyfill/-/headers-polyfill-3.1.2.tgz", - "integrity": "sha512-tWCK4biJ6hcLqTviLXVR9DTRfYGQMXEIUj3gwJ2rZ5wO/at3XtkI4g8mCvFdUF9l1KMBNCfmNAdnahm1cgavQA==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/headers-polyfill/-/headers-polyfill-4.0.2.tgz", + "integrity": "sha512-EWGTfnTqAO2L/j5HZgoM/3z82L7necsJ0pO9Tp0X1wil3PDLrkypTBRgVO2ExehEEvUycejZD3FuRaXpZZc3kw==", "dev": true }, "node_modules/html-encoding-sniffer": { @@ -2548,9 +2548,9 @@ "license": "MIT" }, "node_modules/msw": { - "version": "0.0.0-fetch.rc-15", - "resolved": "https://registry.npmjs.org/msw/-/msw-0.0.0-fetch.rc-15.tgz", - "integrity": "sha512-apgcCzSmsbJ1rUDpmhrjQAZDzEwOvfZD2VyBZVu6YMD+ovm8ow1buVzRE25IvzrtfIklN/fDbVavTa5lhqX4uQ==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/msw/-/msw-2.0.0.tgz", + "integrity": "sha512-lw9UHuzNCWoODHaThGeLLIIuzEBUQkj3fJXQnChHifMKbB2UmF2msHd4d/lnyqjAyD0XWoibdviW9wlstFPpkA==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -2558,7 +2558,7 @@ "@bundled-es-modules/js-levenshtein": "^2.0.1", "@bundled-es-modules/statuses": "^1.0.1", "@mswjs/cookies": "^1.0.0", - "@mswjs/interceptors": "^0.23.0", + "@mswjs/interceptors": "^0.25.1", "@open-draft/until": "^2.1.0", "@types/cookie": "^0.4.1", "@types/js-levenshtein": "^1.1.1", @@ -2566,8 +2566,8 @@ "chalk": "^4.1.2", "chokidar": "^3.4.2", "formdata-node": "4.4.1", - "graphql": "^15.0.0 || ^16.7.0", - "headers-polyfill": "^3.1.2", + "graphql": "^16.8.1", + "headers-polyfill": "^4.0.1", "inquirer": "^8.2.0", "is-node-process": "^1.2.0", "js-levenshtein": "^1.1.6", @@ -2589,7 +2589,7 @@ "url": "https://opencollective.com/mswjs" }, "peerDependencies": { - "typescript": ">= 4.4.x <= 5.1.x" + "typescript": ">= 4.7.x <= 5.2.x" }, "peerDependenciesMeta": { "typescript": { @@ -3368,9 +3368,9 @@ "dev": true }, "node_modules/strict-event-emitter": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/strict-event-emitter/-/strict-event-emitter-0.5.0.tgz", - "integrity": "sha512-sqnMpVJLSB3daNO6FcvsEk4Mq5IJeAwDeH80DP1S8+pgxrF6yZnE1+VeapesGled7nEcIkz1Ax87HzaIy+02kA==", + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/strict-event-emitter/-/strict-event-emitter-0.5.1.tgz", + "integrity": "sha512-vMgjE/GGEPEFnhFub6pa4FmJBRBVOLpIII2hvCZ8Kzb7K0hlHo7mQv6xYrBvCL2LtAIBwFUK8wvuJgTVSQ5MFQ==", "dev": true }, "node_modules/string_decoder": { @@ -4522,17 +4522,17 @@ "dev": true }, "@mswjs/interceptors": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@mswjs/interceptors/-/interceptors-0.23.0.tgz", - "integrity": "sha512-JytvDa7pBbxXvCTXBYQs+0eE6MqxpqH/H4peRNY6zVAlvJ6d/hAWLHAef1D9lWN4zuIigN0VkakGOAUrX7FWLg==", + "version": "0.25.7", + "resolved": "https://registry.npmjs.org/@mswjs/interceptors/-/interceptors-0.25.7.tgz", + "integrity": "sha512-U7iFYs/qU/5jfz1VDpoYz3xqX9nzhsBXw7q923dv6GiGTy+m2ZLhD33L80R/shHOW/YWjeH6k16GbIHGw+bAng==", "dev": true, "requires": { - "@open-draft/deferred-promise": "^2.1.0", + "@open-draft/deferred-promise": "^2.2.0", "@open-draft/logger": "^0.3.0", "@open-draft/until": "^2.0.0", - "headers-polyfill": "^3.1.0", + "is-node-process": "^1.2.0", "outvariant": "^1.2.1", - "strict-event-emitter": "^0.5.0" + "strict-event-emitter": "^0.5.1" } }, "@nodelib/fs.scandir": { @@ -4556,9 +4556,9 @@ } }, "@open-draft/deferred-promise": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@open-draft/deferred-promise/-/deferred-promise-2.1.0.tgz", - "integrity": "sha512-Rzd5JrXZX8zErHzgcGyngh4fmEbSHqTETdGj9rXtejlqMIgXFlyKBA7Jn1Xp0Ls0M0Y22+xHcWiEzbmdWl0BOA==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@open-draft/deferred-promise/-/deferred-promise-2.2.0.tgz", + "integrity": "sha512-CecwLWx3rhxVQF6V4bAgPS5t+So2sTbPgAzafKkVizyi7tlwpcFpdFqq+wqF2OwNBmqFuu6tOyouTuxgpMfzmA==", "dev": true }, "@open-draft/logger": { @@ -4641,9 +4641,9 @@ "peer": true }, "@types/statuses": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@types/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-vVRgv7WXbhIZzILgr58b4Ki2uqpN/dlVCUBWCMkPbMDlV1CrQrgCl5hnIoUlMrgymGcTmdfVqbs1yWj/IRIRtQ==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/statuses/-/statuses-2.0.3.tgz", + "integrity": "sha512-NwCYScf83RIwCyi5/9cXocrJB//xrqMh5PMw3mYTSFGaI3DuVjBLfO/PCk7QVAC3Da8b9NjxNmTO9Aj9T3rl/Q==", "dev": true }, "@vitest/expect": { @@ -5508,9 +5508,9 @@ } }, "graphql": { - "version": "16.7.1", - "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.7.1.tgz", - "integrity": "sha512-DRYR9tf+UGU0KOsMcKAlXeFfX89UiiIZ0dRU3mR0yJfu6OjZqUcp68NnFLnqQU5RexygFoDy1EW+ccOYcPfmHg==", + "version": "16.8.1", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.8.1.tgz", + "integrity": "sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw==", "dev": true }, "happy-dom": { @@ -5556,9 +5556,9 @@ "peer": true }, "headers-polyfill": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/headers-polyfill/-/headers-polyfill-3.1.2.tgz", - "integrity": "sha512-tWCK4biJ6hcLqTviLXVR9DTRfYGQMXEIUj3gwJ2rZ5wO/at3XtkI4g8mCvFdUF9l1KMBNCfmNAdnahm1cgavQA==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/headers-polyfill/-/headers-polyfill-4.0.2.tgz", + "integrity": "sha512-EWGTfnTqAO2L/j5HZgoM/3z82L7necsJ0pO9Tp0X1wil3PDLrkypTBRgVO2ExehEEvUycejZD3FuRaXpZZc3kw==", "dev": true }, "html-encoding-sniffer": { @@ -5993,16 +5993,16 @@ "dev": true }, "msw": { - "version": "0.0.0-fetch.rc-15", - "resolved": "https://registry.npmjs.org/msw/-/msw-0.0.0-fetch.rc-15.tgz", - "integrity": "sha512-apgcCzSmsbJ1rUDpmhrjQAZDzEwOvfZD2VyBZVu6YMD+ovm8ow1buVzRE25IvzrtfIklN/fDbVavTa5lhqX4uQ==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/msw/-/msw-2.0.0.tgz", + "integrity": "sha512-lw9UHuzNCWoODHaThGeLLIIuzEBUQkj3fJXQnChHifMKbB2UmF2msHd4d/lnyqjAyD0XWoibdviW9wlstFPpkA==", "dev": true, "requires": { "@bundled-es-modules/cookie": "^2.0.0", "@bundled-es-modules/js-levenshtein": "^2.0.1", "@bundled-es-modules/statuses": "^1.0.1", "@mswjs/cookies": "^1.0.0", - "@mswjs/interceptors": "^0.23.0", + "@mswjs/interceptors": "^0.25.1", "@open-draft/until": "^2.1.0", "@types/cookie": "^0.4.1", "@types/js-levenshtein": "^1.1.1", @@ -6010,8 +6010,8 @@ "chalk": "^4.1.2", "chokidar": "^3.4.2", "formdata-node": "4.4.1", - "graphql": "^15.0.0 || ^16.7.0", - "headers-polyfill": "^3.1.2", + "graphql": "^16.8.1", + "headers-polyfill": "^4.0.1", "inquirer": "^8.2.0", "is-node-process": "^1.2.0", "js-levenshtein": "^1.1.6", @@ -6504,9 +6504,9 @@ "dev": true }, "strict-event-emitter": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/strict-event-emitter/-/strict-event-emitter-0.5.0.tgz", - "integrity": "sha512-sqnMpVJLSB3daNO6FcvsEk4Mq5IJeAwDeH80DP1S8+pgxrF6yZnE1+VeapesGled7nEcIkz1Ax87HzaIy+02kA==", + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/strict-event-emitter/-/strict-event-emitter-0.5.1.tgz", + "integrity": "sha512-vMgjE/GGEPEFnhFub6pa4FmJBRBVOLpIII2hvCZ8Kzb7K0hlHo7mQv6xYrBvCL2LtAIBwFUK8wvuJgTVSQ5MFQ==", "dev": true }, "string_decoder": { diff --git a/package.json b/package.json index 7512d1f..05c1952 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "devDependencies": { "@types/node": "^18.7.20", "esbuild-register": "^3.3.3", - "msw": "^0.0.0-fetch.rc-15", + "msw": "^2.0.0", "openapi-types": "^12.0.2", "prettier": "2.7.1", "swagger-parser": "^10.0.3", From 73b8290177793519e4b63a9260701860d78e95a6 Mon Sep 17 00:00:00 2001 From: Justin Bennett Date: Wed, 1 Nov 2023 19:12:56 -0400 Subject: [PATCH 5/8] Allow handlers to be async, add extra helper export --- client/msw-handlers.ts | 308 ++++++++++++++++--------------- generator/client/msw-handlers.ts | 12 +- 2 files changed, 164 insertions(+), 156 deletions(-) diff --git a/client/msw-handlers.ts b/client/msw-handlers.ts index 9e53893..2bbdb68 100644 --- a/client/msw-handlers.ts +++ b/client/msw-handlers.ts @@ -13,11 +13,12 @@ import { HttpHandler, HttpResponse, StrictResponse, - delay as doDelay, - DefaultBodyType, PathParams, } from "msw"; -import type { SnakeCasedPropertiesDeep as Snakify } from "type-fest"; +import type { + SnakeCasedPropertiesDeep as Snakify, + Promisable, +} from "type-fest"; import { z, ZodSchema } from "zod"; import type * as Api from "./Api"; import { snakeify } from "./util"; @@ -43,80 +44,83 @@ type StringifyDates = T extends Date */ export type Json = Snakify>; +// Shortcut to reduce number of imports required in consumers +export { HttpResponse }; + export interface MSWHandlers { /** `POST /device/auth` */ deviceAuthRequest: (params: { req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `POST /device/confirm` */ deviceAuthConfirm: (params: { body: Json; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `POST /device/token` */ deviceAccessToken: (params: { req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `POST /login/:siloName/saml/:providerName` */ loginSaml: (params: { path: Api.LoginSamlPathParams; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `GET /v1/certificates` */ certificateList: (params: { query: Api.CertificateListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/certificates` */ certificateCreate: (params: { body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/certificates/:certificate` */ certificateView: (params: { path: Api.CertificateViewPathParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `DELETE /v1/certificates/:certificate` */ certificateDelete: (params: { path: Api.CertificateDeletePathParams; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `GET /v1/disks` */ diskList: (params: { query: Api.DiskListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/disks` */ diskCreate: (params: { query: Api.DiskCreateQueryParams; body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/disks/:disk` */ diskView: (params: { path: Api.DiskViewPathParams; query: Api.DiskViewQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `DELETE /v1/disks/:disk` */ diskDelete: (params: { path: Api.DiskDeletePathParams; query: Api.DiskDeleteQueryParams; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `POST /v1/disks/:disk/bulk-write` */ diskBulkWriteImport: (params: { path: Api.DiskBulkWriteImportPathParams; @@ -124,21 +128,21 @@ export interface MSWHandlers { body: Json; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `POST /v1/disks/:disk/bulk-write-start` */ diskBulkWriteImportStart: (params: { path: Api.DiskBulkWriteImportStartPathParams; query: Api.DiskBulkWriteImportStartQueryParams; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `POST /v1/disks/:disk/bulk-write-stop` */ diskBulkWriteImportStop: (params: { path: Api.DiskBulkWriteImportStopPathParams; query: Api.DiskBulkWriteImportStopQueryParams; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `POST /v1/disks/:disk/finalize` */ diskFinalizeImport: (params: { path: Api.DiskFinalizeImportPathParams; @@ -146,7 +150,7 @@ export interface MSWHandlers { body: Json; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `POST /v1/disks/:disk/import` */ diskImportBlocksFromUrl: (params: { path: Api.DiskImportBlocksFromUrlPathParams; @@ -154,101 +158,101 @@ export interface MSWHandlers { body: Json; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `GET /v1/disks/:disk/metrics/:metric` */ diskMetricsList: (params: { path: Api.DiskMetricsListPathParams; query: Api.DiskMetricsListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/groups` */ groupList: (params: { query: Api.GroupListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/groups/:groupId` */ groupView: (params: { path: Api.GroupViewPathParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/images` */ imageList: (params: { query: Api.ImageListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/images` */ imageCreate: (params: { query: Api.ImageCreateQueryParams; body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/images/:image` */ imageView: (params: { path: Api.ImageViewPathParams; query: Api.ImageViewQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `DELETE /v1/images/:image` */ imageDelete: (params: { path: Api.ImageDeletePathParams; query: Api.ImageDeleteQueryParams; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `POST /v1/images/:image/demote` */ imageDemote: (params: { path: Api.ImageDemotePathParams; query: Api.ImageDemoteQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/images/:image/promote` */ imagePromote: (params: { path: Api.ImagePromotePathParams; query: Api.ImagePromoteQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/instances` */ instanceList: (params: { query: Api.InstanceListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/instances` */ instanceCreate: (params: { query: Api.InstanceCreateQueryParams; body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/instances/:instance` */ instanceView: (params: { path: Api.InstanceViewPathParams; query: Api.InstanceViewQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `DELETE /v1/instances/:instance` */ instanceDelete: (params: { path: Api.InstanceDeletePathParams; query: Api.InstanceDeleteQueryParams; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `GET /v1/instances/:instance/disks` */ instanceDiskList: (params: { path: Api.InstanceDiskListPathParams; query: Api.InstanceDiskListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/instances/:instance/disks/attach` */ instanceDiskAttach: (params: { path: Api.InstanceDiskAttachPathParams; @@ -256,7 +260,7 @@ export interface MSWHandlers { body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/instances/:instance/disks/detach` */ instanceDiskDetach: (params: { path: Api.InstanceDiskDetachPathParams; @@ -264,14 +268,14 @@ export interface MSWHandlers { body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/instances/:instance/external-ips` */ instanceExternalIpList: (params: { path: Api.InstanceExternalIpListPathParams; query: Api.InstanceExternalIpListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/instances/:instance/migrate` */ instanceMigrate: (params: { path: Api.InstanceMigratePathParams; @@ -279,129 +283,129 @@ export interface MSWHandlers { body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/instances/:instance/reboot` */ instanceReboot: (params: { path: Api.InstanceRebootPathParams; query: Api.InstanceRebootQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/instances/:instance/serial-console` */ instanceSerialConsole: (params: { path: Api.InstanceSerialConsolePathParams; query: Api.InstanceSerialConsoleQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/instances/:instance/serial-console/stream` */ instanceSerialConsoleStream: (params: { path: Api.InstanceSerialConsoleStreamPathParams; query: Api.InstanceSerialConsoleStreamQueryParams; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `POST /v1/instances/:instance/start` */ instanceStart: (params: { path: Api.InstanceStartPathParams; query: Api.InstanceStartQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/instances/:instance/stop` */ instanceStop: (params: { path: Api.InstanceStopPathParams; query: Api.InstanceStopQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/ip-pools` */ projectIpPoolList: (params: { query: Api.ProjectIpPoolListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/ip-pools/:pool` */ projectIpPoolView: (params: { path: Api.ProjectIpPoolViewPathParams; query: Api.ProjectIpPoolViewQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/login/:siloName/local` */ loginLocal: (params: { path: Api.LoginLocalPathParams; body: Json; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `POST /v1/logout` */ logout: (params: { req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `GET /v1/me` */ currentUserView: (params: { req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/me/groups` */ currentUserGroups: (params: { query: Api.CurrentUserGroupsQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/me/ssh-keys` */ currentUserSshKeyList: (params: { query: Api.CurrentUserSshKeyListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/me/ssh-keys` */ currentUserSshKeyCreate: (params: { body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/me/ssh-keys/:sshKey` */ currentUserSshKeyView: (params: { path: Api.CurrentUserSshKeyViewPathParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `DELETE /v1/me/ssh-keys/:sshKey` */ currentUserSshKeyDelete: (params: { path: Api.CurrentUserSshKeyDeletePathParams; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `GET /v1/metrics/:metricName` */ siloMetric: (params: { path: Api.SiloMetricPathParams; query: Api.SiloMetricQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/network-interfaces` */ instanceNetworkInterfaceList: (params: { query: Api.InstanceNetworkInterfaceListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/network-interfaces` */ instanceNetworkInterfaceCreate: (params: { query: Api.InstanceNetworkInterfaceCreateQueryParams; body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/network-interfaces/:interface` */ instanceNetworkInterfaceView: (params: { path: Api.InstanceNetworkInterfaceViewPathParams; query: Api.InstanceNetworkInterfaceViewQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `PUT /v1/network-interfaces/:interface` */ instanceNetworkInterfaceUpdate: (params: { path: Api.InstanceNetworkInterfaceUpdatePathParams; @@ -409,146 +413,146 @@ export interface MSWHandlers { body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `DELETE /v1/network-interfaces/:interface` */ instanceNetworkInterfaceDelete: (params: { path: Api.InstanceNetworkInterfaceDeletePathParams; query: Api.InstanceNetworkInterfaceDeleteQueryParams; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `GET /v1/policy` */ policyView: (params: { req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `PUT /v1/policy` */ policyUpdate: (params: { body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/projects` */ projectList: (params: { query: Api.ProjectListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/projects` */ projectCreate: (params: { body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/projects/:project` */ projectView: (params: { path: Api.ProjectViewPathParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `PUT /v1/projects/:project` */ projectUpdate: (params: { path: Api.ProjectUpdatePathParams; body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `DELETE /v1/projects/:project` */ projectDelete: (params: { path: Api.ProjectDeletePathParams; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `GET /v1/projects/:project/policy` */ projectPolicyView: (params: { path: Api.ProjectPolicyViewPathParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `PUT /v1/projects/:project/policy` */ projectPolicyUpdate: (params: { path: Api.ProjectPolicyUpdatePathParams; body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/snapshots` */ snapshotList: (params: { query: Api.SnapshotListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/snapshots` */ snapshotCreate: (params: { query: Api.SnapshotCreateQueryParams; body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/snapshots/:snapshot` */ snapshotView: (params: { path: Api.SnapshotViewPathParams; query: Api.SnapshotViewQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `DELETE /v1/snapshots/:snapshot` */ snapshotDelete: (params: { path: Api.SnapshotDeletePathParams; query: Api.SnapshotDeleteQueryParams; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `GET /v1/system/hardware/disks` */ physicalDiskList: (params: { query: Api.PhysicalDiskListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/system/hardware/racks` */ rackList: (params: { query: Api.RackListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/system/hardware/racks/:rackId` */ rackView: (params: { path: Api.RackViewPathParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/system/hardware/sleds` */ sledList: (params: { query: Api.SledListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/system/hardware/sleds/:sledId` */ sledView: (params: { path: Api.SledViewPathParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/system/hardware/sleds/:sledId/disks` */ sledPhysicalDiskList: (params: { path: Api.SledPhysicalDiskListPathParams; query: Api.SledPhysicalDiskListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/system/hardware/sleds/:sledId/instances` */ sledInstanceList: (params: { path: Api.SledInstanceListPathParams; query: Api.SledInstanceListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/system/hardware/switch-port` */ networkingSwitchPortList: (params: { query: Api.NetworkingSwitchPortListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/system/hardware/switch-port/:port/settings` */ networkingSwitchPortApplySettings: (params: { path: Api.NetworkingSwitchPortApplySettingsPathParams; @@ -556,46 +560,46 @@ export interface MSWHandlers { body: Json; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `DELETE /v1/system/hardware/switch-port/:port/settings` */ networkingSwitchPortClearSettings: (params: { path: Api.NetworkingSwitchPortClearSettingsPathParams; query: Api.NetworkingSwitchPortClearSettingsQueryParams; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `GET /v1/system/hardware/switches` */ switchList: (params: { query: Api.SwitchListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/system/hardware/switches/:switchId` */ switchView: (params: { path: Api.SwitchViewPathParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/system/identity-providers` */ siloIdentityProviderList: (params: { query: Api.SiloIdentityProviderListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/system/identity-providers/local/users` */ localIdpUserCreate: (params: { query: Api.LocalIdpUserCreateQueryParams; body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `DELETE /v1/system/identity-providers/local/users/:userId` */ localIdpUserDelete: (params: { path: Api.LocalIdpUserDeletePathParams; query: Api.LocalIdpUserDeleteQueryParams; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `POST /v1/system/identity-providers/local/users/:userId/set-password` */ localIdpUserSetPassword: (params: { path: Api.LocalIdpUserSetPasswordPathParams; @@ -603,294 +607,294 @@ export interface MSWHandlers { body: Json; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `POST /v1/system/identity-providers/saml` */ samlIdentityProviderCreate: (params: { query: Api.SamlIdentityProviderCreateQueryParams; body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/system/identity-providers/saml/:provider` */ samlIdentityProviderView: (params: { path: Api.SamlIdentityProviderViewPathParams; query: Api.SamlIdentityProviderViewQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/system/ip-pools` */ ipPoolList: (params: { query: Api.IpPoolListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/system/ip-pools` */ ipPoolCreate: (params: { body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/system/ip-pools/:pool` */ ipPoolView: (params: { path: Api.IpPoolViewPathParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `PUT /v1/system/ip-pools/:pool` */ ipPoolUpdate: (params: { path: Api.IpPoolUpdatePathParams; body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `DELETE /v1/system/ip-pools/:pool` */ ipPoolDelete: (params: { path: Api.IpPoolDeletePathParams; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `GET /v1/system/ip-pools/:pool/ranges` */ ipPoolRangeList: (params: { path: Api.IpPoolRangeListPathParams; query: Api.IpPoolRangeListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/system/ip-pools/:pool/ranges/add` */ ipPoolRangeAdd: (params: { path: Api.IpPoolRangeAddPathParams; body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/system/ip-pools/:pool/ranges/remove` */ ipPoolRangeRemove: (params: { path: Api.IpPoolRangeRemovePathParams; body: Json; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `GET /v1/system/ip-pools-service` */ ipPoolServiceView: (params: { req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/system/ip-pools-service/ranges` */ ipPoolServiceRangeList: (params: { query: Api.IpPoolServiceRangeListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/system/ip-pools-service/ranges/add` */ ipPoolServiceRangeAdd: (params: { body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/system/ip-pools-service/ranges/remove` */ ipPoolServiceRangeRemove: (params: { body: Json; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `GET /v1/system/metrics/:metricName` */ systemMetric: (params: { path: Api.SystemMetricPathParams; query: Api.SystemMetricQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/system/networking/address-lot` */ networkingAddressLotList: (params: { query: Api.NetworkingAddressLotListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/system/networking/address-lot` */ networkingAddressLotCreate: (params: { body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `DELETE /v1/system/networking/address-lot/:addressLot` */ networkingAddressLotDelete: (params: { path: Api.NetworkingAddressLotDeletePathParams; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `GET /v1/system/networking/address-lot/:addressLot/blocks` */ networkingAddressLotBlockList: (params: { path: Api.NetworkingAddressLotBlockListPathParams; query: Api.NetworkingAddressLotBlockListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/system/networking/loopback-address` */ networkingLoopbackAddressList: (params: { query: Api.NetworkingLoopbackAddressListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/system/networking/loopback-address` */ networkingLoopbackAddressCreate: (params: { body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `DELETE /v1/system/networking/loopback-address/:rackId/:switchLocation/:address/:subnetMask` */ networkingLoopbackAddressDelete: (params: { path: Api.NetworkingLoopbackAddressDeletePathParams; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `GET /v1/system/networking/switch-port-settings` */ networkingSwitchPortSettingsList: (params: { query: Api.NetworkingSwitchPortSettingsListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/system/networking/switch-port-settings` */ networkingSwitchPortSettingsCreate: (params: { body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `DELETE /v1/system/networking/switch-port-settings` */ networkingSwitchPortSettingsDelete: (params: { query: Api.NetworkingSwitchPortSettingsDeleteQueryParams; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `GET /v1/system/networking/switch-port-settings/:port` */ networkingSwitchPortSettingsView: (params: { path: Api.NetworkingSwitchPortSettingsViewPathParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/system/policy` */ systemPolicyView: (params: { req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `PUT /v1/system/policy` */ systemPolicyUpdate: (params: { body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/system/roles` */ roleList: (params: { query: Api.RoleListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/system/roles/:roleName` */ roleView: (params: { path: Api.RoleViewPathParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/system/silos` */ siloList: (params: { query: Api.SiloListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/system/silos` */ siloCreate: (params: { body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/system/silos/:silo` */ siloView: (params: { path: Api.SiloViewPathParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `DELETE /v1/system/silos/:silo` */ siloDelete: (params: { path: Api.SiloDeletePathParams; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `GET /v1/system/silos/:silo/policy` */ siloPolicyView: (params: { path: Api.SiloPolicyViewPathParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `PUT /v1/system/silos/:silo/policy` */ siloPolicyUpdate: (params: { path: Api.SiloPolicyUpdatePathParams; body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/system/users` */ siloUserList: (params: { query: Api.SiloUserListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/system/users/:userId` */ siloUserView: (params: { path: Api.SiloUserViewPathParams; query: Api.SiloUserViewQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/system/users-builtin` */ userBuiltinList: (params: { query: Api.UserBuiltinListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/system/users-builtin/:user` */ userBuiltinView: (params: { path: Api.UserBuiltinViewPathParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/users` */ userList: (params: { query: Api.UserListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/vpc-firewall-rules` */ vpcFirewallRulesView: (params: { query: Api.VpcFirewallRulesViewQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `PUT /v1/vpc-firewall-rules` */ vpcFirewallRulesUpdate: (params: { query: Api.VpcFirewallRulesUpdateQueryParams; body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/vpc-router-routes` */ vpcRouterRouteList: (params: { query: Api.VpcRouterRouteListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/vpc-router-routes` */ vpcRouterRouteCreate: (params: { query: Api.VpcRouterRouteCreateQueryParams; body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/vpc-router-routes/:route` */ vpcRouterRouteView: (params: { path: Api.VpcRouterRouteViewPathParams; query: Api.VpcRouterRouteViewQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `PUT /v1/vpc-router-routes/:route` */ vpcRouterRouteUpdate: (params: { path: Api.VpcRouterRouteUpdatePathParams; @@ -898,34 +902,34 @@ export interface MSWHandlers { body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `DELETE /v1/vpc-router-routes/:route` */ vpcRouterRouteDelete: (params: { path: Api.VpcRouterRouteDeletePathParams; query: Api.VpcRouterRouteDeleteQueryParams; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `GET /v1/vpc-routers` */ vpcRouterList: (params: { query: Api.VpcRouterListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/vpc-routers` */ vpcRouterCreate: (params: { query: Api.VpcRouterCreateQueryParams; body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/vpc-routers/:router` */ vpcRouterView: (params: { path: Api.VpcRouterViewPathParams; query: Api.VpcRouterViewQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `PUT /v1/vpc-routers/:router` */ vpcRouterUpdate: (params: { path: Api.VpcRouterUpdatePathParams; @@ -933,34 +937,34 @@ export interface MSWHandlers { body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `DELETE /v1/vpc-routers/:router` */ vpcRouterDelete: (params: { path: Api.VpcRouterDeletePathParams; query: Api.VpcRouterDeleteQueryParams; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `GET /v1/vpc-subnets` */ vpcSubnetList: (params: { query: Api.VpcSubnetListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/vpc-subnets` */ vpcSubnetCreate: (params: { query: Api.VpcSubnetCreateQueryParams; body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/vpc-subnets/:subnet` */ vpcSubnetView: (params: { path: Api.VpcSubnetViewPathParams; query: Api.VpcSubnetViewQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `PUT /v1/vpc-subnets/:subnet` */ vpcSubnetUpdate: (params: { path: Api.VpcSubnetUpdatePathParams; @@ -968,41 +972,41 @@ export interface MSWHandlers { body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `DELETE /v1/vpc-subnets/:subnet` */ vpcSubnetDelete: (params: { path: Api.VpcSubnetDeletePathParams; query: Api.VpcSubnetDeleteQueryParams; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; /** `GET /v1/vpc-subnets/:subnet/network-interfaces` */ vpcSubnetListNetworkInterfaces: (params: { path: Api.VpcSubnetListNetworkInterfacesPathParams; query: Api.VpcSubnetListNetworkInterfacesQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/vpcs` */ vpcList: (params: { query: Api.VpcListQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `POST /v1/vpcs` */ vpcCreate: (params: { query: Api.VpcCreateQueryParams; body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `GET /v1/vpcs/:vpc` */ vpcView: (params: { path: Api.VpcViewPathParams; query: Api.VpcViewQueryParams; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `PUT /v1/vpcs/:vpc` */ vpcUpdate: (params: { path: Api.VpcUpdatePathParams; @@ -1010,14 +1014,14 @@ export interface MSWHandlers { body: Json; req: Request; cookies: Record; - }) => HandlerResult; + }) => Promisable>; /** `DELETE /v1/vpcs/:vpc` */ vpcDelete: (params: { path: Api.VpcDeletePathParams; query: Api.VpcDeleteQueryParams; req: Request; cookies: Record; - }) => StatusCode; + }) => Promisable; } function validateBody(schema: S, body: unknown) { diff --git a/generator/client/msw-handlers.ts b/generator/client/msw-handlers.ts index 7ff256e..13634fc 100644 --- a/generator/client/msw-handlers.ts +++ b/generator/client/msw-handlers.ts @@ -39,11 +39,9 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) { HttpHandler, HttpResponse, StrictResponse, - delay as doDelay, - DefaultBodyType, PathParams, } from "msw"; - import type { SnakeCasedPropertiesDeep as Snakify } from "type-fest"; + import type { SnakeCasedPropertiesDeep as Snakify, Promisable } from "type-fest"; import { z, ZodSchema } from "zod"; import type * as Api from "./Api"; import { snakeify } from "./util"; @@ -68,6 +66,10 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) { * purpose JSON type! */ export type Json = Snakify> + + + // Shortcut to reduce number of imports required in consumers + export { HttpResponse } `); w(`export interface MSWHandlers {`); @@ -106,7 +108,9 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) { const params = `params: { ${pathParamsType} ${queryParamsType} ${body} req: Request, cookies: Record }`; const resultType = - successType === "void" ? "StatusCode" : `HandlerResult<${successType}>`; + successType === "void" + ? "Promisable" + : `Promisable>`; w(`/** \`${method.toUpperCase()} ${formatPath(path)}\` */`); w(` ${opName}: (${params}) => ${resultType},`); From dafde691c843f3dbdf663f88b5f2be81a00696b9 Mon Sep 17 00:00:00 2001 From: Justin Bennett Date: Thu, 2 Nov 2023 09:52:21 -0400 Subject: [PATCH 6/8] Export json for a flatter diff --- client/msw-handlers.ts | 22 +++++++++++----------- generator/client/msw-handlers.ts | 19 +++++++++++-------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/client/msw-handlers.ts b/client/msw-handlers.ts index 2bbdb68..7e4057e 100644 --- a/client/msw-handlers.ts +++ b/client/msw-handlers.ts @@ -43,6 +43,7 @@ type StringifyDates = T extends Date * purpose JSON type! */ export type Json = Snakify>; +export const json = HttpResponse.json; // Shortcut to reduce number of imports required in consumers export { HttpResponse }; @@ -1029,7 +1030,7 @@ function validateBody(schema: S, body: unknown) { if (result.success) { return { body: result.data as Json> }; } - return { bodyErr: HttpResponse.json(result.error.issues, { status: 400 }) }; + return { bodyErr: json(result.error.issues, { status: 400 }) }; } function validateParams( schema: S, @@ -1057,7 +1058,7 @@ function validateParams( // exist if there's no valid name const { issues } = result.error; const status = issues.some((e) => e.path[0] === "path") ? 404 : 400; - return { paramsErr: HttpResponse.json(issues, { status }) }; + return { paramsErr: json(issues, { status }) }; } const handler = @@ -1069,28 +1070,30 @@ const handler = async ({ request: req, params: pathParams, + cookies, }: { request: Request; params: PathParams; + cookies: Record; }) => { const { params, paramsErr } = paramSchema ? validateParams(paramSchema, req, pathParams) : { params: {}, paramsErr: undefined }; - if (paramsErr) return HttpResponse.json(paramsErr, { status: 400 }); + if (paramsErr) return json(paramsErr, { status: 400 }); const { path, query } = params; const { body, bodyErr } = bodySchema ? validateBody(bodySchema, await req.json()) : { body: undefined, bodyErr: undefined }; - if (bodyErr) return HttpResponse.json(bodyErr, { status: 400 }); + if (bodyErr) return json(bodyErr, { status: 400 }); try { // TypeScript can't narrow the handler down because there's not an explicit relationship between the schema // being present and the shape of the handler API. The type of this function could be resolved such that the // relevant schema is required if and only if the handler has a type that matches the inferred schema const result = await (handler as any).apply(null, [ - { path, query, body, req }, + { path, query, body, req, cookies }, ]); if (typeof result === "number") { return new HttpResponse(null, { status: result }); @@ -1098,7 +1101,7 @@ const handler = if (typeof result === "function") { return result(); } - return HttpResponse.json(result); + return json(result); } catch (thrown) { if (typeof thrown === "number") { return new HttpResponse(null, { status: thrown }); @@ -1107,13 +1110,10 @@ const handler = return thrown(); } if (typeof thrown === "string") { - return HttpResponse.json({ message: thrown }, { status: 400 }); + return json({ message: thrown }, { status: 400 }); } console.error("Unexpected mock error", thrown); - return HttpResponse.json( - { message: "Unknown Server Error" }, - { status: 500 } - ); + return json({ message: "Unknown Server Error" }, { status: 500 }); } }; diff --git a/generator/client/msw-handlers.ts b/generator/client/msw-handlers.ts index 13634fc..e03a9b5 100644 --- a/generator/client/msw-handlers.ts +++ b/generator/client/msw-handlers.ts @@ -66,6 +66,7 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) { * purpose JSON type! */ export type Json = Snakify> + export const json = HttpResponse.json // Shortcut to reduce number of imports required in consumers @@ -123,7 +124,7 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) { if (result.success) { return { body: result.data as Json> } } - return { bodyErr: HttpResponse.json(result.error.issues, { status: 400 }) } + return { bodyErr: json(result.error.issues, { status: 400 }) } } function validateParams(schema: S, req: Request, pathParams: PathParams) { const rawParams = new URLSearchParams(new URL(req.url).search) @@ -147,41 +148,43 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) { // exist if there's no valid name const { issues } = result.error const status = issues.some(e => e.path[0] === 'path') ? 404 : 400 - return { paramsErr: HttpResponse.json(issues, { status }) } + return { paramsErr: json(issues, { status }) } } const handler = (handler: MSWHandlers[keyof MSWHandlers], paramSchema: ZodSchema | null, bodySchema: ZodSchema | null) => async ({ request: req, params: pathParams, + cookies }: { request: Request; params: PathParams; + cookies: Record; }) => { const { params, paramsErr } = paramSchema ? validateParams(paramSchema, req, pathParams) : { params: {}, paramsErr: undefined }; - if (paramsErr) return HttpResponse.json(paramsErr, { status: 400 }); + if (paramsErr) return json(paramsErr, { status: 400 }); const { path, query } = params const { body, bodyErr } = bodySchema ? validateBody(bodySchema, await req.json()) : { body: undefined, bodyErr: undefined }; - if (bodyErr) return HttpResponse.json(bodyErr, { status: 400 }); + if (bodyErr) return json(bodyErr, { status: 400 }); try { // TypeScript can't narrow the handler down because there's not an explicit relationship between the schema // being present and the shape of the handler API. The type of this function could be resolved such that the // relevant schema is required if and only if the handler has a type that matches the inferred schema - const result = await (handler as any).apply(null, [{path, query, body, req}]) + const result = await (handler as any).apply(null, [{path, query, body, req, cookies}]) if (typeof result === "number") { return new HttpResponse(null, { status: result }); } if (typeof result === "function") { return result(); } - return HttpResponse.json(result); + return json(result); } catch (thrown) { if (typeof thrown === 'number') { return new HttpResponse(null, { status: thrown }); @@ -190,10 +193,10 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) { return thrown(); } if (typeof thrown === "string") { - return HttpResponse.json({ message: thrown }, { status: 400 }); + return json({ message: thrown }, { status: 400 }); } console.error('Unexpected mock error', thrown) - return HttpResponse.json({ message: "Unknown Server Error" }, { status: 500 }); + return json({ message: "Unknown Server Error" }, { status: 500 }); } } From 0143504c01eb277034c2d08dca5ee04e1e342cae Mon Sep 17 00:00:00 2001 From: Justin Bennett Date: Thu, 2 Nov 2023 11:13:32 -0400 Subject: [PATCH 7/8] Handle raw response errors --- client/msw-handlers.ts | 3 +++ generator/client/msw-handlers.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/client/msw-handlers.ts b/client/msw-handlers.ts index 7e4057e..5ac8990 100644 --- a/client/msw-handlers.ts +++ b/client/msw-handlers.ts @@ -1112,6 +1112,9 @@ const handler = if (typeof thrown === "string") { return json({ message: thrown }, { status: 400 }); } + if (thrown instanceof Response) { + return thrown; + } console.error("Unexpected mock error", thrown); return json({ message: "Unknown Server Error" }, { status: 500 }); } diff --git a/generator/client/msw-handlers.ts b/generator/client/msw-handlers.ts index e03a9b5..a6e625f 100644 --- a/generator/client/msw-handlers.ts +++ b/generator/client/msw-handlers.ts @@ -195,6 +195,9 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) { if (typeof thrown === "string") { return json({ message: thrown }, { status: 400 }); } + if (thrown instanceof Response) { + return thrown; + } console.error('Unexpected mock error', thrown) return json({ message: "Unknown Server Error" }, { status: 500 }); } From 7d9b0ce068593070439d9e0b35f1e032fae8496f Mon Sep 17 00:00:00 2001 From: Justin Bennett Date: Thu, 2 Nov 2023 11:55:41 -0400 Subject: [PATCH 8/8] Return responses from successful handler logic branch --- client/msw-handlers.ts | 3 +++ generator/client/msw-handlers.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/client/msw-handlers.ts b/client/msw-handlers.ts index 5ac8990..f380fa0 100644 --- a/client/msw-handlers.ts +++ b/client/msw-handlers.ts @@ -1101,6 +1101,9 @@ const handler = if (typeof result === "function") { return result(); } + if (result instanceof Response) { + return result; + } return json(result); } catch (thrown) { if (typeof thrown === "number") { diff --git a/generator/client/msw-handlers.ts b/generator/client/msw-handlers.ts index a6e625f..db1db45 100644 --- a/generator/client/msw-handlers.ts +++ b/generator/client/msw-handlers.ts @@ -184,6 +184,9 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) { if (typeof result === "function") { return result(); } + if (result instanceof Response) { + return result; + } return json(result); } catch (thrown) { if (typeof thrown === 'number') {