backend-manager 3.2.174 → 3.2.176

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backend-manager",
3
- "version": "3.2.174",
3
+ "version": "3.2.176",
4
4
  "description": "Quick tools for developing Firebase functions",
5
5
  "main": "src/manager/index.js",
6
6
  "bin": {
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@firebase/rules-unit-testing": "^2.0.7",
45
- "@google-cloud/storage": "^7.11.2",
45
+ "@google-cloud/storage": "^7.11.3",
46
46
  "@octokit/rest": "^19.0.13",
47
47
  "@sendgrid/mail": "^7.7.0",
48
48
  "@sentry/node": "^6.19.7",
@@ -52,13 +52,13 @@
52
52
  "cors": "^2.8.5",
53
53
  "dotenv": "^16.4.5",
54
54
  "express": "^4.19.2",
55
- "firebase-admin": "^12.1.1",
55
+ "firebase-admin": "^12.2.0",
56
56
  "firebase-functions": "^5.0.1",
57
57
  "fs-jetpack": "^5.1.0",
58
- "glob": "^10.4.2",
58
+ "glob": "^11.0.0",
59
59
  "hcaptcha": "^0.1.1",
60
60
  "inquirer": "^8.2.5",
61
- "itwcw-package-analytics": "^1.0.4",
61
+ "itwcw-package-analytics": "^1.0.6",
62
62
  "json5": "^2.2.3",
63
63
  "jwt-decode": "^3.1.2",
64
64
  "lodash": "^4.17.21",
@@ -69,7 +69,7 @@
69
69
  "moment": "^2.30.1",
70
70
  "nanoid": "^3.3.7",
71
71
  "node-fetch": "^2.7.0",
72
- "node-powertools": "^1.4.4",
72
+ "node-powertools": "^1.4.5",
73
73
  "npm-api": "^1.0.1",
74
74
  "paypal-server-api": "^2.0.14",
75
75
  "pushid": "^1.0.0",
@@ -85,6 +85,6 @@
85
85
  "yargs": "^17.7.2"
86
86
  },
87
87
  "devDependencies": {
88
- "prepare-package": "^1.1.12"
88
+ "prepare-package": "^1.1.13"
89
89
  }
90
- }
90
+ }
@@ -21,6 +21,11 @@ Module.prototype.main = function () {
21
21
  return reject(assistant.errorify(`<path> parameter required`, {code: 400}));
22
22
  }
23
23
 
24
+ // Log
25
+ assistant.log(`main(): Read`,
26
+ payload.data.payload.path,
27
+ );
28
+
24
29
  // Read from Firestore
25
30
  self.libraries.admin.database().ref(payload.data.payload.path)
26
31
  .on('value', (snapshot) => {
@@ -22,6 +22,12 @@ Module.prototype.main = function () {
22
22
  return reject(assistant.errorify(`<path> parameter required`, {code: 400}));
23
23
  }
24
24
 
25
+ // Log
26
+ assistant.log(`main(): Write`,
27
+ payload.data.payload.path,
28
+ payload.data.payload.document,
29
+ );
30
+
25
31
  // Write to Firestore
26
32
  self.libraries.admin.database().ref(payload.data.payload.path)
27
33
  .set(payload.data.payload.document)
@@ -20,9 +20,14 @@ Module.prototype.main = function () {
20
20
 
21
21
  // Run queries
22
22
  self.docs = [];
23
- assistant.log('Queries', payload.data.payload.queries);
24
23
  let queries = powertools.arrayify(payload.data.payload.queries || []);
25
24
 
25
+ // Log
26
+ assistant.log(`main(): Queries`,
27
+ payload.data.payload.queries,
28
+ );
29
+
30
+ // Run the queries
26
31
  let promises = [];
27
32
  for (var i = 0; i < queries.length; i++) {
28
33
  queries[i]
@@ -21,6 +21,11 @@ Module.prototype.main = function () {
21
21
  return reject(assistant.errorify(`<path> parameter required`, {code: 400}));
22
22
  }
23
23
 
24
+ // Log
25
+ assistant.log(`main(): Reading`,
26
+ payload.data.payload.path,
27
+ );
28
+
24
29
  // Read from Firestore
25
30
  await self.libraries.admin.firestore().doc(payload.data.payload.path)
26
31
  .get()
@@ -37,6 +37,13 @@ Module.prototype.main = function () {
37
37
  // Delete metadataTag
38
38
  delete payload.data.payload.options.metadataTag;
39
39
 
40
+ // Log
41
+ assistant.log(`main(): Writing`,
42
+ payload.data.payload.path,
43
+ payload.data.payload.document,
44
+ payload.data.payload.options
45
+ );
46
+
40
47
  // Write to Firestore
41
48
  await self.libraries.admin.firestore().doc(payload.data.payload.path)
42
49
  .set(payload.data.payload.document, payload.data.payload.options)
@@ -434,8 +434,8 @@ Module.prototype.sendWelcomeEmail = function (user) {
434
434
  I'm Ian, the founder and CEO of <strong>${Manager.config.brand.name}</strong>, and I'm thrilled to have you with us.
435
435
  Your journey begins today, and we are committed to supporting you every step of the way.
436
436
  <br><br>
437
+ We are dedicated to ensuring your experience is exceptional.
437
438
  Feel free to reply directly to this email with any questions you may have.
438
- Our team and I are dedicated to ensuring your experience is exceptional.
439
439
  <br><br>
440
440
  Thank you for choosing <strong>${Manager.config.brand.name}</strong>. Here's to new beginnings!
441
441
  `
@@ -88,10 +88,10 @@ function Analytics(Manager, options) {
88
88
  : 'None',
89
89
  },
90
90
  country: {
91
- value: self.request.country
91
+ value: self.request.country,
92
92
  },
93
93
  city: {
94
- value: self.request.city
94
+ value: self.request.city,
95
95
  },
96
96
  gender: {
97
97
  value: authUser?.personal?.gender
@@ -228,7 +228,7 @@ Analytics.prototype.event = function (payload) {
228
228
  payload = payload || {};
229
229
 
230
230
  // Fix event name
231
- payload.name = (payload.name || '')
231
+ payload.name = `${payload.name}`
232
232
  // Replace anything not a letter, number, or underscore with an underscore
233
233
  .replace(/[^a-zA-Z0-9_]/g, '_')
234
234
  // Remove leading and trailing underscores
@@ -4,37 +4,61 @@ const powertools = require('node-powertools');
4
4
  const _ = require('lodash');
5
5
  const JSON5 = require('json5');
6
6
 
7
+ // Constants
8
+ const DEFAULT_MODEL = 'gpt-4o';
7
9
  const TOKEN_COST_TABLE = {
8
- // May 13th, 2024
10
+ // Jul 18th, 2024
11
+ 'gpt-4o-mini': {
12
+ input: 0.000150,
13
+ output: 0.000600,
14
+ },
9
15
  'gpt-4o': {
10
- input: 0.0050,
11
- output: 0.0150,
16
+ input: 0.00500,
17
+ output: 0.01500,
12
18
  },
13
19
  'gpt-4-turbo': {
14
- input: 0.0100,
15
- output: 0.0300,
16
- },
17
- 'gpt-4-turbo-preview': {
18
- input: 0.0100,
19
- output: 0.0300,
20
- },
21
- 'gpt-4-vision-preview': {
22
- input: 0.0100,
23
- output: 0.0300,
24
- },
25
- 'gpt-4-1106-preview': {
26
- input: 0.0100,
27
- output: 0.0300,
20
+ input: 0.01000,
21
+ output: 0.03000,
28
22
  },
29
23
  'gpt-4': {
30
- input: 0.0300,
31
- output: 0.0600,
24
+ input: 0.03000,
25
+ output: 0.06000,
32
26
  },
33
27
  'gpt-3.5-turbo': {
34
- input: 0.0005,
35
- output: 0.0015,
28
+ input: 0.00050,
29
+ output: 0.00150,
36
30
  },
37
31
 
32
+ // // May 13th, 2024
33
+ // 'gpt-4o': {
34
+ // input: 0.0050,
35
+ // output: 0.0150,
36
+ // },
37
+ // 'gpt-4-turbo': {
38
+ // input: 0.0100,
39
+ // output: 0.0300,
40
+ // },
41
+ // 'gpt-4-turbo-preview': {
42
+ // input: 0.0100,
43
+ // output: 0.0300,
44
+ // },
45
+ // 'gpt-4-vision-preview': {
46
+ // input: 0.0100,
47
+ // output: 0.0300,
48
+ // },
49
+ // 'gpt-4-1106-preview': {
50
+ // input: 0.0100,
51
+ // output: 0.0300,
52
+ // },
53
+ // 'gpt-4': {
54
+ // input: 0.0300,
55
+ // output: 0.0600,
56
+ // },
57
+ // 'gpt-3.5-turbo': {
58
+ // input: 0.0005,
59
+ // output: 0.0015,
60
+ // },
61
+
38
62
  // // Apr 9th, 2024
39
63
  // 'gpt-4-turbo': {
40
64
  // input: 0.0100,
@@ -142,7 +166,7 @@ OpenAI.prototype.request = function (options) {
142
166
  return new Promise(async function(resolve, reject) {
143
167
  options = _.merge({}, options);
144
168
 
145
- options.model = typeof options.model === 'undefined' ? 'gpt-3.5-turbo' : options.model;
169
+ options.model = typeof options.model === 'undefined' ? DEFAULT_MODEL : options.model;
146
170
  options.timeout = typeof options.timeout === 'undefined' ? 120000 : options.timeout;
147
171
  options.moderate = typeof options.moderate === 'undefined' ? true : options.moderate;
148
172
  options.log = typeof options.log === 'undefined' ? false : options.log;