telescope-prisma-client 0.0.195 → 0.0.196
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/USEFUL_QUERIES.md +49 -0
- package/dist/generatedClient/default.js +3 -0
- package/dist/generatedClient/edge.js +16 -12
- package/dist/generatedClient/index-browser.js +10 -6
- package/dist/generatedClient/index.d.ts +187 -46
- package/dist/generatedClient/index.js +16 -12
- package/dist/generatedClient/libquery_engine-darwin-arm64.dylib.node +0 -0
- package/dist/generatedClient/libquery_engine-darwin.dylib.node +0 -0
- package/dist/generatedClient/libquery_engine-debian-openssl-3.0.x.so.node +0 -0
- package/dist/generatedClient/libquery_engine-linux-musl-openssl-3.0.x.so.node +0 -0
- package/dist/generatedClient/libquery_engine-linux-musl.so.node +0 -0
- package/dist/generatedClient/libquery_engine-rhel-openssl-1.0.x.so.node +0 -0
- package/dist/generatedClient/package.json +53 -10
- package/dist/generatedClient/runtime/edge-esm.js +21 -18
- package/dist/generatedClient/runtime/edge.js +21 -18
- package/dist/generatedClient/runtime/index-browser.d.ts +3 -0
- package/dist/generatedClient/runtime/index-browser.js +4 -1
- package/dist/generatedClient/runtime/library.d.ts +494 -314
- package/dist/generatedClient/runtime/library.js +68 -65
- package/dist/generatedClient/runtime/react-native.js +28 -25
- package/dist/generatedClient/schema.prisma +5 -0
- package/dist/generatedClient/wasm.js +10 -6
- package/dist/libquery_engine-darwin-arm64.dylib.node +0 -0
- package/dist/libquery_engine-darwin.dylib.node +0 -0
- package/dist/libquery_engine-debian-openssl-3.0.x.so.node +0 -0
- package/dist/libquery_engine-linux-musl-openssl-3.0.x.so.node +0 -0
- package/dist/libquery_engine-linux-musl.so.node +0 -0
- package/dist/libquery_engine-rhel-openssl-1.0.x.so.node +0 -0
- package/dist/schema.prisma +5 -0
- package/package.json +3 -3
- package/schema.prisma +5 -0
- package/dist/generatedClient/runtime/wasm.js +0 -32
package/USEFUL_QUERIES.md
CHANGED
|
@@ -12,3 +12,52 @@ WHERE p.created_at >= NOW() - INTERVAL '12 months'
|
|
|
12
12
|
AND COALESCE(p.email_verification_status, 'UNVERIFIED') != 'VALID'
|
|
13
13
|
AND p.deleted_at IS NULL and p.owner_id = '<user_id>'
|
|
14
14
|
```
|
|
15
|
+
|
|
16
|
+
## Count prospect sequence steps by hour
|
|
17
|
+
|
|
18
|
+
```sql
|
|
19
|
+
WITH prospect_steps_with_hour AS (
|
|
20
|
+
SELECT
|
|
21
|
+
id,
|
|
22
|
+
status,
|
|
23
|
+
CASE
|
|
24
|
+
WHEN status = 'SCHEDULED' AND
|
|
25
|
+
scheduled_at IS NOT NULL THEN
|
|
26
|
+
DATE_TRUNC('hour', scheduled_at)
|
|
27
|
+
WHEN status = 'COMPLETED' AND
|
|
28
|
+
confirmed_at IS NOT NULL THEN
|
|
29
|
+
DATE_TRUNC('hour', confirmed_at)
|
|
30
|
+
WHEN status = 'ERROR' AND failed_at IS
|
|
31
|
+
NOT NULL THEN
|
|
32
|
+
DATE_TRUNC('hour', failed_at)
|
|
33
|
+
ELSE NULL
|
|
34
|
+
END AS hour_bucket
|
|
35
|
+
FROM "ProspectSequenceStep"
|
|
36
|
+
WHERE status IN ('SCHEDULED', 'COMPLETED',
|
|
37
|
+
'ERROR')
|
|
38
|
+
AND (
|
|
39
|
+
(status = 'SCHEDULED' AND
|
|
40
|
+
scheduled_at >= NOW() - INTERVAL '7 days')
|
|
41
|
+
OR
|
|
42
|
+
(status = 'COMPLETED' AND confirmed_at
|
|
43
|
+
>= NOW() - INTERVAL '7 days') OR
|
|
44
|
+
(status = 'ERROR' AND failed_at >=
|
|
45
|
+
NOW() - INTERVAL '7 days')
|
|
46
|
+
)
|
|
47
|
+
)
|
|
48
|
+
SELECT
|
|
49
|
+
hour_bucket,
|
|
50
|
+
COUNT(CASE WHEN status = 'SCHEDULED' THEN
|
|
51
|
+
1 END) as scheduled_count,
|
|
52
|
+
COUNT(CASE WHEN status = 'COMPLETED' THEN
|
|
53
|
+
1 END) as completed_count,
|
|
54
|
+
COUNT(CASE WHEN status = 'ERROR' THEN 1
|
|
55
|
+
END) as failed_count,
|
|
56
|
+
COUNT(*) as total_count
|
|
57
|
+
FROM prospect_steps_with_hour
|
|
58
|
+
WHERE hour_bucket IS NOT NULL
|
|
59
|
+
AND hour_bucket >= NOW() - INTERVAL '7
|
|
60
|
+
days'
|
|
61
|
+
GROUP BY hour_bucket
|
|
62
|
+
ORDER BY hour_bucket DESC;
|
|
63
|
+
```
|