@things-factory/auth-base 9.0.0-beta.8 → 9.0.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 (168) hide show
  1. package/config/config.development.js +1 -0
  2. package/dist-client/auth.js +2 -7
  3. package/dist-client/auth.js.map +1 -1
  4. package/dist-client/reducers/auth.js +9 -2
  5. package/dist-client/reducers/auth.js.map +1 -1
  6. package/dist-client/tsconfig.tsbuildinfo +1 -1
  7. package/dist-server/controllers/change-pwd.js +5 -2
  8. package/dist-server/controllers/change-pwd.js.map +1 -1
  9. package/dist-server/controllers/checkin.js +1 -1
  10. package/dist-server/controllers/checkin.js.map +1 -1
  11. package/dist-server/controllers/delete-user.js +2 -2
  12. package/dist-server/controllers/delete-user.js.map +1 -1
  13. package/dist-server/controllers/profile.js +4 -1
  14. package/dist-server/controllers/profile.js.map +1 -1
  15. package/dist-server/controllers/reset-password.js +5 -2
  16. package/dist-server/controllers/reset-password.js.map +1 -1
  17. package/dist-server/controllers/signin.js +2 -2
  18. package/dist-server/controllers/signin.js.map +1 -1
  19. package/dist-server/controllers/signup.js +8 -1
  20. package/dist-server/controllers/signup.js.map +1 -1
  21. package/dist-server/errors/auth-error.js +3 -1
  22. package/dist-server/errors/auth-error.js.map +1 -1
  23. package/dist-server/middlewares/authenticate-401-middleware.js +22 -9
  24. package/dist-server/middlewares/authenticate-401-middleware.js.map +1 -1
  25. package/dist-server/middlewares/bypass-signin-middleware.d.ts +1 -0
  26. package/dist-server/middlewares/bypass-signin-middleware.js +20 -0
  27. package/dist-server/middlewares/bypass-signin-middleware.js.map +1 -0
  28. package/dist-server/middlewares/domain-authenticate-middleware.js +1 -5
  29. package/dist-server/middlewares/domain-authenticate-middleware.js.map +1 -1
  30. package/dist-server/middlewares/index.js +6 -1
  31. package/dist-server/middlewares/index.js.map +1 -1
  32. package/dist-server/middlewares/jwt-authenticate-middleware.js +1 -1
  33. package/dist-server/middlewares/jwt-authenticate-middleware.js.map +1 -1
  34. package/dist-server/migrations/1548206416130-SeedUser.js +11 -3
  35. package/dist-server/migrations/1548206416130-SeedUser.js.map +1 -1
  36. package/dist-server/router/auth-checkin-router.js +11 -13
  37. package/dist-server/router/auth-checkin-router.js.map +1 -1
  38. package/dist-server/router/auth-private-process-router.js +10 -4
  39. package/dist-server/router/auth-private-process-router.js.map +1 -1
  40. package/dist-server/router/auth-signup-router.js +5 -2
  41. package/dist-server/router/auth-signup-router.js.map +1 -1
  42. package/dist-server/router/oauth2/oauth2-authorize-router.js +5 -2
  43. package/dist-server/router/oauth2/oauth2-authorize-router.js.map +1 -1
  44. package/dist-server/router/oauth2/oauth2-router.js +1 -2
  45. package/dist-server/router/oauth2/oauth2-router.js.map +1 -1
  46. package/dist-server/router/oauth2/oauth2-server.js +21 -3
  47. package/dist-server/router/oauth2/oauth2-server.js.map +1 -1
  48. package/dist-server/router/site-root-router.js +1 -1
  49. package/dist-server/router/site-root-router.js.map +1 -1
  50. package/dist-server/router/webauthn-router.js +1 -1
  51. package/dist-server/router/webauthn-router.js.map +1 -1
  52. package/dist-server/routes.js +74 -48
  53. package/dist-server/routes.js.map +1 -1
  54. package/dist-server/service/app-binding/app-binding-types.js +3 -3
  55. package/dist-server/service/app-binding/app-binding-types.js.map +1 -1
  56. package/dist-server/service/app-binding/app-binding.js +6 -4
  57. package/dist-server/service/app-binding/app-binding.js.map +1 -1
  58. package/dist-server/service/appliance/appliance-mutation.js +37 -34
  59. package/dist-server/service/appliance/appliance-mutation.js.map +1 -1
  60. package/dist-server/service/appliance/appliance-types.js +18 -18
  61. package/dist-server/service/appliance/appliance-types.js.map +1 -1
  62. package/dist-server/service/appliance/appliance.d.ts +2 -0
  63. package/dist-server/service/appliance/appliance.js +61 -14
  64. package/dist-server/service/appliance/appliance.js.map +1 -1
  65. package/dist-server/service/application/application-mutation.js +22 -4
  66. package/dist-server/service/application/application-mutation.js.map +1 -1
  67. package/dist-server/service/application/application-types.js +24 -24
  68. package/dist-server/service/application/application-types.js.map +1 -1
  69. package/dist-server/service/application/application.d.ts +6 -6
  70. package/dist-server/service/application/application.js +22 -22
  71. package/dist-server/service/application/application.js.map +1 -1
  72. package/dist-server/service/auth-provider/auth-provider-mutation.js +29 -7
  73. package/dist-server/service/auth-provider/auth-provider-mutation.js.map +1 -1
  74. package/dist-server/service/auth-provider/auth-provider-parameter-spec.js +12 -7
  75. package/dist-server/service/auth-provider/auth-provider-parameter-spec.js.map +1 -1
  76. package/dist-server/service/auth-provider/auth-provider-type.js +24 -21
  77. package/dist-server/service/auth-provider/auth-provider-type.js.map +1 -1
  78. package/dist-server/service/auth-provider/auth-provider.js +35 -25
  79. package/dist-server/service/auth-provider/auth-provider.js.map +1 -1
  80. package/dist-server/service/domain-generator/domain-generator-mutation.js +1 -2
  81. package/dist-server/service/domain-generator/domain-generator-mutation.js.map +1 -1
  82. package/dist-server/service/domain-generator/domain-generator-types.js +17 -14
  83. package/dist-server/service/domain-generator/domain-generator-types.js.map +1 -1
  84. package/dist-server/service/domain-link/domain-link-mutation.d.ts +9 -0
  85. package/dist-server/service/domain-link/domain-link-mutation.js +133 -0
  86. package/dist-server/service/domain-link/domain-link-mutation.js.map +1 -0
  87. package/dist-server/service/domain-link/domain-link-query.d.ts +11 -0
  88. package/dist-server/service/domain-link/domain-link-query.js +75 -0
  89. package/dist-server/service/domain-link/domain-link-query.js.map +1 -0
  90. package/dist-server/service/domain-link/domain-link-types.d.ts +18 -0
  91. package/dist-server/service/domain-link/domain-link-types.js +66 -0
  92. package/dist-server/service/domain-link/domain-link-types.js.map +1 -0
  93. package/dist-server/service/domain-link/domain-link.d.ts +28 -0
  94. package/dist-server/service/domain-link/domain-link.js +105 -0
  95. package/dist-server/service/domain-link/domain-link.js.map +1 -0
  96. package/dist-server/service/domain-link/index.d.ts +6 -0
  97. package/dist-server/service/domain-link/index.js +10 -0
  98. package/dist-server/service/domain-link/index.js.map +1 -0
  99. package/dist-server/service/granted-role/granted-role-mutation.js +7 -7
  100. package/dist-server/service/granted-role/granted-role-mutation.js.map +1 -1
  101. package/dist-server/service/granted-role/granted-role.js +4 -4
  102. package/dist-server/service/granted-role/granted-role.js.map +1 -1
  103. package/dist-server/service/index.d.ts +3 -1
  104. package/dist-server/service/index.js +7 -2
  105. package/dist-server/service/index.js.map +1 -1
  106. package/dist-server/service/invitation/invitation-mutation.js +6 -2
  107. package/dist-server/service/invitation/invitation-mutation.js.map +1 -1
  108. package/dist-server/service/invitation/invitation-types.js +3 -3
  109. package/dist-server/service/invitation/invitation-types.js.map +1 -1
  110. package/dist-server/service/invitation/invitation.js +10 -10
  111. package/dist-server/service/invitation/invitation.js.map +1 -1
  112. package/dist-server/service/login-history/login-history-type.js +3 -3
  113. package/dist-server/service/login-history/login-history-type.js.map +1 -1
  114. package/dist-server/service/login-history/login-history.js +6 -6
  115. package/dist-server/service/login-history/login-history.js.map +1 -1
  116. package/dist-server/service/partner/partner-types.js +3 -3
  117. package/dist-server/service/partner/partner-types.js.map +1 -1
  118. package/dist-server/service/partner/partner.js +8 -8
  119. package/dist-server/service/partner/partner.js.map +1 -1
  120. package/dist-server/service/password-history/password-history.js +3 -3
  121. package/dist-server/service/password-history/password-history.js.map +1 -1
  122. package/dist-server/service/privilege/privilege-directive.js +1 -2
  123. package/dist-server/service/privilege/privilege-directive.js.map +1 -1
  124. package/dist-server/service/privilege/privilege-mutation.js +11 -2
  125. package/dist-server/service/privilege/privilege-mutation.js.map +1 -1
  126. package/dist-server/service/privilege/privilege.js +20 -20
  127. package/dist-server/service/privilege/privilege.js.map +1 -1
  128. package/dist-server/service/role/role-mutation.js +12 -2
  129. package/dist-server/service/role/role-mutation.js.map +1 -1
  130. package/dist-server/service/role/role-query.d.ts +7 -3
  131. package/dist-server/service/role/role-query.js +18 -10
  132. package/dist-server/service/role/role-query.js.map +1 -1
  133. package/dist-server/service/role/role-types.d.ts +4 -0
  134. package/dist-server/service/role/role-types.js +41 -27
  135. package/dist-server/service/role/role-types.js.map +1 -1
  136. package/dist-server/service/role/role.js +11 -11
  137. package/dist-server/service/role/role.js.map +1 -1
  138. package/dist-server/service/user/user-mutation.js +89 -41
  139. package/dist-server/service/user/user-mutation.js.map +1 -1
  140. package/dist-server/service/user/user-query.d.ts +1 -0
  141. package/dist-server/service/user/user-query.js +25 -9
  142. package/dist-server/service/user/user-query.js.map +1 -1
  143. package/dist-server/service/user/user-types.js +33 -32
  144. package/dist-server/service/user/user-types.js.map +1 -1
  145. package/dist-server/service/user/user.d.ts +5 -5
  146. package/dist-server/service/user/user.js +25 -22
  147. package/dist-server/service/user/user.js.map +1 -1
  148. package/dist-server/service/users-auth-providers/users-auth-providers.js +11 -8
  149. package/dist-server/service/users-auth-providers/users-auth-providers.js.map +1 -1
  150. package/dist-server/service/verification-token/verification-token.d.ts +3 -3
  151. package/dist-server/service/verification-token/verification-token.js +8 -8
  152. package/dist-server/service/verification-token/verification-token.js.map +1 -1
  153. package/dist-server/service/web-auth-credential/web-auth-credential.js +11 -10
  154. package/dist-server/service/web-auth-credential/web-auth-credential.js.map +1 -1
  155. package/dist-server/tsconfig.tsbuildinfo +1 -1
  156. package/dist-server/utils/access-token-cookie.js +1 -11
  157. package/dist-server/utils/access-token-cookie.js.map +1 -1
  158. package/dist-server/utils/check-user-belongs-domain.js +1 -2
  159. package/dist-server/utils/check-user-belongs-domain.js.map +1 -1
  160. package/dist-server/utils/get-domain-users.js +2 -2
  161. package/dist-server/utils/get-domain-users.js.map +1 -1
  162. package/dist-server/utils/get-user-domains.d.ts +0 -1
  163. package/dist-server/utils/get-user-domains.js +28 -22
  164. package/dist-server/utils/get-user-domains.js.map +1 -1
  165. package/package.json +6 -6
  166. package/dist-server/utils/get-domain-from-hostname.d.ts +0 -1
  167. package/dist-server/utils/get-domain-from-hostname.js +0 -9
  168. package/dist-server/utils/get-domain-from-hostname.js.map +0 -1
@@ -9,90 +9,93 @@ let NewAuthProvider = class NewAuthProvider {
9
9
  };
10
10
  exports.NewAuthProvider = NewAuthProvider;
11
11
  tslib_1.__decorate([
12
- (0, type_graphql_1.Field)(),
12
+ (0, type_graphql_1.Field)({ description: 'The type of the authentication provider (e.g., keycloak, google).' }),
13
13
  tslib_1.__metadata("design:type", String)
14
14
  ], NewAuthProvider.prototype, "type", void 0);
15
15
  tslib_1.__decorate([
16
- (0, type_graphql_1.Field)({ nullable: true }),
16
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Whether the new provider instance should be active.' }),
17
17
  tslib_1.__metadata("design:type", Boolean)
18
18
  ], NewAuthProvider.prototype, "active", void 0);
19
19
  tslib_1.__decorate([
20
- (0, type_graphql_1.Field)({ nullable: true }),
20
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Tenant ID, for multi-tenant providers.' }),
21
21
  tslib_1.__metadata("design:type", String)
22
22
  ], NewAuthProvider.prototype, "tenantId", void 0);
23
23
  tslib_1.__decorate([
24
- (0, type_graphql_1.Field)({ nullable: true }),
24
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Client ID for OAuth/OIDC providers.' }),
25
25
  tslib_1.__metadata("design:type", String)
26
26
  ], NewAuthProvider.prototype, "clientId", void 0);
27
27
  tslib_1.__decorate([
28
- (0, type_graphql_1.Field)({ nullable: true }),
28
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Client secret for OAuth/OIDC providers.' }),
29
29
  tslib_1.__metadata("design:type", String)
30
30
  ], NewAuthProvider.prototype, "clientSecret", void 0);
31
31
  tslib_1.__decorate([
32
- (0, type_graphql_1.Field)({ nullable: true }),
32
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Private key, for certain types of providers.' }),
33
33
  tslib_1.__metadata("design:type", String)
34
34
  ], NewAuthProvider.prototype, "privateKey", void 0);
35
35
  tslib_1.__decorate([
36
- (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
36
+ (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true, description: 'Provider-specific parameters.' }),
37
37
  tslib_1.__metadata("design:type", Object)
38
38
  ], NewAuthProvider.prototype, "params", void 0);
39
39
  exports.NewAuthProvider = NewAuthProvider = tslib_1.__decorate([
40
- (0, type_graphql_1.InputType)()
40
+ (0, type_graphql_1.InputType)({ description: 'Input for creating a new authentication provider instance.' })
41
41
  ], NewAuthProvider);
42
42
  let AuthProviderPatch = class AuthProviderPatch {
43
43
  };
44
44
  exports.AuthProviderPatch = AuthProviderPatch;
45
45
  tslib_1.__decorate([
46
- (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
46
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true, description: 'The unique identifier of the provider instance to update.' }),
47
47
  tslib_1.__metadata("design:type", String)
48
48
  ], AuthProviderPatch.prototype, "id", void 0);
49
49
  tslib_1.__decorate([
50
- (0, type_graphql_1.Field)({ nullable: true }),
50
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The new type for the provider.' }),
51
51
  tslib_1.__metadata("design:type", String)
52
52
  ], AuthProviderPatch.prototype, "type", void 0);
53
53
  tslib_1.__decorate([
54
- (0, type_graphql_1.Field)({ nullable: true }),
54
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The new active status for the provider.' }),
55
55
  tslib_1.__metadata("design:type", Boolean)
56
56
  ], AuthProviderPatch.prototype, "active", void 0);
57
57
  tslib_1.__decorate([
58
- (0, type_graphql_1.Field)({ nullable: true }),
58
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The new tenant ID for the provider.' }),
59
59
  tslib_1.__metadata("design:type", String)
60
60
  ], AuthProviderPatch.prototype, "tenantId", void 0);
61
61
  tslib_1.__decorate([
62
- (0, type_graphql_1.Field)({ nullable: true }),
62
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The new client ID for the provider.' }),
63
63
  tslib_1.__metadata("design:type", String)
64
64
  ], AuthProviderPatch.prototype, "clientId", void 0);
65
65
  tslib_1.__decorate([
66
- (0, type_graphql_1.Field)({ nullable: true }),
66
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The new client secret for the provider.' }),
67
67
  tslib_1.__metadata("design:type", String)
68
68
  ], AuthProviderPatch.prototype, "clientSecret", void 0);
69
69
  tslib_1.__decorate([
70
- (0, type_graphql_1.Field)({ nullable: true }),
70
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The new private key for the provider.' }),
71
71
  tslib_1.__metadata("design:type", String)
72
72
  ], AuthProviderPatch.prototype, "privateKey", void 0);
73
73
  tslib_1.__decorate([
74
- (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
74
+ (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true, description: 'The new provider-specific parameters.' }),
75
75
  tslib_1.__metadata("design:type", Object)
76
76
  ], AuthProviderPatch.prototype, "params", void 0);
77
77
  tslib_1.__decorate([
78
- (0, type_graphql_1.Field)({ nullable: true }),
78
+ (0, type_graphql_1.Field)({
79
+ nullable: true,
80
+ description: 'A flag indicating whether the provider is being created, updated, or deleted.'
81
+ }),
79
82
  tslib_1.__metadata("design:type", String)
80
83
  ], AuthProviderPatch.prototype, "cuFlag", void 0);
81
84
  exports.AuthProviderPatch = AuthProviderPatch = tslib_1.__decorate([
82
- (0, type_graphql_1.InputType)()
85
+ (0, type_graphql_1.InputType)({ description: 'Input for updating (patching) an existing authentication provider instance.' })
83
86
  ], AuthProviderPatch);
84
87
  let AuthProviderList = class AuthProviderList {
85
88
  };
86
89
  exports.AuthProviderList = AuthProviderList;
87
90
  tslib_1.__decorate([
88
- (0, type_graphql_1.Field)(type => [auth_provider_js_1.AuthProvider]),
91
+ (0, type_graphql_1.Field)(type => [auth_provider_js_1.AuthProvider], { description: 'The list of authentication provider items.' }),
89
92
  tslib_1.__metadata("design:type", Array)
90
93
  ], AuthProviderList.prototype, "items", void 0);
91
94
  tslib_1.__decorate([
92
- (0, type_graphql_1.Field)(type => type_graphql_1.Int),
95
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'The total number of authentication providers.' }),
93
96
  tslib_1.__metadata("design:type", Number)
94
97
  ], AuthProviderList.prototype, "total", void 0);
95
98
  exports.AuthProviderList = AuthProviderList = tslib_1.__decorate([
96
- (0, type_graphql_1.ObjectType)()
99
+ (0, type_graphql_1.ObjectType)({ description: 'A paginated list of configured authentication provider instances.' })
97
100
  ], AuthProviderList);
98
101
  //# sourceMappingURL=auth-provider-type.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth-provider-type.js","sourceRoot":"","sources":["../../../server/service/auth-provider/auth-provider-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AAEpE,iDAAoD;AACpD,yDAAiD;AAG1C,IAAM,eAAe,GAArB,MAAM,eAAe;CAqB3B,CAAA;AArBY,0CAAe;AAE1B;IADC,IAAA,oBAAK,GAAE;;6CACI;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACV;AAGhB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACT;AAGjB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACT;AAGjB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACL;AAGrB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACP;AAGnB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACjB;0BApBpB,eAAe;IAD3B,IAAA,wBAAS,GAAE;GACC,eAAe,CAqB3B;AAGM,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CA2B7B,CAAA;AA3BY,8CAAiB;AAE5B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CAC3B;AAGX;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACb;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACV;AAGhB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACT;AAGjB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACT;AAGjB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uDACL;AAGrB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACP;AAGnB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACjB;AAG/B;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACX;4BA1BJ,iBAAiB;IAD7B,IAAA,wBAAS,GAAE;GACC,iBAAiB,CA2B7B;AAGM,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAM5B,CAAA;AANY,4CAAgB;AAE3B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,+BAAY,CAAC,CAAC;;+CACT;AAGrB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;+CACN;2BALF,gBAAgB;IAD5B,IAAA,yBAAU,GAAE;GACA,gBAAgB,CAM5B","sourcesContent":["import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'\n\nimport { ScalarObject } from '@things-factory/shell'\nimport { AuthProvider } from './auth-provider.js'\n\n@InputType()\nexport class NewAuthProvider {\n @Field()\n type: string\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n tenantId?: string\n\n @Field({ nullable: true })\n clientId?: string\n\n @Field({ nullable: true })\n clientSecret?: string\n\n @Field({ nullable: true })\n privateKey?: string\n\n @Field(type => ScalarObject, { nullable: true })\n params?: { [key: string]: any }\n}\n\n@InputType()\nexport class AuthProviderPatch {\n @Field(type => ID, { nullable: true })\n id?: string\n\n @Field({ nullable: true })\n type?: string\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n tenantId?: string\n\n @Field({ nullable: true })\n clientId?: string\n\n @Field({ nullable: true })\n clientSecret?: string\n\n @Field({ nullable: true })\n privateKey?: string\n\n @Field(type => ScalarObject, { nullable: true })\n params?: { [key: string]: any }\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class AuthProviderList {\n @Field(type => [AuthProvider])\n items: AuthProvider[]\n\n @Field(type => Int)\n total: number\n}\n"]}
1
+ {"version":3,"file":"auth-provider-type.js","sourceRoot":"","sources":["../../../server/service/auth-provider/auth-provider-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AAEpE,iDAAoD;AACpD,yDAAiD;AAG1C,IAAM,eAAe,GAArB,MAAM,eAAe;CAqB3B,CAAA;AArBY,0CAAe;AAE1B;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,mEAAmE,EAAE,CAAC;;6CAChF;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,qDAAqD,EAAE,CAAC;;+CAC9E;AAGhB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;;iDAChE;AAGjB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,qCAAqC,EAAE,CAAC;;iDAC7D;AAGjB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,yCAAyC,EAAE,CAAC;;qDAC7D;AAGrB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,8CAA8C,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;;iDACvE;AAM/B;IAJC,IAAA,oBAAK,EAAC;QACL,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,+EAA+E;KAC7F,CAAC;;iDACa;4BA7BJ,iBAAiB;IAD7B,IAAA,wBAAS,EAAC,EAAE,WAAW,EAAE,6EAA6E,EAAE,CAAC;GAC7F,iBAAiB,CA8B7B;AAGM,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAM5B,CAAA;AANY,4CAAgB;AAE3B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,+BAAY,CAAC,EAAE,EAAE,WAAW,EAAE,4CAA4C,EAAE,CAAC;;+CACxE;AAGrB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,WAAW,EAAE,+CAA+C,EAAE,CAAC;;+CACxE;2BALF,gBAAgB;IAD5B,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,mEAAmE,EAAE,CAAC;GACpF,gBAAgB,CAM5B","sourcesContent":["import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'\n\nimport { ScalarObject } from '@things-factory/shell'\nimport { AuthProvider } from './auth-provider.js'\n\n@InputType({ description: 'Input for creating a new authentication provider instance.' })\nexport class NewAuthProvider {\n @Field({ description: 'The type of the authentication provider (e.g., keycloak, google).' })\n type: string\n\n @Field({ nullable: true, description: 'Whether the new provider instance should be active.' })\n active?: boolean\n\n @Field({ nullable: true, description: 'Tenant ID, for multi-tenant providers.' })\n tenantId?: string\n\n @Field({ nullable: true, description: 'Client ID for OAuth/OIDC providers.' })\n clientId?: string\n\n @Field({ nullable: true, description: 'Client secret for OAuth/OIDC providers.' })\n clientSecret?: string\n\n @Field({ nullable: true, description: 'Private key, for certain types of providers.' })\n privateKey?: string\n\n @Field(type => ScalarObject, { nullable: true, description: 'Provider-specific parameters.' })\n params?: { [key: string]: any }\n}\n\n@InputType({ description: 'Input for updating (patching) an existing authentication provider instance.' })\nexport class AuthProviderPatch {\n @Field(type => ID, { nullable: true, description: 'The unique identifier of the provider instance to update.' })\n id?: string\n\n @Field({ nullable: true, description: 'The new type for the provider.' })\n type?: string\n\n @Field({ nullable: true, description: 'The new active status for the provider.' })\n active?: boolean\n\n @Field({ nullable: true, description: 'The new tenant ID for the provider.' })\n tenantId?: string\n\n @Field({ nullable: true, description: 'The new client ID for the provider.' })\n clientId?: string\n\n @Field({ nullable: true, description: 'The new client secret for the provider.' })\n clientSecret?: string\n\n @Field({ nullable: true, description: 'The new private key for the provider.' })\n privateKey?: string\n\n @Field(type => ScalarObject, { nullable: true, description: 'The new provider-specific parameters.' })\n params?: { [key: string]: any }\n\n @Field({\n nullable: true,\n description: 'A flag indicating whether the provider is being created, updated, or deleted.'\n })\n cuFlag?: string\n}\n\n@ObjectType({ description: 'A paginated list of configured authentication provider instances.' })\nexport class AuthProviderList {\n @Field(type => [AuthProvider], { description: 'The list of authentication provider items.' })\n items: AuthProvider[]\n\n @Field(type => Int, { description: 'The total number of authentication providers.' })\n total: number\n}\n"]}
@@ -13,39 +13,44 @@ let AuthProviderType = class AuthProviderType {
13
13
  };
14
14
  exports.AuthProviderType = AuthProviderType;
15
15
  tslib_1.__decorate([
16
- (0, type_graphql_1.Field)(),
16
+ (0, type_graphql_1.Field)({ description: 'The unique type name of the authentication provider (e.g., keycloak, google).' }),
17
17
  tslib_1.__metadata("design:type", String)
18
18
  ], AuthProviderType.prototype, "type", void 0);
19
19
  tslib_1.__decorate([
20
- (0, type_graphql_1.Field)({ nullable: true }),
20
+ (0, type_graphql_1.Field)({ nullable: true, description: 'A brief description of the authentication provider.' }),
21
21
  tslib_1.__metadata("design:type", String)
22
22
  ], AuthProviderType.prototype, "description", void 0);
23
23
  tslib_1.__decorate([
24
- (0, type_graphql_1.Field)({ nullable: true }),
24
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Helpful information or a link to documentation for the provider.' }),
25
25
  tslib_1.__metadata("design:type", String)
26
26
  ], AuthProviderType.prototype, "help", void 0);
27
27
  tslib_1.__decorate([
28
- (0, type_graphql_1.Field)(type => [auth_provider_parameter_spec_js_1.AuthProviderParameterSpec], { nullable: true }),
28
+ (0, type_graphql_1.Field)(type => [auth_provider_parameter_spec_js_1.AuthProviderParameterSpec], {
29
+ nullable: true,
30
+ description: 'A list of parameters required to configure this authentication provider.'
31
+ }),
29
32
  tslib_1.__metadata("design:type", Array)
30
33
  ], AuthProviderType.prototype, "parameterSpec", void 0);
31
34
  exports.AuthProviderType = AuthProviderType = tslib_1.__decorate([
32
- (0, type_graphql_1.ObjectType)()
35
+ (0, type_graphql_1.ObjectType)({ description: 'Describes a type of authentication provider available in the system.' })
33
36
  ], AuthProviderType);
34
37
  let AuthProviderTypeList = class AuthProviderTypeList {
35
38
  };
36
39
  exports.AuthProviderTypeList = AuthProviderTypeList;
37
40
  tslib_1.__decorate([
38
- (0, type_graphql_1.Field)(type => [AuthProviderType]),
41
+ (0, type_graphql_1.Field)(type => [AuthProviderType], { description: 'The list of authentication provider type items.' }),
39
42
  tslib_1.__metadata("design:type", Array)
40
43
  ], AuthProviderTypeList.prototype, "items", void 0);
41
44
  tslib_1.__decorate([
42
- (0, type_graphql_1.Field)(type => type_graphql_1.Int),
45
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'The total number of authentication provider types.' }),
43
46
  tslib_1.__metadata("design:type", Number)
44
47
  ], AuthProviderTypeList.prototype, "total", void 0);
45
48
  exports.AuthProviderTypeList = AuthProviderTypeList = tslib_1.__decorate([
46
- (0, type_graphql_1.ObjectType)()
49
+ (0, type_graphql_1.ObjectType)({ description: 'A list of available authentication provider types.' })
47
50
  ], AuthProviderTypeList);
48
- let AuthProvider = AuthProvider_1 = class AuthProvider {
51
+ let AuthProvider = class AuthProvider {
52
+ static { AuthProvider_1 = this; }
53
+ static { this.registry = {}; }
49
54
  static register(type, provider) {
50
55
  AuthProvider_1.registry[type] = provider;
51
56
  }
@@ -68,15 +73,14 @@ let AuthProvider = AuthProvider_1 = class AuthProvider {
68
73
  }
69
74
  };
70
75
  exports.AuthProvider = AuthProvider;
71
- AuthProvider.registry = {};
72
76
  tslib_1.__decorate([
73
77
  (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
74
- (0, type_graphql_1.Field)(type => type_graphql_1.ID),
78
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier for the configured authentication provider.' }),
75
79
  tslib_1.__metadata("design:type", String)
76
80
  ], AuthProvider.prototype, "id", void 0);
77
81
  tslib_1.__decorate([
78
82
  (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
79
- (0, type_graphql_1.Field)(type => shell_1.Domain),
83
+ (0, type_graphql_1.Field)(type => shell_1.Domain, { description: 'The domain to which this authentication provider belongs.' }),
80
84
  tslib_1.__metadata("design:type", shell_1.Domain)
81
85
  ], AuthProvider.prototype, "domain", void 0);
82
86
  tslib_1.__decorate([
@@ -85,61 +89,67 @@ tslib_1.__decorate([
85
89
  ], AuthProvider.prototype, "domainId", void 0);
86
90
  tslib_1.__decorate([
87
91
  (0, typeorm_1.Column)(),
88
- (0, type_graphql_1.Field)({ nullable: true }),
92
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The type of the authentication provider (e.g., keycloak, google).' }),
89
93
  tslib_1.__metadata("design:type", String)
90
94
  ], AuthProvider.prototype, "type", void 0);
91
95
  tslib_1.__decorate([
92
96
  (0, typeorm_1.Column)({ nullable: true }),
93
- (0, type_graphql_1.Field)({ nullable: true }),
97
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Indicates whether this authentication provider is currently active.' }),
94
98
  tslib_1.__metadata("design:type", Boolean)
95
99
  ], AuthProvider.prototype, "active", void 0);
96
100
  tslib_1.__decorate([
97
101
  (0, type_graphql_1.Directive)('@privilege(category: "security", privilege: "query", domainOwnerGranted: true)'),
98
102
  (0, typeorm_1.Column)({ nullable: true }),
99
- (0, type_graphql_1.Field)({ nullable: true }),
103
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Tenant ID, used by some multi-tenant authentication providers.' }),
100
104
  tslib_1.__metadata("design:type", String)
101
105
  ], AuthProvider.prototype, "tenantId", void 0);
102
106
  tslib_1.__decorate([
103
107
  (0, type_graphql_1.Directive)('@privilege(category: "security", privilege: "query", domainOwnerGranted: true)'),
104
108
  (0, typeorm_1.Column)({ nullable: true }),
105
- (0, type_graphql_1.Field)({ nullable: true }),
109
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Client ID for OAuth/OIDC providers.' }),
106
110
  tslib_1.__metadata("design:type", String)
107
111
  ], AuthProvider.prototype, "clientId", void 0);
108
112
  tslib_1.__decorate([
109
113
  (0, type_graphql_1.Directive)('@privilege(category: "security", privilege: "query", domainOwnerGranted: true)'),
110
114
  (0, typeorm_1.Column)({ nullable: true, transformer: shell_1.encryptTransformer }),
111
- (0, type_graphql_1.Field)({ nullable: true }),
115
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Client secret for OAuth/OIDC providers (stored encrypted).' }),
112
116
  tslib_1.__metadata("design:type", String)
113
117
  ], AuthProvider.prototype, "clientSecret", void 0);
114
118
  tslib_1.__decorate([
115
119
  (0, type_graphql_1.Directive)('@privilege(category: "security", privilege: "query", domainOwnerGranted: true)'),
116
120
  (0, typeorm_1.Column)({ nullable: true, transformer: shell_1.encryptTransformer }),
117
- (0, type_graphql_1.Field)({ nullable: true }),
121
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Private key, used by some authentication providers (stored encrypted).' }),
118
122
  tslib_1.__metadata("design:type", String)
119
123
  ], AuthProvider.prototype, "privateKey", void 0);
120
124
  tslib_1.__decorate([
121
125
  (0, typeorm_1.Column)('simple-json', { nullable: true }),
122
- (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
126
+ (0, type_graphql_1.Field)(type => shell_1.ScalarObject, {
127
+ nullable: true,
128
+ description: 'A key-value map for additional provider-specific parameters.'
129
+ }),
123
130
  tslib_1.__metadata("design:type", Object)
124
131
  ], AuthProvider.prototype, "params", void 0);
125
132
  tslib_1.__decorate([
126
133
  (0, typeorm_1.OneToMany)(() => users_auth_providers_js_1.UsersAuthProviders, usersAuthProviders => usersAuthProviders.authProvider),
127
- (0, type_graphql_1.Field)(type => [users_auth_providers_js_1.UsersAuthProviders], { nullable: true }),
134
+ (0, type_graphql_1.Field)(type => [users_auth_providers_js_1.UsersAuthProviders], {
135
+ nullable: true,
136
+ description: 'A list of user-provider associations for this provider.'
137
+ }),
128
138
  tslib_1.__metadata("design:type", Array)
129
139
  ], AuthProvider.prototype, "usersAuthProviders", void 0);
130
140
  tslib_1.__decorate([
131
141
  (0, typeorm_1.CreateDateColumn)(),
132
- (0, type_graphql_1.Field)({ nullable: true }),
142
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The timestamp when this provider instance was created.' }),
133
143
  tslib_1.__metadata("design:type", Date)
134
144
  ], AuthProvider.prototype, "createdAt", void 0);
135
145
  tslib_1.__decorate([
136
146
  (0, typeorm_1.UpdateDateColumn)(),
137
- (0, type_graphql_1.Field)({ nullable: true }),
147
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The timestamp when this provider instance was last updated.' }),
138
148
  tslib_1.__metadata("design:type", Date)
139
149
  ], AuthProvider.prototype, "updatedAt", void 0);
140
150
  tslib_1.__decorate([
141
151
  (0, typeorm_1.ManyToOne)(type => user_js_1.User, { nullable: true }),
142
- (0, type_graphql_1.Field)(type => user_js_1.User, { nullable: true }),
152
+ (0, type_graphql_1.Field)(type => user_js_1.User, { nullable: true, description: 'The user who created this provider instance.' }),
143
153
  tslib_1.__metadata("design:type", user_js_1.User)
144
154
  ], AuthProvider.prototype, "creator", void 0);
145
155
  tslib_1.__decorate([
@@ -148,7 +158,7 @@ tslib_1.__decorate([
148
158
  ], AuthProvider.prototype, "creatorId", void 0);
149
159
  tslib_1.__decorate([
150
160
  (0, typeorm_1.ManyToOne)(type => user_js_1.User, { nullable: true }),
151
- (0, type_graphql_1.Field)(type => user_js_1.User, { nullable: true }),
161
+ (0, type_graphql_1.Field)(type => user_js_1.User, { nullable: true, description: 'The user who last updated this provider instance.' }),
152
162
  tslib_1.__metadata("design:type", user_js_1.User)
153
163
  ], AuthProvider.prototype, "updater", void 0);
154
164
  tslib_1.__decorate([
@@ -160,6 +170,6 @@ exports.AuthProvider = AuthProvider = AuthProvider_1 = tslib_1.__decorate([
160
170
  (0, typeorm_1.Index)('ix_auth_provider_0', (authProvider) => [authProvider.domain, authProvider.type], {
161
171
  unique: true
162
172
  }),
163
- (0, type_graphql_1.ObjectType)({ description: 'Entity for AuthProvider' })
173
+ (0, type_graphql_1.ObjectType)({ description: 'Represents a configured instance of an authentication provider for a specific domain.' })
164
174
  ], AuthProvider);
165
175
  //# sourceMappingURL=auth-provider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth-provider.js","sourceRoot":"","sources":["../../../server/service/auth-provider/auth-provider.ts"],"names":[],"mappings":";;;;;AAAA,qCAUgB;AAChB,+CAAoE;AAEpE,iDAAgF;AAChF,6CAAsC;AACtC,6FAAoF;AACpF,uFAA6E;AAetE,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAY5B,CAAA;AAZY,4CAAgB;AAE3B;IADC,IAAA,oBAAK,GAAE;;8CACI;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACP;AAGnB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACd;AAGZ;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,2DAAyB,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uDACrB;2BAX/B,gBAAgB;IAD5B,IAAA,yBAAU,GAAE;GACA,gBAAgB,CAY5B;AAGM,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;CAMhC,CAAA;AANY,oDAAoB;AAE/B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,gBAAgB,CAAC,CAAC;;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,MAAM,EAAE,IAAI;KACb,CAAC;IACD,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,yBAAyB,EAAE,CAAC;GAC1C,YAAY,CA+FxB","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n OneToMany,\n PrimaryGeneratedColumn\n} from 'typeorm'\nimport { Directive, ObjectType, Field, Int, ID } from 'type-graphql'\n\nimport { Domain, ScalarObject, encryptTransformer } from '@things-factory/shell'\nimport { User } from '../user/user.js'\nimport { UsersAuthProviders } from '../users-auth-providers/users-auth-providers.js'\nimport { AuthProviderParameterSpec } from './auth-provider-parameter-spec.js'\n\nexport type AuthProviderImpl = {\n type: string\n description: string\n help: string\n parameterSpec: AuthProviderParameterSpec\n synchronizeUsers: (authProvider: AuthProvider, context: ResolverContext) => Promise<boolean>\n}\n\nexport type AuthProviderRegistry = {\n [type: string]: AuthProviderImpl\n}\n\n@ObjectType()\nexport class AuthProviderType {\n @Field()\n type: string\n\n @Field({ nullable: true })\n description: string\n\n @Field({ nullable: true })\n help: string\n\n @Field(type => [AuthProviderParameterSpec], { nullable: true })\n parameterSpec: AuthProviderParameterSpec[]\n}\n\n@ObjectType()\nexport class AuthProviderTypeList {\n @Field(type => [AuthProviderType])\n items: AuthProviderType[]\n\n @Field(type => Int)\n total: number\n}\n\n@Entity()\n@Index('ix_auth_provider_0', (authProvider: AuthProvider) => [authProvider.domain, authProvider.type], {\n unique: true\n})\n@ObjectType({ description: 'Entity for AuthProvider' })\nexport class AuthProvider {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field(type => Domain)\n domain?: Domain\n\n @RelationId((authProvider: AuthProvider) => authProvider.domain)\n domainId?: string\n\n @Column()\n @Field({ nullable: true })\n type?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n active?: boolean\n\n @Directive('@privilege(category: \"security\", privilege: \"query\", domainOwnerGranted: true)')\n @Column({ nullable: true })\n @Field({ nullable: true })\n tenantId?: string\n\n @Directive('@privilege(category: \"security\", privilege: \"query\", domainOwnerGranted: true)')\n @Column({ nullable: true })\n @Field({ nullable: true })\n clientId?: string\n\n @Directive('@privilege(category: \"security\", privilege: \"query\", domainOwnerGranted: true)')\n @Column({ nullable: true, transformer: encryptTransformer })\n @Field({ nullable: true })\n clientSecret?: string\n\n @Directive('@privilege(category: \"security\", privilege: \"query\", domainOwnerGranted: true)')\n @Column({ nullable: true, transformer: encryptTransformer })\n @Field({ nullable: true })\n privateKey?: string\n\n @Column('simple-json', { nullable: true })\n @Field(type => ScalarObject, { nullable: true })\n params?: { [key: string]: any }\n\n @OneToMany(() => UsersAuthProviders, usersAuthProviders => usersAuthProviders.authProvider)\n @Field(type => [UsersAuthProviders], { nullable: true })\n usersAuthProviders?: UsersAuthProviders[]\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, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((authProvider: AuthProvider) => authProvider.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((authProvider: AuthProvider) => authProvider.updater)\n updaterId?: string\n\n static registry = {}\n\n public static register(type: string, provider: AuthProviderImpl) {\n AuthProvider.registry[type] = provider\n }\n\n public static getAuthProviderTypes(): AuthProviderTypeList {\n const items = Object.values(AuthProvider.registry).map(({ type, description, help, parameterSpec }) => {\n return {\n type,\n description,\n help,\n parameterSpec\n }\n })\n\n return {\n items,\n total: items.length\n }\n }\n\n public static getAuthProviderImpl(type: string) {\n return AuthProvider.registry[type]\n }\n}\n"]}
1
+ {"version":3,"file":"auth-provider.js","sourceRoot":"","sources":["../../../server/service/auth-provider/auth-provider.ts"],"names":[],"mappings":";;;;;AAAA,qCAUgB;AAChB,+CAAoE;AAE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eAAK,EAAC,oBAAoB,EAAE,CAAC,YAA0B,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE;QACrG,MAAM,EAAE,IAAI;KACb,CAAC;IACD,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,uFAAuF,EAAE,CAAC;GACxG,YAAY,CAqGxB","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n OneToMany,\n PrimaryGeneratedColumn\n} from 'typeorm'\nimport { Directive, ObjectType, Field, Int, ID } from 'type-graphql'\n\nimport { Domain, ScalarObject, encryptTransformer } from '@things-factory/shell'\nimport { User } from '../user/user.js'\nimport { UsersAuthProviders } from '../users-auth-providers/users-auth-providers.js'\nimport { AuthProviderParameterSpec } from './auth-provider-parameter-spec.js'\n\nexport type AuthProviderImpl = {\n type: string\n description: string\n help: string\n parameterSpec: AuthProviderParameterSpec\n synchronizeUsers: (authProvider: AuthProvider, context: ResolverContext) => Promise<boolean>\n}\n\nexport type AuthProviderRegistry = {\n [type: string]: AuthProviderImpl\n}\n\n@ObjectType({ description: 'Describes a type of authentication provider available in the system.' })\nexport class AuthProviderType {\n @Field({ description: 'The unique type name of the authentication provider (e.g., keycloak, google).' })\n type: string\n\n @Field({ nullable: true, description: 'A brief description of the authentication provider.' })\n description: string\n\n @Field({ nullable: true, description: 'Helpful information or a link to documentation for the provider.' })\n help: string\n\n @Field(type => [AuthProviderParameterSpec], {\n nullable: true,\n description: 'A list of parameters required to configure this authentication provider.'\n })\n parameterSpec: AuthProviderParameterSpec[]\n}\n\n@ObjectType({ description: 'A list of available authentication provider types.' })\nexport class AuthProviderTypeList {\n @Field(type => [AuthProviderType], { description: 'The list of authentication provider type items.' })\n items: AuthProviderType[]\n\n @Field(type => Int, { description: 'The total number of authentication provider types.' })\n total: number\n}\n\n@Entity()\n@Index('ix_auth_provider_0', (authProvider: AuthProvider) => [authProvider.domain, authProvider.type], {\n unique: true\n})\n@ObjectType({ description: 'Represents a configured instance of an authentication provider for a specific domain.' })\nexport class AuthProvider {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier for the configured authentication provider.' })\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field(type => Domain, { description: 'The domain to which this authentication provider belongs.' })\n domain?: Domain\n\n @RelationId((authProvider: AuthProvider) => authProvider.domain)\n domainId?: string\n\n @Column()\n @Field({ nullable: true, description: 'The type of the authentication provider (e.g., keycloak, google).' })\n type?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Indicates whether this authentication provider is currently active.' })\n active?: boolean\n\n @Directive('@privilege(category: \"security\", privilege: \"query\", domainOwnerGranted: true)')\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Tenant ID, used by some multi-tenant authentication providers.' })\n tenantId?: string\n\n @Directive('@privilege(category: \"security\", privilege: \"query\", domainOwnerGranted: true)')\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Client ID for OAuth/OIDC providers.' })\n clientId?: string\n\n @Directive('@privilege(category: \"security\", privilege: \"query\", domainOwnerGranted: true)')\n @Column({ nullable: true, transformer: encryptTransformer })\n @Field({ nullable: true, description: 'Client secret for OAuth/OIDC providers (stored encrypted).' })\n clientSecret?: string\n\n @Directive('@privilege(category: \"security\", privilege: \"query\", domainOwnerGranted: true)')\n @Column({ nullable: true, transformer: encryptTransformer })\n @Field({ nullable: true, description: 'Private key, used by some authentication providers (stored encrypted).' })\n privateKey?: string\n\n @Column('simple-json', { nullable: true })\n @Field(type => ScalarObject, {\n nullable: true,\n description: 'A key-value map for additional provider-specific parameters.'\n })\n params?: { [key: string]: any }\n\n @OneToMany(() => UsersAuthProviders, usersAuthProviders => usersAuthProviders.authProvider)\n @Field(type => [UsersAuthProviders], {\n nullable: true,\n description: 'A list of user-provider associations for this provider.'\n })\n usersAuthProviders?: UsersAuthProviders[]\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'The timestamp when this provider instance was created.' })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'The timestamp when this provider instance was last updated.' })\n updatedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who created this provider instance.' })\n creator?: User\n\n @RelationId((authProvider: AuthProvider) => authProvider.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who last updated this provider instance.' })\n updater?: User\n\n @RelationId((authProvider: AuthProvider) => authProvider.updater)\n updaterId?: string\n\n static registry = {}\n\n public static register(type: string, provider: AuthProviderImpl) {\n AuthProvider.registry[type] = provider\n }\n\n public static getAuthProviderTypes(): AuthProviderTypeList {\n const items = Object.values(AuthProvider.registry).map(({ type, description, help, parameterSpec }) => {\n return {\n type,\n description,\n help,\n parameterSpec\n }\n })\n\n return {\n items,\n total: items.length\n }\n }\n\n public static getAuthProviderImpl(type: string) {\n return AuthProvider.registry[type]\n }\n}\n"]}
@@ -39,8 +39,7 @@ let DomainGeneratorMutation = class DomainGeneratorMutation {
39
39
  });
40
40
  // 역할 생성
41
41
  const newRoles = await Promise.all(roles.map(async (role) => {
42
- var _a;
43
- if ((_a = role.privileges) === null || _a === void 0 ? void 0 : _a.length) {
42
+ if (role.privileges?.length) {
44
43
  const privilegeIds = role.privileges.map((p) => p.id);
45
44
  role.privileges = await privilegeRepository.findBy({
46
45
  id: (0, typeorm_1.In)(privilegeIds)
@@ -1 +1 @@
1
- {"version":3,"file":"domain-generator-mutation.js","sourceRoot":"","sources":["../../../server/service/domain-generator/domain-generator-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA+C;AAE/C,iDAA6D;AAC7D,iDAA+C;AAE/C,4DAAqD;AACrD,6CAAsC;AACtC,6CAAsC;AACtC,2EAAuF;AAGhF,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAI5B,AAAN,KAAK,CAAC,cAAc,CACE,WAAiC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,CAAA;QACpB,OAAO,MAAM,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IAC/C,CAAC;CACF,CAAA;AAnGY,0DAAuB;AAI5B;IAHL,IAAA,wBAAS,EAAC,oCAAoC,CAAC;IAC/C,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,cAAM,CAAC;IAEzB,mBAAA,IAAA,kBAAG,EAAC,aAAa,CAAC,CAAA;IAClB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAD2B,gDAAoB;;6DActD;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,cAAM,CAAC;IAEzB,mBAAA,IAAA,kBAAG,EAAC,eAAe,CAAC,CAAA;IACpB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAD+B,+CAAmB;;qEA0EzD;kCAlGU,uBAAuB;IADnC,IAAA,uBAAQ,GAAE;GACE,uBAAuB,CAmGnC;AAED,SAAS,eAAe,CAAC,SAAiB,EAAE,QAAgB;IAC1D,MAAM,aAAa,GAAa,SAAS,CAAC,GAAG,CAAC,CAAC,CAAO,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IAClE,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAO,EAAE,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;AACzE,CAAC","sourcesContent":["import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\nimport { ILike, In, Repository } from 'typeorm'\n\nimport { Domain, getRepository } from '@things-factory/shell'\nimport { slugger } from '@things-factory/utils'\n\nimport { Privilege } from '../privilege/privilege.js'\nimport { Role } from '../role/role.js'\nimport { User } from '../user/user.js'\nimport { DomainGeneratorInput, DomainUserRoleInput } from './domain-generator-types.js'\n\n@Resolver()\nexport class DomainGeneratorMutation {\n @Directive('@privilege(superUserGranted: true)')\n @Directive('@transaction')\n @Mutation(returns => Domain)\n async domainRegister(\n @Arg('domainInput') domainInput: DomainGeneratorInput,\n @Ctx() context: ResolverContext\n ): Promise<Domain> {\n const { user } = context.state\n const { name, description } = domainInput\n const domainRepo: Repository<Domain> = getRepository(Domain)\n const subdomain: string = slugger(name)\n\n const domain: Domain = await domainRepo.findOneBy({ subdomain })\n if (domain) {\n throw new Error('domain is duplicated')\n }\n\n return await domainRepo.save({ name, description, subdomain, owner: user.id })\n }\n\n @Directive('@transaction')\n @Mutation(returns => Domain)\n async domainUserRoleRegister(\n @Arg('newDomainInfo') newDomainInfo: DomainUserRoleInput,\n @Ctx() context: ResolverContext\n ): Promise<Domain> {\n const { tx } = context.state\n // 도메인 생성\n const { domain, users, roles } = newDomainInfo\n const domainOwner = users.find(user => user.owner === true)\n\n const domainRepository: Repository<Domain> = tx.getRepository(Domain)\n const roleRepository: Repository<Role> = tx.getRepository(Role)\n const userRepository: Repository<User> = tx.getRepository(User)\n const privilegeRepository: Repository<Privilege> = tx.getRepository(Privilege)\n\n const subdomain: string = slugger(domain.name)\n\n const newDomain = await domainRepository.save({\n name: domain.name,\n description: domain.description,\n subdomain\n })\n\n // 역할 생성\n const newRoles: Role[] = await Promise.all(\n roles.map(async (role: Role) => {\n if (role.privileges?.length) {\n const privilegeIds: string[] = role.privileges.map((p: Privilege) => p.id)\n role.privileges = await privilegeRepository.findBy({\n id: In(privilegeIds)\n })\n }\n\n role.domain = newDomain\n return await roleRepository.save(role)\n })\n )\n\n // 사용자 생성\n let inviteUsers = []\n let createUsers = []\n users.forEach(user => (user.isInvitee ? inviteUsers.push(user) : createUsers.push(user)))\n\n // create user\n await Promise.all(\n createUsers.map(async user => {\n user.domains = [newDomain]\n user.password = User.encode(user.password, user.salt)\n user.salt = User.generateSalt()\n user.passwordUpdatedAt = new Date()\n user.userType = 'user'\n user.roles = filterUserRoles(user.roles, newRoles)\n\n return await userRepository.save(user)\n })\n )\n\n // invite user\n await Promise.all(\n inviteUsers.map(async inviteUser => {\n const user: User = await userRepository.findOne({\n where: { email: inviteUser.email },\n relations: ['domains', 'roles']\n })\n\n user.domains = [...user.domains, newDomain]\n user.roles = [...user.roles, ...filterUserRoles(inviteUser.roles, newRoles)]\n\n return await userRepository.save(user)\n })\n )\n\n // domain owner\n const { id } = await userRepository.findOne({ where: { email: ILike(domainOwner.email) } })\n newDomain.owner = id\n return await domainRepository.save(newDomain)\n }\n}\n\nfunction filterUserRoles(userRoles: Role[], newRoles: Role[]): Role[] {\n const userRoleNames: string[] = userRoles.map((r: Role) => r.name)\n return newRoles.filter((r: Role) => userRoleNames.indexOf(r.name) >= 0)\n}\n"]}
1
+ {"version":3,"file":"domain-generator-mutation.js","sourceRoot":"","sources":["../../../server/service/domain-generator/domain-generator-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA+C;AAE/C,iDAA6D;AAC7D,iDAA+C;AAE/C,4DAAqD;AACrD,6CAAsC;AACtC,6CAAsC;AACtC,2EAAuF;AAGhF,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAI5B,AAAN,KAAK,CAAC,cAAc,CACE,WAAiC,EAC9C,OAAwB;QAE/B,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAC9B,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,WAAW,CAAA;QACzC,MAAM,UAAU,GAAuB,IAAA,qBAAa,EAAC,cAAM,CAAC,CAAA;QAC5D,MAAM,SAAS,GAAW,IAAA,eAAO,EAAC,IAAI,CAAC,CAAA;QAEvC,MAAM,MAAM,GAAW,MAAM,UAAU,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC,CAAA;QAChE,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAA;QACzC,CAAC;QAED,OAAO,MAAM,UAAU,CAAC,IAAI,C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B,mBAAA,IAAA,kBAAG,EAAC,eAAe,CAAC,CAAA;IACpB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAD+B,+CAAmB;;qEA0EzD;kCAlGU,uBAAuB;IADnC,IAAA,uBAAQ,GAAE;GACE,uBAAuB,CAmGnC;AAED,SAAS,eAAe,CAAC,SAAiB,EAAE,QAAgB;IAC1D,MAAM,aAAa,GAAa,SAAS,CAAC,GAAG,CAAC,CAAC,CAAO,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IAClE,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAO,EAAE,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;AACzE,CAAC","sourcesContent":["import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\nimport { ILike, In, Repository } from 'typeorm'\n\nimport { Domain, getRepository } from '@things-factory/shell'\nimport { slugger } from '@things-factory/utils'\n\nimport { Privilege } from '../privilege/privilege.js'\nimport { Role } from '../role/role.js'\nimport { User } from '../user/user.js'\nimport { DomainGeneratorInput, DomainUserRoleInput } from './domain-generator-types.js'\n\n@Resolver()\nexport class DomainGeneratorMutation {\n @Directive('@privilege(superUserGranted: true)')\n @Directive('@transaction')\n @Mutation(returns => Domain)\n async domainRegister(\n @Arg('domainInput') domainInput: DomainGeneratorInput,\n @Ctx() context: ResolverContext\n ): Promise<Domain> {\n const { user } = context.state\n const { name, description } = domainInput\n const domainRepo: Repository<Domain> = getRepository(Domain)\n const subdomain: string = slugger(name)\n\n const domain: Domain = await domainRepo.findOneBy({ subdomain })\n if (domain) {\n throw new Error('domain is duplicated')\n }\n\n return await domainRepo.save({ name, description, subdomain, owner: user.id })\n }\n\n @Directive('@transaction')\n @Mutation(returns => Domain)\n async domainUserRoleRegister(\n @Arg('newDomainInfo') newDomainInfo: DomainUserRoleInput,\n @Ctx() context: ResolverContext\n ): Promise<Domain> {\n const { tx } = context.state\n // 도메인 생성\n const { domain, users, roles } = newDomainInfo\n const domainOwner = users.find(user => user.owner === true)\n\n const domainRepository: Repository<Domain> = tx.getRepository(Domain)\n const roleRepository: Repository<Role> = tx.getRepository(Role)\n const userRepository: Repository<User> = tx.getRepository(User)\n const privilegeRepository: Repository<Privilege> = tx.getRepository(Privilege)\n\n const subdomain: string = slugger(domain.name)\n\n const newDomain = await domainRepository.save({\n name: domain.name,\n description: domain.description,\n subdomain\n })\n\n // 역할 생성\n const newRoles: Role[] = await Promise.all(\n roles.map(async (role: Role) => {\n if (role.privileges?.length) {\n const privilegeIds: string[] = role.privileges.map((p: Privilege) => p.id)\n role.privileges = await privilegeRepository.findBy({\n id: In(privilegeIds)\n })\n }\n\n role.domain = newDomain\n return await roleRepository.save(role)\n })\n )\n\n // 사용자 생성\n let inviteUsers = []\n let createUsers = []\n users.forEach(user => (user.isInvitee ? inviteUsers.push(user) : createUsers.push(user)))\n\n // create user\n await Promise.all(\n createUsers.map(async user => {\n user.domains = [newDomain]\n user.password = User.encode(user.password, user.salt)\n user.salt = User.generateSalt()\n user.passwordUpdatedAt = new Date()\n user.userType = 'user'\n user.roles = filterUserRoles(user.roles, newRoles)\n\n return await userRepository.save(user)\n })\n )\n\n // invite user\n await Promise.all(\n inviteUsers.map(async inviteUser => {\n const user: User = await userRepository.findOne({\n where: { email: inviteUser.email },\n relations: ['domains', 'roles']\n })\n\n user.domains = [...user.domains, newDomain]\n user.roles = [...user.roles, ...filterUserRoles(inviteUser.roles, newRoles)]\n\n return await userRepository.save(user)\n })\n )\n\n // domain owner\n const { id } = await userRepository.findOne({ where: { email: ILike(domainOwner.email) } })\n newDomain.owner = id\n return await domainRepository.save(newDomain)\n }\n}\n\nfunction filterUserRoles(userRoles: Role[], newRoles: Role[]): Role[] {\n const userRoleNames: string[] = userRoles.map((r: Role) => r.name)\n return newRoles.filter((r: Role) => userRoleNames.indexOf(r.name) >= 0)\n}\n"]}
@@ -10,62 +10,65 @@ let DomainGeneratorInput = class DomainGeneratorInput {
10
10
  };
11
11
  exports.DomainGeneratorInput = DomainGeneratorInput;
12
12
  tslib_1.__decorate([
13
- (0, type_graphql_1.Field)(),
13
+ (0, type_graphql_1.Field)({ description: 'The name of the new domain.' }),
14
14
  tslib_1.__metadata("design:type", String)
15
15
  ], DomainGeneratorInput.prototype, "name", void 0);
16
16
  tslib_1.__decorate([
17
- (0, type_graphql_1.Field)({ nullable: true }),
17
+ (0, type_graphql_1.Field)({ nullable: true, description: 'A description for the new domain.' }),
18
18
  tslib_1.__metadata("design:type", String)
19
19
  ], DomainGeneratorInput.prototype, "description", void 0);
20
20
  exports.DomainGeneratorInput = DomainGeneratorInput = tslib_1.__decorate([
21
- (0, type_graphql_1.InputType)()
21
+ (0, type_graphql_1.InputType)({ description: 'Input for generating a new domain.' })
22
22
  ], DomainGeneratorInput);
23
23
  let DomainUserRoleInput = class DomainUserRoleInput {
24
24
  };
25
25
  exports.DomainUserRoleInput = DomainUserRoleInput;
26
26
  tslib_1.__decorate([
27
- (0, type_graphql_1.Field)(type => shell_1.DomainInput),
27
+ (0, type_graphql_1.Field)(type => shell_1.DomainInput, { description: 'The details of the new domain to be created.' }),
28
28
  tslib_1.__metadata("design:type", shell_1.DomainInput)
29
29
  ], DomainUserRoleInput.prototype, "domain", void 0);
30
30
  tslib_1.__decorate([
31
- (0, type_graphql_1.Field)(type => [NewUserByDomainWizardInput]),
31
+ (0, type_graphql_1.Field)(type => [NewUserByDomainWizardInput], { description: 'A list of new users to be created within the domain.' }),
32
32
  tslib_1.__metadata("design:type", Array)
33
33
  ], DomainUserRoleInput.prototype, "users", void 0);
34
34
  tslib_1.__decorate([
35
- (0, type_graphql_1.Field)(type => [role_types_js_1.NewRole]),
35
+ (0, type_graphql_1.Field)(type => [role_types_js_1.NewRole], { description: 'A list of new roles to be created within the domain.' }),
36
36
  tslib_1.__metadata("design:type", Array)
37
37
  ], DomainUserRoleInput.prototype, "roles", void 0);
38
38
  exports.DomainUserRoleInput = DomainUserRoleInput = tslib_1.__decorate([
39
- (0, type_graphql_1.InputType)()
39
+ (0, type_graphql_1.InputType)({ description: 'Input for the domain creation wizard, including domain, users, and roles.' })
40
40
  ], DomainUserRoleInput);
41
41
  let NewUserByDomainWizardInput = class NewUserByDomainWizardInput {
42
42
  };
43
43
  exports.NewUserByDomainWizardInput = NewUserByDomainWizardInput;
44
44
  tslib_1.__decorate([
45
- (0, type_graphql_1.Field)(),
45
+ (0, type_graphql_1.Field)({ description: 'The full name of the new user.' }),
46
46
  tslib_1.__metadata("design:type", String)
47
47
  ], NewUserByDomainWizardInput.prototype, "name", void 0);
48
48
  tslib_1.__decorate([
49
- (0, type_graphql_1.Field)(type => graphql_scalars_1.GraphQLEmailAddress),
49
+ (0, type_graphql_1.Field)(type => graphql_scalars_1.GraphQLEmailAddress, { description: 'The email address of the new user.' }),
50
50
  tslib_1.__metadata("design:type", String)
51
51
  ], NewUserByDomainWizardInput.prototype, "email", void 0);
52
52
  tslib_1.__decorate([
53
- (0, type_graphql_1.Field)({ nullable: true }),
53
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The password for the new user. If not provided, an invitation will be sent.' }),
54
54
  tslib_1.__metadata("design:type", String)
55
55
  ], NewUserByDomainWizardInput.prototype, "password", void 0);
56
56
  tslib_1.__decorate([
57
- (0, type_graphql_1.Field)({ nullable: true }),
57
+ (0, type_graphql_1.Field)({
58
+ nullable: true,
59
+ description: 'Indicates whether the user should be invited via email instead of created directly.'
60
+ }),
58
61
  tslib_1.__metadata("design:type", Boolean)
59
62
  ], NewUserByDomainWizardInput.prototype, "isInvitee", void 0);
60
63
  tslib_1.__decorate([
61
- (0, type_graphql_1.Field)(),
64
+ (0, type_graphql_1.Field)({ description: 'Indicates whether this user is an owner of the domain.' }),
62
65
  tslib_1.__metadata("design:type", Boolean)
63
66
  ], NewUserByDomainWizardInput.prototype, "owner", void 0);
64
67
  tslib_1.__decorate([
65
- (0, type_graphql_1.Field)(type => [role_types_js_1.NewRole]),
68
+ (0, type_graphql_1.Field)(type => [role_types_js_1.NewRole], { description: 'A list of roles to be assigned to the new user.' }),
66
69
  tslib_1.__metadata("design:type", Array)
67
70
  ], NewUserByDomainWizardInput.prototype, "roles", void 0);
68
71
  exports.NewUserByDomainWizardInput = NewUserByDomainWizardInput = tslib_1.__decorate([
69
- (0, type_graphql_1.InputType)()
72
+ (0, type_graphql_1.InputType)({ description: 'Input for creating a new user as part of the domain creation wizard.' })
70
73
  ], NewUserByDomainWizardInput);
71
74
  //# sourceMappingURL=domain-generator-types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"domain-generator-types.js","sourceRoot":"","sources":["../../../server/service/domain-generator/domain-generator-types.ts"],"names":[],"mappings":";;;;AAAA,+CAA+C;AAC/C,qDAAqD;AACrD,iDAAmD;AACnD,yDAA+C;AAGxC,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;CAMhC,CAAA;AANY,oDAAoB;AAE/B;IADC,IAAA,oBAAK,GAAE;;kDACI;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yDACN;+BALT,oBAAoB;IADhC,IAAA,wBAAS,GAAE;GACC,oBAAoB,CAMhC;AAGM,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;CAS/B,CAAA;AATY,kDAAmB;AAE9B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,mBAAW,CAAC;sCACnB,mBAAW;mDAAA;AAGnB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,0BAA0B,CAAC,CAAC;;kDACT;AAGnC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,uBAAO,CAAC,CAAC;;kDACT;8BARL,mBAAmB;IAD/B,IAAA,wBAAS,GAAE;GACC,mBAAmB,CAS/B;AAGM,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;CAkBtC,CAAA;AAlBY,gEAA0B;AAErC;IADC,IAAA,oBAAK,GAAE;;wDACI;AAGZ;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,qCAAmB,CAAC;;yDACtB;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4DACV;AAGhB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACf,OAAO;6DAAA;AAGlB;IADC,IAAA,oBAAK,GAAE;sCACD,OAAO;yDAAA;AAGd;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,uBAAO,CAAC,CAAC;;yDACT;qCAjBL,0BAA0B;IADtC,IAAA,wBAAS,GAAE;GACC,0BAA0B,CAkBtC","sourcesContent":["import { Field, InputType } from 'type-graphql'\nimport { GraphQLEmailAddress } from 'graphql-scalars'\nimport { DomainInput } from '@things-factory/shell'\nimport { NewRole } from '../role/role-types.js'\n\n@InputType()\nexport class DomainGeneratorInput {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n}\n\n@InputType()\nexport class DomainUserRoleInput {\n @Field(type => DomainInput)\n domain: DomainInput\n\n @Field(type => [NewUserByDomainWizardInput])\n users: NewUserByDomainWizardInput[]\n\n @Field(type => [NewRole])\n roles: NewRole[]\n}\n\n@InputType()\nexport class NewUserByDomainWizardInput {\n @Field()\n name: string\n\n @Field(type => GraphQLEmailAddress)\n email: string\n\n @Field({ nullable: true })\n password: string\n\n @Field({ nullable: true })\n isInvitee: Boolean\n\n @Field()\n owner: Boolean\n\n @Field(type => [NewRole])\n roles: NewRole[]\n}\n"]}
1
+ {"version":3,"file":"domain-generator-types.js","sourceRoot":"","sources":["../../../server/service/domain-generator/domain-generator-types.ts"],"names":[],"mappings":";;;;AAAA,+CAA+C;AAC/C,qDAAqD;AACrD,iDAAmD;AACnD,yDAA+C;AAGxC,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;CAMhC,CAAA;AANY,oDAAoB;AAE/B;IADC,I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QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,qFAAqF;KACnG,CAAC;sCACS,OAAO;6DAAA;AAGlB;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,wDAAwD,EAAE,CAAC;sCAC1E,OAAO;yDAAA;AAGd;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,uBAAO,CAAC,EAAE,EAAE,WAAW,EAAE,iDAAiD,EAAE,CAAC;;yDAC7E;qCApBL,0BAA0B;IADtC,IAAA,wBAAS,EAAC,EAAE,WAAW,EAAE,sEAAsE,EAAE,CAAC;GACtF,0BAA0B,CAqBtC","sourcesContent":["import { Field, InputType } from 'type-graphql'\nimport { GraphQLEmailAddress } from 'graphql-scalars'\nimport { DomainInput } from '@things-factory/shell'\nimport { NewRole } from '../role/role-types.js'\n\n@InputType({ description: 'Input for generating a new domain.' })\nexport class DomainGeneratorInput {\n @Field({ description: 'The name of the new domain.' })\n name: string\n\n @Field({ nullable: true, description: 'A description for the new domain.' })\n description?: string\n}\n\n@InputType({ description: 'Input for the domain creation wizard, including domain, users, and roles.' })\nexport class DomainUserRoleInput {\n @Field(type => DomainInput, { description: 'The details of the new domain to be created.' })\n domain: DomainInput\n\n @Field(type => [NewUserByDomainWizardInput], { description: 'A list of new users to be created within the domain.' })\n users: NewUserByDomainWizardInput[]\n\n @Field(type => [NewRole], { description: 'A list of new roles to be created within the domain.' })\n roles: NewRole[]\n}\n\n@InputType({ description: 'Input for creating a new user as part of the domain creation wizard.' })\nexport class NewUserByDomainWizardInput {\n @Field({ description: 'The full name of the new user.' })\n name: string\n\n @Field(type => GraphQLEmailAddress, { description: 'The email address of the new user.' })\n email: string\n\n @Field({ nullable: true, description: 'The password for the new user. If not provided, an invitation will be sent.' })\n password: string\n\n @Field({\n nullable: true,\n description: 'Indicates whether the user should be invited via email instead of created directly.'\n })\n isInvitee: Boolean\n\n @Field({ description: 'Indicates whether this user is an owner of the domain.' })\n owner: Boolean\n\n @Field(type => [NewRole], { description: 'A list of roles to be assigned to the new user.' })\n roles: NewRole[]\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import { DomainLink } from './domain-link.js';
2
+ import { NewDomainLink, DomainLinkPatch } from './domain-link-types.js';
3
+ export declare class DomainLinkMutation {
4
+ createDomainLink(domainLink: NewDomainLink, context: ResolverContext): Promise<DomainLink>;
5
+ updateDomainLink(id: string, patch: DomainLinkPatch, context: ResolverContext): Promise<DomainLink>;
6
+ updateMultipleDomainLink(patches: DomainLinkPatch[], context: ResolverContext): Promise<DomainLink[]>;
7
+ deleteDomainLink(id: string, context: ResolverContext): Promise<boolean>;
8
+ deleteDomainLinks(ids: string[], context: ResolverContext): Promise<boolean>;
9
+ }