@insurup/sdk 0.1.12 → 0.1.14

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.
Files changed (67) hide show
  1. package/README.md +55 -58
  2. package/dist/client/client.d.ts +153 -0
  3. package/dist/client/client.d.ts.map +1 -0
  4. package/dist/client/graphql.d.ts +51 -0
  5. package/dist/client/graphql.d.ts.map +1 -0
  6. package/dist/client/http.d.ts +173 -0
  7. package/dist/client/http.d.ts.map +1 -0
  8. package/dist/clients/agent.d.ts +121 -0
  9. package/dist/clients/agent.d.ts.map +1 -0
  10. package/dist/clients/agentBranch.d.ts +61 -0
  11. package/dist/clients/agentBranch.d.ts.map +1 -0
  12. package/dist/clients/agentRole.d.ts +60 -0
  13. package/dist/clients/agentRole.d.ts.map +1 -0
  14. package/dist/clients/agentSetup.d.ts +34 -0
  15. package/dist/clients/agentSetup.d.ts.map +1 -0
  16. package/dist/clients/agentUser.d.ts +176 -0
  17. package/dist/clients/agentUser.d.ts.map +1 -0
  18. package/dist/clients/case.d.ts +232 -0
  19. package/dist/clients/case.d.ts.map +1 -0
  20. package/dist/clients/coverage.d.ts +98 -0
  21. package/dist/clients/coverage.d.ts.map +1 -0
  22. package/dist/clients/customer.d.ts +216 -0
  23. package/dist/clients/customer.d.ts.map +1 -0
  24. package/dist/clients/file.d.ts +30 -0
  25. package/dist/clients/file.d.ts.map +1 -0
  26. package/dist/clients/insurance.d.ts +105 -0
  27. package/dist/clients/insurance.d.ts.map +1 -0
  28. package/dist/clients/language.d.ts +27 -0
  29. package/dist/clients/language.d.ts.map +1 -0
  30. package/dist/clients/policy.d.ts +251 -0
  31. package/dist/clients/policy.d.ts.map +1 -0
  32. package/dist/clients/property.d.ts +163 -0
  33. package/dist/clients/property.d.ts.map +1 -0
  34. package/dist/clients/proposal.d.ts +232 -0
  35. package/dist/clients/proposal.d.ts.map +1 -0
  36. package/dist/clients/template.d.ts +73 -0
  37. package/dist/clients/template.d.ts.map +1 -0
  38. package/dist/clients/vehicle.d.ts +112 -0
  39. package/dist/clients/vehicle.d.ts.map +1 -0
  40. package/dist/clients/webhook.d.ts +106 -0
  41. package/dist/clients/webhook.d.ts.map +1 -0
  42. package/dist/core/config.d.ts +38 -0
  43. package/dist/core/config.d.ts.map +1 -0
  44. package/dist/core/endpoints.d.ts +1331 -0
  45. package/dist/core/endpoints.d.ts.map +1 -0
  46. package/dist/core/error-types.d.ts +66 -0
  47. package/dist/core/error-types.d.ts.map +1 -0
  48. package/dist/core/errors.d.ts +42 -0
  49. package/dist/core/errors.d.ts.map +1 -0
  50. package/dist/core/options.d.ts +221 -0
  51. package/dist/core/options.d.ts.map +1 -0
  52. package/dist/core/result.d.ts +183 -0
  53. package/dist/core/result.d.ts.map +1 -0
  54. package/dist/core/retry.d.ts +15 -0
  55. package/dist/core/retry.d.ts.map +1 -0
  56. package/dist/index.browser.js +1 -1
  57. package/dist/index.browser.js.map +1 -1
  58. package/dist/index.cjs +144 -506
  59. package/dist/index.cjs.map +1 -1
  60. package/dist/index.d.ts +31 -4225
  61. package/dist/index.d.ts.map +1 -0
  62. package/dist/index.js +144 -506
  63. package/dist/index.js.map +1 -1
  64. package/dist/version.d.ts +10 -0
  65. package/dist/version.d.ts.map +1 -0
  66. package/package.json +17 -14
  67. package/dist/index.d.cts +0 -4226
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../src/core/endpoints.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,eAAO,MAAM,WAAW;;CAEd,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,MAAM;;;;;;;;;uDAWqB,MAAM,KAAG,MAAM;;;;uDASf,MAAM,KAAG,MAAM;;;;uDASf,MAAM,KAAG,MAAM;;;;uDASf,MAAM,KAAG,MAAM;;;;uDASf,MAAM,KAAG,MAAM;;;;uDASf,MAAM,KAAG,MAAM;;;CAO7C,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM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AAqB,MAAM,KAAG,MAAM;;;;;;;;;kCAuJnD,MAAM,KAAG,MAAM;;;;kCAIf,MAAM,KAAG,MAAM;;;;kCAIf,MAAM,KAAG,MAAM;;;;;;;;;;;;;;mCA0Bd,MAAM,KAAG,MAAM;;;;mCAIf,MAAM,KAAG,MAAM;;;;mCAIf,MAAM,KAAG,MAAM;;;;;;;;;;;;;0CA1nBR,MAAM,KAAG,MAAM;;;;0CAMf,MAAM,KAAG,MAAM;;;;0CAMf,MAAM,KAAG,MAAM;;;;0CAMf,MAAM,qBAAqB,MAAM,KAAG,MAAM;;;;0CAQ1C,MAAM,qBAAqB,MAAM,KAAG,MAAM;;;;0CAS1C,MAAM,qBAAqB,MAAM,qBAAqB,MAAM,KAAG,MAAM;;;;0CASrE,MAAM,qBAAqB,MAAM,KAAG,MAAM;;;;0CAQ1C,MAAM,qBAAqB,MAAM,KAAG,MAAM;;;;0CAQ1C,MAAM,KAAG,MAAM;;;;0CAMf,MAAM,qBAAqB,MAAM,KAAG,MAAM;;;;0CAQ1C,MAAM,qBAAqB,MAAM,KAAG,MAAM;;;;0CAQ1C,MAAM,qBAAqB,MAAM,KAAG,MAAM;;;;0CAQ1C,MAAM,qBAAqB,MAAM,KAAG,MAAM;;;;0CAQ1C,MAAM,qBAAqB,MAAM,KAAG,MAAM;;;;0CAQ1C,MAAM,KAAG,MAAM;;;;0CASf,MAAM,KAAG,MAAM;;;;0CASf,MAAM,KAAG,MAAM;;;;0CASf,MAAM,KAAG,MAAM;;;;0CAMf,MAAM,KAAG,MAAM;;;;;;CAuhB9B,CAAC"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * @fileoverview Error Type Enums - Foundational error types used across the SDK
3
+ * @description Centralized error type definitions to avoid circular dependencies
4
+ */
5
+ /**
6
+ * Client-side error types that can occur during API operations
7
+ */
8
+ export declare enum InsurUpClientErrorType {
9
+ Unknown = "Unknown",
10
+ JsonSerialization = "JsonSerialization",
11
+ JsonDeserialization = "JsonDeserialization",
12
+ NullResponse = "NullResponse",
13
+ Timeout = "Timeout",
14
+ HttpRequestFailed = "HttpRequestFailed",
15
+ UnexpectedNoContent = "UnexpectedNoContent",
16
+ GraphQLError = "GraphQLError"
17
+ }
18
+ /**
19
+ * Server-side error types from HTTP responses
20
+ */
21
+ export declare enum InsurUpServerErrorType {
22
+ Unknown = "Unknown",
23
+ AccessDenied = "AccessDenied",
24
+ BusinessValidation = "BusinessValidation",
25
+ FeatureNotSupported = "FeatureNotSupported",
26
+ InputValidation = "InputValidation",
27
+ ResourceDuplicate = "ResourceDuplicate",
28
+ ResourceInvalidState = "ResourceInvalidState",
29
+ ResourceNotFound = "ResourceNotFound",
30
+ EndpointNotFound = "EndpointNotFound",
31
+ UnsupportedMediaType = "UnsupportedMediaType",
32
+ MethodNotAllowed = "MethodNotAllowed",
33
+ Unauthorized = "Unauthorized",
34
+ Upstream = "Upstream"
35
+ }
36
+ /**
37
+ * GraphQL error codes from the server
38
+ * These match the error codes set by the GraphQL error filter on the backend
39
+ */
40
+ export declare enum InsurUpGraphQLErrorCode {
41
+ /** Access denied - user lacks permission */
42
+ Forbidden = "FORBIDDEN",
43
+ /** Authentication required or invalid */
44
+ Unauthorized = "UNAUTHORIZED",
45
+ /** Requested resource not found */
46
+ NotFound = "NOT_FOUND",
47
+ /** Invalid input or business validation failure */
48
+ BadRequest = "BAD_REQUEST",
49
+ /** Resource conflict (duplicate or invalid state) */
50
+ Conflict = "CONFLICT",
51
+ /** Feature not supported */
52
+ NotSupported = "NOT_SUPPORTED",
53
+ /** Upstream service error */
54
+ UpstreamError = "UPSTREAM_ERROR",
55
+ /** Internal server error */
56
+ InternalError = "INTERNAL_ERROR",
57
+ /** GraphQL validation error */
58
+ ValidationError = "VALIDATION_ERROR",
59
+ /** Filter is required for this query */
60
+ FilterRequired = "FILTER_REQUIRED",
61
+ /** Filter time span exceeds maximum allowed */
62
+ FilterMaxSpanExceeded = "FILTER_MAX_SPAN_EXCEEDED",
63
+ /** Unknown error code */
64
+ Unknown = "UNKNOWN"
65
+ }
66
+ //# sourceMappingURL=error-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-types.d.ts","sourceRoot":"","sources":["../../src/core/error-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,oBAAY,sBAAsB;IAChC,OAAO,YAAY;IACnB,iBAAiB,sBAAsB;IACvC,mBAAmB,wBAAwB;IAC3C,YAAY,iBAAiB;IAC7B,OAAO,YAAY;IACnB,iBAAiB,sBAAsB;IACvC,mBAAmB,wBAAwB;IAC3C,YAAY,iBAAiB;CAC9B;AAED;;GAEG;AACH,oBAAY,sBAAsB;IAChC,OAAO,YAAY;IACnB,YAAY,iBAAiB;IAC7B,kBAAkB,uBAAuB;IACzC,mBAAmB,wBAAwB;IAC3C,eAAe,oBAAoB;IACnC,iBAAiB,sBAAsB;IACvC,oBAAoB,yBAAyB;IAC7C,gBAAgB,qBAAqB;IACrC,gBAAgB,qBAAqB;IACrC,oBAAoB,yBAAyB;IAC7C,gBAAgB,qBAAqB;IACrC,YAAY,iBAAiB;IAC7B,QAAQ,aAAa;CACtB;AAED;;;GAGG;AACH,oBAAY,uBAAuB;IACjC,4CAA4C;IAC5C,SAAS,cAAc;IACvB,yCAAyC;IACzC,YAAY,iBAAiB;IAC7B,mCAAmC;IACnC,QAAQ,cAAc;IACtB,mDAAmD;IACnD,UAAU,gBAAgB;IAC1B,qDAAqD;IACrD,QAAQ,aAAa;IACrB,4BAA4B;IAC5B,YAAY,kBAAkB;IAC9B,6BAA6B;IAC7B,aAAa,mBAAmB;IAChC,4BAA4B;IAC5B,aAAa,mBAAmB;IAChC,+BAA+B;IAC/B,eAAe,qBAAqB;IACpC,wCAAwC;IACxC,cAAc,oBAAoB;IAClC,+CAA+C;IAC/C,qBAAqB,6BAA6B;IAClD,yBAAyB;IACzB,OAAO,YAAY;CACpB"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @fileoverview Error handling and mapping utilities
3
+ * @description Error type mapping and parsing logic
4
+ */
5
+ import { type ServerError, type ClientError, type GraphQLErrors } from './result.js';
6
+ /**
7
+ * Parses server error response and creates a ServerError object
8
+ */
9
+ export declare function parseServerError(response: Response, responseBody: string): ServerError;
10
+ /**
11
+ * Creates a client error for network/timeout issues
12
+ */
13
+ export declare function createNetworkError(error: unknown): ClientError;
14
+ /**
15
+ * Creates a client error for JSON serialization issues
16
+ */
17
+ export declare function createSerializationError(error: unknown): ClientError;
18
+ /**
19
+ * Creates a client error for JSON deserialization issues
20
+ */
21
+ export declare function createDeserializationError(error: unknown): ClientError;
22
+ /**
23
+ * Creates a client error for null/empty responses when data was expected
24
+ */
25
+ export declare function createNullResponseError(): ClientError;
26
+ /**
27
+ * Creates a client error for unexpected empty/no-content responses
28
+ * Used when an endpoint that should return data receives 204 or empty body
29
+ */
30
+ export declare function createUnexpectedNoContentError(): ClientError;
31
+ export declare function extractError(error: Error): ClientError | ServerError | GraphQLErrors;
32
+ /**
33
+ * Custom InsurUp error class that extends the standard Error
34
+ */
35
+ export declare class InsurUpError extends Error {
36
+ /**
37
+ * The original client, server, or GraphQL error object
38
+ */
39
+ readonly error: ClientError | ServerError | GraphQLErrors;
40
+ constructor(error: ClientError | ServerError | GraphQLErrors);
41
+ }
42
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAgFrF;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,GAAG,WAAW,CAmCtF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,CA+C9D;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,CAQpE;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,CAQtE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,WAAW,CAOrD;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,IAAI,WAAW,CAO5D;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW,GAAG,WAAW,GAAG,aAAa,CAWpF;AAED;;GAEG;AACH,qBAAa,YAAa,SAAQ,KAAK;IACrC;;OAEG;IACH,SAAgB,KAAK,EAAE,WAAW,GAAG,WAAW,GAAG,aAAa,CAAC;gBAErD,KAAK,EAAE,WAAW,GAAG,WAAW,GAAG,aAAa;CAK7D"}
@@ -0,0 +1,221 @@
1
+ /**
2
+ * @fileoverview InsurUp Client Options - Configuration for the SDK client
3
+ * @description Configuration for the SDK client
4
+ */
5
+ import type { InsurUpResult } from './result.js';
6
+ /**
7
+ * Logging levels for request/response debugging
8
+ */
9
+ export type LogLevel = 'none' | 'basic' | 'detailed';
10
+ /**
11
+ * Custom logger interface for request/response logging
12
+ */
13
+ export interface Logger {
14
+ /**
15
+ * Log informational messages
16
+ */
17
+ info(message: string, data?: unknown): void;
18
+ /**
19
+ * Log warning messages
20
+ */
21
+ warn(message: string, data?: unknown): void;
22
+ /**
23
+ * Log error messages
24
+ */
25
+ error(message: string, data?: unknown): void;
26
+ }
27
+ /**
28
+ * Backoff strategy for retry delays
29
+ * - exponential: delay = minTimeout * (factor ^ attempt) - grows quickly
30
+ * - linear: delay = minTimeout * attempt - grows steadily
31
+ * - constant: delay = minTimeout - fixed delay between retries
32
+ */
33
+ export type BackoffStrategy = 'exponential' | 'linear' | 'constant';
34
+ /**
35
+ * Retry configuration for handling transient failures
36
+ * Built-in implementation providing configurable backoff with jitter.
37
+ * Disabled by default. To enable, provide an object with retry settings.
38
+ */
39
+ export interface RetryOptions {
40
+ /**
41
+ * Maximum number of retry attempts
42
+ * @default 3
43
+ */
44
+ readonly retries?: number;
45
+ /**
46
+ * The exponential factor to use
47
+ * @default 2
48
+ */
49
+ readonly factor?: number;
50
+ /**
51
+ * The number of milliseconds before starting the first retry
52
+ * @default 1000
53
+ */
54
+ readonly minTimeout?: number;
55
+ /**
56
+ * The maximum number of milliseconds between two retries
57
+ * @default 10000
58
+ */
59
+ readonly maxTimeout?: number;
60
+ /**
61
+ * Randomizes the timeouts by multiplying with a factor between 1 to 2
62
+ * @default true
63
+ */
64
+ readonly randomize?: boolean;
65
+ /**
66
+ * The backoff strategy to use between retries
67
+ * - exponential: delay = minTimeout * (factor ^ attempt)
68
+ * - linear: delay = minTimeout * attempt
69
+ * - constant: delay = minTimeout
70
+ * @default "exponential"
71
+ */
72
+ readonly backoffStrategy?: BackoffStrategy;
73
+ /**
74
+ * HTTP status codes that should trigger a retry
75
+ * @default [408, 429, 500, 502, 503, 504]
76
+ */
77
+ readonly retryableStatusCodes?: readonly number[];
78
+ /**
79
+ * Called when a retry is made
80
+ */
81
+ readonly onFailedAttempt?: (error: {
82
+ attemptNumber: number;
83
+ retriesLeft: number;
84
+ name: string;
85
+ message: string;
86
+ error: Error;
87
+ }) => void;
88
+ }
89
+ /**
90
+ * Token provider function that returns an authentication token
91
+ * Can be async to support dynamic token retrieval
92
+ */
93
+ export type TokenProvider = () => string | Promise<string | null> | null;
94
+ /**
95
+ * Request configuration passed to interceptors
96
+ */
97
+ export interface RequestConfig {
98
+ /**
99
+ * The full URL of the request
100
+ */
101
+ readonly url: string;
102
+ /**
103
+ * HTTP method (GET, POST, PUT, DELETE, PATCH)
104
+ */
105
+ readonly method: string;
106
+ /**
107
+ * Request headers
108
+ */
109
+ readonly headers: Record<string, string>;
110
+ /**
111
+ * Request body (if any)
112
+ */
113
+ readonly body?: unknown;
114
+ }
115
+ /**
116
+ * Request interceptor function called before each request is sent
117
+ * Can modify the request configuration or perform side effects
118
+ */
119
+ export type RequestInterceptor = (config: RequestConfig) => RequestConfig | Promise<RequestConfig>;
120
+ /**
121
+ * Response interceptor function called after each response is received
122
+ * Can transform the result or perform side effects
123
+ */
124
+ export type ResponseInterceptor = <T>(result: InsurUpResult<T>, config: RequestConfig) => InsurUpResult<T> | Promise<InsurUpResult<T>>;
125
+ /**
126
+ * Per-request options for individual API calls
127
+ * Allows overriding client-level defaults and controlling request lifecycle
128
+ */
129
+ export interface RequestOptions {
130
+ /**
131
+ * AbortSignal for request cancellation
132
+ * Useful for cancelling requests on component unmount (React) or user navigation
133
+ *
134
+ * @example
135
+ * ```typescript
136
+ * const controller = new AbortController();
137
+ * const result = await client.customers.getCustomer('id', { signal: controller.signal });
138
+ * // Later: controller.abort();
139
+ * ```
140
+ */
141
+ readonly signal?: AbortSignal;
142
+ /**
143
+ * Per-request timeout in milliseconds
144
+ * Overrides the client-level timeoutMs for this specific request
145
+ *
146
+ * @example
147
+ * ```typescript
148
+ * // Override default timeout for a slow operation
149
+ * const result = await client.customers.getCustomer('id', { timeoutMs: 60000 });
150
+ * ```
151
+ */
152
+ readonly timeoutMs?: number;
153
+ /**
154
+ * Additional headers for this specific request
155
+ * These headers will be merged with client-level customHeaders
156
+ */
157
+ readonly headers?: Record<string, string>;
158
+ }
159
+ /**
160
+ * Configuration options for the InsurUp SDK client
161
+ */
162
+ export interface InsurUpClientOptions {
163
+ /**
164
+ * The base URL of the InsurUp API
165
+ *
166
+ * @default "https://api.insurup.com/api/"
167
+ */
168
+ readonly baseUrl?: string;
169
+ /**
170
+ * Custom headers to include with every request
171
+ * These headers will be merged with the default headers for each request
172
+ */
173
+ readonly customHeaders?: Readonly<Record<string, string>>;
174
+ /**
175
+ * User agent string for HTTP requests
176
+ * Note: In browser environments, this may be ignored due to CORS restrictions
177
+ *
178
+ * @default "@insurup/sdk/1.0.0"
179
+ */
180
+ readonly userAgent?: string;
181
+ /**
182
+ * Request timeout in milliseconds
183
+ * This is a simplified adaptation of the .NET TimeoutStrategy options
184
+ *
185
+ * @default 30000 (30 seconds)
186
+ */
187
+ readonly timeoutMs?: number;
188
+ /**
189
+ * Logging configuration for request/response debugging
190
+ *
191
+ * @default 'none'
192
+ */
193
+ readonly logLevel?: LogLevel;
194
+ /**
195
+ * Custom logger implementation
196
+ * If not provided, console will be used when logLevel is not 'none'
197
+ */
198
+ readonly logger?: Logger;
199
+ /**
200
+ * Retry configuration for handling transient failures
201
+ * If not provided, no retries will be attempted
202
+ */
203
+ readonly retry?: RetryOptions;
204
+ /**
205
+ * Optional token provider function for authentication
206
+ * Called before each request to get the current authentication token
207
+ * The token will be automatically added to the Authorization header as 'Bearer {token}'
208
+ */
209
+ readonly tokenProvider?: TokenProvider;
210
+ /**
211
+ * Optional request interceptor called before each request is sent
212
+ * Allows modifying request configuration or performing side effects
213
+ */
214
+ readonly onRequest?: RequestInterceptor;
215
+ /**
216
+ * Optional response interceptor called after each response is received
217
+ * Allows transforming the result or performing side effects
218
+ */
219
+ readonly onResponse?: ResponseInterceptor;
220
+ }
221
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/core/options.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAE5C;;OAEG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAE5C;;OAEG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC9C;AAED;;;;;GAKG;AACH,MAAM,MAAM,eAAe,G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AC,EAAE,kBAAkB,CAAC;IAExC;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,mBAAmB,CAAC;CAC3C"}
@@ -0,0 +1,183 @@
1
+ /**
2
+ * @fileoverview InsurUp Result Types - Type-safe discriminated unions for operation results
3
+ * @description Type-safe discriminated unions for operation results
4
+ */
5
+ import { InsurUpClientErrorType, InsurUpServerErrorType, InsurUpGraphQLErrorCode } from './error-types.js';
6
+ /**
7
+ * Represents a validation error that occurred during request processing
8
+ */
9
+ export interface ValidationError {
10
+ /**
11
+ * The name of the property that failed validation
12
+ * The name of the property.
13
+ */
14
+ readonly propertyName: string;
15
+ /**
16
+ * The error message describing what went wrong
17
+ * The error message
18
+ */
19
+ readonly errorMessage: string;
20
+ /**
21
+ * The property value that caused the validation failure
22
+ * The property value that caused the failure.
23
+ */
24
+ readonly attemptedValue: unknown;
25
+ }
26
+ export { InsurUpClientErrorType, InsurUpServerErrorType, InsurUpGraphQLErrorCode };
27
+ /**
28
+ * Represents a successful operation with data
29
+ */
30
+ export interface Success<T> {
31
+ readonly kind: 'success';
32
+ readonly isSuccess: true;
33
+ readonly message: 'Success';
34
+ readonly data: T;
35
+ }
36
+ /**
37
+ * Represents a successful operation without data (e.g., 204 No Content)
38
+ */
39
+ export interface SuccessNoContent {
40
+ readonly kind: 'success';
41
+ readonly isSuccess: true;
42
+ readonly message: 'Success';
43
+ }
44
+ /**
45
+ * Represents an error response from the server (4xx and 5xx HTTP status codes)
46
+ */
47
+ export interface ServerError {
48
+ readonly kind: 'server-error';
49
+ readonly isSuccess: false;
50
+ readonly message: string;
51
+ readonly type: InsurUpServerErrorType;
52
+ readonly typeString: string;
53
+ readonly title: string;
54
+ readonly detail: string;
55
+ readonly instance: string;
56
+ readonly status: number;
57
+ readonly codes: readonly string[];
58
+ readonly traceId: string | undefined;
59
+ readonly template: string;
60
+ readonly templateArgs: Readonly<Record<string, unknown>>;
61
+ readonly suggestions: readonly string[];
62
+ readonly validationErrors: readonly ValidationError[];
63
+ }
64
+ /**
65
+ * Represents a client-side error (exceptions, null JSON responses, etc.)
66
+ */
67
+ export interface ClientError {
68
+ readonly kind: 'client-error';
69
+ readonly isSuccess: false;
70
+ readonly message: string;
71
+ readonly type: InsurUpClientErrorType;
72
+ readonly error?: unknown;
73
+ }
74
+ /**
75
+ * Represents the location of an error in a GraphQL document
76
+ */
77
+ export interface GraphQLErrorLocation {
78
+ readonly line: number;
79
+ readonly column: number;
80
+ }
81
+ /**
82
+ * Extensions attached to GraphQL errors by the server
83
+ * Contains structured error information from the backend error filter
84
+ */
85
+ export interface GraphQLErrorExtensions {
86
+ /** The error code (e.g., FORBIDDEN, UNAUTHORIZED, NOT_FOUND) */
87
+ readonly code?: InsurUpGraphQLErrorCode;
88
+ /** Trace ID for debugging/correlation */
89
+ readonly traceId?: string;
90
+ /** Array of error codes from the backend AppException */
91
+ readonly codes?: readonly string[];
92
+ /** Message template for localization */
93
+ readonly template?: string;
94
+ /** Arguments for the message template */
95
+ readonly templateArgs?: Readonly<Record<string, unknown>>;
96
+ /** Suggested actions or fixes */
97
+ readonly suggestions?: readonly string[];
98
+ /** Additional extension fields */
99
+ readonly [key: string]: unknown;
100
+ }
101
+ /**
102
+ * Represents a single GraphQL error item
103
+ */
104
+ export interface GraphQLErrorItem {
105
+ /** The error message */
106
+ readonly message: string;
107
+ /** Locations in the GraphQL document where the error occurred */
108
+ readonly locations?: readonly GraphQLErrorLocation[];
109
+ /** Path to the field that caused the error */
110
+ readonly path?: readonly (string | number)[];
111
+ /** Extensions containing additional error information */
112
+ readonly extensions?: GraphQLErrorExtensions;
113
+ }
114
+ /**
115
+ * Represents a GraphQL error response containing one or more errors
116
+ */
117
+ export interface GraphQLErrors {
118
+ readonly kind: 'graphql-error';
119
+ readonly isSuccess: false;
120
+ /** First error message for convenience */
121
+ readonly message: string;
122
+ /** All GraphQL errors from the response */
123
+ readonly errors: readonly GraphQLErrorItem[];
124
+ }
125
+ /**
126
+ * Discriminated union representing the result of a GraphQL operation
127
+ *
128
+ * Uses GraphQLErrors for GraphQL-level errors (multiple errors with a distinct
129
+ * schema), and also includes ServerError to pass through HTTP-level failures
130
+ * (401, 500, etc.) that occur before the GraphQL layer.
131
+ *
132
+ * @template T The type of the success data (void for no-content operations)
133
+ */
134
+ export type InsurUpGraphQLResult<T = void> = T extends void ? SuccessNoContent | GraphQLErrors | ServerError | ClientError : Success<T> | GraphQLErrors | ServerError | ClientError;
135
+ /**
136
+ * Discriminated union representing the result of an InsurUp operation
137
+ *
138
+ * When called without a type parameter (InsurUpResult), represents a no-content result
139
+ * where the success case has no data field.
140
+ *
141
+ * When called with a type parameter (InsurUpResult<T>), represents a result with data
142
+ * where the success case has a data field of type T.
143
+ *
144
+ * @template T The type of the success data (void for no-content operations)
145
+ */
146
+ export type InsurUpResult<T = void> = T extends void ? SuccessNoContent | ServerError | ClientError : Success<T> | ServerError | ClientError;
147
+ /**
148
+ * Creates a successful result with data
149
+ */
150
+ export declare function createSuccess<T>(data: T): Success<T>;
151
+ /**
152
+ * Creates a successful result without data (for 204 No Content responses)
153
+ */
154
+ export declare function createSuccessNoContent(): SuccessNoContent;
155
+ /**
156
+ * Helper type to extract data type from a Success result
157
+ */
158
+ export type ExtractSuccessData<R> = R extends Success<infer T> ? T : never;
159
+ /**
160
+ * Extracts data from a successful result or throws an InsurUpError
161
+ * Only works with InsurUpResult<T> where T is not void
162
+ */
163
+ export declare function getDataOrThrow<T>(result: InsurUpResult<T>): T;
164
+ /**
165
+ * Throws an InsurUpError if the result is not successful
166
+ * Works with any InsurUpResult type
167
+ */
168
+ export declare function throwIfError(result: InsurUpResult<unknown> | InsurUpResult): void;
169
+ /**
170
+ * Extracts data from a successful GraphQL result or throws an InsurUpError
171
+ * Only works with InsurUpGraphQLResult<T> where T is not void
172
+ */
173
+ export declare function getGraphQLDataOrThrow<T>(result: InsurUpGraphQLResult<T>): T;
174
+ /**
175
+ * Throws an InsurUpError if the GraphQL result is not successful
176
+ * Works with any InsurUpGraphQLResult type
177
+ */
178
+ export declare function throwIfGraphQLError(result: InsurUpGraphQLResult<unknown> | InsurUpGraphQLResult): void;
179
+ /**
180
+ * Creates a GraphQL errors result from an array of GraphQL error items
181
+ */
182
+ export declare function createGraphQLErrors(errors: readonly GraphQLErrorItem[]): GraphQLErrors;
183
+ //# sourceMappingURL=result.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../src/core/result.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,kBAAkB,CAAC;AAE1B;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAE9B;;;OAGG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAE9B;;;OAGG;IACH,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;CAClC;AAGD,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,CAAC;AAEnF;;GAEG;AACH,MAAM,WAAW,OAAO,CAAC,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC;IAC1B,QAAQ,CAAC,OAA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;AAE3D;;;;;;;;;;GAUG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,SAAS,IAAI,GAChD,gBAAgB,GAAG,WAAW,GAAG,WAAW,GAC5C,OAAO,CAAC,CAAC,CAAC,GAAG,WAAW,GAAG,WAAW,CAAC;AAE3C;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAOpD;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,gBAAgB,CAMzD;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAE3E;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAM7D;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,GAAG,aAAa,GAAG,IAAI,CAKjF;AAMD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,CAAC,CAK3E;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,oBAAoB,CAAC,OAAO,CAAC,GAAG,oBAAoB,GAC3D,IAAI,CAKN;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,gBAAgB,EAAE,GAAG,aAAa,CAOtF"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @fileoverview Lightweight retry utility for transient failure handling
3
+ * @description Provides configurable backoff strategies with jitter, zero-dependency replacement for p-retry
4
+ */
5
+ import type { RetryOptions } from './options.js';
6
+ /**
7
+ * Executes a function with configurable backoff retry logic
8
+ * @template T The return type of the function
9
+ * @param fn The function to execute, receives attempt number (1-based)
10
+ * @param options Retry configuration options
11
+ * @returns Promise resolving to the function's result
12
+ * @throws The last error encountered if all retry attempts fail
13
+ */
14
+ export declare function withRetry<T>(fn: (attemptNumber: number) => Promise<T>, options: Required<RetryOptions>): Promise<T>;
15
+ //# sourceMappingURL=retry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../src/core/retry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD;;;;;;;GAOG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAC/B,EAAE,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,EACzC,OAAO,EAAE,QAAQ,CAAC,YAAY,CAAC,GAC9B,OAAO,CAAC,CAAC,CAAC,CAwDZ"}