@adaptware/eagles-db 0.5.20 → 0.5.22
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/client/edge.js +29 -96
- package/client/index-browser.js +18 -85
- package/client/index.d.ts +757 -5626
- package/client/index.js +29 -96
- package/client/package.json +1 -1
- package/client/schema.prisma +62 -156
- package/client/wasm.js +29 -96
- package/package.json +1 -1
- package/prisma/.DS_Store +0 -0
- package/prisma/schema/activityEvent.prisma +8 -4
- package/prisma/schema/applications.prisma +27 -3
- package/prisma/schema/integration.prisma +1 -0
- package/prisma/schema/migrations/.DS_Store +0 -0
- package/prisma/schema/migrations/20260610100000_add_communication/migration.sql +131 -0
- package/prisma/schema/migrations/20260610170000_add_communication_application_scope/migration.sql +45 -0
- package/prisma/schema/migrations/20260718120000_add_hiring_plan/migration.sql +208 -0
- package/prisma/schema/migrations/20260718140000_hiring_plan_assumptions/migration.sql +2 -0
- package/prisma/schema/migrations/20260807140000_simplify_offer_status_model/migration.sql +109 -0
- package/prisma/schema/offer.prisma +9 -132
- package/client/libquery_engine-darwin.dylib.node +0 -0
- package/prisma/migrations/20260519120000_migrate_shortlisted_to_selected/migration.sql +0 -2
- package/prisma/schema/.DS_Store +0 -0
- package/prisma/schema/migrations/20260519120000_add_analytics_schema/migration.sql +0 -84
- package/prisma/schema/migrations/20260625120000_add_interviewer_analytics/migration.sql +0 -26
- package/prisma/schema/migrations/20260629120000_add_user_lifecycle_activity_events/migration.sql +0 -13
- package/prisma/schema/migrations/20260629140000_drop_organisation_org_code/migration.sql +0 -2
- package/prisma/schema/migrations/20260629160000_employee_codes_dual_interviewer_analytics/migration.sql +0 -87
- package/prisma/schema/migrations/20260630120000_add_application_sources/migration.sql +0 -38
- package/prisma/schema/migrations/20260701120000_add_source_effectiveness_analytics/migration.sql +0 -40
- package/prisma/schema/migrations/20260702120000_add_analytics_daily_tables/migration.sql +0 -232
- package/prisma/schema/migrations/20260716120000_evaluation_category_four_values/migration.sql +0 -204
- package/prisma/schema/migrations/20260716130000_application_withdrawn_analytics/migration.sql +0 -31
- package/prisma/schema/migrations/20260804120000_contact_us_optional_website_subject/migration.sql +0 -3
package/client/package.json
CHANGED
package/client/schema.prisma
CHANGED
|
@@ -139,16 +139,20 @@ enum ActivityEventType {
|
|
|
139
139
|
|
|
140
140
|
/// Offer workflow — one semantic event per business moment.
|
|
141
141
|
OFFER_CREATED
|
|
142
|
+
OFFER_GENERATED
|
|
142
143
|
OFFER_SENT
|
|
144
|
+
OFFER_REVISED
|
|
145
|
+
OFFER_ACCEPTED
|
|
146
|
+
OFFER_DECLINED
|
|
147
|
+
OFFER_WITHDRAWN
|
|
148
|
+
OFFER_JOINED
|
|
149
|
+
OFFER_NO_SHOW
|
|
150
|
+
/// Legacy values kept for historic ActivityEvent rows; not emitted by current flow.
|
|
143
151
|
OFFER_VIEWED
|
|
144
152
|
OFFER_CHANGE_REQUESTED
|
|
145
153
|
OFFER_CHANGE_UNDER_REVIEW
|
|
146
154
|
OFFER_COUNTER_SENT
|
|
147
|
-
OFFER_ACCEPTED
|
|
148
|
-
OFFER_DECLINED
|
|
149
|
-
OFFER_WITHDRAWN
|
|
150
155
|
OFFER_EXPIRED
|
|
151
|
-
OFFER_JOINED
|
|
152
156
|
OFFER_CHANGE_REQUEST_REJECTED
|
|
153
157
|
OFFER_CHANGE_REQUEST_WITHDRAWN
|
|
154
158
|
|
|
@@ -376,7 +380,7 @@ enum ApplicationStatus {
|
|
|
376
380
|
IN_PROGRESS
|
|
377
381
|
SELECTED
|
|
378
382
|
OFFER
|
|
379
|
-
|
|
383
|
+
JOINED
|
|
380
384
|
SHORTLISTED
|
|
381
385
|
REJECTED
|
|
382
386
|
ON_HOLD
|
|
@@ -385,9 +389,32 @@ enum ApplicationStatus {
|
|
|
385
389
|
@@schema("public")
|
|
386
390
|
}
|
|
387
391
|
|
|
392
|
+
/// Fine-grained state within ApplicationStatus.OFFER. Owned by Application —
|
|
393
|
+
/// Offer table holds terms/letters/audit only, no lifecycle enum of its own.
|
|
394
|
+
enum ApplicationOfferSubstatus {
|
|
395
|
+
/// Offer row created with terms, no letter generated yet.
|
|
396
|
+
PREPARING
|
|
397
|
+
/// Letter DOCX generated and downloaded — awaiting manual send outside TreadSpace.
|
|
398
|
+
GENERATED
|
|
399
|
+
/// Staff manually marked the letter as sent to the candidate.
|
|
400
|
+
SENT
|
|
401
|
+
/// Revising after SENT — current letter is superseded, no active letter until next Generate.
|
|
402
|
+
NEGOTIATING
|
|
403
|
+
/// Candidate accepted (staff-recorded, no candidate portal).
|
|
404
|
+
ACCEPTED
|
|
405
|
+
/// Candidate declined — Application.status also flips to REJECTED.
|
|
406
|
+
DECLINED
|
|
407
|
+
/// Offer withdrawn by staff — Application.status also flips to REJECTED.
|
|
408
|
+
WITHDRAWN
|
|
409
|
+
/// Candidate accepted but did not join — Application.status also flips to REJECTED.
|
|
410
|
+
NO_SHOW
|
|
411
|
+
|
|
412
|
+
@@schema("public")
|
|
413
|
+
}
|
|
414
|
+
|
|
388
415
|
model Application {
|
|
389
416
|
/// Primary key
|
|
390
|
-
id String
|
|
417
|
+
id String @id @default(uuid())
|
|
391
418
|
/// Foreign keys
|
|
392
419
|
organisation_id String
|
|
393
420
|
candidate_id String
|
|
@@ -398,13 +425,13 @@ model Application {
|
|
|
398
425
|
source_id String?
|
|
399
426
|
/// Data fields
|
|
400
427
|
fit_check_score Float?
|
|
401
|
-
applied_at DateTime
|
|
402
|
-
round_no Int
|
|
403
|
-
is_jaf_completed Boolean
|
|
404
|
-
proceed_to_next_round Boolean?
|
|
428
|
+
applied_at DateTime @default(now())
|
|
429
|
+
round_no Int @default(0)
|
|
430
|
+
is_jaf_completed Boolean @default(false)
|
|
431
|
+
proceed_to_next_round Boolean? @default(false)
|
|
405
432
|
evaluationComment String?
|
|
406
433
|
/// Candidate flag (orthogonal to ApplicationStatus). Latest actor/comment only.
|
|
407
|
-
is_flagged Boolean
|
|
434
|
+
is_flagged Boolean @default(false)
|
|
408
435
|
flag_comment String?
|
|
409
436
|
flagged_at DateTime?
|
|
410
437
|
flagged_by String?
|
|
@@ -412,24 +439,24 @@ model Application {
|
|
|
412
439
|
unflagged_at DateTime?
|
|
413
440
|
unflagged_by String?
|
|
414
441
|
fit_check_status FitCheckStatus?
|
|
415
|
-
status ApplicationStatus
|
|
416
|
-
///
|
|
417
|
-
|
|
442
|
+
status ApplicationStatus @default(PENDING)
|
|
443
|
+
/// Fine-grained offer-stage state. Meaningful only when status = OFFER (or was OFFER for a terminal-substatus that flipped to REJECTED / JOINED).
|
|
444
|
+
offer_substatus ApplicationOfferSubstatus?
|
|
418
445
|
/// Audit fields
|
|
419
|
-
created_at DateTime
|
|
420
|
-
updated_at DateTime
|
|
446
|
+
created_at DateTime @default(now())
|
|
447
|
+
updated_at DateTime @updatedAt
|
|
421
448
|
created_by String
|
|
422
449
|
updated_by String
|
|
423
|
-
is_active Boolean
|
|
450
|
+
is_active Boolean @default(true)
|
|
424
451
|
/// Relations
|
|
425
|
-
evaluation_plan EvaluationPlan?
|
|
426
|
-
candidate User
|
|
427
|
-
organisation Organisation
|
|
428
|
-
resume Resume
|
|
429
|
-
job_description JobDescription
|
|
452
|
+
evaluation_plan EvaluationPlan? @relation(fields: [evaluation_plan_id], references: [id])
|
|
453
|
+
candidate User @relation(fields: [candidate_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
454
|
+
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
455
|
+
resume Resume @relation(fields: [resume_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
456
|
+
job_description JobDescription @relation(fields: [job_description_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
430
457
|
fit_check FitCheck?
|
|
431
|
-
recruiter User?
|
|
432
|
-
source Source?
|
|
458
|
+
recruiter User? @relation("ApplicationRecruiter", fields: [recruiter_id], references: [id])
|
|
459
|
+
source Source? @relation(fields: [source_id], references: [id], onDelete: SetNull)
|
|
433
460
|
interviews Interview[]
|
|
434
461
|
assignments Assignment[]
|
|
435
462
|
ongoing_evaluations OngoingEvaluation[]
|
|
@@ -448,6 +475,7 @@ model Application {
|
|
|
448
475
|
@@index([job_description_id, is_flagged])
|
|
449
476
|
@@index([organisation_id, is_active, status])
|
|
450
477
|
@@index([job_description_id, is_active, status])
|
|
478
|
+
@@index([organisation_id, offer_substatus])
|
|
451
479
|
@@schema("public")
|
|
452
480
|
}
|
|
453
481
|
|
|
@@ -1794,6 +1822,7 @@ model PlannedCandidate {
|
|
|
1794
1822
|
enum IntegrationProvider {
|
|
1795
1823
|
NAUKRI
|
|
1796
1824
|
ZOHO_RECRUIT
|
|
1825
|
+
ZOHO_SIGN
|
|
1797
1826
|
LINKEDIN
|
|
1798
1827
|
GOOGLE
|
|
1799
1828
|
MICROSOFT
|
|
@@ -2736,48 +2765,11 @@ model Notes {
|
|
|
2736
2765
|
@@schema("public")
|
|
2737
2766
|
}
|
|
2738
2767
|
|
|
2739
|
-
/// Recruiter/candidate-visible offer lifecycle under Application SELECTED.
|
|
2740
|
-
/// Distinct from OfferChangeRequest.status (per-ticket workflow).
|
|
2741
|
-
enum OfferStatus {
|
|
2742
|
-
/// Offer in flight — see OfferSubstatus for detail.
|
|
2743
|
-
OPEN
|
|
2744
|
-
ACCEPTED
|
|
2745
|
-
DECLINED
|
|
2746
|
-
EXPIRED
|
|
2747
|
-
WITHDRAWN
|
|
2748
|
-
JOINED
|
|
2749
|
-
NO_SHOW
|
|
2750
|
-
|
|
2751
|
-
@@schema("public")
|
|
2752
|
-
}
|
|
2753
|
-
|
|
2754
|
-
/// In-flight offer detail — only meaningful when Offer.status = OPEN.
|
|
2755
|
-
enum OfferSubstatus {
|
|
2756
|
-
/// Draft offer created; no letter sent yet.
|
|
2757
|
-
OFFER_CREATED
|
|
2758
|
-
/// Awaiting executive approval before send.
|
|
2759
|
-
PENDING_APPROVAL
|
|
2760
|
-
/// First letter issued to candidate.
|
|
2761
|
-
OFFER_SENT
|
|
2762
|
-
/// Candidate opened the current letter.
|
|
2763
|
-
VIEWED
|
|
2764
|
-
/// Candidate submitted a change request (ticket OPEN).
|
|
2765
|
-
CHANGE_REQUESTED
|
|
2766
|
-
/// Staff marked change request IN_PROGRESS; HR actively working.
|
|
2767
|
-
CHANGE_UNDER_REVIEW
|
|
2768
|
-
/// Revised letter sent after negotiation (counter-offer).
|
|
2769
|
-
COUNTER_OFFER_SENT
|
|
2770
|
-
|
|
2771
|
-
@@schema("public")
|
|
2772
|
-
}
|
|
2773
|
-
|
|
2774
2768
|
enum OfferLetterStatus {
|
|
2775
2769
|
/// Current issued letter for the offer (at most one per offer; app-enforced).
|
|
2776
2770
|
ACTIVE
|
|
2777
2771
|
/// Replaced by a newer version; PDF remains immutable.
|
|
2778
2772
|
SUPERSEDED
|
|
2779
|
-
/// Invalidated before meaningful candidate action (e.g. draft discarded).
|
|
2780
|
-
VOID
|
|
2781
2773
|
|
|
2782
2774
|
@@schema("public")
|
|
2783
2775
|
}
|
|
@@ -2813,17 +2805,6 @@ enum OfferLetterTemplateScope {
|
|
|
2813
2805
|
@@schema("public")
|
|
2814
2806
|
}
|
|
2815
2807
|
|
|
2816
|
-
enum OfferChangeCategory {
|
|
2817
|
-
BUDGET
|
|
2818
|
-
BENEFITS
|
|
2819
|
-
JOINING_DATE
|
|
2820
|
-
ROLE_TITLE
|
|
2821
|
-
LOCATION
|
|
2822
|
-
OTHER
|
|
2823
|
-
|
|
2824
|
-
@@schema("public")
|
|
2825
|
-
}
|
|
2826
|
-
|
|
2827
2808
|
enum WorkMode {
|
|
2828
2809
|
REMOTE
|
|
2829
2810
|
OFFICE
|
|
@@ -2832,27 +2813,6 @@ enum WorkMode {
|
|
|
2832
2813
|
@@schema("public")
|
|
2833
2814
|
}
|
|
2834
2815
|
|
|
2835
|
-
/// Per change-request ticket workflow (distinct from Offer.substatus).
|
|
2836
|
-
enum OfferChangeRequestStatus {
|
|
2837
|
-
OPEN
|
|
2838
|
-
IN_PROGRESS
|
|
2839
|
-
/// Staff addressed via revised letter or explicit resolution.
|
|
2840
|
-
RESOLVED
|
|
2841
|
-
REJECTED
|
|
2842
|
-
WITHDRAWN
|
|
2843
|
-
EXPIRED
|
|
2844
|
-
|
|
2845
|
-
@@schema("public")
|
|
2846
|
-
}
|
|
2847
|
-
|
|
2848
|
-
enum OfferApprovalStatus {
|
|
2849
|
-
PENDING
|
|
2850
|
-
APPROVED
|
|
2851
|
-
REJECTED
|
|
2852
|
-
|
|
2853
|
-
@@schema("public")
|
|
2854
|
-
}
|
|
2855
|
-
|
|
2856
2816
|
model OfferLetterTemplate {
|
|
2857
2817
|
id String @id @default(uuid())
|
|
2858
2818
|
organisation_id String
|
|
@@ -2892,6 +2852,8 @@ model OfferLetterTemplate {
|
|
|
2892
2852
|
@@schema("public")
|
|
2893
2853
|
}
|
|
2894
2854
|
|
|
2855
|
+
/// Offer is a data container: terms, letter versions, timeline audit.
|
|
2856
|
+
/// Lifecycle lives on Application.offer_substatus — no status enum here.
|
|
2895
2857
|
model Offer {
|
|
2896
2858
|
id String @id @default(uuid())
|
|
2897
2859
|
application_id String @unique
|
|
@@ -2899,26 +2861,21 @@ model Offer {
|
|
|
2899
2861
|
candidate_id String
|
|
2900
2862
|
job_description_id String
|
|
2901
2863
|
template_id String?
|
|
2902
|
-
status OfferStatus @default(OPEN)
|
|
2903
|
-
substatus OfferSubstatus?
|
|
2904
2864
|
letter_version_count Int @default(0)
|
|
2905
|
-
|
|
2906
|
-
/// FK to latest ACTIVE letter; avoids MAX(version) on every read.
|
|
2865
|
+
/// FK to latest ACTIVE letter; null when NEGOTIATING (v(N) superseded, v(N+1) not generated yet) or PREPARING (no letter yet).
|
|
2907
2866
|
current_offer_letter_id String?
|
|
2908
2867
|
/// Merge payload: CTC, joining date, role title, location, etc.
|
|
2909
2868
|
/// Single structured source of truth — no denormalized term columns.
|
|
2910
2869
|
terms Json @default("{}")
|
|
2911
2870
|
/// Draft offer-scoped HTML snapshot (never mutates OfferLetterTemplate).
|
|
2912
2871
|
draft_edited_html_document_id String?
|
|
2913
|
-
|
|
2914
|
-
/// First letter sent (reporting SLA).
|
|
2872
|
+
/// Staff clicked "Mark as sent" (letter is out with candidate).
|
|
2915
2873
|
sent_at DateTime?
|
|
2916
|
-
/// First accept / decline
|
|
2874
|
+
/// First accept / decline recorded on the Offer.
|
|
2917
2875
|
responded_at DateTime?
|
|
2918
2876
|
accepted_at DateTime?
|
|
2919
2877
|
declined_at DateTime?
|
|
2920
2878
|
withdrawn_at DateTime?
|
|
2921
|
-
expired_at DateTime?
|
|
2922
2879
|
joined_at DateTime?
|
|
2923
2880
|
no_show_at DateTime?
|
|
2924
2881
|
withdraw_reason OfferWithdrawReason?
|
|
@@ -2939,17 +2896,10 @@ model Offer {
|
|
|
2939
2896
|
draft_edited_html_document Document? @relation("OfferDraftEditedHtml", fields: [draft_edited_html_document_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
|
|
2940
2897
|
current_offer_letter OfferLetter? @relation("OfferCurrentLetter", fields: [current_offer_letter_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
|
|
2941
2898
|
letters OfferLetter[] @relation("OfferLetters")
|
|
2942
|
-
change_requests OfferChangeRequest[]
|
|
2943
|
-
approvals OfferApproval[]
|
|
2944
2899
|
|
|
2945
2900
|
@@index([organisation_id])
|
|
2946
|
-
@@index([organisation_id, status])
|
|
2947
|
-
@@index([organisation_id, substatus])
|
|
2948
2901
|
@@index([candidate_id])
|
|
2949
2902
|
@@index([job_description_id])
|
|
2950
|
-
@@index([status])
|
|
2951
|
-
@@index([substatus])
|
|
2952
|
-
@@index([expires_at])
|
|
2953
2903
|
@@index([current_offer_letter_id])
|
|
2954
2904
|
@@index([draft_edited_html_document_id])
|
|
2955
2905
|
@@schema("public")
|
|
@@ -2968,9 +2918,10 @@ model OfferLetter {
|
|
|
2968
2918
|
template_document_id String?
|
|
2969
2919
|
/// Snapshot of OfferLetterTemplate.version at render time
|
|
2970
2920
|
template_version Int?
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2921
|
+
/// When staff clicked "Generate letter" — the PDF was rendered and the DOCX downloaded.
|
|
2922
|
+
generated_at DateTime?
|
|
2923
|
+
/// Free-form note attached at generation time (e.g. "Revised for updated CTC").
|
|
2924
|
+
generation_note String?
|
|
2974
2925
|
/// Soft-delete only — never infer supersession from is_active.
|
|
2975
2926
|
is_active Boolean @default(true)
|
|
2976
2927
|
created_by String
|
|
@@ -2983,7 +2934,6 @@ model OfferLetter {
|
|
|
2983
2934
|
document Document @relation("OfferLetterPdf", fields: [document_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2984
2935
|
template OfferLetterTemplate? @relation(fields: [template_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
|
|
2985
2936
|
template_document Document? @relation("OfferLetterTemplateSnapshot", fields: [template_document_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
|
|
2986
|
-
change_requests OfferChangeRequest[]
|
|
2987
2937
|
|
|
2988
2938
|
@@unique([offer_id, version])
|
|
2989
2939
|
@@index([offer_id])
|
|
@@ -2992,50 +2942,6 @@ model OfferLetter {
|
|
|
2992
2942
|
@@schema("public")
|
|
2993
2943
|
}
|
|
2994
2944
|
|
|
2995
|
-
model OfferChangeRequest {
|
|
2996
|
-
id String @id @default(uuid())
|
|
2997
|
-
offer_id String
|
|
2998
|
-
offer_letter_id String
|
|
2999
|
-
categories OfferChangeCategory[]
|
|
3000
|
-
note String?
|
|
3001
|
-
/// Structured payload keyed by category (e.g. BUDGET.expectedCtc)
|
|
3002
|
-
details Json?
|
|
3003
|
-
/// Staff note when rejecting (not shown to candidate)
|
|
3004
|
-
hr_note String?
|
|
3005
|
-
status OfferChangeRequestStatus @default(OPEN)
|
|
3006
|
-
resolved_at DateTime?
|
|
3007
|
-
created_by String
|
|
3008
|
-
updated_by String
|
|
3009
|
-
created_at DateTime @default(now())
|
|
3010
|
-
updated_at DateTime @updatedAt
|
|
3011
|
-
|
|
3012
|
-
offer Offer @relation(fields: [offer_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
3013
|
-
offer_letter OfferLetter @relation(fields: [offer_letter_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
3014
|
-
|
|
3015
|
-
@@index([offer_id, status])
|
|
3016
|
-
@@index([offer_letter_id])
|
|
3017
|
-
@@schema("public")
|
|
3018
|
-
}
|
|
3019
|
-
|
|
3020
|
-
model OfferApproval {
|
|
3021
|
-
id String @id @default(uuid())
|
|
3022
|
-
offer_id String
|
|
3023
|
-
status OfferApprovalStatus @default(PENDING)
|
|
3024
|
-
note String?
|
|
3025
|
-
decided_at DateTime?
|
|
3026
|
-
decided_by String?
|
|
3027
|
-
created_by String
|
|
3028
|
-
updated_by String
|
|
3029
|
-
created_at DateTime @default(now())
|
|
3030
|
-
updated_at DateTime @updatedAt
|
|
3031
|
-
|
|
3032
|
-
offer Offer @relation(fields: [offer_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
3033
|
-
|
|
3034
|
-
@@index([offer_id, status])
|
|
3035
|
-
@@index([offer_id, created_at])
|
|
3036
|
-
@@schema("public")
|
|
3037
|
-
}
|
|
3038
|
-
|
|
3039
2945
|
enum OngoingEvaluationState {
|
|
3040
2946
|
NOT_STARTED
|
|
3041
2947
|
IN_PROGRESS
|