@friggframework/core 2.0.0--canary.522.cbd3d5a.0 → 2.0.0--canary.517.35ee143.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 (225) hide show
  1. package/CHANGELOG.md +67 -66
  2. package/CLAUDE.md +124 -148
  3. package/README.md +130 -165
  4. package/admin-scripts/index.js +16 -30
  5. package/admin-scripts/repositories/{admin-api-key-repository-documentdb.js → admin-process-repository-documentdb.js} +5 -5
  6. package/admin-scripts/repositories/{admin-api-key-repository-factory.js → admin-process-repository-factory.js} +15 -19
  7. package/admin-scripts/repositories/admin-process-repository-interface.js +150 -0
  8. package/admin-scripts/repositories/admin-process-repository-mongo.js +213 -0
  9. package/admin-scripts/repositories/admin-process-repository-postgres.js +251 -0
  10. package/admin-scripts/repositories/script-schedule-repository-factory.js +2 -6
  11. package/admin-scripts/repositories/script-schedule-repository-interface.js +14 -36
  12. package/admin-scripts/repositories/script-schedule-repository-mongo.js +13 -25
  13. package/admin-scripts/repositories/script-schedule-repository-postgres.js +13 -25
  14. package/application/commands/admin-script-commands.js +102 -266
  15. package/application/commands/integration-commands.js +6 -12
  16. package/application/index.js +3 -1
  17. package/assertions/get.js +4 -1
  18. package/associations/association.js +57 -59
  19. package/associations/model.js +41 -41
  20. package/core/CLAUDE.md +156 -222
  21. package/core/Worker.js +1 -5
  22. package/credential/repositories/credential-repository-documentdb.js +1 -71
  23. package/credential/repositories/credential-repository-interface.js +2 -8
  24. package/credential/repositories/credential-repository-mongo.js +4 -45
  25. package/credential/repositories/credential-repository-postgres.js +3 -44
  26. package/credential/repositories/credential-repository.js +4 -6
  27. package/credential/use-cases/get-credential-for-user.js +3 -21
  28. package/credential/use-cases/update-authentication-status.js +2 -5
  29. package/database/MONGODB_TRANSACTION_FIX.md +52 -72
  30. package/database/adapters/lambda-invoker.js +7 -8
  31. package/database/config.js +13 -15
  32. package/database/documentdb-encryption-service.js +13 -29
  33. package/database/documentdb-utils.js +12 -21
  34. package/database/encryption/README.md +36 -53
  35. package/database/encryption/encryption-schema-registry.js +9 -21
  36. package/database/encryption/field-encryption-service.js +4 -15
  37. package/database/encryption/logger.js +2 -3
  38. package/database/encryption/prisma-encryption-extension.js +8 -5
  39. package/database/index.js +2 -4
  40. package/database/models/IndividualUser.js +15 -15
  41. package/database/models/OrganizationUser.js +4 -6
  42. package/database/models/UserModel.js +2 -2
  43. package/database/models/WebsocketConnection.js +1 -4
  44. package/database/mongoose.js +2 -2
  45. package/database/prisma.js +14 -22
  46. package/database/repositories/health-check-repository-documentdb.js +7 -22
  47. package/database/repositories/health-check-repository-factory.js +3 -9
  48. package/database/repositories/health-check-repository-interface.js +5 -15
  49. package/database/repositories/health-check-repository-mongodb.js +6 -9
  50. package/database/repositories/health-check-repository-postgres.js +1 -1
  51. package/database/repositories/migration-status-repository-s3.js +5 -10
  52. package/database/use-cases/check-database-health-use-case.js +2 -3
  53. package/database/use-cases/check-database-state-use-case.js +7 -9
  54. package/database/use-cases/get-database-state-via-worker-use-case.js +12 -15
  55. package/database/use-cases/get-migration-status-use-case.js +2 -4
  56. package/database/use-cases/run-database-migration-use-case.js +9 -41
  57. package/database/use-cases/test-encryption-use-case.js +5 -4
  58. package/database/use-cases/trigger-database-migration-use-case.js +8 -9
  59. package/database/utils/mongodb-collection-utils.js +3 -11
  60. package/database/utils/mongodb-schema-init.js +4 -10
  61. package/database/utils/prisma-runner.js +74 -144
  62. package/database/utils/prisma-schema-parser.js +2 -2
  63. package/docs/PROCESS_MANAGEMENT_QUEUE_SPEC.md +80 -135
  64. package/encrypt/Cryptor.js +2 -8
  65. package/errors/fetch-error.js +1 -1
  66. package/generated/prisma-mongodb/edge.js +16 -59
  67. package/generated/prisma-mongodb/index-browser.js +12 -62
  68. package/generated/prisma-mongodb/index.d.ts +4850 -8136
  69. package/generated/prisma-mongodb/index.js +16 -59
  70. package/generated/prisma-mongodb/package.json +1 -1
  71. package/generated/prisma-mongodb/schema.prisma +33 -75
  72. package/generated/prisma-mongodb/wasm.js +16 -59
  73. package/generated/prisma-postgresql/edge.js +15 -59
  74. package/generated/prisma-postgresql/index-browser.js +11 -62
  75. package/generated/prisma-postgresql/index.d.ts +5963 -8930
  76. package/generated/prisma-postgresql/index.js +15 -59
  77. package/generated/prisma-postgresql/package.json +1 -1
  78. package/generated/prisma-postgresql/schema.prisma +33 -73
  79. package/generated/prisma-postgresql/wasm.js +15 -59
  80. package/handlers/WEBHOOKS.md +81 -104
  81. package/handlers/app-definition-loader.js +1 -1
  82. package/handlers/app-handler-helpers.js +2 -14
  83. package/handlers/backend-utils.js +1 -0
  84. package/handlers/database-migration-handler.js +45 -64
  85. package/handlers/middleware/admin-auth.js +53 -0
  86. package/handlers/routers/HEALTHCHECK.md +135 -170
  87. package/handlers/routers/auth.js +2 -23
  88. package/handlers/routers/db-migration.handler.js +3 -2
  89. package/handlers/routers/db-migration.js +33 -69
  90. package/handlers/routers/health.js +8 -23
  91. package/handlers/routers/integration-defined-routers.js +4 -4
  92. package/handlers/routers/integration-webhook-routers.js +7 -17
  93. package/handlers/routers/websocket.js +3 -9
  94. package/handlers/use-cases/check-integrations-health-use-case.js +6 -13
  95. package/handlers/workers/db-migration.js +26 -54
  96. package/index.js +9 -5
  97. package/integrations/WEBHOOK-QUICKSTART.md +14 -21
  98. package/integrations/index.js +0 -4
  99. package/integrations/integration-base.js +6 -9
  100. package/integrations/integration-router.js +146 -1817
  101. package/integrations/options.js +20 -47
  102. package/integrations/repositories/integration-repository-documentdb.js +24 -53
  103. package/integrations/repositories/integration-repository-factory.js +2 -6
  104. package/integrations/repositories/integration-repository-interface.js +9 -27
  105. package/integrations/repositories/integration-repository-postgres.js +3 -3
  106. package/integrations/repositories/process-repository-factory.js +1 -0
  107. package/integrations/repositories/process-repository-interface.js +5 -9
  108. package/integrations/repositories/process-repository-mongo.js +3 -7
  109. package/integrations/repositories/process-repository-postgres.js +2 -2
  110. package/integrations/tests/doubles/config-capturing-integration.js +8 -9
  111. package/integrations/tests/doubles/dummy-integration-class.js +8 -81
  112. package/integrations/tests/doubles/test-integration-repository.js +11 -51
  113. package/integrations/use-cases/create-integration.js +32 -36
  114. package/integrations/use-cases/create-process.js +9 -20
  115. package/integrations/use-cases/delete-integration-for-user.js +4 -5
  116. package/integrations/use-cases/get-integration-for-user.js +10 -25
  117. package/integrations/use-cases/get-integration-instance-by-definition.js +7 -13
  118. package/integrations/use-cases/get-integrations-for-user.js +1 -4
  119. package/integrations/use-cases/get-possible-integrations.js +1 -1
  120. package/integrations/use-cases/get-process.js +6 -5
  121. package/integrations/use-cases/index.js +1 -3
  122. package/integrations/use-cases/load-integration-context.js +5 -1
  123. package/integrations/use-cases/update-process-state.js +8 -10
  124. package/integrations/utils/map-integration-dto.js +3 -9
  125. package/jest-setup.js +1 -1
  126. package/jest-teardown.js +1 -1
  127. package/lambda/TimeoutCatcher.js +30 -32
  128. package/lambda/index.js +1 -1
  129. package/logs/index.js +3 -3
  130. package/modules/module.js +1 -3
  131. package/modules/repositories/module-repository-documentdb.js +48 -114
  132. package/modules/repositories/module-repository-interface.js +0 -13
  133. package/modules/repositories/module-repository-mongo.js +6 -46
  134. package/modules/repositories/module-repository-postgres.js +6 -48
  135. package/modules/repositories/module-repository.js +1 -34
  136. package/modules/requester/api-key.js +2 -0
  137. package/modules/requester/basic.js +1 -0
  138. package/modules/requester/oauth-2.js +2 -3
  139. package/modules/test/mock-api/definition.js +10 -15
  140. package/modules/test/mock-api/mocks/hubspot.js +36 -36
  141. package/modules/tests/doubles/test-module-factory.js +4 -10
  142. package/modules/tests/doubles/test-module-repository.js +1 -1
  143. package/modules/use-cases/get-entities-for-user.js +1 -1
  144. package/modules/use-cases/get-entity-options-by-id.js +6 -8
  145. package/modules/use-cases/get-module.js +9 -12
  146. package/modules/use-cases/process-authorization-callback.js +6 -12
  147. package/modules/use-cases/refresh-entity-options.js +6 -8
  148. package/modules/use-cases/test-module-auth.js +6 -8
  149. package/modules/utils/map-module-dto.js +2 -2
  150. package/package.json +5 -7
  151. package/prisma-mongodb/schema.prisma +33 -75
  152. package/prisma-postgresql/schema.prisma +33 -73
  153. package/queues/queuer-util.js +1 -5
  154. package/syncs/model.js +51 -51
  155. package/syncs/repositories/sync-repository-documentdb.js +19 -39
  156. package/syncs/repositories/sync-repository-interface.js +2 -6
  157. package/syncs/repositories/sync-repository-postgres.js +13 -19
  158. package/syncs/sync.js +100 -104
  159. package/token/repositories/token-repository-factory.js +3 -1
  160. package/types/assertions/index.d.ts +72 -72
  161. package/types/associations/index.d.ts +57 -57
  162. package/types/core/index.d.ts +53 -59
  163. package/types/database/index.d.ts +2 -2
  164. package/types/encrypt/index.d.ts +3 -3
  165. package/types/errors/index.d.ts +54 -61
  166. package/types/eslint-config/index.d.ts +40 -40
  167. package/types/integrations/index.d.ts +183 -185
  168. package/types/lambda/index.d.ts +26 -26
  169. package/types/logs/index.d.ts +4 -4
  170. package/types/module-plugin/index.d.ts +237 -239
  171. package/types/prettier-config/index.d.ts +5 -5
  172. package/types/syncs/index.d.ts +108 -102
  173. package/types/test-environment/index.d.ts +14 -14
  174. package/types/tsconfig.json +93 -95
  175. package/user/tests/doubles/test-user-repository.js +2 -5
  176. package/user/use-cases/authenticate-user.js +4 -2
  177. package/user/use-cases/authenticate-with-shared-secret.js +1 -1
  178. package/user/use-cases/create-individual-user.js +7 -8
  179. package/user/use-cases/create-organization-user.js +1 -1
  180. package/user/use-cases/create-token-for-user-id.js +1 -1
  181. package/user/use-cases/get-user-from-adopter-jwt.js +2 -0
  182. package/user/use-cases/get-user-from-bearer-token.js +3 -7
  183. package/user/use-cases/get-user-from-x-frigg-headers.js +11 -14
  184. package/user/use-cases/login-user.js +8 -8
  185. package/user/user.js +4 -18
  186. package/utils/backend-path.js +2 -2
  187. package/utils/index.js +1 -4
  188. package/websocket/repositories/websocket-connection-repository-documentdb.js +8 -21
  189. package/websocket/repositories/websocket-connection-repository-mongo.js +4 -8
  190. package/websocket/repositories/websocket-connection-repository-postgres.js +4 -8
  191. package/websocket/repositories/websocket-connection-repository.js +4 -8
  192. package/admin-scripts/repositories/admin-api-key-repository-interface.js +0 -121
  193. package/admin-scripts/repositories/admin-api-key-repository-mongo.js +0 -155
  194. package/admin-scripts/repositories/admin-api-key-repository-postgres.js +0 -189
  195. package/admin-scripts/repositories/script-execution-repository-documentdb.js +0 -21
  196. package/admin-scripts/repositories/script-execution-repository-factory.js +0 -55
  197. package/admin-scripts/repositories/script-execution-repository-interface.js +0 -193
  198. package/admin-scripts/repositories/script-execution-repository-mongo.js +0 -278
  199. package/admin-scripts/repositories/script-execution-repository-postgres.js +0 -320
  200. package/credential/credential-router.js +0 -262
  201. package/credential/use-cases/delete-credential-for-user.js +0 -50
  202. package/credential/use-cases/list-credentials-for-user.js +0 -31
  203. package/credential/use-cases/reauthorize-credential.js +0 -103
  204. package/handlers/routers/admin.js +0 -450
  205. package/handlers/routers/docs.js +0 -180
  206. package/handlers/routers/middleware/loadUser.js +0 -39
  207. package/handlers/routers/middleware/requireAdmin.js +0 -41
  208. package/handlers/routers/middleware/requireLoggedInUser.js +0 -19
  209. package/integrations/use-cases/execute-proxy-request.js +0 -564
  210. package/modules/domain/entities/AuthorizationSession.js +0 -131
  211. package/modules/domain/entities/index.js +0 -10
  212. package/modules/repositories/authorization-session-repository-factory.js +0 -55
  213. package/modules/repositories/authorization-session-repository-interface.js +0 -75
  214. package/modules/repositories/authorization-session-repository-mongo.js +0 -169
  215. package/modules/repositories/authorization-session-repository-postgres.js +0 -170
  216. package/modules/use-cases/delete-module-entity.js +0 -23
  217. package/modules/use-cases/get-authorization-requirements.js +0 -110
  218. package/modules/use-cases/get-module-entity-by-id.js +0 -16
  219. package/modules/use-cases/process-authorization-step.js +0 -160
  220. package/modules/use-cases/start-authorization-session.js +0 -86
  221. package/modules/use-cases/update-module-entity.js +0 -27
  222. package/openapi/openapi-spec-generator.js +0 -370
  223. package/openapi/openapi-v1.yaml +0 -1360
  224. package/openapi/openapi-v2.yaml +0 -1535
  225. package/user/use-cases/delete-user.js +0 -47
@@ -1,120 +1,126 @@
1
- declare module '@friggframework/syncs/model' {
2
- import { Model } from 'mongoose';
1
+ declare module "@friggframework/syncs/model" {
2
+ import { Model } from "mongoose";
3
3
 
4
- export class Sync extends Model {
5
- entities: any[];
6
- hash: string;
7
- name: string;
8
- dataIdentifiers: {
9
- entity: any;
10
- id: object;
11
- hash: string;
12
- }[];
13
- }
4
+ export class Sync extends Model {
5
+ entities: any[];
6
+ hash: string;
7
+ name: string;
8
+ dataIdentifiers: {
9
+ entity: any;
10
+ id: object;
11
+ hash: string;
12
+ }[];
13
+ }
14
14
  }
15
15
 
16
- declare module '@friggframework/syncs/manager' {
17
- import Sync from '@friggframework/syncs/sync';
16
+ declare module "@friggframework/syncs/manager" {
17
+ import Sync from "@friggframework/syncs/sync";
18
18
 
19
- export default class SyncManager implements IFriggSyncManager {
20
- ignoreEmptyMatchValues: boolean;
21
- integration: any;
22
- isUnidirectionalSync: boolean;
23
- omitEmptyStringsFromData: boolean;
24
- syncObjectClass: Sync;
25
- useFirstMatchingDuplicate: boolean;
19
+ export default class SyncManager implements IFriggSyncManager {
20
+ ignoreEmptyMatchValues: boolean;
21
+ integration: any;
22
+ isUnidirectionalSync: boolean;
23
+ omitEmptyStringsFromData: boolean;
24
+ syncObjectClass: Sync;
25
+ useFirstMatchingDuplicate: boolean;
26
26
 
27
- constructor(params: SyncManagerConstructor);
28
- confirmCreate(syncObj: Sync, createdId: string): Promise<any>;
29
- confirmUpdate(syncObj: Sync): Promise<any>;
30
- createSyncDBObject(objArr: any[], entities: any[]): Promise<any>;
31
- initialSync(): Promise<void>;
32
- sync(syncObjects: Sync[]): Promise<any[]>;
33
- }
27
+ constructor(params: SyncManagerConstructor);
28
+ confirmCreate(
29
+ syncObj: Sync,
30
+ createdId: string,
31
+ ): Promise<any>;
32
+ confirmUpdate(syncObj: Sync): Promise<any>;
33
+ createSyncDBObject(objArr: any[], entities: any[]): Promise<any>;
34
+ initialSync(): Promise<void>;
35
+ sync(syncObjects: Sync[]): Promise<any[]>;
36
+ }
34
37
 
35
- interface IFriggSyncManager {
36
- syncObjectClass: Sync;
37
- ignoreEmptyMatchValues: boolean;
38
- isUnidirectionalSync: boolean;
39
- useFirstMatchingDuplicate: boolean;
40
- omitEmptyStringsFromData: boolean;
41
- integration: any;
38
+ interface IFriggSyncManager {
39
+ syncObjectClass: Sync;
40
+ ignoreEmptyMatchValues: boolean;
41
+ isUnidirectionalSync: boolean;
42
+ useFirstMatchingDuplicate: boolean;
43
+ omitEmptyStringsFromData: boolean;
44
+ integration: any;
42
45
 
43
- initialSync(): Promise<void>;
44
- createSyncDBObject(objArr: any[], entities: any[]): Promise<any>;
45
- sync(syncObjects: Sync[]): Promise<any[]>;
46
- confirmCreate(syncObj: Sync, createdId: string): Promise<any>;
47
- confirmUpdate(syncObj: Sync): Promise<any>;
48
- }
46
+ initialSync(): Promise<void>;
47
+ createSyncDBObject(objArr: any[], entities: any[]): Promise<any>;
48
+ sync(syncObjects: Sync[]): Promise<any[]>;
49
+ confirmCreate(
50
+ syncObj: Sync,
51
+ createdId: string,
52
+ ): Promise<any>;
53
+ confirmUpdate(syncObj: Sync): Promise<any>;
54
+ }
49
55
 
50
- type SyncManagerConstructor = {
51
- syncObjectClass: Sync;
52
- ignoreEmptyMatchValues?: boolean;
53
- isUnidirectionalSync?: boolean;
54
- useFirstMatchingDuplicate?: boolean;
55
- omitEmptyStringsFromData?: boolean;
56
- integration: any;
57
- };
56
+ type SyncManagerConstructor = {
57
+ syncObjectClass: Sync;
58
+ ignoreEmptyMatchValues?: boolean;
59
+ isUnidirectionalSync?: boolean;
60
+ useFirstMatchingDuplicate?: boolean;
61
+ omitEmptyStringsFromData?: boolean;
62
+ integration: any;
63
+ };
58
64
  }
59
65
 
60
- declare module '@friggframework/syncs/sync' {
61
- export default class Sync implements IFriggSync {
62
- data: object;
63
- dataIdentifier: any;
64
- dataIdentifierHash: string;
65
- matchHash: string;
66
- missingMatchData: boolean;
67
- moduleName: string;
68
- syncId: string;
69
- useMapping: boolean;
66
+ declare module "@friggframework/syncs/sync" {
67
+ export default class Sync implements IFriggSync {
68
+ data: object;
69
+ dataIdentifier: any;
70
+ dataIdentifierHash: string;
71
+ matchHash: string;
72
+ missingMatchData: boolean;
73
+ moduleName: string;
74
+ syncId: string;
75
+ useMapping: boolean;
70
76
 
71
- static Config: {
72
- name: string;
73
- keys: any[];
74
- matchOn: any[];
75
- moduleMap: object;
76
- reverseModuleMap: object;
77
- };
77
+ static Config: {
78
+ name: string;
79
+ keys: any[];
80
+ matchOn: any[];
81
+ moduleMap: object;
82
+ reverseModuleMap: object;
83
+ };
78
84
 
79
- static hashJSON(data: any): string;
85
+ static hashJSON(data: any): string;
80
86
 
81
- constructor(params: SyncConstructor);
82
- dataKeyIsReplaceable(key: string): boolean;
83
- equals(syncObj: IFriggSync): boolean;
84
- getHashData(params: GetHashData): any;
85
- getName(): string;
86
- isModuleInMap(moduleName: string): any;
87
- reverseModuleMap(moduleName: string): any;
88
- setSyncId(syncId: string): void;
89
- }
87
+ constructor(params: SyncConstructor);
88
+ dataKeyIsReplaceable(key: string): boolean;
89
+ equals(syncObj: IFriggSync): boolean;
90
+ getHashData(params: GetHashData): any;
91
+ getName(): string;
92
+ isModuleInMap(moduleName: string): any;
93
+ reverseModuleMap(moduleName: string): any;
94
+ setSyncId(syncId: string): void;
95
+ }
90
96
 
91
- interface IFriggSync {
92
- data: object;
93
- moduleName: string;
94
- dataIdentifier: any;
95
- useMapping?: boolean;
96
- dataIdentifierHash: string;
97
- missingMatchData: boolean;
98
- matchHash: string;
99
- syncId: string;
97
+ interface IFriggSync {
98
+ data: object;
99
+ moduleName: string;
100
+ dataIdentifier: any;
101
+ useMapping?: boolean;
102
+ dataIdentifierHash: string;
103
+ missingMatchData: boolean;
104
+ matchHash: string;
105
+ syncId: string;
100
106
 
101
- equals(syncObj: IFriggSync): boolean;
102
- dataKeyIsReplaceable(key: string): boolean;
103
- isModuleInMap(moduleName: string): any;
104
- getName(): string;
105
- getHashData(params: GetHashData): any;
106
- setSyncId(syncId: string): void;
107
- reverseModuleMap(moduleName: string): any;
108
- }
107
+ equals(syncObj: IFriggSync): boolean;
108
+ dataKeyIsReplaceable(key: string): boolean;
109
+ isModuleInMap(moduleName: string): any;
110
+ getName(): string;
111
+ getHashData(params: GetHashData): any;
112
+ setSyncId(syncId: string): void;
113
+ reverseModuleMap(moduleName: string): any;
114
+ }
109
115
 
110
- type SyncConstructor = {
111
- data: any;
112
- moduleName: string;
113
- dataIdentifier: any;
114
- useMapping?: boolean;
115
- };
116
+ type SyncConstructor = {
117
+ data: any;
118
+ moduleName: string;
119
+ dataIdentifier: any;
120
+ useMapping?: boolean;
121
+ };
116
122
 
117
- type GetHashData = {
118
- omitEmptyStringsFromData?: boolean;
119
- };
123
+ type GetHashData = {
124
+ omitEmptyStringsFromData?: boolean;
125
+ };
120
126
  }
@@ -1,17 +1,17 @@
1
- declare module '@friggframework/test-environment' {
2
- export class TestMongo implements IFriggTestDatabase {
3
- #mongoServer: any;
4
- start(): Promise<void>;
5
- stop(): Promise<void>;
6
- }
1
+ declare module "@friggframework/test-environment" {
2
+ export class TestMongo implements IFriggTestDatabase {
3
+ #mongoServer: any;
4
+ start(): Promise<void>;
5
+ stop(): Promise<void>;
6
+ }
7
7
 
8
- interface IFriggTestDatabase {
9
- start(): Promise<void>;
10
- stop(): Promise<void>;
11
- }
8
+ interface IFriggTestDatabase {
9
+ start(): Promise<void>;
10
+ stop(): Promise<void>;
11
+ }
12
12
 
13
- export function overrideEnvironment(overrideByKey: any): void;
14
- export function restoreEnvironment(): void;
15
- export function globalTeardown(): Promise<void>;
16
- export function globalSetup(): Promise<void>;
13
+ export function overrideEnvironment(overrideByKey: any): void;
14
+ export function restoreEnvironment(): void;
15
+ export function globalTeardown(): Promise<void>;
16
+ export function globalSetup(): Promise<void>;
17
17
  }
@@ -1,105 +1,103 @@
1
1
  {
2
- "compilerOptions": {
3
- /* Visit https://aka.ms/tsconfig to read more about this file */
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig to read more about this file */
4
4
 
5
- /* Projects */
6
- // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
7
- // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
- // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
9
- // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
10
- // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
- // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
5
+ /* Projects */
6
+ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
7
+ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
+ // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
9
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
10
+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
12
 
13
- /* Language and Environment */
14
- "target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
15
- "lib": [
16
- "es2022"
17
- ] /* Specify a set of bundled library declaration files that describe the target runtime environment. */,
18
- // "jsx": "preserve", /* Specify what JSX code is generated. */
19
- // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
20
- // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
21
- // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
22
- // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
23
- // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
24
- // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
25
- // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
26
- // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
27
- // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
13
+ /* Language and Environment */
14
+ "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15
+ "lib": ["es2022"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
+ // "jsx": "preserve", /* Specify what JSX code is generated. */
17
+ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
18
+ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
19
+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
20
+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
21
+ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
22
+ // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
23
+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24
+ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
25
+ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
28
26
 
29
- /* Modules */
30
- "module": "commonjs" /* Specify what module code is generated. */,
31
- // "rootDir": "./", /* Specify the root folder within your source files. */
32
- // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
33
- // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
34
- // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
35
- // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
36
- // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
37
- // "types": [], /* Specify type package names to be included without being referenced in a source file. */
38
- // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
39
- // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
40
- // "resolveJsonModule": true, /* Enable importing .json files. */
41
- // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
27
+ /* Modules */
28
+ "module": "commonjs", /* Specify what module code is generated. */
29
+ // "rootDir": "./", /* Specify the root folder within your source files. */
30
+ // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
31
+ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
32
+ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
33
+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
34
+ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
35
+ // "types": [], /* Specify type package names to be included without being referenced in a source file. */
36
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
37
+ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
38
+ // "resolveJsonModule": true, /* Enable importing .json files. */
39
+ // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
42
40
 
43
- /* JavaScript Support */
44
- // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
45
- // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
46
- // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
41
+ /* JavaScript Support */
42
+ // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
43
+ // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
44
+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
47
45
 
48
- /* Emit */
49
- // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
50
- // "declarationMap": true, /* Create sourcemaps for d.ts files. */
51
- // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
52
- // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
53
- // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
54
- // "outDir": "./", /* Specify an output folder for all emitted files. */
55
- // "removeComments": true, /* Disable emitting comments. */
56
- // "noEmit": true, /* Disable emitting files from a compilation. */
57
- // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
58
- // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
59
- // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
60
- // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
61
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
62
- // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
63
- // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
64
- // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
65
- // "newLine": "crlf", /* Set the newline character for emitting files. */
66
- // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
67
- // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
68
- // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
69
- // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
70
- // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
71
- // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
46
+ /* Emit */
47
+ // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
48
+ // "declarationMap": true, /* Create sourcemaps for d.ts files. */
49
+ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
50
+ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
51
+ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
52
+ // "outDir": "./", /* Specify an output folder for all emitted files. */
53
+ // "removeComments": true, /* Disable emitting comments. */
54
+ // "noEmit": true, /* Disable emitting files from a compilation. */
55
+ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
56
+ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
57
+ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
58
+ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
59
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
60
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
61
+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
62
+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
63
+ // "newLine": "crlf", /* Set the newline character for emitting files. */
64
+ // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
65
+ // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
66
+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
67
+ // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
68
+ // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
69
+ // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
72
70
 
73
- /* Interop Constraints */
74
- // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
75
- // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
76
- "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
77
- // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
78
- "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
71
+ /* Interop Constraints */
72
+ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
73
+ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
74
+ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
75
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
76
+ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
79
77
 
80
- /* Type Checking */
81
- "strict": true /* Enable all strict type-checking options. */,
82
- // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
83
- // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
84
- // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
85
- // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
86
- // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
87
- // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
88
- // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
89
- // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
90
- // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
91
- // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
92
- // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
93
- // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
94
- // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
95
- // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
96
- // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
97
- // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
98
- // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
99
- // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
78
+ /* Type Checking */
79
+ "strict": true, /* Enable all strict type-checking options. */
80
+ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
81
+ // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
82
+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
83
+ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
84
+ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
85
+ // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
86
+ // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
87
+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
88
+ // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
89
+ // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
90
+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
91
+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
92
+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
93
+ // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
94
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
95
+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
96
+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
97
+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
100
98
 
101
- /* Completeness */
102
- // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
103
- "skipLibCheck": true /* Skip type checking all .d.ts files. */
104
- }
99
+ /* Completeness */
100
+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
101
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
102
+ }
105
103
  }
@@ -28,10 +28,7 @@ class TestUserRepository {
28
28
  }
29
29
 
30
30
  async createIndividualUser(params) {
31
- const individualUserData = {
32
- id: `individual-${Date.now()}`,
33
- ...params,
34
- };
31
+ const individualUserData = { id: `individual-${Date.now()}`, ...params };
35
32
  this.individualUsers.set(individualUserData.id, individualUserData);
36
33
  return individualUserData;
37
34
  }
@@ -72,4 +69,4 @@ class TestUserRepository {
72
69
  }
73
70
  }
74
71
 
75
- module.exports = { TestUserRepository };
72
+ module.exports = { TestUserRepository };
@@ -2,12 +2,12 @@ const Boom = require('@hapi/boom');
2
2
 
3
3
  /**
4
4
  * Use case for authenticating a user using multiple authentication strategies.
5
- *
5
+ *
6
6
  * Supports three authentication modes in priority order:
7
7
  * 1. Shared Secret (backend-to-backend with x-frigg-api-key + x-frigg headers)
8
8
  * 2. Adopter JWT (custom JWT authentication)
9
9
  * 3. Frigg Native Token (bearer token from /user/login)
10
- *
10
+ *
11
11
  * x-frigg-appUserId and x-frigg-appOrgId headers are automatically supported
12
12
  * for user identification with any auth mode. When present with JWT or Frigg
13
13
  * tokens, they are validated to match the authenticated user.
@@ -123,3 +123,5 @@ class AuthenticateUser {
123
123
  }
124
124
 
125
125
  module.exports = { AuthenticateUser };
126
+
127
+
@@ -33,7 +33,7 @@ class AuthenticateWithSharedSecret {
33
33
  if (!expectedSecret) {
34
34
  throw Boom.badImplementation(
35
35
  'FRIGG_API_KEY environment variable is not configured. ' +
36
- 'Set FRIGG_API_KEY to enable shared secret authentication.'
36
+ 'Set FRIGG_API_KEY to enable shared secret authentication.'
37
37
  );
38
38
  }
39
39
 
@@ -39,14 +39,13 @@ class CreateIndividualUser {
39
39
  const appUserId = get(params, 'appUserId', null);
40
40
  const organizationUserId = get(params, 'organizationUserId', null);
41
41
 
42
- const individualUserData =
43
- await this.userRepository.createIndividualUser({
44
- email,
45
- username,
46
- hashword,
47
- appUserId,
48
- organizationUser: organizationUserId,
49
- });
42
+ const individualUserData = await this.userRepository.createIndividualUser({
43
+ email,
44
+ username,
45
+ hashword,
46
+ appUserId,
47
+ organizationUser: organizationUserId,
48
+ });
50
49
 
51
50
  return new User(
52
51
  individualUserData,
@@ -44,4 +44,4 @@ class CreateOrganizationUser {
44
44
  }
45
45
  }
46
46
 
47
- module.exports = { CreateOrganizationUser };
47
+ module.exports = { CreateOrganizationUser };
@@ -27,4 +27,4 @@ class CreateTokenForUserId {
27
27
  }
28
28
  }
29
29
 
30
- module.exports = { CreateTokenForUserId };
30
+ module.exports = { CreateTokenForUserId };
@@ -145,3 +145,5 @@ class GetUserFromAdopterJwt {
145
145
  }
146
146
 
147
147
  module.exports = { GetUserFromAdopterJwt };
148
+
149
+
@@ -41,10 +41,7 @@ class GetUserFromBearerToken {
41
41
  }
42
42
 
43
43
  if (this.userConfig.primary === 'organization') {
44
- const organizationUserData =
45
- await this.userRepository.findOrganizationUserById(
46
- sessionToken.user
47
- );
44
+ const organizationUserData = await this.userRepository.findOrganizationUserById(sessionToken.user);
48
45
 
49
46
  if (!organizationUserData) {
50
47
  throw Boom.unauthorized('Organization User Not Found');
@@ -60,8 +57,7 @@ class GetUserFromBearerToken {
60
57
  );
61
58
  }
62
59
 
63
- const individualUserData =
64
- await this.userRepository.findIndividualUserById(sessionToken.user);
60
+ const individualUserData = await this.userRepository.findIndividualUserById(sessionToken.user);
65
61
 
66
62
  if (!individualUserData) {
67
63
  throw Boom.unauthorized('Individual User Not Found');
@@ -78,4 +74,4 @@ class GetUserFromBearerToken {
78
74
  }
79
75
  }
80
76
 
81
- module.exports = { GetUserFromBearerToken };
77
+ module.exports = { GetUserFromBearerToken };