@polyester/sdk 0.26.1 → 0.27.0
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/CHANGELOG.md +16 -0
- package/dist/gen/auth/v1/auth_pb.d.ts +30 -21
- package/dist/gen/auth/v1/auth_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/auth_pb.js +25 -8
- package/dist/gen/auth/v1/auth_pb.js.map +1 -1
- package/dist/gen/auth/v1/mfa_pb.js +1 -1
- package/dist/gen/auth/v1/mfa_pb.js.map +1 -1
- package/dist/gen/auth/v1/profile_pb.d.ts +2 -2
- package/dist/gen/auth/v1/profile_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/profile_pb.js +2 -1
- package/dist/gen/auth/v1/profile_pb.js.map +1 -1
- package/dist/gen/auth/v1/resolve_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/resolve_pb.js +2 -1
- package/dist/gen/auth/v1/resolve_pb.js.map +1 -1
- package/dist/gen/auth/v1/social_verification_pb.d.ts +3 -0
- package/dist/gen/auth/v1/social_verification_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/social_verification_pb.js +2 -1
- package/dist/gen/auth/v1/social_verification_pb.js.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.d.ts +90 -10
- package/dist/gen/auth/v1/subaccounts_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.js +40 -28
- package/dist/gen/auth/v1/subaccounts_pb.js.map +1 -1
- package/dist/gen/claims/v1/claims_pb.d.ts +108 -2
- package/dist/gen/claims/v1/claims_pb.d.ts.map +1 -1
- package/dist/gen/claims/v1/claims_pb.js +109 -11
- package/dist/gen/claims/v1/claims_pb.js.map +1 -1
- package/dist/gen/index.d.ts +1 -1
- package/dist/gen/index.js +1 -1
- package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts.map +1 -1
- package/dist/gen/ledger/read/v1/ledger_read_pb.js +6 -1
- package/dist/gen/ledger/read/v1/ledger_read_pb.js.map +1 -1
- package/dist/gen/orderbook/v1/orderbook_pb.d.ts +1 -1
- package/dist/gen/orderbook/v1/orderbook_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.d.ts +10 -0
- package/dist/gen/orders/v1/orders_read_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.js +1 -1
- package/dist/gen/orders/v1/orders_read_pb.js.map +1 -1
- package/dist/gen/polyester/api/options_pb.d.ts +39 -2
- package/dist/gen/polyester/api/options_pb.d.ts.map +1 -1
- package/dist/gen/polyester/api/options_pb.js +43 -2
- package/dist/gen/polyester/api/options_pb.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/services/auth/account-signer-auth.d.ts +10 -3
- package/dist/services/auth/account-signer-auth.d.ts.map +1 -1
- package/dist/services/auth/account-signer-auth.js +14 -12
- package/dist/services/auth/account-signer-auth.js.map +1 -1
- package/dist/services/auth/auth.d.ts +3 -4
- package/dist/services/auth/auth.d.ts.map +1 -1
- package/dist/services/auth/auth.js +4 -6
- package/dist/services/auth/auth.js.map +1 -1
- package/dist/services/auth/auth.types.d.ts +2 -2
- package/dist/services/candles/candles.schemas.d.ts +10 -10
- package/dist/services/claims/claims.js +1 -1
- package/dist/services/heatmap/heatmap.schemas.d.ts +9 -9
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +42 -42
- package/dist/services/market-overview/market-overview.schemas.d.ts +3 -3
- package/dist/services/orders/orders-output.schemas.d.ts +12 -6
- package/dist/services/orders/orders-output.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-output.schemas.js +2 -0
- package/dist/services/orders/orders-output.schemas.js.map +1 -1
- package/dist/services/subaccounts/index.d.ts +2 -2
- package/dist/services/subaccounts/subaccounts.d.ts +9 -3
- package/dist/services/subaccounts/subaccounts.d.ts.map +1 -1
- package/dist/services/subaccounts/subaccounts.js +13 -3
- package/dist/services/subaccounts/subaccounts.js.map +1 -1
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +25 -6
- package/dist/services/subaccounts/subaccounts.schemas.d.ts.map +1 -1
- package/dist/services/subaccounts/subaccounts.schemas.js +13 -2
- package/dist/services/subaccounts/subaccounts.schemas.js.map +1 -1
- package/dist/services/subaccounts/subaccounts.types.d.ts +2 -2
- package/dist/services/triggers/trigger-input.schemas.d.ts +1 -1
- package/dist/services/triggers/triggers-output.schemas.d.ts +15 -15
- package/dist/shared/connect-error-mapping.d.ts.map +1 -1
- package/dist/shared/connect-error-mapping.js +6 -4
- package/dist/shared/connect-error-mapping.js.map +1 -1
- package/dist/shared/error-detail.d.ts +12 -8
- package/dist/shared/error-detail.d.ts.map +1 -1
- package/dist/shared/error-detail.js +30 -19
- package/dist/shared/error-detail.js.map +1 -1
- package/dist/shared/errors.d.ts +10 -1
- package/dist/shared/errors.d.ts.map +1 -1
- package/dist/shared/errors.js +12 -1
- package/dist/shared/errors.js.map +1 -1
- package/dist/wired-services.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","names":[],"sources":["../../src/shared/errors.ts"],"sourcesContent":["import type { PolyesterErrorDetail } from \"./error-detail.js\";\nexport type { PolyesterErrorDetail } from \"./error-detail.js\";\nimport type { RateLimitDetail } from \"./rate-limit.schemas.js\";\n\n/**\n * Typed error hierarchy for the Polyester SDK.\n *\n * Every error raised by the SDK extends {@link PolyesterError}, which carries a\n * stable machine-readable `code` and a `retryable` flag. The tree splits on\n * retryability so callers can triage with a single `instanceof` check:\n *\n * ```\n * PolyesterError code retryable\n * ├── TransientError TRANSIENT_FAILURE true\n * │ ├── NetworkError NETWORK_ERROR true\n * │ ├── TimeoutError TIMEOUT true\n * │ ├── RateLimitError RATE_LIMITED true\n * │ └── ServiceUnavailableError SERVICE_UNAVAILABLE true\n * ├── RequestError REQUEST_FAILED false\n * │ ├── ValidationError VALIDATION_FAILED false\n * │ │ ├── StaleQuoteError STALE_QUOTE\n * │ │ └── PolicyScopeMismatchError POLICY_SCOPE_MISMATCH\n * │ ├── ResourceNotFoundError RESOURCE_NOT_FOUND false\n * │ ├── AlreadyExistsError ALREADY_EXISTS false\n * │ ├── PermissionError PERMISSION_DENIED false\n * │ ├── AuthenticationError UNAUTHENTICATED false\n * │ ├── PreconditionFailedError PRECONDITION_FAILED false\n * │ │ ├── RevisionConflictError REVISION_CONFLICT\n * │ │ ├── PolicyInUseError POLICY_IN_USE\n * │ │ ├── PolicyLockedError POLICY_LOCKED\n * │ │ └── MfaLastFactorRequiredError MFA_LAST_FACTOR_REQUIRED\n * │ ├── ConfigurationError INVALID_CONFIGURATION false\n * │ ├── MfaRequiredError MFA_REQUIRED false\n * │ │ ├── MfaEnrollmentRequiredError MFA_ENROLLMENT_REQUIRED\n * │ │ ├── StepUpRequiredError STEP_UP_REQUIRED\n * │ │ └── SessionElevationRequiredError SESSION_ELEVATION_REQUIRED\n * │ └── MfaVerificationError MFA_VERIFICATION_FAILED false\n * └── InternalServerError INTERNAL_SERVER_ERROR false\n * ```\n *\n * Catalog errors (`CatalogLookupError`, `CatalogConversionError`, …) plug into\n * the same tree under `RequestError`/`ValidationError`.\n *\n * Errors mapped from RPC failures keep the original `ConnectError` as `cause`.\n *\n * @example\n * ```ts\n * try {\n * await client.orders.createSpotOrder(input);\n * } catch (err) {\n * if (err instanceof RateLimitError) await sleep(err.retryAfterMs ?? 1000);\n * else if (err instanceof TransientError) retry();\n * else if (err instanceof StepUpRequiredError) promptForMfa();\n * else throw err;\n * }\n * ```\n */\n\n/** Stable machine-readable codes carried by built-in SDK errors. */\nexport type PolyesterErrorCode =\n | \"TRANSIENT_FAILURE\"\n | \"NETWORK_ERROR\"\n | \"TIMEOUT\"\n | \"RATE_LIMITED\"\n | \"SERVICE_UNAVAILABLE\"\n | \"REQUEST_FAILED\"\n | \"VALIDATION_FAILED\"\n | \"STALE_QUOTE\"\n | \"RESOURCE_NOT_FOUND\"\n | \"ALREADY_EXISTS\"\n | \"PERMISSION_DENIED\"\n | \"UNAUTHENTICATED\"\n | \"PRECONDITION_FAILED\"\n | \"REVISION_CONFLICT\"\n | \"POLICY_IN_USE\"\n | \"POLICY_LOCKED\"\n | \"POLICY_SCOPE_MISMATCH\"\n | \"INVALID_CONFIGURATION\"\n | \"MFA_REQUIRED\"\n | \"MFA_ENROLLMENT_REQUIRED\"\n | \"STEP_UP_REQUIRED\"\n | \"SESSION_ELEVATION_REQUIRED\"\n | \"MFA_LAST_FACTOR_REQUIRED\"\n | \"MFA_VERIFICATION_FAILED\"\n | \"INTERNAL_SERVER_ERROR\"\n | \"CATALOG_LOOKUP_MISS\"\n | \"CATALOG_NOT_READY\"\n | \"CATALOG_CONVERSION_INVALID\"\n | \"CATALOG_VALIDATION_FAILED\";\n\nexport interface PolyesterErrorOptions {\n /** Underlying error, typically the original `ConnectError` for RPC failures. */\n cause?: unknown;\n /** Recognized structured backend rejection, decoded at the RPC boundary. */\n detail?: PolyesterErrorDetail;\n}\n\nconst CONNECT_ERROR_PREFIX_RE = /^(?:\\[[a-z][a-z0-9_-]*]\\s*)+/i;\n\nexport function normalizeErrorMessage(message: string): string {\n return message.replace(CONNECT_ERROR_PREFIX_RE, \"\").trim();\n}\n\n/**\n * Base class for every error raised by the Polyester SDK.\n *\n * Check `retryable` (or `instanceof TransientError`) to decide whether the\n * same call can be safely retried, and switch on `code` for exhaustive,\n * minification-safe handling.\n */\nexport abstract class PolyesterError extends Error {\n /** Stable machine-readable error code, e.g. `\"RATE_LIMITED\"`. */\n abstract readonly code: string;\n /** Whether retrying the same operation may succeed. */\n abstract readonly retryable: boolean;\n readonly detail: PolyesterErrorDetail | undefined;\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(normalizeErrorMessage(message), options);\n this.name = \"PolyesterError\";\n this.detail =\n options?.detail ??\n (options?.cause instanceof PolyesterError ? options.cause.detail : undefined);\n }\n}\n\n/**\n * A transient failure — the request may never have reached the backend or the\n * backend was temporarily unable to serve it. Follow the operation's retry\n * contract: reuse requestId for idempotent mutations. For single-order creation,\n * reconcile by clientOrderId; reusing it returns a conflict rather than replay.\n */\nexport class TransientError extends PolyesterError {\n readonly code: string = \"TRANSIENT_FAILURE\";\n readonly retryable = true;\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"TransientError\";\n }\n}\n\n/** The request could not be sent or the connection failed mid-flight. */\nexport class NetworkError extends TransientError {\n override readonly code: string = \"NETWORK_ERROR\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"NetworkError\";\n }\n}\n\n/** The request timed out before the backend produced a response. */\nexport class TimeoutError extends TransientError {\n override readonly code: string = \"TIMEOUT\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"TimeoutError\";\n }\n}\n\nexport interface RateLimitErrorOptions extends PolyesterErrorOptions {\n /** Suggested wait before retrying, when the backend provided one. */\n retryAfterMs?: number;\n /** Structured quota state attached to the rejection, when provided. */\n rateLimit?: RateLimitDetail;\n}\n\n/** The backend rejected the request due to rate limiting. */\nexport class RateLimitError extends TransientError {\n override readonly code: string = \"RATE_LIMITED\";\n /** Suggested wait before retrying, in milliseconds, when known. */\n readonly retryAfterMs?: number;\n /** Structured quota state attached to the rejection, when provided. */\n readonly rateLimit?: RateLimitDetail;\n\n constructor(message: string, options?: RateLimitErrorOptions) {\n super(message, options);\n this.name = \"RateLimitError\";\n this.retryAfterMs = options?.retryAfterMs;\n this.rateLimit = options?.rateLimit;\n }\n}\n\n/** The backend is temporarily unavailable (e.g. overloaded or restarting). */\nexport class ServiceUnavailableError extends TransientError {\n override readonly code: string = \"SERVICE_UNAVAILABLE\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"ServiceUnavailableError\";\n }\n}\n\n/**\n * The request itself was rejected — retrying the identical call will fail the\n * same way. Fix the input, authentication, or permissions first.\n */\nexport class RequestError extends PolyesterError {\n readonly code: string = \"REQUEST_FAILED\";\n readonly retryable = false;\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"RequestError\";\n }\n}\n\n/** The request input failed validation (client- or server-side). */\nexport class ValidationError extends RequestError {\n override readonly code: string = \"VALIDATION_FAILED\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"ValidationError\";\n }\n}\n\n/** The submitted client reference quote exceeded the market's configured drift limit. */\nexport class StaleQuoteError extends ValidationError {\n override readonly code = \"STALE_QUOTE\" as const;\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"StaleQuoteError\";\n }\n}\n\n/** The requested resource does not exist (or is not visible to the caller). */\nexport class ResourceNotFoundError extends RequestError {\n override readonly code: string = \"RESOURCE_NOT_FOUND\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"ResourceNotFoundError\";\n }\n}\n\n/** The resource already exists (e.g. a duplicate `clientOrderId`). */\nexport class AlreadyExistsError extends RequestError {\n override readonly code: string = \"ALREADY_EXISTS\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"AlreadyExistsError\";\n }\n}\n\n/** The caller is authenticated but not allowed to perform this operation. */\nexport class PermissionError extends RequestError {\n override readonly code: string = \"PERMISSION_DENIED\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"PermissionError\";\n }\n}\n\n/** The caller is not authenticated (missing, expired, or invalid credentials). */\nexport class AuthenticationError extends RequestError {\n override readonly code: string = \"UNAUTHENTICATED\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"AuthenticationError\";\n }\n}\n\n/** The system is not in a state that allows this operation (e.g. insufficient balance). */\nexport class PreconditionFailedError extends RequestError {\n override readonly code: string = \"PRECONDITION_FAILED\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"PreconditionFailedError\";\n }\n}\n\n/**\n * The resource changed after it was read, so the submitted expected revision\n * is stale. Refetch and let the caller reconcile; do not blindly retry.\n */\nexport class RevisionConflictError extends PreconditionFailedError {\n override readonly code: string = \"REVISION_CONFLICT\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"RevisionConflictError\";\n }\n}\n\n/** The policy cannot be removed while accounts or API keys still use it. */\nexport class PolicyInUseError extends PreconditionFailedError {\n override readonly code: string = \"POLICY_IN_USE\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"PolicyInUseError\";\n }\n}\n\n/** The policy is locked against the requested mutation. */\nexport class PolicyLockedError extends PreconditionFailedError {\n override readonly code: string = \"POLICY_LOCKED\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"PolicyLockedError\";\n }\n}\n\n/** The policy does not belong to the account scope targeted by the request. */\nexport class PolicyScopeMismatchError extends ValidationError {\n override readonly code: string = \"POLICY_SCOPE_MISMATCH\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"PolicyScopeMismatchError\";\n }\n}\n\n/** The SDK was configured incorrectly (bad environment, missing credentials, …). */\nexport class ConfigurationError extends RequestError {\n override readonly code: string = \"INVALID_CONFIGURATION\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"ConfigurationError\";\n }\n}\n\n/**\n * The operation requires additional multi-factor authentication. Catch this\n * class to handle all MFA flows, or the subclasses to branch per flow.\n */\nexport class MfaRequiredError extends RequestError {\n override readonly code: string = \"MFA_REQUIRED\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"MfaRequiredError\";\n }\n}\n\n/** The user must enroll in MFA before this operation can proceed. */\nexport class MfaEnrollmentRequiredError extends MfaRequiredError {\n override readonly code: string = \"MFA_ENROLLMENT_REQUIRED\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"MfaEnrollmentRequiredError\";\n }\n}\n\n/** The operation requires a fresh MFA step-up proof (retry with `X-Auth-Step-Up`). */\nexport class StepUpRequiredError extends MfaRequiredError {\n override readonly code: string = \"STEP_UP_REQUIRED\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"StepUpRequiredError\";\n }\n}\n\n/** The operation requires a recent MFA-elevated session, not a one-use step-up proof. */\nexport class SessionElevationRequiredError extends MfaRequiredError {\n override readonly code: string = \"SESSION_ELEVATION_REQUIRED\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"SessionElevationRequiredError\";\n }\n}\n\n/** The requested deletion would leave the account without an active MFA factor. */\nexport class MfaLastFactorRequiredError extends PreconditionFailedError {\n override readonly code: string = \"MFA_LAST_FACTOR_REQUIRED\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"MfaLastFactorRequiredError\";\n }\n}\n\n/** The reason an MFA challenge could not be completed. */\nexport type MfaVerificationFailureReason =\n | \"challenge-invalid\"\n | \"challenge-locked\"\n | \"otp-invalid\"\n | \"recovery-code-invalid\"\n | \"passkey-invalid\";\n\n/**\n * An expected MFA verification rejection. Callers should select their own\n * user-facing copy from `reason` instead of displaying the backend message.\n */\nexport class MfaVerificationError extends RequestError {\n override readonly code: string = \"MFA_VERIFICATION_FAILED\";\n\n constructor(\n message: string,\n readonly reason: MfaVerificationFailureReason,\n options?: PolyesterErrorOptions,\n ) {\n super(message, options);\n this.name = \"MfaVerificationError\";\n }\n}\n\n/**\n * The backend failed unexpectedly or returned a malformed response. Not\n * automatically retryable — the failure may recur and mutations may have\n * partially applied.\n */\nexport class InternalServerError extends PolyesterError {\n readonly code: string = \"INTERNAL_SERVER_ERROR\";\n readonly retryable = false;\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"InternalServerError\";\n }\n}\n\n/**\n * Checks whether an error represents an aborted request (caller-initiated via\n * `AbortSignal`). Aborts are intentionally NOT part of the {@link PolyesterError}\n * tree and are never retryable.\n */\nexport function isAbortError(err: unknown): boolean {\n return err instanceof DOMException && err.name === \"AbortError\";\n}\n\n/** Maps a plain HTTP status code onto the SDK error tree. */\nexport function errorFromHttpStatus(\n status: number,\n message: string,\n options?: PolyesterErrorOptions,\n): PolyesterError {\n if (status === 401) return new AuthenticationError(message, options);\n if (status === 403) return new PermissionError(message, options);\n if (status === 404) return new ResourceNotFoundError(message, options);\n if (status === 408) return new TimeoutError(message, options);\n if (status === 409) return new AlreadyExistsError(message, options);\n if (status === 429) return new RateLimitError(message, options);\n if (status === 502 || status === 503 || status === 504) {\n return new ServiceUnavailableError(message, options);\n }\n if (status >= 500) return new InternalServerError(message, options);\n if (status >= 400) return new RequestError(message, options);\n return new NetworkError(message, options);\n}\n"],"mappings":";AAiGA,MAAM,0BAA0B;AAEhC,SAAgB,sBAAsB,SAAyB;CAC3D,OAAO,QAAQ,QAAQ,yBAAyB,EAAE,CAAC,CAAC,KAAK;AAC7D;;;;;;;;AASA,IAAsB,iBAAtB,MAAsB,uBAAuB,MAAM;CAK/C;CAEA,YAAY,SAAiB,SAAiC;EAC1D,MAAM,sBAAsB,OAAO,GAAG,OAAO;EAC7C,KAAK,OAAO;EACZ,KAAK,SACD,SAAS,WACR,SAAS,iBAAiB,iBAAiB,QAAQ,MAAM,SAAS,KAAA;CAC3E;AACJ;;;;;;;AAQA,IAAa,iBAAb,cAAoC,eAAe;CAC/C,OAAwB;CACxB,YAAqB;CAErB,YAAY,SAAiB,SAAiC;EAC1D,MAAM,SAAS,OAAO;EACtB,KAAK,OAAO;CAChB;AACJ;;AAGA,IAAa,eAAb,cAAkC,eAAe;CAC7C,OAAiC;CAEjC,YAAY,SAAiB,SAAiC;EAC1D,MAAM,SAAS,OAAO;EACtB,KAAK,OAAO;CAChB;AACJ;;AAGA,IAAa,eAAb,cAAkC,eAAe;CAC7C,OAAiC;CAEjC,YAAY,SAAiB,SAAiC;EAC1D,MAAM,SAAS,OAAO;EACtB,KAAK,OAAO;CAChB;AACJ;;AAUA,IAAa,iBAAb,cA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|
+
{"version":3,"file":"errors.js","names":[],"sources":["../../src/shared/errors.ts"],"sourcesContent":["import type { PolyesterErrorDetail } from \"./error-detail.js\";\nexport type { PolyesterErrorDetail } from \"./error-detail.js\";\nimport type { RateLimitDetail } from \"./rate-limit.schemas.js\";\n\n/**\n * Typed error hierarchy for the Polyester SDK.\n *\n * Every error raised by the SDK extends {@link PolyesterError}, which carries a\n * stable machine-readable `code` and a `retryable` flag. The tree splits on\n * retryability so callers can triage with a single `instanceof` check:\n *\n * ```\n * PolyesterError code retryable\n * ├── TransientError TRANSIENT_FAILURE true\n * │ ├── NetworkError NETWORK_ERROR true\n * │ ├── TimeoutError TIMEOUT true\n * │ ├── RateLimitError RATE_LIMITED true\n * │ └── ServiceUnavailableError SERVICE_UNAVAILABLE true\n * ├── RequestError REQUEST_FAILED false\n * │ ├── ValidationError VALIDATION_FAILED false\n * │ │ ├── StaleQuoteError STALE_QUOTE\n * │ │ └── PolicyScopeMismatchError POLICY_SCOPE_MISMATCH\n * │ ├── ResourceNotFoundError RESOURCE_NOT_FOUND false\n * │ ├── AlreadyExistsError ALREADY_EXISTS false\n * │ ├── PermissionError PERMISSION_DENIED false\n * │ ├── AuthenticationError UNAUTHENTICATED false\n * │ ├── PreconditionFailedError PRECONDITION_FAILED false\n * │ │ ├── RevisionConflictError REVISION_CONFLICT\n * │ │ ├── PolicyInUseError POLICY_IN_USE\n * │ │ ├── PolicyLockedError POLICY_LOCKED\n * │ │ ├── SubaccountChallengeInvalidError SUBACCOUNT_CHALLENGE_INVALID\n * │ │ └── MfaLastFactorRequiredError MFA_LAST_FACTOR_REQUIRED\n * │ ├── ConfigurationError INVALID_CONFIGURATION false\n * │ ├── MfaRequiredError MFA_REQUIRED false\n * │ │ ├── MfaEnrollmentRequiredError MFA_ENROLLMENT_REQUIRED\n * │ │ ├── StepUpRequiredError STEP_UP_REQUIRED\n * │ │ └── SessionElevationRequiredError SESSION_ELEVATION_REQUIRED\n * │ └── MfaVerificationError MFA_VERIFICATION_FAILED false\n * └── InternalServerError INTERNAL_SERVER_ERROR false\n * ```\n *\n * Catalog errors (`CatalogLookupError`, `CatalogConversionError`, …) plug into\n * the same tree under `RequestError`/`ValidationError`.\n *\n * Errors mapped from RPC failures keep the original `ConnectError` as `cause`.\n *\n * @example\n * ```ts\n * try {\n * await client.orders.createSpotOrder(input);\n * } catch (err) {\n * if (err instanceof RateLimitError) await sleep(err.retryAfterMs ?? 1000);\n * else if (err instanceof TransientError) retry();\n * else if (err instanceof StepUpRequiredError) promptForMfa();\n * else throw err;\n * }\n * ```\n */\n\n/** Stable machine-readable codes carried by built-in SDK errors. */\nexport type PolyesterErrorCode =\n | \"TRANSIENT_FAILURE\"\n | \"NETWORK_ERROR\"\n | \"TIMEOUT\"\n | \"RATE_LIMITED\"\n | \"SERVICE_UNAVAILABLE\"\n | \"REQUEST_FAILED\"\n | \"VALIDATION_FAILED\"\n | \"STALE_QUOTE\"\n | \"RESOURCE_NOT_FOUND\"\n | \"ALREADY_EXISTS\"\n | \"PERMISSION_DENIED\"\n | \"UNAUTHENTICATED\"\n | \"PRECONDITION_FAILED\"\n | \"REVISION_CONFLICT\"\n | \"POLICY_IN_USE\"\n | \"POLICY_LOCKED\"\n | \"POLICY_SCOPE_MISMATCH\"\n | \"INVALID_CONFIGURATION\"\n | \"MFA_REQUIRED\"\n | \"MFA_ENROLLMENT_REQUIRED\"\n | \"STEP_UP_REQUIRED\"\n | \"SESSION_ELEVATION_REQUIRED\"\n | \"MFA_LAST_FACTOR_REQUIRED\"\n | \"MFA_VERIFICATION_FAILED\"\n | \"INTERNAL_SERVER_ERROR\"\n | \"CATALOG_LOOKUP_MISS\"\n | \"CATALOG_NOT_READY\"\n | \"CATALOG_CONVERSION_INVALID\"\n | \"CATALOG_VALIDATION_FAILED\";\n\nexport interface PolyesterErrorOptions {\n /** Underlying error, typically the original `ConnectError` for RPC failures. */\n cause?: unknown;\n /** Recognized structured backend rejection, decoded at the RPC boundary. */\n detail?: PolyesterErrorDetail;\n}\n\nconst CONNECT_ERROR_PREFIX_RE = /^(?:\\[[a-z][a-z0-9_-]*]\\s*)+/i;\n\nexport function normalizeErrorMessage(message: string): string {\n return message.replace(CONNECT_ERROR_PREFIX_RE, \"\").trim();\n}\n\n/**\n * Base class for every error raised by the Polyester SDK.\n *\n * Check `retryable` (or `instanceof TransientError`) to decide whether the\n * same call can be safely retried, and switch on `code` for exhaustive,\n * minification-safe handling.\n */\nexport abstract class PolyesterError extends Error {\n /** Stable machine-readable error code, e.g. `\"RATE_LIMITED\"`. */\n abstract readonly code: string;\n /** Whether retrying the same operation may succeed. */\n abstract readonly retryable: boolean;\n readonly detail: PolyesterErrorDetail | undefined;\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(normalizeErrorMessage(message), options);\n this.name = \"PolyesterError\";\n this.detail =\n options?.detail ??\n (options?.cause instanceof PolyesterError ? options.cause.detail : undefined);\n }\n}\n\n/**\n * A transient failure — the request may never have reached the backend or the\n * backend was temporarily unable to serve it. Follow the operation's retry\n * contract: reuse requestId for idempotent mutations. For single-order creation,\n * reconcile by clientOrderId; reusing it returns a conflict rather than replay.\n */\nexport class TransientError extends PolyesterError {\n readonly code: string = \"TRANSIENT_FAILURE\";\n readonly retryable = true;\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"TransientError\";\n }\n}\n\n/** The request could not be sent or the connection failed mid-flight. */\nexport class NetworkError extends TransientError {\n override readonly code: string = \"NETWORK_ERROR\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"NetworkError\";\n }\n}\n\n/** The request timed out before the backend produced a response. */\nexport class TimeoutError extends TransientError {\n override readonly code: string = \"TIMEOUT\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"TimeoutError\";\n }\n}\n\nexport interface RateLimitErrorOptions extends PolyesterErrorOptions {\n /** Suggested wait before retrying, when the backend provided one. */\n retryAfterMs?: number;\n /** Structured quota state attached to the rejection, when provided. */\n rateLimit?: RateLimitDetail;\n}\n\n/** The backend rejected the request due to rate limiting. */\nexport class RateLimitError extends TransientError {\n override readonly code: string = \"RATE_LIMITED\";\n /** Suggested wait before retrying, in milliseconds, when known. */\n readonly retryAfterMs?: number;\n /** Structured quota state attached to the rejection, when provided. */\n readonly rateLimit?: RateLimitDetail;\n\n constructor(message: string, options?: RateLimitErrorOptions) {\n super(message, options);\n this.name = \"RateLimitError\";\n this.retryAfterMs = options?.retryAfterMs;\n this.rateLimit = options?.rateLimit;\n }\n}\n\n/** The backend is temporarily unavailable (e.g. overloaded or restarting). */\nexport class ServiceUnavailableError extends TransientError {\n override readonly code: string = \"SERVICE_UNAVAILABLE\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"ServiceUnavailableError\";\n }\n}\n\n/**\n * The request itself was rejected — retrying the identical call will fail the\n * same way. Fix the input, authentication, or permissions first.\n */\nexport class RequestError extends PolyesterError {\n readonly code: string = \"REQUEST_FAILED\";\n readonly retryable = false;\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"RequestError\";\n }\n}\n\n/** The request input failed validation (client- or server-side). */\nexport class ValidationError extends RequestError {\n override readonly code: string = \"VALIDATION_FAILED\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"ValidationError\";\n }\n}\n\n/** The submitted client reference quote exceeded the market's configured drift limit. */\nexport class StaleQuoteError extends ValidationError {\n override readonly code = \"STALE_QUOTE\" as const;\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"StaleQuoteError\";\n }\n}\n\n/** The requested resource does not exist (or is not visible to the caller). */\nexport class ResourceNotFoundError extends RequestError {\n override readonly code: string = \"RESOURCE_NOT_FOUND\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"ResourceNotFoundError\";\n }\n}\n\n/** The resource already exists (e.g. a duplicate `clientOrderId`). */\nexport class AlreadyExistsError extends RequestError {\n override readonly code: string = \"ALREADY_EXISTS\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"AlreadyExistsError\";\n }\n}\n\n/** The caller is authenticated but not allowed to perform this operation. */\nexport class PermissionError extends RequestError {\n override readonly code: string = \"PERMISSION_DENIED\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"PermissionError\";\n }\n}\n\n/** The caller is not authenticated (missing, expired, or invalid credentials). */\nexport class AuthenticationError extends RequestError {\n override readonly code: string = \"UNAUTHENTICATED\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"AuthenticationError\";\n }\n}\n\n/** The system is not in a state that allows this operation (e.g. insufficient balance). */\nexport class PreconditionFailedError extends RequestError {\n override readonly code: string = \"PRECONDITION_FAILED\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"PreconditionFailedError\";\n }\n}\n\n/**\n * The resource changed after it was read, so the submitted expected revision\n * is stale. Refetch and let the caller reconcile; do not blindly retry.\n */\nexport class RevisionConflictError extends PreconditionFailedError {\n override readonly code: string = \"REVISION_CONFLICT\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"RevisionConflictError\";\n }\n}\n\n/**\n * The subaccount authorization is expired, replaced by a newer challenge, replayed,\n * or otherwise invalid. Request a fresh challenge via `subaccounts.createChallenge`.\n */\nexport class SubaccountChallengeInvalidError extends PreconditionFailedError {\n override readonly code: string = \"SUBACCOUNT_CHALLENGE_INVALID\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"SubaccountChallengeInvalidError\";\n }\n}\n\n/** The policy cannot be removed while accounts or API keys still use it. */\nexport class PolicyInUseError extends PreconditionFailedError {\n override readonly code: string = \"POLICY_IN_USE\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"PolicyInUseError\";\n }\n}\n\n/** The policy is locked against the requested mutation. */\nexport class PolicyLockedError extends PreconditionFailedError {\n override readonly code: string = \"POLICY_LOCKED\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"PolicyLockedError\";\n }\n}\n\n/** The policy does not belong to the account scope targeted by the request. */\nexport class PolicyScopeMismatchError extends ValidationError {\n override readonly code: string = \"POLICY_SCOPE_MISMATCH\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"PolicyScopeMismatchError\";\n }\n}\n\n/** The SDK was configured incorrectly (bad environment, missing credentials, …). */\nexport class ConfigurationError extends RequestError {\n override readonly code: string = \"INVALID_CONFIGURATION\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"ConfigurationError\";\n }\n}\n\n/**\n * The operation requires additional multi-factor authentication. Catch this\n * class to handle all MFA flows, or the subclasses to branch per flow.\n */\nexport class MfaRequiredError extends RequestError {\n override readonly code: string = \"MFA_REQUIRED\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"MfaRequiredError\";\n }\n}\n\n/** The user must enroll in MFA before this operation can proceed. */\nexport class MfaEnrollmentRequiredError extends MfaRequiredError {\n override readonly code: string = \"MFA_ENROLLMENT_REQUIRED\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"MfaEnrollmentRequiredError\";\n }\n}\n\n/** The operation requires a fresh MFA step-up proof (retry with `X-Auth-Step-Up`). */\nexport class StepUpRequiredError extends MfaRequiredError {\n override readonly code: string = \"STEP_UP_REQUIRED\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"StepUpRequiredError\";\n }\n}\n\n/** The operation requires a recent MFA-elevated session, not a one-use step-up proof. */\nexport class SessionElevationRequiredError extends MfaRequiredError {\n override readonly code: string = \"SESSION_ELEVATION_REQUIRED\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"SessionElevationRequiredError\";\n }\n}\n\n/** The requested deletion would leave the account without an active MFA factor. */\nexport class MfaLastFactorRequiredError extends PreconditionFailedError {\n override readonly code: string = \"MFA_LAST_FACTOR_REQUIRED\";\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"MfaLastFactorRequiredError\";\n }\n}\n\n/** The reason an MFA challenge could not be completed. */\nexport type MfaVerificationFailureReason =\n | \"challenge-invalid\"\n | \"challenge-locked\"\n | \"otp-invalid\"\n | \"recovery-code-invalid\"\n | \"passkey-invalid\";\n\n/**\n * An expected MFA verification rejection. Callers should select their own\n * user-facing copy from `reason` instead of displaying the backend message.\n */\nexport class MfaVerificationError extends RequestError {\n override readonly code: string = \"MFA_VERIFICATION_FAILED\";\n\n constructor(\n message: string,\n readonly reason: MfaVerificationFailureReason,\n options?: PolyesterErrorOptions,\n ) {\n super(message, options);\n this.name = \"MfaVerificationError\";\n }\n}\n\n/**\n * The backend failed unexpectedly or returned a malformed response. Not\n * automatically retryable — the failure may recur and mutations may have\n * partially applied.\n */\nexport class InternalServerError extends PolyesterError {\n readonly code: string = \"INTERNAL_SERVER_ERROR\";\n readonly retryable = false;\n\n constructor(message: string, options?: PolyesterErrorOptions) {\n super(message, options);\n this.name = \"InternalServerError\";\n }\n}\n\n/**\n * Checks whether an error represents an aborted request (caller-initiated via\n * `AbortSignal`). Aborts are intentionally NOT part of the {@link PolyesterError}\n * tree and are never retryable.\n */\nexport function isAbortError(err: unknown): boolean {\n return err instanceof DOMException && err.name === \"AbortError\";\n}\n\n/** Maps a plain HTTP status code onto the SDK error tree. */\nexport function errorFromHttpStatus(\n status: number,\n message: string,\n options?: PolyesterErrorOptions,\n): PolyesterError {\n if (status === 401) return new AuthenticationError(message, options);\n if (status === 403) return new PermissionError(message, options);\n if (status === 404) return new ResourceNotFoundError(message, options);\n if (status === 408) return new TimeoutError(message, options);\n if (status === 409) return new AlreadyExistsError(message, options);\n if (status === 429) return new RateLimitError(message, options);\n if (status === 502 || status === 503 || status === 504) {\n return new ServiceUnavailableError(message, options);\n }\n if (status >= 500) return new InternalServerError(message, options);\n if (status >= 400) return new RequestError(message, options);\n return new NetworkError(message, options);\n}\n"],"mappings":";AAkGA,MAAM,0BAA0B;AAEhC,SAAgB,sBAAsB,SAAyB;CAC3D,OAAO,QAAQ,QAAQ,yBAAyB,EAAE,CAAC,CAAC,KAAK;AAC7D;;;;;;;;AASA,IAAsB,iBAAtB,MAAsB,uBAAuB,MAAM;CAK/C;CAEA,YAAY,SAAiB,SAAiC;EAC1D,MAAM,sBAAsB,OAAO,GAAG,OAAO;EAC7C,KAAK,OAAO;EACZ,KAAK,SACD,SAAS,WACR,SAAS,iBAAiB,iBAAiB,QAAQ,MAAM,SAAS,KAAA;CAC3E;AACJ;;;;;;;AAQA,IAAa,iBAAb,cAAoC,eAAe;CAC/C,OAAwB;CACxB,YAAqB;CAErB,YAAY,SAAiB,SAAiC;EAC1D,MAAM,SAAS,OAAO;EACtB,KAAK,OAAO;CAChB;AACJ;;AAGA,IAAa,eAAb,cAAkC,eAAe;CAC7C,OAAiC;CAEjC,YAAY,SAAiB,SAAiC;EAC1D,MAAM,SAAS,OAAO;EACtB,KAAK,OAAO;CAChB;AACJ;;AAGA,IAAa,eAAb,cAAkC,eAAe;CAC7C,OAAiC;CAEjC,YAAY,SAAiB,SAAiC;EAC1D,MAAM,SAAS,OAAO;EACtB,KAAK,OAAO;CAChB;AACJ;;AAUA,IAAa,iBAAb,cAAoC,eAAe;CAC/C,OAAiC;;CAEjC;;CAEA;CAEA,YAAY,SAAiB,SAAiC;EAC1D,MAAM,SAAS,OAAO;EACtB,KAAK,OAAO;EACZ,KAAK,eAAe,SAAS;EAC7B,KAAK,YAAY,SAAS;CAC9B;AACJ;;AAGA,IAAa,0BAAb,cAA6C,eAAe;CACxD,OAAiC;CAEjC,YAAY,SAAiB,SAAiC;EAC1D,MAAM,SAAS,OAAO;EACtB,KAAK,OAAO;CAChB;AACJ;;;;;AAMA,IAAa,eAAb,cAAkC,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AAO;EACtB,KAAK,OAAO;CAChB;AACJ;;;;;AAcA,IAAa,uBAAb,cAA0C,aAAa;CAKtC;CAJb,OAAiC;CAEjC,YACI,SACA,QACA,SACF;EACE,MAAM,SAAS,OAAO;EAHb,KAAA,SAAA;EAIT,KAAK,OAAO;CAChB;AACJ;;;;;;AAOA,IAAa,sBAAb,cAAyC,eAAe;CACpD,OAAwB;CACxB,YAAqB;CAErB,YAAY,SAAiB,SAAiC;EAC1D,MAAM,SAAS,OAAO;EACtB,KAAK,OAAO;CAChB;AACJ;;;;;;AAOA,SAAgB,aAAa,KAAuB;CAChD,OAAO,eAAe,gBAAgB,IAAI,SAAS;AACvD;;AAGA,SAAgB,oBACZ,QACA,SACA,SACc;CACd,IAAI,WAAW,KAAK,OAAO,IAAI,oBAAoB,SAAS,OAAO;CACnE,IAAI,WAAW,KAAK,OAAO,IAAI,gBAAgB,SAAS,OAAO;CAC/D,IAAI,WAAW,KAAK,OAAO,IAAI,sBAAsB,SAAS,OAAO;CACrE,IAAI,WAAW,KAAK,OAAO,IAAI,aAAa,SAAS,OAAO;CAC5D,IAAI,WAAW,KAAK,OAAO,IAAI,mBAAmB,SAAS,OAAO;CAClE,IAAI,WAAW,KAAK,OAAO,IAAI,eAAe,SAAS,OAAO;CAC9D,IAAI,WAAW,OAAO,WAAW,OAAO,WAAW,KAC/C,OAAO,IAAI,wBAAwB,SAAS,OAAO;CAEvD,IAAI,UAAU,KAAK,OAAO,IAAI,oBAAoB,SAAS,OAAO;CAClE,IAAI,UAAU,KAAK,OAAO,IAAI,aAAa,SAAS,OAAO;CAC3D,OAAO,IAAI,aAAa,SAAS,OAAO;AAC5C"}
|
package/dist/wired-services.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MFAService } from "./gen/auth/v1/mfa_pb.js";
|
|
2
2
|
import { AuthService } from "./gen/auth/v1/auth_pb.js";
|
|
3
3
|
import { ProfileService } from "./gen/auth/v1/profile_pb.js";
|
|
4
|
+
import { ClaimsService } from "./gen/claims/v1/claims_pb.js";
|
|
4
5
|
import { WithdrawService } from "./gen/chain/withdraw/v1/withdraw_pb.js";
|
|
5
6
|
import { LedgerReadService } from "./gen/ledger/read/v1/ledger_read_pb.js";
|
|
6
7
|
import { MarketOverviewService } from "./gen/marketoverview/v1/marketoverview_pb.js";
|
|
@@ -23,7 +24,6 @@ import { GuardSignerService } from "./gen/chain/guard/v1/guard_signer_pb.js";
|
|
|
23
24
|
import { SocialVerificationService } from "./gen/auth/v1/social_verification_pb.js";
|
|
24
25
|
import { WhiteboardService } from "./gen/collab/v1/whiteboard_pb.js";
|
|
25
26
|
import { ZipperService } from "./gen/chain/zipper/v1/zipper_pb.js";
|
|
26
|
-
import { ClaimsService } from "./gen/claims/v1/claims_pb.js";
|
|
27
27
|
import { VIPService } from "./gen/vip/v1/vip_pb.js";
|
|
28
28
|
import { FeeService } from "./gen/fees/v1/fees_pb.js";
|
|
29
29
|
import { RateLimitService } from "./gen/ratelimit/v1/ratelimit_pb.js";
|
package/package.json
CHANGED