backend-manager 2.5.104 → 2.5.105

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.105",
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', {
@@ -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