@equilateral_ai/mindmeld 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +300 -0
- package/hooks/README.md +494 -0
- package/hooks/pre-compact.js +392 -0
- package/hooks/session-start.js +264 -0
- package/package.json +90 -0
- package/scripts/harvest.js +561 -0
- package/scripts/init-project.js +437 -0
- package/scripts/inject.js +388 -0
- package/src/collaboration/CollaborationPrompt.js +460 -0
- package/src/core/AlertEngine.js +813 -0
- package/src/core/AlertNotifier.js +363 -0
- package/src/core/CorrelationAnalyzer.js +774 -0
- package/src/core/CurationEngine.js +688 -0
- package/src/core/LLMPatternDetector.js +508 -0
- package/src/core/LoadBearingDetector.js +242 -0
- package/src/core/NotificationService.js +1032 -0
- package/src/core/PatternValidator.js +355 -0
- package/src/core/README.md +160 -0
- package/src/core/RapportOrchestrator.js +446 -0
- package/src/core/RelevanceDetector.js +577 -0
- package/src/core/StandardsIngestion.js +575 -0
- package/src/core/TeamLoadBearingDetector.js +431 -0
- package/src/database/dbOperations.js +105 -0
- package/src/handlers/activity/activityGetMe.js +98 -0
- package/src/handlers/activity/activityGetTeam.js +130 -0
- package/src/handlers/alerts/alertsAcknowledge.js +91 -0
- package/src/handlers/alerts/alertsGet.js +250 -0
- package/src/handlers/collaborators/collaboratorAdd.js +201 -0
- package/src/handlers/collaborators/collaboratorInvite.js +218 -0
- package/src/handlers/collaborators/collaboratorList.js +88 -0
- package/src/handlers/collaborators/collaboratorRemove.js +127 -0
- package/src/handlers/collaborators/inviteAccept.js +122 -0
- package/src/handlers/context/contextGet.js +57 -0
- package/src/handlers/context/invariantsGet.js +74 -0
- package/src/handlers/context/loopsGet.js +82 -0
- package/src/handlers/context/notesCreate.js +74 -0
- package/src/handlers/context/purposeGet.js +78 -0
- package/src/handlers/correlations/correlationsDeveloperGet.js +226 -0
- package/src/handlers/correlations/correlationsGet.js +93 -0
- package/src/handlers/correlations/correlationsProjectGet.js +161 -0
- package/src/handlers/github/githubConnectionStatus.js +49 -0
- package/src/handlers/github/githubDiscoverPatterns.js +364 -0
- package/src/handlers/github/githubOAuthCallback.js +166 -0
- package/src/handlers/github/githubOAuthStart.js +59 -0
- package/src/handlers/github/githubPatternsReview.js +109 -0
- package/src/handlers/github/githubReposList.js +105 -0
- package/src/handlers/helpers/checkSuperAdmin.js +85 -0
- package/src/handlers/helpers/dbOperations.js +53 -0
- package/src/handlers/helpers/errorHandler.js +49 -0
- package/src/handlers/helpers/index.js +106 -0
- package/src/handlers/helpers/lambdaWrapper.js +60 -0
- package/src/handlers/helpers/responseUtil.js +55 -0
- package/src/handlers/helpers/subscriptionTiers.js +1168 -0
- package/src/handlers/notifications/getPreferences.js +84 -0
- package/src/handlers/notifications/sendNotification.js +170 -0
- package/src/handlers/notifications/updatePreferences.js +316 -0
- package/src/handlers/patterns/patternUsagePost.js +182 -0
- package/src/handlers/patterns/patternViolationPost.js +185 -0
- package/src/handlers/projects/projectCreate.js +107 -0
- package/src/handlers/projects/projectDelete.js +82 -0
- package/src/handlers/projects/projectGet.js +95 -0
- package/src/handlers/projects/projectUpdate.js +118 -0
- package/src/handlers/reports/aiLeverage.js +206 -0
- package/src/handlers/reports/engineeringInvestment.js +132 -0
- package/src/handlers/reports/riskForecast.js +186 -0
- package/src/handlers/reports/standardsRoi.js +162 -0
- package/src/handlers/scheduled/analyzeCorrelations.js +178 -0
- package/src/handlers/scheduled/analyzeGitHistory.js +510 -0
- package/src/handlers/scheduled/generateAlerts.js +135 -0
- package/src/handlers/scheduled/refreshActivity.js +21 -0
- package/src/handlers/scheduled/scanCompliance.js +334 -0
- package/src/handlers/sessions/sessionEndPost.js +180 -0
- package/src/handlers/sessions/sessionStandardsPost.js +135 -0
- package/src/handlers/stripe/addonManagePost.js +240 -0
- package/src/handlers/stripe/billingPortalPost.js +93 -0
- package/src/handlers/stripe/enterpriseCheckoutPost.js +272 -0
- package/src/handlers/stripe/seatsUpdatePost.js +185 -0
- package/src/handlers/stripe/subscriptionCancelDelete.js +169 -0
- package/src/handlers/stripe/subscriptionCreatePost.js +221 -0
- package/src/handlers/stripe/subscriptionUpdatePut.js +163 -0
- package/src/handlers/stripe/webhookPost.js +454 -0
- package/src/handlers/users/cognitoPostConfirmation.js +150 -0
- package/src/handlers/users/userEntitlementsGet.js +89 -0
- package/src/handlers/users/userGet.js +114 -0
- package/src/handlers/webhooks/githubWebhook.js +223 -0
- package/src/index.js +969 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers Index
|
|
3
|
+
* Tim-Combo pattern: Re-export all helpers from single entry point
|
|
4
|
+
*
|
|
5
|
+
* Usage: const { wrapHandler, executeQuery, createSuccessResponse, handleError } = require('./helpers');
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const { wrapHandler } = require('./lambdaWrapper');
|
|
9
|
+
const { executeQuery } = require('./dbOperations');
|
|
10
|
+
const { createSuccessResponse, createErrorResponse } = require('./responseUtil');
|
|
11
|
+
const { handleError } = require('./errorHandler');
|
|
12
|
+
const {
|
|
13
|
+
getTierConfig,
|
|
14
|
+
SUBSCRIPTION_TIERS,
|
|
15
|
+
getStripePriceId,
|
|
16
|
+
checkEarlyAdopterEligibility,
|
|
17
|
+
getEarlyAdopterDiscount,
|
|
18
|
+
calculateEarlyAdopterPrice,
|
|
19
|
+
requiresCommunityContribution,
|
|
20
|
+
getPrivateTierVariant,
|
|
21
|
+
calculateTierCost,
|
|
22
|
+
checkSubscriptionLimits,
|
|
23
|
+
// Billing type functions
|
|
24
|
+
BILLING_TYPES,
|
|
25
|
+
usesStripeBilling,
|
|
26
|
+
usesInvoiceBilling,
|
|
27
|
+
isInternalClient,
|
|
28
|
+
checkCollaboratorBillingLimits,
|
|
29
|
+
getBillingTypeDisplayName,
|
|
30
|
+
// Enterprise subscription functions
|
|
31
|
+
ENTERPRISE_PACKAGES,
|
|
32
|
+
ENTERPRISE_ADDONS,
|
|
33
|
+
VOLUME_DISCOUNTS,
|
|
34
|
+
getVolumeDiscount,
|
|
35
|
+
validateSeatCount,
|
|
36
|
+
calculateEnterpriseCost,
|
|
37
|
+
getEnterprisePackage,
|
|
38
|
+
getEnterpriseAddon,
|
|
39
|
+
getAllEnterpriseAddons,
|
|
40
|
+
hasEnterpriseFeature,
|
|
41
|
+
getEnterpriseFeatures,
|
|
42
|
+
checkEnterpriseSeatLimits,
|
|
43
|
+
getEnterprisePriceId,
|
|
44
|
+
getAddonPriceId
|
|
45
|
+
} = require('./subscriptionTiers');
|
|
46
|
+
const checkSuperAdmin = require('./checkSuperAdmin');
|
|
47
|
+
|
|
48
|
+
module.exports = {
|
|
49
|
+
// Lambda wrapper
|
|
50
|
+
wrapHandler,
|
|
51
|
+
|
|
52
|
+
// Database operations
|
|
53
|
+
executeQuery,
|
|
54
|
+
|
|
55
|
+
// Response utilities
|
|
56
|
+
createSuccessResponse,
|
|
57
|
+
createErrorResponse,
|
|
58
|
+
|
|
59
|
+
// Error handling
|
|
60
|
+
handleError,
|
|
61
|
+
|
|
62
|
+
// Subscription tiers
|
|
63
|
+
getTierConfig,
|
|
64
|
+
SUBSCRIPTION_TIERS,
|
|
65
|
+
getStripePriceId,
|
|
66
|
+
calculateTierCost,
|
|
67
|
+
|
|
68
|
+
// Early adopter discount
|
|
69
|
+
checkEarlyAdopterEligibility,
|
|
70
|
+
getEarlyAdopterDiscount,
|
|
71
|
+
calculateEarlyAdopterPrice,
|
|
72
|
+
|
|
73
|
+
// Community vs Private tiers
|
|
74
|
+
requiresCommunityContribution,
|
|
75
|
+
getPrivateTierVariant,
|
|
76
|
+
|
|
77
|
+
// Subscription limits
|
|
78
|
+
checkSubscriptionLimits,
|
|
79
|
+
|
|
80
|
+
// Billing type functions
|
|
81
|
+
BILLING_TYPES,
|
|
82
|
+
usesStripeBilling,
|
|
83
|
+
usesInvoiceBilling,
|
|
84
|
+
isInternalClient,
|
|
85
|
+
checkCollaboratorBillingLimits,
|
|
86
|
+
getBillingTypeDisplayName,
|
|
87
|
+
|
|
88
|
+
// Enterprise subscription functions
|
|
89
|
+
ENTERPRISE_PACKAGES,
|
|
90
|
+
ENTERPRISE_ADDONS,
|
|
91
|
+
VOLUME_DISCOUNTS,
|
|
92
|
+
getVolumeDiscount,
|
|
93
|
+
validateSeatCount,
|
|
94
|
+
calculateEnterpriseCost,
|
|
95
|
+
getEnterprisePackage,
|
|
96
|
+
getEnterpriseAddon,
|
|
97
|
+
getAllEnterpriseAddons,
|
|
98
|
+
hasEnterpriseFeature,
|
|
99
|
+
getEnterpriseFeatures,
|
|
100
|
+
checkEnterpriseSeatLimits,
|
|
101
|
+
getEnterprisePriceId,
|
|
102
|
+
getAddonPriceId,
|
|
103
|
+
|
|
104
|
+
// Authorization
|
|
105
|
+
checkSuperAdmin
|
|
106
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lambda Wrapper Helper
|
|
3
|
+
* Standardizes request/response handling for all Rapport handlers
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
function wrapHandler(handler) {
|
|
7
|
+
return async (event, context) => {
|
|
8
|
+
try {
|
|
9
|
+
// Parse body if present
|
|
10
|
+
let body = {};
|
|
11
|
+
if (event.body) {
|
|
12
|
+
try {
|
|
13
|
+
body = JSON.parse(event.body);
|
|
14
|
+
} catch (e) {
|
|
15
|
+
console.error('Failed to parse body:', e);
|
|
16
|
+
return {
|
|
17
|
+
statusCode: 400,
|
|
18
|
+
headers: {
|
|
19
|
+
'Content-Type': 'application/json',
|
|
20
|
+
'Access-Control-Allow-Origin': '*'
|
|
21
|
+
},
|
|
22
|
+
body: JSON.stringify({
|
|
23
|
+
success: false,
|
|
24
|
+
message: 'Invalid JSON in request body'
|
|
25
|
+
})
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Call handler with standardized parameters
|
|
31
|
+
const result = await handler({
|
|
32
|
+
queryStringParameters: event.queryStringParameters || {},
|
|
33
|
+
pathParameters: event.pathParameters || {},
|
|
34
|
+
body: body,
|
|
35
|
+
requestContext: event.requestContext,
|
|
36
|
+
headers: event.headers || {},
|
|
37
|
+
httpMethod: event.httpMethod
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
return result;
|
|
41
|
+
|
|
42
|
+
} catch (error) {
|
|
43
|
+
console.error('Wrapper Error:', error);
|
|
44
|
+
return {
|
|
45
|
+
statusCode: 500,
|
|
46
|
+
headers: {
|
|
47
|
+
'Content-Type': 'application/json',
|
|
48
|
+
'Access-Control-Allow-Origin': '*'
|
|
49
|
+
},
|
|
50
|
+
body: JSON.stringify({
|
|
51
|
+
success: false,
|
|
52
|
+
message: 'Internal server error',
|
|
53
|
+
error: process.env.NODE_ENV === 'dev' ? error.message : undefined
|
|
54
|
+
})
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
module.exports = { wrapHandler };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response Utility Helper
|
|
3
|
+
* Standard response formatting for all Rapport handlers
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Create success response
|
|
8
|
+
* @param {object} data - Response data (should include Records array)
|
|
9
|
+
* @param {string} message - Success message
|
|
10
|
+
* @param {object} meta - Metadata (Total_Records, Request_ID, etc.)
|
|
11
|
+
* @returns {object} Lambda response
|
|
12
|
+
*/
|
|
13
|
+
function createSuccessResponse(data, message, meta = {}) {
|
|
14
|
+
return {
|
|
15
|
+
statusCode: 200,
|
|
16
|
+
headers: {
|
|
17
|
+
'Content-Type': 'application/json',
|
|
18
|
+
'Access-Control-Allow-Origin': '*',
|
|
19
|
+
'Access-Control-Allow-Methods': 'GET,POST,PUT,DELETE,OPTIONS',
|
|
20
|
+
'Access-Control-Allow-Headers': 'Content-Type,Authorization'
|
|
21
|
+
},
|
|
22
|
+
body: JSON.stringify({
|
|
23
|
+
success: true,
|
|
24
|
+
message,
|
|
25
|
+
data,
|
|
26
|
+
meta
|
|
27
|
+
})
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Create error response
|
|
33
|
+
* @param {number} statusCode - HTTP status code
|
|
34
|
+
* @param {string} message - Error message
|
|
35
|
+
* @param {object} details - Additional error details
|
|
36
|
+
* @returns {object} Lambda response
|
|
37
|
+
*/
|
|
38
|
+
function createErrorResponse(statusCode, message, details = {}) {
|
|
39
|
+
return {
|
|
40
|
+
statusCode,
|
|
41
|
+
headers: {
|
|
42
|
+
'Content-Type': 'application/json',
|
|
43
|
+
'Access-Control-Allow-Origin': '*',
|
|
44
|
+
'Access-Control-Allow-Methods': 'GET,POST,PUT,DELETE,OPTIONS',
|
|
45
|
+
'Access-Control-Allow-Headers': 'Content-Type,Authorization'
|
|
46
|
+
},
|
|
47
|
+
body: JSON.stringify({
|
|
48
|
+
success: false,
|
|
49
|
+
message,
|
|
50
|
+
details
|
|
51
|
+
})
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
module.exports = { createSuccessResponse, createErrorResponse };
|