@things-factory/oauth2-client 8.0.0 → 9.0.0-beta.3

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.
@@ -1,127 +0,0 @@
1
- import { Field, InputType, Int, ObjectType } from 'type-graphql'
2
- import { GraphQLJWT } from 'graphql-scalars'
3
-
4
- import { Oauth2Client } from './oauth2-client'
5
-
6
- @InputType()
7
- export class NewOauth2Client {
8
- @Field()
9
- name: string
10
-
11
- @Field({ nullable: true })
12
- description?: string
13
-
14
- @Field({ nullable: true })
15
- icon?: string
16
-
17
- @Field({ nullable: true })
18
- grantType?: string
19
-
20
- @Field({ nullable: true })
21
- clientId?: string
22
-
23
- @Field({ nullable: true })
24
- clientSecret?: string
25
-
26
- @Field({ nullable: true })
27
- callbackUrl?: string
28
-
29
- @Field({ nullable: true })
30
- authUrl?: string
31
-
32
- @Field({ nullable: true })
33
- accessTokenUrl?: string
34
-
35
- @Field({ nullable: true })
36
- webhook?: string
37
-
38
- @Field({ nullable: true })
39
- username?: string
40
-
41
- @Field({ nullable: true })
42
- password?: string
43
-
44
- @Field({ nullable: true })
45
- codeChallengeMethod?: string
46
-
47
- @Field({ nullable: true })
48
- codeVerifier?: string
49
-
50
- @Field({ nullable: true })
51
- scopes?: string
52
-
53
- @Field({ nullable: true })
54
- accessToken?: string
55
-
56
- @Field({ nullable: true })
57
- refreshToken?: string
58
-
59
- @Field(type => GraphQLJWT, { nullable: true })
60
- jwtToken?: string
61
- }
62
-
63
- @InputType()
64
- export class Oauth2ClientPatch {
65
- @Field({ nullable: true })
66
- name?: string
67
-
68
- @Field({ nullable: true })
69
- description?: string
70
-
71
- @Field({ nullable: true })
72
- icon?: string
73
-
74
- @Field({ nullable: true })
75
- grantType?: string
76
-
77
- @Field({ nullable: true })
78
- clientId?: string
79
-
80
- @Field({ nullable: true })
81
- clientSecret?: string
82
-
83
- @Field({ nullable: true })
84
- callbackUrl?: string
85
-
86
- @Field({ nullable: true })
87
- authUrl?: string
88
-
89
- @Field({ nullable: true })
90
- accessTokenUrl?: string
91
-
92
- @Field({ nullable: true })
93
- webhook?: string
94
-
95
- @Field({ nullable: true })
96
- username?: string
97
-
98
- @Field({ nullable: true })
99
- password?: string
100
-
101
- @Field({ nullable: true })
102
- codeChallengeMethod?: string
103
-
104
- @Field({ nullable: true })
105
- codeVerifier?: string
106
-
107
- @Field({ nullable: true })
108
- scopes?: string
109
-
110
- @Field({ nullable: true })
111
- accessToken?: string
112
-
113
- @Field({ nullable: true })
114
- refreshToken?: string
115
-
116
- @Field(type => GraphQLJWT, { nullable: true })
117
- jwtToken?: string
118
- }
119
-
120
- @ObjectType()
121
- export class Oauth2ClientList {
122
- @Field(type => [Oauth2Client])
123
- items: Oauth2Client[]
124
-
125
- @Field(type => Int)
126
- total: number
127
- }
@@ -1,152 +0,0 @@
1
- import { Field, ID, ObjectType } from 'type-graphql'
2
- import { GraphQLJWT } from 'graphql-scalars'
3
- import {
4
- Column,
5
- CreateDateColumn,
6
- Entity,
7
- Index,
8
- ManyToOne,
9
- PrimaryGeneratedColumn,
10
- RelationId,
11
- UpdateDateColumn
12
- } from 'typeorm'
13
-
14
- import { User } from '@things-factory/auth-base'
15
- import { Domain } from '@things-factory/shell'
16
-
17
- @Entity()
18
- @Index('ix_oauth2_client_0', (oauth2Client: Oauth2Client) => [oauth2Client.domain, oauth2Client.name], { unique: true })
19
- @ObjectType({ description: 'Entity for Oauth2Client' })
20
- export class Oauth2Client {
21
- @PrimaryGeneratedColumn('uuid')
22
- @Field(type => ID)
23
- readonly id: string
24
-
25
- @ManyToOne(type => Domain)
26
- @Field(type => Domain)
27
- domain?: Domain
28
-
29
- @RelationId((oauth2Client: Oauth2Client) => oauth2Client.domain)
30
- domainId?: string
31
-
32
- @Column()
33
- @Field()
34
- name: string
35
-
36
- @Column({ nullable: true })
37
- @Field({ nullable: true })
38
- description?: string
39
-
40
- @Column({ nullable: true })
41
- @Field({ nullable: true })
42
- icon?: string
43
-
44
- @Column({ nullable: true })
45
- @Field({ nullable: true })
46
- grantType?: string
47
-
48
- @Column({ nullable: true })
49
- @Field({ nullable: true })
50
- clientId?: string
51
-
52
- @Column({ nullable: true })
53
- @Field({ nullable: true })
54
- clientSecret?: string
55
-
56
- @Column({ nullable: true })
57
- @Field({ nullable: true })
58
- accessTokenUrl?: string
59
-
60
- @Column({ nullable: true })
61
- @Field({ nullable: true })
62
- authUrl?: string
63
-
64
- @Column({ nullable: true })
65
- @Field({ nullable: true })
66
- callbackUrl?: string
67
-
68
- @Column({ nullable: true })
69
- @Field({ nullable: true })
70
- webhook?: string
71
-
72
- @Column({ nullable: true })
73
- @Field({ nullable: true })
74
- username?: string
75
-
76
- @Column({ nullable: true })
77
- @Field({ nullable: true })
78
- password?: string
79
-
80
- @Column({ nullable: true })
81
- @Field({ nullable: true })
82
- codeChallengeMethod?: string
83
-
84
- @Column({ nullable: true })
85
- @Field({ nullable: true })
86
- codeVerifier?: string
87
-
88
- @Column({ nullable: true })
89
- @Field({ nullable: true })
90
- scopes?: string
91
-
92
- @Column({ nullable: true })
93
- @Field({ nullable: true })
94
- accessToken?: string
95
-
96
- @Column({ nullable: true })
97
- @Field({ nullable: true })
98
- refreshToken?: string
99
-
100
- @Column({ nullable: true })
101
- @Field({ nullable: true })
102
- expires?: Date
103
-
104
- @Column({ nullable: true })
105
- @Field({ nullable: true })
106
- state?: string
107
-
108
- @Column({ nullable: true })
109
- @Field(type => GraphQLJWT, { nullable: true })
110
- jwtToken?: string
111
-
112
- @Column({ nullable: true })
113
- @Field({ nullable: true })
114
- tokenType?: string
115
-
116
- @CreateDateColumn()
117
- @Field({ nullable: true })
118
- createdAt?: Date
119
-
120
- @UpdateDateColumn()
121
- @Field({ nullable: true })
122
- updatedAt?: Date
123
-
124
- @ManyToOne(type => User, { nullable: true })
125
- @Field(type => User, { nullable: true })
126
- creator?: User
127
-
128
- @RelationId((oauth2Client: Oauth2Client) => oauth2Client.creator)
129
- creatorId?: string
130
-
131
- @ManyToOne(type => User, { nullable: true })
132
- @Field(type => User, { nullable: true })
133
- updater?: User
134
-
135
- @RelationId((oauth2Client: Oauth2Client) => oauth2Client.updater)
136
- updaterId?: string
137
-
138
- getAuthHeaders() {
139
- if (this.tokenType == 'bearer') {
140
- return {
141
- Authorization: `Bearer ${this.accessToken}`
142
- }
143
- } else if (this.tokenType == 'basic' || !this.tokenType) {
144
- const encoded = Buffer.from(`${this.username}:${this.password}`).toString('base64')
145
- return {
146
- Authorization: `Basic ${encoded}`
147
- }
148
- }
149
-
150
- return {}
151
- }
152
- }
@@ -1,11 +0,0 @@
1
- {
2
- "extends": "../../tsconfig-base.json",
3
- "compilerOptions": {
4
- "strict": false,
5
- "declaration": true,
6
- "module": "commonjs",
7
- "outDir": "../dist-server",
8
- "baseUrl": "./"
9
- },
10
- "include": ["./**/*"]
11
- }