Commit Graph

123 Commits

Author SHA1 Message Date
forehalo
aff166a0ef
feat(server): add administrator feature (#6995) 2024-05-27 11:17:21 +00:00
darkskygit
0c42849bc3
feat: update i2i model (#7041) 2024-05-23 14:27:12 +00:00
darkskygit
df73b6ddc7
feat: revoke token after sensitive operations (#6993)
fix #6914
2024-05-20 06:38:48 +00:00
darkskygit
a3f3d09764
feat: add upscaler & bg remover (#6967) 2024-05-16 11:09:34 +00:00
darkskygit
0076359d6a
feat: add retry support for copilot (#6947) 2024-05-15 11:02:37 +00:00
darkskygit
98e218af93
feat: allow undefined new model (#6933) 2024-05-14 13:05:07 +00:00
darkskygit
b8333de119
fix: blob test flaky (#6929) 2024-05-14 09:20:58 +00:00
darkskygit
8e0a0a7f02
fix: wait activated event (#6814) 2024-05-07 09:44:38 +00:00
forehalo
d657f4091a
fix(server): do not allow registration through gql (#6775) 2024-05-06 11:11:57 +00:00
darkskygit
13f40f435d
feat: improve query performence (#6764) 2024-05-06 09:12:04 +00:00
forehalo
f566457dcf
test(server): payment tests (#6737) 2024-04-30 06:59:54 +00:00
forehalo
a14194c482
fix(server): blob controller permission (#6746) 2024-04-30 03:47:00 +00:00
darkskygit
850bbee629
test: copilot unit & e2e test (#6649)
fix CLOUD-31
2024-04-26 09:43:35 +00:00
darkskygit
a0c219e036
feat: use default params if not provided (#6701) 2024-04-25 10:59:46 +00:00
forehalo
3297486e31
fix(server): skip throttle for currentUser (#6700) 2024-04-25 09:45:31 +00:00
forehalo
e8bcb75602
fix(server): use post request to consume magic link token (#6656) 2024-04-22 07:15:26 +00:00
EYHN
5e243de392
feat(server): auto refresh session (#6613) 2024-04-19 07:00:12 +00:00
EYHN
08cd940e6b
fix(server): fix unstable test (#6621) 2024-04-18 14:53:24 +00:00
darkskygit
b3b9e9a056
chore: cleanup outdated api (#6604) 2024-04-18 14:42:46 +00:00
liuyi
e53d5e2e3d
chore(server): clean up throttler (#6326) 2024-04-17 16:32:26 +08:00
darkskygit
1b0864eb60
feat: check quota correctly (#6561) 2024-04-16 09:41:48 +00:00
EYHN
9e7a2fcf0e
feat(server): add pro quota to dev user (#6532) 2024-04-12 06:45:18 +00:00
darkskygit
e6a576551a
feat: add copilot impl (#6230)
fix CLOUD-22
fix CLOUD-24
2024-04-10 11:15:32 +00:00
darkskygit
46a368d7f1
feat: add session impl (#6254) 2024-04-10 11:15:25 +00:00
darkskygit
3c01d944fb
feat: add prompt service (#6241)
fix CLOUD-19
2024-04-02 07:04:54 +00:00
forehalo
54c06777a6
fix(server): always set new session cookie (#6323) 2024-03-26 09:56:39 +00:00
forehalo
1a1af83375
test(server): auth tests (#6135) 2024-03-26 02:24:17 +00:00
EYHN
f2adbdaba4
style: enable import-x/no-duplicates (#6279) 2024-03-25 03:55:33 +00:00
EYHN
34703a3b7d
feat(infra): new doc sync engine (#6205)
https://github.com/toeverything/AFFiNE/blob/eyhn/feat/new-sync/packages/common/infra/src/workspace/engine/doc/README.md
2024-03-22 16:43:26 +00:00
DarkSky
f18133af82
fix(server): wrap read-modify-write apis with distributed lock (#6142) 2024-03-19 02:16:24 +00:00
LongYinan
bc465f9704
Revert "fix(server): wrap read-modify-write apis with distributed lock (#5979)"
This reverts commit 34f892b05b.
2024-03-15 16:55:48 +08:00
DarkSky
34f892b05b
fix(server): wrap read-modify-write apis with distributed lock (#5979) 2024-03-15 13:31:11 +08:00
liuyi
fb3a0e7b8f
refactor(server): auth (#5895)
Remove `next-auth` and implement our own Authorization/Authentication system from scratch.

## Server

- [x] tokens
  - [x] function
  - [x] encryption

- [x] AuthController
  - [x] /api/auth/sign-in
  - [x] /api/auth/sign-out
  - [x] /api/auth/session
  - [x] /api/auth/session (WE SUPPORT MULTI-ACCOUNT!)

- [x] OAuthPlugin
  - [x] OAuthController
  - [x] /oauth/login
  - [x] /oauth/callback
  - [x] Providers
    - [x] Google
    - [x] GitHub

## Client

- [x] useSession
- [x] cloudSignIn
- [x] cloudSignOut

## NOTE:

Tests will be adding in the future
2024-03-12 10:00:09 +00:00
liuyi
4d421a324f
refactor(server): import prisma from @prisma/client (#5863) 2024-02-22 07:46:57 +00:00
L-Sun
46cc0810e9
test(server): incorrect prisma overriding (#5857) 2024-02-22 11:55:37 +08: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
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
DarkSky
fc8a48fb43
feat: add business blob limit (#5734) 2024-01-29 08:32:35 +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
DarkSky
ee8ec47a4f
feat: use SafeInt replace Float (#5613) 2024-01-17 12:36:21 +00:00
DarkSky
8f80bdb7af
feat: new free plan (#5604) 2024-01-17 07:20:18 +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
DarkSky
d6f65ea414
feat: blob size limit with quota (#5524)
fix AFF-506 TOV-342
2024-01-11 10:21:40 +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
DarkSky
0d7ffb0511
feat: add unlimited workspace support (#5523)
fix AFF-505
2024-01-10 07:28:53 +00:00
DarkSky
a59fe1b49e
feat: adapted user quota for member api (#5521)
fix AFF-494 TOV-337
2024-01-10 07:28:46 +00:00
DarkSky
443908da22
feat: add workspace experimental features api (#5525) 2024-01-06 11:04:49 +00:00
DarkSky
f6ec786ef9
feat: add workspace level feature apis (#5503) 2024-01-05 04:13:49 +00:00
DarkSky
04ca554525
feat: add workspace feature tests (#5501) 2024-01-05 04:13:47 +00:00
liuyi
0d34805375
refactor(server): use new storage providers (#5433) 2024-01-03 10:56:55 +00:00
DarkSky
0c2d2f8d16
feat: struct type feature config (#5142) 2023-12-14 09:50:52 +00:00
DarkSky
2b7f6f8b74
feat: integrate new modules (#5087) 2023-12-14 09:50:46 +00:00
DarkSky
a93c12e122
feat: user usage gql & test case improve (#5076) 2023-12-14 09:50:42 +00:00
DarkSky
ad23ead5e4
feat: integrate user usage into apis (#5075) 2023-12-14 09:50:37 +00:00
liuyi
797cd5c6eb
fix(server): avoid repeatly register providers (#5265) 2023-12-13 02:12:38 +00:00
liuyi
17d584b336
refactor(server): use events system (#5149) 2023-12-08 05:00:58 +00:00
liuyi
b4b4a3b625
fix(server): avoid snapshot write conflict (#5174) 2023-12-04 11:12:16 +00:00
LongYinan
cb2c659f52
fix: add no-new-array rule (#5117) 2023-11-29 04:44:06 +00:00
LongYinan
68caf5027d
fix: add new-for-builtins rule (#5116) 2023-11-29 04:44:02 +00:00
LongYinan
45690c2756
fix: add no-useless-promise-resolve-reject rule (#5111) 2023-11-29 04:43:47 +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
1740e7efa1
fix(server): check state changes before saving history record (#5038) 2023-11-23 07:39:02 +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
f491ff94cc
refactor(server): separate page visibility from workspace permission (#4836) 2023-11-06 03:49:39 +00:00
liuyi
6a93203d68
feat(server): sync data with ack (#4791) 2023-11-02 09:05:28 +00:00
forehalo
df054ac7f6
feat(core): payment backend 2023-10-24 11:40:44 +08:00
Joooye_34
bed9310519
refactor(infra): directory structure (#4615) 2023-10-18 15:30:08 +00:00