@nehorai/credits 1.0.2 → 1.3.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 (134) hide show
  1. package/dist/adapters/index.cjs +463 -0
  2. package/dist/adapters/index.cjs.map +1 -0
  3. package/dist/adapters/index.d.cts +66 -0
  4. package/dist/adapters/index.d.ts +66 -3
  5. package/dist/adapters/index.js +435 -1
  6. package/dist/adapters/index.js.map +1 -1
  7. package/dist/auth/index.cjs +96 -0
  8. package/dist/auth/index.cjs.map +1 -0
  9. package/dist/auth/{api-key.d.ts → index.d.cts} +9 -6
  10. package/dist/auth/index.d.ts +37 -5
  11. package/dist/auth/index.js +65 -7
  12. package/dist/auth/index.js.map +1 -1
  13. package/dist/core/index.cjs +522 -0
  14. package/dist/core/index.cjs.map +1 -0
  15. package/dist/core/index.d.cts +119 -0
  16. package/dist/core/index.d.ts +115 -25
  17. package/dist/core/index.js +475 -27
  18. package/dist/core/index.js.map +1 -1
  19. package/dist/{core/deferred.d.ts → deferred-C7rrRfkm.d.cts} +7 -6
  20. package/dist/{core/deferred.js → deferred-C7rrRfkm.d.ts} +23 -29
  21. package/dist/index.cjs +2506 -0
  22. package/dist/index.cjs.map +1 -0
  23. package/dist/index.d.cts +437 -0
  24. package/dist/index.d.ts +429 -49
  25. package/dist/index.js +2399 -62
  26. package/dist/index.js.map +1 -1
  27. package/dist/repository/index.cjs +816 -0
  28. package/dist/repository/index.cjs.map +1 -0
  29. package/dist/repository/{memory/index.d.ts → index.d.cts} +35 -5
  30. package/dist/repository/index.d.ts +97 -7
  31. package/dist/repository/index.js +783 -10
  32. package/dist/repository/index.js.map +1 -1
  33. package/dist/sdk/index.cjs +608 -0
  34. package/dist/sdk/index.cjs.map +1 -0
  35. package/dist/sdk/index.d.cts +495 -0
  36. package/dist/sdk/index.d.ts +491 -9
  37. package/dist/sdk/index.js +568 -12
  38. package/dist/sdk/index.js.map +1 -1
  39. package/dist/service/index.cjs +670 -0
  40. package/dist/service/index.cjs.map +1 -0
  41. package/dist/service/{credits-service.d.ts → index.d.cts} +9 -7
  42. package/dist/service/index.d.ts +141 -3
  43. package/dist/service/index.js +641 -1
  44. package/dist/service/index.js.map +1 -1
  45. package/dist/{core/types.d.ts → types-BBxIWHK2.d.cts} +25 -35
  46. package/dist/types-BBxIWHK2.d.ts +277 -0
  47. package/dist/types-D1vdeBcA.d.cts +305 -0
  48. package/dist/{auth/types.d.ts → types-OZU3I5OM.d.cts} +5 -4
  49. package/dist/types-OZU3I5OM.d.ts +32 -0
  50. package/dist/{repository/types.d.ts → types-aJsyv8df.d.ts} +35 -13
  51. package/package.json +14 -13
  52. package/dist/adapters/generic.d.ts +0 -18
  53. package/dist/adapters/generic.d.ts.map +0 -1
  54. package/dist/adapters/generic.js +0 -147
  55. package/dist/adapters/generic.js.map +0 -1
  56. package/dist/adapters/index.d.ts.map +0 -1
  57. package/dist/adapters/types.d.ts +0 -45
  58. package/dist/adapters/types.d.ts.map +0 -1
  59. package/dist/adapters/types.js +0 -8
  60. package/dist/adapters/types.js.map +0 -1
  61. package/dist/auth/api-key.d.ts.map +0 -1
  62. package/dist/auth/api-key.js +0 -94
  63. package/dist/auth/api-key.js.map +0 -1
  64. package/dist/auth/index.d.ts.map +0 -1
  65. package/dist/auth/types.d.ts.map +0 -1
  66. package/dist/auth/types.js +0 -2
  67. package/dist/auth/types.js.map +0 -1
  68. package/dist/config/costs.d.ts +0 -61
  69. package/dist/config/costs.d.ts.map +0 -1
  70. package/dist/config/costs.js +0 -86
  71. package/dist/config/costs.js.map +0 -1
  72. package/dist/config/index.d.ts +0 -165
  73. package/dist/config/index.d.ts.map +0 -1
  74. package/dist/config/index.js +0 -286
  75. package/dist/config/index.js.map +0 -1
  76. package/dist/core/deferred.d.ts.map +0 -1
  77. package/dist/core/deferred.js.map +0 -1
  78. package/dist/core/errors.d.ts +0 -78
  79. package/dist/core/errors.d.ts.map +0 -1
  80. package/dist/core/errors.js +0 -110
  81. package/dist/core/errors.js.map +0 -1
  82. package/dist/core/index.d.ts.map +0 -1
  83. package/dist/core/operations.d.ts +0 -36
  84. package/dist/core/operations.d.ts.map +0 -1
  85. package/dist/core/operations.js +0 -87
  86. package/dist/core/operations.js.map +0 -1
  87. package/dist/core/types.d.ts.map +0 -1
  88. package/dist/core/types.js +0 -93
  89. package/dist/core/types.js.map +0 -1
  90. package/dist/index.d.ts.map +0 -1
  91. package/dist/notifications/index.d.ts +0 -76
  92. package/dist/notifications/index.d.ts.map +0 -1
  93. package/dist/notifications/index.js +0 -182
  94. package/dist/notifications/index.js.map +0 -1
  95. package/dist/repository/index.d.ts.map +0 -1
  96. package/dist/repository/memory/index.d.ts.map +0 -1
  97. package/dist/repository/memory/index.js +0 -518
  98. package/dist/repository/memory/index.js.map +0 -1
  99. package/dist/repository/types.d.ts.map +0 -1
  100. package/dist/repository/types.js +0 -39
  101. package/dist/repository/types.js.map +0 -1
  102. package/dist/repository/utils.d.ts +0 -22
  103. package/dist/repository/utils.d.ts.map +0 -1
  104. package/dist/repository/utils.js +0 -40
  105. package/dist/repository/utils.js.map +0 -1
  106. package/dist/sdk/admin-client.d.ts +0 -146
  107. package/dist/sdk/admin-client.d.ts.map +0 -1
  108. package/dist/sdk/admin-client.js +0 -196
  109. package/dist/sdk/admin-client.js.map +0 -1
  110. package/dist/sdk/client.d.ts +0 -144
  111. package/dist/sdk/client.d.ts.map +0 -1
  112. package/dist/sdk/client.js +0 -247
  113. package/dist/sdk/client.js.map +0 -1
  114. package/dist/sdk/errors.d.ts +0 -91
  115. package/dist/sdk/errors.d.ts.map +0 -1
  116. package/dist/sdk/errors.js +0 -185
  117. package/dist/sdk/errors.js.map +0 -1
  118. package/dist/sdk/index.d.ts.map +0 -1
  119. package/dist/sdk/types.d.ts +0 -110
  120. package/dist/sdk/types.d.ts.map +0 -1
  121. package/dist/sdk/types.js +0 -20
  122. package/dist/sdk/types.js.map +0 -1
  123. package/dist/service/credits-service.d.ts.map +0 -1
  124. package/dist/service/credits-service.js +0 -372
  125. package/dist/service/credits-service.js.map +0 -1
  126. package/dist/service/index.d.ts.map +0 -1
  127. package/dist/utils/error-utils.d.ts +0 -48
  128. package/dist/utils/error-utils.d.ts.map +0 -1
  129. package/dist/utils/error-utils.js +0 -57
  130. package/dist/utils/error-utils.js.map +0 -1
  131. package/dist/utils/index.d.ts +0 -54
  132. package/dist/utils/index.d.ts.map +0 -1
  133. package/dist/utils/index.js +0 -72
  134. package/dist/utils/index.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAYrE;;GAEG;AACH,QAAA,MAAM,wBAAwB;IAC5B;;;;OAIG;;IAMH;;OAEG;;;;;;;;;;;;;;;;;IAMH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AA6E1E;;;;;;GAMG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAuD/D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,kBAAkB,CAiC5F;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,kBAAkB,CAE9C;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,EAAE,CAEjD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAQpE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,gBAAgB,GAAG,UAAU,CAEtE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,CAGpE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,kBAAkB,CAAC,UAAU,CAAC,GAAG,OAAO,CAEvF;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAElC"}
@@ -1,286 +0,0 @@
1
- import { z } from "zod";
2
- /**
3
- * Schema for tier configuration
4
- */
5
- const tierConfigSchema = z.object({
6
- tier: z.enum(["free", "basic", "premium", "unlimited"]),
7
- monthlyCredits: z.number().min(0),
8
- priceUsd: z.number().min(0),
9
- features: z.array(z.string()),
10
- });
11
- /**
12
- * Schema for credit system configuration
13
- */
14
- const creditSystemConfigSchema = z.object({
15
- /**
16
- * Operation costs in credits
17
- * Keys are operation type names (any non-empty string)
18
- * Values are positive numbers representing credit cost
19
- */
20
- operationCosts: z.record(z.string().min(1), z.number().positive()),
21
- /**
22
- * Tier configurations
23
- */
24
- tierConfigs: z.record(z.enum(["free", "basic", "premium", "unlimited"]), tierConfigSchema),
25
- /**
26
- * Reservation expiry time in milliseconds
27
- */
28
- reservationExpiryMs: z.number().positive().default(5 * 60 * 1000),
29
- /**
30
- * Default credits for new users (free tier)
31
- */
32
- defaultFreeCredits: z.number().positive().default(25),
33
- /**
34
- * Grace period in days after subscription expires before downgrade
35
- */
36
- subscriptionGracePeriodDays: z.number().min(0).default(3),
37
- /**
38
- * Low balance notification threshold
39
- */
40
- lowBalanceThreshold: z.number().min(0).default(10),
41
- /**
42
- * Cooldown in hours between low balance notifications
43
- */
44
- lowBalanceNotificationCooldownHours: z.number().positive().default(24),
45
- /**
46
- * Feature flags for optional features
47
- */
48
- features: z.object({
49
- journalEntries: z.boolean().default(true),
50
- notifications: z.boolean().default(true),
51
- subscriptionExpiry: z.boolean().default(true),
52
- usageHistory: z.boolean().default(true),
53
- }).default({
54
- journalEntries: true,
55
- notifications: true,
56
- subscriptionExpiry: true,
57
- usageHistory: true,
58
- }),
59
- });
60
- /**
61
- * Default configuration
62
- */
63
- const DEFAULT_CONFIG = {
64
- operationCosts: {
65
- story_generation: 5,
66
- conversation: 2,
67
- image_generation: 10,
68
- template_generation: 10,
69
- },
70
- tierConfigs: {
71
- free: {
72
- tier: "free",
73
- monthlyCredits: 25,
74
- priceUsd: 0,
75
- features: [
76
- "25 credits per month",
77
- "Basic story generation",
78
- "Standard image quality",
79
- ],
80
- },
81
- basic: {
82
- tier: "basic",
83
- monthlyCredits: 200,
84
- priceUsd: 9.99,
85
- features: [
86
- "200 credits per month",
87
- "All story features",
88
- "High quality images",
89
- "Priority support",
90
- ],
91
- },
92
- premium: {
93
- tier: "premium",
94
- monthlyCredits: 500,
95
- priceUsd: 19.99,
96
- features: [
97
- "500 credits per month",
98
- "All features",
99
- "Highest quality images",
100
- "Early access to new features",
101
- "Priority support",
102
- ],
103
- },
104
- unlimited: {
105
- tier: "unlimited",
106
- monthlyCredits: 0, // 0 = unlimited
107
- priceUsd: 49.99,
108
- features: [
109
- "Unlimited credits",
110
- "All features",
111
- "Highest quality images",
112
- "Early access to new features",
113
- "Dedicated support",
114
- ],
115
- },
116
- },
117
- reservationExpiryMs: 5 * 60 * 1000, // 5 minutes
118
- defaultFreeCredits: 25,
119
- subscriptionGracePeriodDays: 3,
120
- lowBalanceThreshold: 10,
121
- lowBalanceNotificationCooldownHours: 24,
122
- features: {
123
- journalEntries: true,
124
- notifications: true,
125
- subscriptionExpiry: true,
126
- usageHistory: true,
127
- },
128
- };
129
- /**
130
- * Current configuration (can be overridden)
131
- */
132
- let currentConfig = DEFAULT_CONFIG;
133
- /**
134
- * Load configuration from environment variables
135
- * Can be extended to load from other sources (file, remote config, etc.)
136
- *
137
- * Operation costs are loaded from CREDITS_OPERATION_COSTS as JSON:
138
- * CREDITS_OPERATION_COSTS={"story_generation":5,"image_generation":10}
139
- */
140
- export function loadConfigFromEnv() {
141
- const envConfig = {};
142
- // Load operation costs from env as JSON
143
- const operationCostsEnv = process.env.CREDITS_OPERATION_COSTS;
144
- if (operationCostsEnv) {
145
- try {
146
- const parsed = JSON.parse(operationCostsEnv);
147
- if (typeof parsed === "object" && parsed !== null) {
148
- envConfig.operationCosts = {
149
- ...DEFAULT_CONFIG.operationCosts,
150
- ...parsed,
151
- };
152
- }
153
- }
154
- catch {
155
- console.warn("[Credits Config] Failed to parse CREDITS_OPERATION_COSTS env var as JSON");
156
- }
157
- }
158
- // Load other settings from env
159
- const reservationExpiry = process.env.CREDITS_RESERVATION_EXPIRY_MS;
160
- if (reservationExpiry) {
161
- envConfig.reservationExpiryMs = parseInt(reservationExpiry, 10);
162
- }
163
- const defaultCredits = process.env.CREDITS_DEFAULT_FREE;
164
- if (defaultCredits) {
165
- envConfig.defaultFreeCredits = parseInt(defaultCredits, 10);
166
- }
167
- const gracePeriod = process.env.CREDITS_GRACE_PERIOD_DAYS;
168
- if (gracePeriod) {
169
- envConfig.subscriptionGracePeriodDays = parseInt(gracePeriod, 10);
170
- }
171
- const lowBalanceThreshold = process.env.CREDITS_LOW_BALANCE_THRESHOLD;
172
- if (lowBalanceThreshold) {
173
- envConfig.lowBalanceThreshold = parseInt(lowBalanceThreshold, 10);
174
- }
175
- // Load feature flags
176
- const featuresEnv = process.env.CREDITS_FEATURES;
177
- if (featuresEnv) {
178
- try {
179
- const features = JSON.parse(featuresEnv);
180
- envConfig.features = {
181
- ...DEFAULT_CONFIG.features,
182
- ...features,
183
- };
184
- }
185
- catch {
186
- console.warn("[Credits Config] Failed to parse CREDITS_FEATURES env var");
187
- }
188
- }
189
- return envConfig;
190
- }
191
- /**
192
- * Initialize configuration
193
- * Merges default config with environment overrides
194
- */
195
- export function initializeConfig(overrides) {
196
- const envConfig = loadConfigFromEnv();
197
- const mergedConfig = {
198
- ...DEFAULT_CONFIG,
199
- ...envConfig,
200
- ...overrides,
201
- operationCosts: {
202
- ...DEFAULT_CONFIG.operationCosts,
203
- ...envConfig.operationCosts,
204
- ...overrides?.operationCosts,
205
- },
206
- tierConfigs: {
207
- ...DEFAULT_CONFIG.tierConfigs,
208
- ...envConfig.tierConfigs,
209
- ...overrides?.tierConfigs,
210
- },
211
- features: {
212
- ...DEFAULT_CONFIG.features,
213
- ...envConfig.features,
214
- ...overrides?.features,
215
- },
216
- };
217
- // Validate configuration
218
- const result = creditSystemConfigSchema.safeParse(mergedConfig);
219
- if (!result.success) {
220
- console.error("[Credits Config] Invalid configuration:", result.error.issues);
221
- throw new Error("Invalid credit system configuration");
222
- }
223
- currentConfig = result.data;
224
- return currentConfig;
225
- }
226
- /**
227
- * Get the current configuration
228
- */
229
- export function getConfig() {
230
- return currentConfig;
231
- }
232
- /**
233
- * Get all valid operation types from configuration
234
- * Returns the keys of the operationCosts object
235
- */
236
- export function getValidOperationTypes() {
237
- return Object.keys(currentConfig.operationCosts);
238
- }
239
- /**
240
- * Check if an operation type is valid (configured in the system)
241
- * @param type - The operation type to check
242
- * @returns true if the operation type is configured
243
- */
244
- export function isValidOperationType(type) {
245
- return type in currentConfig.operationCosts;
246
- }
247
- /**
248
- * Get operation cost from configuration
249
- * @throws Error if the operation type is not configured
250
- */
251
- export function getConfigOperationCost(operationType) {
252
- const cost = currentConfig.operationCosts[operationType];
253
- if (cost === undefined) {
254
- throw new Error(`Unknown operation type: ${operationType}. Valid types: ${getValidOperationTypes().join(", ")}`);
255
- }
256
- return cost;
257
- }
258
- /**
259
- * Get tier configuration from configuration
260
- */
261
- export function getConfigTierConfig(tier) {
262
- return currentConfig.tierConfigs[tier];
263
- }
264
- /**
265
- * Get monthly limit for a tier from configuration
266
- * Returns Infinity for unlimited tier
267
- */
268
- export function getConfigMonthlyLimit(tier) {
269
- const config = currentConfig.tierConfigs[tier];
270
- return config.monthlyCredits === 0 ? Infinity : config.monthlyCredits;
271
- }
272
- /**
273
- * Check if a feature is enabled
274
- */
275
- export function isFeatureEnabled(feature) {
276
- return currentConfig.features[feature];
277
- }
278
- /**
279
- * Reset configuration to defaults (for testing)
280
- */
281
- export function resetConfig() {
282
- currentConfig = DEFAULT_CONFIG;
283
- }
284
- // Initialize configuration on module load
285
- initializeConfig();
286
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;GAEG;AACH,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;IACvD,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACjC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAC9B,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC;;;;OAIG;IACH,cAAc,EAAE,CAAC,CAAC,MAAM,CACtB,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EACjB,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CACtB;IAED;;OAEG;IACH,WAAW,EAAE,CAAC,CAAC,MAAM,CACnB,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,EACjD,gBAAgB,CACjB;IAED;;OAEG;IACH,mBAAmB,EAAE,CAAC,CAAC,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,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"deferred.d.ts","sourceRoot":"","sources":["../../src/core/deferred.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACtC;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,gBAU7B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAE,gBAMjC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,GAC1C,gBAAgB,CAIlB;AAED;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,gBAI1B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"deferred.js","sourceRoot":"","sources":["../../src/core/deferred.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAoBH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAqB;IAC/C,KAAK,CAAC,EAAuB;QAC3B,sDAAsD;QACtD,MAAM,SAAS,GAAG,OAAO,YAAY,KAAK,WAAW,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC;QAClF,SAAS,CAAC,GAAG,EAAE;YACb,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;gBACnB,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;YACzD,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAqB;IACnD,KAAK,CAAC,EAAuB;QAC3B,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACnB,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,sBAAsB,CACpC,QAA2C;IAE3C,OAAO;QACL,KAAK,EAAE,QAAQ;KAChB,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAqB;IAC5C,KAAK,CAAC,GAAwB;QAC5B,2BAA2B;IAC7B,CAAC;CACF,CAAC"}
@@ -1,78 +0,0 @@
1
- /**
2
- * Credit system error classes - framework agnostic
3
- *
4
- * Provides typed error handling for credit operations.
5
- * These errors can be used across different environments.
6
- */
7
- /**
8
- * Error codes for credit operations
9
- */
10
- export declare const CreditErrorCode: {
11
- readonly INSUFFICIENT_CREDITS: "INSUFFICIENT_CREDITS";
12
- readonly RESERVATION_NOT_FOUND: "RESERVATION_NOT_FOUND";
13
- readonly RESERVATION_EXPIRED: "RESERVATION_EXPIRED";
14
- readonly RESERVATION_ALREADY_PROCESSED: "RESERVATION_ALREADY_PROCESSED";
15
- readonly USER_NOT_FOUND: "USER_NOT_FOUND";
16
- readonly INVALID_OPERATION_TYPE: "INVALID_OPERATION_TYPE";
17
- readonly CONFIGURATION_ERROR: "CONFIGURATION_ERROR";
18
- readonly DATABASE_ERROR: "DATABASE_ERROR";
19
- };
20
- export type CreditErrorCodeType = (typeof CreditErrorCode)[keyof typeof CreditErrorCode];
21
- /**
22
- * Custom error class for credit operations
23
- *
24
- * Provides structured error information including:
25
- * - Error code for programmatic handling
26
- * - Human-readable message
27
- * - Optional details for debugging
28
- */
29
- export declare class CreditError extends Error {
30
- readonly code: CreditErrorCodeType;
31
- readonly details?: Record<string, unknown>;
32
- constructor(message: string, code: CreditErrorCodeType, details?: Record<string, unknown>);
33
- /**
34
- * Convert to JSON-serializable object
35
- */
36
- toJSON(): {
37
- name: string;
38
- code: string;
39
- message: string;
40
- details?: Record<string, unknown>;
41
- };
42
- }
43
- /**
44
- * Type guard to check if an error is a CreditError
45
- */
46
- export declare function isCreditError(error: unknown): error is CreditError;
47
- /**
48
- * Check if an error represents insufficient credits
49
- *
50
- * Works with both CreditError and regular Error instances.
51
- * Useful for handling errors from different sources.
52
- */
53
- export declare function isInsufficientCreditsError(error: unknown): boolean;
54
- /**
55
- * Create an insufficient credits error
56
- */
57
- export declare function createInsufficientCreditsError(required: number, available: number): CreditError;
58
- /**
59
- * Create a reservation not found error
60
- */
61
- export declare function createReservationNotFoundError(reservationId: string): CreditError;
62
- /**
63
- * Create a reservation expired error
64
- */
65
- export declare function createReservationExpiredError(reservationId: string): CreditError;
66
- /**
67
- * Create a reservation already processed error
68
- */
69
- export declare function createReservationAlreadyProcessedError(reservationId: string, status: string): CreditError;
70
- /**
71
- * Create a user not found error
72
- */
73
- export declare function createUserNotFoundError(userId: string): CreditError;
74
- /**
75
- * Create an invalid operation type error
76
- */
77
- export declare function createInvalidOperationTypeError(operationType: string, validTypes: string[]): CreditError;
78
- //# sourceMappingURL=errors.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;CASlB,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAEzF;;;;;;;GAOG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACpC,SAAgB,IAAI,EAAE,mBAAmB,CAAC;IAC1C,SAAgB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAGhD,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,mBAAmB,EACzB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAanC;;OAEG;IACH,MAAM,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE;CAQ7F;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAElE;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAUlE;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAChB,WAAW,CAMb;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,aAAa,EAAE,MAAM,GAAG,WAAW,CAMjF;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,aAAa,EAAE,MAAM,GAAG,WAAW,CAMhF;AAED;;GAEG;AACH,wBAAgB,sCAAsC,CACpD,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,GACb,WAAW,CAMb;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAMnE;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAC7C,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,EAAE,GACnB,WAAW,CAMb"}
@@ -1,110 +0,0 @@
1
- /**
2
- * Credit system error classes - framework agnostic
3
- *
4
- * Provides typed error handling for credit operations.
5
- * These errors can be used across different environments.
6
- */
7
- /**
8
- * Error codes for credit operations
9
- */
10
- export const CreditErrorCode = {
11
- INSUFFICIENT_CREDITS: "INSUFFICIENT_CREDITS",
12
- RESERVATION_NOT_FOUND: "RESERVATION_NOT_FOUND",
13
- RESERVATION_EXPIRED: "RESERVATION_EXPIRED",
14
- RESERVATION_ALREADY_PROCESSED: "RESERVATION_ALREADY_PROCESSED",
15
- USER_NOT_FOUND: "USER_NOT_FOUND",
16
- INVALID_OPERATION_TYPE: "INVALID_OPERATION_TYPE",
17
- CONFIGURATION_ERROR: "CONFIGURATION_ERROR",
18
- DATABASE_ERROR: "DATABASE_ERROR",
19
- };
20
- /**
21
- * Custom error class for credit operations
22
- *
23
- * Provides structured error information including:
24
- * - Error code for programmatic handling
25
- * - Human-readable message
26
- * - Optional details for debugging
27
- */
28
- export class CreditError extends Error {
29
- code;
30
- details;
31
- constructor(message, code, details) {
32
- super(message);
33
- this.name = "CreditError";
34
- this.code = code;
35
- this.details = details;
36
- // Maintains proper stack trace for where error was thrown
37
- if (Error.captureStackTrace) {
38
- Error.captureStackTrace(this, CreditError);
39
- }
40
- }
41
- /**
42
- * Convert to JSON-serializable object
43
- */
44
- toJSON() {
45
- return {
46
- name: this.name,
47
- code: this.code,
48
- message: this.message,
49
- ...(this.details && { details: this.details }),
50
- };
51
- }
52
- }
53
- /**
54
- * Type guard to check if an error is a CreditError
55
- */
56
- export function isCreditError(error) {
57
- return error instanceof CreditError;
58
- }
59
- /**
60
- * Check if an error represents insufficient credits
61
- *
62
- * Works with both CreditError and regular Error instances.
63
- * Useful for handling errors from different sources.
64
- */
65
- export function isInsufficientCreditsError(error) {
66
- if (isCreditError(error)) {
67
- return error.code === CreditErrorCode.INSUFFICIENT_CREDITS;
68
- }
69
- if (error instanceof Error) {
70
- return error.message.toLowerCase().includes("insufficient credits");
71
- }
72
- return false;
73
- }
74
- /**
75
- * Create an insufficient credits error
76
- */
77
- export function createInsufficientCreditsError(required, available) {
78
- return new CreditError(`Insufficient credits: available ${available}, required ${required}`, CreditErrorCode.INSUFFICIENT_CREDITS, { required, available, shortfall: required - available });
79
- }
80
- /**
81
- * Create a reservation not found error
82
- */
83
- export function createReservationNotFoundError(reservationId) {
84
- return new CreditError(`Reservation ${reservationId} not found`, CreditErrorCode.RESERVATION_NOT_FOUND, { reservationId });
85
- }
86
- /**
87
- * Create a reservation expired error
88
- */
89
- export function createReservationExpiredError(reservationId) {
90
- return new CreditError(`Reservation ${reservationId} has expired`, CreditErrorCode.RESERVATION_EXPIRED, { reservationId });
91
- }
92
- /**
93
- * Create a reservation already processed error
94
- */
95
- export function createReservationAlreadyProcessedError(reservationId, status) {
96
- return new CreditError(`Reservation ${reservationId} has already been ${status}`, CreditErrorCode.RESERVATION_ALREADY_PROCESSED, { reservationId, status });
97
- }
98
- /**
99
- * Create a user not found error
100
- */
101
- export function createUserNotFoundError(userId) {
102
- return new CreditError(`User ${userId} not found`, CreditErrorCode.USER_NOT_FOUND, { userId });
103
- }
104
- /**
105
- * Create an invalid operation type error
106
- */
107
- export function createInvalidOperationTypeError(operationType, validTypes) {
108
- return new CreditError(`Invalid operation type: ${operationType}. Valid types: ${validTypes.join(", ")}`, CreditErrorCode.INVALID_OPERATION_TYPE, { operationType, validTypes });
109
- }
110
- //# sourceMappingURL=errors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,oBAAoB,EAAE,sBAAsB;IAC5C,qBAAqB,EAAE,uBAAuB;IAC9C,mBAAmB,EAAE,qBAAqB;IAC1C,6BAA6B,EAAE,+BAA+B;IAC9D,cAAc,EAAE,gBAAgB;IAChC,sBAAsB,EAAE,wBAAwB;IAChD,mBAAmB,EAAE,qBAAqB;IAC1C,cAAc,EAAE,gBAAgB;CACxB,CAAC;AAIX;;;;;;;GAOG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK;IACpB,IAAI,CAAsB;IAC1B,OAAO,CAA2B;IAElD,YACE,OAAe,EACf,IAAyB,EACzB,OAAiC;QAEjC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,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iB,EACjB,kBAAkB,EAClB,wBAAwB,EACxB,iBAAiB,EACjB,oBAAoB,EACpB,UAAU,EACV,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,MAAM,EACN,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAGpB,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,EACL,WAAW,EACX,eAAe,EACf,aAAa,EACb,0BAA0B,EAC1B,8BAA8B,EAC9B,8BAA8B,EAC9B,6BAA6B,EAC7B,sCAAsC,EACtC,uBAAuB,EACvB,+BAA+B,GAChC,MAAM,aAAa,CAAC;AAGrB,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,sBAAsB,GACvB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,4BAA4B,EAC5B,6BAA6B,EAC7B,0BAA0B,GAC3B,MAAM,iBAAiB,CAAC"}
@@ -1,36 +0,0 @@
1
- /**
2
- * Core credit operations - framework agnostic
3
- *
4
- * Contains the business logic for credit operations that can be
5
- * used by any adapter or service implementation.
6
- */
7
- import type { ICreditRepository } from "../repository/types.js";
8
- import type { PortableReservation } from "./types.js";
9
- /**
10
- * Commit a reservation with journal entry
11
- *
12
- * @param repository - The credit repository
13
- * @param userId - User ID
14
- * @param reservationId - Reservation to commit
15
- */
16
- export declare function commitReservationWithJournal(repository: ICreditRepository, userId: string, reservationId: string): Promise<void>;
17
- /**
18
- * Release a reservation with journal entry
19
- *
20
- * @param repository - The credit repository
21
- * @param userId - User ID
22
- * @param reservationId - Reservation to release
23
- */
24
- export declare function releaseReservationWithJournal(repository: ICreditRepository, userId: string, reservationId: string): Promise<void>;
25
- /**
26
- * Reserve credits for an operation
27
- *
28
- * @param repository - The credit repository
29
- * @param userId - User ID
30
- * @param amount - Credits to reserve
31
- * @param operationType - Type of operation
32
- * @param expiryMs - Reservation expiry time in milliseconds
33
- * @returns The reservation
34
- */
35
- export declare function reserveCreditsForOperation(repository: ICreditRepository, userId: string, amount: number, operationType: string, expiryMs?: number): Promise<PortableReservation>;
36
- //# sourceMappingURL=operations.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../src/core/operations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD;;;;;;GAMG;AACH,wBAAsB,4BAA4B,CAChD,UAAU,EAAE,iBAAiB,EAC7B,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,IAAI,CAAC,CA2Bf;AAED;;;;;;GAMG;AACH,wBAAsB,6BAA6B,CACjD,UAAU,EAAE,iBAAiB,EAC7B,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,IAAI,CAAC,CA2Bf;AAED;;;;;;;;;GASG;AACH,wBAAsB,0BAA0B,CAC9C,UAAU,EAAE,iBAAiB,EAC7B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EACrB,QAAQ,GAAE,MAAsB,GAC/B,OAAO,CAAC,mBAAmB,CAAC,CAG9B"}
@@ -1,87 +0,0 @@
1
- /**
2
- * Core credit operations - framework agnostic
3
- *
4
- * Contains the business logic for credit operations that can be
5
- * used by any adapter or service implementation.
6
- */
7
- /**
8
- * Commit a reservation with journal entry
9
- *
10
- * @param repository - The credit repository
11
- * @param userId - User ID
12
- * @param reservationId - Reservation to commit
13
- */
14
- export async function commitReservationWithJournal(repository, userId, reservationId) {
15
- // Get the reservation to know the amount
16
- const reservation = await repository.getReservation(userId, reservationId);
17
- if (!reservation) {
18
- throw new Error(`Reservation ${reservationId} not found`);
19
- }
20
- // Commit the reservation atomically
21
- await repository.commitReservationAtomic(userId, reservationId);
22
- // Create journal entry
23
- const credits = await repository.getUserCredits(userId);
24
- if (credits) {
25
- await repository.createJournalEntry({
26
- userId,
27
- entryType: "debit",
28
- amount: reservation.amount,
29
- balanceAfter: credits.balance,
30
- source: "operation_commit",
31
- referenceId: reservationId,
32
- referenceType: "reservation",
33
- description: `Committed ${reservation.amount} credits for ${reservation.operationType}`,
34
- metadata: {
35
- operationType: reservation.operationType,
36
- },
37
- });
38
- }
39
- }
40
- /**
41
- * Release a reservation with journal entry
42
- *
43
- * @param repository - The credit repository
44
- * @param userId - User ID
45
- * @param reservationId - Reservation to release
46
- */
47
- export async function releaseReservationWithJournal(repository, userId, reservationId) {
48
- // Get the reservation to check its state
49
- const reservation = await repository.getReservation(userId, reservationId);
50
- // Release the reservation atomically
51
- await repository.releaseReservationAtomic(userId, reservationId);
52
- // Create journal entry only if reservation was in reserved state
53
- if (reservation?.status === "reserved") {
54
- const credits = await repository.getUserCredits(userId);
55
- if (credits) {
56
- await repository.createJournalEntry({
57
- userId,
58
- entryType: "credit",
59
- amount: 0, // No actual credits returned (they were reserved, not spent)
60
- balanceAfter: credits.balance,
61
- source: "operation_release",
62
- referenceId: reservationId,
63
- referenceType: "reservation",
64
- description: `Released ${reservation.amount} reserved credits for ${reservation.operationType}`,
65
- metadata: {
66
- operationType: reservation.operationType,
67
- amount: reservation.amount,
68
- },
69
- });
70
- }
71
- }
72
- }
73
- /**
74
- * Reserve credits for an operation
75
- *
76
- * @param repository - The credit repository
77
- * @param userId - User ID
78
- * @param amount - Credits to reserve
79
- * @param operationType - Type of operation
80
- * @param expiryMs - Reservation expiry time in milliseconds
81
- * @returns The reservation
82
- */
83
- export async function reserveCreditsForOperation(repository, userId, amount, operationType, expiryMs = 5 * 60 * 1000) {
84
- const expiresAt = new Date(Date.now() + expiryMs);
85
- return repository.reserveCreditsAtomic(userId, amount, operationType, expiresAt);
86
- }
87
- //# sourceMappingURL=operations.js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