@nhost/nhost-js 3.2.8 → 5.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -37
- package/dist/nhost-js/auth.cjs.js +2 -0
- package/dist/nhost-js/auth.cjs.js.map +1 -0
- package/dist/nhost-js/auth.es.js +589 -0
- package/dist/nhost-js/auth.es.js.map +1 -0
- package/dist/nhost-js/fetch.cjs.js +2 -0
- package/dist/nhost-js/fetch.cjs.js.map +1 -0
- package/dist/nhost-js/fetch.es.js +10 -0
- package/dist/nhost-js/fetch.es.js.map +1 -0
- package/dist/nhost-js/functions.cjs.js +2 -0
- package/dist/nhost-js/functions.cjs.js.map +1 -0
- package/dist/nhost-js/functions.es.js +31 -0
- package/dist/nhost-js/functions.es.js.map +1 -0
- package/dist/nhost-js/graphql.cjs.js +2 -0
- package/dist/nhost-js/graphql.cjs.js.map +1 -0
- package/dist/nhost-js/graphql.es.js +35 -0
- package/dist/nhost-js/graphql.es.js.map +1 -0
- package/dist/nhost-js/storage.cjs.js +2 -0
- package/dist/nhost-js/storage.cjs.js.map +1 -0
- package/dist/nhost-js/storage.es.js +205 -0
- package/dist/nhost-js/storage.es.js.map +1 -0
- package/dist/nhost-js.cjs.js +2 -0
- package/dist/nhost-js.cjs.js.map +1 -0
- package/dist/nhost-js.es.js +497 -0
- package/dist/nhost-js.es.js.map +1 -0
- package/dist/nhost-js.umd.js +2 -0
- package/dist/nhost-js.umd.js.map +1 -0
- package/dist/src/auth/client.d.ts +430 -0
- package/dist/src/auth/client.d.ts.map +1 -0
- package/dist/src/auth/client.js +727 -0
- package/dist/src/auth/client.js.map +1 -0
- package/dist/src/auth/index.d.ts +11 -0
- package/dist/src/auth/index.d.ts.map +1 -0
- package/dist/src/auth/index.js +11 -0
- package/dist/src/auth/index.js.map +1 -0
- package/dist/src/auth/interface.d.ts +142 -0
- package/dist/src/auth/interface.d.ts.map +1 -0
- package/dist/src/auth/interface.js +2 -0
- package/dist/src/auth/interface.js.map +1 -0
- package/dist/src/fetch/index.d.ts +53 -0
- package/dist/src/fetch/index.d.ts.map +1 -0
- package/dist/src/fetch/index.js +40 -0
- package/dist/src/fetch/index.js.map +1 -0
- package/dist/src/functions/client.d.ts +47 -0
- package/dist/src/functions/client.d.ts.map +1 -0
- package/dist/src/functions/client.js +62 -0
- package/dist/src/functions/client.js.map +1 -0
- package/dist/src/functions/index.d.ts +10 -0
- package/dist/src/functions/index.d.ts.map +1 -0
- package/dist/src/functions/index.js +10 -0
- package/dist/src/functions/index.js.map +1 -0
- package/dist/src/graphql/client.d.ts +89 -0
- package/dist/src/graphql/client.d.ts.map +1 -0
- package/dist/src/graphql/client.js +49 -0
- package/dist/src/graphql/client.js.map +1 -0
- package/dist/src/graphql/index.d.ts +10 -0
- package/dist/src/graphql/index.d.ts.map +1 -0
- package/dist/src/graphql/index.js +10 -0
- package/dist/src/graphql/index.js.map +1 -0
- package/dist/src/index.d.ts +184 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +251 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/middlewareAttachToken.d.ts +24 -0
- package/dist/src/middlewareAttachToken.d.ts.map +1 -0
- package/dist/src/middlewareAttachToken.js +60 -0
- package/dist/src/middlewareAttachToken.js.map +1 -0
- package/dist/src/middlewareRefreshSession.d.ts +43 -0
- package/dist/src/middlewareRefreshSession.d.ts.map +1 -0
- package/dist/src/middlewareRefreshSession.js +190 -0
- package/dist/src/middlewareRefreshSession.js.map +1 -0
- package/dist/src/middlewareResponseSession.d.ts +26 -0
- package/dist/src/middlewareResponseSession.d.ts.map +1 -0
- package/dist/src/middlewareResponseSession.js +83 -0
- package/dist/src/middlewareResponseSession.js.map +1 -0
- package/dist/src/sessionStorage.d.ts +123 -0
- package/dist/src/sessionStorage.d.ts.map +1 -0
- package/dist/src/sessionStorage.js +165 -0
- package/dist/src/sessionStorage.js.map +1 -0
- package/dist/src/storage/client.d.ts +184 -0
- package/dist/src/storage/client.d.ts.map +1 -0
- package/dist/src/storage/client.js +249 -0
- package/dist/src/storage/client.js.map +1 -0
- package/dist/src/storage/index.d.ts +11 -0
- package/dist/src/storage/index.d.ts.map +1 -0
- package/dist/src/storage/index.js +11 -0
- package/dist/src/storage/index.js.map +1 -0
- package/dist/src/storage/interface.d.ts +52 -0
- package/dist/src/storage/interface.d.ts.map +1 -0
- package/dist/src/storage/interface.js +2 -0
- package/dist/src/storage/interface.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +109 -63
- package/LICENSE +0 -21
- package/dist/clients/auth.d.ts +0 -8
- package/dist/clients/auth.d.ts.map +0 -1
- package/dist/clients/functions/index.d.ts +0 -107
- package/dist/clients/functions/index.d.ts.map +0 -1
- package/dist/clients/functions/types.d.ts +0 -28
- package/dist/clients/functions/types.d.ts.map +0 -1
- package/dist/clients/graphql.d.ts +0 -8
- package/dist/clients/graphql.d.ts.map +0 -1
- package/dist/clients/index.d.ts +0 -6
- package/dist/clients/index.d.ts.map +0 -1
- package/dist/clients/nhost.d.ts +0 -83
- package/dist/clients/nhost.d.ts.map +0 -1
- package/dist/clients/storage.d.ts +0 -8
- package/dist/clients/storage.d.ts.map +0 -1
- package/dist/index.cjs.js +0 -2
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.d.ts.map +0 -1
- package/dist/index.esm.js +0 -344
- package/dist/index.esm.js.map +0 -1
- package/dist/utils/helpers.d.ts +0 -20
- package/dist/utils/helpers.d.ts.map +0 -1
- package/dist/utils/types.d.ts +0 -57
- package/dist/utils/types.d.ts.map +0 -1
- package/umd/nhost-js.umd.js +0 -22
- package/umd/nhost-js.umd.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.es.js","sources":["../../src/auth/client.ts"],"sourcesContent":["/**\n * Generated by orval v7.9.0 🍺\n * Do not edit manually.\n * Nhost Authentication API\n * Comprehensive authentication service for managing user identities, sessions, and authentication methods\n * OpenAPI spec version: 1.0.0\n */\nimport { createEnhancedFetch } from \"../fetch\";\nimport type { ChainFunction } from \"../fetch\";\n\nimport type { Client } from \"./interface\";\n\n/**\n * JSON Web Key Set for verifying JWT signatures\n */\nexport interface JWKSet {\n /** Array of public keys */\n keys: Jwk[];\n}\n\n/**\n * JSON Web Key for JWT verification\n */\nexport interface Jwk {\n /** Algorithm used with this key */\n alg: string;\n /** RSA public exponent */\n e: string;\n /** Key ID */\n kid: string;\n /** Key type */\n kty: string;\n /** RSA modulus */\n n: string;\n /** Key usage */\n use: string;\n}\n\n/**\n * Request to refresh an access token\n */\nexport interface RefreshTokenRequest {\n /**\n * Refresh token used to generate a new access token\n * @pattern \\b[0-9a-f]{8}\\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\\b[0-9a-f]{12}\\b\n */\n refreshToken: string;\n}\n\nexport interface SignOutSchema {\n /** Refresh token for the current session */\n refreshToken: string;\n /** Sign out from all connected devices */\n all?: boolean;\n}\n\nexport type CreatePATRequestMetadata = { [key: string]: unknown };\n\nexport interface CreatePATRequest {\n /** Expiration date of the PAT */\n expiresAt: string;\n metadata?: CreatePATRequestMetadata;\n}\n\nexport interface CreatePATResponse {\n /**\n * ID of the PAT\n * @pattern \\b[0-9a-f]{8}\\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\\b[0-9a-f]{12}\\b\n */\n id: string;\n /**\n * PAT\n * @pattern \\b[0-9a-f]{8}\\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\\b[0-9a-f]{12}\\b\n */\n personalAccessToken: string;\n}\n\n/**\n * Error code identifying the specific application error\n */\nexport type ErrorResponseError =\n | \"default-role-must-be-in-allowed-roles\"\n | \"disabled-endpoint\"\n | \"disabled-user\"\n | \"email-already-in-use\"\n | \"email-already-verified\"\n | \"forbidden-anonymous\"\n | \"internal-server-error\"\n | \"invalid-email-password\"\n | \"invalid-request\"\n | \"locale-not-allowed\"\n | \"password-too-short\"\n | \"password-in-hibp-database\"\n | \"redirectTo-not-allowed\"\n | \"role-not-allowed\"\n | \"signup-disabled\"\n | \"unverified-user\"\n | \"user-not-anonymous\"\n | \"invalid-pat\"\n | \"invalid-refresh-token\"\n | \"invalid-ticket\"\n | \"disabled-mfa-totp\"\n | \"no-totp-secret\"\n | \"invalid-totp\"\n | \"mfa-type-not-found\"\n | \"totp-already-active\";\n/**\n * Standardized error response\n */\nexport interface ErrorResponse {\n /** HTTP status error code */\n status: number;\n /** Human-friendly error message */\n message: string;\n /** Error code identifying the specific application error */\n error: ErrorResponseError;\n}\n\n/**\n * Response for email-password authentication that may include a session or MFA challenge\n */\nexport interface SignInEmailPasswordResponse {\n /** User session if authentication was successful. Null if MFA challenge is required. */\n session?: Session;\n /** MFA challenge if two-factor authentication is required */\n mfa?: MFAChallengePayload;\n}\n\n/**\n * Challenge payload for multi-factor authentication\n */\nexport interface MFAChallengePayload {\n /** Ticket to use when completing the MFA challenge */\n ticket: string;\n}\n\n/**\n * Container for session information\n */\nexport interface SessionPayload {\n /** User session data. Null if authentication requires additional steps. */\n session?: Session;\n}\n\n/**\n * User authentication session containing tokens and user information\n */\nexport interface Session {\n /** JWT token for authenticating API requests */\n accessToken: string;\n /** Expiration time of the access token in seconds */\n accessTokenExpiresIn: number;\n /**\n * Identifier for the refresh token\n * @pattern \\b[0-9a-f]{8}\\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\\b[0-9a-f]{12}\\b\n */\n refreshTokenId: string;\n /**\n * Token used to refresh the access token\n * @pattern \\b[0-9a-f]{8}\\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\\b[0-9a-f]{12}\\b\n */\n refreshToken: string;\n /** Information about the authenticated user */\n user?: User;\n}\n\nexport interface SignInPATRequest {\n /**\n * PAT\n * @pattern \\b[0-9a-f]{8}\\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\\b[0-9a-f]{12}\\b\n */\n personalAccessToken: string;\n}\n\n/**\n * Custom metadata associated with the user\n */\nexport type UserMetadata = { [key: string]: unknown };\n\n/**\n * User profile and account information\n */\nexport interface User {\n /** URL to the user's profile picture */\n avatarUrl: string;\n /** Timestamp when the user account was created */\n createdAt: string;\n /** Default authorization role for the user */\n defaultRole: string;\n /** User's display name */\n displayName: string;\n /** User's email address */\n email?: string;\n /** Whether the user's email has been verified */\n emailVerified: boolean;\n /**\n * Unique identifier for the user\n * @pattern \\b[0-9a-f]{8}\\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\\b[0-9a-f]{12}\\b\n */\n id: string;\n /** Whether this is an anonymous user account */\n isAnonymous: boolean;\n /**\n * User's preferred locale (language code)\n * @minLength 2\n * @maxLength 2\n */\n locale: string;\n /** Custom metadata associated with the user */\n metadata: UserMetadata;\n /** User's phone number */\n phoneNumber?: string;\n /** Whether the user's phone number has been verified */\n phoneNumberVerified: boolean;\n /** List of roles assigned to the user */\n roles: string[];\n}\n\n/**\n * Which sign-in method to use\n */\nexport type UserDeanonymizeRequestSignInMethod =\n | \"email-password\"\n | \"passwordless\";\nexport interface UserDeanonymizeRequest {\n /** Which sign-in method to use */\n signInMethod: UserDeanonymizeRequestSignInMethod;\n /** A valid email */\n email: string;\n /**\n * A password of minimum 3 characters\n * @minLength 3\n * @maxLength 50\n */\n password?: string;\n /**\n * Deprecated, will be ignored\n * @deprecated\n */\n connection?: string;\n options?: SignUpOptions;\n}\n\nexport interface UserEmailChangeRequest {\n /** A valid email */\n newEmail: string;\n options?: OptionsRedirectTo;\n}\n\nexport interface UserEmailSendVerificationEmailRequest {\n /** A valid email */\n email: string;\n options?: OptionsRedirectTo;\n}\n\nexport interface UserPasswordResetRequest {\n /** A valid email */\n email: string;\n options?: OptionsRedirectTo;\n}\n\nexport interface UserPasswordRequest {\n /**\n * A password of minimum 3 characters\n * @minLength 3\n * @maxLength 50\n */\n newPassword: string;\n /**\n * Ticket to reset the password, required if the user is not authenticated\n * @pattern ^passwordReset\\:.*$\n */\n ticket?: string;\n}\n\nexport type OKResponse = \"OK\";\nexport interface OptionsRedirectTo {\n redirectTo?: string;\n}\n\nexport type SigninAnonymousRequestMetadata = { [key: string]: unknown };\n\nexport interface SigninAnonymousRequest {\n displayName?: string;\n /**\n * A two-characters locale\n * @minLength 2\n * @maxLength 2\n */\n locale?: string;\n metadata?: SigninAnonymousRequestMetadata;\n}\n\n/**\n * Request to authenticate using email and password\n */\nexport interface SignInEmailPasswordRequest {\n /** User's email address */\n email: string;\n /**\n * User's password\n * @minLength 3\n * @maxLength 50\n */\n password: string;\n}\n\nexport interface SignInPasswordlessEmailRequest {\n /** A valid email */\n email: string;\n options?: SignUpOptions;\n}\n\nexport interface SignInOTPEmailRequest {\n /** A valid email */\n email: string;\n options?: SignUpOptions;\n}\n\nexport interface SignInOTPEmailVerifyRequest {\n /** One time password */\n otp: string;\n /** A valid email */\n email: string;\n}\n\nexport interface SignInOTPEmailVerifyResponse {\n session?: Session;\n}\n\n/**\n * Request to register a new user with email and password\n */\nexport interface SignUpEmailPasswordRequest {\n /** Email address for the new user account */\n email: string;\n /**\n * Password for the new user account\n * @minLength 3\n * @maxLength 50\n */\n password: string;\n /** Optional configuration for the new user account */\n options?: SignUpOptions;\n}\n\nexport type SignUpOptionsMetadata = { [key: string]: unknown };\n\nexport interface SignUpOptions {\n allowedRoles?: string[];\n defaultRole?: string;\n /**\n * @maxLength 32\n * @pattern ^[\\p{L}\\p{N}\\p{S} ,.'-]+$\n */\n displayName?: string;\n /**\n * A two-characters locale\n * @minLength 2\n * @maxLength 2\n */\n locale?: string;\n metadata?: SignUpOptionsMetadata;\n redirectTo?: string;\n}\n\nexport interface SignInWebauthnRequest {\n /** A valid email */\n email?: string;\n}\n\nexport interface SignUpWebauthnRequest {\n /** A valid email */\n email: string;\n options?: SignUpOptions;\n}\n\nexport interface SignInWebauthnResponse {\n [key: string]: unknown;\n}\n\nexport interface SignUpWebauthnResponse {\n [key: string]: unknown;\n}\n\nexport type SignInWebauthnVerifyRequestCredential = { [key: string]: unknown };\n\nexport interface SignInWebauthnVerifyRequest {\n /**\n * A valid email. Deprecated, no longer used\n * @deprecated\n */\n email?: string;\n credential: SignInWebauthnVerifyRequestCredential;\n [key: string]: unknown;\n}\n\nexport type SignUpWebauthnVerifyRequestCredential = { [key: string]: unknown };\n\nexport type SignUpWebauthnVerifyRequestOptionsAllOf = {\n nickname?: string;\n};\n\nexport type SignUpWebauthnVerifyRequestOptions = SignUpOptions &\n SignUpWebauthnVerifyRequestOptionsAllOf;\n\nexport interface SignUpWebauthnVerifyRequest {\n credential?: SignUpWebauthnVerifyRequestCredential;\n options?: SignUpWebauthnVerifyRequestOptions;\n [key: string]: unknown;\n}\n\nexport interface SignInIdTokenRequest {\n provider: Provider;\n /** Apple ID token */\n idToken: string;\n /** Nonce used during sign in process */\n nonce?: string;\n options?: SignUpOptions;\n}\n\nexport interface SignInMfaTotpRequest {\n /**\n * Ticket\n * @pattern ^mfaTotp:.*$\n */\n ticket: string;\n /** One time password */\n otp: string;\n}\n\nexport type Provider = \"apple\" | \"google\";\nexport interface LinkIdTokenRequest {\n provider: Provider;\n /** Apple ID token */\n idToken: string;\n /** Nonce used during sign in process */\n nonce?: string;\n}\n\n/**\n * Type of MFA to activate. Use empty string to disable MFA.\n */\nexport type UserMfaRequestActiveMfaType = \"totp\" | \"\";\n/**\n * Request to activate or deactivate multi-factor authentication\n */\nexport interface UserMfaRequest {\n /** Verification code from the authenticator app when activating MFA */\n code: string;\n /** Type of MFA to activate. Use empty string to disable MFA. */\n activeMfaType?: UserMfaRequestActiveMfaType;\n}\n\n/**\n * Response containing TOTP setup information for MFA\n */\nexport interface TotpGenerateResponse {\n /** URL to QR code image for scanning with an authenticator app */\n imageUrl: string;\n /** TOTP secret key for manual setup with an authenticator app */\n totpSecret: string;\n}\n\n/**\n * Ticket\n */\nexport type TicketQueryParameter = string;\n\n/**\n * Type of the ticket\n */\nexport type TicketTypeQueryParameter =\n | \"emailVerify\"\n | \"emailConfirmChange\"\n | \"signinPasswordless\"\n | \"passwordReset\";\n/**\n * Target URL for the redirect\n */\nexport type RedirectToQueryParameter = string;\n\nexport type GetVersion200 = {\n /** The version of the authentication service */\n version: string;\n};\n\nexport type VerifyTicketParams = {\n /**\n * Ticket\n */\n ticket: TicketQueryParameter;\n /**\n * Type of the ticket. Deprecated, no longer used\n * @deprecated\n */\n type?: TicketTypeQueryParameter;\n /**\n * Target URL for the redirect\n */\n redirectTo: RedirectToQueryParameter;\n};\n\nexport type FetchResponse<T> = {\n body: T;\n status: number;\n headers: Headers;\n};\n\nexport const createAPIClient = (\n baseURL: string,\n chainFunctions: ChainFunction[] = [],\n): Client => {\n let fetch = createEnhancedFetch(chainFunctions);\n\n const pushChainFunction = (chainFunction: ChainFunction) => {\n chainFunctions.push(chainFunction);\n fetch = createEnhancedFetch(chainFunctions);\n };\n\n /**\n * Verify if the authentication service is operational using HEAD method\n * @summary Health check (HEAD)\n */\n const healthCheckHead = async (\n options?: RequestInit,\n ): Promise<FetchResponse<void>> => {\n const res = await fetch(getHealthCheckHeadUrl(), {\n ...options,\n method: \"HEAD\",\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: void = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<void>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getHealthCheckHeadUrl = () => {\n return baseURL + `/healthz`;\n };\n\n /**\n * Verify if the authentication service is operational using GET method\n * @summary Health check (GET)\n */\n const healthCheckGet = async (\n options?: RequestInit,\n ): Promise<FetchResponse<OKResponse>> => {\n const res = await fetch(getHealthCheckGetUrl(), {\n ...options,\n method: \"GET\",\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: OKResponse = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<OKResponse>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getHealthCheckGetUrl = () => {\n return baseURL + `/healthz`;\n };\n\n /**\n * Retrieve version information about the authentication service\n * @summary Get service version\n */\n const getVersion = async (\n options?: RequestInit,\n ): Promise<FetchResponse<GetVersion200>> => {\n const res = await fetch(getGetVersionUrl(), {\n ...options,\n method: \"GET\",\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: GetVersion200 = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<GetVersion200>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getGetVersionUrl = () => {\n return baseURL + `/version`;\n };\n\n /**\n * Generate a new JWT access token using a valid refresh token. The refresh token used will be revoked and a new one will be issued.\n * @summary Refresh access token\n */\n const refreshToken = async (\n refreshTokenRequest: RefreshTokenRequest,\n options?: RequestInit,\n ): Promise<FetchResponse<Session>> => {\n const res = await fetch(getRefreshTokenUrl(), {\n ...options,\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...options?.headers },\n body: JSON.stringify(refreshTokenRequest),\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: Session = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<Session>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getRefreshTokenUrl = () => {\n return baseURL + `/token`;\n };\n\n /**\n * @summary Sign out\n */\n const signOut = async (\n signOutSchema: SignOutSchema,\n options?: RequestInit,\n ): Promise<FetchResponse<OKResponse>> => {\n const res = await fetch(getSignOutUrl(), {\n ...options,\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...options?.headers },\n body: JSON.stringify(signOutSchema),\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: OKResponse = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<OKResponse>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getSignOutUrl = () => {\n return baseURL + `/signout`;\n };\n\n /**\n * Authenticate a user with their email and password. Returns a session object or MFA challenge if two-factor authentication is enabled.\n * @summary Sign in with email and password\n */\n const signInEmailPassword = async (\n signInEmailPasswordRequest: SignInEmailPasswordRequest,\n options?: RequestInit,\n ): Promise<FetchResponse<SignInEmailPasswordResponse>> => {\n const res = await fetch(getSignInEmailPasswordUrl(), {\n ...options,\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...options?.headers },\n body: JSON.stringify(signInEmailPasswordRequest),\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: SignInEmailPasswordResponse = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<SignInEmailPasswordResponse>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getSignInEmailPasswordUrl = () => {\n return baseURL + `/signin/email-password`;\n };\n\n /**\n * Complete the multi-factor authentication by verifying a Time-based One-Time Password (TOTP). Returns a session if validation is successful.\n * @summary Verify TOTP for MFA\n */\n const signInVerifyMfaTotp = async (\n signInMfaTotpRequest: SignInMfaTotpRequest,\n options?: RequestInit,\n ): Promise<FetchResponse<SessionPayload>> => {\n const res = await fetch(getSignInVerifyMfaTotpUrl(), {\n ...options,\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...options?.headers },\n body: JSON.stringify(signInMfaTotpRequest),\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: SessionPayload = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<SessionPayload>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getSignInVerifyMfaTotpUrl = () => {\n return baseURL + `/signin/mfa/totp`;\n };\n\n /**\n * Initiate passwordless authentication by sending a magic link to the user's email. If the user doesn't exist, a new account will be created with the provided options.\n * @summary Sign in with magic link email\n */\n const signInPasswordlessEmail = async (\n signInPasswordlessEmailRequest: SignInPasswordlessEmailRequest,\n options?: RequestInit,\n ): Promise<FetchResponse<OKResponse>> => {\n const res = await fetch(getSignInPasswordlessEmailUrl(), {\n ...options,\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...options?.headers },\n body: JSON.stringify(signInPasswordlessEmailRequest),\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: OKResponse = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<OKResponse>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getSignInPasswordlessEmailUrl = () => {\n return baseURL + `/signin/passwordless/email`;\n };\n\n /**\n * Register a new user account with email and password. Returns a session if email verification is not required, otherwise returns null session.\n * @summary Sign up with email and password\n */\n const signUpEmailPassword = async (\n signUpEmailPasswordRequest: SignUpEmailPasswordRequest,\n options?: RequestInit,\n ): Promise<FetchResponse<SessionPayload>> => {\n const res = await fetch(getSignUpEmailPasswordUrl(), {\n ...options,\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...options?.headers },\n body: JSON.stringify(signUpEmailPasswordRequest),\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: SessionPayload = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<SessionPayload>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getSignUpEmailPasswordUrl = () => {\n return baseURL + `/signup/email-password`;\n };\n\n /**\n * Activate or deactivate multi-factor authentication for the authenticated user\n * @summary Manage multi-factor authentication\n */\n const changeUserMfaVerify = async (\n userMfaRequest: UserMfaRequest,\n options?: RequestInit,\n ): Promise<FetchResponse<OKResponse>> => {\n const res = await fetch(getChangeUserMfaVerifyUrl(), {\n ...options,\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...options?.headers },\n body: JSON.stringify(userMfaRequest),\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: OKResponse = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<OKResponse>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getChangeUserMfaVerifyUrl = () => {\n return baseURL + `/user/mfa`;\n };\n\n /**\n * Generate a Time-based One-Time Password (TOTP) secret for setting up multi-factor authentication\n * @summary Generate TOTP secret\n */\n const changeUserMfa = async (\n options?: RequestInit,\n ): Promise<FetchResponse<TotpGenerateResponse>> => {\n const res = await fetch(getChangeUserMfaUrl(), {\n ...options,\n method: \"GET\",\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: TotpGenerateResponse = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<TotpGenerateResponse>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getChangeUserMfaUrl = () => {\n return baseURL + `/mfa/totp/generate`;\n };\n\n /**\n * @summary Get public keys for JWT verification in JWK Set format\n */\n const getJWKs = async (\n options?: RequestInit,\n ): Promise<FetchResponse<JWKSet>> => {\n const res = await fetch(getGetJWKsUrl(), {\n ...options,\n method: \"GET\",\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: JWKSet = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<JWKSet>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getGetJWKsUrl = () => {\n return baseURL + `/.well-known/jwks.json`;\n };\n\n /**\n * @summary Create a Personal Access Token (PAT)\n */\n const createPAT = async (\n createPATRequest: CreatePATRequest,\n options?: RequestInit,\n ): Promise<FetchResponse<CreatePATResponse>> => {\n const res = await fetch(getCreatePATUrl(), {\n ...options,\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...options?.headers },\n body: JSON.stringify(createPATRequest),\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: CreatePATResponse = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<CreatePATResponse>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getCreatePATUrl = () => {\n return baseURL + `/pat`;\n };\n\n /**\n * @summary Sign in anonymously\n */\n const signInAnonymous = async (\n signinAnonymousRequest?: SigninAnonymousRequest,\n options?: RequestInit,\n ): Promise<FetchResponse<SessionPayload>> => {\n const res = await fetch(getSignInAnonymousUrl(), {\n ...options,\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...options?.headers },\n body: JSON.stringify(signinAnonymousRequest),\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: SessionPayload = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<SessionPayload>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getSignInAnonymousUrl = () => {\n return baseURL + `/signin/anonymous`;\n };\n\n /**\n * @summary Sign in with a one time password sent to user's email. If the user doesn't exist, it will be created. The options object is optional and can be used to configure the user's when signing up a new user. It is ignored if the user already exists.\n */\n const signInOTPEmail = async (\n signInOTPEmailRequest: SignInOTPEmailRequest,\n options?: RequestInit,\n ): Promise<FetchResponse<OKResponse>> => {\n const res = await fetch(getSignInOTPEmailUrl(), {\n ...options,\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...options?.headers },\n body: JSON.stringify(signInOTPEmailRequest),\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: OKResponse = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<OKResponse>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getSignInOTPEmailUrl = () => {\n return baseURL + `/signin/otp/email`;\n };\n\n /**\n * @summary Verify OTP and return a session if validation is successful\n */\n const verifySignInOTPEmail = async (\n signInOTPEmailVerifyRequest: SignInOTPEmailVerifyRequest,\n options?: RequestInit,\n ): Promise<FetchResponse<SignInOTPEmailVerifyResponse>> => {\n const res = await fetch(getVerifySignInOTPEmailUrl(), {\n ...options,\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...options?.headers },\n body: JSON.stringify(signInOTPEmailVerifyRequest),\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: SignInOTPEmailVerifyResponse = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<SignInOTPEmailVerifyResponse>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getVerifySignInOTPEmailUrl = () => {\n return baseURL + `/signin/otp/email/verify`;\n };\n\n /**\n * @summary Sign in with Personal Access Token (PAT)\n */\n const signInPAT = async (\n signInPATRequest: SignInPATRequest,\n options?: RequestInit,\n ): Promise<FetchResponse<SessionPayload>> => {\n const res = await fetch(getSignInPATUrl(), {\n ...options,\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...options?.headers },\n body: JSON.stringify(signInPATRequest),\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: SessionPayload = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<SessionPayload>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getSignInPATUrl = () => {\n return baseURL + `/signin/pat`;\n };\n\n /**\n * @summary Sign in with in an id token\n */\n const signInIdToken = async (\n signInIdTokenRequest: SignInIdTokenRequest,\n options?: RequestInit,\n ): Promise<FetchResponse<SessionPayload>> => {\n const res = await fetch(getSignInIdTokenUrl(), {\n ...options,\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...options?.headers },\n body: JSON.stringify(signInIdTokenRequest),\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: SessionPayload = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<SessionPayload>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getSignInIdTokenUrl = () => {\n return baseURL + `/signin/idtoken`;\n };\n\n /**\n * @summary Link a user account with the provider's account using an id token\n */\n const linkIdToken = async (\n linkIdTokenRequest: LinkIdTokenRequest,\n options?: RequestInit,\n ): Promise<FetchResponse<OKResponse>> => {\n const res = await fetch(getLinkIdTokenUrl(), {\n ...options,\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...options?.headers },\n body: JSON.stringify(linkIdTokenRequest),\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: OKResponse = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<OKResponse>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getLinkIdTokenUrl = () => {\n return baseURL + `/link/idtoken`;\n };\n\n /**\n * @summary Deanonymize an anonymous user in adding missing email or email+password, depending on the chosen authentication method. Will send a confirmation email if the server is configured to do so\n */\n const deanonymizeUser = async (\n userDeanonymizeRequest: UserDeanonymizeRequest,\n options?: RequestInit,\n ): Promise<FetchResponse<OKResponse>> => {\n const res = await fetch(getDeanonymizeUserUrl(), {\n ...options,\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...options?.headers },\n body: JSON.stringify(userDeanonymizeRequest),\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: OKResponse = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<OKResponse>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getDeanonymizeUserUrl = () => {\n return baseURL + `/user/deanonymize`;\n };\n\n /**\n * @summary Change user email\n */\n const changeUserEmail = async (\n userEmailChangeRequest: UserEmailChangeRequest,\n options?: RequestInit,\n ): Promise<FetchResponse<OKResponse>> => {\n const res = await fetch(getChangeUserEmailUrl(), {\n ...options,\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...options?.headers },\n body: JSON.stringify(userEmailChangeRequest),\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: OKResponse = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<OKResponse>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getChangeUserEmailUrl = () => {\n return baseURL + `/user/email/change`;\n };\n\n /**\n * @summary Send verification email\n */\n const sendVerificationEmail = async (\n userEmailSendVerificationEmailRequest: UserEmailSendVerificationEmailRequest,\n options?: RequestInit,\n ): Promise<FetchResponse<OKResponse>> => {\n const res = await fetch(getSendVerificationEmailUrl(), {\n ...options,\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...options?.headers },\n body: JSON.stringify(userEmailSendVerificationEmailRequest),\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: OKResponse = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<OKResponse>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getSendVerificationEmailUrl = () => {\n return baseURL + `/user/email/send-verification-email`;\n };\n\n /**\n * @summary Change user password. The user must be authenticated or provide a ticket\n */\n const changeUserPassword = async (\n userPasswordRequest: UserPasswordRequest,\n options?: RequestInit,\n ): Promise<FetchResponse<OKResponse>> => {\n const res = await fetch(getChangeUserPasswordUrl(), {\n ...options,\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...options?.headers },\n body: JSON.stringify(userPasswordRequest),\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: OKResponse = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<OKResponse>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getChangeUserPasswordUrl = () => {\n return baseURL + `/user/password`;\n };\n\n /**\n * @summary Request a password reset. An email with a verification link will be sent to the user's address\n */\n const sendPasswordResetEmail = async (\n userPasswordResetRequest: UserPasswordResetRequest,\n options?: RequestInit,\n ): Promise<FetchResponse<OKResponse>> => {\n const res = await fetch(getSendPasswordResetEmailUrl(), {\n ...options,\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...options?.headers },\n body: JSON.stringify(userPasswordResetRequest),\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: OKResponse = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<OKResponse>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getSendPasswordResetEmailUrl = () => {\n return baseURL + `/user/password/reset`;\n };\n\n /**\n * @summary Verify tickets created by email verification, email passwordless authentication (magic link), or password reset\n */\n const verifyTicket = async (\n params: VerifyTicketParams,\n options?: RequestInit,\n ): Promise<FetchResponse<void>> => {\n const res = await fetch(getVerifyTicketUrl(params), {\n ...options,\n method: \"GET\",\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: void = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<void>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getVerifyTicketUrl = (params: VerifyTicketParams) => {\n const normalizedParams = new URLSearchParams();\n\n Object.entries(params || {}).forEach(([key, value]) => {\n if (value !== undefined) {\n normalizedParams.append(\n key,\n value === null ? \"null\" : value.toString(),\n );\n }\n });\n\n const stringifiedParams = normalizedParams.toString();\n\n return stringifiedParams.length > 0\n ? baseURL + `/verify?${stringifiedParams}`\n : baseURL + `/verify`;\n };\n\n return {\n healthCheckHead,\n healthCheckGet,\n getVersion,\n refreshToken,\n signOut,\n signInEmailPassword,\n signInVerifyMfaTotp,\n signInPasswordlessEmail,\n signUpEmailPassword,\n changeUserMfaVerify,\n changeUserMfa,\n getJWKs,\n createPAT,\n signInAnonymous,\n signInOTPEmail,\n verifySignInOTPEmail,\n signInPAT,\n signInIdToken,\n linkIdToken,\n deanonymizeUser,\n changeUserEmail,\n sendVerificationEmail,\n changeUserPassword,\n sendPasswordResetEmail,\n verifyTicket,\n pushChainFunction,\n baseURL,\n };\n};\n"],"names":[],"mappings":";AA6fO,MAAM,kBAAkB,CAC7B,SACA,iBAAkC,OACvB;AACP,MAAA,QAAQ,oBAAoB,cAAc;AAExC,QAAA,oBAAoB,CAAC,kBAAiC;AAC1D,mBAAe,KAAK,aAAa;AACjC,YAAQ,oBAAoB,cAAc;AAAA,EAC5C;AAMM,QAAA,kBAAkB,OACtB,YACiC;AACjC,UAAM,MAAM,MAAM,MAAM,yBAAyB;AAAA,MAC/C,GAAG;AAAA,MACH,QAAQ;AAAA,IAAA,CACT;AAED,UAAM,OAAO,CAAC,KAAK,KAAK,KAAK,GAAG,EAAE,SAAS,IAAI,MAAM,IACjD,OACA,MAAM,IAAI,KAAK;AACnB,UAAM,UAAgB,OAAO,KAAK,MAAM,IAAI,IAAI,CAAC;AAEjD,UAAM,WAAW;AAAA,MACf,MAAM;AAAA,MACN,QAAQ,IAAI;AAAA,MACZ,SAAS,IAAI;AAAA,IACf;AAEI,QAAA,CAAC,IAAI,IAAI;AACL,YAAA;AAAA,IAAA;AAGD,WAAA;AAAA,EACT;AAEA,QAAM,wBAAwB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AAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.cjs.js","sources":["../../src/fetch/index.ts"],"sourcesContent":["/**\n * @fileoverview Enhanced fetch implementation with middleware support.\n *\n * This module provides a middleware pattern for the Fetch API, allowing\n * chain functions to be applied to requests and responses, such as\n * authentication token refreshing, error handling, and request/response transformation.\n */\n\n/**\n * Type definition for a fetch-like function.\n * Takes the same parameters as fetch and returns the same type.\n * This allows middleware to intercept and modify requests and responses.\n */\nexport type FetchFunction = (\n url: string,\n options?: RequestInit,\n) => Promise<Response>;\n\n/**\n * Type definition for a chain function (middleware).\n * Takes a fetch-like function and returns another fetch-like function.\n *\n * Chain functions can be used to implement:\n * - Authentication token handling\n * - Error handling and retry logic\n * - Request and response transformations\n * - Logging and metrics\n */\nexport type ChainFunction = (next: FetchFunction) => FetchFunction;\n\n/**\n * Creates an enhanced fetch function using a chain of middleware functions.\n *\n * The fetch chain executes in the order of the array, with each middleware\n * wrapping the next one in the chain. This allows each middleware to\n * intercept both the request (before calling next) and the response\n * (after calling next).\n *\n * @example\n * ```typescript\n * // Simple logging middleware\n * const loggingMiddleware: ChainFunction = (next) => {\n * return async (url, options) => {\n * console.log(`Request to ${url}`);\n * const response = await next(url, options);\n * console.log(`Response from ${url}: ${response.status}`);\n * return response;\n * };\n * };\n *\n * const enhancedFetch = createEnhancedFetch([loggingMiddleware]);\n * const response = await enhancedFetch('https://api.example.com/data');\n * ```\n *\n * @param chainFunctions - Array of chain functions to apply in order\n * @returns Enhanced fetch function with all middleware applied\n */\nexport function createEnhancedFetch(\n chainFunctions: ChainFunction[] = [],\n): FetchFunction {\n // Build the chain starting with vanilla fetch, but apply functions in reverse\n // to achieve the desired execution order\n return chainFunctions.reduceRight(\n (nextInChain, chainFunction) => chainFunction(nextInChain),\n fetch as FetchFunction,\n );\n}\n"],"names":["chainFunctions","reduceRight","nextInChain","chainFunction","fetch"],"mappings":"4GAyDgB,SACdA,EAAkC,IAIlC,OAAOA,EAAeC,aACpB,CAACC,EAAaC,IAAkBA,EAAcD,IAC9CE,MAEJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.es.js","sources":["../../src/fetch/index.ts"],"sourcesContent":["/**\n * @fileoverview Enhanced fetch implementation with middleware support.\n *\n * This module provides a middleware pattern for the Fetch API, allowing\n * chain functions to be applied to requests and responses, such as\n * authentication token refreshing, error handling, and request/response transformation.\n */\n\n/**\n * Type definition for a fetch-like function.\n * Takes the same parameters as fetch and returns the same type.\n * This allows middleware to intercept and modify requests and responses.\n */\nexport type FetchFunction = (\n url: string,\n options?: RequestInit,\n) => Promise<Response>;\n\n/**\n * Type definition for a chain function (middleware).\n * Takes a fetch-like function and returns another fetch-like function.\n *\n * Chain functions can be used to implement:\n * - Authentication token handling\n * - Error handling and retry logic\n * - Request and response transformations\n * - Logging and metrics\n */\nexport type ChainFunction = (next: FetchFunction) => FetchFunction;\n\n/**\n * Creates an enhanced fetch function using a chain of middleware functions.\n *\n * The fetch chain executes in the order of the array, with each middleware\n * wrapping the next one in the chain. This allows each middleware to\n * intercept both the request (before calling next) and the response\n * (after calling next).\n *\n * @example\n * ```typescript\n * // Simple logging middleware\n * const loggingMiddleware: ChainFunction = (next) => {\n * return async (url, options) => {\n * console.log(`Request to ${url}`);\n * const response = await next(url, options);\n * console.log(`Response from ${url}: ${response.status}`);\n * return response;\n * };\n * };\n *\n * const enhancedFetch = createEnhancedFetch([loggingMiddleware]);\n * const response = await enhancedFetch('https://api.example.com/data');\n * ```\n *\n * @param chainFunctions - Array of chain functions to apply in order\n * @returns Enhanced fetch function with all middleware applied\n */\nexport function createEnhancedFetch(\n chainFunctions: ChainFunction[] = [],\n): FetchFunction {\n // Build the chain starting with vanilla fetch, but apply functions in reverse\n // to achieve the desired execution order\n return chainFunctions.reduceRight(\n (nextInChain, chainFunction) => chainFunction(nextInChain),\n fetch as FetchFunction,\n );\n}\n"],"names":[],"mappings":"AAyDgB,SAAA,oBACd,iBAAkC,IACnB;AAGf,SAAO,eAAe;AAAA,IACpB,CAAC,aAAa,kBAAkB,cAAc,WAAW;AAAA,IACzD;AAAA,EACF;AACF;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./fetch.cjs.js");exports.createAPIClient=(e,s=[])=>{const a=t.createEnhancedFetch(s);return{fetch:async(t,s)=>{const n=await a(`${e}${t}`,s);let r;r=n.headers.get("content-type")?.includes("application/json")?await n.json():n.headers.get("content-type")?.startsWith("text/")?await n.text():await n.blob();const o={status:n.status,body:r,headers:n.headers};if(!n.ok)throw o;return o}}};
|
|
2
|
+
//# sourceMappingURL=functions.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.cjs.js","sources":["../../src/functions/client.ts"],"sourcesContent":["/**\n * @fileoverview Functions client for the Nhost JavaScript SDK.\n *\n * This module provides functionality for executing serverless function calls\n * against Nhost serverless functions.\n */\n\nimport { createEnhancedFetch } from \"../fetch\";\nimport type { ChainFunction } from \"../fetch\";\n\n/**\n * Response wrapper for function calls with additional metadata.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface FetchResponse<T = any> {\n /** The parsed response body */\n body: T;\n /** HTTP status code of the response */\n status: number;\n /** HTTP headers from the response */\n headers: Headers;\n}\n\n/**\n * Functions client interface providing methods for executing serverless function calls\n */\nexport interface Client {\n /**\n * Execute a request to a serverless function\n * The response body will be automatically parsed based on the content type into the following types:\n * - Object if the response is application/json\n * - string text string if the response is text/*\n * - Blob if the response is any other type\n *\n * @param path - The path to the serverless function\n * @param options - Additional fetch options to apply to the request\n * @returns Promise with the function response and metadata. */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n fetch: (path: string, options?: RequestInit) => Promise<FetchResponse<any>>;\n}\n\n/**\n * Creates a Functions API client for interacting with serverless functions.\n *\n * This client provides methods for executing requests against serverless functions,\n * with support for middleware functions to handle authentication, error handling,\n * and other cross-cutting concerns.\n *\n * @param baseURL - Base URL for the functions endpoint\n * @param chainFunctions - Array of middleware functions for the fetch chain\n * @returns Functions client with fetch method\n */\nexport const createAPIClient = (\n baseURL: string,\n chainFunctions: ChainFunction[] = [],\n) => {\n const enhancedFetch = createEnhancedFetch(chainFunctions);\n\n /**\n * Executes a request to a serverless function and processes the response\n *\n * @param path - The path to the serverless function\n * @param options - Additional fetch options to apply to the request\n * @returns Promise with the function response and metadata. Body will be either\n * - JSON object if the response is application/json\n - text string if the response is text/*\n - Blob if the response is any other type\n */\n const fetch = async (\n path: string,\n options?: RequestInit,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): Promise<FetchResponse<any>> => {\n const resp = await enhancedFetch(`${baseURL}${path}`, options);\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let body: any;\n // Process response based on content type\n if (resp.headers.get(\"content-type\")?.includes(\"application/json\")) {\n body = await resp.json();\n } else if (resp.headers.get(\"content-type\")?.startsWith(\"text/\")) {\n body = await resp.text();\n } else {\n body = await resp.blob();\n }\n\n // Create response payload with status, body and headers\n const payload = {\n status: resp.status,\n body: body,\n headers: resp.headers,\n };\n\n // Throw error for non-OK responses\n if (!resp.ok) {\n throw payload;\n }\n\n return payload;\n };\n\n // Return client object with the fetch method\n return {\n fetch,\n } as Client;\n};\n"],"names":["baseURL","chainFunctions","enhancedFetch","createEnhancedFetch","fetch","async","path","options","resp","body","headers","get","includes","json","startsWith","text","blob","payload","status","ok"],"mappings":"0IAoD+B,CAC7BA,EACAC,EAAkC,MAE5B,MAAAC,EAAgBC,sBAAoBF,GA8CnC,MAAA,CACLG,MAnCYC,MACZC,EACAC,KAGM,MAAAC,QAAaN,EAAc,GAAGF,IAAUM,IAAQC,GAGlD,IAAAE,EAGKA,EADLD,EAAKE,QAAQC,IAAI,iBAAiBC,SAAS,0BAChCJ,EAAKK,OACTL,EAAKE,QAAQC,IAAI,iBAAiBG,WAAW,eACzCN,EAAKO,aAELP,EAAKQ,OAIpB,MAAMC,EAAU,CACdC,OAAQV,EAAKU,OACbT,OACAC,QAASF,EAAKE,SAIZ,IAACF,EAAKW,GACF,MAAAF,EAGD,OAAAA,CAAA,EAMT"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createEnhancedFetch } from "./fetch.es.js";
|
|
2
|
+
const createAPIClient = (baseURL, chainFunctions = []) => {
|
|
3
|
+
const enhancedFetch = createEnhancedFetch(chainFunctions);
|
|
4
|
+
const fetch = async (path, options) => {
|
|
5
|
+
const resp = await enhancedFetch(`${baseURL}${path}`, options);
|
|
6
|
+
let body;
|
|
7
|
+
if (resp.headers.get("content-type")?.includes("application/json")) {
|
|
8
|
+
body = await resp.json();
|
|
9
|
+
} else if (resp.headers.get("content-type")?.startsWith("text/")) {
|
|
10
|
+
body = await resp.text();
|
|
11
|
+
} else {
|
|
12
|
+
body = await resp.blob();
|
|
13
|
+
}
|
|
14
|
+
const payload = {
|
|
15
|
+
status: resp.status,
|
|
16
|
+
body,
|
|
17
|
+
headers: resp.headers
|
|
18
|
+
};
|
|
19
|
+
if (!resp.ok) {
|
|
20
|
+
throw payload;
|
|
21
|
+
}
|
|
22
|
+
return payload;
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
fetch
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
createAPIClient
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=functions.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.es.js","sources":["../../src/functions/client.ts"],"sourcesContent":["/**\n * @fileoverview Functions client for the Nhost JavaScript SDK.\n *\n * This module provides functionality for executing serverless function calls\n * against Nhost serverless functions.\n */\n\nimport { createEnhancedFetch } from \"../fetch\";\nimport type { ChainFunction } from \"../fetch\";\n\n/**\n * Response wrapper for function calls with additional metadata.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface FetchResponse<T = any> {\n /** The parsed response body */\n body: T;\n /** HTTP status code of the response */\n status: number;\n /** HTTP headers from the response */\n headers: Headers;\n}\n\n/**\n * Functions client interface providing methods for executing serverless function calls\n */\nexport interface Client {\n /**\n * Execute a request to a serverless function\n * The response body will be automatically parsed based on the content type into the following types:\n * - Object if the response is application/json\n * - string text string if the response is text/*\n * - Blob if the response is any other type\n *\n * @param path - The path to the serverless function\n * @param options - Additional fetch options to apply to the request\n * @returns Promise with the function response and metadata. */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n fetch: (path: string, options?: RequestInit) => Promise<FetchResponse<any>>;\n}\n\n/**\n * Creates a Functions API client for interacting with serverless functions.\n *\n * This client provides methods for executing requests against serverless functions,\n * with support for middleware functions to handle authentication, error handling,\n * and other cross-cutting concerns.\n *\n * @param baseURL - Base URL for the functions endpoint\n * @param chainFunctions - Array of middleware functions for the fetch chain\n * @returns Functions client with fetch method\n */\nexport const createAPIClient = (\n baseURL: string,\n chainFunctions: ChainFunction[] = [],\n) => {\n const enhancedFetch = createEnhancedFetch(chainFunctions);\n\n /**\n * Executes a request to a serverless function and processes the response\n *\n * @param path - The path to the serverless function\n * @param options - Additional fetch options to apply to the request\n * @returns Promise with the function response and metadata. Body will be either\n * - JSON object if the response is application/json\n - text string if the response is text/*\n - Blob if the response is any other type\n */\n const fetch = async (\n path: string,\n options?: RequestInit,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): Promise<FetchResponse<any>> => {\n const resp = await enhancedFetch(`${baseURL}${path}`, options);\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let body: any;\n // Process response based on content type\n if (resp.headers.get(\"content-type\")?.includes(\"application/json\")) {\n body = await resp.json();\n } else if (resp.headers.get(\"content-type\")?.startsWith(\"text/\")) {\n body = await resp.text();\n } else {\n body = await resp.blob();\n }\n\n // Create response payload with status, body and headers\n const payload = {\n status: resp.status,\n body: body,\n headers: resp.headers,\n };\n\n // Throw error for non-OK responses\n if (!resp.ok) {\n throw payload;\n }\n\n return payload;\n };\n\n // Return client object with the fetch method\n return {\n fetch,\n } as Client;\n};\n"],"names":[],"mappings":";AAoDO,MAAM,kBAAkB,CAC7B,SACA,iBAAkC,OAC/B;AACG,QAAA,gBAAgB,oBAAoB,cAAc;AAYlD,QAAA,QAAQ,OACZ,MACA,YAEgC;AAC1B,UAAA,OAAO,MAAM,cAAc,GAAG,OAAO,GAAG,IAAI,IAAI,OAAO;AAGzD,QAAA;AAEJ,QAAI,KAAK,QAAQ,IAAI,cAAc,GAAG,SAAS,kBAAkB,GAAG;AAC3D,aAAA,MAAM,KAAK,KAAK;AAAA,IAAA,WACd,KAAK,QAAQ,IAAI,cAAc,GAAG,WAAW,OAAO,GAAG;AACzD,aAAA,MAAM,KAAK,KAAK;AAAA,IAAA,OAClB;AACE,aAAA,MAAM,KAAK,KAAK;AAAA,IAAA;AAIzB,UAAM,UAAU;AAAA,MACd,QAAQ,KAAK;AAAA,MACb;AAAA,MACA,SAAS,KAAK;AAAA,IAChB;AAGI,QAAA,CAAC,KAAK,IAAI;AACN,YAAA;AAAA,IAAA;AAGD,WAAA;AAAA,EACT;AAGO,SAAA;AAAA,IACL;AAAA,EACF;AACF;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./fetch.cjs.js");exports.createAPIClient=(t,r=[])=>{const s=e.createEnhancedFetch(r);return{post:(e,r)=>(async(e,r)=>{const a=await s(`${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),...r}),o=await a.text(),n=o?JSON.parse(o):{},c={body:n,status:a.status,headers:a.headers};if(n.errors)throw c;return c})(e,r)}};
|
|
2
|
+
//# sourceMappingURL=graphql.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql.cjs.js","sources":["../../src/graphql/client.ts"],"sourcesContent":["/**\n * @fileoverview GraphQL client for the Nhost JavaScript SDK.\n *\n * This module provides functionality for executing GraphQL operations against\n * a Hasura GraphQL API.\n */\n\nimport { createEnhancedFetch } from \"../fetch\";\nimport type { ChainFunction } from \"../fetch\";\n\n/**\n * Variables object for GraphQL operations.\n * Key-value pairs of variable names and their values.\n */\nexport interface GraphQLVariables {\n [key: string]: any; // eslint-disable-line @typescript-eslint/no-explicit-any\n}\n\n/**\n * GraphQL request object used for queries and mutations.\n */\nexport interface GraphQLRequest {\n /** The GraphQL query or mutation string */\n query: string;\n /** Optional variables for parameterized queries */\n variables?: GraphQLVariables;\n /** Optional name of the operation to execute */\n operationName?: string;\n}\n\n/**\n * Represents a GraphQL error returned from the server.\n */\nexport interface GraphQLError {\n /** Error message */\n message: string;\n /** Source locations in the GraphQL document where the error occurred */\n locations?: { line: number; column: number }[];\n /** Path in the query where the error occurred */\n path?: string[];\n /** Additional error information specific to the GraphQL implementation */\n extensions?: any; // eslint-disable-line @typescript-eslint/no-explicit-any\n}\n\n/**\n * Standard GraphQL response format as defined by the GraphQL specification.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface GraphQLResponse<T = any> {\n /** The data returned from successful execution */\n data?: T;\n /** Array of errors if execution was unsuccessful or partially successful */\n errors?: GraphQLError[];\n}\n\n/**\n * Response wrapper for GraphQL operations with additional metadata.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface FetchResponse<T = any> {\n /** The parsed response body */\n body: T;\n /** HTTP status code of the response */\n status: number;\n /** HTTP headers from the response */\n headers: Headers;\n}\n\n/**\n * GraphQL client interface providing methods for executing queries and mutations\n */\nexport interface Client {\n /**\n * Execute a GraphQL query operation\n *\n * Queries are used to fetch data and should not modify any data on the server.\n *\n * @param request - GraphQL request object containing query and optional variables\n * @param options - Additional fetch options to apply to the request\n * @returns Promise with the GraphQL response and metadata\n */\n post: (\n request: GraphQLRequest,\n options?: RequestInit,\n ) => Promise<FetchResponse<GraphQLResponse>>;\n}\n\n/**\n * Creates a GraphQL API client for interacting with a GraphQL endpoint.\n *\n * This client provides methods for executing queries and mutations against\n * a GraphQL API, with support for middleware functions to handle authentication,\n * error handling, and other cross-cutting concerns.\n *\n * @param baseURL - Base URL for the GraphQL endpoint\n * @param chainFunctions - Array of middleware functions for the fetch chain\n * @returns GraphQL client with query and mutation methods\n */\nexport const createAPIClient = (\n baseURL: string,\n chainFunctions: ChainFunction[] = [],\n) => {\n const enhancedFetch = createEnhancedFetch(chainFunctions);\n\n const executeOperation = async (\n request: GraphQLRequest,\n options?: RequestInit,\n ): Promise<FetchResponse<GraphQLResponse>> => {\n const response = await enhancedFetch(`${baseURL}`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(request),\n ...options,\n });\n\n const body = await response.text();\n const data: GraphQLResponse = body ? JSON.parse(body) : {};\n\n const resp = {\n body: data,\n status: response.status,\n headers: response.headers,\n };\n\n if (data.errors) {\n throw resp;\n }\n\n return resp;\n };\n\n const post = (\n request: GraphQLRequest,\n options?: RequestInit,\n ): Promise<FetchResponse<GraphQLResponse>> => {\n return executeOperation(request, options);\n };\n\n return {\n post,\n } as Client;\n};\n"],"names":["baseURL","chainFunctions","enhancedFetch","createEnhancedFetch","post","request","options","async","response","method","headers","body","JSON","stringify","text","data","parse","resp","status","errors","executeOperation"],"mappings":"0IAkG+B,CAC7BA,EACAC,EAAkC,MAE5B,MAAAC,EAAgBC,sBAAoBF,GAsCnC,MAAA,CACLG,KARW,CACXC,EACAC,IA/BuBC,OACvBF,EACAC,KAEA,MAAME,QAAiBN,EAAc,GAAGF,IAAW,CACjDS,OAAQ,OACRC,QAAS,CACP,eAAgB,oBAElBC,KAAMC,KAAKC,UAAUR,MAClBC,IAGCK,QAAaH,EAASM,OACtBC,EAAwBJ,EAAOC,KAAKI,MAAML,GAAQ,CAAC,EAEnDM,EAAO,CACXN,KAAMI,EACNG,OAAQV,EAASU,OACjBR,QAASF,EAASE,SAGpB,GAAIK,EAAKI,OACD,MAAAF,EAGD,OAAAA,CAAA,EAOAG,CAAiBf,EAASC,GAKnC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createEnhancedFetch } from "./fetch.es.js";
|
|
2
|
+
const createAPIClient = (baseURL, chainFunctions = []) => {
|
|
3
|
+
const enhancedFetch = createEnhancedFetch(chainFunctions);
|
|
4
|
+
const executeOperation = async (request, options) => {
|
|
5
|
+
const response = await enhancedFetch(`${baseURL}`, {
|
|
6
|
+
method: "POST",
|
|
7
|
+
headers: {
|
|
8
|
+
"Content-Type": "application/json"
|
|
9
|
+
},
|
|
10
|
+
body: JSON.stringify(request),
|
|
11
|
+
...options
|
|
12
|
+
});
|
|
13
|
+
const body = await response.text();
|
|
14
|
+
const data = body ? JSON.parse(body) : {};
|
|
15
|
+
const resp = {
|
|
16
|
+
body: data,
|
|
17
|
+
status: response.status,
|
|
18
|
+
headers: response.headers
|
|
19
|
+
};
|
|
20
|
+
if (data.errors) {
|
|
21
|
+
throw resp;
|
|
22
|
+
}
|
|
23
|
+
return resp;
|
|
24
|
+
};
|
|
25
|
+
const post = (request, options) => {
|
|
26
|
+
return executeOperation(request, options);
|
|
27
|
+
};
|
|
28
|
+
return {
|
|
29
|
+
post
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
createAPIClient
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=graphql.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql.es.js","sources":["../../src/graphql/client.ts"],"sourcesContent":["/**\n * @fileoverview GraphQL client for the Nhost JavaScript SDK.\n *\n * This module provides functionality for executing GraphQL operations against\n * a Hasura GraphQL API.\n */\n\nimport { createEnhancedFetch } from \"../fetch\";\nimport type { ChainFunction } from \"../fetch\";\n\n/**\n * Variables object for GraphQL operations.\n * Key-value pairs of variable names and their values.\n */\nexport interface GraphQLVariables {\n [key: string]: any; // eslint-disable-line @typescript-eslint/no-explicit-any\n}\n\n/**\n * GraphQL request object used for queries and mutations.\n */\nexport interface GraphQLRequest {\n /** The GraphQL query or mutation string */\n query: string;\n /** Optional variables for parameterized queries */\n variables?: GraphQLVariables;\n /** Optional name of the operation to execute */\n operationName?: string;\n}\n\n/**\n * Represents a GraphQL error returned from the server.\n */\nexport interface GraphQLError {\n /** Error message */\n message: string;\n /** Source locations in the GraphQL document where the error occurred */\n locations?: { line: number; column: number }[];\n /** Path in the query where the error occurred */\n path?: string[];\n /** Additional error information specific to the GraphQL implementation */\n extensions?: any; // eslint-disable-line @typescript-eslint/no-explicit-any\n}\n\n/**\n * Standard GraphQL response format as defined by the GraphQL specification.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface GraphQLResponse<T = any> {\n /** The data returned from successful execution */\n data?: T;\n /** Array of errors if execution was unsuccessful or partially successful */\n errors?: GraphQLError[];\n}\n\n/**\n * Response wrapper for GraphQL operations with additional metadata.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface FetchResponse<T = any> {\n /** The parsed response body */\n body: T;\n /** HTTP status code of the response */\n status: number;\n /** HTTP headers from the response */\n headers: Headers;\n}\n\n/**\n * GraphQL client interface providing methods for executing queries and mutations\n */\nexport interface Client {\n /**\n * Execute a GraphQL query operation\n *\n * Queries are used to fetch data and should not modify any data on the server.\n *\n * @param request - GraphQL request object containing query and optional variables\n * @param options - Additional fetch options to apply to the request\n * @returns Promise with the GraphQL response and metadata\n */\n post: (\n request: GraphQLRequest,\n options?: RequestInit,\n ) => Promise<FetchResponse<GraphQLResponse>>;\n}\n\n/**\n * Creates a GraphQL API client for interacting with a GraphQL endpoint.\n *\n * This client provides methods for executing queries and mutations against\n * a GraphQL API, with support for middleware functions to handle authentication,\n * error handling, and other cross-cutting concerns.\n *\n * @param baseURL - Base URL for the GraphQL endpoint\n * @param chainFunctions - Array of middleware functions for the fetch chain\n * @returns GraphQL client with query and mutation methods\n */\nexport const createAPIClient = (\n baseURL: string,\n chainFunctions: ChainFunction[] = [],\n) => {\n const enhancedFetch = createEnhancedFetch(chainFunctions);\n\n const executeOperation = async (\n request: GraphQLRequest,\n options?: RequestInit,\n ): Promise<FetchResponse<GraphQLResponse>> => {\n const response = await enhancedFetch(`${baseURL}`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(request),\n ...options,\n });\n\n const body = await response.text();\n const data: GraphQLResponse = body ? JSON.parse(body) : {};\n\n const resp = {\n body: data,\n status: response.status,\n headers: response.headers,\n };\n\n if (data.errors) {\n throw resp;\n }\n\n return resp;\n };\n\n const post = (\n request: GraphQLRequest,\n options?: RequestInit,\n ): Promise<FetchResponse<GraphQLResponse>> => {\n return executeOperation(request, options);\n };\n\n return {\n post,\n } as Client;\n};\n"],"names":[],"mappings":";AAkGO,MAAM,kBAAkB,CAC7B,SACA,iBAAkC,OAC/B;AACG,QAAA,gBAAgB,oBAAoB,cAAc;AAElD,QAAA,mBAAmB,OACvB,SACA,YAC4C;AAC5C,UAAM,WAAW,MAAM,cAAc,GAAG,OAAO,IAAI;AAAA,MACjD,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,gBAAgB;AAAA,MAClB;AAAA,MACA,MAAM,KAAK,UAAU,OAAO;AAAA,MAC5B,GAAG;AAAA,IAAA,CACJ;AAEK,UAAA,OAAO,MAAM,SAAS,KAAK;AACjC,UAAM,OAAwB,OAAO,KAAK,MAAM,IAAI,IAAI,CAAC;AAEzD,UAAM,OAAO;AAAA,MACX,MAAM;AAAA,MACN,QAAQ,SAAS;AAAA,MACjB,SAAS,SAAS;AAAA,IACpB;AAEA,QAAI,KAAK,QAAQ;AACT,YAAA;AAAA,IAAA;AAGD,WAAA;AAAA,EACT;AAEM,QAAA,OAAO,CACX,SACA,YAC4C;AACrC,WAAA,iBAAiB,SAAS,OAAO;AAAA,EAC1C;AAEO,SAAA;AAAA,IACL;AAAA,EACF;AACF;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./fetch.cjs.js");exports.createAPIClient=(e,a=[])=>{let s=t.createEnhancedFetch(a);const n=()=>e+"/openapi.yaml",r=()=>e+"/version",i=()=>e+"/files/",o=(t,a)=>{const s=new URLSearchParams;Object.entries(a||{}).forEach((([t,e])=>{void 0!==e&&s.append(t,null===e?"null":e.toString())}));const n=s.toString();return n.length>0?e+`/files/${t}?${n}`:e+`/files/${t}`},d=(t,a)=>{const s=new URLSearchParams;Object.entries(a||{}).forEach((([t,e])=>{void 0!==e&&s.append(t,null===e?"null":e.toString())}));const n=s.toString();return n.length>0?e+`/files/${t}?${n}`:e+`/files/${t}`},u=t=>e+`/files/${t}`,l=t=>e+`/files/${t}`;return{getOpenAPISpec:async t=>{const e=await s(n(),{...t,method:"GET"}),a=[204,205,304,412].includes(e.status)?null:await e.text(),r={body:a?JSON.parse(a):{},status:e.status,headers:e.headers};if(!e.ok)throw r;return r},getVersion:async t=>{const e=await s(r(),{...t,method:"GET"}),a=[204,205,304,412].includes(e.status)?null:await e.text(),n={body:a?JSON.parse(a):{},status:e.status,headers:e.headers};if(!e.ok)throw n;return n},uploadFiles:async(t,e)=>{const a=new FormData;void 0!==t["bucket-id"]&&a.append("bucket-id",t["bucket-id"]),void 0!==t["metadata[]"]&&t["metadata[]"].forEach((t=>a.append("metadata[]",JSON.stringify(t)))),void 0!==t["file[]"]&&t["file[]"].forEach((t=>a.append("file[]",t)));const n=await s(i(),{...e,method:"POST",body:a}),r=[204,205,304,412].includes(n.status)?null:await n.text(),o={body:r?JSON.parse(r):{},status:n.status,headers:n.headers};if(!n.ok)throw o;return o},getFileMetadataHeaders:async(t,e,a)=>{const n=await s(o(t,e),{...a,method:"HEAD"}),r=[204,205,304,412].includes(n.status)?null:await n.text(),i={body:r?JSON.parse(r):{},status:n.status,headers:n.headers};if(!n.ok)throw i;return i},getFile:async(t,e,a)=>{const n=await s(d(t,e),{...a,method:"GET"}),r={body:await n.blob(),status:n.status,headers:n.headers};if(!n.ok)throw r;return r},replaceFile:async(t,e,a)=>{const n=new FormData;void 0!==e.metadata&&n.append("metadata",JSON.stringify(e.metadata)),void 0!==e.file&&n.append("file",e.file);const r=await s(u(t),{...a,method:"PUT",body:n}),i=[204,205,304,412].includes(r.status)?null:await r.text(),o={body:i?JSON.parse(i):{},status:r.status,headers:r.headers};if(!r.ok)throw o;return o},deleteFile:async(t,e)=>{const a=await s(l(t),{...e,method:"DELETE"}),n=[204,205,304,412].includes(a.status)?null:await a.text(),r={body:n?JSON.parse(n):{},status:a.status,headers:a.headers};if(!a.ok)throw r;return r},pushChainFunction:e=>{a.push(e),s=t.createEnhancedFetch(a)},baseURL:e}};
|
|
2
|
+
//# sourceMappingURL=storage.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.cjs.js","sources":["../../src/storage/client.ts"],"sourcesContent":["/**\n * Generated by orval v7.9.0 🍺\n * Do not edit manually.\n * Nhost Storage API\n * Nhost Storage API - A service for managing and serving files with powerful access control capabilities\n * OpenAPI spec version: 1.0.0\n */\nimport { createEnhancedFetch } from \"../fetch\";\nimport type { ChainFunction } from \"../fetch\";\n\nimport type { Client } from \"./interface\";\n\n/**\n * Contains version information about the storage service.\n */\nexport interface VersionInformation {\n /** The version number of the storage service build. */\n buildVersion?: string;\n}\n\n/**\n * Basic information about a file in storage.\n */\nexport interface FileSummary {\n /** Unique identifier for the file. */\n id?: string;\n /** Name of the file including extension. */\n name?: string;\n /** ID of the bucket containing the file. */\n bucketId?: string;\n /** Whether the file has been successfully uploaded. */\n isUploaded?: boolean;\n}\n\n/**\n * Custom metadata associated with the file.\n */\nexport type FileMetadataMetadata = { [key: string]: unknown };\n\n/**\n * Comprehensive metadata information about a file in storage.\n */\nexport interface FileMetadata {\n /** Unique identifier for the file. */\n id?: string;\n /** Name of the file including extension. */\n name?: string;\n /** Size of the file in bytes. */\n size?: number;\n /** ID of the bucket containing the file. */\n bucketId?: string;\n /** Entity tag for cache validation. */\n etag?: string;\n /** Timestamp when the file was created. */\n createdAt?: string;\n /** Timestamp when the file was last updated. */\n updatedAt?: string;\n /** Whether the file has been successfully uploaded. */\n isUploaded?: boolean;\n /** MIME type of the file. */\n mimeType?: string;\n /** ID of the user who uploaded the file. */\n uploadedByUserId?: string;\n /** Custom metadata associated with the file. */\n metadata?: FileMetadataMetadata;\n}\n\n/**\n * Custom metadata to associate with the file.\n */\nexport type UploadFileMetadataMetadata = { [key: string]: unknown };\n\n/**\n * Metadata provided when uploading a new file.\n */\nexport interface UploadFileMetadata {\n /** Optional custom ID for the file. If not provided, a UUID will be generated. */\n id?: string;\n /** Name to assign to the file. If not provided, the original filename will be used. */\n name?: string;\n /** Custom metadata to associate with the file. */\n metadata?: UploadFileMetadataMetadata;\n}\n\n/**\n * Updated custom metadata to associate with the file.\n */\nexport type UpdateFileMetadataMetadata = { [key: string]: unknown };\n\n/**\n * Metadata that can be updated for an existing file.\n */\nexport interface UpdateFileMetadata {\n /** New name to assign to the file. */\n name?: string;\n /** Updated custom metadata to associate with the file. */\n metadata?: UpdateFileMetadataMetadata;\n}\n\n/**\n * Contains a presigned URL for direct file operations.\n */\nexport interface PresignedURLResponse {\n /** The presigned URL for file operations. */\n url?: string;\n /** The time in seconds until the URL expires. */\n expiration?: number;\n}\n\n/**\n * Error details.\n */\nexport type ErrorError = {\n /** Human-readable error message. */\n message: string;\n};\n\n/**\n * Error information returned by the API.\n */\nexport interface Error {\n /** Error details. */\n error?: ErrorError;\n}\n\nexport type GetOpenAPISpec200 = { [key: string]: unknown };\n\nexport type UploadFilesBody = {\n /** Target bucket identifier where files will be stored. */\n \"bucket-id\"?: string;\n /** Optional custom metadata for each uploaded file. Must match the order of the file[] array. */\n \"metadata[]\"?: UploadFileMetadata[];\n /** Array of files to upload. */\n \"file[]\"?: Blob[];\n};\n\nexport type UploadFiles201 = {\n /** List of successfully processed files with their metadata. */\n processedFiles?: FileMetadata[];\n};\n\nexport type GetFileMetadataHeadersParams = {\n /**\n * Image quality (1-100). Only applies to JPEG, WebP and PNG files\n */\n q?: number;\n /**\n * Maximum height to resize image to while maintaining aspect ratio. Only applies to image files\n */\n h?: number;\n /**\n * Maximum width to resize image to while maintaining aspect ratio. Only applies to image files\n */\n w?: number;\n /**\n * Blur the image using this sigma value. Only applies to image files\n */\n b?: number;\n /**\n * Output format for image files. Use 'auto' for content negotiation based on Accept header\n */\n f?: GetFileMetadataHeadersF;\n};\n\nexport type GetFileMetadataHeadersF =\n | \"auto\"\n | \"same\"\n | \"jpeg\"\n | \"webp\"\n | \"png\"\n | \"avif\";\nexport type GetFileParams = {\n /**\n * Image quality (1-100). Only applies to JPEG, WebP and PNG files\n */\n q?: number;\n /**\n * Maximum height to resize image to while maintaining aspect ratio. Only applies to image files\n */\n h?: number;\n /**\n * Maximum width to resize image to while maintaining aspect ratio. Only applies to image files\n */\n w?: number;\n /**\n * Blur the image using this sigma value. Only applies to image files\n */\n b?: number;\n /**\n * Output format for image files. Use 'auto' for content negotiation based on Accept header\n */\n f?: GetFileF;\n};\n\nexport type GetFileF = \"auto\" | \"same\" | \"jpeg\" | \"webp\" | \"png\" | \"avif\";\nexport type ReplaceFileBody = {\n /** Optional metadata to update for the file */\n metadata?: UpdateFileMetadata;\n /** New file content to replace the existing file */\n file?: Blob;\n};\n\nexport type FetchResponse<T> = {\n body: T;\n status: number;\n headers: Headers;\n};\n\nexport const createAPIClient = (\n baseURL: string,\n chainFunctions: ChainFunction[] = [],\n): Client => {\n let fetch = createEnhancedFetch(chainFunctions);\n\n const pushChainFunction = (chainFunction: ChainFunction) => {\n chainFunctions.push(chainFunction);\n fetch = createEnhancedFetch(chainFunctions);\n };\n\n /**\n * Returns the OpenAPI schema definition for this API, allowing clients to understand the available endpoints and models.\n * @summary Get OpenAPI specification\n */\n const getOpenAPISpec = async (\n options?: RequestInit,\n ): Promise<FetchResponse<GetOpenAPISpec200>> => {\n const res = await fetch(getGetOpenAPISpecUrl(), {\n ...options,\n method: \"GET\",\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: GetOpenAPISpec200 = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<GetOpenAPISpec200>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getGetOpenAPISpecUrl = () => {\n return baseURL + `/openapi.yaml`;\n };\n\n /**\n * Retrieves build and version information about the storage service. Useful for monitoring and debugging.\n * @summary Get service version information\n */\n const getVersion = async (\n options?: RequestInit,\n ): Promise<FetchResponse<VersionInformation>> => {\n const res = await fetch(getGetVersionUrl(), {\n ...options,\n method: \"GET\",\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: VersionInformation = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<VersionInformation>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getGetVersionUrl = () => {\n return baseURL + `/version`;\n };\n\n /**\n * Upload one or more files to a specified bucket. Supports batch uploading with optional custom metadata for each file. If uploading multiple files, either provide metadata for all files or none.\n * @summary Upload files\n */\n const uploadFiles = async (\n uploadFilesBody: UploadFilesBody,\n options?: RequestInit,\n ): Promise<FetchResponse<UploadFiles201>> => {\n const formData = new FormData();\n if (uploadFilesBody[\"bucket-id\"] !== undefined) {\n formData.append(`bucket-id`, uploadFilesBody[\"bucket-id\"]);\n }\n if (uploadFilesBody[\"metadata[]\"] !== undefined) {\n uploadFilesBody[\"metadata[]\"].forEach((value) =>\n formData.append(`metadata[]`, JSON.stringify(value)),\n );\n }\n if (uploadFilesBody[\"file[]\"] !== undefined) {\n uploadFilesBody[\"file[]\"].forEach((value) =>\n formData.append(`file[]`, value),\n );\n }\n\n const res = await fetch(getUploadFilesUrl(), {\n ...options,\n method: \"POST\",\n body: formData,\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: UploadFiles201 = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<UploadFiles201>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getUploadFilesUrl = () => {\n return baseURL + `/files/`;\n };\n\n /**\n * Retrieve file metadata headers without downloading the file content. Supports conditional requests and provides caching information.\n * @summary Check file information\n */\n const getFileMetadataHeaders = async (\n id: string,\n params?: GetFileMetadataHeadersParams,\n options?: RequestInit,\n ): Promise<FetchResponse<void>> => {\n const res = await fetch(getGetFileMetadataHeadersUrl(id, params), {\n ...options,\n method: \"HEAD\",\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: void = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<void>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getGetFileMetadataHeadersUrl = (\n id: string,\n params?: GetFileMetadataHeadersParams,\n ) => {\n const normalizedParams = new URLSearchParams();\n\n Object.entries(params || {}).forEach(([key, value]) => {\n if (value !== undefined) {\n normalizedParams.append(\n key,\n value === null ? \"null\" : value.toString(),\n );\n }\n });\n\n const stringifiedParams = normalizedParams.toString();\n\n return stringifiedParams.length > 0\n ? baseURL + `/files/${id}?${stringifiedParams}`\n : baseURL + `/files/${id}`;\n };\n\n /**\n * Retrieve and download the complete file content. Supports conditional requests, image transformations, and range requests for partial downloads.\n * @summary Download file\n */\n const getFile = async (\n id: string,\n params?: GetFileParams,\n options?: RequestInit,\n ): Promise<FetchResponse<Blob>> => {\n const res = await fetch(getGetFileUrl(id, params), {\n ...options,\n method: \"GET\",\n });\n\n const payload: Blob = await res.blob();\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<Blob>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getGetFileUrl = (id: string, params?: GetFileParams) => {\n const normalizedParams = new URLSearchParams();\n\n Object.entries(params || {}).forEach(([key, value]) => {\n if (value !== undefined) {\n normalizedParams.append(\n key,\n value === null ? \"null\" : value.toString(),\n );\n }\n });\n\n const stringifiedParams = normalizedParams.toString();\n\n return stringifiedParams.length > 0\n ? baseURL + `/files/${id}?${stringifiedParams}`\n : baseURL + `/files/${id}`;\n };\n\n /**\n * Replace an existing file with new content while preserving the file ID. The operation follows these steps:\n1. The isUploaded flag is set to false to mark the file as being updated\n2. The file content is replaced in the storage backend\n3. File metadata is updated (size, mime-type, isUploaded, etc.)\n\nEach step is atomic, but if a step fails, previous steps will not be automatically rolled back.\n\n * @summary Replace file\n */\n const replaceFile = async (\n id: string,\n replaceFileBody: ReplaceFileBody,\n options?: RequestInit,\n ): Promise<FetchResponse<FileMetadata>> => {\n const formData = new FormData();\n if (replaceFileBody.metadata !== undefined) {\n formData.append(`metadata`, JSON.stringify(replaceFileBody.metadata));\n }\n if (replaceFileBody.file !== undefined) {\n formData.append(`file`, replaceFileBody.file);\n }\n\n const res = await fetch(getReplaceFileUrl(id), {\n ...options,\n method: \"PUT\",\n body: formData,\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: FileMetadata = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<FileMetadata>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getReplaceFileUrl = (id: string) => {\n return baseURL + `/files/${id}`;\n };\n\n /**\n * Permanently delete a file from storage. This removes both the file content and its associated metadata.\n * @summary Delete file\n */\n const deleteFile = async (\n id: string,\n options?: RequestInit,\n ): Promise<FetchResponse<void>> => {\n const res = await fetch(getDeleteFileUrl(id), {\n ...options,\n method: \"DELETE\",\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: void = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<void>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getDeleteFileUrl = (id: string) => {\n return baseURL + `/files/${id}`;\n };\n\n return {\n getOpenAPISpec,\n getVersion,\n uploadFiles,\n getFileMetadataHeaders,\n getFile,\n replaceFile,\n deleteFile,\n pushChainFunction,\n baseURL,\n };\n};\n"],"names":["baseURL","chainFunctions","fetch","createEnhancedFetch","getGetOpenAPISpecUrl","getGetVersionUrl","getUploadFilesUrl","getGetFileMetadataHeadersUrl","id","params","normalizedParams","URLSearchParams","Object","entries","forEach","key","value","append","toString","stringifiedParams","length","getGetFileUrl","getReplaceFileUrl","getDeleteFileUrl","getOpenAPISpec","async","options","res","method","body","includes","status","text","response","JSON","parse","headers","ok","getVersion","uploadFiles","uploadFilesBody","formData","FormData","stringify","getFileMetadataHeaders","getFile","blob","replaceFile","replaceFileBody","metadata","file","deleteFile","pushChainFunction","chainFunction","push"],"mappings":"0IAgN+B,CAC7BA,EACAC,EAAkC,MAE9B,IAAAC,EAAQC,sBAAoBF,GAE1B,MAmCAG,EAAuB,IACpBJ,EAAU,gBAiCbK,EAAmB,IAChBL,EAAU,WAkDbM,EAAoB,IACjBN,EAAU,UAmCbO,EAA+B,CACnCC,EACAC,KAEM,MAAAC,EAAmB,IAAIC,gBAEtBC,OAAAC,QAAQJ,GAAU,CAAE,GAAEK,SAAQ,EAAEC,EAAKC,WAC5B,IAAVA,GACeN,EAAAO,OACfF,EACU,OAAVC,EAAiB,OAASA,EAAME,WAClC,IAIE,MAAAC,EAAoBT,EAAiBQ,WAEpC,OAAAC,EAAkBC,OAAS,EAC9BpB,EAAU,UAAUQ,KAAMW,IAC1BnB,EAAU,UAAUQ,GAAE,EAgCtBa,EAAgB,CAACb,EAAYC,KAC3B,MAAAC,EAAmB,IAAIC,gBAEtBC,OAAAC,QAAQJ,GAAU,CAAE,GAAEK,SAAQ,EAAEC,EAAKC,WAC5B,IAAVA,GACeN,E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AGRC,EAAW,CACfJ,KAH4BA,EAAOK,KAAKC,MAAMN,GAAQ,CAAC,EAIvDE,OAAQJ,EAAII,OACZK,QAAST,EAAIS,SAGX,IAACT,EAAIU,GACD,MAAAJ,EAGD,OAAAA,CAAA,EAiDPkB,WAtCiB1B,MACjBjB,EACAkB,KAEA,MAAMC,QAAYzB,EAAMqB,EAAiBf,GAAK,IACzCkB,EACHE,OAAQ,WAGJC,EAAO,CAAC,IAAK,IAAK,IAAK,KAAKC,SAASH,EAAII,QAC3C,WACMJ,EAAIK,OAGRC,EAAW,CACfJ,KAHoBA,EAAOK,KAAKC,MAAMN,GAAQ,CAAC,EAI/CE,OAAQJ,EAAII,OACZK,QAAST,EAAIS,SAGX,IAACT,EAAIU,GACD,MAAAJ,EAGD,OAAAA,CAAA,EAePmB,kBAhUyBC,IACzBpD,EAAeqD,KAAKD,GACZlD,EAAAA,sBAAoBF,EAAc,EA+T1CD,UACF"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { createEnhancedFetch } from "./fetch.es.js";
|
|
2
|
+
const createAPIClient = (baseURL, chainFunctions = []) => {
|
|
3
|
+
let fetch = createEnhancedFetch(chainFunctions);
|
|
4
|
+
const pushChainFunction = (chainFunction) => {
|
|
5
|
+
chainFunctions.push(chainFunction);
|
|
6
|
+
fetch = createEnhancedFetch(chainFunctions);
|
|
7
|
+
};
|
|
8
|
+
const getOpenAPISpec = async (options) => {
|
|
9
|
+
const res = await fetch(getGetOpenAPISpecUrl(), {
|
|
10
|
+
...options,
|
|
11
|
+
method: "GET"
|
|
12
|
+
});
|
|
13
|
+
const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
|
|
14
|
+
const payload = body ? JSON.parse(body) : {};
|
|
15
|
+
const response = {
|
|
16
|
+
body: payload,
|
|
17
|
+
status: res.status,
|
|
18
|
+
headers: res.headers
|
|
19
|
+
};
|
|
20
|
+
if (!res.ok) {
|
|
21
|
+
throw response;
|
|
22
|
+
}
|
|
23
|
+
return response;
|
|
24
|
+
};
|
|
25
|
+
const getGetOpenAPISpecUrl = () => {
|
|
26
|
+
return baseURL + `/openapi.yaml`;
|
|
27
|
+
};
|
|
28
|
+
const getVersion = async (options) => {
|
|
29
|
+
const res = await fetch(getGetVersionUrl(), {
|
|
30
|
+
...options,
|
|
31
|
+
method: "GET"
|
|
32
|
+
});
|
|
33
|
+
const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
|
|
34
|
+
const payload = body ? JSON.parse(body) : {};
|
|
35
|
+
const response = {
|
|
36
|
+
body: payload,
|
|
37
|
+
status: res.status,
|
|
38
|
+
headers: res.headers
|
|
39
|
+
};
|
|
40
|
+
if (!res.ok) {
|
|
41
|
+
throw response;
|
|
42
|
+
}
|
|
43
|
+
return response;
|
|
44
|
+
};
|
|
45
|
+
const getGetVersionUrl = () => {
|
|
46
|
+
return baseURL + `/version`;
|
|
47
|
+
};
|
|
48
|
+
const uploadFiles = async (uploadFilesBody, options) => {
|
|
49
|
+
const formData = new FormData();
|
|
50
|
+
if (uploadFilesBody["bucket-id"] !== void 0) {
|
|
51
|
+
formData.append(`bucket-id`, uploadFilesBody["bucket-id"]);
|
|
52
|
+
}
|
|
53
|
+
if (uploadFilesBody["metadata[]"] !== void 0) {
|
|
54
|
+
uploadFilesBody["metadata[]"].forEach(
|
|
55
|
+
(value) => formData.append(`metadata[]`, JSON.stringify(value))
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
if (uploadFilesBody["file[]"] !== void 0) {
|
|
59
|
+
uploadFilesBody["file[]"].forEach(
|
|
60
|
+
(value) => formData.append(`file[]`, value)
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
const res = await fetch(getUploadFilesUrl(), {
|
|
64
|
+
...options,
|
|
65
|
+
method: "POST",
|
|
66
|
+
body: formData
|
|
67
|
+
});
|
|
68
|
+
const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
|
|
69
|
+
const payload = body ? JSON.parse(body) : {};
|
|
70
|
+
const response = {
|
|
71
|
+
body: payload,
|
|
72
|
+
status: res.status,
|
|
73
|
+
headers: res.headers
|
|
74
|
+
};
|
|
75
|
+
if (!res.ok) {
|
|
76
|
+
throw response;
|
|
77
|
+
}
|
|
78
|
+
return response;
|
|
79
|
+
};
|
|
80
|
+
const getUploadFilesUrl = () => {
|
|
81
|
+
return baseURL + `/files/`;
|
|
82
|
+
};
|
|
83
|
+
const getFileMetadataHeaders = async (id, params, options) => {
|
|
84
|
+
const res = await fetch(getGetFileMetadataHeadersUrl(id, params), {
|
|
85
|
+
...options,
|
|
86
|
+
method: "HEAD"
|
|
87
|
+
});
|
|
88
|
+
const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
|
|
89
|
+
const payload = body ? JSON.parse(body) : {};
|
|
90
|
+
const response = {
|
|
91
|
+
body: payload,
|
|
92
|
+
status: res.status,
|
|
93
|
+
headers: res.headers
|
|
94
|
+
};
|
|
95
|
+
if (!res.ok) {
|
|
96
|
+
throw response;
|
|
97
|
+
}
|
|
98
|
+
return response;
|
|
99
|
+
};
|
|
100
|
+
const getGetFileMetadataHeadersUrl = (id, params) => {
|
|
101
|
+
const normalizedParams = new URLSearchParams();
|
|
102
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
103
|
+
if (value !== void 0) {
|
|
104
|
+
normalizedParams.append(
|
|
105
|
+
key,
|
|
106
|
+
value === null ? "null" : value.toString()
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
const stringifiedParams = normalizedParams.toString();
|
|
111
|
+
return stringifiedParams.length > 0 ? baseURL + `/files/${id}?${stringifiedParams}` : baseURL + `/files/${id}`;
|
|
112
|
+
};
|
|
113
|
+
const getFile = async (id, params, options) => {
|
|
114
|
+
const res = await fetch(getGetFileUrl(id, params), {
|
|
115
|
+
...options,
|
|
116
|
+
method: "GET"
|
|
117
|
+
});
|
|
118
|
+
const payload = await res.blob();
|
|
119
|
+
const response = {
|
|
120
|
+
body: payload,
|
|
121
|
+
status: res.status,
|
|
122
|
+
headers: res.headers
|
|
123
|
+
};
|
|
124
|
+
if (!res.ok) {
|
|
125
|
+
throw response;
|
|
126
|
+
}
|
|
127
|
+
return response;
|
|
128
|
+
};
|
|
129
|
+
const getGetFileUrl = (id, params) => {
|
|
130
|
+
const normalizedParams = new URLSearchParams();
|
|
131
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
132
|
+
if (value !== void 0) {
|
|
133
|
+
normalizedParams.append(
|
|
134
|
+
key,
|
|
135
|
+
value === null ? "null" : value.toString()
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
const stringifiedParams = normalizedParams.toString();
|
|
140
|
+
return stringifiedParams.length > 0 ? baseURL + `/files/${id}?${stringifiedParams}` : baseURL + `/files/${id}`;
|
|
141
|
+
};
|
|
142
|
+
const replaceFile = async (id, replaceFileBody, options) => {
|
|
143
|
+
const formData = new FormData();
|
|
144
|
+
if (replaceFileBody.metadata !== void 0) {
|
|
145
|
+
formData.append(`metadata`, JSON.stringify(replaceFileBody.metadata));
|
|
146
|
+
}
|
|
147
|
+
if (replaceFileBody.file !== void 0) {
|
|
148
|
+
formData.append(`file`, replaceFileBody.file);
|
|
149
|
+
}
|
|
150
|
+
const res = await fetch(getReplaceFileUrl(id), {
|
|
151
|
+
...options,
|
|
152
|
+
method: "PUT",
|
|
153
|
+
body: formData
|
|
154
|
+
});
|
|
155
|
+
const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
|
|
156
|
+
const payload = body ? JSON.parse(body) : {};
|
|
157
|
+
const response = {
|
|
158
|
+
body: payload,
|
|
159
|
+
status: res.status,
|
|
160
|
+
headers: res.headers
|
|
161
|
+
};
|
|
162
|
+
if (!res.ok) {
|
|
163
|
+
throw response;
|
|
164
|
+
}
|
|
165
|
+
return response;
|
|
166
|
+
};
|
|
167
|
+
const getReplaceFileUrl = (id) => {
|
|
168
|
+
return baseURL + `/files/${id}`;
|
|
169
|
+
};
|
|
170
|
+
const deleteFile = async (id, options) => {
|
|
171
|
+
const res = await fetch(getDeleteFileUrl(id), {
|
|
172
|
+
...options,
|
|
173
|
+
method: "DELETE"
|
|
174
|
+
});
|
|
175
|
+
const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
|
|
176
|
+
const payload = body ? JSON.parse(body) : {};
|
|
177
|
+
const response = {
|
|
178
|
+
body: payload,
|
|
179
|
+
status: res.status,
|
|
180
|
+
headers: res.headers
|
|
181
|
+
};
|
|
182
|
+
if (!res.ok) {
|
|
183
|
+
throw response;
|
|
184
|
+
}
|
|
185
|
+
return response;
|
|
186
|
+
};
|
|
187
|
+
const getDeleteFileUrl = (id) => {
|
|
188
|
+
return baseURL + `/files/${id}`;
|
|
189
|
+
};
|
|
190
|
+
return {
|
|
191
|
+
getOpenAPISpec,
|
|
192
|
+
getVersion,
|
|
193
|
+
uploadFiles,
|
|
194
|
+
getFileMetadataHeaders,
|
|
195
|
+
getFile,
|
|
196
|
+
replaceFile,
|
|
197
|
+
deleteFile,
|
|
198
|
+
pushChainFunction,
|
|
199
|
+
baseURL
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
export {
|
|
203
|
+
createAPIClient
|
|
204
|
+
};
|
|
205
|
+
//# sourceMappingURL=storage.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.es.js","sources":["../../src/storage/client.ts"],"sourcesContent":["/**\n * Generated by orval v7.9.0 🍺\n * Do not edit manually.\n * Nhost Storage API\n * Nhost Storage API - A service for managing and serving files with powerful access control capabilities\n * OpenAPI spec version: 1.0.0\n */\nimport { createEnhancedFetch } from \"../fetch\";\nimport type { ChainFunction } from \"../fetch\";\n\nimport type { Client } from \"./interface\";\n\n/**\n * Contains version information about the storage service.\n */\nexport interface VersionInformation {\n /** The version number of the storage service build. */\n buildVersion?: string;\n}\n\n/**\n * Basic information about a file in storage.\n */\nexport interface FileSummary {\n /** Unique identifier for the file. */\n id?: string;\n /** Name of the file including extension. */\n name?: string;\n /** ID of the bucket containing the file. */\n bucketId?: string;\n /** Whether the file has been successfully uploaded. */\n isUploaded?: boolean;\n}\n\n/**\n * Custom metadata associated with the file.\n */\nexport type FileMetadataMetadata = { [key: string]: unknown };\n\n/**\n * Comprehensive metadata information about a file in storage.\n */\nexport interface FileMetadata {\n /** Unique identifier for the file. */\n id?: string;\n /** Name of the file including extension. */\n name?: string;\n /** Size of the file in bytes. */\n size?: number;\n /** ID of the bucket containing the file. */\n bucketId?: string;\n /** Entity tag for cache validation. */\n etag?: string;\n /** Timestamp when the file was created. */\n createdAt?: string;\n /** Timestamp when the file was last updated. */\n updatedAt?: string;\n /** Whether the file has been successfully uploaded. */\n isUploaded?: boolean;\n /** MIME type of the file. */\n mimeType?: string;\n /** ID of the user who uploaded the file. */\n uploadedByUserId?: string;\n /** Custom metadata associated with the file. */\n metadata?: FileMetadataMetadata;\n}\n\n/**\n * Custom metadata to associate with the file.\n */\nexport type UploadFileMetadataMetadata = { [key: string]: unknown };\n\n/**\n * Metadata provided when uploading a new file.\n */\nexport interface UploadFileMetadata {\n /** Optional custom ID for the file. If not provided, a UUID will be generated. */\n id?: string;\n /** Name to assign to the file. If not provided, the original filename will be used. */\n name?: string;\n /** Custom metadata to associate with the file. */\n metadata?: UploadFileMetadataMetadata;\n}\n\n/**\n * Updated custom metadata to associate with the file.\n */\nexport type UpdateFileMetadataMetadata = { [key: string]: unknown };\n\n/**\n * Metadata that can be updated for an existing file.\n */\nexport interface UpdateFileMetadata {\n /** New name to assign to the file. */\n name?: string;\n /** Updated custom metadata to associate with the file. */\n metadata?: UpdateFileMetadataMetadata;\n}\n\n/**\n * Contains a presigned URL for direct file operations.\n */\nexport interface PresignedURLResponse {\n /** The presigned URL for file operations. */\n url?: string;\n /** The time in seconds until the URL expires. */\n expiration?: number;\n}\n\n/**\n * Error details.\n */\nexport type ErrorError = {\n /** Human-readable error message. */\n message: string;\n};\n\n/**\n * Error information returned by the API.\n */\nexport interface Error {\n /** Error details. */\n error?: ErrorError;\n}\n\nexport type GetOpenAPISpec200 = { [key: string]: unknown };\n\nexport type UploadFilesBody = {\n /** Target bucket identifier where files will be stored. */\n \"bucket-id\"?: string;\n /** Optional custom metadata for each uploaded file. Must match the order of the file[] array. */\n \"metadata[]\"?: UploadFileMetadata[];\n /** Array of files to upload. */\n \"file[]\"?: Blob[];\n};\n\nexport type UploadFiles201 = {\n /** List of successfully processed files with their metadata. */\n processedFiles?: FileMetadata[];\n};\n\nexport type GetFileMetadataHeadersParams = {\n /**\n * Image quality (1-100). Only applies to JPEG, WebP and PNG files\n */\n q?: number;\n /**\n * Maximum height to resize image to while maintaining aspect ratio. Only applies to image files\n */\n h?: number;\n /**\n * Maximum width to resize image to while maintaining aspect ratio. Only applies to image files\n */\n w?: number;\n /**\n * Blur the image using this sigma value. Only applies to image files\n */\n b?: number;\n /**\n * Output format for image files. Use 'auto' for content negotiation based on Accept header\n */\n f?: GetFileMetadataHeadersF;\n};\n\nexport type GetFileMetadataHeadersF =\n | \"auto\"\n | \"same\"\n | \"jpeg\"\n | \"webp\"\n | \"png\"\n | \"avif\";\nexport type GetFileParams = {\n /**\n * Image quality (1-100). Only applies to JPEG, WebP and PNG files\n */\n q?: number;\n /**\n * Maximum height to resize image to while maintaining aspect ratio. Only applies to image files\n */\n h?: number;\n /**\n * Maximum width to resize image to while maintaining aspect ratio. Only applies to image files\n */\n w?: number;\n /**\n * Blur the image using this sigma value. Only applies to image files\n */\n b?: number;\n /**\n * Output format for image files. Use 'auto' for content negotiation based on Accept header\n */\n f?: GetFileF;\n};\n\nexport type GetFileF = \"auto\" | \"same\" | \"jpeg\" | \"webp\" | \"png\" | \"avif\";\nexport type ReplaceFileBody = {\n /** Optional metadata to update for the file */\n metadata?: UpdateFileMetadata;\n /** New file content to replace the existing file */\n file?: Blob;\n};\n\nexport type FetchResponse<T> = {\n body: T;\n status: number;\n headers: Headers;\n};\n\nexport const createAPIClient = (\n baseURL: string,\n chainFunctions: ChainFunction[] = [],\n): Client => {\n let fetch = createEnhancedFetch(chainFunctions);\n\n const pushChainFunction = (chainFunction: ChainFunction) => {\n chainFunctions.push(chainFunction);\n fetch = createEnhancedFetch(chainFunctions);\n };\n\n /**\n * Returns the OpenAPI schema definition for this API, allowing clients to understand the available endpoints and models.\n * @summary Get OpenAPI specification\n */\n const getOpenAPISpec = async (\n options?: RequestInit,\n ): Promise<FetchResponse<GetOpenAPISpec200>> => {\n const res = await fetch(getGetOpenAPISpecUrl(), {\n ...options,\n method: \"GET\",\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: GetOpenAPISpec200 = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<GetOpenAPISpec200>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getGetOpenAPISpecUrl = () => {\n return baseURL + `/openapi.yaml`;\n };\n\n /**\n * Retrieves build and version information about the storage service. Useful for monitoring and debugging.\n * @summary Get service version information\n */\n const getVersion = async (\n options?: RequestInit,\n ): Promise<FetchResponse<VersionInformation>> => {\n const res = await fetch(getGetVersionUrl(), {\n ...options,\n method: \"GET\",\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: VersionInformation = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<VersionInformation>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getGetVersionUrl = () => {\n return baseURL + `/version`;\n };\n\n /**\n * Upload one or more files to a specified bucket. Supports batch uploading with optional custom metadata for each file. If uploading multiple files, either provide metadata for all files or none.\n * @summary Upload files\n */\n const uploadFiles = async (\n uploadFilesBody: UploadFilesBody,\n options?: RequestInit,\n ): Promise<FetchResponse<UploadFiles201>> => {\n const formData = new FormData();\n if (uploadFilesBody[\"bucket-id\"] !== undefined) {\n formData.append(`bucket-id`, uploadFilesBody[\"bucket-id\"]);\n }\n if (uploadFilesBody[\"metadata[]\"] !== undefined) {\n uploadFilesBody[\"metadata[]\"].forEach((value) =>\n formData.append(`metadata[]`, JSON.stringify(value)),\n );\n }\n if (uploadFilesBody[\"file[]\"] !== undefined) {\n uploadFilesBody[\"file[]\"].forEach((value) =>\n formData.append(`file[]`, value),\n );\n }\n\n const res = await fetch(getUploadFilesUrl(), {\n ...options,\n method: \"POST\",\n body: formData,\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: UploadFiles201 = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<UploadFiles201>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getUploadFilesUrl = () => {\n return baseURL + `/files/`;\n };\n\n /**\n * Retrieve file metadata headers without downloading the file content. Supports conditional requests and provides caching information.\n * @summary Check file information\n */\n const getFileMetadataHeaders = async (\n id: string,\n params?: GetFileMetadataHeadersParams,\n options?: RequestInit,\n ): Promise<FetchResponse<void>> => {\n const res = await fetch(getGetFileMetadataHeadersUrl(id, params), {\n ...options,\n method: \"HEAD\",\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: void = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<void>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getGetFileMetadataHeadersUrl = (\n id: string,\n params?: GetFileMetadataHeadersParams,\n ) => {\n const normalizedParams = new URLSearchParams();\n\n Object.entries(params || {}).forEach(([key, value]) => {\n if (value !== undefined) {\n normalizedParams.append(\n key,\n value === null ? \"null\" : value.toString(),\n );\n }\n });\n\n const stringifiedParams = normalizedParams.toString();\n\n return stringifiedParams.length > 0\n ? baseURL + `/files/${id}?${stringifiedParams}`\n : baseURL + `/files/${id}`;\n };\n\n /**\n * Retrieve and download the complete file content. Supports conditional requests, image transformations, and range requests for partial downloads.\n * @summary Download file\n */\n const getFile = async (\n id: string,\n params?: GetFileParams,\n options?: RequestInit,\n ): Promise<FetchResponse<Blob>> => {\n const res = await fetch(getGetFileUrl(id, params), {\n ...options,\n method: \"GET\",\n });\n\n const payload: Blob = await res.blob();\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<Blob>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getGetFileUrl = (id: string, params?: GetFileParams) => {\n const normalizedParams = new URLSearchParams();\n\n Object.entries(params || {}).forEach(([key, value]) => {\n if (value !== undefined) {\n normalizedParams.append(\n key,\n value === null ? \"null\" : value.toString(),\n );\n }\n });\n\n const stringifiedParams = normalizedParams.toString();\n\n return stringifiedParams.length > 0\n ? baseURL + `/files/${id}?${stringifiedParams}`\n : baseURL + `/files/${id}`;\n };\n\n /**\n * Replace an existing file with new content while preserving the file ID. The operation follows these steps:\n1. The isUploaded flag is set to false to mark the file as being updated\n2. The file content is replaced in the storage backend\n3. File metadata is updated (size, mime-type, isUploaded, etc.)\n\nEach step is atomic, but if a step fails, previous steps will not be automatically rolled back.\n\n * @summary Replace file\n */\n const replaceFile = async (\n id: string,\n replaceFileBody: ReplaceFileBody,\n options?: RequestInit,\n ): Promise<FetchResponse<FileMetadata>> => {\n const formData = new FormData();\n if (replaceFileBody.metadata !== undefined) {\n formData.append(`metadata`, JSON.stringify(replaceFileBody.metadata));\n }\n if (replaceFileBody.file !== undefined) {\n formData.append(`file`, replaceFileBody.file);\n }\n\n const res = await fetch(getReplaceFileUrl(id), {\n ...options,\n method: \"PUT\",\n body: formData,\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: FileMetadata = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<FileMetadata>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getReplaceFileUrl = (id: string) => {\n return baseURL + `/files/${id}`;\n };\n\n /**\n * Permanently delete a file from storage. This removes both the file content and its associated metadata.\n * @summary Delete file\n */\n const deleteFile = async (\n id: string,\n options?: RequestInit,\n ): Promise<FetchResponse<void>> => {\n const res = await fetch(getDeleteFileUrl(id), {\n ...options,\n method: \"DELETE\",\n });\n\n const body = [204, 205, 304, 412].includes(res.status)\n ? null\n : await res.text();\n const payload: void = body ? JSON.parse(body) : {};\n\n const response = {\n body: payload,\n status: res.status,\n headers: res.headers,\n } as FetchResponse<void>;\n\n if (!res.ok) {\n throw response;\n }\n\n return response;\n };\n\n const getDeleteFileUrl = (id: string) => {\n return baseURL + `/files/${id}`;\n };\n\n return {\n getOpenAPISpec,\n getVersion,\n uploadFiles,\n getFileMetadataHeaders,\n getFile,\n replaceFile,\n deleteFile,\n pushChainFunction,\n baseURL,\n };\n};\n"],"names":[],"mappings":";AAgNO,MAAM,kBAAkB,CAC7B,SACA,iBAAkC,OACvB;AACP,MAAA,QAAQ,oBAAoB,cAAc;AAExC,QAAA,oBAAoB,CAAC,kBAAiC;AAC1D,mBAAe,KAAK,aAAa;AACjC,YAAQ,oBAAoB,cAAc;AAAA,EAC5C;AAMM,QAAA,iBAAiB,OACrB,YAC8C;AAC9C,UAAM,MAAM,MAAM,MAAM,wBAAwB;AAAA,MAC9C,GAAG;AAAA,MACH,QAAQ;AAAA,IAAA,CACT;AAED,UAAM,OAAO,CAAC,KAAK,KAAK,KAAK,GAAG,EAAE,SAAS,IAAI,MAAM,IACjD,OACA,MAAM,IAAI,KAAK;AACnB,UAAM,UAA6B,OAAO,KAAK,MAAM,IAAI,IAAI,CAAC;AAE9D,UAAM,WAAW;AAAA,MACf,MAAM;AAAA,MACN,QAAQ,IAAI;AAAA,MACZ,SAAS,IAAI;AAAA,IACf;AAEI,QAAA,CAAC,IAAI,IAAI;AACL,YAAA;AAAA,IAAA;AAGD,WAAA;AAAA,EACT;AAEA,QAAM,uBAAuB,MAAM;AACjC,WAAO,UAAU;AAAA,EACnB;AAMM,QAAA,aAAa,OAC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AAM;AAAA,MACN,QAAQ,IAAI;AAAA,MACZ,SAAS,IAAI;AAAA,IACf;AAEI,QAAA,CAAC,IAAI,IAAI;AACL,YAAA;AAAA,IAAA;AAGD,WAAA;AAAA,EACT;AAEM,QAAA,oBAAoB,CAAC,OAAe;AACjC,WAAA,UAAU,UAAU,EAAE;AAAA,EAC/B;AAMM,QAAA,aAAa,OACjB,IACA,YACiC;AACjC,UAAM,MAAM,MAAM,MAAM,iBAAiB,EAAE,GAAG;AAAA,MAC5C,GAAG;AAAA,MACH,QAAQ;AAAA,IAAA,CACT;AAED,UAAM,OAAO,CAAC,KAAK,KAAK,KAAK,GAAG,EAAE,SAAS,IAAI,MAAM,IACjD,OACA,MAAM,IAAI,KAAK;AACnB,UAAM,UAAgB,OAAO,KAAK,MAAM,IAAI,IAAI,CAAC;AAEjD,UAAM,WAAW;AAAA,MACf,MAAM;AAAA,MACN,QAAQ,IAAI;AAAA,MACZ,SAAS,IAAI;AAAA,IACf;AAEI,QAAA,CAAC,IAAI,IAAI;AACL,YAAA;AAAA,IAAA;AAGD,WAAA;AAAA,EACT;AAEM,QAAA,mBAAmB,CAAC,OAAe;AAChC,WAAA,UAAU,UAAU,EAAE;AAAA,EAC/B;AAEO,SAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./nhost-js/auth.cjs.js"),t=require("./nhost-js/storage.cjs.js"),s=require("./nhost-js/graphql.cjs.js"),r=require("./nhost-js/functions.cjs.js"),o="nhostSession";class n{storageKey;constructor(e=o){this.storageKey=e}get(){try{const e=window.localStorage.getItem(this.storageKey);return e?JSON.parse(e):null}catch{return this.remove(),null}}set(e){window.localStorage.setItem(this.storageKey,JSON.stringify(e))}remove(){window.localStorage.removeItem(this.storageKey)}}class i{session=null;get(){return this.session}set(e){this.session=e}remove(){this.session=null}}const a=()=>{if("undefined"!=typeof window&&"undefined"!=typeof localStorage)try{return localStorage.setItem("__test","__test"),localStorage.removeItem("__test"),new n}catch{console.warn("localStorage is not available, using in-memory storage instead")}return new i},c=e=>{try{const t=e.split(".");if(3!==t.length)return console.warn("Token does not have three parts"),0;const s=t[1];if(!s)return console.warn("Payload part is empty"),0;const r=function(e){try{let t;if("undefined"!=typeof window)t=decodeURIComponent(window.atob(e).split("").map((e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2))).join(""));else{t=Buffer.from(e,"base64").toString("utf8")}return JSON.parse(t)}catch(t){throw console.warn("Error decoding token payload:",t),t}}(s.replace(/-/g,"+").replace(/_/g,"/"));return r.exp?1e3*r.exp:(console.warn("No exp claim found in token"),0)}catch(t){return console.warn("Failed to extract token expiration:",t),0}};const u=(e,t,s)=>{const{marginSeconds:r=60}=s||{};let o=null,n=0;return s=>async(i,a={})=>{if(function(e,t,s){const r=new Headers(t.headers||{});if(r.has("Authorization"))return!0;if(e===`${s}/token`)return!0;return!1}(i,a,e.baseURL))return s(i,a);try{if(o=t.get(),o?.accessToken&&(n=c(o.accessToken)),!o)return s(i,a);if(function(e,t){const s=Date.now();return e-s<1e3*t}(n,r)&&o.refreshToken){const s=await async function(e,t,s){try{const r=await e.refreshToken({refreshToken:s});if(200===r.status){const e=r.body;return t.set(e),e}return null}catch(r){return console.error("Error refreshing token:",r),null}}(e,t,o.refreshToken);s&&(o=s,n=c(s.accessToken),t.set(s))}return s(i,a)}catch(u){return console.error("Error in token refresh chain:",u),s(i,a)}}};const h=e=>t=>async(s,r={})=>{const o=new Headers(r.headers||{});if(o.has("Authorization"))return t(s,r);const n=e.get();if(n?.accessToken){const e={...r,headers:l(o,n)};return t(s,e)}return t(s,r)};function l(e,t){return t.accessToken&&e.set("Authorization",`Bearer ${t.accessToken}`),e}const f=e=>t=>async(s,r)=>{const o=await t(s,r);try{if(s.endsWith("/signout"))return e.remove(),o;if(s.endsWith("/token")||s.includes("/signin/")||s.includes("/signup/")){const t=o.clone(),s=await t.json().catch((()=>null));if(s){const t=function(e){return e?.session||e?.data?.session||e?.accessToken&&e?.refreshToken&&e||null}(s);t&&t.accessToken&&t.refreshToken&&e.set(t)}}}catch(n){console.warn("Error in session response middleware:",n)}return o},g=(e,t,s,r)=>r||(t&&s?`https://${t}.${e}.${s}.nhost.run/v1`:t?`https://${t}.${e}.nhost.run/v1`:`https://local.${e}.local.nhost.run/v1`);class p{auth;storage;graphql;functions;sessionStorage;constructor(e,t,s,r,o){this.auth=e,this.storage=t,this.graphql=s,this.functions=r,this.sessionStorage=o}getUserSession(){return this.sessionStorage.get()}async refreshSession(e=60){try{return await this._refreshSession(e)}catch(t){try{return console.warn("error refreshing session, retrying:",t),await this._refreshSession(e)}catch(s){const e=s;return 401===e?.status&&(console.error("session probably expired"),this.sessionStorage.remove()),null}}}async _refreshSession(e=60){const t=this.sessionStorage.get();if(!t)return null;const s=c(t?.accessToken||""),r=Date.now(),o=s<r;if(s-r>1e3*e)return t;try{const e=await this.auth.refreshToken({refreshToken:t.refreshToken});return this.sessionStorage.set(e.body),e.body}catch(n){if(!o)return t;throw n}}async clearSession(){this.sessionStorage.remove()}}exports.CookieStorage=class{cookieName;expirationDays;secure;sameSite;constructor(e=o,t=30,s=!0,r="lax"){this.cookieName=e,this.expirationDays=t,this.secure=s,this.sameSite=r}get(){const e=document.cookie.split(";");for(const t of e){const[e,s]=t.trim().split("=");if(e===this.cookieName)try{return JSON.parse(decodeURIComponent(s||""))}catch{return this.remove(),null}}return null}set(e){const t=new Date;t.setTime(t.getTime()+24*this.expirationDays*60*60*1e3);const s=encodeURIComponent(JSON.stringify(e)),r=`${this.cookieName}=${s}; expires=${t.toUTCString()}; path=/; ${this.secure?"secure; ":""}SameSite=${this.sameSite}`;document.cookie=r}remove(){document.cookie=`${this.cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; ${this.secure?"secure; ":""}SameSite=${this.sameSite}`}},exports.DEFAULT_SESSION_KEY=o,exports.LocalStorage=n,exports.MemoryStorage=i,exports.NhostClient=p,exports.createAttachAccessTokenMiddleware=h,exports.createClient=function(o={}){const{subdomain:n,region:i,authUrl:c,storageUrl:l,graphqlUrl:d,functionsUrl:S,storage:m=a(),disableAutoRefreshToken:y=!1}=o,w=g("auth",n,i,c),k=g("storage",n,i,l),T=g("graphql",n,i,d),x=g("functions",n,i,S),v=e.createAPIClient(w),$=function(e,t,s){const r=[f(t),h(t)];return s&&r.unshift(u(e,t)),r}(v,m,!y);for(const e of $)v.pushChainFunction(e);const j=t.createAPIClient(k,$),b=s.createAPIClient(T,$),C=r.createAPIClient(x,$);return new p(v,j,b,C,m)},exports.createSessionRefreshMiddleware=u,exports.createSessionResponseMiddleware=f,exports.generateServiceUrl=g;
|
|
2
|
+
//# sourceMappingURL=nhost-js.cjs.js.map
|