@things-factory/oauth2-client 5.0.7 → 6.0.0-alpha.0

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.
Files changed (129) hide show
  1. package/client/{bootstrap.js → bootstrap.ts} +0 -0
  2. package/{server/controllers → client}/index.ts +0 -0
  3. package/client/pages/oauth2-client/oauth2-client-importer.ts +97 -0
  4. package/client/pages/oauth2-client/oauth2-client-list-page.ts +337 -0
  5. package/client/pages/{oauth2-client-register.js → oauth2-client-register.ts} +79 -86
  6. package/client/pages/{oauth2-client.js → oauth2-client.ts} +157 -161
  7. package/client/pages/oauth2-clients.ts +192 -0
  8. package/client/{route.js → route.ts} +1 -1
  9. package/client/tsconfig.json +11 -0
  10. package/dist-client/bootstrap.d.ts +1 -0
  11. package/dist-client/bootstrap.js +2 -0
  12. package/dist-client/bootstrap.js.map +1 -0
  13. package/dist-client/index.d.ts +0 -0
  14. package/dist-client/index.js +2 -0
  15. package/dist-client/index.js.map +1 -0
  16. package/dist-client/pages/oauth2-client/oauth2-client-importer.d.ts +22 -0
  17. package/dist-client/pages/oauth2-client/oauth2-client-importer.js +100 -0
  18. package/dist-client/pages/oauth2-client/oauth2-client-importer.js.map +1 -0
  19. package/dist-client/pages/oauth2-client/oauth2-client-list-page.d.ts +55 -0
  20. package/dist-client/pages/oauth2-client/oauth2-client-list-page.js +315 -0
  21. package/dist-client/pages/oauth2-client/oauth2-client-list-page.js.map +1 -0
  22. package/dist-client/pages/oauth2-client-register.d.ts +21 -0
  23. package/dist-client/pages/oauth2-client-register.js +190 -0
  24. package/dist-client/pages/oauth2-client-register.js.map +1 -0
  25. package/dist-client/pages/oauth2-client.d.ts +35 -0
  26. package/dist-client/pages/oauth2-client.js +586 -0
  27. package/dist-client/pages/oauth2-client.js.map +1 -0
  28. package/dist-client/pages/oauth2-clients.d.ts +1 -0
  29. package/dist-client/pages/oauth2-clients.js +194 -0
  30. package/dist-client/pages/oauth2-clients.js.map +1 -0
  31. package/dist-client/route.d.ts +1 -0
  32. package/dist-client/route.js +14 -0
  33. package/dist-client/route.js.map +1 -0
  34. package/dist-client/tsconfig.tsbuildinfo +1 -0
  35. package/dist-server/index.d.ts +2 -0
  36. package/dist-server/index.js +2 -16
  37. package/dist-server/index.js.map +1 -1
  38. package/dist-server/routes.d.ts +1 -0
  39. package/dist-server/routes.js +10 -18
  40. package/dist-server/routes.js.map +1 -1
  41. package/dist-server/service/index.d.ts +5 -0
  42. package/dist-server/service/index.js +19 -0
  43. package/dist-server/service/index.js.map +1 -0
  44. package/dist-server/service/oauth2-client/index.d.ts +5 -0
  45. package/dist-server/service/oauth2-client/index.js +9 -0
  46. package/dist-server/service/oauth2-client/index.js.map +1 -0
  47. package/dist-server/service/oauth2-client/oauth2-client-mutation.d.ts +11 -0
  48. package/dist-server/service/oauth2-client/oauth2-client-mutation.js +165 -0
  49. package/dist-server/service/oauth2-client/oauth2-client-mutation.js.map +1 -0
  50. package/dist-server/service/oauth2-client/oauth2-client-query.d.ts +11 -0
  51. package/dist-server/service/oauth2-client/oauth2-client-query.js +79 -0
  52. package/dist-server/service/oauth2-client/oauth2-client-query.js.map +1 -0
  53. package/dist-server/service/oauth2-client/oauth2-client-type.d.ts +45 -0
  54. package/dist-server/service/oauth2-client/oauth2-client-type.js +177 -0
  55. package/dist-server/service/oauth2-client/oauth2-client-type.js.map +1 -0
  56. package/dist-server/service/oauth2-client/oauth2-client.d.ts +39 -0
  57. package/dist-server/service/oauth2-client/oauth2-client.js +220 -0
  58. package/dist-server/service/oauth2-client/oauth2-client.js.map +1 -0
  59. package/dist-server/tsconfig.tsbuildinfo +1 -0
  60. package/package.json +12 -10
  61. package/server/index.ts +2 -3
  62. package/server/routes.ts +9 -20
  63. package/server/service/index.ts +17 -0
  64. package/server/service/oauth2-client/index.ts +6 -0
  65. package/server/service/oauth2-client/oauth2-client-mutation.ts +188 -0
  66. package/server/service/oauth2-client/oauth2-client-query.ts +50 -0
  67. package/server/service/oauth2-client/oauth2-client-type.ts +126 -0
  68. package/server/service/oauth2-client/oauth2-client.ts +193 -0
  69. package/server/tsconfig.json +11 -0
  70. package/things-factory.config.js +5 -14
  71. package/client/index.js +0 -1
  72. package/client/pages/oauth2-clients.js +0 -197
  73. package/dist-server/controllers/index.js +0 -1
  74. package/dist-server/controllers/index.js.map +0 -1
  75. package/dist-server/entities/index.js +0 -9
  76. package/dist-server/entities/index.js.map +0 -1
  77. package/dist-server/entities/oauth2-client.js +0 -190
  78. package/dist-server/entities/oauth2-client.js.map +0 -1
  79. package/dist-server/graphql/index.js +0 -34
  80. package/dist-server/graphql/index.js.map +0 -1
  81. package/dist-server/graphql/resolvers/index.js +0 -18
  82. package/dist-server/graphql/resolvers/index.js.map +0 -1
  83. package/dist-server/graphql/resolvers/oauth2-client/create-oauth2-client.js +0 -19
  84. package/dist-server/graphql/resolvers/oauth2-client/create-oauth2-client.js.map +0 -1
  85. package/dist-server/graphql/resolvers/oauth2-client/delete-oauth2-client.js +0 -12
  86. package/dist-server/graphql/resolvers/oauth2-client/delete-oauth2-client.js.map +0 -1
  87. package/dist-server/graphql/resolvers/oauth2-client/delete-oauth2-clients.js +0 -15
  88. package/dist-server/graphql/resolvers/oauth2-client/delete-oauth2-clients.js.map +0 -1
  89. package/dist-server/graphql/resolvers/oauth2-client/get-oauth2-access-token.js +0 -49
  90. package/dist-server/graphql/resolvers/oauth2-client/get-oauth2-access-token.js.map +0 -1
  91. package/dist-server/graphql/resolvers/oauth2-client/index.js +0 -15
  92. package/dist-server/graphql/resolvers/oauth2-client/index.js.map +0 -1
  93. package/dist-server/graphql/resolvers/oauth2-client/oauth2-client-query.js +0 -46
  94. package/dist-server/graphql/resolvers/oauth2-client/oauth2-client-query.js.map +0 -1
  95. package/dist-server/graphql/resolvers/oauth2-client/refresh-oauth2-access-token.js +0 -38
  96. package/dist-server/graphql/resolvers/oauth2-client/refresh-oauth2-access-token.js.map +0 -1
  97. package/dist-server/graphql/resolvers/oauth2-client/update-oauth2-client.js +0 -15
  98. package/dist-server/graphql/resolvers/oauth2-client/update-oauth2-client.js.map +0 -1
  99. package/dist-server/graphql/types/index.js +0 -18
  100. package/dist-server/graphql/types/index.js.map +0 -1
  101. package/dist-server/graphql/types/oauth2-client/index.js +0 -42
  102. package/dist-server/graphql/types/oauth2-client/index.js.map +0 -1
  103. package/dist-server/graphql/types/oauth2-client/new-oauth2-client.js +0 -30
  104. package/dist-server/graphql/types/oauth2-client/new-oauth2-client.js.map +0 -1
  105. package/dist-server/graphql/types/oauth2-client/oauth2-client-list.js +0 -14
  106. package/dist-server/graphql/types/oauth2-client/oauth2-client-list.js.map +0 -1
  107. package/dist-server/graphql/types/oauth2-client/oauth2-client-patch.js +0 -30
  108. package/dist-server/graphql/types/oauth2-client/oauth2-client-patch.js.map +0 -1
  109. package/dist-server/graphql/types/oauth2-client/oauth2-client.js +0 -38
  110. package/dist-server/graphql/types/oauth2-client/oauth2-client.js.map +0 -1
  111. package/server/entities/index.ts +0 -9
  112. package/server/entities/oauth2-client.ts +0 -156
  113. package/server/graphql/index.ts +0 -9
  114. package/server/graphql/resolvers/index.ts +0 -1
  115. package/server/graphql/resolvers/oauth2-client/create-oauth2-client.ts +0 -24
  116. package/server/graphql/resolvers/oauth2-client/delete-oauth2-client.ts +0 -10
  117. package/server/graphql/resolvers/oauth2-client/delete-oauth2-clients.ts +0 -13
  118. package/server/graphql/resolvers/oauth2-client/get-oauth2-access-token.ts +0 -64
  119. package/server/graphql/resolvers/oauth2-client/index.ts +0 -21
  120. package/server/graphql/resolvers/oauth2-client/oauth2-client-query.ts +0 -62
  121. package/server/graphql/resolvers/oauth2-client/refresh-oauth2-access-token.ts +0 -54
  122. package/server/graphql/resolvers/oauth2-client/update-oauth2-client.ts +0 -17
  123. package/server/graphql/types/index.ts +0 -1
  124. package/server/graphql/types/oauth2-client/index.ts +0 -23
  125. package/server/graphql/types/oauth2-client/new-oauth2-client.ts +0 -24
  126. package/server/graphql/types/oauth2-client/oauth2-client-list.ts +0 -8
  127. package/server/graphql/types/oauth2-client/oauth2-client-patch.ts +0 -24
  128. package/server/graphql/types/oauth2-client/oauth2-client.ts +0 -32
  129. package/tsconfig.json +0 -9
@@ -0,0 +1,220 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Oauth2Client = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const typeorm_1 = require("typeorm");
7
+ const auth_base_1 = require("@things-factory/auth-base");
8
+ const shell_1 = require("@things-factory/shell");
9
+ let Oauth2Client = class Oauth2Client {
10
+ getAuthHeaders() {
11
+ if (this.tokenType == 'bearer') {
12
+ return {
13
+ Authorization: `Bearer ${this.accessToken}`
14
+ };
15
+ }
16
+ else if (this.tokenType == 'basic' || !this.tokenType) {
17
+ const encoded = Buffer.from(`${this.username}:${this.password}`).toString('base64');
18
+ return {
19
+ Authorization: `Basic ${encoded}`
20
+ };
21
+ }
22
+ return {};
23
+ }
24
+ };
25
+ tslib_1.__decorate([
26
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
27
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID),
28
+ tslib_1.__metadata("design:type", String)
29
+ ], Oauth2Client.prototype, "id", void 0);
30
+ tslib_1.__decorate([
31
+ (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
32
+ (0, type_graphql_1.Field)({ nullable: true }),
33
+ tslib_1.__metadata("design:type", shell_1.Domain)
34
+ ], Oauth2Client.prototype, "domain", void 0);
35
+ tslib_1.__decorate([
36
+ (0, typeorm_1.RelationId)((oauth2Client) => oauth2Client.domain),
37
+ tslib_1.__metadata("design:type", String)
38
+ ], Oauth2Client.prototype, "domainId", void 0);
39
+ tslib_1.__decorate([
40
+ (0, typeorm_1.Column)(),
41
+ (0, type_graphql_1.Field)(),
42
+ tslib_1.__metadata("design:type", String)
43
+ ], Oauth2Client.prototype, "name", void 0);
44
+ tslib_1.__decorate([
45
+ (0, typeorm_1.Column)({
46
+ nullable: true
47
+ }),
48
+ (0, type_graphql_1.Field)({ nullable: true }),
49
+ tslib_1.__metadata("design:type", String)
50
+ ], Oauth2Client.prototype, "description", void 0);
51
+ tslib_1.__decorate([
52
+ (0, typeorm_1.Column)({
53
+ nullable: true
54
+ }),
55
+ (0, type_graphql_1.Field)({ nullable: true }),
56
+ tslib_1.__metadata("design:type", String)
57
+ ], Oauth2Client.prototype, "icon", void 0);
58
+ tslib_1.__decorate([
59
+ (0, typeorm_1.Column)({
60
+ nullable: true
61
+ }),
62
+ (0, type_graphql_1.Field)({ nullable: true }),
63
+ tslib_1.__metadata("design:type", String)
64
+ ], Oauth2Client.prototype, "grantType", void 0);
65
+ tslib_1.__decorate([
66
+ (0, typeorm_1.Column)({
67
+ nullable: true
68
+ }),
69
+ (0, type_graphql_1.Field)({ nullable: true }),
70
+ tslib_1.__metadata("design:type", String)
71
+ ], Oauth2Client.prototype, "clientId", void 0);
72
+ tslib_1.__decorate([
73
+ (0, typeorm_1.Column)({
74
+ nullable: true
75
+ }),
76
+ (0, type_graphql_1.Field)({ nullable: true }),
77
+ tslib_1.__metadata("design:type", String)
78
+ ], Oauth2Client.prototype, "clientSecret", void 0);
79
+ tslib_1.__decorate([
80
+ (0, typeorm_1.Column)({
81
+ nullable: true
82
+ }),
83
+ (0, type_graphql_1.Field)({ nullable: true }),
84
+ tslib_1.__metadata("design:type", String)
85
+ ], Oauth2Client.prototype, "accessTokenUrl", void 0);
86
+ tslib_1.__decorate([
87
+ (0, typeorm_1.Column)({
88
+ nullable: true
89
+ }),
90
+ (0, type_graphql_1.Field)({ nullable: true }),
91
+ tslib_1.__metadata("design:type", String)
92
+ ], Oauth2Client.prototype, "authUrl", void 0);
93
+ tslib_1.__decorate([
94
+ (0, typeorm_1.Column)({
95
+ nullable: true
96
+ }),
97
+ (0, type_graphql_1.Field)({ nullable: true }),
98
+ tslib_1.__metadata("design:type", String)
99
+ ], Oauth2Client.prototype, "callbackUrl", void 0);
100
+ tslib_1.__decorate([
101
+ (0, typeorm_1.Column)({
102
+ nullable: true
103
+ }),
104
+ (0, type_graphql_1.Field)({ nullable: true }),
105
+ tslib_1.__metadata("design:type", String)
106
+ ], Oauth2Client.prototype, "webhook", void 0);
107
+ tslib_1.__decorate([
108
+ (0, typeorm_1.Column)({
109
+ nullable: true
110
+ }),
111
+ (0, type_graphql_1.Field)({ nullable: true }),
112
+ tslib_1.__metadata("design:type", String)
113
+ ], Oauth2Client.prototype, "username", void 0);
114
+ tslib_1.__decorate([
115
+ (0, typeorm_1.Column)({
116
+ nullable: true
117
+ }),
118
+ (0, type_graphql_1.Field)({ nullable: true }),
119
+ tslib_1.__metadata("design:type", String)
120
+ ], Oauth2Client.prototype, "password", void 0);
121
+ tslib_1.__decorate([
122
+ (0, typeorm_1.Column)({
123
+ nullable: true
124
+ }),
125
+ (0, type_graphql_1.Field)({ nullable: true }),
126
+ tslib_1.__metadata("design:type", String)
127
+ ], Oauth2Client.prototype, "codeChallengeMethod", void 0);
128
+ tslib_1.__decorate([
129
+ (0, typeorm_1.Column)({
130
+ nullable: true
131
+ }),
132
+ (0, type_graphql_1.Field)({ nullable: true }),
133
+ tslib_1.__metadata("design:type", String)
134
+ ], Oauth2Client.prototype, "codeVerifier", void 0);
135
+ tslib_1.__decorate([
136
+ (0, typeorm_1.Column)({
137
+ nullable: true
138
+ }),
139
+ (0, type_graphql_1.Field)({ nullable: true }),
140
+ tslib_1.__metadata("design:type", String)
141
+ ], Oauth2Client.prototype, "scopes", void 0);
142
+ tslib_1.__decorate([
143
+ (0, typeorm_1.Column)({
144
+ nullable: true
145
+ }),
146
+ (0, type_graphql_1.Field)({ nullable: true }),
147
+ tslib_1.__metadata("design:type", String)
148
+ ], Oauth2Client.prototype, "accessToken", void 0);
149
+ tslib_1.__decorate([
150
+ (0, typeorm_1.Column)({
151
+ nullable: true
152
+ }),
153
+ (0, type_graphql_1.Field)({ nullable: true }),
154
+ tslib_1.__metadata("design:type", String)
155
+ ], Oauth2Client.prototype, "refreshToken", void 0);
156
+ tslib_1.__decorate([
157
+ (0, typeorm_1.Column)(),
158
+ (0, type_graphql_1.Field)({ nullable: true }),
159
+ tslib_1.__metadata("design:type", Date)
160
+ ], Oauth2Client.prototype, "expires", void 0);
161
+ tslib_1.__decorate([
162
+ (0, typeorm_1.Column)({
163
+ nullable: true
164
+ }),
165
+ (0, type_graphql_1.Field)({ nullable: true }),
166
+ tslib_1.__metadata("design:type", String)
167
+ ], Oauth2Client.prototype, "state", void 0);
168
+ tslib_1.__decorate([
169
+ (0, typeorm_1.Column)({
170
+ nullable: true
171
+ }),
172
+ (0, type_graphql_1.Field)({ nullable: true }),
173
+ tslib_1.__metadata("design:type", String)
174
+ ], Oauth2Client.prototype, "jwtToken", void 0);
175
+ tslib_1.__decorate([
176
+ (0, typeorm_1.Column)({
177
+ nullable: true
178
+ }),
179
+ (0, type_graphql_1.Field)({ nullable: true }),
180
+ tslib_1.__metadata("design:type", String)
181
+ ], Oauth2Client.prototype, "tokenType", void 0);
182
+ tslib_1.__decorate([
183
+ (0, typeorm_1.CreateDateColumn)(),
184
+ (0, type_graphql_1.Field)({ nullable: true }),
185
+ tslib_1.__metadata("design:type", Date)
186
+ ], Oauth2Client.prototype, "createdAt", void 0);
187
+ tslib_1.__decorate([
188
+ (0, typeorm_1.UpdateDateColumn)(),
189
+ (0, type_graphql_1.Field)({ nullable: true }),
190
+ tslib_1.__metadata("design:type", Date)
191
+ ], Oauth2Client.prototype, "updatedAt", void 0);
192
+ tslib_1.__decorate([
193
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
194
+ nullable: true
195
+ }),
196
+ (0, type_graphql_1.Field)({ nullable: true }),
197
+ tslib_1.__metadata("design:type", auth_base_1.User)
198
+ ], Oauth2Client.prototype, "creator", void 0);
199
+ tslib_1.__decorate([
200
+ (0, typeorm_1.RelationId)((oauth2Client) => oauth2Client.creator),
201
+ tslib_1.__metadata("design:type", String)
202
+ ], Oauth2Client.prototype, "creatorId", void 0);
203
+ tslib_1.__decorate([
204
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
205
+ nullable: true
206
+ }),
207
+ (0, type_graphql_1.Field)({ nullable: true }),
208
+ tslib_1.__metadata("design:type", auth_base_1.User)
209
+ ], Oauth2Client.prototype, "updater", void 0);
210
+ tslib_1.__decorate([
211
+ (0, typeorm_1.RelationId)((oauth2Client) => oauth2Client.creator),
212
+ tslib_1.__metadata("design:type", String)
213
+ ], Oauth2Client.prototype, "updaterId", void 0);
214
+ Oauth2Client = tslib_1.__decorate([
215
+ (0, typeorm_1.Entity)(),
216
+ (0, typeorm_1.Index)('ix_oauth2_client_0', (oauth2Client) => [oauth2Client.domain, oauth2Client.name], { unique: true }),
217
+ (0, type_graphql_1.ObjectType)({ description: 'Entity for Oauth2Client' })
218
+ ], Oauth2Client);
219
+ exports.Oauth2Client = Oauth2Client;
220
+ //# sourceMappingURL=oauth2-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth2-client.js","sourceRoot":"","sources":["../../../server/service/oauth2-client/oauth2-client.ts"],"names":[],"mappings":";;;;AAAA,+CAAoD;AACpD,qCASgB;AAEhB,yDAAgD;AAChD,iDAA8C;AAK9C,IAAa,YAAY,GAAzB,MAAa,YAAY;IAgKvB,cAAc;QACZ,IAAI,IAAI,CAAC,SAAS,IAAI,QAAQ,EAAE;YAC9B,OAAO;gBACL,aAAa,EAAE,UAAU,IAAI,CAAC,WAAW,EAAE;aAC5C,CAAA;SACF;aAAM,IAAI,IAAI,CAAC,SAAS,IAAI,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACvD,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;YACnF,OAAO;gBACL,aAAa,EAAE,SAAS,OAAO,EAAE;aAClC,CAAA;SACF;QAED,OAAO,EAAE,CAAA;I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AC,EAAE,CAAC,gBAAI,EAAE;QACvB,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAChB,gBAAI;6CAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,YAA0B,EAAE,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC;;+CAC/C;AA9JP,YAAY;IAHxB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,oBAAoB,EAAE,CAAC,YAA0B,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACvH,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,yBAAyB,EAAE,CAAC;GAC1C,YAAY,CA8KxB;AA9KY,oCAAY","sourcesContent":["import { Field, ID, ObjectType } from 'type-graphql'\nimport {\n Column,\n CreateDateColumn,\n Entity,\n Index,\n ManyToOne,\n PrimaryGeneratedColumn,\n RelationId,\n UpdateDateColumn\n} from 'typeorm'\n\nimport { User } from '@things-factory/auth-base'\nimport { Domain } from '@things-factory/shell'\n\n@Entity()\n@Index('ix_oauth2_client_0', (oauth2Client: Oauth2Client) => [oauth2Client.domain, oauth2Client.name], { unique: true })\n@ObjectType({ description: 'Entity for Oauth2Client' })\nexport class Oauth2Client {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true })\n domain?: Domain\n\n @RelationId((oauth2Client: Oauth2Client) => oauth2Client.domain)\n domainId?: string\n\n @Column()\n @Field()\n name: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n description?: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n icon?: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n grantType?: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n clientId?: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n clientSecret?: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n accessTokenUrl?: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n authUrl?: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n callbackUrl?: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n webhook?: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n username?: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n password?: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n codeChallengeMethod?: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n codeVerifier?: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n scopes?: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n accessToken?: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n refreshToken?: string\n\n @Column()\n @Field({ nullable: true })\n expires?: Date\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n state?: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n jwtToken?: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n tokenType?: string\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @ManyToOne(type => User, {\n nullable: true\n })\n @Field({ nullable: true })\n creator?: User\n\n @RelationId((oauth2Client: Oauth2Client) => oauth2Client.creator)\n creatorId?: string\n\n @ManyToOne(type => User, {\n nullable: true\n })\n @Field({ nullable: true })\n updater?: User\n\n @RelationId((oauth2Client: Oauth2Client) => oauth2Client.creator)\n updaterId?: string\n\n getAuthHeaders() {\n if (this.tokenType == 'bearer') {\n return {\n Authorization: `Bearer ${this.accessToken}`\n }\n } else if (this.tokenType == 'basic' || !this.tokenType) {\n const encoded = Buffer.from(`${this.username}:${this.password}`).toString('base64')\n return {\n Authorization: `Basic ${encoded}`\n }\n }\n\n return {}\n }\n}\n"]}