@scrawn/core 0.0.2 → 0.0.3

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 (86) hide show
  1. package/README.md +40 -0
  2. package/dist/gen/auth/v1/auth_grpc_pb.js +45 -0
  3. package/dist/gen/auth/v1/auth_pb.js +471 -86
  4. package/dist/gen/data/v1/data_grpc_pb.js +44 -0
  5. package/dist/gen/data/v1/data_pb.js +1530 -0
  6. package/dist/gen/event/v1/event_grpc_pb.js +79 -0
  7. package/dist/gen/event/v1/event_pb.js +1862 -138
  8. package/dist/gen/package.json +3 -0
  9. package/dist/gen/payment/v1/payment_grpc_pb.js +45 -0
  10. package/dist/gen/payment/v1/payment_pb.js +321 -59
  11. package/dist/gen/query/v1/query_grpc_pb.js +44 -0
  12. package/dist/gen/query/v1/query_pb.js +2327 -0
  13. package/package.json +18 -14
  14. package/dist/config.d.ts +0 -26
  15. package/dist/config.d.ts.map +0 -1
  16. package/dist/config.js +0 -25
  17. package/dist/config.js.map +0 -1
  18. package/dist/core/auth/apiKeyAuth.d.ts +0 -67
  19. package/dist/core/auth/apiKeyAuth.d.ts.map +0 -1
  20. package/dist/core/auth/apiKeyAuth.js +0 -71
  21. package/dist/core/auth/apiKeyAuth.js.map +0 -1
  22. package/dist/core/auth/baseAuth.d.ts +0 -92
  23. package/dist/core/auth/baseAuth.d.ts.map +0 -1
  24. package/dist/core/auth/baseAuth.js +0 -28
  25. package/dist/core/auth/baseAuth.js.map +0 -1
  26. package/dist/core/grpc/client.d.ts +0 -126
  27. package/dist/core/grpc/client.d.ts.map +0 -1
  28. package/dist/core/grpc/client.js +0 -138
  29. package/dist/core/grpc/client.js.map +0 -1
  30. package/dist/core/grpc/index.d.ts +0 -12
  31. package/dist/core/grpc/index.d.ts.map +0 -1
  32. package/dist/core/grpc/index.js +0 -11
  33. package/dist/core/grpc/index.js.map +0 -1
  34. package/dist/core/grpc/requestBuilder.d.ts +0 -116
  35. package/dist/core/grpc/requestBuilder.d.ts.map +0 -1
  36. package/dist/core/grpc/requestBuilder.js +0 -146
  37. package/dist/core/grpc/requestBuilder.js.map +0 -1
  38. package/dist/core/grpc/types.d.ts +0 -54
  39. package/dist/core/grpc/types.d.ts.map +0 -1
  40. package/dist/core/grpc/types.js +0 -9
  41. package/dist/core/grpc/types.js.map +0 -1
  42. package/dist/core/scrawn.d.ts +0 -197
  43. package/dist/core/scrawn.d.ts.map +0 -1
  44. package/dist/core/scrawn.js +0 -331
  45. package/dist/core/scrawn.js.map +0 -1
  46. package/dist/core/types/auth.d.ts +0 -31
  47. package/dist/core/types/auth.d.ts.map +0 -1
  48. package/dist/core/types/auth.js +0 -2
  49. package/dist/core/types/auth.js.map +0 -1
  50. package/dist/core/types/event.d.ts +0 -119
  51. package/dist/core/types/event.d.ts.map +0 -1
  52. package/dist/core/types/event.js +0 -15
  53. package/dist/core/types/event.js.map +0 -1
  54. package/dist/gen/auth/v1/auth_connect.d.ts +0 -22
  55. package/dist/gen/auth/v1/auth_connect.d.ts.map +0 -1
  56. package/dist/gen/auth/v1/auth_connect.js +0 -26
  57. package/dist/gen/auth/v1/auth_connect.js.map +0 -1
  58. package/dist/gen/auth/v1/auth_pb.d.ts +0 -59
  59. package/dist/gen/auth/v1/auth_pb.d.ts.map +0 -1
  60. package/dist/gen/auth/v1/auth_pb.js.map +0 -1
  61. package/dist/gen/event/v1/event_connect.d.ts +0 -22
  62. package/dist/gen/event/v1/event_connect.d.ts.map +0 -1
  63. package/dist/gen/event/v1/event_connect.js +0 -26
  64. package/dist/gen/event/v1/event_connect.js.map +0 -1
  65. package/dist/gen/event/v1/event_pb.d.ts +0 -105
  66. package/dist/gen/event/v1/event_pb.d.ts.map +0 -1
  67. package/dist/gen/event/v1/event_pb.js.map +0 -1
  68. package/dist/gen/payment/v1/payment_connect.d.ts +0 -22
  69. package/dist/gen/payment/v1/payment_connect.d.ts.map +0 -1
  70. package/dist/gen/payment/v1/payment_connect.js +0 -26
  71. package/dist/gen/payment/v1/payment_connect.js.map +0 -1
  72. package/dist/gen/payment/v1/payment_pb.d.ts +0 -37
  73. package/dist/gen/payment/v1/payment_pb.d.ts.map +0 -1
  74. package/dist/gen/payment/v1/payment_pb.js.map +0 -1
  75. package/dist/index.d.ts +0 -11
  76. package/dist/index.d.ts.map +0 -1
  77. package/dist/index.js +0 -15
  78. package/dist/index.js.map +0 -1
  79. package/dist/utils/logger.d.ts +0 -10
  80. package/dist/utils/logger.d.ts.map +0 -1
  81. package/dist/utils/logger.js +0 -62
  82. package/dist/utils/logger.js.map +0 -1
  83. package/dist/utils/pathMatcher.d.ts +0 -25
  84. package/dist/utils/pathMatcher.d.ts.map +0 -1
  85. package/dist/utils/pathMatcher.js +0 -46
  86. package/dist/utils/pathMatcher.js.map +0 -1
@@ -1,331 +0,0 @@
1
- import { ApiKeyAuth } from './auth/apiKeyAuth.js';
2
- import { ScrawnLogger } from '../utils/logger.js';
3
- import { matchPath } from '../utils/pathMatcher.js';
4
- import { EventPayloadSchema } from './types/event.js';
5
- import { GrpcClient } from './grpc/index.js';
6
- import { EventService } from '../gen/event/v1/event_connect.js';
7
- import { EventType, SDKCallType, SDKCall } from '../gen/event/v1/event_pb.js';
8
- import { PaymentService } from '../gen/payment/v1/payment_connect.js';
9
- const log = new ScrawnLogger('Scrawn');
10
- /**
11
- * Main SDK class for Scrawn billing infrastructure.
12
- *
13
- * Manages authentication, event tracking, and credential caching.
14
- * All event consumption methods are available directly on the SDK instance.
15
- *
16
- * @example
17
- * ```typescript
18
- * import { Scrawn } from '@scrawn/core';
19
- *
20
- * // Initialize SDK
21
- * const scrawn = new Scrawn({ apiKey: process.env.SCRAWN_KEY });
22
- * await scrawn.init();
23
- *
24
- * // Track SDK calls
25
- * await scrawn.sdkCallEventConsumer({ userId: 'u123', debitAmount: 3 });
26
- * ```
27
- */
28
- export class Scrawn {
29
- /**
30
- * Creates a new Scrawn SDK instance.
31
- *
32
- * @param config - Configuration object
33
- * @param config.apiKey - Your Scrawn API key for authentication
34
- * @param config.baseURL - Base URL for the Scrawn API (e.g., 'https://api.scrawn.dev')
35
- *
36
- * @example
37
- * ```typescript
38
- * const scrawn = new Scrawn({
39
- * apiKey: 'sk_test_...',
40
- * baseURL: 'https://api.scrawn.dev'
41
- * });
42
- * await scrawn.init();
43
- * ```
44
- */
45
- constructor(config) {
46
- /** Map of authentication method names to their implementations */
47
- this.authMethods = new Map();
48
- /**
49
- * Cache of credentials keyed by auth method name for performance.
50
- * Keys are restricted to registered auth method names only.
51
- */
52
- this.credCache = new Map();
53
- try {
54
- this.apiKey = config.apiKey;
55
- this.grpcClient = new GrpcClient(config.baseURL);
56
- this.registerAuthMethod('api', new ApiKeyAuth(this.apiKey));
57
- }
58
- catch (error) {
59
- log.error('Failed to initialize Scrawn SDK');
60
- throw error;
61
- }
62
- }
63
- /**
64
- * Register an authentication method with the SDK.
65
- *
66
- * Auth methods handle credential management and can be shared across multiple event types.
67
- * Only auth method names defined in AuthRegistry are allowed.
68
- *
69
- * @param name - Unique identifier for this auth method (must be in AuthRegistry)
70
- * @param auth - Instance of an AuthBase implementation
71
- *
72
- * @example
73
- * ```typescript
74
- * scrawn.registerAuthMethod('api', new ApiKeyAuth('sk_test_...'));
75
- * ```
76
- */
77
- registerAuthMethod(name, auth) {
78
- this.authMethods.set(name, auth);
79
- }
80
- /**
81
- * Get credentials for a specific authentication method.
82
- *
83
- * Credentials are cached after the first fetch for performance.
84
- * Subsequent calls return the cached value without re-fetching.
85
- * Only auth method names defined in AuthRegistry are allowed.
86
- *
87
- * @param authMethodName - Name of the auth method to get credentials for (must be in AuthRegistry)
88
- * @returns A promise that resolves to the credentials object
89
- * @throws Error if the auth method is not registered
90
- *
91
- * @example
92
- * ```typescript
93
- * const creds = await scrawn.getCredsFor('api');
94
- * // { apiKey: 'sk_test_...' }
95
- * ```
96
- */
97
- async getCredsFor(authMethodName) {
98
- // Check cache first
99
- if (this.credCache.has(authMethodName)) {
100
- return this.credCache.get(authMethodName);
101
- }
102
- // Get fresh creds from auth method
103
- const auth = this.authMethods.get(authMethodName);
104
- if (!auth) {
105
- throw new Error(`No auth method registered: ${authMethodName}`);
106
- }
107
- const creds = await auth.getCreds();
108
- this.credCache.set(authMethodName, creds);
109
- return creds;
110
- }
111
- /**
112
- * Track an SDK call event.
113
- *
114
- * Records SDK usage to the Scrawn backend for billing tracking.
115
- * The event is authenticated using the API key provided during SDK initialization.
116
- *
117
- * @param payload - The SDK call data to track
118
- * @param payload.userId - Unique identifier of the user making the call
119
- * @param payload.debitAmount - Amount to debit from the user's account
120
- * @returns A promise that resolves when the event is tracked
121
- * @throws Error if payload validation fails
122
- *
123
- * @example
124
- * ```typescript
125
- * await scrawn.sdkCallEventConsumer({
126
- * userId: 'user_abc123',
127
- * debitAmount: 10
128
- * });
129
- * ```
130
- */
131
- async sdkCallEventConsumer(payload) {
132
- const validationResult = EventPayloadSchema.safeParse(payload);
133
- if (!validationResult.success) {
134
- const errors = validationResult.error.issues.map(e => `${e.path.join('.')}: ${e.message}`).join(', ');
135
- log.error(`Invalid payload for sdkCallEventConsumer: ${errors}`);
136
- throw new Error(`Payload validation failed: ${errors}`); // TODO: for error shit implement the callback shit
137
- }
138
- return this.consumeEvent(validationResult.data, 'api', 'SDK_CALL'); // TODO: change this event type when jaydeep changes it in backend
139
- }
140
- /**
141
- * Create an Express-compatible middleware for tracking API endpoint usage.
142
- *
143
- * This middleware automatically tracks requests to your API endpoints for billing purposes.
144
- * You provide an extractor function that determines the userId and debitAmount from each request.
145
- * Optionally, you can provide a whitelist array to only track specific endpoints,
146
- * or a blacklist array to exclude specific endpoints from tracking.
147
- *
148
- * The middleware is framework-agnostic and works with Express, Fastify, and similar frameworks.
149
- *
150
- * @param config - Configuration object for the middleware
151
- * @param config.extractor - Function that extracts userId and debitAmount from the request. Return null to skip tracking.
152
- * @param config.whitelist - Optional array of endpoint patterns to track. Supports wildcards:
153
- * - Exact match: /api/users
154
- * - Single segment (*): /api/* matches /api/users but not /api/users/123
155
- * - Multi-segment (**): /api/** matches any path starting with /api/
156
- * - Mixed: /api/star/profile, **.php
157
- * Takes precedence over blacklist. If omitted, all requests will be tracked.
158
- * @param config.blacklist - Optional array of endpoint patterns to exclude. Same wildcard support as whitelist.
159
- * Only applies to endpoints not in the whitelist.
160
- *
161
- * @returns Express-compatible middleware function
162
- *
163
- * @example
164
- * ```typescript
165
- * // Track all endpoints
166
- * app.use(scrawn.middlewareEventConsumer({
167
- * extractor: (req) => ({
168
- * userId: req.user.id,
169
- * debitAmount: 1
170
- * })
171
- * }));
172
- *
173
- * // Track only specific endpoints with wildcards
174
- * app.use(scrawn.middlewareEventConsumer({
175
- * extractor: (req) => ({
176
- * userId: req.headers['x-user-id'] as string,
177
- * debitAmount: req.body.tokens || 1
178
- * }),
179
- * whitelist: ['/api/generate', '/api/analyze', '/api/v1/*']
180
- * }));
181
- *
182
- * // Exclude specific endpoints from tracking
183
- * app.use(scrawn.middlewareEventConsumer({
184
- * extractor: (req) => ({
185
- * userId: req.user.id,
186
- * debitAmount: 1
187
- * }),
188
- * blacklist: ['/health', '/api/collect-payment', '/internal/**', '**.tmp']
189
- * }));
190
- * ```
191
- */
192
- middlewareEventConsumer(config) {
193
- return async (req, res, next) => {
194
- try {
195
- const requestPath = req.path || req.url || '';
196
- // Check whitelist first (takes precedence)
197
- if (config.whitelist && config.whitelist.length > 0) {
198
- const isWhitelisted = config.whitelist.some(pattern => matchPath(requestPath, pattern));
199
- if (!isWhitelisted) {
200
- return next();
201
- }
202
- }
203
- // Then check blacklist
204
- if (config.blacklist && config.blacklist.length > 0) {
205
- const isBlacklisted = config.blacklist.some(pattern => matchPath(requestPath, pattern));
206
- if (isBlacklisted) {
207
- return next();
208
- }
209
- }
210
- const extractedPayload = await config.extractor(req);
211
- // If extractor returns null, skip tracking
212
- if (extractedPayload === null) {
213
- log.warn(`Extractor returned null for path: ${requestPath}. Skipping event tracking.`);
214
- return next();
215
- }
216
- const validationResult = EventPayloadSchema.safeParse(extractedPayload);
217
- if (!validationResult.success) {
218
- const errors = validationResult.error.issues.map(e => `${e.path.join('.')}: ${e.message}`).join(', ');
219
- log.error(`Invalid payload extracted in middlewareEventConsumer: ${errors}`); // TODO: for error shit implement the callback shit
220
- return next();
221
- }
222
- this.consumeEvent(validationResult.data, 'api', 'MIDDLEWARE_CALL')
223
- .catch(error => {
224
- log.error(`Failed to track middleware event: ${error.message}`);
225
- }); // TODO: for error shit implement the callback shit
226
- next();
227
- }
228
- catch (error) {
229
- log.error(`Error in middlewareEventConsumer: ${error instanceof Error ? error.message : 'Unknown error'}`);
230
- next();
231
- } // TODO: for error shit implement the callback shit
232
- };
233
- }
234
- /**
235
- * Collect payment by creating a checkout link for a user.
236
- *
237
- * Generates a payment checkout link for the specified user via the Scrawn payment service.
238
- * The checkout link can be used to direct users to complete their payment.
239
- *
240
- * @param userId - Unique identifier of the user to collect payment from
241
- * @returns A promise that resolves to the checkout link URL
242
- * @throws Error if the gRPC call fails or if authentication is invalid
243
- *
244
- * @example
245
- * ```typescript
246
- * const checkoutLink = await scrawn.collectPayment('user_abc123');
247
- * // Returns: 'https://checkout.scrawn.dev/...'
248
- * // Redirect user to this URL to complete payment
249
- * ```
250
- */
251
- async collectPayment(userId) {
252
- // Validate input
253
- if (!userId || typeof userId !== 'string' || userId.trim().length === 0) {
254
- log.error('Invalid userId provided to collectPayment');
255
- throw new Error('userId must be a non-empty string');
256
- }
257
- // Get credentials for authentication
258
- const creds = await this.getCredsFor('api');
259
- try {
260
- log.info(`Creating checkout link for user: ${userId}`);
261
- const response = await this.grpcClient
262
- .newCall(PaymentService, 'createCheckoutLink')
263
- .addHeader('Authorization', `Bearer ${creds.apiKey}`)
264
- .addPayload({ userId })
265
- .request();
266
- log.info(`Checkout link created successfully: ${response.checkoutLink}`);
267
- return response.checkoutLink;
268
- }
269
- catch (error) {
270
- log.error(`Failed to create checkout link: ${error instanceof Error ? error.message : 'Unknown error'}`);
271
- throw error;
272
- }
273
- }
274
- /**
275
- * Internal method to consume and process an event.
276
- *
277
- * This method:
278
- * 1. Validates authentication
279
- * 2. Fetches/caches credentials
280
- * 3. Executes any pre-run hooks
281
- * 4. Processes the event via gRPC call to RegisterEvent
282
- *
283
- * @param payload - Event payload data
284
- * @param authMethodName - Name of the auth method to use (must be in AuthRegistry)
285
- * @param eventType - Type of event for categorization (RAW or MIDDLEWARE_CALL)
286
- * @returns A promise that resolves when the event is processed
287
- * @throws Error if auth method is not registered or gRPC call fails
288
- *
289
- * @internal
290
- */
291
- async consumeEvent(payload, authMethodName, eventType) {
292
- const auth = this.authMethods.get(authMethodName);
293
- if (!auth)
294
- throw new Error(`No auth registered for type ${authMethodName}`);
295
- // Run pre-hook if exists
296
- if (auth.preRun)
297
- await auth.preRun();
298
- // Get creds (from cache or fresh)
299
- const creds = await this.getCredsFor(authMethodName);
300
- // Map event type to SDKCallType
301
- const sdkCallType = eventType === 'SDK_CALL'
302
- ? SDKCallType.RAW
303
- : SDKCallType.MIDDLEWARE_CALL;
304
- try {
305
- log.info(`Ingesting event (type: ${eventType}) with creds: ${JSON.stringify(creds)}, payload: ${JSON.stringify(payload)}`);
306
- const response = await this.grpcClient
307
- .newCall(EventService, 'registerEvent')
308
- .addHeader('Authorization', `Bearer ${creds.apiKey}`)
309
- .addPayload({
310
- type: EventType.SDK_CALL,
311
- userId: payload.userId,
312
- data: {
313
- case: 'sdkCall',
314
- value: new SDKCall({
315
- sdkCallType: sdkCallType,
316
- debitAmount: payload.debitAmount,
317
- }),
318
- },
319
- })
320
- .request();
321
- log.info(`Event registered successfully: ${JSON.stringify(response)}`);
322
- }
323
- catch (error) {
324
- log.error(`Failed to register event: ${error instanceof Error ? error.message : 'Unknown error'}`);
325
- throw error;
326
- }
327
- if (auth.postRun)
328
- await auth.postRun();
329
- }
330
- }
331
- //# sourceMappingURL=scrawn.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scrawn.js","sourceRoot":"","sources":["../../src/core/scrawn.ts"],"names":[],"mappings":"AASA,OAAO,EAAE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thCreds } from '../auth/apiKeyAuth.js';
2
- /**
3
- * Registry of all authentication methods and their credential types.
4
- *
5
- * When you add a new auth method, add it here:
6
- * - Key: The auth method name (literal string)
7
- * - Value: The credential type for that auth method
8
- *
9
- * @example
10
- * ```typescript
11
- * // Adding OAuth
12
- * export type AuthRegistry = {
13
- * api: ApiKeyAuthCreds;
14
- * oauth: OAuthAuthCreds; // Add new auth types here
15
- * };
16
- * ```
17
- */
18
- export type AuthRegistry = {
19
- api: ApiKeyAuthCreds;
20
- };
21
- /**
22
- * Union of all auth method names.
23
- * Automatically derived from AuthRegistry keys.
24
- */
25
- export type AuthMethodName = keyof AuthRegistry;
26
- /**
27
- * Union of all credential types.
28
- * Automatically derived from AuthRegistry values.
29
- */
30
- export type AllCredentials = AuthRegistry[keyof AuthRegistry];
31
- //# sourceMappingURL=auth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/core/types/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,eAAe,CAAC;CAEtB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,YAAY,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,YAAY,CAAC,MAAM,YAAY,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=auth.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/core/types/auth.ts"],"names":[],"mappings":""}
@@ -1,119 +0,0 @@
1
- import { z } from 'zod';
2
- /**
3
- * Zod schema for event payload validation.
4
- *
5
- * Used by all event consumer methods to ensure consistent validation.
6
- *
7
- * Validates:
8
- * - userId: non-empty string
9
- * - debitAmount: positive number
10
- */
11
- export declare const EventPayloadSchema: z.ZodObject<{
12
- userId: z.ZodString;
13
- debitAmount: z.ZodNumber;
14
- }, z.core.$strip>;
15
- /**
16
- * Payload structure for event tracking.
17
- *
18
- * Used by both sdkCallEventConsumer and middlewareEventConsumer.
19
- *
20
- * @property userId - The user ID associated with this event
21
- * @property debitAmount - Amount to debit for billing tracking
22
- *
23
- * @example
24
- * ```typescript
25
- * const payload: EventPayload = {
26
- * userId: 'u123',
27
- * debitAmount: 5
28
- * };
29
- * ```
30
- */
31
- export type EventPayload = z.infer<typeof EventPayloadSchema>;
32
- /**
33
- * Generic request object type for middleware compatibility.
34
- * Supports Express, Fastify, and other Node.js frameworks.
35
- */
36
- export interface MiddlewareRequest {
37
- /** HTTP method (GET, POST, etc.) */
38
- method?: string;
39
- /** Request URL path */
40
- url?: string;
41
- /** Request path (alternative to url) */
42
- path?: string;
43
- /** Request body */
44
- body?: any;
45
- /** Request headers */
46
- headers?: Record<string, string | string[] | undefined>;
47
- /** Request query parameters */
48
- query?: Record<string, any>;
49
- /** Request params (route parameters) */
50
- params?: Record<string, any>;
51
- /** Any additional custom properties */
52
- [key: string]: any;
53
- }
54
- /**
55
- * Generic response object type for middleware compatibility.
56
- */
57
- export interface MiddlewareResponse {
58
- /** Status code setter */
59
- status?: (code: number) => MiddlewareResponse;
60
- /** JSON response sender */
61
- json?: (data: any) => void;
62
- /** Send response */
63
- send?: (data: any) => void;
64
- /** Any additional custom properties */
65
- [key: string]: any;
66
- }
67
- /**
68
- * Generic next function type for middleware compatibility.
69
- */
70
- export type MiddlewareNext = (error?: any) => void;
71
- /**
72
- * Extractor function that derives userId and debitAmount from a request.
73
- *
74
- * @param req - The incoming request object
75
- * @returns An object containing userId and debitAmount, a Promise resolving to it, or null to skip tracking
76
- *
77
- * @example
78
- * ```typescript
79
- * const extractor: PayloadExtractor = (req) => ({
80
- * userId: req.headers['x-user-id'] as string,
81
- * debitAmount: 1
82
- * });
83
- *
84
- * // Return null to skip tracking
85
- * const extractor: PayloadExtractor = (req) => {
86
- * if (req.path === '/health') return null;
87
- * return { userId: req.user.id, debitAmount: 1 };
88
- * };
89
- * ```
90
- */
91
- export type PayloadExtractor = (req: MiddlewareRequest) => EventPayload | Promise<EventPayload> | null | Promise<null>;
92
- /**
93
- * Configuration options for the Express middleware event consumer.
94
- *
95
- * @property extractor - Function to extract userId and debitAmount from request. Return null to skip tracking.
96
- * @property whitelist - Optional array of endpoint patterns to track. Supports wildcards (* for single segment, ** for multiple segments). Takes precedence over blacklist.
97
- * @property blacklist - Optional array of endpoint patterns to exclude from tracking. Same wildcard support as whitelist. Only applies to endpoints not in whitelist.
98
- *
99
- * @example
100
- * ```typescript
101
- * const config: MiddlewareEventConfig = {
102
- * extractor: (req) => ({
103
- * userId: req.user?.id,
104
- * debitAmount: calculateCost(req)
105
- * }),
106
- * whitelist: ['/api/expensive-operation', '/api/premium-feature', '/api/*\/data'],
107
- * blacklist: ['/api/health', '/api/collect-payment', '**.tmp']
108
- * };
109
- * ```
110
- */
111
- export interface MiddlewareEventConfig {
112
- /** Function to extract event payload from request. Return null to skip tracking. */
113
- extractor: PayloadExtractor;
114
- /** Optional patterns to track (exact match or wildcards: * for single segment, ** for multi-segment). Takes precedence over blacklist. */
115
- whitelist?: string[];
116
- /** Optional patterns to exclude (exact match or wildcards: * for single segment, ** for multi-segment). Only applies to endpoints not in whitelist. */
117
- blacklist?: string[];
118
- }
119
- //# sourceMappingURL=event.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../../src/core/types/event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB;;;iBAG7B,CAAC;AAEH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D;;;GAGG;AACH,MAAM,WAAW,iB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qBAAqB;IAClC,oFAAoF;IACpF,SAAS,EAAE,gBAAgB,CAAC;IAC5B,0IAA0I;IAC1I,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,uJAAuJ;IACvJ,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB"}
@@ -1,15 +0,0 @@
1
- import { z } from 'zod';
2
- /**
3
- * Zod schema for event payload validation.
4
- *
5
- * Used by all event consumer methods to ensure consistent validation.
6
- *
7
- * Validates:
8
- * - userId: non-empty string
9
- * - debitAmount: positive number
10
- */
11
- export const EventPayloadSchema = z.object({
12
- userId: z.string().min(1, 'userId must be a non-empty string'),
13
- debitAmount: z.number().positive('debitAmount must be a positive number'),
14
- });
15
- //# sourceMappingURL=event.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event.js","sourceRoot":"","sources":["../../../src/core/types/event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,mCAAmC,CAAC;IAC9D,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;CAC5E,CAAC,CAAC"}
@@ -1,22 +0,0 @@
1
- import { CreateAPIKeyRequest, CreateAPIKeyResponse } from "./auth_pb.js";
2
- import { MethodKind } from "@bufbuild/protobuf";
3
- /**
4
- * @generated from service auth.v1.AuthService
5
- */
6
- export declare const AuthService: {
7
- readonly typeName: "auth.v1.AuthService";
8
- readonly methods: {
9
- /**
10
- * CreateAPIKey creates a new API key for the authenticated user
11
- *
12
- * @generated from rpc auth.v1.AuthService.CreateAPIKey
13
- */
14
- readonly createAPIKey: {
15
- readonly name: "CreateAPIKey";
16
- readonly I: typeof CreateAPIKeyRequest;
17
- readonly O: typeof CreateAPIKeyResponse;
18
- readonly kind: MethodKind.Unary;
19
- };
20
- };
21
- };
22
- //# sourceMappingURL=auth_connect.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth_connect.d.ts","sourceRoot":"","sources":["../../../../src/gen/auth/v1/auth_connect.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,WAAW;;;QAGpB;;;;WAIG;;;;;;;;CAQG,CAAC"}
@@ -1,26 +0,0 @@
1
- // @generated by protoc-gen-connect-es v1.7.0 with parameter "target=ts"
2
- // @generated from file auth/v1/auth.proto (package auth.v1, syntax proto3)
3
- /* eslint-disable */
4
- // @ts-nocheck
5
- import { CreateAPIKeyRequest, CreateAPIKeyResponse } from "./auth_pb.js";
6
- import { MethodKind } from "@bufbuild/protobuf";
7
- /**
8
- * @generated from service auth.v1.AuthService
9
- */
10
- export const AuthService = {
11
- typeName: "auth.v1.AuthService",
12
- methods: {
13
- /**
14
- * CreateAPIKey creates a new API key for the authenticated user
15
- *
16
- * @generated from rpc auth.v1.AuthService.CreateAPIKey
17
- */
18
- createAPIKey: {
19
- name: "CreateAPIKey",
20
- I: CreateAPIKeyRequest,
21
- O: CreateAPIKeyResponse,
22
- kind: MethodKind.Unary,
23
- },
24
- }
25
- };
26
- //# sourceMappingURL=auth_connect.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth_connect.js","sourceRoot":"","sources":["../../../../src/gen/auth/v1/auth_connect.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,2EAA2E;AAC3E,oBAAoB;AACpB,cAAc;AAEd,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,QAAQ,EAAE,qBAAqB;IAC/B,OAAO,EAAE;QACP;;;;WAIG;QACH,YAAY,EAAE;YACZ,IAAI,EAAE,cAAc;YACpB,CAAC,EAAE,mBAAmB;YACtB,CAAC,EAAE,oBAAoB;YACvB,IAAI,EAAE,UAAU,CAAC,KAAK;SACvB;KACF;CACO,CAAC"}
@@ -1,59 +0,0 @@
1
- import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
2
- import { Message, proto3 } from "@bufbuild/protobuf";
3
- /**
4
- * @generated from message auth.v1.CreateAPIKeyRequest
5
- */
6
- export declare class CreateAPIKeyRequest extends Message<CreateAPIKeyRequest> {
7
- /**
8
- * @generated from field: string name = 1;
9
- */
10
- name: string;
11
- /**
12
- * expiresIn is the expiration time in seconds from now
13
- *
14
- * @generated from field: int64 expiresIn = 2;
15
- */
16
- expiresIn: bigint;
17
- constructor(data?: PartialMessage<CreateAPIKeyRequest>);
18
- static readonly runtime: typeof proto3;
19
- static readonly typeName = "auth.v1.CreateAPIKeyRequest";
20
- static readonly fields: FieldList;
21
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): CreateAPIKeyRequest;
22
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): CreateAPIKeyRequest;
23
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): CreateAPIKeyRequest;
24
- static equals(a: CreateAPIKeyRequest | PlainMessage<CreateAPIKeyRequest> | undefined, b: CreateAPIKeyRequest | PlainMessage<CreateAPIKeyRequest> | undefined): boolean;
25
- }
26
- /**
27
- * @generated from message auth.v1.CreateAPIKeyResponse
28
- */
29
- export declare class CreateAPIKeyResponse extends Message<CreateAPIKeyResponse> {
30
- /**
31
- * @generated from field: string apiKeyId = 1;
32
- */
33
- apiKeyId: string;
34
- /**
35
- * @generated from field: string apiKey = 2;
36
- */
37
- apiKey: string;
38
- /**
39
- * @generated from field: string name = 3;
40
- */
41
- name: string;
42
- /**
43
- * @generated from field: string createdAt = 4;
44
- */
45
- createdAt: string;
46
- /**
47
- * @generated from field: string expiresAt = 5;
48
- */
49
- expiresAt: string;
50
- constructor(data?: PartialMessage<CreateAPIKeyResponse>);
51
- static readonly runtime: typeof proto3;
52
- static readonly typeName = "auth.v1.CreateAPIKeyResponse";
53
- static readonly fields: FieldList;
54
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): CreateAPIKeyResponse;
55
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): CreateAPIKeyResponse;
56
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): CreateAPIKeyResponse;
57
- static equals(a: CreateAPIKeyResponse | PlainMessage<CreateAPIKeyResponse> | undefined, b: CreateAPIKeyResponse | PlainMessage<CreateAPIKeyResponse> | undefined): boolean;
58
- }
59
- //# sourceMappingURL=auth_pb.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth_pb.d.ts","sourceRoot":"","sources":["../../../../src/gen/auth/v1/auth_pb.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACjI,OAAO,EAAE,OAAO,EAAE,MAAM,EAAc,MAAM,oBAAoB,CAAC;AAEjE;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,OAAO,CAAC,mBAAmB,CAAC;IACnE;;OAEG;IACH,IAAI,SAAM;IAEV;;;;OAIG;IACH,SAAS,SAAmB;gBAEhB,IAAI,CAAC,EAAE,cAAc,CAAC,mBAAmB,CAAC;IAKtD,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,MAAM,CAAU;IAChD,MAAM,CAAC,QAAQ,CAAC,QAAQ,iCAAiC;IACzD,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAG9B;IAEH,M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