fraim 2.0.179 → 2.0.182

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 (64) hide show
  1. package/dist/src/ai-hub/desktop-main.js +2 -2
  2. package/dist/src/api/admin/payments.js +33 -0
  3. package/dist/src/api/admin/sales-leads.js +21 -0
  4. package/dist/src/api/payment/create-session.js +338 -0
  5. package/dist/src/api/payment/dashboard-link.js +149 -0
  6. package/dist/src/api/payment/session-details.js +31 -0
  7. package/dist/src/api/payment/webhook.js +587 -0
  8. package/dist/src/api/personas/me.js +29 -0
  9. package/dist/src/api/pricing/get-config.js +25 -0
  10. package/dist/src/api/sales/contact.js +44 -0
  11. package/dist/src/cli/commands/add-ide.js +9 -2
  12. package/dist/src/cli/commands/setup.js +14 -44
  13. package/dist/src/cli/distribution/marketplace-bundles.js +5 -1
  14. package/dist/src/cli/setup/ide-detector.js +7 -2
  15. package/dist/src/core/config-loader.js +10 -8
  16. package/dist/src/core/types.js +2 -1
  17. package/dist/src/db/payment-repository.js +61 -0
  18. package/dist/src/fraim/config-loader.js +11 -0
  19. package/dist/src/fraim/db-service.js +2387 -0
  20. package/dist/src/fraim/issues.js +152 -0
  21. package/dist/src/fraim/template-processor.js +184 -0
  22. package/dist/src/fraim/utils/request-utils.js +23 -0
  23. package/dist/src/middleware/auth.js +266 -0
  24. package/dist/src/middleware/cors-config.js +111 -0
  25. package/dist/src/middleware/logger.js +116 -0
  26. package/dist/src/middleware/rate-limit.js +110 -0
  27. package/dist/src/middleware/reject-query-api-key.js +45 -0
  28. package/dist/src/middleware/security-headers.js +41 -0
  29. package/dist/src/middleware/telemetry.js +134 -0
  30. package/dist/src/models/payment.js +2 -0
  31. package/dist/src/routes/analytics.js +1447 -0
  32. package/dist/src/routes/app-routes.js +32 -0
  33. package/dist/src/routes/auth-routes.js +505 -0
  34. package/dist/src/routes/oauth-routes.js +325 -0
  35. package/dist/src/routes/payment-routes.js +186 -0
  36. package/dist/src/routes/persona-catalog-routes.js +84 -0
  37. package/dist/src/services/admin-service.js +229 -0
  38. package/dist/src/services/audit-log-persistence.js +60 -0
  39. package/dist/src/services/audit-log.js +69 -0
  40. package/dist/src/services/cookie-service.js +129 -0
  41. package/dist/src/services/dashboard-access.js +27 -0
  42. package/dist/src/services/demo-seed-service.js +139 -0
  43. package/dist/src/services/email-code.js +23 -0
  44. package/dist/src/services/email-service-clean.js +782 -0
  45. package/dist/src/services/email-service.js +951 -0
  46. package/dist/src/services/installer-service.js +131 -0
  47. package/dist/src/services/mcp-oauth-store.js +33 -0
  48. package/dist/src/services/mcp-service.js +823 -0
  49. package/dist/src/services/oauth-helpers.js +127 -0
  50. package/dist/src/services/org-service.js +89 -0
  51. package/dist/src/services/persona-entitlement-service.js +288 -0
  52. package/dist/src/services/provider-service.js +215 -0
  53. package/dist/src/services/registry-service.js +628 -0
  54. package/dist/src/services/session-service.js +86 -0
  55. package/dist/src/services/trial-reminder-service.js +120 -0
  56. package/dist/src/services/usage-analytics-service.js +419 -0
  57. package/dist/src/services/workspace-identity.js +21 -0
  58. package/dist/src/types/analytics.js +2 -0
  59. package/dist/src/utils/payment-calculator.js +52 -0
  60. package/extensions/office-word/favicon.ico +0 -0
  61. package/extensions/office-word/icon-64.png +0 -0
  62. package/extensions/office-word/manifest.xml +33 -0
  63. package/extensions/office-word/taskpane.html +242 -0
  64. package/package.json +12 -2
@@ -0,0 +1,215 @@
1
+ "use strict";
2
+ // Server-side provider service
3
+ // This is the single source of truth for provider definitions
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.providerService = exports.ProviderService = void 0;
6
+ // Provider Registry - Server-side single source of truth
7
+ const PROVIDERS = {
8
+ github: {
9
+ id: 'github',
10
+ name: 'GitHub',
11
+ displayName: 'GitHub',
12
+ description: 'GitHub repository and issue management',
13
+ capabilities: ['code', 'issues', 'integrated'],
14
+ docsUrl: 'https://github.com/settings/tokens',
15
+ setupInstructions: 'Run "fraim add-provider github" — your IDE handles OAuth automatically on first use',
16
+ mcpServer: {
17
+ type: 'http',
18
+ url: 'https://api.githubcopilot.com/mcp/'
19
+ }
20
+ },
21
+ gitlab: {
22
+ id: 'gitlab',
23
+ name: 'GitLab',
24
+ displayName: 'GitLab',
25
+ description: 'GitLab repository and issue management',
26
+ capabilities: ['code', 'issues', 'integrated'],
27
+ docsUrl: 'https://gitlab.com/-/profile/personal_access_tokens',
28
+ setupInstructions: 'Create a Personal Access Token at https://gitlab.com/-/profile/personal_access_tokens with api scope',
29
+ mcpServer: {
30
+ type: 'http',
31
+ url: 'https://gitlab.com/api/v4/mcp',
32
+ authHeaderTemplate: 'Bearer {token}'
33
+ }
34
+ },
35
+ ado: {
36
+ id: 'ado',
37
+ name: 'Azure DevOps',
38
+ displayName: 'Azure DevOps',
39
+ description: 'Azure DevOps repository and work item management',
40
+ capabilities: ['code', 'issues', 'integrated'],
41
+ configRequirements: [
42
+ {
43
+ key: 'organization',
44
+ displayName: 'Azure DevOps Organization',
45
+ description: 'Your Azure DevOps organization name (for example, contoso)',
46
+ required: true,
47
+ type: 'string',
48
+ cliOptionName: 'organization'
49
+ }
50
+ ],
51
+ docsUrl: 'https://dev.azure.com',
52
+ setupInstructions: 'Create a Personal Access Token in Azure DevOps with Code (Read & Write) and Work Items (Read & Write) scopes',
53
+ mcpServer: {
54
+ type: 'stdio',
55
+ command: 'npx',
56
+ args: ['-y', '@azure-devops/mcp', '{config.organization}', '--authentication', 'envvar'],
57
+ envTemplate: {
58
+ ADO_MCP_AUTH_TOKEN: '{token}'
59
+ }
60
+ }
61
+ },
62
+ jira: {
63
+ id: 'jira',
64
+ name: 'Jira',
65
+ displayName: 'Jira',
66
+ description: 'Jira issue tracking and project management',
67
+ capabilities: ['issues'],
68
+ configRequirements: [
69
+ {
70
+ key: 'baseUrl',
71
+ displayName: 'Jira Base URL',
72
+ description: 'Your Jira instance URL (e.g., yourcompany.atlassian.net)',
73
+ required: true,
74
+ type: 'url',
75
+ cliOptionName: 'url',
76
+ validation: {
77
+ pattern: '^https?://.*',
78
+ errorMessage: 'Must be a valid URL'
79
+ }
80
+ },
81
+ {
82
+ key: 'email',
83
+ displayName: 'Email',
84
+ description: 'Your Jira account email address',
85
+ required: true,
86
+ type: 'email',
87
+ validation: {
88
+ pattern: '^[^@]+@[^@]+\\.[^@]+$',
89
+ errorMessage: 'Must be a valid email address'
90
+ }
91
+ }
92
+ ],
93
+ docsUrl: 'https://id.atlassian.com/manage-profile/security/api-tokens',
94
+ setupInstructions: 'Create an API Token at https://id.atlassian.com/manage-profile/security/api-tokens',
95
+ mcpServer: {
96
+ type: 'stdio',
97
+ command: 'uvx',
98
+ args: ['mcp-atlassian'],
99
+ envTemplate: {
100
+ JIRA_URL: '{config.baseUrl}',
101
+ JIRA_USERNAME: '{config.email}',
102
+ JIRA_API_TOKEN: '{token}'
103
+ }
104
+ }
105
+ }
106
+ };
107
+ class ProviderService {
108
+ /**
109
+ * Get all providers with computed hasAdditionalConfig
110
+ */
111
+ getAllProviders() {
112
+ return Object.values(PROVIDERS).map(provider => ({
113
+ ...provider,
114
+ hasAdditionalConfig: (provider.configRequirements?.length || 0) > 0
115
+ }));
116
+ }
117
+ /**
118
+ * Get a specific provider by ID with computed hasAdditionalConfig
119
+ */
120
+ getProvider(id) {
121
+ const provider = PROVIDERS[id];
122
+ if (!provider)
123
+ return null;
124
+ return {
125
+ ...provider,
126
+ hasAdditionalConfig: (provider.configRequirements?.length || 0) > 0
127
+ };
128
+ }
129
+ /**
130
+ * Get all provider IDs
131
+ */
132
+ getAllProviderIds() {
133
+ return Object.keys(PROVIDERS);
134
+ }
135
+ /**
136
+ * Check if a provider ID is valid
137
+ */
138
+ isValidProviderId(id) {
139
+ return id in PROVIDERS;
140
+ }
141
+ /**
142
+ * Get providers with a specific capability
143
+ */
144
+ getProvidersWithCapability(capability) {
145
+ return this.getAllProviders().filter(provider => provider.capabilities.includes(capability));
146
+ }
147
+ /**
148
+ * Check if a provider has a specific capability
149
+ */
150
+ providerHasCapability(providerId, capability) {
151
+ const provider = this.getProvider(providerId);
152
+ return provider ? provider.capabilities.includes(capability) : false;
153
+ }
154
+ /**
155
+ * Get config requirements for a provider
156
+ */
157
+ getProviderConfigRequirements(providerId) {
158
+ const provider = this.getProvider(providerId);
159
+ return provider?.configRequirements || [];
160
+ }
161
+ /**
162
+ * Check if a provider requires additional config
163
+ */
164
+ requiresAdditionalConfig(providerId) {
165
+ const requirements = this.getProviderConfigRequirements(providerId);
166
+ return requirements.length > 0;
167
+ }
168
+ /**
169
+ * Validate provider config against requirements
170
+ */
171
+ validateProviderConfig(providerId, config) {
172
+ const requirements = this.getProviderConfigRequirements(providerId);
173
+ const errors = [];
174
+ for (const req of requirements) {
175
+ const value = config[req.key];
176
+ // Check required fields
177
+ if (req.required && !value) {
178
+ errors.push({
179
+ field: req.key,
180
+ message: `${req.displayName} is required`
181
+ });
182
+ continue;
183
+ }
184
+ // Validate pattern if provided
185
+ if (value && req.validation?.pattern) {
186
+ const regex = new RegExp(req.validation.pattern);
187
+ if (!regex.test(value)) {
188
+ errors.push({
189
+ field: req.key,
190
+ message: req.validation.errorMessage || `Invalid ${req.displayName}`
191
+ });
192
+ }
193
+ }
194
+ }
195
+ return {
196
+ valid: errors.length === 0,
197
+ errors
198
+ };
199
+ }
200
+ /**
201
+ * Get provider schema (for CLI to render prompts)
202
+ */
203
+ getProviderSchema(providerId) {
204
+ const provider = this.getProvider(providerId);
205
+ if (!provider)
206
+ return null;
207
+ return {
208
+ providerId,
209
+ configRequirements: provider.configRequirements || []
210
+ };
211
+ }
212
+ }
213
+ exports.ProviderService = ProviderService;
214
+ // Export singleton instance
215
+ exports.providerService = new ProviderService();