backend-manager 2.5.104 → 2.5.106

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": "2.5.104",
3
+ "version": "2.5.106",
4
4
  "description": "Quick tools for developing Firebase functions",
5
5
  "main": "src/manager/index.js",
6
6
  "bin": {
@@ -1,6 +1,7 @@
1
1
  const fetch = require('node-fetch');
2
+ const wonderfulFetch = require('wonderful-fetch');
2
3
  const Poster = require('ultimate-jekyll-poster');
3
- const pathApi = require('path');
4
+ const pathApi = require('path');
4
5
  const { get } = require('lodash');
5
6
 
6
7
  function Module() {
@@ -47,6 +48,20 @@ Module.prototype.main = function () {
47
48
  return reject(assistant.errorManager(`Failed to post: ${finalPost}`, {code: 500, sentry: false, send: false, log: false}).error)
48
49
  }
49
50
 
51
+ // Request indexing
52
+ try {
53
+ const url = get(self.Manager.config, 'brand.url');
54
+ const encoded = encodeURIComponent(`${url}/sitemap.xml`);
55
+
56
+ wonderfulFetch(`https://www.google.com/ping?sitemap=${encoded}`)
57
+
58
+ // TODO
59
+ // https://developers.google.com/search/apis/indexing-api/v3/prereqs
60
+ // https://developers.google.com/search/apis/indexing-api/v3/using-api#url
61
+ } catch (e) {
62
+ assistant.error(`Failed to ping google: ${e}`);
63
+ }
64
+
50
65
  // Save post OR commit
51
66
  await createFile(get(self.Manager.config, 'github.user'), repoInfo.user, repoInfo.name, get(self.Manager.config, 'github.key'), poster.removeDirDot(finalPost.path), finalPost.content)
52
67
  .then(() => {
@@ -139,7 +154,9 @@ function makeRequest(options) {
139
154
  return new Promise(function(resolve, reject) {
140
155
  options.headers = options.headers || {};
141
156
  options.headers['Content-Type'] = 'application/json';
157
+
142
158
  let hasBody = Object.keys(options.body || {}).length > 0
159
+
143
160
  fetch(options.url, {
144
161
  method: options.method,
145
162
  body: hasBody ? JSON.stringify(options.body) : undefined,
@@ -30,7 +30,7 @@ Module.prototype.main = function () {
30
30
  self._notificationPayload.notification.title = self.payload.data.payload.title || self.payload.data.payload.notification.title || 'Notification';
31
31
  self._notificationPayload.notification.click_action = self.payload.data.payload.click_action || self.payload.data.payload.notification.click_action || 'https://itwcreativeworks.com';
32
32
  self._notificationPayload.notification.body = self.payload.data.payload.body || self.payload.data.payload.notification.body || 'Check this out';
33
- self._notificationPayload.notification.icon = self.payload.data.payload.icon || self.payload.data.payload.notification.icon || self.Manager.config.brand.brandmark || 'https://cdn.itwcreativeworks.com/assets/itw-creative-works/images/socials/itw-creative-works-brandmark-black-1024x1024.png';
33
+ self._notificationPayload.notification.icon = self.payload.data.payload.icon || self.payload.data.payload.notification.icon || self.Manager.config.brand.brandmark || 'https://cdn.itwcreativeworks.com/assets/itw-creative-works/images/socials/itw-creative-works-brandmark-square-black-1024x1024.png';
34
34
 
35
35
  try {
36
36
  self._notificationPayload.notification.click_action = new URL(self._notificationPayload.notification.click_action);
@@ -20,7 +20,7 @@ Module.prototype.main = function () {
20
20
 
21
21
  const url = 'https://itwcreativeworks.com';
22
22
  const title = 'https://itwcreativeworks.com';
23
- const icon = 'https://cdn.itwcreativeworks.com/assets/itw-creative-works/images/socials/itw-creative-works-brandmark-black-1024x1024.png?cb=1651834176';
23
+ const icon = 'https://cdn.itwcreativeworks.com/assets/itw-creative-works/images/socials/itw-creative-works-brandmark-square-black-1024x1024.png?cb=1651834176';
24
24
 
25
25
 
26
26
  await Api.import('admin:send-notification', {
@@ -40,7 +40,7 @@ Module.prototype.main = function () {
40
40
  : payload.data.payload.redirect
41
41
 
42
42
  payload.data.payload.referrer = typeof payload.data.payload.referrer === 'undefined'
43
- ? (assistant.meta.environment === 'development' ? `http://localhost:4000/authentication/account` : `${Manager.config.brand.url}/authentication/account`)
43
+ ? (assistant.meta.environment === 'development' ? `http://localhost:4000/account` : `${Manager.config.brand.url}/account`)
44
44
  : payload.data.payload.referrer
45
45
 
46
46
  payload.data.payload.serverUrl = typeof payload.data.payload.serverUrl === 'undefined'
@@ -73,7 +73,7 @@ SubscriptionResolver.prototype.resolve = function (options) {
73
73
  ) {
74
74
  profile.processor = 'paypal';
75
75
  profile.type = profile.type || 'order';
76
- // Order
76
+ // Subscription
77
77
  } else if (
78
78
  // resource.billing_info
79
79
  resource.create_time
@@ -84,15 +84,15 @@ function User(Manager, settings, options) {
84
84
  timestampUNIX: _.get(settings, 'activity.created.timestampUNIX', useDefaults ? nowUNIX : null),
85
85
  },
86
86
  geolocation: {
87
- ip: _.get(settings, 'activity.geolocation.ip', useDefaults ? 'unknown' : null),
88
- continent: _.get(settings, 'activity.geolocation.continent', useDefaults ? 'unknown' : null),
89
- country: _.get(settings, 'activity.geolocation.country', useDefaults ? 'unknown' : null),
90
- city: _.get(settings, 'activity.geolocation.city', useDefaults ? 'unknown' : null),
91
- latitude: _.get(settings, 'activity.geolocation.latitude', useDefaults ? 'unknown' : null),
92
- longitude: _.get(settings, 'activity.geolocation.longitude', useDefaults ? 'unknown' : null),
93
- userAgent: _.get(settings, 'activity.geolocation.userAgent', useDefaults ? 'unknown' : null),
94
- language: _.get(settings, 'activity.geolocation.language', useDefaults ? 'unknown' : null),
95
- platform: _.get(settings, 'activity.geolocation.platform', useDefaults ? 'unknown' : null),
87
+ ip: _.get(settings, 'activity.geolocation.ip', useDefaults ? '' : null),
88
+ continent: _.get(settings, 'activity.geolocation.continent', useDefaults ? '' : null),
89
+ country: _.get(settings, 'activity.geolocation.country', useDefaults ? '' : null),
90
+ city: _.get(settings, 'activity.geolocation.city', useDefaults ? '' : null),
91
+ latitude: _.get(settings, 'activity.geolocation.latitude', useDefaults ? 0 : null),
92
+ longitude: _.get(settings, 'activity.geolocation.longitude', useDefaults ? 0 : null),
93
+ userAgent: _.get(settings, 'activity.geolocation.userAgent', useDefaults ? '' : null),
94
+ language: _.get(settings, 'activity.geolocation.language', useDefaults ? '' : null),
95
+ platform: _.get(settings, 'activity.geolocation.platform', useDefaults ? '' : null),
96
96
  },
97
97
  },
98
98
  api: {
@@ -104,14 +104,14 @@ function User(Manager, settings, options) {
104
104
  timestamp: _.get(settings, 'personal.birthday.timestamp', useDefaults ? oldDate : null),
105
105
  timestampUNIX: _.get(settings, 'personal.birthday.timestampUNIX', useDefaults ? oldDateUNIX : null),
106
106
  },
107
- gender: _.get(settings, 'personal.gender', useDefaults ? 'undisclosed' : null),
107
+ gender: _.get(settings, 'personal.gender', useDefaults ? '' : null),
108
108
  location: {
109
- city: _.get(settings, 'personal.location.city', useDefaults ? 'undisclosed' : null),
110
- country: _.get(settings, 'personal.location.country', useDefaults ? 'ZZ' : null),
109
+ city: _.get(settings, 'personal.location.city', useDefaults ? '' : null),
110
+ country: _.get(settings, 'personal.location.country', useDefaults ? '' : null),
111
111
  },
112
112
  name: {
113
- first: _.get(settings, 'personal.name.first', useDefaults ? 'undisclosed' : null),
114
- last: _.get(settings, 'personal.name.last', useDefaults ? 'undisclosed' : null),
113
+ first: _.get(settings, 'personal.name.first', useDefaults ? '' : null),
114
+ last: _.get(settings, 'personal.name.last', useDefaults ? '' : null),
115
115
  },
116
116
  telephone: {
117
117
  countryCode: _.get(settings, 'personal.telephone.countryCode', useDefaults ? 0 : null),