@xivdyetools/types 1.6.1 → 1.7.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.
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * @module api
7
7
  */
8
- export type { APIResponse, CachedData } from './response.js';
8
+ export type { APISuccessResponse, APIErrorResponse, APIResponse, CachedData } from './response.js';
9
9
  export type { ModerationResult, ModerationLogEntry, ModerationStats } from './moderation.js';
10
10
  export type { PriceData, RateLimitResult } from './price.js';
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC7D,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC7F,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACnG,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC7F,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
@@ -6,20 +6,43 @@
6
6
  * @module api/response
7
7
  */
8
8
  /**
9
- * Generic API response wrapper
10
- *
11
- * Provides a consistent structure for all API responses.
9
+ * Successful API response
10
+ */
11
+ export interface APISuccessResponse<T> {
12
+ /** Operation succeeded */
13
+ success: true;
14
+ /** Response data */
15
+ data: T;
16
+ /** Response timestamp (ms since epoch) */
17
+ timestamp: number;
18
+ }
19
+ /**
20
+ * Failed API response
12
21
  */
13
- export interface APIResponse<T> {
14
- /** Whether the operation succeeded */
15
- success: boolean;
16
- /** Response data (if successful) */
17
- data?: T;
18
- /** Error message (if unsuccessful) */
19
- error?: string;
22
+ export interface APIErrorResponse {
23
+ /** Operation failed */
24
+ success: false;
25
+ /** Error message describing the failure */
26
+ error: string;
20
27
  /** Response timestamp (ms since epoch) */
21
28
  timestamp: number;
22
29
  }
30
+ /**
31
+ * Generic API response wrapper
32
+ *
33
+ * Provides a consistent structure for all API responses.
34
+ * Uses discriminated union for type-safe handling:
35
+ * ```typescript
36
+ * if (response.success) {
37
+ * // TypeScript knows: data exists and is of type T
38
+ * console.log(response.data);
39
+ * } else {
40
+ * // TypeScript knows: error exists
41
+ * console.error(response.error);
42
+ * }
43
+ * ```
44
+ */
45
+ export type APIResponse<T> = APISuccessResponse<T> | APIErrorResponse;
23
46
  /**
24
47
  * Cached data wrapper with TTL and integrity checking
25
48
  *
@@ -1 +1 @@
1
- {"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../src/api/response.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,sCAAsC;IACtC,OAAO,EAAE,OAAO,CAAC;IAEjB,oCAAoC;IACpC,IAAI,CAAC,EAAE,CAAC,CAAC;IAET,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,sBAAsB;IACtB,IAAI,EAAE,CAAC,CAAC;IAER,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC;IAElB,mCAAmC;IACnC,GAAG,EAAE,MAAM,CAAC;IAEZ,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
1
+ {"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../src/api/response.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC,0BAA0B;IAC1B,OAAO,EAAE,IAAI,CAAC;IAEd,oBAAoB;IACpB,IAAI,EAAE,CAAC,CAAC;IAER,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,uBAAuB;IACvB,OAAO,EAAE,KAAK,CAAC;IAEf,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IAEd,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,kBAAkB,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC;AAEtE;;;;;GAKG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,sBAAsB;IACtB,IAAI,EAAE,CAAC,CAAC;IAER,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC;IAElB,mCAAmC;IACnC,GAAG,EAAE,MAAM,CAAC;IAEZ,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
@@ -9,5 +9,5 @@ export type { AuthProvider, AuthSource, AuthContext } from './provider.js';
9
9
  export type { PrimaryCharacter, JWTPayload, OAuthState } from './jwt.js';
10
10
  export type { DiscordTokenResponse, DiscordUser } from './discord.js';
11
11
  export type { XIVAuthTokenResponse, XIVAuthCharacter, XIVAuthCharacterRegistration, XIVAuthSocialIdentity, XIVAuthUser, } from './xivauth.js';
12
- export type { AuthUser, AuthResponse, RefreshResponse, UserInfoResponse, } from './response.js';
12
+ export type { AuthUser, AuthSuccessResponse, AuthErrorResponse, AuthResponse, RefreshSuccessResponse, RefreshErrorResponse, RefreshResponse, UserInfoData, UserInfoSuccessResponse, UserInfoErrorResponse, UserInfoResponse, } from './response.js';
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG3E,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGzE,YAAY,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGtE,YAAY,EACV,oBAAoB,EACpB,gBAAgB,EAChB,4BAA4B,EAC5B,qBAAqB,EACrB,WAAW,GACZ,MAAM,cAAc,CAAC;AAGtB,YAAY,EACV,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,gBAAgB,GACjB,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG3E,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGzE,YAAY,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGtE,YAAY,EACV,oBAAoB,EACpB,gBAAgB,EAChB,4BAA4B,EAC5B,qBAAqB,EACrB,WAAW,GACZ,MAAM,cAAc,CAAC;AAGtB,YAAY,EACV,QAAQ,EACR,mBAAmB,EACnB,iBAAiB,EACjB,YAAY,EACZ,sBAAsB,EACtB,oBAAoB,EACpB,eAAe,EACf,YAAY,EACZ,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,eAAe,CAAC"}
@@ -27,48 +27,100 @@ export interface AuthUser {
27
27
  primary_character?: PrimaryCharacter;
28
28
  }
29
29
  /**
30
- * Response from authentication endpoints
30
+ * Successful authentication response
31
31
  */
32
- export interface AuthResponse {
33
- /** Whether authentication succeeded */
34
- success: boolean;
35
- /** JWT token (if successful) */
36
- token?: string;
37
- /** User information (if successful) */
38
- user?: AuthUser;
32
+ export interface AuthSuccessResponse {
33
+ /** Authentication succeeded */
34
+ success: true;
35
+ /** JWT token */
36
+ token: string;
37
+ /** User information */
38
+ user: AuthUser;
39
39
  /** Token expiration timestamp (ms since epoch) */
40
- expires_at?: number;
41
- /** Error message (if unsuccessful) */
42
- error?: string;
40
+ expires_at: number;
41
+ }
42
+ /**
43
+ * Failed authentication response
44
+ */
45
+ export interface AuthErrorResponse {
46
+ /** Authentication failed */
47
+ success: false;
48
+ /** Error message describing the failure */
49
+ error: string;
50
+ }
51
+ /**
52
+ * Response from authentication endpoints
53
+ *
54
+ * Uses discriminated union for type-safe handling:
55
+ * ```typescript
56
+ * if (response.success) {
57
+ * // TypeScript knows: token, user, expires_at exist
58
+ * console.log(response.user.username);
59
+ * } else {
60
+ * // TypeScript knows: error exists
61
+ * console.error(response.error);
62
+ * }
63
+ * ```
64
+ */
65
+ export type AuthResponse = AuthSuccessResponse | AuthErrorResponse;
66
+ /**
67
+ * Successful token refresh response
68
+ */
69
+ export interface RefreshSuccessResponse {
70
+ /** Refresh succeeded */
71
+ success: true;
72
+ /** New JWT token */
73
+ token: string;
74
+ /** New token expiration timestamp (ms since epoch) */
75
+ expires_at: number;
76
+ }
77
+ /**
78
+ * Failed token refresh response
79
+ */
80
+ export interface RefreshErrorResponse {
81
+ /** Refresh failed */
82
+ success: false;
83
+ /** Error message describing the failure */
84
+ error: string;
43
85
  }
44
86
  /**
45
87
  * Response from token refresh endpoint
88
+ *
89
+ * Uses discriminated union for type-safe handling.
46
90
  */
47
- export interface RefreshResponse {
48
- /** Whether refresh succeeded */
49
- success: boolean;
50
- /** New JWT token (if successful) */
51
- token?: string;
52
- /** New token expiration timestamp */
53
- expires_at?: number;
54
- /** Error message (if unsuccessful) */
55
- error?: string;
91
+ export type RefreshResponse = RefreshSuccessResponse | RefreshErrorResponse;
92
+ /**
93
+ * User info data returned in UserInfoResponse
94
+ */
95
+ export interface UserInfoData {
96
+ id: string;
97
+ username: string;
98
+ global_name: string | null;
99
+ avatar: string | null;
100
+ avatar_url: string | null;
56
101
  }
57
102
  /**
58
- * Response from user info endpoint
103
+ * Successful user info response
59
104
  */
60
- export interface UserInfoResponse {
61
- /** Whether request succeeded */
62
- success: boolean;
63
- /** User information (if successful) */
64
- user?: {
65
- id: string;
66
- username: string;
67
- global_name: string | null;
68
- avatar: string | null;
69
- avatar_url: string | null;
70
- };
71
- /** Error message (if unsuccessful) */
72
- error?: string;
105
+ export interface UserInfoSuccessResponse {
106
+ /** Request succeeded */
107
+ success: true;
108
+ /** User information */
109
+ user: UserInfoData;
73
110
  }
111
+ /**
112
+ * Failed user info response
113
+ */
114
+ export interface UserInfoErrorResponse {
115
+ /** Request failed */
116
+ success: false;
117
+ /** Error message describing the failure */
118
+ error: string;
119
+ }
120
+ /**
121
+ * Response from user info endpoint
122
+ *
123
+ * Uses discriminated union for type-safe handling.
124
+ */
125
+ export type UserInfoResponse = UserInfoSuccessResponse | UserInfoErrorResponse;
74
126
  //# sourceMappingURL=response.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../src/auth/response.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,uBAAuB;IACvB,EAAE,EAAE,MAAM,CAAC;IAEX,uBAAuB;IACvB,QAAQ,EAAE,MAAM,CAAC;IAEjB,kCAAkC;IAClC,WAAW,EAAE,MAAM,GAAG,IAAI,C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AAC;IAEf,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,sBAAsB,GAAG,oBAAoB,CAAC;AAE5E;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,wBAAwB;IACxB,OAAO,EAAE,IAAI,CAAC;IAEd,uBAAuB;IACvB,IAAI,EAAE,YAAY,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,qBAAqB;IACrB,OAAO,EAAE,KAAK,CAAC;IAEf,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,uBAAuB,GAAG,qBAAqB,CAAC"}
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * @module color
7
7
  */
8
- export type { RGB, HSV, LAB } from './rgb.js';
8
+ export type { RGB, HSV, LAB, OKLAB, OKLCH, LCH, HSL } from './rgb.js';
9
9
  export type { HexColor, DyeId, Hue, Saturation } from './branded.js';
10
10
  export { createHexColor, createDyeId, createHue, createSaturation } from './branded.js';
11
11
  export type { VisionType, Matrix3x3, ColorblindMatrices } from './colorblind.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/color/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAG9C,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGxF,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/color/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAGtE,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGxF,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -42,4 +42,74 @@ export interface LAB {
42
42
  /** Blue-Yellow axis (approximately -128 to 127) */
43
43
  b: number;
44
44
  }
45
+ /**
46
+ * OKLAB color representation (modern perceptually uniform color space)
47
+ *
48
+ * OKLAB (Björn Ottosson, 2020) fixes issues with CIELAB, particularly
49
+ * for blue colors. It provides more consistent perceptual uniformity
50
+ * and is now part of CSS Color Level 4.
51
+ *
52
+ * Key advantages over LAB:
53
+ * - Blue + Yellow = Green (not pink like LAB)
54
+ * - More uniform hue spacing
55
+ * - Better gradient interpolation
56
+ *
57
+ * @example { L: 0.628, a: 0.225, b: -0.126 } // Red
58
+ */
59
+ export interface OKLAB {
60
+ /** Perceived lightness (0 to 1) */
61
+ L: number;
62
+ /** Green-Red axis (approximately -0.4 to 0.4) */
63
+ a: number;
64
+ /** Blue-Yellow axis (approximately -0.4 to 0.4) */
65
+ b: number;
66
+ }
67
+ /**
68
+ * OKLCH color representation (cylindrical form of OKLAB)
69
+ *
70
+ * OKLCH expresses OKLAB in cylindrical coordinates for intuitive
71
+ * hue manipulation. Ideal for gradient interpolation and color mixing.
72
+ *
73
+ * @example { L: 0.628, C: 0.258, h: 29.23 } // Red
74
+ */
75
+ export interface OKLCH {
76
+ /** Perceived lightness (0 to 1) */
77
+ L: number;
78
+ /** Chroma - colorfulness (0 to ~0.4) */
79
+ C: number;
80
+ /** Hue angle (0-360 degrees) */
81
+ h: number;
82
+ }
83
+ /**
84
+ * LCH color representation (cylindrical form of CIE LAB)
85
+ *
86
+ * LCH expresses LAB in cylindrical coordinates (Lightness, Chroma, Hue).
87
+ * Useful for hue-based interpolation with control over direction.
88
+ *
89
+ * @example { L: 53.23, C: 104.55, h: 40.0 } // Red
90
+ */
91
+ export interface LCH {
92
+ /** Lightness (0-100) */
93
+ L: number;
94
+ /** Chroma - colorfulness (0 to ~150) */
95
+ C: number;
96
+ /** Hue angle (0-360 degrees) */
97
+ h: number;
98
+ }
99
+ /**
100
+ * HSL color representation (Hue, Saturation, Lightness)
101
+ *
102
+ * Similar to HSV but with Lightness instead of Value.
103
+ * Common in design tools (Photoshop, Figma, CSS).
104
+ *
105
+ * @example { h: 0, s: 100, l: 50 } // Bright red
106
+ */
107
+ export interface HSL {
108
+ /** Hue (0-360 degrees) */
109
+ h: number;
110
+ /** Saturation (0-100 percent) */
111
+ s: number;
112
+ /** Lightness (0-100 percent) */
113
+ l: number;
114
+ }
45
115
  //# sourceMappingURL=rgb.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rgb.d.ts","sourceRoot":"","sources":["../../src/color/rgb.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,MAAM,WAAW,GAAG;IAClB,0BAA0B;IAC1B,CAAC,EAAE,MAAM,CAAC;IACV,4BAA4B;IAC5B,CAAC,EAAE,MAAM,CAAC;IACV,2BAA2B;IAC3B,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;;GAGG;AACH,MAAM,WAAW,GAAG;IAClB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AC;IACV,gCAAgC;IAChC,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,GAAG;IAClB,wBAAwB;IACxB,CAAC,EAAE,MAAM,CAAC;IACV,wCAAwC;IACxC,CAAC,EAAE,MAAM,CAAC;IACV,gCAAgC;IAChC,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,GAAG;IAClB,0BAA0B;IAC1B,CAAC,EAAE,MAAM,CAAC;IACV,iCAAiC;IACjC,CAAC,EAAE,MAAM,CAAC;IACV,gCAAgC;IAChC,CAAC,EAAE,MAAM,CAAC;CACX"}
package/dist/index.d.ts CHANGED
@@ -12,16 +12,16 @@
12
12
  *
13
13
  * @packageDocumentation
14
14
  */
15
- export type { RGB, HSV, LAB } from './color/index.js';
15
+ export type { RGB, HSV, LAB, OKLAB, OKLCH, LCH, HSL } from './color/index.js';
16
16
  export type { HexColor, DyeId, Hue, Saturation } from './color/index.js';
17
17
  export { createHexColor, createDyeId, createHue, createSaturation } from './color/index.js';
18
18
  export type { VisionType, Matrix3x3, ColorblindMatrices } from './color/index.js';
19
19
  export type { Dye, LocalizedDye, DyeWithDistance, DyeDatabase } from './dye/index.js';
20
20
  export type { CharacterColor, CharacterColorMatch, SharedColorCategory, RaceSpecificColorCategory, CharacterColorCategory, SubRace, Gender, Race, } from './character/index.js';
21
21
  export { RACE_SUBRACES, SUBRACE_TO_RACE, COLOR_GRID_DIMENSIONS, } from './character/index.js';
22
- export type { PresetCategory, PresetStatus, PresetSortOption, CategoryMeta, PresetPalette, ResolvedPreset, PresetData, PresetPreviousValues, CommunityPreset, PresetSubmission, AuthenticatedPresetSubmission, PresetFilters, PresetEditRequest, PresetListResponse, PresetSubmitResponse, PresetEditResponse, VoteResponse, ModerationResponse, CategoryListResponse, } from './preset/index.js';
23
- export type { AuthProvider, AuthSource, AuthContext, PrimaryCharacter, JWTPayload, OAuthState, DiscordTokenResponse, DiscordUser, XIVAuthTokenResponse, XIVAuthCharacter, XIVAuthCharacterRegistration, XIVAuthSocialIdentity, XIVAuthUser, AuthUser, AuthResponse, RefreshResponse, UserInfoResponse, } from './auth/index.js';
24
- export type { APIResponse, CachedData, ModerationResult, ModerationLogEntry, ModerationStats, PriceData, RateLimitResult, } from './api/index.js';
22
+ export type { PresetCategory, PresetStatus, PresetSortOption, CategoryMeta, PresetPalette, ResolvedPreset, PresetData, PresetPreviousValues, CommunityPreset, PresetSubmission, AuthenticatedPresetSubmission, PresetFilters, PresetEditRequest, PresetListResponse, PresetSubmitCreatedResponse, PresetSubmitDuplicateResponse, PresetSubmitErrorResponse, PresetSubmitResponse, PresetEditDuplicateInfo, PresetEditSuccessResponse, PresetEditDuplicateResponse, PresetEditErrorResponse, PresetEditResponse, VoteSuccessResponse, VoteErrorResponse, VoteResponse, ModerationSuccessResponse, ModerationErrorResponse, ModerationResponse, CategoryListResponse, } from './preset/index.js';
23
+ export type { AuthProvider, AuthSource, AuthContext, PrimaryCharacter, JWTPayload, OAuthState, DiscordTokenResponse, DiscordUser, XIVAuthTokenResponse, XIVAuthCharacter, XIVAuthCharacterRegistration, XIVAuthSocialIdentity, XIVAuthUser, AuthUser, AuthSuccessResponse, AuthErrorResponse, AuthResponse, RefreshSuccessResponse, RefreshErrorResponse, RefreshResponse, UserInfoData, UserInfoSuccessResponse, UserInfoErrorResponse, UserInfoResponse, } from './auth/index.js';
24
+ export type { APISuccessResponse, APIErrorResponse, APIResponse, CachedData, ModerationResult, ModerationLogEntry, ModerationStats, PriceData, RateLimitResult, } from './api/index.js';
25
25
  export type { LocaleCode, TranslationKey, HarmonyTypeKey, JobKey, GrandCompanyKey, RaceKey, ClanKey, LocaleData, LocalePreference, } from './localization/index.js';
26
26
  export { ErrorCode } from './error/index.js';
27
27
  export { AppError } from './error/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAa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M,kBAAkB,CAAC;AAC5C,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKtD,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAqB5F,OAAO,EACL,aAAa,EACb,eAAe,EACf,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AA8E9B,+EAA+E;AAC/E,cAAc;AACd,+EAA+E;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAO5C,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAqB5F,OAAO,EACL,aAAa,EACb,eAAe,EACf,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAkG9B,+EAA+E;AAC/E,cAAc;AACd,+EAA+E;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAO5C,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC"}
@@ -8,5 +8,5 @@
8
8
  export type { PresetCategory, PresetStatus, PresetSortOption, CategoryMeta, PresetPalette, ResolvedPreset, PresetData, } from './core.js';
9
9
  export type { PresetPreviousValues, CommunityPreset, PresetSubmission, AuthenticatedPresetSubmission, } from './community.js';
10
10
  export type { PresetFilters, PresetEditRequest } from './request.js';
11
- export type { PresetListResponse, PresetSubmitResponse, PresetEditResponse, VoteResponse, ModerationResponse, CategoryListResponse, } from './response.js';
11
+ export type { PresetListResponse, PresetSubmitCreatedResponse, PresetSubmitDuplicateResponse, PresetSubmitErrorResponse, PresetSubmitResponse, PresetEditDuplicateInfo, PresetEditSuccessResponse, PresetEditDuplicateResponse, PresetEditErrorResponse, PresetEditResponse, VoteSuccessResponse, VoteErrorResponse, VoteResponse, ModerationSuccessResponse, ModerationErrorResponse, ModerationResponse, CategoryListResponse, } from './response.js';
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/preset/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EACV,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,UAAU,GACX,MAAM,WAAW,CAAC;AAGnB,YAAY,EACV,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,6BAA6B,GAC9B,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGrE,YAAY,EACV,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/preset/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EACV,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,UAAU,GACX,MAAM,WAAW,CAAC;AAGnB,YAAY,EACV,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,6BAA6B,GAC9B,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGrE,YAAY,EACV,kBAAkB,EAClB,2BAA2B,EAC3B,6BAA6B,EAC7B,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACvB,yBAAyB,EACzB,2BAA2B,EAC3B,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,YAAY,EACZ,yBAAyB,EACzB,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,eAAe,CAAC"}
@@ -23,65 +23,140 @@ export interface PresetListResponse {
23
23
  has_more: boolean;
24
24
  }
25
25
  /**
26
- * Response when submitting a preset
26
+ * Successful preset creation response
27
27
  */
28
- export interface PresetSubmitResponse {
29
- /** Whether the operation succeeded */
30
- success: boolean;
31
- /** The created preset (if new) */
32
- preset?: CommunityPreset;
33
- /** The existing preset (if duplicate found) */
34
- duplicate?: CommunityPreset;
35
- /** Whether a vote was added to duplicate */
36
- vote_added?: boolean;
28
+ export interface PresetSubmitCreatedResponse {
29
+ /** Operation succeeded */
30
+ success: true;
31
+ /** The newly created preset */
32
+ preset: CommunityPreset;
37
33
  /** Moderation result */
38
- moderation_status?: 'approved' | 'pending';
39
- /** Error message (if success is false) */
40
- error?: string;
34
+ moderation_status: 'approved' | 'pending';
41
35
  }
42
36
  /**
43
- * Response from preset edit endpoint
37
+ * Duplicate preset found response
38
+ */
39
+ export interface PresetSubmitDuplicateResponse {
40
+ /** Operation succeeded (duplicate handling is not an error) */
41
+ success: true;
42
+ /** The existing preset that matched */
43
+ duplicate: CommunityPreset;
44
+ /** Whether a vote was added to the duplicate */
45
+ vote_added: boolean;
46
+ }
47
+ /**
48
+ * Failed preset submission response
49
+ */
50
+ export interface PresetSubmitErrorResponse {
51
+ /** Operation failed */
52
+ success: false;
53
+ /** Error message describing the failure */
54
+ error: string;
55
+ }
56
+ /**
57
+ * Response when submitting a preset
58
+ *
59
+ * Uses discriminated union with multiple success states:
60
+ * - Created: new preset was created
61
+ * - Duplicate: existing preset found, vote may have been added
62
+ * - Error: submission failed
44
63
  */
45
- export interface PresetEditResponse {
46
- /** Whether the operation succeeded */
47
- success: boolean;
64
+ export type PresetSubmitResponse = PresetSubmitCreatedResponse | PresetSubmitDuplicateResponse | PresetSubmitErrorResponse;
65
+ /**
66
+ * Duplicate preset info for edit conflict
67
+ */
68
+ export interface PresetEditDuplicateInfo {
69
+ id: string;
70
+ name: string;
71
+ author_name: string | null;
72
+ }
73
+ /**
74
+ * Successful preset edit response
75
+ */
76
+ export interface PresetEditSuccessResponse {
77
+ /** Operation succeeded */
78
+ success: true;
48
79
  /** The updated preset */
49
- preset?: CommunityPreset;
80
+ preset: CommunityPreset;
50
81
  /** Moderation result (if content needed review) */
51
82
  moderation_status?: 'approved' | 'pending';
52
- /** Duplicate info (if edit would create duplicate) */
53
- duplicate?: {
54
- id: string;
55
- name: string;
56
- author_name: string | null;
57
- };
58
- /** Error message (if success is false) */
59
- error?: string;
60
83
  }
61
84
  /**
62
- * Response when voting on a preset
85
+ * Preset edit blocked due to duplicate
86
+ */
87
+ export interface PresetEditDuplicateResponse {
88
+ /** Operation failed due to duplicate */
89
+ success: false;
90
+ /** Info about the existing duplicate */
91
+ duplicate: PresetEditDuplicateInfo;
92
+ /** Error message */
93
+ error: string;
94
+ }
95
+ /**
96
+ * Failed preset edit response
97
+ */
98
+ export interface PresetEditErrorResponse {
99
+ /** Operation failed */
100
+ success: false;
101
+ /** Error message describing the failure */
102
+ error: string;
103
+ }
104
+ /**
105
+ * Response from preset edit endpoint
106
+ *
107
+ * Uses discriminated union for type-safe handling.
108
+ */
109
+ export type PresetEditResponse = PresetEditSuccessResponse | PresetEditDuplicateResponse | PresetEditErrorResponse;
110
+ /**
111
+ * Successful vote response
63
112
  */
64
- export interface VoteResponse {
65
- /** Whether the operation succeeded */
66
- success: boolean;
113
+ export interface VoteSuccessResponse {
114
+ /** Operation succeeded */
115
+ success: true;
67
116
  /** Updated vote count */
68
117
  new_vote_count: number;
69
- /** True if user already voted */
118
+ /** True if user already voted (vote was not added) */
70
119
  already_voted?: boolean;
71
- /** Error message (if success is false) */
72
- error?: string;
73
120
  }
74
121
  /**
75
- * Response from moderation actions
122
+ * Failed vote response
76
123
  */
77
- export interface ModerationResponse {
78
- /** Whether the operation succeeded */
79
- success: boolean;
124
+ export interface VoteErrorResponse {
125
+ /** Operation failed */
126
+ success: false;
127
+ /** Error message describing the failure */
128
+ error: string;
129
+ }
130
+ /**
131
+ * Response when voting on a preset
132
+ *
133
+ * Uses discriminated union for type-safe handling.
134
+ */
135
+ export type VoteResponse = VoteSuccessResponse | VoteErrorResponse;
136
+ /**
137
+ * Successful moderation response
138
+ */
139
+ export interface ModerationSuccessResponse {
140
+ /** Operation succeeded */
141
+ success: true;
80
142
  /** The updated preset */
81
- preset?: CommunityPreset;
82
- /** Error message (if success is false) */
83
- error?: string;
143
+ preset: CommunityPreset;
144
+ }
145
+ /**
146
+ * Failed moderation response
147
+ */
148
+ export interface ModerationErrorResponse {
149
+ /** Operation failed */
150
+ success: false;
151
+ /** Error message describing the failure */
152
+ error: string;
84
153
  }
154
+ /**
155
+ * Response from moderation actions
156
+ *
157
+ * Uses discriminated union for type-safe handling.
158
+ */
159
+ export type ModerationResponse = ModerationSuccessResponse | ModerationErrorResponse;
85
160
  /**
86
161
  * Response when listing categories
87
162
  */
@@ -1 +1 @@
1
- {"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../src/preset/response.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,uBAAuB;IACvB,OAAO,EA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Y,GAAG,mBAAmB,GAAG,iBAAiB,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,0BAA0B;IAC1B,OAAO,EAAE,IAAI,CAAC;IAEd,yBAAyB;IACzB,MAAM,EAAE,eAAe,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,uBAAuB;IACvB,OAAO,EAAE,KAAK,CAAC;IAEf,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,yBAAyB,GAAG,uBAAuB,CAAC;AAErF;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,iCAAiC;IACjC,UAAU,EAAE,YAAY,EAAE,CAAC;CAC5B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xivdyetools/types",
3
- "version": "1.6.1",
3
+ "version": "1.7.0",
4
4
  "description": "Shared TypeScript type definitions for the xivdyetools ecosystem",
5
5
  "author": "XIV Dye Tools",
6
6
  "license": "MIT",
@@ -79,4 +79,4 @@
79
79
  "type": "git",
80
80
  "url": "https://github.com/xivdyetools/xivdyetools-types.git"
81
81
  }
82
- }
82
+ }