@dataflint/mcp-server 1.0.14 → 1.0.17

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 (105) hide show
  1. package/dist/auth/auth-strategy-factory.d.ts +60 -0
  2. package/dist/auth/auth-strategy-factory.d.ts.map +1 -0
  3. package/dist/auth/auth-strategy-factory.js +113 -0
  4. package/dist/auth/auth-strategy-factory.js.map +1 -0
  5. package/dist/auth/auth0-m2m-service.d.ts +74 -0
  6. package/dist/auth/auth0-m2m-service.d.ts.map +1 -0
  7. package/dist/auth/auth0-m2m-service.js +195 -0
  8. package/dist/auth/auth0-m2m-service.js.map +1 -0
  9. package/dist/auth/auth0-service.d.ts +64 -0
  10. package/dist/auth/auth0-service.d.ts.map +1 -0
  11. package/dist/auth/auth0-service.js +326 -0
  12. package/dist/auth/auth0-service.js.map +1 -0
  13. package/dist/auth/customer-auth-configs.d.ts +31 -0
  14. package/dist/auth/customer-auth-configs.d.ts.map +1 -0
  15. package/dist/auth/customer-auth-configs.js +39 -0
  16. package/dist/auth/customer-auth-configs.js.map +1 -0
  17. package/dist/auth/index.d.ts +75 -0
  18. package/dist/auth/index.d.ts.map +1 -0
  19. package/dist/auth/index.js +137 -0
  20. package/dist/auth/index.js.map +1 -0
  21. package/dist/auth/secrets/aws-secrets-provider.d.ts +45 -0
  22. package/dist/auth/secrets/aws-secrets-provider.d.ts.map +1 -0
  23. package/dist/auth/secrets/aws-secrets-provider.js +125 -0
  24. package/dist/auth/secrets/aws-secrets-provider.js.map +1 -0
  25. package/dist/auth/secrets/index.d.ts +12 -0
  26. package/dist/auth/secrets/index.d.ts.map +1 -0
  27. package/dist/auth/secrets/index.js +17 -0
  28. package/dist/auth/secrets/index.js.map +1 -0
  29. package/dist/auth/secrets/local-file-secrets-provider.d.ts +47 -0
  30. package/dist/auth/secrets/local-file-secrets-provider.d.ts.map +1 -0
  31. package/dist/auth/secrets/local-file-secrets-provider.js +151 -0
  32. package/dist/auth/secrets/local-file-secrets-provider.js.map +1 -0
  33. package/dist/auth/secrets/secrets-provider.d.ts +54 -0
  34. package/dist/auth/secrets/secrets-provider.d.ts.map +1 -0
  35. package/dist/auth/secrets/secrets-provider.js +106 -0
  36. package/dist/auth/secrets/secrets-provider.js.map +1 -0
  37. package/dist/auth/secrets/types.d.ts +32 -0
  38. package/dist/auth/secrets/types.d.ts.map +1 -0
  39. package/dist/auth/secrets/types.js +8 -0
  40. package/dist/auth/secrets/types.js.map +1 -0
  41. package/dist/auth/service-account-service.d.ts +77 -0
  42. package/dist/auth/service-account-service.d.ts.map +1 -0
  43. package/dist/auth/service-account-service.js +209 -0
  44. package/dist/auth/service-account-service.js.map +1 -0
  45. package/dist/auth/types.d.ts +140 -0
  46. package/dist/auth/types.d.ts.map +1 -0
  47. package/dist/auth/types.js +30 -0
  48. package/dist/auth/types.js.map +1 -0
  49. package/dist/auth.d.ts +47 -0
  50. package/dist/auth.d.ts.map +1 -0
  51. package/dist/auth.js +302 -0
  52. package/dist/auth.js.map +1 -0
  53. package/dist/dataflint-server-service.d.ts +3 -6
  54. package/dist/dataflint-server-service.d.ts.map +1 -1
  55. package/dist/dataflint-server-service.js +48 -133
  56. package/dist/dataflint-server-service.js.map +1 -1
  57. package/dist/index.d.ts +4 -3
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js +7 -11
  60. package/dist/index.js.map +1 -1
  61. package/dist/request-context.d.ts +0 -20
  62. package/dist/request-context.d.ts.map +1 -1
  63. package/dist/request-context.js +1 -31
  64. package/dist/request-context.js.map +1 -1
  65. package/dist/server.d.ts +2 -2
  66. package/dist/server.d.ts.map +1 -1
  67. package/dist/server.js +14 -16
  68. package/dist/server.js.map +1 -1
  69. package/dist/standalone/config.d.ts +7 -13
  70. package/dist/standalone/config.d.ts.map +1 -1
  71. package/dist/standalone/config.js +439 -23059
  72. package/dist/standalone/config.js.map +4 -4
  73. package/dist/standalone/logger.js +2 -2
  74. package/dist/standalone/logger.js.map +1 -1
  75. package/dist/standalone/server.d.ts.map +1 -1
  76. package/dist/standalone/server.js +25 -45
  77. package/dist/standalone/server.js.map +1 -1
  78. package/dist/standalone/stdio-transport.d.ts +1 -2
  79. package/dist/standalone/stdio-transport.d.ts.map +1 -1
  80. package/dist/standalone/stdio-transport.js +4 -3
  81. package/dist/standalone/stdio-transport.js.map +1 -1
  82. package/dist/tools/base.d.ts +16 -0
  83. package/dist/tools/base.d.ts.map +1 -1
  84. package/dist/tools/base.js +16 -0
  85. package/dist/tools/base.js.map +1 -1
  86. package/dist/tools/core-tools.d.ts.map +1 -1
  87. package/dist/tools/core-tools.js +4 -4
  88. package/dist/tools/core-tools.js.map +1 -1
  89. package/dist/tools/expertise-tools.d.ts.map +1 -1
  90. package/dist/tools/expertise-tools.js +5 -5
  91. package/dist/tools/expertise-tools.js.map +1 -1
  92. package/dist/tools/findings-tools.d.ts.map +1 -1
  93. package/dist/tools/findings-tools.js +4 -4
  94. package/dist/tools/findings-tools.js.map +1 -1
  95. package/dist/tools/highlight-tools.d.ts.map +1 -1
  96. package/dist/tools/highlight-tools.js +8 -10
  97. package/dist/tools/highlight-tools.js.map +1 -1
  98. package/dist/tools/listing-tools.d.ts.map +1 -1
  99. package/dist/tools/listing-tools.js +1 -1
  100. package/dist/tools/listing-tools.js.map +1 -1
  101. package/dist/types.d.ts +13 -5
  102. package/dist/types.d.ts.map +1 -1
  103. package/dist/types.js +0 -5
  104. package/dist/types.js.map +1 -1
  105. package/package.json +1 -2
@@ -0,0 +1,326 @@
1
+ "use strict";
2
+ /**
3
+ * Auth0 OAuth2/PKCE Authentication Service
4
+ *
5
+ * Provides interactive browser-based authentication using Auth0 with PKCE flow.
6
+ * This is the primary authentication method for user-facing applications.
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.Auth0Service = void 0;
43
+ const http = __importStar(require("http"));
44
+ const openid_client_1 = require("openid-client");
45
+ const url_1 = require("url");
46
+ const AUTH_DISCOVERY_TIMEOUT_MS = 10_000; // 10 seconds
47
+ openid_client_1.custom.setHttpOptionsDefaults({
48
+ timeout: AUTH_DISCOVERY_TIMEOUT_MS,
49
+ });
50
+ /**
51
+ * Default no-op logger for when no logger is provided
52
+ */
53
+ const noopLogger = {
54
+ info: () => { },
55
+ warn: () => { },
56
+ error: () => { },
57
+ debug: () => { },
58
+ };
59
+ /**
60
+ * Auth0 service for interactive OAuth2/PKCE authentication
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * const auth0Service = new Auth0Service(
65
+ * async (url) => { await open(url); },
66
+ * () => configService.getAuthConfig(),
67
+ * logger
68
+ * );
69
+ *
70
+ * await auth0Service.initialize();
71
+ * const result = await auth0Service.authenticate();
72
+ * console.log('Access Token:', result.accessToken);
73
+ * ```
74
+ */
75
+ class Auth0Service {
76
+ config;
77
+ redirectUri;
78
+ callbackPort;
79
+ client = null;
80
+ issuer = null;
81
+ initialized = false;
82
+ openUrlHandler;
83
+ logger;
84
+ constructor(openUrlHandler, configProvider, logger, callbackPort = 11334) {
85
+ this.logger = logger || noopLogger;
86
+ this.openUrlHandler = openUrlHandler;
87
+ this.config = {
88
+ ...configProvider(),
89
+ scope: configProvider().scope || "openid profile email",
90
+ };
91
+ this.callbackPort = callbackPort;
92
+ this.redirectUri = `http://localhost:${callbackPort}/callback`;
93
+ this.logger.info(`Auth0Service initialized for domain: ${this.config.domain}`);
94
+ }
95
+ /**
96
+ * Initialize the Auth0 client by discovering the issuer metadata
97
+ */
98
+ async initialize() {
99
+ if (this.initialized) {
100
+ this.logger.debug("Auth0 client already initialized");
101
+ return;
102
+ }
103
+ try {
104
+ const issuerUrl = this.config.domain.startsWith("http")
105
+ ? this.config.domain
106
+ : `https://${this.config.domain}`;
107
+ this.logger.info(`Attempting to discover Auth0 issuer at: ${issuerUrl}`);
108
+ this.logger.debug(`Discovery URL will be: ${issuerUrl}`);
109
+ this.issuer = await openid_client_1.Issuer.discover(issuerUrl);
110
+ this.logger.info(`Auth0 issuer discovered successfully: ${this.issuer.issuer}`);
111
+ this.client = new this.issuer.Client({
112
+ client_id: this.config.clientId,
113
+ redirect_uris: [this.redirectUri],
114
+ response_types: ["code"],
115
+ token_endpoint_auth_method: "none", // Public client, no client secret required
116
+ });
117
+ this.initialized = true;
118
+ this.logger.info("Auth0 client initialized successfully");
119
+ }
120
+ catch (error) {
121
+ this.logger.error("Failed to initialize Auth0 client", error);
122
+ this.logger.error(`Auth0 domain: ${this.config.domain}`);
123
+ this.logger.error(`Client ID: ${this.config.clientId}`);
124
+ this.logger.error(`Constructed issuer URL: ${this.config.domain.startsWith("http") ? this.config.domain : `https://${this.config.domain}`}`);
125
+ // Check if it's a network/discovery error
126
+ if (error instanceof Error) {
127
+ if (error.message.includes("404") ||
128
+ error.message.includes("Not Found")) {
129
+ throw new Error(`Auth0 domain '${this.config.domain}' not found. Please verify your Auth0 domain configuration. The discovery endpoint ${this.config.domain} returned 404.`);
130
+ }
131
+ else if (error.message.includes("ENOTFOUND") ||
132
+ error.message.includes("getaddrinfo")) {
133
+ throw new Error(`Cannot connect to Auth0 domain '${this.config.domain}'. Please check your internet connection and verify the domain is correct.`);
134
+ }
135
+ }
136
+ throw new Error(`Auth0 initialization failed: ${error}`);
137
+ }
138
+ }
139
+ /**
140
+ * Start the authentication flow
141
+ */
142
+ async authenticate() {
143
+ if (!this.client) {
144
+ await this.initialize();
145
+ }
146
+ if (!this.client) {
147
+ throw new Error("Auth0 client not initialized");
148
+ }
149
+ // Generate PKCE code verifier/challenge for security
150
+ const codeVerifier = openid_client_1.generators.codeVerifier();
151
+ const codeChallenge = openid_client_1.generators.codeChallenge(codeVerifier);
152
+ // Create the authorization URL
153
+ const authUrl = this.client.authorizationUrl({
154
+ scope: this.config.scope,
155
+ code_challenge: codeChallenge,
156
+ code_challenge_method: "S256",
157
+ ...(this.config.audience && { audience: this.config.audience }),
158
+ });
159
+ this.logger.info("Opening browser for authentication...");
160
+ try {
161
+ await this.openUrlHandler(authUrl);
162
+ }
163
+ catch (error) {
164
+ this.logger.error("Failed to open browser", error);
165
+ this.logger.info(`Please manually navigate to: ${authUrl}`);
166
+ }
167
+ // Wait for the callback and exchange the code for tokens
168
+ return new Promise((resolve, reject) => {
169
+ const server = http.createServer(async (req, res) => {
170
+ try {
171
+ if (!req.url?.startsWith("/callback")) {
172
+ res.writeHead(404, { "Content-Type": "text/plain" });
173
+ res.end("Not Found");
174
+ return;
175
+ }
176
+ const callbackUrl = new url_1.URL(`http://localhost:${this.callbackPort}${req.url}`);
177
+ const params = this.client.callbackParams(callbackUrl.toString());
178
+ // Exchange authorization code for tokens
179
+ const tokenSet = await this.client.callback(this.redirectUri, params, {
180
+ code_verifier: codeVerifier,
181
+ });
182
+ const authResult = this.processTokenSet(tokenSet);
183
+ // Send success response
184
+ res.writeHead(200, { "Content-Type": "text/html" });
185
+ res.end(`
186
+ <html>
187
+ <body style="font-family: Arial, sans-serif; text-align: center; padding: 50px;">
188
+ <h2 style="color: #4CAF50;">Authentication Successful!</h2>
189
+ <p>You can now close this tab and return to VS Code/Cursor.</p>
190
+ <script>
191
+ setTimeout(() => {
192
+ window.close();
193
+ }, 3000);
194
+ </script>
195
+ </body>
196
+ </html>
197
+ `);
198
+ server.close();
199
+ resolve(authResult);
200
+ }
201
+ catch (error) {
202
+ this.logger.error("Authentication callback error", error);
203
+ // Send error response
204
+ res.writeHead(400, { "Content-Type": "text/html" });
205
+ res.end(`
206
+ <html>
207
+ <body style="font-family: Arial, sans-serif; text-align: center; padding: 50px;">
208
+ <h2 style="color: #f44336;">Authentication Failed</h2>
209
+ <p>Error: ${error}</p>
210
+ <p>Please try again.</p>
211
+ </body>
212
+ </html>
213
+ `);
214
+ server.close();
215
+ reject(error);
216
+ }
217
+ });
218
+ server.listen(this.callbackPort, () => {
219
+ this.logger.info(`Listening for Auth0 callback on http://localhost:${this.callbackPort}/callback`);
220
+ });
221
+ // Add timeout to prevent hanging
222
+ setTimeout(() => {
223
+ server.close();
224
+ reject(new Error("Authentication timeout - no response received within 5 minutes"));
225
+ }, 300000); // 5 minutes timeout
226
+ });
227
+ }
228
+ /**
229
+ * Get user information using the access token
230
+ */
231
+ async getUserInfo(accessToken) {
232
+ if (!this.client) {
233
+ throw new Error("Auth0 client not initialized");
234
+ }
235
+ try {
236
+ this.logger.info("Fetching user information...");
237
+ const userInfo = await this.client.userinfo(accessToken);
238
+ this.logger.info("User information retrieved successfully");
239
+ this.logger.debug(`User ID: ${userInfo.sub}`);
240
+ return userInfo;
241
+ }
242
+ catch (error) {
243
+ this.logger.error("Failed to get user info", error);
244
+ throw error;
245
+ }
246
+ }
247
+ /**
248
+ * Refresh the access token using refresh token
249
+ */
250
+ async refreshToken(refreshToken) {
251
+ if (!this.client) {
252
+ throw new Error("Auth0 client not initialized");
253
+ }
254
+ try {
255
+ this.logger.info("Refreshing access token...");
256
+ const tokenSet = await this.client.refresh(refreshToken);
257
+ const result = this.processTokenSet(tokenSet);
258
+ this.logger.info("Token refresh completed successfully");
259
+ return result;
260
+ }
261
+ catch (error) {
262
+ this.logger.error("Token refresh failed", error);
263
+ throw error;
264
+ }
265
+ }
266
+ /**
267
+ * Process token set and return structured result
268
+ */
269
+ processTokenSet(tokenSet) {
270
+ const result = {
271
+ accessToken: tokenSet.access_token,
272
+ idToken: tokenSet.id_token,
273
+ refreshToken: tokenSet.refresh_token,
274
+ };
275
+ if (tokenSet.expires_at) {
276
+ result.expiresAt = new Date(tokenSet.expires_at * 1000);
277
+ }
278
+ this.logger.info("Authentication tokens processed successfully");
279
+ this.logger.debug(`Access Token: ${result.accessToken?.substring(0, 20)}...`);
280
+ this.logger.debug(`ID Token: ${result.idToken ? "Present" : "Not provided"}`);
281
+ this.logger.debug(`Refresh Token: ${result.refreshToken ? "Present" : "Not provided"}`);
282
+ this.logger.debug(`Expires At: ${result.expiresAt}`);
283
+ return result;
284
+ }
285
+ /**
286
+ * Check if a token is expired
287
+ */
288
+ isTokenExpired(authResult) {
289
+ if (!authResult.expiresAt) {
290
+ this.logger.debug("No expiration time available, considering token valid");
291
+ return false; // If no expiration time, assume it's still valid
292
+ }
293
+ // Ensure expiresAt is a Date object (it might be a string if serialized)
294
+ const expiresAt = authResult.expiresAt instanceof Date
295
+ ? authResult.expiresAt
296
+ : new Date(authResult.expiresAt);
297
+ const now = new Date();
298
+ const buffer = 5 * 60 * 1000; // 5 minutes buffer
299
+ const isExpired = expiresAt.getTime() - buffer < now.getTime();
300
+ if (isExpired) {
301
+ this.logger.warn("Access token is expired or will expire soon");
302
+ }
303
+ else {
304
+ this.logger.debug("Access token is still valid");
305
+ }
306
+ return isExpired;
307
+ }
308
+ /**
309
+ * Logout (revoke tokens if supported)
310
+ */
311
+ async logout(accessToken) {
312
+ if (!this.client) {
313
+ throw new Error("Auth0 client not initialized");
314
+ }
315
+ try {
316
+ await this.client.revoke(accessToken);
317
+ this.logger.info("Token revoked successfully");
318
+ }
319
+ catch (error) {
320
+ this.logger.error("Failed to revoke token", error);
321
+ // Don't throw error as logout should be graceful
322
+ }
323
+ }
324
+ }
325
+ exports.Auth0Service = Auth0Service;
326
+ //# sourceMappingURL=auth0-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth0-service.js","sourceRoot":"","sources":["../../src/auth/auth0-service.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2CAA6B;AAC7B,iDAAmE;AACnE,6BAA0B;AAS1B,MAAM,yBAAyB,GAAG,MAAM,CAAC,CAAC,aAAa;AAEvD,sBAAM,CAAC,sBAAsB,CAAC;IAC1B,OAAO,EAAE,yBAAyB;CACrC,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,UAAU,GAAgB;IAC5B,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;IACf,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;CAClB,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAa,YAAY;IACb,MAAM,CAAa;IACnB,WAAW,CAAS;IACpB,YAAY,CAAS;IACrB,MAAM,GAAkB,IAAI,CAAC;IAC7B,MAAM,GAAkB,IAAI,CAAC;IAC7B,WAAW,GAAG,KAAK,CAAC;IACpB,cAAc,CAAiB;IAC/B,MAAM,CAAc;IAE5B,YACI,cAA8B,EAC9B,cAA8B,EAC9B,MAAoB,EACpB,eAAuB,KAAK;QAE5B,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,UAAU,CAAC;QACnC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,MAAM,GA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CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QACpD,CAAC;QAED,IAAI,CAAC;YACD,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;YACtC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QACnD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;YACnD,iDAAiD;QACrD,CAAC;IACL,CAAC;CACJ;AA/UD,oCA+UC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Customer-specific authentication configurations
3
+ *
4
+ * This file contains mappings from hashed customer domains to their Auth0 configurations.
5
+ * Customer domains are hashed using SHA-256 for privacy.
6
+ *
7
+ * To add a new customer:
8
+ * 1. Generate hash: npm run hash-domain -- "customer.domain.com"
9
+ * 2. Add entry to customerAuthConfigs with the hash as key
10
+ */
11
+ export interface CustomerAuthConfig {
12
+ /**
13
+ * Auth0 client ID for this customer
14
+ */
15
+ clientId: string;
16
+ /**
17
+ * Optional function to produce customer-specific Auth0 domain
18
+ * @param customerDomain - The customer's domain (e.g., "acme.corp")
19
+ * @returns Auth0 domain URL (e.g., "https://dataflint-acme.us.auth0.com/")
20
+ */
21
+ domainProducer?: (customerDomain: string) => string;
22
+ }
23
+ /**
24
+ * Mapping from hashed customer domain to Auth0 configuration
25
+ * Key: SHA-256 hash of customer domain
26
+ * Value: CustomerAuthConfig with clientId and optional domainProducer
27
+ */
28
+ export declare const customerAuthConfigs: {
29
+ [key: string]: CustomerAuthConfig;
30
+ };
31
+ //# sourceMappingURL=customer-auth-configs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customer-auth-configs.d.ts","sourceRoot":"","sources":["../../src/auth/customer-auth-configs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,WAAW,kBAAkB;IAC/B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,cAAc,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,MAAM,CAAC;CACvD;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB,CAAA;CAwBpE,CAAC"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /**
3
+ * Customer-specific authentication configurations
4
+ *
5
+ * This file contains mappings from hashed customer domains to their Auth0 configurations.
6
+ * Customer domains are hashed using SHA-256 for privacy.
7
+ *
8
+ * To add a new customer:
9
+ * 1. Generate hash: npm run hash-domain -- "customer.domain.com"
10
+ * 2. Add entry to customerAuthConfigs with the hash as key
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.customerAuthConfigs = void 0;
14
+ /**
15
+ * Mapping from hashed customer domain to Auth0 configuration
16
+ * Key: SHA-256 hash of customer domain
17
+ * Value: CustomerAuthConfig with clientId and optional domainProducer
18
+ */
19
+ exports.customerAuthConfigs = {
20
+ // Customer domain hash → Auth0 configuration
21
+ "857064adfec4e0e5e37be8afef397155db006bb6009d1b395388d9174eb40795": {
22
+ clientId: "CWvpqujjEV2aoRSDVWFSh1U6HQALygB0",
23
+ domainProducer: (customerDomain) => `https://dataflint-${customerDomain}.us.auth0.com/`,
24
+ },
25
+ cafe6e0af028d729afd3c4a386482621af90e8e117b1216f2bbc08e86a5e9445: {
26
+ clientId: "HRLICLhE0BP4AeZ8dSPAoDHFmMZVacxi",
27
+ },
28
+ "1613f29ea956158d2ad56a10780feb45d78755819565e76c4bf0d9069d17aab9": {
29
+ clientId: "CnyJJKVqes0Y0uU57GreAeaPbJlm4l4w",
30
+ },
31
+ eae8e3404182477f008479b38a6629ee86b23cefe2c418c5dc5c2f0d02af5475: {
32
+ clientId: "etY3z44ssWohe77PEBIMPzktW4BmvWGT",
33
+ },
34
+ // dataflint-demo (added from commit f38928c)
35
+ cc1677626e05d82b301cc83c22a850eac849555e704f288083108d79f600cea1: {
36
+ clientId: "u9W23NGvlV58W2N9WXMMhsM12bKK8oGI",
37
+ },
38
+ };
39
+ //# sourceMappingURL=customer-auth-configs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customer-auth-configs.js","sourceRoot":"","sources":["../../src/auth/customer-auth-configs.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAgBH;;;;GAIG;AACU,QAAA,mBAAmB,GAA0C;IACtE,6CAA6C;IAC7C,kEAAkE,EAAE;QAChE,QAAQ,EAAE,kCAAkC;QAC5C,cAAc,EAAE,CAAC,cAAc,EAAE,EAAE,CAC/B,qBAAqB,cAAc,gBAAgB;KAC1D;IAED,gEAAgE,EAAE;QAC9D,QAAQ,EAAE,kCAAkC;KAC/C;IAED,kEAAkE,EAAE;QAChE,QAAQ,EAAE,kCAAkC;KAC/C;IAED,gEAAgE,EAAE;QAC9D,QAAQ,EAAE,kCAAkC;KAC/C;IAED,6CAA6C;IAC7C,gEAAgE,EAAE;QAC9D,QAAQ,EAAE,kCAAkC;KAC/C;CACJ,CAAC"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Shared authentication configuration and services for DataFlint
3
+ *
4
+ * This package provides:
5
+ * - Customer-specific Auth0 configuration lookup
6
+ * - Multiple authentication strategies (Service Account, Auth0 M2M, Auth0 User)
7
+ * - Secrets providers (AWS Secrets Manager, Local File)
8
+ * - Strategy factory for automatic strategy selection
9
+ *
10
+ * @example Basic usage with Auth0 user flow:
11
+ * ```typescript
12
+ * import { Auth0Service, getCustomerAuthConfig } from "@dataflint/shared-auth-config";
13
+ *
14
+ * const config = getCustomerAuthConfig("acme.corp");
15
+ * const auth0 = new Auth0Service(openUrl, () => config, logger);
16
+ * await auth0.authenticate();
17
+ * ```
18
+ *
19
+ * @example Using the strategy factory (MCP standalone):
20
+ * ```typescript
21
+ * import { AuthStrategyFactory } from "@dataflint/shared-auth-config";
22
+ *
23
+ * const factory = new AuthStrategyFactory(configService, logger);
24
+ * const { strategy, strategyType } = await factory.createStrategy();
25
+ *
26
+ * if (strategy) {
27
+ * await strategy.initialize();
28
+ * const token = await strategy.getToken();
29
+ * } else {
30
+ * // Fall back to interactive OAuth
31
+ * }
32
+ * ```
33
+ */
34
+ import { customerAuthConfigs, CustomerAuthConfig } from "./customer-auth-configs";
35
+ /**
36
+ * Resolved authentication configuration for a customer
37
+ */
38
+ export interface ResolvedAuthConfig {
39
+ /**
40
+ * Auth0 domain URL (e.g., "https://dataflint-acme.us.auth0.com/")
41
+ */
42
+ domain: string;
43
+ /**
44
+ * Auth0 client ID
45
+ */
46
+ clientId: string;
47
+ /**
48
+ * Auth0 audience (API identifier)
49
+ */
50
+ audience: string;
51
+ /**
52
+ * DataFlint API server URL
53
+ */
54
+ serverUrl: string;
55
+ }
56
+ /**
57
+ * Get customer-specific authentication configuration
58
+ *
59
+ * This function:
60
+ * 1. Hashes the customer domain using SHA-256
61
+ * 2. Looks up the hash in customerAuthConfigs
62
+ * 3. Returns the resolved Auth0 configuration
63
+ *
64
+ * @param customerDomain - Customer's domain (e.g., "acme.corp")
65
+ * @returns ResolvedAuthConfig or null if customer not found
66
+ */
67
+ export declare function getCustomerAuthConfig(customerDomain: string): ResolvedAuthConfig | null;
68
+ export { customerAuthConfigs, CustomerAuthConfig };
69
+ export { AuthConfig, AuthResult, Auth0M2MCredentials, AuthStrategyType, M2MType, M2MMode, AuthUserInfo, IAuthStrategy, IAuthConfigProvider, IAuthLogger, OpenUrlHandler, ConfigProvider, } from "./types";
70
+ export { Auth0Service } from "./auth0-service";
71
+ export { Auth0M2MService } from "./auth0-m2m-service";
72
+ export { ServiceAccountService } from "./service-account-service";
73
+ export { AuthStrategyFactory, StrategyResult } from "./auth-strategy-factory";
74
+ export { ISecretsProvider, AWSSecretsProvider, LocalFileSecretsProvider, SecretsProvider, } from "./secrets";
75
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAGH,OAAO,EACH,mBAAmB,EACnB,kBAAkB,EACrB,MAAM,yBAAyB,CAAC;AAMjC;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACjC,cAAc,EAAE,MAAM,GACvB,kBAAkB,GAAG,IAAI,CA8B3B;AAGD,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,CAAC;AAMnD,OAAO,EACH,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,gBAAgB,EAChB,OAAO,EACP,OAAO,EACP,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,cAAc,GACjB,MAAM,SAAS,CAAC;AAMjB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAMlE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAM9E,OAAO,EACH,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,EACxB,eAAe,GAClB,MAAM,WAAW,CAAC"}
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ /**
3
+ * Shared authentication configuration and services for DataFlint
4
+ *
5
+ * This package provides:
6
+ * - Customer-specific Auth0 configuration lookup
7
+ * - Multiple authentication strategies (Service Account, Auth0 M2M, Auth0 User)
8
+ * - Secrets providers (AWS Secrets Manager, Local File)
9
+ * - Strategy factory for automatic strategy selection
10
+ *
11
+ * @example Basic usage with Auth0 user flow:
12
+ * ```typescript
13
+ * import { Auth0Service, getCustomerAuthConfig } from "@dataflint/shared-auth-config";
14
+ *
15
+ * const config = getCustomerAuthConfig("acme.corp");
16
+ * const auth0 = new Auth0Service(openUrl, () => config, logger);
17
+ * await auth0.authenticate();
18
+ * ```
19
+ *
20
+ * @example Using the strategy factory (MCP standalone):
21
+ * ```typescript
22
+ * import { AuthStrategyFactory } from "@dataflint/shared-auth-config";
23
+ *
24
+ * const factory = new AuthStrategyFactory(configService, logger);
25
+ * const { strategy, strategyType } = await factory.createStrategy();
26
+ *
27
+ * if (strategy) {
28
+ * await strategy.initialize();
29
+ * const token = await strategy.getToken();
30
+ * } else {
31
+ * // Fall back to interactive OAuth
32
+ * }
33
+ * ```
34
+ */
35
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
36
+ if (k2 === undefined) k2 = k;
37
+ var desc = Object.getOwnPropertyDescriptor(m, k);
38
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
39
+ desc = { enumerable: true, get: function() { return m[k]; } };
40
+ }
41
+ Object.defineProperty(o, k2, desc);
42
+ }) : (function(o, m, k, k2) {
43
+ if (k2 === undefined) k2 = k;
44
+ o[k2] = m[k];
45
+ }));
46
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
47
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
48
+ }) : function(o, v) {
49
+ o["default"] = v;
50
+ });
51
+ var __importStar = (this && this.__importStar) || (function () {
52
+ var ownKeys = function(o) {
53
+ ownKeys = Object.getOwnPropertyNames || function (o) {
54
+ var ar = [];
55
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
56
+ return ar;
57
+ };
58
+ return ownKeys(o);
59
+ };
60
+ return function (mod) {
61
+ if (mod && mod.__esModule) return mod;
62
+ var result = {};
63
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
64
+ __setModuleDefault(result, mod);
65
+ return result;
66
+ };
67
+ })();
68
+ Object.defineProperty(exports, "__esModule", { value: true });
69
+ exports.SecretsProvider = exports.LocalFileSecretsProvider = exports.AWSSecretsProvider = exports.AuthStrategyFactory = exports.ServiceAccountService = exports.Auth0M2MService = exports.Auth0Service = exports.M2MType = exports.AuthStrategyType = exports.customerAuthConfigs = void 0;
70
+ exports.getCustomerAuthConfig = getCustomerAuthConfig;
71
+ const crypto = __importStar(require("node:crypto"));
72
+ const customer_auth_configs_1 = require("./customer-auth-configs");
73
+ Object.defineProperty(exports, "customerAuthConfigs", { enumerable: true, get: function () { return customer_auth_configs_1.customerAuthConfigs; } });
74
+ /**
75
+ * Get customer-specific authentication configuration
76
+ *
77
+ * This function:
78
+ * 1. Hashes the customer domain using SHA-256
79
+ * 2. Looks up the hash in customerAuthConfigs
80
+ * 3. Returns the resolved Auth0 configuration
81
+ *
82
+ * @param customerDomain - Customer's domain (e.g., "acme.corp")
83
+ * @returns ResolvedAuthConfig or null if customer not found
84
+ */
85
+ function getCustomerAuthConfig(customerDomain) {
86
+ // Step 1: Hash the customer domain using SHA-256
87
+ const customerHash = crypto
88
+ .createHash("sha256")
89
+ .update(customerDomain)
90
+ .digest("hex");
91
+ // Step 2: Look up the hash in our customer configurations
92
+ const customerConfig = customer_auth_configs_1.customerAuthConfigs[customerHash];
93
+ if (!customerConfig) {
94
+ // Customer not found in registry
95
+ return null;
96
+ }
97
+ // Step 3: Build the complete authentication configuration
98
+ return {
99
+ // Use custom Auth0 domain if domainProducer is defined, otherwise use default
100
+ domain: customerConfig.domainProducer?.(customerDomain) ||
101
+ "https://dataflint.us.auth0.com/",
102
+ // Customer-specific Auth0 client ID
103
+ clientId: customerConfig.clientId,
104
+ // Customer-specific API audience
105
+ audience: `https://api.${customerDomain}.dataflint.io`,
106
+ // Customer-specific server URL
107
+ serverUrl: `https://api.${customerDomain}.dataflint.io`,
108
+ };
109
+ }
110
+ // ============================================================================
111
+ // Types
112
+ // ============================================================================
113
+ var types_1 = require("./types");
114
+ Object.defineProperty(exports, "AuthStrategyType", { enumerable: true, get: function () { return types_1.AuthStrategyType; } });
115
+ Object.defineProperty(exports, "M2MType", { enumerable: true, get: function () { return types_1.M2MType; } });
116
+ // ============================================================================
117
+ // Authentication Services
118
+ // ============================================================================
119
+ var auth0_service_1 = require("./auth0-service");
120
+ Object.defineProperty(exports, "Auth0Service", { enumerable: true, get: function () { return auth0_service_1.Auth0Service; } });
121
+ var auth0_m2m_service_1 = require("./auth0-m2m-service");
122
+ Object.defineProperty(exports, "Auth0M2MService", { enumerable: true, get: function () { return auth0_m2m_service_1.Auth0M2MService; } });
123
+ var service_account_service_1 = require("./service-account-service");
124
+ Object.defineProperty(exports, "ServiceAccountService", { enumerable: true, get: function () { return service_account_service_1.ServiceAccountService; } });
125
+ // ============================================================================
126
+ // Authentication Strategy Factory
127
+ // ============================================================================
128
+ var auth_strategy_factory_1 = require("./auth-strategy-factory");
129
+ Object.defineProperty(exports, "AuthStrategyFactory", { enumerable: true, get: function () { return auth_strategy_factory_1.AuthStrategyFactory; } });
130
+ // ============================================================================
131
+ // Secrets Providers
132
+ // ============================================================================
133
+ var secrets_1 = require("./secrets");
134
+ Object.defineProperty(exports, "AWSSecretsProvider", { enumerable: true, get: function () { return secrets_1.AWSSecretsProvider; } });
135
+ Object.defineProperty(exports, "LocalFileSecretsProvider", { enumerable: true, get: function () { return secrets_1.LocalFileSecretsProvider; } });
136
+ Object.defineProperty(exports, "SecretsProvider", { enumerable: true, get: function () { return secrets_1.SecretsProvider; } });
137
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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