@webqit/webflo 0.8.59 → 0.8.62

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
@@ -12,7 +12,7 @@
12
12
  "vanila-javascript"
13
13
  ],
14
14
  "homepage": "https://webqit.io/tooling/webflo",
15
- "version": "0.8.59",
15
+ "version": "0.8.62",
16
16
  "license": "MIT",
17
17
  "repository": {
18
18
  "type": "git",
@@ -38,7 +38,8 @@
38
38
  "@octokit/webhooks": "^7.15.1",
39
39
  "@webqit/backpack": "^0.0.37",
40
40
  "@webqit/browser-pie": "^0.0.16",
41
- "@webqit/pseudo-browser": "^0.3.36",
41
+ "@webqit/observer": "^1.7.5",
42
+ "@webqit/pseudo-browser": "^1.0.0",
42
43
  "@webqit/util": "^0.8.7",
43
44
  "client-sessions": "^0.8.0",
44
45
  "cookie": "^0.4.1",
@@ -2,7 +2,6 @@
2
2
  /**
3
3
  * @imports
4
4
  */
5
- import { Observer } from '@webqit/pseudo-browser/index2.js';
6
5
  import _isArray from '@webqit/util/js/isArray.js';
7
6
  import _isObject from '@webqit/util/js/isObject.js';
8
7
  import { wwwFormUnserialize, wwwFormSerialize } from './util.js';
@@ -70,6 +69,7 @@ const _URL = NativeURL => {
70
69
 
71
70
  constructor() {
72
71
  super(...arguments);
72
+ const { Observer } = WebQit;
73
73
  Observer.accessorize(this, [
74
74
  'protocol',
75
75
  'username',
@@ -2,13 +2,13 @@
2
2
  /**
3
3
  * @imports
4
4
  */
5
- import { Observer } from '@webqit/pseudo-browser/index2.js';
6
5
  import _before from '@webqit/util/str/before.js';
7
6
  import _after from '@webqit/util/str/after.js';
8
7
  import _toTitle from '@webqit/util/str/toTitle.js';
9
8
  import _arrFrom from '@webqit/util/arr/from.js';
10
9
  import { wwwFormUnserialize, wwwFormSet, wwwFormSerialize } from '../util.js';
11
10
  import StdRequest from './StdRequest.js';
11
+ import { Observer } from './Runtime.js';
12
12
  import Url from './Url.js';
13
13
 
14
14
  /**
@@ -16,7 +16,7 @@ import Url from './Url.js';
16
16
  * The Client class
17
17
  * ---------------------------
18
18
  */
19
-
19
+
20
20
  export default class Http {
21
21
 
22
22
  /**
@@ -208,6 +208,7 @@ export default class Http {
208
208
  }
209
209
  }, {diff: false /* method might be the difference */});
210
210
  // Startup route
211
+
211
212
  handleResponse(await client.call(instance, createRequest(window.document.location.href, document.referrer)));
212
213
 
213
214
  return instance;
@@ -2,7 +2,6 @@
2
2
  /**
3
3
  * @imports
4
4
  */
5
- import { OOHTML, Observer } from '@webqit/pseudo-browser/index2.js';
6
5
  import _isObject from '@webqit/util/js/isObject.js';
7
6
  import _before from '@webqit/util/str/before.js';
8
7
  import _unique from '@webqit/util/arr/unique.js';
@@ -13,20 +12,13 @@ import Storage from './Storage.js';
13
12
  import Router from './Router.js';
14
13
  import Http from './Http.js';
15
14
 
16
- /**
17
- * ---------------------------
18
- * OOHTML
19
- * ---------------------------
20
- */
21
-
22
- OOHTML.call(window);
23
-
24
15
  /**
25
16
  * ---------------------------
26
17
  * The Client Initializer
27
18
  * ---------------------------
28
19
  */
29
20
 
21
+ export const { Observer } = window.WebQit;
30
22
  export default function(layout, params) {
31
23
 
32
24
  const session = Storage();
@@ -153,17 +145,19 @@ export default function(layout, params) {
153
145
  // --------
154
146
 
155
147
  if (/*document.activeElement === document.body && */event && _isObject(event.detail) && (event.detail.src instanceof Element) && /* do only on url path change */ _before(event.value, '?') !== _before(event.oldValue, '?')) {
148
+ document.documentElement.classList.add('scroll-reset');
156
149
  setTimeout(() => {
157
- var urlTarget;
150
+ let vieportTop;
158
151
  if (clientNavigationEvent.url.hash && (urlTarget = document.querySelector(clientNavigationEvent.url.hash))) {
159
- urlTarget.scrollIntoView(true);
152
+ urlTarget.scrollIntoView();
153
+ } else if (vieportTop = Array.from(document.querySelectorAll('[data-viewport-top]')).pop()) {
154
+ vieportTop.focus();
160
155
  } else {
161
- document.documentElement.classList.add('scroll-reset');
162
- window.scroll({top: 0, left: 0});
163
- setTimeout(() => {
164
- document.documentElement.classList.remove('scroll-reset');
165
- }, 200);
156
+ document.body.scrollIntoView();
166
157
  }
158
+ setTimeout(() => {
159
+ document.documentElement.classList.remove('scroll-reset');
160
+ }, 600);
167
161
  }, 0);
168
162
  }
169
163
 
@@ -3,8 +3,8 @@
3
3
  /**
4
4
  * @imports
5
5
  */
6
- import { Observer } from '@webqit/pseudo-browser/index2.js';
7
6
  import { _isString, _isUndefined } from '@webqit/util/js/index.js';
7
+ import { Observer } from './Runtime.js';
8
8
 
9
9
  export default function(persistent = false) {
10
10
 
@@ -2,7 +2,6 @@
2
2
  /**
3
3
  * @imports
4
4
  */
5
- import { Observer } from '@webqit/pseudo-browser/index2.js';
6
5
  import _isArray from '@webqit/util/js/isArray.js';
7
6
  import _isObject from '@webqit/util/js/isObject.js';
8
7
  import _isTypeObject from '@webqit/util/js/isTypeObject.js';
@@ -10,12 +9,14 @@ import _isString from '@webqit/util/js/isString.js';
10
9
  import _isEmpty from '@webqit/util/js/isEmpty.js';
11
10
  import _with from '@webqit/util/obj/with.js';
12
11
  import { wwwFormUnserialize, wwwFormSerialize } from '../util.js';
12
+ import { Observer } from './Runtime.js';
13
13
 
14
14
  /**
15
15
  * ---------------------------
16
16
  * The Url class
17
17
  * ---------------------------
18
18
  */
19
+
19
20
  export default class Url {
20
21
 
21
22
  /**
@@ -5,7 +5,7 @@
5
5
  import Router from './Router.js';
6
6
  import _isGlobe from 'is-glob';
7
7
  import Minimatch from 'minimatch';
8
- import { Observer } from '@webqit/pseudo-browser/index2.js';
8
+ import Observer from '@webqit/observer';
9
9
  import _isArray from '@webqit/util/js/isArray.js';
10
10
  import _afterLast from '@webqit/util/str/afterLast.js';
11
11
  import _after from '@webqit/util/str/after.js';
@@ -19,7 +19,7 @@ import NavigationEvent from './NavigationEvent.js';
19
19
  * The Worker Initializer
20
20
  * ---------------------------
21
21
  */
22
-
22
+
23
23
  export default function(layout, params) {
24
24
 
25
25
  // Copy...
@@ -133,7 +133,7 @@ export default function(layout, params) {
133
133
  // Thus the origin server would still not be contacted by the self.fetch() below, leading to inconsistencies in responses.
134
134
  // So, we detect this scenerio and avoid it.
135
135
  if (evt.request.mode === 'navigate' && evt.request.cache === 'force-cache' && evt.request.destination === 'document') {
136
- return cache_fetch(evt/** , truecacheRefresh */);
136
+ return cache_fetch(evt, false, true);
137
137
  }
138
138
  if (_any((params.cache_first_url_list || []).map(c => c.trim()).filter(c => c), pattern => Minimatch.Minimatch(evt.request.url, pattern))) {
139
139
  return cache_fetch(evt, true/** cacheRefresh */);
@@ -152,18 +152,37 @@ export default function(layout, params) {
152
152
  : params.cache_name;
153
153
 
154
154
  // Caching strategy: cache_first
155
- const cache_fetch = (evt, cacheRefresh = false) => {
155
+ const cache_fetch = (evt, cacheRefresh = false, is_Navigate_ForceCache_Document = false) => {
156
156
 
157
157
  return self.caches.open(getCacheName(evt.request)).then(cache => {
158
158
  return cache.match(evt.request).then(response => {
159
+ const force_network_fetch = evt => {
160
+ let request = evt.request;
161
+ if (is_Navigate_ForceCache_Document) {
162
+ let url = new URL(request.url);
163
+ url.searchParams.set('$force-cache', '1');
164
+ request = new Request(url, {
165
+ method: request.method,
166
+ headers: request.headers,
167
+ body: request.body,
168
+ mode: request.mode === 'navigate' ? null : request.mode,
169
+ credentials: request.credentials,
170
+ cache: request.cache,
171
+ redirect: request.redirect,
172
+ referrer: request.referrer,
173
+ integrity: request.integrity,
174
+ });
175
+ }
176
+ return self.fetch(request);
177
+ }
159
178
  if (response) {
160
179
  if (cacheRefresh) {
161
180
  // Fetch, but return this immediately
162
- self.fetch(evt.request).then(response => refreshCache(evt.request, response));
181
+ force_network_fetch(evt).then(response => refreshCache(evt.request, response));
163
182
  }
164
183
  return response;
165
184
  }
166
- return self.fetch(evt.request).then(response => refreshCache(evt.request, response));
185
+ return force_network_fetch(evt).then(response => refreshCache(evt.request, response));
167
186
  });
168
187
  });
169
188
 
@@ -204,6 +223,8 @@ export default function(layout, params) {
204
223
  return response;
205
224
  };
206
225
 
226
+ // -----------------------------
227
+
207
228
  const relay = function(evt, messageData) {
208
229
  return self.clients.matchAll().then(clientList => {
209
230
  clientList.forEach(client => {
@@ -214,8 +235,6 @@ export default function(layout, params) {
214
235
  });
215
236
  });
216
237
  };
217
-
218
- // -----------------------------
219
238
 
220
239
  self.addEventListener('message', evt => {
221
240
 
@@ -3,8 +3,8 @@
3
3
  /**
4
4
  * @imports
5
5
  */
6
- import { Observer } from '@webqit/pseudo-browser/index2.js';
7
6
  import { _isFunction } from '@webqit/util/js/index.js';
7
+ import { Observer } from './Runtime.js';
8
8
 
9
9
  export default class WorkerClient {
10
10
 
@@ -88,7 +88,7 @@ export default class Router extends _Router {
88
88
 
89
89
  // if the file is found, set Content-type and send data
90
90
  const type = Mime.lookup(ext);
91
- resolve(new event.Response(data, {
91
+ resolve( new event.Response(data, {
92
92
  headers: {
93
93
  contentType: type === 'application/javascript' ? 'text/javascript' : type,
94
94
  contentLength: Buffer.byteLength(data),
@@ -98,7 +98,7 @@ export default class Router extends _Router {
98
98
  static: true,
99
99
  autoIndex,
100
100
  }
101
- }));
101
+ } ) );
102
102
 
103
103
  }
104
104
  });
@@ -341,7 +341,7 @@ export async function run(instanceSetup, hostSetup, request, response, Ui, flags
341
341
  $context.response = await router.route([httpMethodName === 'delete' ? 'del' : httpMethodName, 'default'], serverNavigationEvent, null, async function(event) {
342
342
  var file = await router.fetch(event);
343
343
  // JSON request should ignore static files
344
- if (file && !event.request.headers.accept.match(file.headers.contentType)) {
344
+ if (file && event.request.headers.get('Accept') && !event.request.headers.accept.match(file.headers.contentType)) {
345
345
  return;
346
346
  }
347
347
  // ----------------
@@ -410,7 +410,7 @@ export async function run(instanceSetup, hostSetup, request, response, Ui, flags
410
410
  // Serialize rendering?
411
411
  // --------
412
412
  if (_isObject(rendering) && rendering.document) {
413
- await _delay(1000);
413
+ await _delay(2000);
414
414
  rendering = rendering.print();
415
415
  }
416
416
  if (!_isString(rendering)) throw new Error('render() must return a window object or a string response.')
package/vm CHANGED
@@ -53,4 +53,6 @@ sudo certbot run -a webroot -i apache -w /home/webqit_io/www/neatly.fit/public -
53
53
  certbot certonly --manual --preferred-challenges http -d neatly.fit --manual-auth-hook certbot-http-auth-hook --manual-cleanup-hook certbot-http-cleanup-hook --debug-challenges
54
54
 
55
55
  An unexpected error occurred:
56
- There were too many requests of a given type :: Error creating new order :: too many failed authorizations recently: see https://letsencrypt.org/docs/rate-limits/
56
+ There were too many requests of a given type :: Error creating new order :: too many failed authorizations recently: see https://letsencrypt.org/docs/rate-limits/
57
+
58
+ sudo launchctl list | grep postgres