alepha 0.10.4 → 0.10.5
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/README.md +7 -19
- package/api/files.d.ts +43 -45
- package/api/jobs.d.ts +166 -168
- package/api/users.d.ts +219 -218
- package/bucket.d.ts +81 -4
- package/devtools.d.ts +247 -247
- package/package.json +47 -47
- package/postgres.d.ts +31 -11
- package/react/auth.d.ts +5 -0
- package/react.d.ts +26 -26
- package/server/links.d.ts +29 -29
package/README.md
CHANGED
|
@@ -38,25 +38,15 @@ Alepha is an opinionated framework that handles everything from database to fron
|
|
|
38
38
|
|
|
39
39
|
It uses a descriptor-based architecture (`$action`, `$page`, `$repository`, etc.) and enforces type safety across the entire stack.
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
import { run } from "alepha";
|
|
43
|
-
import { $action } from "alepha/server";
|
|
44
|
-
|
|
45
|
-
class App {
|
|
46
|
-
hello = $action({
|
|
47
|
-
handler: () => "Hello world!",
|
|
48
|
-
})
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
run(App);
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
👉 For more information, please visit the [documentation](https://feunard.github.io/alepha/).
|
|
41
|
+
For more information, please visit the [documentation](https://feunard.github.io/alepha/).
|
|
55
42
|
|
|
56
43
|
## Examples
|
|
57
44
|
|
|
58
45
|
### Type-safe API endpoint
|
|
59
46
|
|
|
47
|
+
Write type-safe API endpoints with automatic OpenAPI documentation and more.
|
|
48
|
+
|
|
49
|
+
|
|
60
50
|
```ts
|
|
61
51
|
// app.ts
|
|
62
52
|
import { run, t } from "alepha";
|
|
@@ -96,9 +86,9 @@ node app.ts
|
|
|
96
86
|
|
|
97
87
|
### Database with Drizzle ORM
|
|
98
88
|
|
|
99
|
-
Drizzle ORM is a type-safe ORM for TypeScript, bundled inside Alepha.
|
|
89
|
+
[Drizzle ORM](https://orm.drizzle.team/) is a type-safe ORM for TypeScript, bundled inside Alepha.
|
|
100
90
|
|
|
101
|
-
|
|
91
|
+
You need `drizzle-kit` CLI as dev dependencies:
|
|
102
92
|
|
|
103
93
|
```bash
|
|
104
94
|
npm install -D drizzle-kit
|
|
@@ -143,7 +133,7 @@ node app.ts
|
|
|
143
133
|
|
|
144
134
|
### React Application
|
|
145
135
|
|
|
146
|
-
|
|
136
|
+
Build full-stack React applications, with server-side rendering (SSR) and client-side rendering (CSR).
|
|
147
137
|
|
|
148
138
|
[React](https://react.dev) is required as a `dependency`:
|
|
149
139
|
|
|
@@ -222,8 +212,6 @@ Then run Vite:
|
|
|
222
212
|
npx vite
|
|
223
213
|
```
|
|
224
214
|
|
|
225
|
-
Plenty of other features are available, please check the [documentation](https://feunard.github.io/alepha/).
|
|
226
|
-
|
|
227
215
|
## License
|
|
228
216
|
|
|
229
217
|
MIT
|
package/api/files.d.ts
CHANGED
|
@@ -1,43 +1,41 @@
|
|
|
1
1
|
import { BucketDescriptor } from "alepha/bucket";
|
|
2
2
|
import * as _alepha_core1 from "alepha";
|
|
3
3
|
import { Alepha, FileLike, Static } from "alepha";
|
|
4
|
-
import * as
|
|
4
|
+
import * as _alepha_postgres50 from "alepha/postgres";
|
|
5
5
|
import { Page } from "alepha/postgres";
|
|
6
6
|
import { Ok } from "alepha/server";
|
|
7
7
|
import { DateTimeProvider, DurationLike } from "alepha/datetime";
|
|
8
8
|
import * as _alepha_logger0 from "alepha/logger";
|
|
9
9
|
import { UserAccountToken } from "alepha/security";
|
|
10
10
|
import * as typebox68 from "typebox";
|
|
11
|
-
import * as _alepha_postgres_src_helpers_pgAttr0 from "alepha/postgres/src/helpers/pgAttr";
|
|
12
|
-
import * as _alepha_postgres_src_helpers_pgAttr_ts23 from "alepha/postgres/src/helpers/pgAttr.ts";
|
|
13
11
|
|
|
14
12
|
//#region src/entities/files.d.ts
|
|
15
|
-
declare const files:
|
|
16
|
-
id:
|
|
17
|
-
version:
|
|
18
|
-
createdAt:
|
|
19
|
-
updatedAt:
|
|
13
|
+
declare const files: _alepha_postgres50.PgTableWithColumnsAndSchema<_alepha_postgres50.PgTableConfig<"files", typebox68.TObject<{
|
|
14
|
+
id: _alepha_postgres50.PgAttr<_alepha_postgres50.PgAttr<typebox68.TString, typeof _alepha_postgres50.PG_PRIMARY_KEY>, typeof _alepha_postgres50.PG_DEFAULT>;
|
|
15
|
+
version: _alepha_postgres50.PgAttr<_alepha_postgres50.PgAttr<typebox68.TInteger, typeof _alepha_postgres50.PG_VERSION>, typeof _alepha_postgres50.PG_DEFAULT>;
|
|
16
|
+
createdAt: _alepha_postgres50.PgAttr<_alepha_postgres50.PgAttr<typebox68.TString, typeof _alepha_postgres50.PG_CREATED_AT>, typeof _alepha_postgres50.PG_DEFAULT>;
|
|
17
|
+
updatedAt: _alepha_postgres50.PgAttr<_alepha_postgres50.PgAttr<typebox68.TString, typeof _alepha_postgres50.PG_UPDATED_AT>, typeof _alepha_postgres50.PG_DEFAULT>;
|
|
20
18
|
blobId: typebox68.TString;
|
|
21
19
|
creator: typebox68.TOptional<typebox68.TString>;
|
|
22
20
|
creatorRealm: typebox68.TOptional<typebox68.TString>;
|
|
23
21
|
creatorName: typebox68.TOptional<typebox68.TString>;
|
|
24
|
-
|
|
22
|
+
bucket: typebox68.TString;
|
|
25
23
|
expirationDate: typebox68.TOptional<typebox68.TString>;
|
|
26
24
|
name: typebox68.TString;
|
|
27
25
|
size: typebox68.TNumber;
|
|
28
26
|
mimeType: typebox68.TString;
|
|
29
27
|
tags: typebox68.TOptional<typebox68.TArray<typebox68.TString>>;
|
|
30
28
|
checksum: typebox68.TOptional<typebox68.TString>;
|
|
31
|
-
}>,
|
|
32
|
-
id:
|
|
33
|
-
version:
|
|
34
|
-
createdAt:
|
|
35
|
-
updatedAt:
|
|
29
|
+
}>, _alepha_postgres50.FromSchema<typebox68.TObject<{
|
|
30
|
+
id: _alepha_postgres50.PgAttr<_alepha_postgres50.PgAttr<typebox68.TString, typeof _alepha_postgres50.PG_PRIMARY_KEY>, typeof _alepha_postgres50.PG_DEFAULT>;
|
|
31
|
+
version: _alepha_postgres50.PgAttr<_alepha_postgres50.PgAttr<typebox68.TInteger, typeof _alepha_postgres50.PG_VERSION>, typeof _alepha_postgres50.PG_DEFAULT>;
|
|
32
|
+
createdAt: _alepha_postgres50.PgAttr<_alepha_postgres50.PgAttr<typebox68.TString, typeof _alepha_postgres50.PG_CREATED_AT>, typeof _alepha_postgres50.PG_DEFAULT>;
|
|
33
|
+
updatedAt: _alepha_postgres50.PgAttr<_alepha_postgres50.PgAttr<typebox68.TString, typeof _alepha_postgres50.PG_UPDATED_AT>, typeof _alepha_postgres50.PG_DEFAULT>;
|
|
36
34
|
blobId: typebox68.TString;
|
|
37
35
|
creator: typebox68.TOptional<typebox68.TString>;
|
|
38
36
|
creatorRealm: typebox68.TOptional<typebox68.TString>;
|
|
39
37
|
creatorName: typebox68.TOptional<typebox68.TString>;
|
|
40
|
-
|
|
38
|
+
bucket: typebox68.TString;
|
|
41
39
|
expirationDate: typebox68.TOptional<typebox68.TString>;
|
|
42
40
|
name: typebox68.TString;
|
|
43
41
|
size: typebox68.TNumber;
|
|
@@ -45,15 +43,15 @@ declare const files: _alepha_postgres26.PgTableWithColumnsAndSchema<_alepha_post
|
|
|
45
43
|
tags: typebox68.TOptional<typebox68.TArray<typebox68.TString>>;
|
|
46
44
|
checksum: typebox68.TOptional<typebox68.TString>;
|
|
47
45
|
}>>>, typebox68.TObject<{
|
|
48
|
-
id:
|
|
49
|
-
version:
|
|
50
|
-
createdAt:
|
|
51
|
-
updatedAt:
|
|
46
|
+
id: _alepha_postgres50.PgAttr<_alepha_postgres50.PgAttr<typebox68.TString, typeof _alepha_postgres50.PG_PRIMARY_KEY>, typeof _alepha_postgres50.PG_DEFAULT>;
|
|
47
|
+
version: _alepha_postgres50.PgAttr<_alepha_postgres50.PgAttr<typebox68.TInteger, typeof _alepha_postgres50.PG_VERSION>, typeof _alepha_postgres50.PG_DEFAULT>;
|
|
48
|
+
createdAt: _alepha_postgres50.PgAttr<_alepha_postgres50.PgAttr<typebox68.TString, typeof _alepha_postgres50.PG_CREATED_AT>, typeof _alepha_postgres50.PG_DEFAULT>;
|
|
49
|
+
updatedAt: _alepha_postgres50.PgAttr<_alepha_postgres50.PgAttr<typebox68.TString, typeof _alepha_postgres50.PG_UPDATED_AT>, typeof _alepha_postgres50.PG_DEFAULT>;
|
|
52
50
|
blobId: typebox68.TString;
|
|
53
51
|
creator: typebox68.TOptional<typebox68.TString>;
|
|
54
52
|
creatorRealm: typebox68.TOptional<typebox68.TString>;
|
|
55
53
|
creatorName: typebox68.TOptional<typebox68.TString>;
|
|
56
|
-
|
|
54
|
+
bucket: typebox68.TString;
|
|
57
55
|
expirationDate: typebox68.TOptional<typebox68.TString>;
|
|
58
56
|
name: typebox68.TString;
|
|
59
57
|
size: typebox68.TNumber;
|
|
@@ -68,22 +66,22 @@ declare const fileQuerySchema: typebox68.TObject<{
|
|
|
68
66
|
page: typebox68.TOptional<typebox68.TInteger>;
|
|
69
67
|
size: typebox68.TOptional<typebox68.TInteger>;
|
|
70
68
|
sort: typebox68.TOptional<typebox68.TString>;
|
|
71
|
-
|
|
69
|
+
bucket: typebox68.TOptional<typebox68.TString>;
|
|
72
70
|
tags: typebox68.TOptional<typebox68.TArray<typebox68.TString>>;
|
|
73
71
|
}>;
|
|
74
72
|
type FileQuery = Static<typeof fileQuerySchema>;
|
|
75
73
|
//#endregion
|
|
76
74
|
//#region src/schemas/fileResourceSchema.d.ts
|
|
77
75
|
declare const fileResourceSchema: typebox68.TObject<{
|
|
78
|
-
id:
|
|
79
|
-
version:
|
|
80
|
-
createdAt:
|
|
81
|
-
updatedAt:
|
|
76
|
+
id: _alepha_postgres50.PgAttr<_alepha_postgres50.PgAttr<typebox68.TString, typeof _alepha_postgres50.PG_PRIMARY_KEY>, typeof _alepha_postgres50.PG_DEFAULT>;
|
|
77
|
+
version: _alepha_postgres50.PgAttr<_alepha_postgres50.PgAttr<typebox68.TInteger, typeof _alepha_postgres50.PG_VERSION>, typeof _alepha_postgres50.PG_DEFAULT>;
|
|
78
|
+
createdAt: _alepha_postgres50.PgAttr<_alepha_postgres50.PgAttr<typebox68.TString, typeof _alepha_postgres50.PG_CREATED_AT>, typeof _alepha_postgres50.PG_DEFAULT>;
|
|
79
|
+
updatedAt: _alepha_postgres50.PgAttr<_alepha_postgres50.PgAttr<typebox68.TString, typeof _alepha_postgres50.PG_UPDATED_AT>, typeof _alepha_postgres50.PG_DEFAULT>;
|
|
82
80
|
blobId: typebox68.TString;
|
|
83
81
|
creator: typebox68.TOptional<typebox68.TString>;
|
|
84
82
|
creatorRealm: typebox68.TOptional<typebox68.TString>;
|
|
85
83
|
creatorName: typebox68.TOptional<typebox68.TString>;
|
|
86
|
-
|
|
84
|
+
bucket: typebox68.TString;
|
|
87
85
|
expirationDate: typebox68.TOptional<typebox68.TString>;
|
|
88
86
|
name: typebox68.TString;
|
|
89
87
|
size: typebox68.TNumber;
|
|
@@ -97,32 +95,32 @@ type FileResource = Static<typeof fileResourceSchema>;
|
|
|
97
95
|
declare class FileService {
|
|
98
96
|
protected readonly alepha: Alepha;
|
|
99
97
|
protected readonly log: _alepha_logger0.Logger;
|
|
100
|
-
protected readonly fileRepository:
|
|
101
|
-
id:
|
|
102
|
-
version:
|
|
103
|
-
createdAt:
|
|
104
|
-
updatedAt:
|
|
98
|
+
protected readonly fileRepository: _alepha_postgres50.RepositoryDescriptor<_alepha_postgres50.PgTableConfig<"files", typebox68.TObject<{
|
|
99
|
+
id: _alepha_postgres50.PgAttr<_alepha_postgres50.PgAttr<typebox68.TString, typeof _alepha_postgres50.PG_PRIMARY_KEY>, typeof _alepha_postgres50.PG_DEFAULT>;
|
|
100
|
+
version: _alepha_postgres50.PgAttr<_alepha_postgres50.PgAttr<typebox68.TInteger, typeof _alepha_postgres50.PG_VERSION>, typeof _alepha_postgres50.PG_DEFAULT>;
|
|
101
|
+
createdAt: _alepha_postgres50.PgAttr<_alepha_postgres50.PgAttr<typebox68.TString, typeof _alepha_postgres50.PG_CREATED_AT>, typeof _alepha_postgres50.PG_DEFAULT>;
|
|
102
|
+
updatedAt: _alepha_postgres50.PgAttr<_alepha_postgres50.PgAttr<typebox68.TString, typeof _alepha_postgres50.PG_UPDATED_AT>, typeof _alepha_postgres50.PG_DEFAULT>;
|
|
105
103
|
blobId: typebox68.TString;
|
|
106
104
|
creator: typebox68.TOptional<typebox68.TString>;
|
|
107
105
|
creatorRealm: typebox68.TOptional<typebox68.TString>;
|
|
108
106
|
creatorName: typebox68.TOptional<typebox68.TString>;
|
|
109
|
-
|
|
107
|
+
bucket: typebox68.TString;
|
|
110
108
|
expirationDate: typebox68.TOptional<typebox68.TString>;
|
|
111
109
|
name: typebox68.TString;
|
|
112
110
|
size: typebox68.TNumber;
|
|
113
111
|
mimeType: typebox68.TString;
|
|
114
112
|
tags: typebox68.TOptional<typebox68.TArray<typebox68.TString>>;
|
|
115
113
|
checksum: typebox68.TOptional<typebox68.TString>;
|
|
116
|
-
}>,
|
|
117
|
-
id:
|
|
118
|
-
version:
|
|
119
|
-
createdAt:
|
|
120
|
-
updatedAt:
|
|
114
|
+
}>, _alepha_postgres50.FromSchema<typebox68.TObject<{
|
|
115
|
+
id: _alepha_postgres50.PgAttr<_alepha_postgres50.PgAttr<typebox68.TString, typeof _alepha_postgres50.PG_PRIMARY_KEY>, typeof _alepha_postgres50.PG_DEFAULT>;
|
|
116
|
+
version: _alepha_postgres50.PgAttr<_alepha_postgres50.PgAttr<typebox68.TInteger, typeof _alepha_postgres50.PG_VERSION>, typeof _alepha_postgres50.PG_DEFAULT>;
|
|
117
|
+
createdAt: _alepha_postgres50.PgAttr<_alepha_postgres50.PgAttr<typebox68.TString, typeof _alepha_postgres50.PG_CREATED_AT>, typeof _alepha_postgres50.PG_DEFAULT>;
|
|
118
|
+
updatedAt: _alepha_postgres50.PgAttr<_alepha_postgres50.PgAttr<typebox68.TString, typeof _alepha_postgres50.PG_UPDATED_AT>, typeof _alepha_postgres50.PG_DEFAULT>;
|
|
121
119
|
blobId: typebox68.TString;
|
|
122
120
|
creator: typebox68.TOptional<typebox68.TString>;
|
|
123
121
|
creatorRealm: typebox68.TOptional<typebox68.TString>;
|
|
124
122
|
creatorName: typebox68.TOptional<typebox68.TString>;
|
|
125
|
-
|
|
123
|
+
bucket: typebox68.TString;
|
|
126
124
|
expirationDate: typebox68.TOptional<typebox68.TString>;
|
|
127
125
|
name: typebox68.TString;
|
|
128
126
|
size: typebox68.TNumber;
|
|
@@ -130,15 +128,15 @@ declare class FileService {
|
|
|
130
128
|
tags: typebox68.TOptional<typebox68.TArray<typebox68.TString>>;
|
|
131
129
|
checksum: typebox68.TOptional<typebox68.TString>;
|
|
132
130
|
}>>>, typebox68.TObject<{
|
|
133
|
-
id:
|
|
134
|
-
version:
|
|
135
|
-
createdAt:
|
|
136
|
-
updatedAt:
|
|
131
|
+
id: _alepha_postgres50.PgAttr<_alepha_postgres50.PgAttr<typebox68.TString, typeof _alepha_postgres50.PG_PRIMARY_KEY>, typeof _alepha_postgres50.PG_DEFAULT>;
|
|
132
|
+
version: _alepha_postgres50.PgAttr<_alepha_postgres50.PgAttr<typebox68.TInteger, typeof _alepha_postgres50.PG_VERSION>, typeof _alepha_postgres50.PG_DEFAULT>;
|
|
133
|
+
createdAt: _alepha_postgres50.PgAttr<_alepha_postgres50.PgAttr<typebox68.TString, typeof _alepha_postgres50.PG_CREATED_AT>, typeof _alepha_postgres50.PG_DEFAULT>;
|
|
134
|
+
updatedAt: _alepha_postgres50.PgAttr<_alepha_postgres50.PgAttr<typebox68.TString, typeof _alepha_postgres50.PG_UPDATED_AT>, typeof _alepha_postgres50.PG_DEFAULT>;
|
|
137
135
|
blobId: typebox68.TString;
|
|
138
136
|
creator: typebox68.TOptional<typebox68.TString>;
|
|
139
137
|
creatorRealm: typebox68.TOptional<typebox68.TString>;
|
|
140
138
|
creatorName: typebox68.TOptional<typebox68.TString>;
|
|
141
|
-
|
|
139
|
+
bucket: typebox68.TString;
|
|
142
140
|
expirationDate: typebox68.TOptional<typebox68.TString>;
|
|
143
141
|
name: typebox68.TString;
|
|
144
142
|
size: typebox68.TNumber;
|
|
@@ -150,13 +148,13 @@ declare class FileService {
|
|
|
150
148
|
protected readonly defaultBucket: BucketDescriptor;
|
|
151
149
|
protected onUploadFile: _alepha_core1.HookDescriptor<"bucket:file:uploaded">;
|
|
152
150
|
protected onDeleteBucketFile: _alepha_core1.HookDescriptor<"bucket:file:deleted">;
|
|
153
|
-
|
|
151
|
+
bucket(bucketName?: string): BucketDescriptor;
|
|
154
152
|
findFiles(q?: FileQuery): Promise<Page<FileEntity>>;
|
|
155
153
|
findExpiredFiles(): Promise<FileEntity[]>;
|
|
156
154
|
protected getExpirationDate(ttl?: DurationLike): string | undefined;
|
|
157
155
|
uploadFile(file: FileLike, options?: {
|
|
158
156
|
expirationDate?: string | Date;
|
|
159
|
-
|
|
157
|
+
bucket?: string;
|
|
160
158
|
user?: UserAccountToken;
|
|
161
159
|
tags?: string[];
|
|
162
160
|
}): Promise<FileEntity>;
|