@logux/server 0.13.1 → 0.15.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.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright 2016 Andrey Sitnik <andrey@sitnik.ru>
3
+ Copyright 2016 Andrey Sitnik <andrey@sitnik.es>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Logux Server [![Cult Of Martians][cult-img]][cult]
1
+ # Logux Server
2
2
 
3
3
  <img align="right" width="95" height="148" title="Logux logotype"
4
4
  src="https://logux.org/branding/logotype.svg">
@@ -7,58 +7,35 @@ Logux is a new way to connect client and server. Instead of sending
7
7
  HTTP requests (e.g., AJAX and GraphQL) it synchronizes log of operations
8
8
  between client, server, and other clients.
9
9
 
10
- * **[Guide, recipes, and API](https://logux.org/)**
11
- * **[Issues](https://github.com/logux/logux/issues)**
10
+ - **[Guide, recipes, and API](https://logux.org/)**
11
+ - **[Issues](https://github.com/logux/logux/issues)**
12
12
  and **[roadmap](https://github.com/orgs/logux/projects/1)**
13
- * **[Projects](https://logux.org/guide/architecture/parts/)**
13
+ - **[Projects](https://logux.org/guide/architecture/parts/)**
14
14
  inside Logux ecosystem
15
15
 
16
16
  This repository contains Logux server with:
17
17
 
18
- * Framework to write own server.
19
- * Proxy between WebSocket and HTTP server on any other language.
18
+ - Framework to write own server.
19
+ - Proxy between WebSocket and HTTP server on any other language.
20
20
 
21
- <a href="https://evilmartians.com/?utm_source=logux-server">
22
- <img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg"
23
- alt="Sponsored by Evil Martians" width="236" height="54">
24
- </a>
21
+ ---
25
22
 
26
- [cult-img]: http://cultofmartians.com/assets/badges/badge.svg
27
- [cult]: http://cultofmartians.com/done.html
28
-
29
-
30
- ### Logux Server as Proxy
31
-
32
- ```js
33
- import { fileURLToPath } from 'url'
34
-
35
- const server = new Server(
36
- Server.loadOptions(process, {
37
- controlSecret: 'secret',
38
- subprotocol: '1.0.0',
39
- supports: '0.6.2',
40
- backend: 'http://localhost:3000/logux',
41
- fileUrl: import.meta.url
42
- })
43
- )
44
-
45
- server.listen()
46
- ```
23
+ <img src="https://cdn.evilmartians.com/badges/logo-no-label.svg" alt="" width="22" height="16" />  Logux Server is built by <b><a href="https://evilmartians.com/">Evil Martians</a></b>, an American design and engineering consultancy for <b>developer tools, AI, and cybersecurity startups</b>.
47
24
 
25
+ ---
48
26
 
49
27
  ### Logux Server as Framework
50
28
 
51
29
  ```js
52
- import { fileURLToPath } from 'url'
53
30
  import { isFirstOlder } from '@logux/core'
54
31
  import { dirname } from 'path'
55
32
  import { Server } from '@logux/server'
56
33
 
57
34
  const server = new Server(
58
35
  Server.loadOptions(process, {
59
- subprotocol: '1.0.0',
60
- supports: '1.x',
61
- fileUrl: import.meta.url
36
+ subprotocol: 1,
37
+ minSubprotocol: 1,
38
+ root: import.meta.dirname
62
39
  })
63
40
  )
64
41
 
@@ -68,23 +45,23 @@ server.auth(async ({ userId, token }) => {
68
45
  })
69
46
 
70
47
  server.channel('user/:id', {
71
- access (ctx, action, meta) {
48
+ access(ctx, action, meta) {
72
49
  return ctx.params.id === ctx.userId
73
50
  },
74
- async load (ctx, action, meta) {
51
+ async load(ctx, action, meta) {
75
52
  const user = await db.loadUser(ctx.params.id)
76
53
  return { type: 'USER_NAME', name: user.name }
77
54
  }
78
55
  })
79
56
 
80
57
  server.type('CHANGE_NAME', {
81
- access (ctx, action, meta) {
58
+ access(ctx, action, meta) {
82
59
  return action.user === ctx.userId
83
60
  },
84
- resend (ctx, action, meta) {
85
- return { channel: `user/${ ctx.userId }` }
61
+ resend(ctx, action, meta) {
62
+ return { channel: `user/${ctx.userId}` }
86
63
  },
87
- async process (ctx, action, meta) {
64
+ async process(ctx, action, meta) {
88
65
  if (isFirstOlder(lastNameChange(action.user), meta)) {
89
66
  await db.changeUserName({ id: action.user, name: action.name })
90
67
  }
@@ -1,36 +1,44 @@
1
- <!DOCTYPE html><html>
2
- <head>
3
- <meta charset="UTF-8">
4
- <title>Logux Server</title>
5
- <style>
6
- html {
7
- height: 100%;
8
- }
9
- body {
10
- display: flex;
11
- align-items: center;
12
- justify-content: center;
13
- min-height: 100%;
14
- margin: 0;
15
- }
16
- svg {
17
- height: 25vh;
18
- }
19
- </style>
20
- </head>
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <title>Logux Server</title>
6
+ <style>
7
+ html {
8
+ height: 100%;
9
+ }
10
+ body {
11
+ display: flex;
12
+ align-items: center;
13
+ justify-content: center;
14
+ min-height: 100%;
15
+ margin: 0;
16
+ }
17
+ svg {
18
+ height: 25vh;
19
+ }
20
+ </style>
21
+ </head>
21
22
  <body>
22
23
  <a href="https://logux.org/">
23
24
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 75 117">
24
25
  <g fill="none" fill-rule="evenodd">
25
26
  <path d="M-1 0h78v117H-1z" />
26
27
  <g fill-rule="nonzero">
27
- <path fill="#1F1F1F"
28
- d="M2.239 40.258a12.83 12.83 0 00-.237.351C-.01 43.745-.515 46.634.71 50.4c1.484 4.565 3.865 6.346 9.045 7.98 5.705 1.8 7.064 2.346 10.02 4.481a23.387 23.387 0 013.3 2.885l4.198-1.394a28.632 28.632 0 00-1.907-2.072 27.455 27.455 0 00-3.196-2.697c-3.434-2.48-5.054-3.132-11.182-5.065-4.052-1.279-5.4-2.287-6.4-5.364-.69-2.121-.605-3.62.245-5.313L2.24 40.259zm4.91-7.089a22.975 22.975 0 001.72-3.977c1.038-3.18 1.217-5.458 1.078-9.74-.107-3.276-.06-4.527.422-6.218.648-2.273 2.042-4.164 4.406-5.87 2.658-1.918 5.15-2.604 7.865-2.292a14.85 14.85 0 012.38.491L22.371 9.12a22.74 22.74 0 01-.2-.022c-1.679-.193-3.155.214-5.002 1.546-2.923 2.11-3.317 3.494-3.149 8.678.153 4.713-.057 7.394-1.276 11.123a27.342 27.342 0 01-2.995 6.317l-2.6-3.592zm21.16 39.381c2.508 3.086 5.035 4.444 9.219 4.45 4.565.007 7.157-1.607 9.898-5.325.343-.465 1.837-2.598 2.27-3.184.928-1.257 1.795-2.288 2.783-3.27a23.18 23.18 0 012.784-2.36c1.364-.986 2.405-1.636 3.689-2.22l.023-4.394c-2.399.892-3.9 1.74-6.107 3.335a27.246 27.246 0 00-3.27 2.772c-1.15 1.143-2.145 2.328-3.187 3.74-.472.639-1.968 2.773-2.271 3.185-2.037 2.762-3.501 3.674-6.606 3.669-2.252-.003-3.644-.484-5.016-1.796L28.31 72.55zm38.808-14.716c3.919-1.472 5.9-3.358 7.234-7.431 1.29-3.939.765-6.885-1.353-10.092-.589-.892-2.979-4.007-3.421-4.634-1.48-2.097-2.532-4.081-3.317-6.485-.492-1.506-.799-2.81-.98-4.225l-4.217-1.334c.15 2.408.528 4.384 1.32 6.811.922 2.82 2.16 5.154 3.858 7.56.52.738 2.858 3.785 3.35 4.53 1.47 2.226 1.77 3.91.885 6.614-.716 2.185-1.57 3.35-3.336 4.265l-.023 4.421zm-2.09-41.45c-.22-4.341-1.311-6.541-4.74-9.019-2.339-1.69-4.597-2.387-7.035-2.254-1.101.06-2.206.28-3.518.666-.497.145-1.005.309-1.688.537.011-.003-1.32.446-1.709.575-3.303 1.09-5.743 1.588-8.806 1.588-1.515 0-2.87-.126-4.248-.39l-2.646 3.552c2.286.6 4.406.89 6.894.89 3.57 0 6.408-.579 10.09-1.794 4.765-1.573 4.538-1.506 5.854-1.578 1.481-.08 2.82.332 4.416 1.485 1.811 1.31 2.611 2.37 2.927 4.41l4.21 1.331z" />
29
- <path fill="#F5A623"
30
- d="M72.859 36.742c.095-.137.175-.256.236-.351 2.014-3.136 2.517-6.025 1.294-9.79-1.484-4.565-3.865-6.346-9.046-7.98-5.705-1.8-7.063-2.346-10.019-4.481a23.387 23.387 0 01-3.3-2.885l-4.198 1.394a28.632 28.632 0 001.907 2.072c.975.96 2.03 1.855 3.196 2.697 3.434 2.48 5.054 3.132 11.182 5.065 4.052 1.279 5.4 2.287 6.4 5.364.69 2.121.605 3.62-.245 5.313l2.593 3.582zm-4.91 7.089a22.975 22.975 0 00-1.72 3.977c-1.039 3.18-1.217 5.458-1.078 9.74.106 3.276.06 4.527-.423 6.218-.647 2.273-2.042 4.164-4.406 5.87-2.657 1.918-5.15 2.604-7.864 2.292a14.85 14.85 0 01-2.38-.491l2.649-3.556.2.022c1.678.193 3.155-.214 5.002-1.546 2.923-2.11 3.317-3.494 3.149-8.678-.154-4.713.057-7.394 1.276-11.123a27.342 27.342 0 012.994-6.317l2.6 3.592zM46.788 4.45C44.28 1.364 41.754.006 37.57 0c-4.566-.007-7.157 1.607-9.899 5.325-.343.465-1.837 2.598-2.27 3.184-.928 1.257-1.794 2.288-2.783 3.27a23.18 23.18 0 01-2.784 2.36c-1.363.986-2.404 1.636-3.688 2.22l-.023 4.394c2.398-.892 3.899-1.74 6.107-3.335a27.246 27.246 0 003.27-2.772c1.15-1.143 2.145-2.328 3.187-3.74.472-.639 1.967-2.773 2.271-3.185 2.036-2.762 3.5-3.674 6.606-3.669 2.252.003 3.644.484 5.015 1.796l4.209-1.398zM7.98 19.166c-3.918 1.472-5.899 3.358-7.233 7.431-1.29 3.939-.765 6.885 1.352 10.092.59.892 2.98 4.007 3.422 4.634C7 43.42 8.052 45.404 8.838 47.808c.492 1.506.798 2.81.979 4.225l4.218 1.334c-.15-2.408-.528-4.384-1.321-6.811-.922-2.82-2.16-5.154-3.857-7.56-.521-.738-2.859-3.785-3.351-4.53-1.47-2.226-1.77-3.91-.884-6.614.715-2.185 1.57-3.35 3.335-4.265l.023-4.421zm2.09 41.45c.22 4.341 1.312 6.541 4.74 9.019 2.34 1.69 4.598 2.387 7.036 2.254 1.1-.06 2.205-.28 3.518-.666a45.704 45.704 0 001.687-.537c-.01.003 1.32-.446 1.71-.575 3.303-1.09 5.743-1.588 8.806-1.588 1.515 0 2.87.126 4.248.39l2.646-3.552c-2.286-.6-4.406-.89-6.894-.89-3.57 0-6.409.579-10.09 1.794-4.766 1.573-4.538 1.506-5.854 1.578-1.482.08-2.82-.332-4.417-1.485-1.81-1.31-2.61-2.37-2.926-4.41l-4.21-1.331z" />
28
+ <path
29
+ fill="#1F1F1F"
30
+ d="M2.239 40.258a12.83 12.83 0 00-.237.351C-.01 43.745-.515 46.634.71 50.4c1.484 4.565 3.865 6.346 9.045 7.98 5.705 1.8 7.064 2.346 10.02 4.481a23.387 23.387 0 013.3 2.885l4.198-1.394a28.632 28.632 0 00-1.907-2.072 27.455 27.455 0 00-3.196-2.697c-3.434-2.48-5.054-3.132-11.182-5.065-4.052-1.279-5.4-2.287-6.4-5.364-.69-2.121-.605-3.62.245-5.313L2.24 40.259zm4.91-7.089a22.975 22.975 0 001.72-3.977c1.038-3.18 1.217-5.458 1.078-9.74-.107-3.276-.06-4.527.422-6.218.648-2.273 2.042-4.164 4.406-5.87 2.658-1.918 5.15-2.604 7.865-2.292a14.85 14.85 0 012.38.491L22.371 9.12a22.74 22.74 0 01-.2-.022c-1.679-.193-3.155.214-5.002 1.546-2.923 2.11-3.317 3.494-3.149 8.678.153 4.713-.057 7.394-1.276 11.123a27.342 27.342 0 01-2.995 6.317l-2.6-3.592zm21.16 39.381c2.508 3.086 5.035 4.444 9.219 4.45 4.565.007 7.157-1.607 9.898-5.325.343-.465 1.837-2.598 2.27-3.184.928-1.257 1.795-2.288 2.783-3.27a23.18 23.18 0 012.784-2.36c1.364-.986 2.405-1.636 3.689-2.22l.023-4.394c-2.399.892-3.9 1.74-6.107 3.335a27.246 27.246 0 00-3.27 2.772c-1.15 1.143-2.145 2.328-3.187 3.74-.472.639-1.968 2.773-2.271 3.185-2.037 2.762-3.501 3.674-6.606 3.669-2.252-.003-3.644-.484-5.016-1.796L28.31 72.55zm38.808-14.716c3.919-1.472 5.9-3.358 7.234-7.431 1.29-3.939.765-6.885-1.353-10.092-.589-.892-2.979-4.007-3.421-4.634-1.48-2.097-2.532-4.081-3.317-6.485-.492-1.506-.799-2.81-.98-4.225l-4.217-1.334c.15 2.408.528 4.384 1.32 6.811.922 2.82 2.16 5.154 3.858 7.56.52.738 2.858 3.785 3.35 4.53 1.47 2.226 1.77 3.91.885 6.614-.716 2.185-1.57 3.35-3.336 4.265l-.023 4.421zm-2.09-41.45c-.22-4.341-1.311-6.541-4.74-9.019-2.339-1.69-4.597-2.387-7.035-2.254-1.101.06-2.206.28-3.518.666-.497.145-1.005.309-1.688.537.011-.003-1.32.446-1.709.575-3.303 1.09-5.743 1.588-8.806 1.588-1.515 0-2.87-.126-4.248-.39l-2.646 3.552c2.286.6 4.406.89 6.894.89 3.57 0 6.408-.579 10.09-1.794 4.765-1.573 4.538-1.506 5.854-1.578 1.481-.08 2.82.332 4.416 1.485 1.811 1.31 2.611 2.37 2.927 4.41l4.21 1.331z"
31
+ />
32
+ <path
33
+ fill="#F5A623"
34
+ d="M72.859 36.742c.095-.137.175-.256.236-.351 2.014-3.136 2.517-6.025 1.294-9.79-1.484-4.565-3.865-6.346-9.046-7.98-5.705-1.8-7.063-2.346-10.019-4.481a23.387 23.387 0 01-3.3-2.885l-4.198 1.394a28.632 28.632 0 001.907 2.072c.975.96 2.03 1.855 3.196 2.697 3.434 2.48 5.054 3.132 11.182 5.065 4.052 1.279 5.4 2.287 6.4 5.364.69 2.121.605 3.62-.245 5.313l2.593 3.582zm-4.91 7.089a22.975 22.975 0 00-1.72 3.977c-1.039 3.18-1.217 5.458-1.078 9.74.106 3.276.06 4.527-.423 6.218-.647 2.273-2.042 4.164-4.406 5.87-2.657 1.918-5.15 2.604-7.864 2.292a14.85 14.85 0 01-2.38-.491l2.649-3.556.2.022c1.678.193 3.155-.214 5.002-1.546 2.923-2.11 3.317-3.494 3.149-8.678-.154-4.713.057-7.394 1.276-11.123a27.342 27.342 0 012.994-6.317l2.6 3.592zM46.788 4.45C44.28 1.364 41.754.006 37.57 0c-4.566-.007-7.157 1.607-9.899 5.325-.343.465-1.837 2.598-2.27 3.184-.928 1.257-1.794 2.288-2.783 3.27a23.18 23.18 0 01-2.784 2.36c-1.363.986-2.404 1.636-3.688 2.22l-.023 4.394c2.398-.892 3.899-1.74 6.107-3.335a27.246 27.246 0 003.27-2.772c1.15-1.143 2.145-2.328 3.187-3.74.472-.639 1.967-2.773 2.271-3.185 2.036-2.762 3.5-3.674 6.606-3.669 2.252.003 3.644.484 5.015 1.796l4.209-1.398zM7.98 19.166c-3.918 1.472-5.899 3.358-7.233 7.431-1.29 3.939-.765 6.885 1.352 10.092.59.892 2.98 4.007 3.422 4.634C7 43.42 8.052 45.404 8.838 47.808c.492 1.506.798 2.81.979 4.225l4.218 1.334c-.15-2.408-.528-4.384-1.321-6.811-.922-2.82-2.16-5.154-3.857-7.56-.521-.738-2.859-3.785-3.351-4.53-1.47-2.226-1.77-3.91-.884-6.614.715-2.185 1.57-3.35 3.335-4.265l.023-4.421zm2.09 41.45c.22 4.341 1.312 6.541 4.74 9.019 2.34 1.69 4.598 2.387 7.036 2.254 1.1-.06 2.205-.28 3.518-.666a45.704 45.704 0 001.687-.537c-.01.003 1.32-.446 1.71-.575 3.303-1.09 5.743-1.588 8.806-1.588 1.515 0 2.87.126 4.248.39l2.646-3.552c-2.286-.6-4.406-.89-6.894-.89-3.57 0-6.409.579-10.09 1.794-4.766 1.573-4.538 1.506-5.854 1.578-1.482.08-2.82-.332-4.417-1.485-1.81-1.31-2.61-2.37-2.926-4.41l-4.21-1.331z"
35
+ />
31
36
  </g>
32
- <path fill="#1F1F1F" fill-rule="nonzero"
33
- d="M10.889 117v-4H6.944V89H3v28h7.889zm11.833-14c0 .547-.194 1.017-.582 1.41-.387.393-.85.59-1.39.59-.54 0-1.003-.197-1.39-.59a1.938 1.938 0 01-.582-1.41c0-.547.194-1.017.582-1.41.387-.393.85-.59 1.39-.59.54 0 1.003.197 1.39.59.388.393.582.863.582 1.41zm-7.889 0c0 1.653.579 3.067 1.736 4.24s2.55 1.76 4.181 1.76c1.63 0 3.024-.587 4.181-1.76s1.736-2.587 1.736-4.24-.579-3.067-1.736-4.24S22.381 97 20.75 97c-1.63 0-3.024.587-4.181 1.76s-1.736 2.587-1.736 4.24zm11.834-14H14.833v4h11.834v-4zm0 24H14.833v4h11.834v-4zM38.5 95c0 .547-.194 1.017-.582 1.41-.388.393-.851.59-1.39.59-.54 0-1.003-.197-1.39-.59a1.938 1.938 0 01-.582-1.41c0-.547.193-1.017.581-1.41.388-.393.852-.59 1.39-.59.54 0 1.003.197 1.391.59.388.393.582.863.582 1.41zm-3.944 16v-2.32c.618.213 1.275.32 1.972.32 1.63 0 3.024-.587 4.18-1.76 1.158-1.173 1.736-2.587 1.736-4.24 0-1.547-.506-2.88-1.518-4 1.012-1.12 1.518-2.453 1.518-4 0-1.653-.578-3.067-1.735-4.24S38.159 89 36.528 89c-1.63 0-3.024.587-4.181 1.76S30.61 93.347 30.61 95s.579 3.067 1.736 4.24 2.55 1.76 4.18 1.76c.54 0 1.003.197 1.391.59.388.393.582.863.582 1.41 0 .547-.194 1.017-.582 1.41-.388.393-.851.59-1.39.59-.54 0-1.003-.197-1.39-.59a1.938 1.938 0 01-.582-1.41H30.61v8c0 1.653.579 3.067 1.736 4.24s2.55 1.76 4.18 1.76c1.631 0 3.025-.587 4.182-1.76 1.157-1.173 1.735-2.587 1.735-4.24H38.5c0 .547-.194 1.017-.582 1.41-.388.393-.851.59-1.39.59-.54 0-1.003-.197-1.39-.59a1.938 1.938 0 01-.582-1.41zm11.833 0c0 1.653.578 3.067 1.735 4.24s2.551 1.76 4.182 1.76c1.63 0 3.024-.587 4.18-1.76 1.158-1.173 1.736-2.587 1.736-4.24V89h-3.944v22c0 .547-.194 1.017-.582 1.41-.388.393-.851.59-1.39.59-.54 0-1.003-.197-1.39-.59a1.938 1.938 0 01-.583-1.41V89H46.39v22zM74 89H62.167v4H74v-4zm-3.116 14l2.78-2.82-2.8-2.82-2.78 2.82-2.782-2.82-2.8 2.82 2.8 2.82-2.8 2.84 2.8 2.82 2.781-2.82 2.781 2.82 2.8-2.82-2.78-2.84zM74 113H62.167v4H74v-4z" />
37
+ <path
38
+ fill="#1F1F1F"
39
+ fill-rule="nonzero"
40
+ d="M10.889 117v-4H6.944V89H3v28h7.889zm11.833-14c0 .547-.194 1.017-.582 1.41-.387.393-.85.59-1.39.59-.54 0-1.003-.197-1.39-.59a1.938 1.938 0 01-.582-1.41c0-.547.194-1.017.582-1.41.387-.393.85-.59 1.39-.59.54 0 1.003.197 1.39.59.388.393.582.863.582 1.41zm-7.889 0c0 1.653.579 3.067 1.736 4.24s2.55 1.76 4.181 1.76c1.63 0 3.024-.587 4.181-1.76s1.736-2.587 1.736-4.24-.579-3.067-1.736-4.24S22.381 97 20.75 97c-1.63 0-3.024.587-4.181 1.76s-1.736 2.587-1.736 4.24zm11.834-14H14.833v4h11.834v-4zm0 24H14.833v4h11.834v-4zM38.5 95c0 .547-.194 1.017-.582 1.41-.388.393-.851.59-1.39.59-.54 0-1.003-.197-1.39-.59a1.938 1.938 0 01-.582-1.41c0-.547.193-1.017.581-1.41.388-.393.852-.59 1.39-.59.54 0 1.003.197 1.391.59.388.393.582.863.582 1.41zm-3.944 16v-2.32c.618.213 1.275.32 1.972.32 1.63 0 3.024-.587 4.18-1.76 1.158-1.173 1.736-2.587 1.736-4.24 0-1.547-.506-2.88-1.518-4 1.012-1.12 1.518-2.453 1.518-4 0-1.653-.578-3.067-1.735-4.24S38.159 89 36.528 89c-1.63 0-3.024.587-4.181 1.76S30.61 93.347 30.61 95s.579 3.067 1.736 4.24 2.55 1.76 4.18 1.76c.54 0 1.003.197 1.391.59.388.393.582.863.582 1.41 0 .547-.194 1.017-.582 1.41-.388.393-.851.59-1.39.59-.54 0-1.003-.197-1.39-.59a1.938 1.938 0 01-.582-1.41H30.61v8c0 1.653.579 3.067 1.736 4.24s2.55 1.76 4.18 1.76c1.631 0 3.025-.587 4.182-1.76 1.157-1.173 1.735-2.587 1.735-4.24H38.5c0 .547-.194 1.017-.582 1.41-.388.393-.851.59-1.39.59-.54 0-1.003-.197-1.39-.59a1.938 1.938 0 01-.582-1.41zm11.833 0c0 1.653.578 3.067 1.735 4.24s2.551 1.76 4.182 1.76c1.63 0 3.024-.587 4.18-1.76 1.158-1.173 1.736-2.587 1.736-4.24V89h-3.944v22c0 .547-.194 1.017-.582 1.41-.388.393-.851.59-1.39.59-.54 0-1.003-.197-1.39-.59a1.938 1.938 0 01-.583-1.41V89H46.39v22zM74 89H62.167v4H74v-4zm-3.116 14l2.78-2.82-2.8-2.82-2.78 2.82-2.782-2.82-2.8 2.82 2.8 2.82-2.8 2.84 2.8 2.82 2.781-2.82 2.781 2.82 2.8-2.82-2.78-2.84zM74 113H62.167v4H74v-4z"
41
+ />
34
42
  </g>
35
43
  </svg>
36
44
  </a>
@@ -0,0 +1,24 @@
1
+ import { readFile } from 'node:fs/promises'
2
+ import { join } from 'node:path'
3
+
4
+ let hello
5
+ async function readHello() {
6
+ if (!hello) {
7
+ hello = await readFile(join(import.meta.dirname, 'hello.html'))
8
+ }
9
+ return hello
10
+ }
11
+
12
+ export function addHttpPages(server) {
13
+ if (!server.options.disableHttpServer) {
14
+ server.http('GET', '/', async (req, res) => {
15
+ let data = await readHello()
16
+ res.writeHead(200, { 'Content-Type': 'text/html' })
17
+ res.end(data)
18
+ })
19
+ server.http('GET', '/health', (req, res) => {
20
+ res.writeHead(200, { 'Content-Type': 'text/plain' })
21
+ res.end('Logux Server: OK\n')
22
+ })
23
+ }
24
+ }
@@ -54,9 +54,7 @@ export function ChangedAt<Value extends SyncMapTypes | SyncMapTypes[]>(
54
54
  */
55
55
  export function NoConflictResolution<
56
56
  Value extends SyncMapTypes | SyncMapTypes[]
57
- >(
58
- value: Value
59
- ): WithTime<Value>
57
+ >(value: Value): WithTime<Value>
60
58
 
61
59
  interface SyncMapActionFilter<Value extends SyncMapValues> {
62
60
  (
@@ -46,10 +46,9 @@ function buildFilter(filter) {
46
46
  }
47
47
  if (action.type.endsWith('/changed')) {
48
48
  for (let key in filter) {
49
- if (
50
- key in action.fields &&
51
- action.fields[key] !== filter[key]
52
- ) return false
49
+ if (key in action.fields && action.fields[key] !== filter[key]) {
50
+ return false
51
+ }
53
52
  }
54
53
  }
55
54
  return true
@@ -112,12 +111,7 @@ export function addSyncMap(server, plural, operations) {
112
111
  meta
113
112
  )
114
113
  if (data !== false) {
115
- await sendMap(
116
- server,
117
- changedType,
118
- data,
119
- since
120
- )
114
+ await sendMap(server, changedType, data, since)
121
115
  }
122
116
  }
123
117
  })