@friggframework/core 2.0.0--canary.419.daed467.0 → 2.0.0--canary.419.e82b061.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 (2) hide show
  1. package/database/mongo.js +45 -20
  2. package/package.json +5 -5
package/database/mongo.js CHANGED
@@ -25,7 +25,10 @@ try {
25
25
  }
26
26
  }
27
27
  } catch (error) {
28
- debug('Could not load app definition for DocumentDB configuration:', error.message);
28
+ debug(
29
+ 'Could not load app definition for DocumentDB configuration:',
30
+ error.message
31
+ );
29
32
  }
30
33
 
31
34
  // Buffering means mongoose will queue up operations if it gets
@@ -39,63 +42,85 @@ const mongoConfig = {
39
42
  serverSelectionTimeoutMS: 5000,
40
43
  };
41
44
 
45
+ console.log('📁 AppDefinition content:', JSON.stringify(appDefinition));
46
+
42
47
  // Add DocumentDB TLS configuration if enabled
43
48
  if (appDefinition.database?.documentDB?.enable === true) {
44
49
  console.log('📄 DocumentDB configuration detected, enabling TLS');
45
50
  console.log('📁 Current working directory:', process.cwd());
46
- console.log('📋 App definition database config:', JSON.stringify(appDefinition.database, null, 2));
47
-
51
+ console.log(
52
+ '📋 App definition database config:',
53
+ JSON.stringify(appDefinition.database, null, 2)
54
+ );
55
+
48
56
  mongoConfig.tls = true;
49
-
57
+
50
58
  // Set TLS CA file path if specified
51
59
  if (appDefinition.database.documentDB.tlsCAFile) {
52
60
  const tlsCAFile = appDefinition.database.documentDB.tlsCAFile;
53
-
61
+
54
62
  // Basic safety: reject obviously dangerous paths
55
63
  if (tlsCAFile.includes('..') || path.isAbsolute(tlsCAFile)) {
56
- console.warn('⚠️ Rejecting potentially unsafe tlsCAFile path:', tlsCAFile);
64
+ console.warn(
65
+ '⚠️ Rejecting potentially unsafe tlsCAFile path:',
66
+ tlsCAFile
67
+ );
57
68
  } else {
58
69
  const tlsCAFilePath = path.resolve(process.cwd(), tlsCAFile);
59
-
70
+
60
71
  console.log('📄 DocumentDB TLS CA file configured:');
61
72
  console.log(' 📎 Original path:', tlsCAFile);
62
73
  console.log(' 📎 Resolved path:', tlsCAFilePath);
63
74
  console.log(' 📄 File exists:', fs.existsSync(tlsCAFilePath));
64
-
75
+
65
76
  // Only set tlsCAFile if the file actually exists
66
77
  if (fs.existsSync(tlsCAFilePath)) {
67
78
  mongoConfig.tlsCAFile = tlsCAFilePath;
68
79
  console.log('✅ TLS CA file configured successfully');
69
80
  } else {
70
- console.error('❌ TLS CA file not found, continuing without certificate');
81
+ console.error(
82
+ '❌ TLS CA file not found, continuing without certificate'
83
+ );
71
84
  }
72
-
85
+
73
86
  // Debug directory listing (only in development)
74
87
  if (process.env.NODE_ENV !== 'production') {
75
88
  try {
76
89
  console.log('📁 Current directory contents:');
77
- fs.readdirSync(process.cwd()).forEach(item => {
78
- const stats = fs.statSync(path.join(process.cwd(), item));
79
- console.log(` ${stats.isDirectory() ? '📁' : '📄'} ${item}`);
90
+ fs.readdirSync(process.cwd()).forEach((item) => {
91
+ const stats = fs.statSync(
92
+ path.join(process.cwd(), item)
93
+ );
94
+ console.log(
95
+ ` ${stats.isDirectory() ? '📁' : '📄'} ${item}`
96
+ );
80
97
  });
81
-
98
+
82
99
  const securityDir = path.join(process.cwd(), 'security');
83
100
  if (fs.existsSync(securityDir)) {
84
101
  console.log('📁 Security directory contents:');
85
- fs.readdirSync(securityDir).forEach(item => {
102
+ fs.readdirSync(securityDir).forEach((item) => {
86
103
  console.log(` 📄 ${item}`);
87
104
  });
88
105
  } else {
89
- console.log('❌ Security directory does not exist at:', securityDir);
106
+ console.log(
107
+ '❌ Security directory does not exist at:',
108
+ securityDir
109
+ );
90
110
  }
91
111
  } catch (error) {
92
- console.log('❌ Error listing directory contents:', error.message);
112
+ console.log(
113
+ '❌ Error listing directory contents:',
114
+ error.message
115
+ );
93
116
  }
94
117
  }
95
118
  }
96
119
  }
97
120
  } else {
98
- console.log('📄 DocumentDB not enabled, using standard MongoDB configuration');
121
+ console.log(
122
+ '📄 DocumentDB not enabled, using standard MongoDB configuration'
123
+ );
99
124
  }
100
125
 
101
126
  const checkIsConnected = () => mongoose.connection?.readyState > 0;
@@ -109,10 +134,10 @@ const connectToDatabase = async () => {
109
134
  console.log('🔗 Connecting to database...');
110
135
  console.log('🔗 MongoDB URI:', process.env.MONGO_URI ? 'SET' : 'NOT SET');
111
136
  console.log('🔧 Final mongoConfig:', JSON.stringify(mongoConfig, null, 2));
112
-
137
+
113
138
  debug('=> using new database connection');
114
139
  await mongoose.connect(process.env.MONGO_URI, mongoConfig);
115
- debug('Connection state:', mongoose.STATES[mongoose.connection.readyState]);
140
+ debug('Connection state:', mongoose.STATES[mongoose.connection.readyState]);
116
141
  mongoose.connection.on('error', (error) => flushDebugLog(error));
117
142
  };
118
143
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@friggframework/core",
3
3
  "prettier": "@friggframework/prettier-config",
4
- "version": "2.0.0--canary.419.daed467.0",
4
+ "version": "2.0.0--canary.419.e82b061.0",
5
5
  "dependencies": {
6
6
  "@hapi/boom": "^10.0.1",
7
7
  "aws-sdk": "^2.1200.0",
@@ -22,9 +22,9 @@
22
22
  "uuid": "^9.0.1"
23
23
  },
24
24
  "devDependencies": {
25
- "@friggframework/eslint-config": "2.0.0--canary.419.daed467.0",
26
- "@friggframework/prettier-config": "2.0.0--canary.419.daed467.0",
27
- "@friggframework/test": "2.0.0--canary.419.daed467.0",
25
+ "@friggframework/eslint-config": "2.0.0--canary.419.e82b061.0",
26
+ "@friggframework/prettier-config": "2.0.0--canary.419.e82b061.0",
27
+ "@friggframework/test": "2.0.0--canary.419.e82b061.0",
28
28
  "@types/lodash": "4.17.15",
29
29
  "@typescript-eslint/eslint-plugin": "^8.0.0",
30
30
  "chai": "^4.3.6",
@@ -56,5 +56,5 @@
56
56
  "publishConfig": {
57
57
  "access": "public"
58
58
  },
59
- "gitHead": "daed467862dc5acc37b4dd9e48ea62444da598be"
59
+ "gitHead": "e82b061425a3503af2280f0704c34934f3237c35"
60
60
  }