liuyi
a38f7ee252
fix(server): sender passed to nextauth is never used ( #5938 )
2024-02-28 05:44:25 +00:00
liuyi
540d079308
ci: fix selfhost ( #5920 )
...
## **Type**
enhancement
___
## **Description**
- Introduced a new ESM module resolution setup using `ts-node` to enhance the development and deployment process.
- Implemented a dynamic loader script registration mechanism to facilitate ESM module loading.
- Simplified the predeploy script execution by refining environment variable handling and stdout configuration.
- Updated `package.json` to reflect changes in script commands for better ESM support and added necessary dependencies for `ts-node` and `typescript`.
___
## **Changes walkthrough**
<table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
<td>
<details>
<summary><strong>loader.js</strong><dd><code>Introduce ESM Module Resolution via ts-node</code> </dd></summary>
<hr>
packages/backend/server/scripts/loader.js
<li>Introduced <code>ts-node</code> configuration for ESM module resolution.<br> <li> Exported a <code>resolve</code> function for module resolution.<br>
</details>
</td>
<td><a href="https:/toeverything/AFFiNE/pull/5920/files#diff-9ed793897a493633028d510db0742ff38d2d86471c54b17513d4354c51597ef8">+11/-0</a> </td>
</tr>
<tr>
<td>
<details>
<summary><strong>register.js</strong><dd><code>Implement Dynamic Loader Script Registration</code> </dd></summary>
<hr>
packages/backend/server/scripts/register.js
<li>Implemented dynamic registration of the loader script.<br> <li> Utilized <code>node:module</code> and <code>node:url</code> for script registration.<br>
</details>
</td>
<td><a href="https:/toeverything/AFFiNE/pull/5920/files#diff-64831012a09f2bc4bc5a611ddb8e0871b0e83588de6c5d4f2f5cb1dae8fff244">+4/-0</a> </td>
</tr>
<tr>
<td>
<details>
<summary><strong>self-host-predeploy.js</strong><dd><code>Simplify Predeploy Script Execution</code> </dd></summary>
<hr>
packages/backend/server/scripts/self-host-predeploy.js
<li>Simplified environment variable passing to <code>execSync</code>.<br> <li> Changed stdout handling to inherit from the parent process.<br>
</details>
</td>
<td><a href="https:/toeverything/AFFiNE/pull/5920/files#diff-bd7b0be14c198018c21dadda6945a779c57d13e4c8584ee62da4baa99d370664">+3/-5</a> </td>
</tr>
<tr>
<td>
<details>
<summary><strong>package.json</strong><dd><code>Update Scripts and Dependencies for ESM Support</code> </dd></summary>
<hr>
packages/backend/server/package.json
<li>Updated script commands for ESM compatibility.<br> <li> Added <code>ts-node</code> and <code>typescript</code> dependencies.<br> <li> Removed redundant <code>--es-module-specifier-resolution=node</code> flags.<br>
</details>
</td>
<td><a href="https:/toeverything/AFFiNE/pull/5920/files#diff-a6530c6fe539aaa49ff0a7a80bc4362c1d95c419fdd19125415dcc869b31a443">+6/-6</a> </td>
</tr>
</table></td></tr></tr></tbody></table>
___
> ✨ **PR-Agent usage**:
>Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions
2024-02-27 07:22:21 +00:00
liuyi
4d421a324f
refactor(server): import prisma from @prisma/client ( #5863 )
2024-02-22 07:46:57 +00:00
liuyi
85be45a79c
fix(core): window.open to a new origin will be blocked by browser ( #5856 )
2024-02-21 12:35:25 +00:00
liuyi
d2bf1451fa
ci: fix canary deployment ( #5851 )
2024-02-21 03:01:33 +00:00
liuyi
df157819dc
feat(server): allow customize mailer server ( #5835 )
2024-02-19 14:37:08 +00:00
liuyi
296d47f102
refactor(server): separate s3 & r2 storage to plugin ( #5805 )
2024-02-05 15:10:09 +00:00
liuyi
d9c2dc8dfb
fix(server): apply env overrides after all config merged ( #5795 )
2024-02-04 06:38:31 +00:00
liuyi
bef266ae3b
refactor(server): reorganize server configs ( #5753 )
2024-02-02 08:32:07 +00:00
liuyi
2f3c6f104e
fix(server): doc upsert without row lock ( #5765 )
2024-02-01 09:49:02 +00:00
liuyi
e3b8d0dba4
feat(server): allow pass coupon to checkout session ( #5749 )
2024-01-31 21:34:22 +08:00
liuyi
f1ccc504b5
fix(server): doc upsert race condition ( #5755 )
2024-01-31 21:13:29 +08:00
liuyi
26db1d436d
refactor(server): server errors ( #5741 )
...
standardize the error raising in both GraphQL Resolvers and Controllers.
Now, All user aware errors should be throwed with `HttpException`'s variants, for example `NotFoundException`.
> Directly throwing `GraphQLError` are forbidden.
The GraphQL errorFormatter will handle it automatically and set `code`, `status` in error extensions.
At the same time, the frontend `GraphQLError` should be imported from `@affine/graphql`, which introduce a better error extensions type.
----
controller example:
```js
@Get('/docs/${id}')
doc() {
// ...
// imported from '@nestjs/common'
throw new NotFoundException('Doc is not found.');
// ...
}
```
the above will response as:
```
status: 404 Not Found
{
"message": "Doc is not found.",
"statusCode": 404,
"error": "Not Found"
}
```
resolver example:
```js
@Mutation()
invite() {
// ...
throw new PayloadTooLargeException('Workspace seats is full.')
// ...
}
```
the above will response as:
```
status: 200 Ok
{
"data": null,
"errors": [
{
"message": "Workspace seats is full.",
"extensions": {
"code": 404,
"status": "Not Found"
}
}
]
}
```
for frontend GraphQLError user-friend, a helper function introduced:
```js
import { findGraphQLError } from '@affine/graphql'
fetch(query)
.catch(errOrArr => {
const e = findGraphQLError(errOrArr, e => e.extensions.code === 404)
if (e) {
// handle
}
})
```
2024-01-31 08:43:03 +00:00
liuyi
72d9cc1e5b
chore(storage): bump y-octo ( #5751 )
2024-01-31 06:54:33 +00:00
liuyi
db8e49b046
refactor(server): throw Unauthorized instead if user is not signed in ( #5746 )
2024-01-31 02:12:22 +00:00
liuyi
0f67c683c9
fix(server): add metrics missing attributes ( #5682 )
2024-01-24 08:06:34 +00:00
liuyi
151a53c575
fix(server): disable payment module requirements temporarily ( #5683 )
2024-01-24 03:17:21 +00:00
liuyi
62169c59c8
fix(server): del staled update count cache if unmatch ( #5674 )
2024-01-23 08:19:29 +00:00
liuyi
e516e0db23
refactor(server): plugin modules ( #5630 )
...
- [x] separates modules into `fundamental`, `core`, `plugins`
- [x] optional modules with `@OptionalModule` decorator to install modules with requirements met(`requires`, `if`)
- [x] `module.contributesTo` defines optional features that will be enabled if module registered
- [x] `AFFiNE.plugins.use('payment', {})` to enable a optional/plugin module
- [x] `PaymentModule` is the first plugin module
- [x] GraphQLSchema will not be generated for non-included modules
- [x] Frontend can use `ServerConfigType` query to detect which features are enabled
- [x] override existing provider globally
2024-01-22 07:40:28 +00:00
liuyi
9fdbb3ac3d
fix(server): should not listen on user defined host ( #5622 )
2024-01-18 04:59:53 +00:00
liuyi
f419867437
chore(server): remove useless log ( #5620 )
2024-01-18 03:19:20 +00:00
liuyi
d9324286d4
chore(server): add port to host if it is 0.0.0.0 ( #5619 )
2024-01-18 03:04:36 +00:00
liuyi
b9f20877d0
feat(core): make password sigin default if user has one ( #5577 )
2024-01-17 11:13:58 +00:00
liuyi
bf88b6edaa
chore(server): remove too verbose logs ( #5555 )
...
chore(server): remove too verbose logs
chore(server): make logs less verbose
2024-01-17 10:37:22 +00:00
liuyi
00acc49342
chore(server): remove octobase storage usage ( #5594 )
...
since all blobs have been successfully migrated to r2, the octobase blob functions are no longer necessary.
2024-01-17 10:22:35 +00:00
liuyi
75fb0a9f1a
fix(server): standalone early access users detection ( #5601 )
2024-01-16 03:27:44 +00:00
liuyi
24e18dd475
fix: improve self-host convenience ( #5582 )
2024-01-15 09:24:53 +00:00
liuyi
4c49b62ab7
fix(server): node imports order ( #5583 )
2024-01-14 05:47:56 +00:00
liuyi
89b5c96d25
refactor(server): folder structure ( #5573 )
2024-01-12 04:18:39 +00:00
liuyi
12fdb18a80
test(server): make server testing utils ( #5544 )
2024-01-11 06:40:55 +00:00
liuyi
9253e522aa
test(server): avoid progress get hold after tests finished ( #5522 )
2024-01-11 06:40:53 +00:00
liuyi
ddbb5e1121
fix(server): better error handling and logging for storage ( #5553 )
2024-01-09 10:37:24 +00:00
liuyi
d7b9462d1c
fix(server): backward compatibility for beta+stable envs ( #5510 )
2024-01-08 05:15:32 +00:00
liuyi
760d900f99
feat(server): blob data migration ( #5461 )
2024-01-03 10:56:57 +00:00
liuyi
0d34805375
refactor(server): use new storage providers ( #5433 )
2024-01-03 10:56:55 +00:00
liuyi
1eefd712dd
feat(server): new storage provider ( #5410 )
2024-01-02 07:21:01 +00:00
liuyi
abcca8b09e
refactor(server): object storages ( #5405 )
2024-01-02 07:01:25 +00:00
liuyi
797cd5c6eb
fix(server): avoid repeatly register providers ( #5265 )
2023-12-13 02:12:38 +00:00
liuyi
bf97a07d1f
fix(server): use last update creating time as snasphot update timestamp ( #5266 )
2023-12-12 06:03:34 +00:00
liuyi
30ecee483d
fix(server): avoid updates persist forever ( #5258 )
2023-12-11 09:17:49 +00:00
liuyi
17d584b336
refactor(server): use events system ( #5149 )
2023-12-08 05:00:58 +00:00
liuyi
e0cada49f5
refactor(server): do not force init binary when creating workspace ( #5146 )
2023-12-06 08:35:48 +00:00
liuyi
4cb26cd3e5
feat(server): events system ( #5145 )
2023-12-06 08:35:45 +00:00
liuyi
b4b4a3b625
fix(server): avoid snapshot write conflict ( #5174 )
2023-12-04 11:12:16 +00:00
liuyi
89f267a3fe
refactor(server): simplify metrics creation and usage ( #5115 )
2023-11-29 08:05:08 +00:00
liuyi
e73c39fe6b
fix(server): wrong OTEL config ( #5084 )
2023-11-28 05:54:42 +00:00
liuyi
8cc9a0b21b
feat(server): add soft deleted flag to optimized blob table ( #5058 )
...
requires https://github.com/toeverything/OctoBase/pull/561
2023-11-27 07:06:31 +00:00
liuyi
9dc2d55a5a
fix(server): add guid compatibility of :space:page variant ( #5062 )
2023-11-24 15:46:09 +00:00
liuyi
91efca107a
refactor(server): standarderlize metrics and trace with OTEL ( #5054 )
...
you can now export span to Zipkin and metrics to Prometheus when developing locally
follow the docs of OTEL: https://opentelemetry.io/docs/instrumentation/js/exporters/
<img width="2357" alt="image" src="https://github.com/toeverything/AFFiNE/assets/8281226/ec615e1f-3e91-43f7-9111-d7d2629e9679 ">
2023-11-24 15:19:22 +00:00
liuyi
cf65a5cd93
fix(server): never throw in websocket gateways ( #5050 )
2023-11-24 07:26:40 +00:00
liuyi
1740e7efa1
fix(server): check state changes before saving history record ( #5038 )
2023-11-23 07:39:02 +00:00
liuyi
3710bcdc14
fix(server): use iso date string as history query input ( #5035 )
2023-11-23 01:59:08 +00:00
liuyi
d1476495ae
feat(server): impl doc history ( #5004 )
2023-11-22 07:56:59 +00:00
liuyi
946b7b4004
feat(server): event on snapshot upserted ( #5002 )
2023-11-22 07:23:44 +00:00
liuyi
525b196cae
feat(server): reduce duplidated merge with cache ( #4975 )
2023-11-22 04:09:07 +00:00
liuyi
c69e542b98
feat(server): add cache module ( #4973 )
2023-11-22 04:09:00 +00:00
liuyi
85bee72e6b
chore(server): remove deprecated redis manager ( #4971 )
2023-11-22 03:51:18 +00:00
liuyi
b7d6237c20
feat(server): add doc history support ( #4970 )
2023-11-22 03:31:22 +00:00
liuyi
9baad36e41
fix(server): all viewers can share public link ( #4968 )
2023-11-17 13:48:09 +08:00
liuyi
c44a9a4903
fix(server): wrap updates applying in a transaction ( #4922 )
2023-11-14 14:39:39 +08:00
forehalo
dc8e84df31
fix(server): increase server acceptable websocket payload size
2023-11-12 11:22:00 +08:00
liuyi and DarkSky
7698a6ac8e
chore(server): bump octobase versions ( #4893 )
...
Co-authored-by: DarkSky <darksky2048@gmail.com >
2023-11-10 02:25:28 +00:00
liuyi
405167854b
perf(server): avoid auto select blob data when upsert ( #4891 )
2023-11-09 10:45:31 +00:00
liuyi
f9654bb1f8
feat(core): unify all new created page IDs to nanoid ( #4884 )
2023-11-09 09:22:02 +00:00
liuyi
248fb1fa69
fix(server): token set with id instead of email ( #4883 )
2023-11-09 08:23:03 +00:00
liuyi
7305530d97
fix(server): wrong data migration ( #4855 )
2023-11-07 09:20:42 +00:00
liuyi
b99ac51624
chore(server): decrease amount of batch updates merging ( #4860 )
2023-11-07 09:18:02 +00:00
liuyi
01d7fe4597
fix(server): avoid saving invalid data ( #4859 )
2023-11-07 08:27:17 +00:00
liuyi
cb6974f263
fix(server): avoid server overloading by too many updates ( #4846 )
2023-11-06 10:21:19 +00:00
liuyi
f75684d6f6
fix(server): failed to share again if disable once ( #4844 )
2023-11-06 10:19:21 +00:00
liuyi
f491ff94cc
refactor(server): separate page visibility from workspace permission ( #4836 )
2023-11-06 03:49:39 +00:00
liuyi
f6cfe7c8a1
fix(server): only treat active subscription as existing ( #4826 )
2023-11-03 04:00:58 +00:00
liuyi
a3906bf92b
fix(server): do not return subscription if not active ( #4820 )
2023-11-02 14:17:26 +00:00
forehalo
5e9efbffa3
fix(server): page variant may exist
2023-11-02 18:25:30 +08:00
forehalo
7e516236f5
fix(workspace): remove awareness states cache
2023-11-02 18:24:00 +08:00
liuyi
6a93203d68
feat(server): sync data with ack ( #4791 )
2023-11-02 09:05:28 +00:00
liuyi
b4d8f1428c
Merge pull request #4771 from toeverything/jimmfly/1030/add-i18n
...
feat(i18n): add new key for billing
2023-10-30 10:56:51 +00:00
forehalo
26b953ce57
fix(server): wrong prod data migration scripts filter
2023-10-30 16:50:39 +08:00
forehalo
98d0ac3c90
feat(server): add data migration system
2023-10-30 11:12:09 +08:00
liuyi
50563dcb6e
feat(server): auto attach early access coupon ( #4728 )
2023-10-27 10:28:22 +08:00
liuyi
9334a363c7
chore(server): upgrade stripe sdk ( #4733 )
2023-10-26 12:37:52 +00:00
liuyi
97d06432f0
fix(server): wrong invoice recurring value saved ( #4712 )
2023-10-24 18:32:52 +08:00
forehalo
ef1228dcb4
perf(server): opmitize updates table
2023-10-24 17:54:59 +08:00
forehalo
7ecee01d20
fix(server): respond stripe webhook immediately
2023-10-24 12:09:14 +08:00
forehalo
2e4f6ef2ed
feat(server): combine plan and recurring as stripe lookup key
2023-10-24 12:09:14 +08:00
forehalo
9b43380b05
fix(server): cancel scheduled subscription
2023-10-24 12:09:14 +08:00
liuyi
303dade2ef
fix cancel subscription edge cases ( #4691 )
2023-10-24 11:40:46 +08:00
liuyi
113b20f669
fix(core): payment ui issues ( #4672 )
2023-10-24 11:40:46 +08:00
liuyi
95d37fc63f
refactor(core): make subscription hook ( #4669 )
2023-10-24 11:40:46 +08:00
liuyi
858a1da35f
feat(core): impl billing settings ( #4652 )
2023-10-24 11:40:46 +08:00
forehalo
1d62133f4f
feat(core): impl subscription plans setting
2023-10-24 11:40:46 +08:00
forehalo
df054ac7f6
feat(core): payment backend
2023-10-24 11:40:44 +08:00
liuyi
7275d417b2
fix(server): avoid workspace subdoc guid conflict ( #4664 )
2023-10-19 08:12:57 +00:00
liuyi
01987990ee
fix: make server guid consistent ( #4341 )
2023-10-17 02:34:13 +00:00
liuyi
0092a19812
refactor(server): deprecate unstable redis manager ( #4567 )
2023-10-10 03:23:12 +00:00
liuyi
504dda2092
fix(core): setting ui regression ( #4525 )
2023-09-27 09:56:01 +00:00
liuyi
4a03fa65d1
fix(server): wrong member count query ( #4506 )
2023-09-26 15:36:08 +00:00
liuyi
e10868cd20
fix(server): deal with unexpected updates ( #4064 )
2023-08-31 16:56:33 +08:00
liuyi
6bafa83cef
fix(workspace): should avoid sending providers' update back ( #3384 )
2023-07-26 09:47:24 +00:00
liuyi
2c95bfcc3d
feat(storage): binding jwst storage to node ( #2808 )
2023-06-29 01:45:45 +00:00