wabe-postgres 0.5.3 → 0.5.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/dist/index.d.ts +74 -0
- package/dist/index.js +5373 -0
- package/package.json +5 -2
- package/src/index.test.ts +0 -2183
- package/src/index.ts +0 -766
- package/tsconfig.json +0 -31
- package/utils/preload.ts +0 -5
- package/utils/testHelper.ts +0 -126
package/tsconfig.json
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
// Environment setup & latest features
|
|
4
|
-
"lib": ["ESNext"],
|
|
5
|
-
"target": "ESNext",
|
|
6
|
-
"module": "Preserve",
|
|
7
|
-
"moduleDetection": "force",
|
|
8
|
-
"jsx": "react-jsx",
|
|
9
|
-
"allowJs": true,
|
|
10
|
-
|
|
11
|
-
// Bundler mode
|
|
12
|
-
"moduleResolution": "bundler",
|
|
13
|
-
"allowImportingTsExtensions": true,
|
|
14
|
-
"verbatimModuleSyntax": false,
|
|
15
|
-
"noEmit": true,
|
|
16
|
-
|
|
17
|
-
// Best practices
|
|
18
|
-
"strict": true,
|
|
19
|
-
"skipLibCheck": true,
|
|
20
|
-
"noFallthroughCasesInSwitch": true,
|
|
21
|
-
"noUncheckedIndexedAccess": true,
|
|
22
|
-
"noImplicitOverride": true,
|
|
23
|
-
|
|
24
|
-
// Some stricter flags (disabled by default)
|
|
25
|
-
"noUnusedLocals": false,
|
|
26
|
-
"noUnusedParameters": false,
|
|
27
|
-
"noPropertyAccessFromIndexSignature": false,
|
|
28
|
-
"baseUrl": "."
|
|
29
|
-
},
|
|
30
|
-
"exclude": ["node_modules", "dist", "**/*.test.ts"]
|
|
31
|
-
}
|
package/utils/preload.ts
DELETED
package/utils/testHelper.ts
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { v4 as uuid } from 'uuid'
|
|
2
|
-
import { runDatabase } from 'wabe-postgres-launcher'
|
|
3
|
-
import { type ClassInterface, Wabe } from 'wabe'
|
|
4
|
-
import getPort from 'get-port'
|
|
5
|
-
import { PostgresAdapter } from '../src'
|
|
6
|
-
|
|
7
|
-
export const setupTests = async (additionalClasses: ClassInterface<any>[] = []) => {
|
|
8
|
-
const databaseId = uuid()
|
|
9
|
-
|
|
10
|
-
const port = await getPort()
|
|
11
|
-
|
|
12
|
-
await runDatabase()
|
|
13
|
-
|
|
14
|
-
const wabe = new Wabe<any>({
|
|
15
|
-
isProduction: false,
|
|
16
|
-
rootKey:
|
|
17
|
-
'0uwFvUxM$ceFuF1aEtTtZMa7DUN2NZudqgY5ve5W*QCyb58cwMj9JeoaV@d#%29v&aJzswuudVU1%nAT+rxS0Bh&OkgBYc0PH18*',
|
|
18
|
-
database: {
|
|
19
|
-
adapter: new PostgresAdapter({
|
|
20
|
-
databaseUrl: 'postgresql://wabe:wabe@localhost:5432',
|
|
21
|
-
databaseName: databaseId,
|
|
22
|
-
}),
|
|
23
|
-
},
|
|
24
|
-
authentication: {
|
|
25
|
-
roles: ['Client', 'Client2', 'Client3', 'Admin'],
|
|
26
|
-
session: {
|
|
27
|
-
jwtSecret: 'dev',
|
|
28
|
-
cookieSession: true,
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
security: {
|
|
32
|
-
disableCSRFProtection: true,
|
|
33
|
-
},
|
|
34
|
-
port,
|
|
35
|
-
schema: {
|
|
36
|
-
classes: [
|
|
37
|
-
...additionalClasses,
|
|
38
|
-
{
|
|
39
|
-
name: 'Test',
|
|
40
|
-
fields: {
|
|
41
|
-
field1: { type: 'String' },
|
|
42
|
-
int: { type: 'Int' },
|
|
43
|
-
float: { type: 'Float' },
|
|
44
|
-
array: { type: 'Array', typeValue: 'String' },
|
|
45
|
-
date: { type: 'Date' },
|
|
46
|
-
enum: { type: 'AuthenticationProvider' },
|
|
47
|
-
object: {
|
|
48
|
-
type: 'Object',
|
|
49
|
-
object: {
|
|
50
|
-
name: 'Object',
|
|
51
|
-
fields: {
|
|
52
|
-
array: {
|
|
53
|
-
type: 'Array',
|
|
54
|
-
typeValue: 'Object',
|
|
55
|
-
object: {
|
|
56
|
-
name: 'SubObject',
|
|
57
|
-
fields: {
|
|
58
|
-
string: {
|
|
59
|
-
type: 'String',
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
name: 'User',
|
|
71
|
-
fields: {
|
|
72
|
-
name: { type: 'String' },
|
|
73
|
-
age: { type: 'Int' },
|
|
74
|
-
isAdmin: { type: 'Boolean', defaultValue: false },
|
|
75
|
-
floatValue: { type: 'Float' },
|
|
76
|
-
birthDate: { type: 'Date' },
|
|
77
|
-
arrayValue: {
|
|
78
|
-
type: 'Array',
|
|
79
|
-
typeValue: 'String',
|
|
80
|
-
},
|
|
81
|
-
test: { type: 'TestScalar' },
|
|
82
|
-
},
|
|
83
|
-
searchableFields: ['email'],
|
|
84
|
-
permissions: {
|
|
85
|
-
create: {
|
|
86
|
-
requireAuthentication: false,
|
|
87
|
-
},
|
|
88
|
-
delete: {
|
|
89
|
-
requireAuthentication: true,
|
|
90
|
-
},
|
|
91
|
-
update: {
|
|
92
|
-
requireAuthentication: false,
|
|
93
|
-
},
|
|
94
|
-
read: {
|
|
95
|
-
requireAuthentication: false,
|
|
96
|
-
},
|
|
97
|
-
acl: async (hookObject) => {
|
|
98
|
-
await hookObject.addACL('users', {
|
|
99
|
-
userId: hookObject.object?.id,
|
|
100
|
-
read: true,
|
|
101
|
-
write: true,
|
|
102
|
-
})
|
|
103
|
-
|
|
104
|
-
await hookObject.addACL('roles', null)
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
],
|
|
109
|
-
scalars: [
|
|
110
|
-
{
|
|
111
|
-
name: 'TestScalar',
|
|
112
|
-
description: 'Test scalar',
|
|
113
|
-
},
|
|
114
|
-
],
|
|
115
|
-
},
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
await wabe.start()
|
|
119
|
-
|
|
120
|
-
return { wabe, port }
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export const closeTests = async (wabe: Wabe<any>) => {
|
|
124
|
-
await wabe.controllers?.database?.adapter?.close()
|
|
125
|
-
await wabe.close()
|
|
126
|
-
}
|