@friggframework/core 2.0.0--canary.461.ec1ad4e.0 → 2.0.0--canary.461.7a66bdf.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 (29) hide show
  1. package/credential/repositories/credential-repository-mongo.js +3 -8
  2. package/credential/repositories/credential-repository-postgres.js +3 -8
  3. package/credential/repositories/credential-repository.js +3 -8
  4. package/generated/prisma-mongodb/edge.js +3 -5
  5. package/generated/prisma-mongodb/index-browser.js +0 -2
  6. package/generated/prisma-mongodb/index.d.ts +2 -98
  7. package/generated/prisma-mongodb/index.js +3 -5
  8. package/generated/prisma-mongodb/package.json +1 -1
  9. package/generated/prisma-mongodb/schema.prisma +0 -2
  10. package/generated/prisma-mongodb/wasm.js +3 -5
  11. package/generated/prisma-postgresql/edge.js +3 -5
  12. package/generated/prisma-postgresql/index-browser.js +0 -2
  13. package/generated/prisma-postgresql/index.d.ts +2 -102
  14. package/generated/prisma-postgresql/index.js +3 -5
  15. package/generated/prisma-postgresql/package.json +1 -1
  16. package/generated/prisma-postgresql/schema.prisma +0 -2
  17. package/generated/prisma-postgresql/wasm.js +3 -5
  18. package/modules/entity.js +0 -1
  19. package/modules/repositories/module-repository-mongo.js +3 -12
  20. package/modules/repositories/module-repository-postgres.js +0 -11
  21. package/modules/repositories/module-repository.js +1 -12
  22. package/modules/use-cases/get-entity-options-by-id.js +1 -1
  23. package/modules/use-cases/get-module.js +1 -2
  24. package/modules/use-cases/refresh-entity-options.js +1 -1
  25. package/modules/use-cases/test-module-auth.js +1 -1
  26. package/package.json +5 -5
  27. package/prisma-mongodb/schema.prisma +0 -2
  28. package/prisma-postgresql/schema.prisma +0 -2
  29. package/types/module-plugin/index.d.ts +0 -2
@@ -8,7 +8,9 @@ const { ModuleRepositoryInterface } = require('./module-repository-interface');
8
8
  * MongoDB-specific characteristics:
9
9
  * - Uses String IDs (ObjectId)
10
10
  * - No ID conversion needed (IDs are already strings)
11
- * - entity.__t (discriminator) → entity.subType
11
+ *
12
+ * Prisma Migration Notes:
13
+ * - Mongoose discriminator (__t) → moduleName field (module type: salesforce, hubspot, etc.)
12
14
  */
13
15
  class ModuleRepositoryMongo extends ModuleRepositoryInterface {
14
16
  constructor() {
@@ -100,7 +102,6 @@ class ModuleRepositoryMongo extends ModuleRepositoryInterface {
100
102
  userId: entity.userId,
101
103
  name: entity.name,
102
104
  externalId: entity.externalId,
103
- type: entity.subType,
104
105
  moduleName: entity.moduleName,
105
106
  };
106
107
  }
@@ -127,7 +128,6 @@ class ModuleRepositoryMongo extends ModuleRepositoryInterface {
127
128
  userId: e.userId,
128
129
  name: e.name,
129
130
  externalId: e.externalId,
130
- type: e.subType,
131
131
  moduleName: e.moduleName,
132
132
  }));
133
133
  }
@@ -154,7 +154,6 @@ class ModuleRepositoryMongo extends ModuleRepositoryInterface {
154
154
  userId: e.userId,
155
155
  name: e.name,
156
156
  externalId: e.externalId,
157
- type: e.subType,
158
157
  moduleName: e.moduleName,
159
158
  }));
160
159
  }
@@ -185,7 +184,6 @@ class ModuleRepositoryMongo extends ModuleRepositoryInterface {
185
184
  userId: e.userId,
186
185
  name: e.name,
187
186
  externalId: e.externalId,
188
- type: e.subType,
189
187
  moduleName: e.moduleName,
190
188
  }));
191
189
  }
@@ -232,7 +230,6 @@ class ModuleRepositoryMongo extends ModuleRepositoryInterface {
232
230
  userId: entity.userId,
233
231
  name: entity.name,
234
232
  externalId: entity.externalId,
235
- type: entity.subType,
236
233
  moduleName: entity.moduleName,
237
234
  };
238
235
  }
@@ -248,7 +245,6 @@ class ModuleRepositoryMongo extends ModuleRepositoryInterface {
248
245
  const data = {
249
246
  userId: entityData.user || entityData.userId,
250
247
  credentialId: entityData.credential || entityData.credentialId,
251
- subType: entityData.type || entityData.subType,
252
248
  name: entityData.name,
253
249
  moduleName: entityData.moduleName,
254
250
  externalId: entityData.externalId,
@@ -268,7 +264,6 @@ class ModuleRepositoryMongo extends ModuleRepositoryInterface {
268
264
  userId: entity.userId,
269
265
  name: entity.name,
270
266
  externalId: entity.externalId,
271
- type: entity.subType,
272
267
  moduleName: entity.moduleName,
273
268
  };
274
269
  }
@@ -289,8 +284,6 @@ class ModuleRepositoryMongo extends ModuleRepositoryInterface {
289
284
  data.credentialId = updates.credential;
290
285
  if (updates.credentialId !== undefined)
291
286
  data.credentialId = updates.credentialId;
292
- if (updates.type !== undefined) data.subType = updates.type;
293
- if (updates.subType !== undefined) data.subType = updates.subType;
294
287
  if (updates.name !== undefined) data.name = updates.name;
295
288
  if (updates.moduleName !== undefined)
296
289
  data.moduleName = updates.moduleName;
@@ -313,7 +306,6 @@ class ModuleRepositoryMongo extends ModuleRepositoryInterface {
313
306
  userId: entity.userId,
314
307
  name: entity.name,
315
308
  externalId: entity.externalId,
316
- type: entity.subType,
317
309
  moduleName: entity.moduleName,
318
310
  };
319
311
  } catch (error) {
@@ -377,7 +369,6 @@ class ModuleRepositoryMongo extends ModuleRepositoryInterface {
377
369
  if (filter.name) where.name = filter.name;
378
370
  if (filter.moduleName) where.moduleName = filter.moduleName;
379
371
  if (filter.externalId) where.externalId = this._toString(filter.externalId);
380
- if (filter.subType) where.subType = filter.subType;
381
372
 
382
373
  return where;
383
374
  }
@@ -136,7 +136,6 @@ class ModuleRepositoryPostgres extends ModuleRepositoryInterface {
136
136
  userId: entity.userId?.toString(),
137
137
  name: entity.name,
138
138
  externalId: entity.externalId,
139
- type: entity.subType,
140
139
  moduleName: entity.moduleName,
141
140
  };
142
141
  }
@@ -165,7 +164,6 @@ class ModuleRepositoryPostgres extends ModuleRepositoryInterface {
165
164
  userId: e.userId?.toString(),
166
165
  name: e.name,
167
166
  externalId: e.externalId,
168
- type: e.subType,
169
167
  moduleName: e.moduleName,
170
168
  }));
171
169
  }
@@ -194,7 +192,6 @@ class ModuleRepositoryPostgres extends ModuleRepositoryInterface {
194
192
  userId: e.userId?.toString(),
195
193
  name: e.name,
196
194
  externalId: e.externalId,
197
- type: e.subType,
198
195
  moduleName: e.moduleName,
199
196
  }));
200
197
  }
@@ -227,7 +224,6 @@ class ModuleRepositoryPostgres extends ModuleRepositoryInterface {
227
224
  userId: e.userId?.toString(),
228
225
  name: e.name,
229
226
  externalId: e.externalId,
230
- type: e.subType,
231
227
  moduleName: e.moduleName,
232
228
  }));
233
229
  }
@@ -275,7 +271,6 @@ class ModuleRepositoryPostgres extends ModuleRepositoryInterface {
275
271
  userId: entity.userId?.toString(),
276
272
  name: entity.name,
277
273
  externalId: entity.externalId,
278
- type: entity.subType,
279
274
  moduleName: entity.moduleName,
280
275
  };
281
276
  }
@@ -293,7 +288,6 @@ class ModuleRepositoryPostgres extends ModuleRepositoryInterface {
293
288
  credentialId: this._convertId(
294
289
  entityData.credential || entityData.credentialId
295
290
  ),
296
- subType: entityData.type || entityData.subType,
297
291
  name: entityData.name,
298
292
  moduleName: entityData.moduleName,
299
293
  externalId: entityData.externalId,
@@ -313,7 +307,6 @@ class ModuleRepositoryPostgres extends ModuleRepositoryInterface {
313
307
  userId: entity.userId?.toString(),
314
308
  name: entity.name,
315
309
  externalId: entity.externalId,
316
- type: entity.subType,
317
310
  moduleName: entity.moduleName,
318
311
  };
319
312
  }
@@ -336,8 +329,6 @@ class ModuleRepositoryPostgres extends ModuleRepositoryInterface {
336
329
  data.credentialId = this._convertId(updates.credential);
337
330
  if (updates.credentialId !== undefined)
338
331
  data.credentialId = this._convertId(updates.credentialId);
339
- if (updates.type !== undefined) data.subType = updates.type;
340
- if (updates.subType !== undefined) data.subType = updates.subType;
341
332
  if (updates.name !== undefined) data.name = updates.name;
342
333
  if (updates.moduleName !== undefined)
343
334
  data.moduleName = updates.moduleName;
@@ -362,7 +353,6 @@ class ModuleRepositoryPostgres extends ModuleRepositoryInterface {
362
353
  userId: entity.userId?.toString(),
363
354
  name: entity.name,
364
355
  externalId: entity.externalId,
365
- type: entity.subType,
366
356
  moduleName: entity.moduleName,
367
357
  };
368
358
  } catch (error) {
@@ -428,7 +418,6 @@ class ModuleRepositoryPostgres extends ModuleRepositoryInterface {
428
418
  if (filter.name) where.name = filter.name;
429
419
  if (filter.moduleName) where.moduleName = filter.moduleName;
430
420
  if (filter.externalId) where.externalId = this._toString(filter.externalId);
431
- if (filter.subType) where.subType = filter.subType;
432
421
 
433
422
  return where;
434
423
  }
@@ -13,7 +13,7 @@ const { ModuleRepositoryInterface } = require('./module-repository-interface');
13
13
  * Migration from Mongoose:
14
14
  * - Constructor injection of Prisma client
15
15
  * - populate('credential') → include: { credential: true }
16
- * - entity.__t (discriminator) → entity.subType
16
+ * - Mongoose discriminator (__t) → moduleName field (module type: salesforce, hubspot, etc.)
17
17
  * - _id → id conversion automatic in Prisma
18
18
  */
19
19
  class ModuleRepository extends ModuleRepositoryInterface {
@@ -47,7 +47,6 @@ class ModuleRepository extends ModuleRepositoryInterface {
47
47
  userId: entity.userId,
48
48
  name: entity.name,
49
49
  externalId: entity.externalId,
50
- type: entity.subType,
51
50
  moduleName: entity.moduleName,
52
51
  };
53
52
  }
@@ -72,7 +71,6 @@ class ModuleRepository extends ModuleRepositoryInterface {
72
71
  userId: e.userId,
73
72
  name: e.name,
74
73
  externalId: e.externalId,
75
- type: e.subType,
76
74
  moduleName: e.moduleName,
77
75
  }));
78
76
  }
@@ -97,7 +95,6 @@ class ModuleRepository extends ModuleRepositoryInterface {
97
95
  userId: e.userId,
98
96
  name: e.name,
99
97
  externalId: e.externalId,
100
- type: e.subType,
101
98
  moduleName: e.moduleName,
102
99
  }));
103
100
  }
@@ -126,7 +123,6 @@ class ModuleRepository extends ModuleRepositoryInterface {
126
123
  userId: e.userId,
127
124
  name: e.name,
128
125
  externalId: e.externalId,
129
- type: e.subType,
130
126
  moduleName: e.moduleName,
131
127
  }));
132
128
  }
@@ -172,7 +168,6 @@ class ModuleRepository extends ModuleRepositoryInterface {
172
168
  userId: entity.userId,
173
169
  name: entity.name,
174
170
  externalId: entity.externalId,
175
- type: entity.subType,
176
171
  moduleName: entity.moduleName,
177
172
  };
178
173
  }
@@ -189,7 +184,6 @@ class ModuleRepository extends ModuleRepositoryInterface {
189
184
  const data = {
190
185
  userId: entityData.user || entityData.userId,
191
186
  credentialId: entityData.credential || entityData.credentialId,
192
- subType: entityData.type || entityData.subType,
193
187
  name: entityData.name,
194
188
  moduleName: entityData.moduleName,
195
189
  externalId: entityData.externalId,
@@ -208,7 +202,6 @@ class ModuleRepository extends ModuleRepositoryInterface {
208
202
  userId: entity.userId,
209
203
  name: entity.name,
210
204
  externalId: entity.externalId,
211
- type: entity.subType,
212
205
  moduleName: entity.moduleName,
213
206
  };
214
207
  }
@@ -230,8 +223,6 @@ class ModuleRepository extends ModuleRepositoryInterface {
230
223
  data.credentialId = updates.credential;
231
224
  if (updates.credentialId !== undefined)
232
225
  data.credentialId = updates.credentialId;
233
- if (updates.type !== undefined) data.subType = updates.type;
234
- if (updates.subType !== undefined) data.subType = updates.subType;
235
226
  if (updates.name !== undefined) data.name = updates.name;
236
227
  if (updates.moduleName !== undefined)
237
228
  data.moduleName = updates.moduleName;
@@ -253,7 +244,6 @@ class ModuleRepository extends ModuleRepositoryInterface {
253
244
  userId: entity.userId,
254
245
  name: entity.name,
255
246
  externalId: entity.externalId,
256
- type: entity.subType,
257
247
  moduleName: entity.moduleName,
258
248
  };
259
249
  } catch (error) {
@@ -318,7 +308,6 @@ class ModuleRepository extends ModuleRepositoryInterface {
318
308
  if (filter.name) where.name = filter.name;
319
309
  if (filter.moduleName) where.moduleName = filter.moduleName;
320
310
  if (filter.externalId) where.externalId = filter.externalId;
321
- if (filter.subType) where.subType = filter.subType;
322
311
 
323
312
  return where;
324
313
  }
@@ -32,7 +32,7 @@ class GetEntityOptionsById {
32
32
  );
33
33
  }
34
34
 
35
- const entityType = entity.type;
35
+ const entityType = entity.moduleName;
36
36
  const moduleDefinition = this.moduleDefinitions.find((def) => {
37
37
  const modelName =
38
38
  Module.getEntityModelFromDefinition(def).modelName;
@@ -22,7 +22,7 @@ class GetModule {
22
22
  );
23
23
  }
24
24
 
25
- const entityType = entity.type;
25
+ const entityType = entity.moduleName;
26
26
  const moduleDefinition = this.moduleDefinitions.find((def) => {
27
27
  const modelName = Module.getEntityModelFromDefinition(def).modelName;
28
28
  return entityType === modelName;
@@ -44,7 +44,6 @@ class GetModule {
44
44
  return {
45
45
  id: module.entity.id,
46
46
  name: module.entity.name,
47
- type: module.entity.moduleName,
48
47
  moduleName: module.entity.moduleName,
49
48
  credential: module.credential,
50
49
  externalId: module.entity.externalId,
@@ -32,7 +32,7 @@ class RefreshEntityOptions {
32
32
  );
33
33
  }
34
34
 
35
- const entityType = entity.type;
35
+ const entityType = entity.moduleName;
36
36
  const moduleDefinition = this.moduleDefinitions.find((def) => {
37
37
  const modelName =
38
38
  Module.getEntityModelFromDefinition(def).modelName;
@@ -27,7 +27,7 @@ class TestModuleAuth {
27
27
  );
28
28
  }
29
29
 
30
- const entityType = entity.type;
30
+ const entityType = entity.moduleName;
31
31
  const moduleDefinition = this.moduleDefinitions.find((def) => {
32
32
  const modelName =
33
33
  Module.getEntityModelFromDefinition(def).modelName;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@friggframework/core",
3
3
  "prettier": "@friggframework/prettier-config",
4
- "version": "2.0.0--canary.461.ec1ad4e.0",
4
+ "version": "2.0.0--canary.461.7a66bdf.0",
5
5
  "dependencies": {
6
6
  "@aws-sdk/client-apigatewaymanagementapi": "^3.588.0",
7
7
  "@aws-sdk/client-kms": "^3.588.0",
@@ -38,9 +38,9 @@
38
38
  }
39
39
  },
40
40
  "devDependencies": {
41
- "@friggframework/eslint-config": "2.0.0--canary.461.ec1ad4e.0",
42
- "@friggframework/prettier-config": "2.0.0--canary.461.ec1ad4e.0",
43
- "@friggframework/test": "2.0.0--canary.461.ec1ad4e.0",
41
+ "@friggframework/eslint-config": "2.0.0--canary.461.7a66bdf.0",
42
+ "@friggframework/prettier-config": "2.0.0--canary.461.7a66bdf.0",
43
+ "@friggframework/test": "2.0.0--canary.461.7a66bdf.0",
44
44
  "@prisma/client": "^6.17.0",
45
45
  "@types/lodash": "4.17.15",
46
46
  "@typescript-eslint/eslint-plugin": "^8.0.0",
@@ -80,5 +80,5 @@
80
80
  "publishConfig": {
81
81
  "access": "public"
82
82
  },
83
- "gitHead": "ec1ad4ecc89d650ce9380aeed0a29831d8e2098b"
83
+ "gitHead": "7a66bdf03d77c34934096e197e731cda22940937"
84
84
  }
@@ -92,7 +92,6 @@ model Credential {
92
92
  id String @id @default(auto()) @map("_id") @db.ObjectId
93
93
  userId String? @db.ObjectId
94
94
  user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
95
- subType String?
96
95
  authIsValid Boolean?
97
96
  externalId String?
98
97
 
@@ -116,7 +115,6 @@ model Entity {
116
115
  id String @id @default(auto()) @map("_id") @db.ObjectId
117
116
  credentialId String? @db.ObjectId
118
117
  credential Credential? @relation(fields: [credentialId], references: [id], onDelete: SetNull)
119
- subType String?
120
118
  userId String? @db.ObjectId
121
119
  user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
122
120
  name String?
@@ -90,7 +90,6 @@ model Credential {
90
90
  id Int @id @default(autoincrement())
91
91
  userId Int?
92
92
  user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
93
- subType String?
94
93
  authIsValid Boolean?
95
94
  externalId String?
96
95
 
@@ -113,7 +112,6 @@ model Entity {
113
112
  id Int @id @default(autoincrement())
114
113
  credentialId Int?
115
114
  credential Credential? @relation(fields: [credentialId], references: [id], onDelete: SetNull)
116
- subType String?
117
115
  userId Int?
118
116
  user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
119
117
  name String?
@@ -5,7 +5,6 @@ declare module "@friggframework/module-plugin" {
5
5
  export class Credential extends Model {
6
6
  userId: string;
7
7
  authIsValid: boolean;
8
- subType: string;
9
8
  externalId: string;
10
9
  }
11
10
 
@@ -13,7 +12,6 @@ declare module "@friggframework/module-plugin" {
13
12
 
14
13
  export class Entity extends Model {
15
14
  credentialId: string;
16
- subType: string;
17
15
  userId: string;
18
16
  name: string;
19
17
  externalId: string;