@xivdyetools/types 1.0.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.
Files changed (115) hide show
  1. package/LICENSE +37 -0
  2. package/README.md +272 -0
  3. package/dist/api/index.d.ts +11 -0
  4. package/dist/api/index.d.ts.map +1 -0
  5. package/dist/api/index.js +9 -0
  6. package/dist/api/index.js.map +1 -0
  7. package/dist/api/moderation.d.ts +53 -0
  8. package/dist/api/moderation.d.ts.map +1 -0
  9. package/dist/api/moderation.js +9 -0
  10. package/dist/api/moderation.js.map +1 -0
  11. package/dist/api/price.d.ts +38 -0
  12. package/dist/api/price.d.ts.map +1 -0
  13. package/dist/api/price.js +9 -0
  14. package/dist/api/price.js.map +1 -0
  15. package/dist/api/response.d.ts +41 -0
  16. package/dist/api/response.d.ts.map +1 -0
  17. package/dist/api/response.js +9 -0
  18. package/dist/api/response.js.map +1 -0
  19. package/dist/auth/discord.d.ts +60 -0
  20. package/dist/auth/discord.d.ts.map +1 -0
  21. package/dist/auth/discord.js +9 -0
  22. package/dist/auth/discord.js.map +1 -0
  23. package/dist/auth/index.d.ts +13 -0
  24. package/dist/auth/index.d.ts.map +1 -0
  25. package/dist/auth/index.js +9 -0
  26. package/dist/auth/index.js.map +1 -0
  27. package/dist/auth/jwt.d.ts +68 -0
  28. package/dist/auth/jwt.d.ts.map +1 -0
  29. package/dist/auth/jwt.js +9 -0
  30. package/dist/auth/jwt.js.map +1 -0
  31. package/dist/auth/provider.d.ts +37 -0
  32. package/dist/auth/provider.d.ts.map +1 -0
  33. package/dist/auth/provider.js +9 -0
  34. package/dist/auth/provider.js.map +1 -0
  35. package/dist/auth/response.d.ts +74 -0
  36. package/dist/auth/response.d.ts.map +1 -0
  37. package/dist/auth/response.js +9 -0
  38. package/dist/auth/response.js.map +1 -0
  39. package/dist/auth/xivauth.d.ts +90 -0
  40. package/dist/auth/xivauth.d.ts.map +1 -0
  41. package/dist/auth/xivauth.js +9 -0
  42. package/dist/auth/xivauth.js.map +1 -0
  43. package/dist/color/branded.d.ts +108 -0
  44. package/dist/color/branded.d.ts.map +1 -0
  45. package/dist/color/branded.js +94 -0
  46. package/dist/color/branded.js.map +1 -0
  47. package/dist/color/colorblind.d.ts +57 -0
  48. package/dist/color/colorblind.d.ts.map +1 -0
  49. package/dist/color/colorblind.js +9 -0
  50. package/dist/color/colorblind.js.map +1 -0
  51. package/dist/color/index.d.ts +12 -0
  52. package/dist/color/index.d.ts.map +1 -0
  53. package/dist/color/index.js +9 -0
  54. package/dist/color/index.js.map +1 -0
  55. package/dist/color/rgb.d.ts +32 -0
  56. package/dist/color/rgb.d.ts.map +1 -0
  57. package/dist/color/rgb.js +9 -0
  58. package/dist/color/rgb.js.map +1 -0
  59. package/dist/dye/database.d.ts +23 -0
  60. package/dist/dye/database.d.ts.map +1 -0
  61. package/dist/dye/database.js +9 -0
  62. package/dist/dye/database.js.map +1 -0
  63. package/dist/dye/dye.d.ts +66 -0
  64. package/dist/dye/dye.d.ts.map +1 -0
  65. package/dist/dye/dye.js +9 -0
  66. package/dist/dye/dye.js.map +1 -0
  67. package/dist/dye/index.d.ts +10 -0
  68. package/dist/dye/index.d.ts.map +1 -0
  69. package/dist/dye/index.js +9 -0
  70. package/dist/dye/index.js.map +1 -0
  71. package/dist/error/app-error.d.ts +52 -0
  72. package/dist/error/app-error.d.ts.map +1 -0
  73. package/dist/error/app-error.js +56 -0
  74. package/dist/error/app-error.js.map +1 -0
  75. package/dist/error/codes.d.ts +37 -0
  76. package/dist/error/codes.d.ts.map +1 -0
  77. package/dist/error/codes.js +40 -0
  78. package/dist/error/codes.js.map +1 -0
  79. package/dist/error/index.d.ts +11 -0
  80. package/dist/error/index.d.ts.map +1 -0
  81. package/dist/error/index.js +10 -0
  82. package/dist/error/index.js.map +1 -0
  83. package/dist/index.d.ts +29 -0
  84. package/dist/index.d.ts.map +1 -0
  85. package/dist/index.js +22 -0
  86. package/dist/index.js.map +1 -0
  87. package/dist/localization/index.d.ts +78 -0
  88. package/dist/localization/index.d.ts.map +1 -0
  89. package/dist/localization/index.js +9 -0
  90. package/dist/localization/index.js.map +1 -0
  91. package/dist/preset/community.d.ts +90 -0
  92. package/dist/preset/community.d.ts.map +1 -0
  93. package/dist/preset/community.js +9 -0
  94. package/dist/preset/community.js.map +1 -0
  95. package/dist/preset/core.d.ts +87 -0
  96. package/dist/preset/core.d.ts.map +1 -0
  97. package/dist/preset/core.js +9 -0
  98. package/dist/preset/core.js.map +1 -0
  99. package/dist/preset/index.d.ts +12 -0
  100. package/dist/preset/index.d.ts.map +1 -0
  101. package/dist/preset/index.js +9 -0
  102. package/dist/preset/index.js.map +1 -0
  103. package/dist/preset/request.d.ts +43 -0
  104. package/dist/preset/request.d.ts.map +1 -0
  105. package/dist/preset/request.js +9 -0
  106. package/dist/preset/request.js.map +1 -0
  107. package/dist/preset/response.d.ts +92 -0
  108. package/dist/preset/response.d.ts.map +1 -0
  109. package/dist/preset/response.js +9 -0
  110. package/dist/preset/response.js.map +1 -0
  111. package/dist/utility/index.d.ts +71 -0
  112. package/dist/utility/index.d.ts.map +1 -0
  113. package/dist/utility/index.js +20 -0
  114. package/dist/utility/index.js.map +1 -0
  115. package/package.json +73 -0
package/LICENSE ADDED
@@ -0,0 +1,37 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Flash Galatine
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ FINAL FANTASY XIV © SQUARE ENIX CO., LTD. All Rights Reserved.
26
+
27
+ This project is a fan-made tool and is not affiliated with, endorsed by, or
28
+ sponsored by Square Enix Co., Ltd. FINAL FANTASY is a registered trademark
29
+ of Square Enix Holdings Co., Ltd.
30
+
31
+ Game data, including dye names, colors, and acquisition methods, are property
32
+ of Square Enix Co., Ltd. and are used under fair use for educational and
33
+ informational purposes only.
34
+
35
+ Market board data is provided by Universalis (https://universalis.app/),
36
+ an independent third-party service not affiliated with Square Enix.
37
+
package/README.md ADDED
@@ -0,0 +1,272 @@
1
+ # @xivdyetools/types
2
+
3
+ Shared TypeScript type definitions for the xivdyetools ecosystem.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @xivdyetools/types
9
+ ```
10
+
11
+ ## Overview
12
+
13
+ This package consolidates type definitions from multiple xivdyetools projects:
14
+
15
+ - **xivdyetools-core** - Color types, dye types, error types
16
+ - **xivdyetools-web-app** - Extended dye types, UI-specific types
17
+ - **xivdyetools-discord-worker** - Preset types
18
+ - **xivdyetools-presets-api** - API response types, moderation types
19
+ - **xivdyetools-oauth** - Authentication types
20
+
21
+ ## Usage
22
+
23
+ ### Full Import
24
+
25
+ ```typescript
26
+ import {
27
+ Dye,
28
+ RGB,
29
+ HexColor,
30
+ createHexColor,
31
+ CommunityPreset,
32
+ AppError,
33
+ ErrorCode,
34
+ } from '@xivdyetools/types';
35
+ ```
36
+
37
+ ### Subpath Imports (Tree-Shaking)
38
+
39
+ For smaller bundle sizes, import from specific modules:
40
+
41
+ ```typescript
42
+ // Color types
43
+ import { RGB, HSV, HexColor, createHexColor, VisionType } from '@xivdyetools/types/color';
44
+
45
+ // Dye types
46
+ import { Dye, LocalizedDye, DyeWithDistance, DyeDatabase } from '@xivdyetools/types/dye';
47
+
48
+ // Preset types
49
+ import {
50
+ CommunityPreset,
51
+ PresetSubmission,
52
+ PresetFilters,
53
+ PresetListResponse,
54
+ } from '@xivdyetools/types/preset';
55
+
56
+ // Auth types
57
+ import { AuthResponse, JWTPayload, DiscordUser } from '@xivdyetools/types/auth';
58
+
59
+ // Error types
60
+ import { AppError, ErrorCode, ErrorSeverity } from '@xivdyetools/types/error';
61
+
62
+ // API types
63
+ import { APIResponse, CachedData, ModerationResult } from '@xivdyetools/types/api';
64
+
65
+ // Localization types
66
+ import { LocaleCode, LocaleData, TranslationKey } from '@xivdyetools/types/localization';
67
+ ```
68
+
69
+ ## Type Categories
70
+
71
+ ### Color Types
72
+
73
+ ```typescript
74
+ import { RGB, HSV, HexColor, createHexColor, DyeId, createDyeId } from '@xivdyetools/types';
75
+
76
+ // RGB and HSV interfaces
77
+ const red: RGB = { r: 255, g: 0, b: 0 };
78
+ const redHsv: HSV = { h: 0, s: 100, v: 100 };
79
+
80
+ // Branded types with validation
81
+ const hex: HexColor = createHexColor('#ff6b6b'); // Validates and normalizes to "#FF6B6B"
82
+ const dyeId: DyeId | null = createDyeId(1); // Returns null if invalid (not 1-200)
83
+
84
+ // Colorblindness types
85
+ import { VisionType, ColorblindMatrices } from '@xivdyetools/types';
86
+ const vision: VisionType = 'deuteranopia';
87
+ ```
88
+
89
+ ### Dye Types
90
+
91
+ ```typescript
92
+ import { Dye, LocalizedDye, DyeWithDistance, DyeDatabase } from '@xivdyetools/types';
93
+
94
+ // Full dye object
95
+ const dye: Dye = {
96
+ itemID: 5729,
97
+ id: 1,
98
+ name: 'Snow White',
99
+ hex: '#FFFFFF',
100
+ rgb: { r: 255, g: 255, b: 255 },
101
+ hsv: { h: 0, s: 0, v: 100 },
102
+ category: 'Neutral',
103
+ acquisition: 'NPC',
104
+ cost: 216,
105
+ isMetallic: false,
106
+ isPastel: false,
107
+ isDark: false,
108
+ isCosmic: false,
109
+ };
110
+
111
+ // Dye with color distance (for search results)
112
+ const match: DyeWithDistance = { ...dye, distance: 12.5 };
113
+ ```
114
+
115
+ ### Preset Types
116
+
117
+ ```typescript
118
+ import {
119
+ CommunityPreset,
120
+ PresetSubmission,
121
+ PresetFilters,
122
+ PresetCategory,
123
+ PresetStatus,
124
+ } from '@xivdyetools/types';
125
+
126
+ // Query presets
127
+ const filters: PresetFilters = {
128
+ category: 'jobs',
129
+ sort: 'popular',
130
+ page: 1,
131
+ limit: 20,
132
+ };
133
+
134
+ // Submit a new preset
135
+ const submission: PresetSubmission = {
136
+ name: 'Red Mage Vibes',
137
+ description: 'Crimson and black for the sophisticated caster',
138
+ category_id: 'jobs',
139
+ dyes: [12, 45, 78],
140
+ tags: ['rdm', 'red', 'elegant'],
141
+ };
142
+ ```
143
+
144
+ ### Auth Types
145
+
146
+ ```typescript
147
+ import { AuthResponse, JWTPayload, AuthProvider } from '@xivdyetools/types';
148
+
149
+ // Check auth response
150
+ function handleAuthResponse(response: AuthResponse) {
151
+ if (response.success && response.token) {
152
+ localStorage.setItem('token', response.token);
153
+ }
154
+ }
155
+
156
+ // JWT payload structure
157
+ const payload: JWTPayload = {
158
+ sub: 'user-uuid',
159
+ iat: Date.now() / 1000,
160
+ exp: Date.now() / 1000 + 3600,
161
+ iss: 'https://oauth.xivdyetools.com',
162
+ username: 'User',
163
+ global_name: 'Display Name',
164
+ avatar: null,
165
+ auth_provider: 'discord',
166
+ discord_id: '123456789',
167
+ };
168
+ ```
169
+
170
+ ### Error Types
171
+
172
+ ```typescript
173
+ import { AppError, ErrorCode } from '@xivdyetools/types';
174
+
175
+ // Throw typed errors
176
+ throw new AppError(ErrorCode.DYE_NOT_FOUND, 'Dye with ID 999 not found');
177
+
178
+ // With severity
179
+ throw new AppError(ErrorCode.DATABASE_LOAD_FAILED, 'Failed to load dyes', 'critical');
180
+
181
+ // Serialize for API responses
182
+ catch (error) {
183
+ if (error instanceof AppError) {
184
+ return { error: error.toJSON() };
185
+ }
186
+ }
187
+ ```
188
+
189
+ ### Utility Types
190
+
191
+ ```typescript
192
+ import { Result, isOk, isErr, Nullable } from '@xivdyetools/types';
193
+
194
+ // Result type for operations that might fail
195
+ function findDye(id: number): Result<Dye> {
196
+ const dye = database.find(d => d.id === id);
197
+ if (dye) {
198
+ return { ok: true, value: dye };
199
+ }
200
+ return { ok: false, error: new AppError(ErrorCode.DYE_NOT_FOUND, `Dye ${id} not found`) };
201
+ }
202
+
203
+ // Type guards
204
+ const result = findDye(1);
205
+ if (isOk(result)) {
206
+ console.log(result.value.name); // TypeScript knows this is Dye
207
+ } else {
208
+ console.error(result.error.message); // TypeScript knows this is AppError
209
+ }
210
+ ```
211
+
212
+ ## Migration Guide
213
+
214
+ ### From xivdyetools-core
215
+
216
+ ```typescript
217
+ // Before
218
+ import { Dye, RGB, HexColor, AppError, ErrorCode } from 'xivdyetools-core';
219
+
220
+ // After
221
+ import { Dye, RGB, HexColor, AppError, ErrorCode } from '@xivdyetools/types';
222
+ ```
223
+
224
+ ### From xivdyetools-web-app/src/shared/types.ts
225
+
226
+ ```typescript
227
+ // Before
228
+ import { Dye, DyeWithDistance, AppError } from '../shared/types';
229
+
230
+ // After
231
+ import { Dye, DyeWithDistance, AppError } from '@xivdyetools/types';
232
+ ```
233
+
234
+ ### From xivdyetools-presets-api/src/types.ts
235
+
236
+ ```typescript
237
+ // Before
238
+ import { CommunityPreset, PresetFilters, ModerationResult } from './types';
239
+
240
+ // After
241
+ import { CommunityPreset, PresetFilters, ModerationResult } from '@xivdyetools/types';
242
+ ```
243
+
244
+ ## API Reference
245
+
246
+ ### Modules
247
+
248
+ | Module | Description |
249
+ |--------|-------------|
250
+ | `@xivdyetools/types` | All types (barrel export) |
251
+ | `@xivdyetools/types/color` | RGB, HSV, HexColor, branded types |
252
+ | `@xivdyetools/types/dye` | Dye, LocalizedDye, DyeWithDistance |
253
+ | `@xivdyetools/types/preset` | Preset, community, filters, responses |
254
+ | `@xivdyetools/types/auth` | OAuth, JWT, Discord, XIVAuth |
255
+ | `@xivdyetools/types/api` | APIResponse, CachedData, moderation |
256
+ | `@xivdyetools/types/error` | AppError, ErrorCode enum |
257
+ | `@xivdyetools/types/localization` | LocaleCode, LocaleData |
258
+
259
+ ### Helper Functions
260
+
261
+ | Function | Description |
262
+ |----------|-------------|
263
+ | `createHexColor(hex)` | Validate and normalize hex color |
264
+ | `createDyeId(id)` | Validate dye ID (1-200) |
265
+ | `createHue(hue)` | Normalize hue to 0-360 |
266
+ | `createSaturation(sat)` | Clamp saturation to 0-100 |
267
+ | `isOk(result)` | Type guard for successful Result |
268
+ | `isErr(result)` | Type guard for error Result |
269
+
270
+ ## License
271
+
272
+ MIT
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @xivdyetools/types - API Module
3
+ *
4
+ * API response types, caching, and moderation.
5
+ *
6
+ * @module api
7
+ */
8
+ export type { APIResponse, CachedData } from './response.js';
9
+ export type { ModerationResult, ModerationLogEntry, ModerationStats } from './moderation.js';
10
+ export type { PriceData, RateLimitResult } from './price.js';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @xivdyetools/types - API Module
3
+ *
4
+ * API response types, caching, and moderation.
5
+ *
6
+ * @module api
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @xivdyetools/types - Moderation Types
3
+ *
4
+ * Content moderation types for preset submissions.
5
+ *
6
+ * @module api/moderation
7
+ */
8
+ /**
9
+ * Result of content moderation check
10
+ */
11
+ export interface ModerationResult {
12
+ /** True if content passed moderation */
13
+ passed: boolean;
14
+ /** Which field was flagged (if any) */
15
+ flaggedField?: 'name' | 'description' | 'content';
16
+ /** Reason for flagging */
17
+ flaggedReason?: string;
18
+ /** Which moderation method was used */
19
+ method: 'local' | 'perspective' | 'all';
20
+ /** Toxicity scores by category (if using Perspective API) */
21
+ scores?: Record<string, number>;
22
+ }
23
+ /**
24
+ * Moderation action log entry
25
+ */
26
+ export interface ModerationLogEntry {
27
+ /** Log entry ID */
28
+ id: string;
29
+ /** Preset that was moderated */
30
+ preset_id: string;
31
+ /** Discord ID of moderator who took action */
32
+ moderator_discord_id: string;
33
+ /** Action taken */
34
+ action: 'approve' | 'reject' | 'flag' | 'unflag' | 'revert';
35
+ /** Reason for action (optional) */
36
+ reason: string | null;
37
+ /** When action was taken */
38
+ created_at: string;
39
+ }
40
+ /**
41
+ * Moderation statistics
42
+ */
43
+ export interface ModerationStats {
44
+ /** Total presets pending review */
45
+ pending_count: number;
46
+ /** Total approved presets */
47
+ approved_count: number;
48
+ /** Total rejected presets */
49
+ rejected_count: number;
50
+ /** Total flagged presets */
51
+ flagged_count: number;
52
+ }
53
+ //# sourceMappingURL=moderation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moderation.d.ts","sourceRoot":"","sources":["../../src/api/moderation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,wCAAwC;IACxC,MAAM,EAAE,OAAO,CAAC;IAEhB,uCAAuC;IACvC,YAAY,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAAC;IAElD,0BAA0B;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,uCAAuC;IACvC,MAAM,EAAE,OAAO,GAAG,aAAa,GAAG,KAAK,CAAC;IAExC,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,mBAAmB;IACnB,EAAE,EAAE,MAAM,CAAC;IAEX,gCAAgC;IAChC,SAAS,EAAE,MAAM,CAAC;IAElB,8CAA8C;IAC9C,oBAAoB,EAAE,MAAM,CAAC;IAE7B,mBAAmB;IACnB,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAE5D,mCAAmC;IACnC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtB,4BAA4B;IAC5B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,mCAAmC;IACnC,aAAa,EAAE,MAAM,CAAC;IAEtB,6BAA6B;IAC7B,cAAc,EAAE,MAAM,CAAC;IAEvB,6BAA6B;IAC7B,cAAc,EAAE,MAAM,CAAC;IAEvB,4BAA4B;IAC5B,aAAa,EAAE,MAAM,CAAC;CACvB"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @xivdyetools/types - Moderation Types
3
+ *
4
+ * Content moderation types for preset submissions.
5
+ *
6
+ * @module api/moderation
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=moderation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moderation.js","sourceRoot":"","sources":["../../src/api/moderation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @xivdyetools/types - Price Types
3
+ *
4
+ * Market price data types (Universalis API).
5
+ *
6
+ * @module api/price
7
+ */
8
+ /**
9
+ * Universalis API response for item prices
10
+ *
11
+ * Contains market board pricing information for a dye item.
12
+ */
13
+ export interface PriceData {
14
+ /** FFXIV item ID */
15
+ itemID: number;
16
+ /** Average price from recent sales */
17
+ currentAverage: number;
18
+ /** Lowest current listing price */
19
+ currentMinPrice: number;
20
+ /** Highest current listing price */
21
+ currentMaxPrice: number;
22
+ /** Last update timestamp (ms since epoch) */
23
+ lastUpdate: number;
24
+ }
25
+ /**
26
+ * Rate limit result for API requests
27
+ */
28
+ export interface RateLimitResult {
29
+ /** True if request is allowed */
30
+ allowed: boolean;
31
+ /** Remaining requests in current window */
32
+ remaining: number;
33
+ /** When the rate limit window resets */
34
+ resetAt: Date;
35
+ /** True if rate limit check failed due to KV error */
36
+ kvError?: boolean;
37
+ }
38
+ //# sourceMappingURL=price.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../../src/api/price.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,oBAAoB;IACpB,MAAM,EAAE,MAAM,CAAC;IAEf,sCAAsC;IACtC,cAAc,EAAE,MAAM,CAAC;IAEvB,mCAAmC;IACnC,eAAe,EAAE,MAAM,CAAC;IAExB,oCAAoC;IACpC,eAAe,EAAE,MAAM,CAAC;IAExB,6CAA6C;IAC7C,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,iCAAiC;IACjC,OAAO,EAAE,OAAO,CAAC;IAEjB,2CAA2C;IAC3C,SAAS,EAAE,MAAM,CAAC;IAElB,wCAAwC;IACxC,OAAO,EAAE,IAAI,CAAC;IAEd,sDAAsD;IACtD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @xivdyetools/types - Price Types
3
+ *
4
+ * Market price data types (Universalis API).
5
+ *
6
+ * @module api/price
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=price.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"price.js","sourceRoot":"","sources":["../../src/api/price.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @xivdyetools/types - API Response Types
3
+ *
4
+ * Generic API response wrappers and caching types.
5
+ *
6
+ * @module api/response
7
+ */
8
+ /**
9
+ * Generic API response wrapper
10
+ *
11
+ * Provides a consistent structure for all API responses.
12
+ */
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;
20
+ /** Response timestamp (ms since epoch) */
21
+ timestamp: number;
22
+ }
23
+ /**
24
+ * Cached data wrapper with TTL and integrity checking
25
+ *
26
+ * Used for storing data with expiration and optional
27
+ * integrity verification.
28
+ */
29
+ export interface CachedData<T> {
30
+ /** The cached data */
31
+ data: T;
32
+ /** When data was cached (ms since epoch) */
33
+ timestamp: number;
34
+ /** Time-to-live in milliseconds */
35
+ ttl: number;
36
+ /** Cache version for invalidation */
37
+ version?: string;
38
+ /** Optional checksum for corruption detection */
39
+ checksum?: string;
40
+ }
41
+ //# sourceMappingURL=response.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @xivdyetools/types - API Response Types
3
+ *
4
+ * Generic API response wrappers and caching types.
5
+ *
6
+ * @module api/response
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.js","sourceRoot":"","sources":["../../src/api/response.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * @xivdyetools/types - Discord OAuth Types
3
+ *
4
+ * Discord OAuth and user types.
5
+ *
6
+ * @module auth/discord
7
+ */
8
+ /**
9
+ * Discord OAuth token response
10
+ */
11
+ export interface DiscordTokenResponse {
12
+ /** OAuth access token */
13
+ access_token: string;
14
+ /** Token type (usually "Bearer") */
15
+ token_type: string;
16
+ /** Token lifetime in seconds */
17
+ expires_in: number;
18
+ /** Refresh token for obtaining new access tokens */
19
+ refresh_token: string;
20
+ /** Granted scopes (space-separated) */
21
+ scope: string;
22
+ }
23
+ /**
24
+ * Discord user object from /users/@me
25
+ */
26
+ export interface DiscordUser {
27
+ /** Discord snowflake ID */
28
+ id: string;
29
+ /** Username (not nickname) */
30
+ username: string;
31
+ /** Legacy discriminator (usually "0" now) */
32
+ discriminator: string;
33
+ /** Display name (new Discord usernames) */
34
+ global_name: string | null;
35
+ /** Avatar hash */
36
+ avatar: string | null;
37
+ /** True if user is a bot */
38
+ bot?: boolean;
39
+ /** True if user is a system user */
40
+ system?: boolean;
41
+ /** True if user has MFA enabled */
42
+ mfa_enabled?: boolean;
43
+ /** Banner hash */
44
+ banner?: string | null;
45
+ /** Banner color as integer */
46
+ accent_color?: number | null;
47
+ /** User's locale setting */
48
+ locale?: string;
49
+ /** True if email is verified */
50
+ verified?: boolean;
51
+ /** User's email (requires email scope) */
52
+ email?: string | null;
53
+ /** User flags bitmap */
54
+ flags?: number;
55
+ /** Nitro subscription type */
56
+ premium_type?: number;
57
+ /** Public flags bitmap */
58
+ public_flags?: number;
59
+ }
60
+ //# sourceMappingURL=discord.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discord.d.ts","sourceRoot":"","sources":["../../src/auth/discord.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,yBAAyB;IACzB,YAAY,EAAE,MAAM,CAAC;IAErB,oCAAoC;IACpC,UAAU,EAAE,MAAM,CAAC;IAEnB,gCAAgC;IAChC,UAAU,EAAE,MAAM,CAAC;IAEnB,oDAAoD;IACpD,aAAa,EAAE,MAAM,CAAC;IAEtB,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,2BAA2B;IAC3B,EAAE,EAAE,MAAM,CAAC;IAEX,8BAA8B;IAC9B,QAAQ,EAAE,MAAM,CAAC;IAEjB,6CAA6C;IAC7C,aAAa,EAAE,MAAM,CAAC;IAEtB,2CAA2C;IAC3C,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAE3B,kBAAkB;IAClB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtB,4BAA4B;IAC5B,GAAG,CAAC,EAAE,OAAO,CAAC;IAEd,oCAAoC;IACpC,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,mCAAmC;IACnC,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,kBAAkB;IAClB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvB,8BAA8B;IAC9B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,gCAAgC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtB,wBAAwB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,8BAA8B;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,0BAA0B;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @xivdyetools/types - Discord OAuth Types
3
+ *
4
+ * Discord OAuth and user types.
5
+ *
6
+ * @module auth/discord
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=discord.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discord.js","sourceRoot":"","sources":["../../src/auth/discord.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @xivdyetools/types - Auth Module
3
+ *
4
+ * Authentication type definitions for OAuth flows and JWT.
5
+ *
6
+ * @module auth
7
+ */
8
+ export type { AuthProvider, AuthSource, AuthContext } from './provider.js';
9
+ export type { PrimaryCharacter, JWTPayload, OAuthState } from './jwt.js';
10
+ export type { DiscordTokenResponse, DiscordUser } from './discord.js';
11
+ export type { XIVAuthTokenResponse, XIVAuthCharacter, XIVAuthCharacterRegistration, XIVAuthSocialIdentity, XIVAuthUser, } from './xivauth.js';
12
+ export type { AuthUser, AuthResponse, RefreshResponse, UserInfoResponse, } from './response.js';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @xivdyetools/types - Auth Module
3
+ *
4
+ * Authentication type definitions for OAuth flows and JWT.
5
+ *
6
+ * @module auth
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}