telescope-prisma-client 0.0.21 → 0.0.23

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.
package/README.md CHANGED
@@ -1,5 +1,11 @@
1
+ # Telescope Prisma Client
2
+
1
3
  This package is used to manage the postgres database and publish a package that can be used as a dependency in other projects.
2
4
 
3
- Use npm link to have updated generated types within your project.
5
+ A future improvement could be to also generate the python client.
6
+
7
+ ## Usage
8
+
9
+ Use `npm link` to have updated generated types within your project when developing locally
4
10
 
5
- `npm login` and `npm publish` to publish to npm
11
+ Use `npm login` and `npm publish` to publish to npm
package/dist/index.d.ts CHANGED
@@ -1,32 +1,35 @@
1
- import { PrismaClient } from '../generatedClient/index.d';
2
-
3
- export function createContext(ctx: any): Promise<Context>;
4
-
5
- export * from '../generatedClient/index.d';
6
-
7
- export interface Context {
8
- prisma: PrismaClient;
1
+ import { PrismaClient } from '../generatedClient/index';
2
+ export * from '../generatedClient/index';
3
+ declare const createPrismaClient: (dbUrl: string) => PrismaClient<{
4
+ datasources: {
5
+ db: {
6
+ url: string;
7
+ };
8
+ };
9
+ }, never, false, import("../generatedClient/runtime").DefaultArgs>;
10
+ export { createPrismaClient };
11
+ export interface PrismaContext {
12
+ prisma: PrismaClient;
9
13
  }
10
-
14
+ export declare const createPrismaClientWithContext: (ctx: any) => Promise<PrismaContext>;
11
15
  declare global {
12
- // eslint-disable-next-line @typescript-eslint/no-namespace
13
- namespace PrismaJson {
14
- type CountryCodes = string[][];
15
- type ExampleCompanies = {
16
- id: string;
17
- name: string;
18
- }[];
19
- type CompanySizeRange = {
20
- lower?: number;
21
- upper?: number;
22
- };
23
- type FoundedYearRange = {
24
- lower?: number;
25
- upper?: number;
26
- };
27
- type ScheduleHourlyRange = {
28
- lower: number;
29
- upper: number;
30
- };
31
- }
16
+ namespace PrismaJson {
17
+ type CountryCodes = string[][];
18
+ type ExampleCompanies = {
19
+ id: string;
20
+ name: string;
21
+ }[];
22
+ type CompanySizeRange = {
23
+ lower?: number;
24
+ upper?: number;
25
+ };
26
+ type FoundedYearRange = {
27
+ lower?: number;
28
+ upper?: number;
29
+ };
30
+ type ScheduleHourlyRange = {
31
+ lower: number;
32
+ upper: number;
33
+ };
34
+ }
32
35
  }
package/dist/index.js CHANGED
@@ -10,6 +10,20 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
25
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
26
+ };
13
27
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
28
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
29
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -47,14 +61,27 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
47
61
  }
48
62
  };
49
63
  Object.defineProperty(exports, "__esModule", { value: true });
50
- exports.createContext = void 0;
51
- var generatedClient_1 = require("../generatedClient");
52
- var prisma = new generatedClient_1.PrismaClient();
53
- var createContext = function (ctx) { return __awaiter(void 0, void 0, void 0, function () {
64
+ exports.createPrismaClientWithContext = exports.createPrismaClient = void 0;
65
+ // The idea is to simply extend the generated client
66
+ var index_1 = require("../generatedClient/index");
67
+ __exportStar(require("../generatedClient/index"), exports);
68
+ var createPrismaClient = function (dbUrl) {
69
+ return new index_1.PrismaClient({
70
+ datasources: {
71
+ db: {
72
+ url: dbUrl,
73
+ },
74
+ },
75
+ });
76
+ };
77
+ exports.createPrismaClient = createPrismaClient;
78
+ var prisma = new index_1.PrismaClient();
79
+ var createPrismaClientWithContext = function (ctx) { return __awaiter(void 0, void 0, void 0, function () {
54
80
  return __generator(this, function (_a) {
55
81
  // Skip if you are not using a serverless environment
82
+ // Based on https://isidoro-ferreiro.medium.com/share-your-prisma-client-across-projects-44d1c7aca6fd
56
83
  ctx.callbackWaitsForEmptyEventLoop = false;
57
84
  return [2 /*return*/, __assign(__assign({}, ctx), { prisma: prisma })];
58
85
  });
59
86
  }); };
60
- exports.createContext = createContext;
87
+ exports.createPrismaClientWithContext = createPrismaClientWithContext;
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "telescope-prisma-client",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {
8
- "prepare2": "npx prisma generate && tsc && cp src/index.d.ts dist/index.d.ts && cp schema.prisma dist/schema.prisma",
8
+ "prepare-deprecated": "npx prisma generate && tsc && cp src/index.d.ts dist/index.d.ts && cp schema.prisma dist/schema.prisma",
9
+ "prepublish": "npm run generate && rm -rf dist && cp -a generatedClient dist && tsc",
9
10
  "generate": "dotenv -- prisma generate",
10
- "migrate:dev": "dotenv -- prisma migrate dev"
11
+ "migrate:dev": "dotenv -- prisma migrate dev",
12
+ "test": "ts-node test.ts"
11
13
  },
12
14
  "author": "",
13
15
  "license": "ISC",
package/tsconfig.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "compilerOptions": {
3
+ "declaration": true,
4
+ "outDir": "./dist",
3
5
  "target": "es5",
4
6
  "module": "commonjs",
5
- "outDir": "./dist",
6
- "strict": true
7
+ "strict": true,
8
+ "esModuleInterop": true
7
9
  },
8
- "include": ["src"]
10
+ "include": ["src/**/*"],
11
+ "exclude": ["node_modules", "dist", "generatedClient"]
9
12
  }
@@ -1,448 +0,0 @@
1
- generator client {
2
- provider = "prisma-client-js"
3
- output = "./generatedClient"
4
- binaryTargets = ["native", "linux-musl", "linux-musl-openssl-3.0.x", "darwin"]
5
- }
6
-
7
- generator json {
8
- provider = "prisma-json-types-generator"
9
- clientOutput = "./generatedClient"
10
- }
11
-
12
- datasource db {
13
- provider = "postgresql"
14
- url = env("POSTGRES_DATABASE_URL")
15
- }
16
-
17
- model User {
18
- id String @id
19
- deleted_at DateTime?
20
- email String @unique
21
- first_name String
22
- is_nlp_icp_enabled Boolean? @default(false)
23
- last_name String
24
- onboarded_at DateTime?
25
- registered_at DateTime
26
- updated_at DateTime @updatedAt
27
- campaigns Campaign[]
28
- campaign_log_events CampaignLogEvent[]
29
- connected_mailboxes ConnectedMailbox[]
30
- ideal_customer_profiles IdealCustomerProfile[]
31
- merge_connection MergeConnection[]
32
- prospects Prospect[]
33
- prospect_interaction_events ProspectInteractionEvent[]
34
- ProspectSequenceStep ProspectSequenceStep[]
35
- recommendations Recommendation[]
36
- sequences Sequence[]
37
- SequenceStep SequenceStep[]
38
- }
39
-
40
- model MergeConnection {
41
- id String @id @default(uuid())
42
- user_id String
43
- account_token String
44
- webhook_listener_url String?
45
- crm_name String
46
- image String?
47
- image_square String?
48
- status String?
49
- crm_slug_name String
50
- linked_account_id String @unique
51
- accounts_last_sync_at DateTime?
52
- contacts_last_sync_at DateTime?
53
- leads_last_sync_at DateTime?
54
- last_merge_syncAt DateTime?
55
- deleted_at DateTime?
56
- user User @relation(fields: [user_id], references: [id])
57
- merge_crm_accounts MergeCrmAccount[]
58
- merge_crm_contacts MergeCrmContact[]
59
- merge_crm_leads MergeCrmLead[]
60
- }
61
-
62
- model MergeCrmAccount {
63
- id String @id @default(uuid())
64
- created_at DateTime @default(now())
65
- name String?
66
- description String?
67
- industry String?
68
- website String?
69
- domain String?
70
- number_of_employees Int?
71
- remote_was_deleted Boolean?
72
- merge_crm_id String @unique
73
- remote_id String
74
- telescope_user_id String
75
- linked_account_id String
76
- last_activity_at DateTime?
77
- remote_created_at DateTime?
78
- company_id String?
79
- remote_owner String?
80
- merge_connection MergeConnection @relation(fields: [linked_account_id], references: [linked_account_id])
81
- merge_crm_lead MergeCrmLead[]
82
- prospects Prospect[]
83
- recommendations Recommendation?
84
- }
85
-
86
- model MergeCrmContact {
87
- id String @id @default(uuid())
88
- created_at DateTime? @default(now())
89
- merge_crm_account_id String?
90
- remote_was_deleted Boolean?
91
- merge_crm_id String @unique
92
- remote_id String
93
- telescope_user_id String
94
- linked_account_id String
95
- last_activity_at DateTime?
96
- remote_created_at DateTime?
97
- person_id String?
98
- merge_connection MergeConnection @relation(fields: [linked_account_id], references: [linked_account_id])
99
- merge_crm_lead MergeCrmLead[]
100
- prospects Prospect[]
101
- recommendations Recommendation?
102
- }
103
-
104
- model MergeCrmLead {
105
- id String @id @default(uuid())
106
- created_at DateTime @default(now())
107
- remote_owner String?
108
- lead_source String?
109
- remote_was_deleted Boolean?
110
- merge_crm_converted_account_id String?
111
- merge_crm_id String @unique
112
- remote_id String
113
- telescope_user_id String
114
- linked_account_id String
115
- remote_created_at DateTime?
116
- person_id String?
117
- remote_updated_at DateTime?
118
- converted_date DateTime?
119
- merge_crm_converted_contact_id String?
120
- merge_connection MergeConnection @relation(fields: [linked_account_id], references: [linked_account_id])
121
- merge_crm_converted_account MergeCrmAccount? @relation(fields: [merge_crm_converted_account_id], references: [merge_crm_id])
122
- merge_crm_converted_contact MergeCrmContact? @relation(fields: [merge_crm_converted_contact_id], references: [merge_crm_id])
123
- prospects Prospect[]
124
- recommendations Recommendation?
125
- }
126
-
127
- model Campaign {
128
- id String @id @default(uuid())
129
- name String
130
- outreach_status OutreachStatus @default(DISABLED)
131
- active_icp_id String? @unique
132
- sequence_id String?
133
- owner_id String
134
- created_at DateTime @default(now())
135
- updated_at DateTime @updatedAt
136
- deleted_at DateTime?
137
- active_icp IdealCustomerProfile? @relation("activeICP", fields: [active_icp_id], references: [id])
138
- owner User @relation(fields: [owner_id], references: [id])
139
- sequence Sequence? @relation(fields: [sequence_id], references: [id])
140
- log_events CampaignLogEvent[]
141
- icps IdealCustomerProfile[] @relation("ICPs")
142
- prospects Prospect[]
143
- prospect_interaction_events ProspectInteractionEvent[]
144
- recommendations Recommendation[]
145
- }
146
-
147
- model Prospect {
148
- id String @id @default(uuid())
149
- campaign_id String
150
- company_name String
151
- email String?
152
- first_name String
153
- last_name String
154
- job_title String
155
- phone_numbers String[]
156
- person_id String
157
- company_id String
158
- recommendation_id String?
159
- merge_crm_account_id String?
160
- merge_crm_contact_id String?
161
- merge_crm_lead_id String?
162
- merge_crm_export_status MergeCrmExportStatus?
163
- first_crm_export_at DateTime?
164
- last_crm_export_at DateTime?
165
- owner_id String
166
- created_at DateTime @default(now())
167
- deleted_at DateTime?
168
- updated_at DateTime @updatedAt
169
- is_outreach_paused Boolean?
170
- campaign_log_events CampaignLogEvent[]
171
- campaign Campaign @relation(fields: [campaign_id], references: [id])
172
- merge_crm_account MergeCrmAccount? @relation(fields: [merge_crm_account_id], references: [merge_crm_id])
173
- merge_crm_contact MergeCrmContact? @relation(fields: [merge_crm_contact_id], references: [merge_crm_id])
174
- merge_crm_lead MergeCrmLead? @relation(fields: [merge_crm_lead_id], references: [merge_crm_id])
175
- owner User @relation(fields: [owner_id], references: [id])
176
- recommendation Recommendation? @relation(fields: [recommendation_id], references: [id])
177
- prospect_interaction_events ProspectInteractionEvent[]
178
- prospect_sequence_steps ProspectSequenceStep[]
179
- }
180
-
181
- model CampaignLogEvent {
182
- id String @id @default(uuid())
183
- campaign_id String
184
- type CampaignLogEventType
185
- description String?
186
- prospect_id String?
187
- thread_id String?
188
- sequence_step_id String?
189
- recommendation_id String?
190
- email_subject String?
191
- email_body String?
192
- owner_id String
193
- created_at DateTime @default(now())
194
- updated_at DateTime @updatedAt
195
- deleted_at DateTime?
196
- campaign Campaign @relation(fields: [campaign_id], references: [id])
197
- owner User @relation(fields: [owner_id], references: [id])
198
- prospect Prospect? @relation(fields: [prospect_id], references: [id])
199
- recommendation Recommendation? @relation(fields: [recommendation_id], references: [id])
200
- sequence_step SequenceStep? @relation(fields: [sequence_step_id], references: [id])
201
- }
202
-
203
- model Recommendation {
204
- id String @id @default(uuid())
205
- campaign_id String
206
- status RecommendationStatus
207
- candidate_origin String?
208
- candidate_version String?
209
- ranker_score String?
210
- person_id String
211
- person_record_id String
212
- company_id String
213
- company_record_id String
214
- icp_id String
215
- icp_match_confidence Int @default(3)
216
- merge_crm_lead_id String? @unique
217
- merge_crm_contact_id String? @unique
218
- merge_crm_account_id String? @unique
219
- owner_id String
220
- created_at DateTime @default(now())
221
- resolved_at DateTime?
222
- updated_at DateTime @updatedAt
223
- deleted_at DateTime?
224
- model_info Json?
225
- rejection_reason RecommendationRejectionReason?
226
- ranker_version Float?
227
- campaign_log_events CampaignLogEvent[]
228
- prospects Prospect[]
229
- campaign Campaign @relation(fields: [campaign_id], references: [id])
230
- icp IdealCustomerProfile @relation(fields: [icp_id], references: [id])
231
- merge_crm_account MergeCrmAccount? @relation(fields: [merge_crm_account_id], references: [id])
232
- merge_crm_contact MergeCrmContact? @relation(fields: [merge_crm_contact_id], references: [id])
233
- merge_crm_lead MergeCrmLead? @relation(fields: [merge_crm_lead_id], references: [id])
234
- owner User @relation(fields: [owner_id], references: [id])
235
- }
236
-
237
- model IdealCustomerProfile {
238
- id String @id @default(uuid())
239
- campaign_id String
240
- icp_description String?
241
- keywords String[]
242
- negative_keywords String[]
243
- job_titles String[]
244
- /// [ExampleCompanies]
245
- example_companies Json @default("[]")
246
- /// [CountryCodes]
247
- country_codes Json?
248
- /// [CountryCodes]
249
- employee_country_codes Json?
250
- industries String[]
251
- /// [CompanySizeRange]
252
- company_size_range Json?
253
- /// [FoundedYearRange]
254
- founded_year_range Json?
255
- company_types String[]
256
- require_email Boolean?
257
- owner_id String
258
- created_at DateTime @default(now())
259
- updated_at DateTime @updatedAt
260
- deleted_at DateTime?
261
- campaign_active_icp Campaign? @relation("activeICP")
262
- campaign Campaign @relation("ICPs", fields: [campaign_id], references: [id])
263
- owner User @relation(fields: [owner_id], references: [id])
264
- recommendations Recommendation[]
265
- }
266
-
267
- model ConnectedMailbox {
268
- id String @id @default(uuid())
269
- status ConnectedMailboxStatus
270
- type ConnectedMailboxType
271
- tokens Json
272
- owner_id String
273
- created_at DateTime @default(now())
274
- updated_at DateTime @updatedAt
275
- deleted_at DateTime?
276
- email String
277
- email_provider_user_id String?
278
- mailbox_user_id String?
279
- max_emails_per_day Int?
280
- max_emails_per_hour Int?
281
- owner User @relation(fields: [owner_id], references: [id])
282
- }
283
-
284
- model Sequence {
285
- id String @id @default(uuid())
286
- steps_ids String[]
287
- owner_id String
288
- created_at DateTime @default(now())
289
- updated_at DateTime @updatedAt
290
- deleted_at DateTime?
291
- iana_timezone_name String
292
- /// [ScheduleHourlyRange]
293
- schedule_hourly_range Json
294
- campaigns Campaign[]
295
- owner User @relation(fields: [owner_id], references: [id])
296
- steps SequenceStep[]
297
- }
298
-
299
- model SequenceStep {
300
- id String @id @default(uuid())
301
- sequence_id String
302
- type SequenceStepType
303
- condition SequenceStepCondition?
304
- seconds_from_previous_step Int
305
- email_subject String?
306
- email_body String?
307
- linkedin_message String?
308
- created_at DateTime @default(now())
309
- updated_at DateTime @updatedAt
310
- deleted_at DateTime?
311
- owner_id String
312
- campaign_log_events CampaignLogEvent[]
313
- prospect_sequence_steps ProspectSequenceStep[]
314
- owner User @relation(fields: [owner_id], references: [id])
315
- sequence Sequence @relation(fields: [sequence_id], references: [id])
316
- }
317
-
318
- model ProspectSequenceStep {
319
- id String @id @default(uuid())
320
- prospect_id String
321
- sequence_step_id String
322
- status ProspectSequenceStepStatus?
323
- dispatched_at DateTime?
324
- confirmed_at DateTime?
325
- failed_at DateTime?
326
- thread_id String?
327
- message_id String?
328
- created_at DateTime @default(now())
329
- updated_at DateTime @updatedAt
330
- email_body String?
331
- email_subject String?
332
- executed_with_mailbox_id String?
333
- linkedin_message String?
334
- owner_id String
335
- scheduled_at DateTime?
336
- prospect_interaction_events_responses ProspectInteractionEvent[]
337
- owner User @relation(fields: [owner_id], references: [id])
338
- prospect Prospect @relation(fields: [prospect_id], references: [id])
339
- sequence_step SequenceStep @relation(fields: [sequence_step_id], references: [id])
340
- }
341
-
342
- model ProspectInteractionEvent {
343
- id String @id @default(uuid())
344
- campaign_id String
345
- prospect_id String
346
- in_resp_to_prospect_sequence_step_id String
347
- type ProspectInteractionEventType
348
- thread_id String?
349
- message_id String?
350
- sent_at DateTime
351
- is_auto_reply Boolean?
352
- text_reply String?
353
- prospect_interest Float?
354
- owner_id String
355
- created_at DateTime @default(now())
356
- updated_at DateTime @updatedAt
357
- interest_analysed_at DateTime?
358
- campaign Campaign @relation(fields: [campaign_id], references: [id])
359
- in_resp_to_prospect_sequence_step ProspectSequenceStep @relation(fields: [in_resp_to_prospect_sequence_step_id], references: [id])
360
- owner User @relation(fields: [owner_id], references: [id])
361
- prospect Prospect @relation(fields: [prospect_id], references: [id])
362
- }
363
-
364
- enum MergeCrmExportStatus {
365
- SUCCESS
366
- FAILED
367
- }
368
-
369
- enum OutreachStatus {
370
- RUNNING
371
- PAUSED
372
- DISABLED
373
- }
374
-
375
- enum CampaignLogEventType {
376
- CREATED_CAMPAIGN
377
- STARTED_CAMPAIGN
378
- PAUSED_CAMPAIGN
379
- EMAIL_SENT
380
- EMAIL_SEND_FAILURE
381
- FUNNEL_REPLENISH_ACTIVATED
382
- FUNNEL_REPLENISH_DEACTIVATED
383
- REPLENISHED_FUNNEL
384
- ADDED_PROSPECTS
385
- REMOVED_PROSPECTS
386
- EDITED_EMAIL_STEP
387
- DELETED_EMAIL_STEP
388
- ADDED_EMAIL_STEP
389
- ADDED_DELAY_AFTER
390
- EDITED_DELAY_AFTER
391
- ACCEPTED_RECOMMENDATION
392
- REJECTED_RECOMMENDATION
393
- }
394
-
395
- enum RecommendationStatus {
396
- ACCEPTED
397
- REJECTED
398
- PENDING
399
- }
400
-
401
- enum RecommendationRejectionReason {
402
- NOT_RELEVANT
403
- WRONG_POSITION_RIGHT_COMPANY
404
- RIGHT_POSITION_WRONG_COMPANY
405
- EXISTING_CUSTOMER
406
- ALREADY_CONTACTED
407
- OTHER
408
- DISCARDED
409
- }
410
-
411
- enum ConnectedMailboxStatus {
412
- CONNECTED
413
- DISCONNECTED
414
- }
415
-
416
- enum ConnectedMailboxType {
417
- GMAIL
418
- OUTLOOK
419
- }
420
-
421
- enum SequenceStepType {
422
- EMAIL
423
- LINKEDIN_CONNECTION
424
- LINKEDIN_MESSAGE
425
- }
426
-
427
- enum SequenceStepCondition {
428
- LINKEDIN_ACCEPTED_CONNECTION
429
- LINKEDIN_CONNECTION_NOT_ACCEPTED
430
- }
431
-
432
- enum ProspectSequenceStepStatus {
433
- PENDING
434
- COMPLETED
435
- ERROR
436
- SCHEDULED
437
- }
438
-
439
- enum ProspectInteractionEventType {
440
- POSITIVE_EMAIL_REPLY
441
- NEGATIVE_EMAIL_REPLY
442
- EMAIL_REPLY_UNKNOWN_SENTIMENT
443
- EMAIL_BOUNCE_NOTIFICATION
444
- EMAIL_OOO_NOTIFICATION
445
- LINKEDIN_CONNECTION_ACCEPTED
446
- POSITIVE_LINKEDIN_REPLY
447
- NEGATIVE_LINKEDIN_REPLY
448
- }