@adaptware/eagles-db 0.4.18 → 0.4.21

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 (24) hide show
  1. package/README.md +9 -4
  2. package/client/edge.js +10 -6
  3. package/client/index-browser.js +3 -0
  4. package/client/index.d.ts +216 -1
  5. package/client/index.js +10 -6
  6. package/client/package.json +1 -1
  7. package/client/schema.prisma +5 -0
  8. package/client/wasm.js +3 -0
  9. package/package.json +1 -1
  10. package/prisma/schema/applications.prisma +34 -33
  11. package/prisma/schema/interview.prisma +4 -0
  12. package/prisma/schema/migrations/20260522120000_ongoing_evaluation_record_kind/migration.sql +25 -0
  13. package/prisma/schema/migrations/20260523120000_replace_record_kind_with_is_committed/migration.sql +24 -0
  14. package/prisma/schema/migrations/20260528120000_drop_job_description_recommendation_config/migration.sql +2 -0
  15. package/prisma/.DS_Store +0 -0
  16. package/prisma/schema/migrations/20260519120000_interview_deadline/migration.sql +0 -2
  17. package/prisma/schema/migrations/20260520120000_interview_duration_drop_deadline/migration.sql +0 -30
  18. package/prisma/schema/migrations/20260602120000_resume_file_hash_drop_unique/migration.sql +0 -2
  19. package/prisma/schema/migrations/20260603120000_job_application_field_is_mandatory/migration.sql +0 -2
  20. package/prisma/schema/migrations/20260604120000_job_application_response_updated_by_organisation/migration.sql +0 -2
  21. package/prisma/schema/migrations/20260605120000_drop_document_application_id/migration.sql +0 -3
  22. package/prisma/schema/migrations/20260610120000_jaf_template_model/migration.sql +0 -70
  23. package/prisma/schema/migrations/20260610130000_assignment_document_fks/migration.sql +0 -15
  24. package/prisma/schema/migrations/20260610140000_jaf_draft_activation/migration.sql +0 -12
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "prisma-client-3d70badd60095a1c4e09c64ac9eab10259b0340113526173ec137100d1ac59e3",
2
+ "name": "prisma-client-21eaf0bc9a1622e21269ed75e52a7bd080767d8d3a6fa5ebe712d4469a450f69",
3
3
  "main": "index.js",
4
4
  "types": "index.d.ts",
5
5
  "browser": "index-browser.js",
@@ -108,6 +108,7 @@ enum ApplicationStatus {
108
108
  PENDING
109
109
  IN_PROGRESS
110
110
  SHORTLISTED
111
+ SELECTED
111
112
  REJECTED
112
113
  }
113
114
 
@@ -1010,6 +1011,10 @@ model Interview {
1010
1011
  final_feedback Json?
1011
1012
  interview_analysis_ranges Json?
1012
1013
  interview_flow_summary String?
1014
+ /// When Orion AI feedback was last persisted on this interview.
1015
+ ai_feedback_generated_at DateTime?
1016
+ /// When recruiter human feedback was last saved (draft or final).
1017
+ human_feedback_updated_at DateTime?
1013
1018
 
1014
1019
  /// Self-scheduling
1015
1020
  reschedule_count Int @default(0)
package/client/wasm.js CHANGED
@@ -636,6 +636,8 @@ exports.Prisma.InterviewScalarFieldEnum = {
636
636
  final_feedback: 'final_feedback',
637
637
  interview_analysis_ranges: 'interview_analysis_ranges',
638
638
  interview_flow_summary: 'interview_flow_summary',
639
+ ai_feedback_generated_at: 'ai_feedback_generated_at',
640
+ human_feedback_updated_at: 'human_feedback_updated_at',
639
641
  reschedule_count: 'reschedule_count',
640
642
  last_rescheduled_at: 'last_rescheduled_at',
641
643
  first_assigned_at: 'first_assigned_at',
@@ -1149,6 +1151,7 @@ exports.ApplicationStatus = exports.$Enums.ApplicationStatus = {
1149
1151
  PENDING: 'PENDING',
1150
1152
  IN_PROGRESS: 'IN_PROGRESS',
1151
1153
  SHORTLISTED: 'SHORTLISTED',
1154
+ SELECTED: 'SELECTED',
1152
1155
  REJECTED: 'REJECTED'
1153
1156
  };
1154
1157
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptware/eagles-db",
3
- "version": "0.4.18",
3
+ "version": "0.4.21",
4
4
  "description": "A Prisma client package for Treadspace database operations",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -3,51 +3,52 @@ enum ApplicationStatus {
3
3
  PENDING
4
4
  IN_PROGRESS
5
5
  SHORTLISTED
6
+ SELECTED
6
7
  REJECTED
7
8
  }
8
9
 
9
10
  model Application {
10
- id String @id @default(uuid())
11
- candidate_id String
12
- resume_id String
13
- organisation_id String
14
- job_description_id String
15
- fit_check_score Float?
16
- applied_at DateTime @default(now())
17
- evaluation_plan_id String?
18
- fit_check_id String? @unique
19
- round_no Int @default(0)
20
- is_jaf_completed Boolean @default(false)
11
+ id String @id @default(uuid())
12
+ candidate_id String
13
+ resume_id String
14
+ organisation_id String
15
+ job_description_id String
16
+ fit_check_score Float?
17
+ applied_at DateTime @default(now())
18
+ evaluation_plan_id String?
19
+ fit_check_id String? @unique
20
+ round_no Int @default(0)
21
+ is_jaf_completed Boolean @default(false)
21
22
  //Screening fields
22
- on_notice_period Boolean @default(false)
23
- expected_joining_date DateTime?
24
- current_ctc String?
25
- expected_ctc String?
26
- notice_period Int?
27
- preferred_location String?
23
+ on_notice_period Boolean @default(false)
24
+ expected_joining_date DateTime?
25
+ current_ctc String?
26
+ expected_ctc String?
27
+ notice_period Int?
28
+ preferred_location String?
28
29
  // Relations
29
- fit_check_status FitCheckStatus?
30
- status ApplicationStatus @default(PENDING)
31
- evaluation_plan EvaluationPlan? @relation(fields: [evaluation_plan_id], references: [id])
32
- candidate User @relation(fields: [candidate_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
33
- organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
34
- resume Resume @relation(fields: [resume_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
35
- job_description JobDescription @relation(fields: [job_description_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
36
- fit_check FitCheck? @relation(fields: [fit_check_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
37
- interviews Interview[]
38
- assignments Assignment[]
39
- ongoing_evaluations OngoingEvaluation[]
30
+ fit_check_status FitCheckStatus?
31
+ status ApplicationStatus @default(PENDING)
32
+ evaluation_plan EvaluationPlan? @relation(fields: [evaluation_plan_id], references: [id])
33
+ candidate User @relation(fields: [candidate_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
34
+ organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
35
+ resume Resume @relation(fields: [resume_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
36
+ job_description JobDescription @relation(fields: [job_description_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
37
+ fit_check FitCheck? @relation(fields: [fit_check_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
38
+ interviews Interview[]
39
+ assignments Assignment[]
40
+ ongoing_evaluations OngoingEvaluation[]
40
41
  activity_logs ActivityLog[]
41
42
  notes Notes[]
42
43
  job_application_responses JobApplicationResponse[]
43
44
  conversations Conversation[]
44
45
  communication_messages CommunicationMessage[]
45
46
  // Audit fields
46
- created_at DateTime @default(now())
47
- updated_at DateTime @updatedAt
48
- created_by String
49
- updated_by String
50
- is_active Boolean @default(true)
47
+ created_at DateTime @default(now())
48
+ updated_at DateTime @updatedAt
49
+ created_by String
50
+ updated_by String
51
+ is_active Boolean @default(true)
51
52
 
52
53
  @@unique([candidate_id, job_description_id]) // Ensures candidate applies only once per job
53
54
  @@index([candidate_id])
@@ -66,6 +66,10 @@ model Interview {
66
66
  final_feedback Json?
67
67
  interview_analysis_ranges Json?
68
68
  interview_flow_summary String?
69
+ /// When Orion AI feedback was last persisted on this interview.
70
+ ai_feedback_generated_at DateTime?
71
+ /// When recruiter human feedback was last saved (draft or final).
72
+ human_feedback_updated_at DateTime?
69
73
 
70
74
  /// Self-scheduling
71
75
  reschedule_count Int @default(0)
@@ -0,0 +1,25 @@
1
+ -- Safe to re-run: adds record_kind without breaking existing ongoing evaluations.
2
+
3
+ DO $$ BEGIN
4
+ CREATE TYPE "OngoingEvaluationRecordKind" AS ENUM (
5
+ 'AI_RECOMMENDED',
6
+ 'PLAN_SELECTED',
7
+ 'COMMITTED'
8
+ );
9
+ EXCEPTION
10
+ WHEN duplicate_object THEN NULL;
11
+ END $$;
12
+
13
+ ALTER TABLE "OngoingEvaluation"
14
+ ADD COLUMN IF NOT EXISTS "record_kind" "OngoingEvaluationRecordKind";
15
+
16
+ ALTER TABLE "OngoingEvaluation"
17
+ ALTER COLUMN "evaluation_plan_id" DROP NOT NULL;
18
+
19
+ -- All existing rows are real pipeline rounds — not pre-Proceed drafts.
20
+ UPDATE "OngoingEvaluation"
21
+ SET "record_kind" = 'COMMITTED'
22
+ WHERE "record_kind" IS NULL;
23
+
24
+ CREATE INDEX IF NOT EXISTS "OngoingEvaluation_application_id_record_kind_idx"
25
+ ON "OngoingEvaluation"("application_id", "record_kind");
@@ -0,0 +1,24 @@
1
+ -- Replace record_kind enum with is_committed (null = legacy, false = draft, true = committed).
2
+
3
+ ALTER TABLE "OngoingEvaluation"
4
+ ADD COLUMN IF NOT EXISTS "is_committed" BOOLEAN;
5
+
6
+ UPDATE "OngoingEvaluation"
7
+ SET "is_committed" = false
8
+ WHERE "record_kind" IN ('AI_RECOMMENDED', 'PLAN_SELECTED');
9
+
10
+ UPDATE "OngoingEvaluation"
11
+ SET "is_committed" = true
12
+ WHERE "record_kind" = 'COMMITTED';
13
+
14
+ -- Legacy rows without record_kind stay null (treated as committed in app queries).
15
+
16
+ DROP INDEX IF EXISTS "OngoingEvaluation_application_id_record_kind_idx";
17
+
18
+ ALTER TABLE "OngoingEvaluation"
19
+ DROP COLUMN IF EXISTS "record_kind";
20
+
21
+ DROP TYPE IF EXISTS "OngoingEvaluationRecordKind";
22
+
23
+ CREATE INDEX IF NOT EXISTS "OngoingEvaluation_application_id_is_committed_idx"
24
+ ON "OngoingEvaluation"("application_id", "is_committed");
@@ -0,0 +1,2 @@
1
+ -- Drop unused per-job AI recommendation threshold storage (defaults live in application code).
2
+ ALTER TABLE "JobDescription" DROP COLUMN IF EXISTS "recommendation_config";
package/prisma/.DS_Store DELETED
Binary file
@@ -1,2 +0,0 @@
1
- -- Full AI interview completion window (calendar days); nullable for non–Full AI rows.
2
- ALTER TABLE "Interview" ADD COLUMN IF NOT EXISTS "deadline" INTEGER;
@@ -1,30 +0,0 @@
1
- -- Interview.duration (minutes) replaces timestamp-derived length; Interview.deadline removed (window = scheduled_end_time).
2
- ALTER TABLE "Interview" ADD COLUMN IF NOT EXISTS "duration" INTEGER;
3
-
4
- ALTER TABLE "Interview" DROP COLUMN IF EXISTS "deadline";
5
-
6
- -- Best-effort inline backfill (Full AI rows may be wrong until backfill-interview-duration.ts runs).
7
- UPDATE "Interview" i
8
- SET "duration" = GREATEST(
9
- 1,
10
- ROUND(
11
- EXTRACT(EPOCH FROM (i."scheduled_end_time" - i."scheduled_start_time")) / 60
12
- )::integer
13
- )
14
- WHERE i."duration" IS NULL
15
- AND i."scheduled_start_time" IS NOT NULL
16
- AND i."scheduled_end_time" IS NOT NULL
17
- AND i."scheduled_end_time" > i."scheduled_start_time"
18
- AND (i."evaluation_type" IS NULL OR i."evaluation_type"::text <> 'TREADSPACE_FULL_AI');
19
-
20
- UPDATE "Interview" i
21
- SET "duration" = oe."duration"
22
- FROM "OngoingEvaluation" oe
23
- WHERE oe."interview_id" = i."id"
24
- AND i."duration" IS NULL
25
- AND oe."duration" IS NOT NULL
26
- AND oe."duration_unit" = 'MINUTES';
27
-
28
- UPDATE "Interview"
29
- SET "duration" = 45
30
- WHERE "duration" IS NULL;
@@ -1,2 +0,0 @@
1
- -- Drop unique constraint on Resume.file_hash (dedup moves to Document.file_hash).
2
- DROP INDEX IF EXISTS "Resume_file_hash_key";
@@ -1,2 +0,0 @@
1
- -- Add is_mandatory flag to job application form fields.
2
- ALTER TABLE "JobApplicationField" ADD COLUMN IF NOT EXISTS "is_mandatory" BOOLEAN NOT NULL DEFAULT false;
@@ -1,2 +0,0 @@
1
- -- Track whether the latest response change was made by the organisation (vs candidate).
2
- ALTER TABLE "JobApplicationResponse" ADD COLUMN IF NOT EXISTS "updated_by_organisation" BOOLEAN NOT NULL DEFAULT false;
@@ -1,3 +0,0 @@
1
- -- Drop Document.application_id FK and column (linking stays on JobApplicationResponse.document_id).
2
- ALTER TABLE "Document" DROP CONSTRAINT IF EXISTS "Document_application_id_fkey";
3
- ALTER TABLE "Document" DROP COLUMN IF EXISTS "application_id";
@@ -1,70 +0,0 @@
1
- -- CreateEnum
2
- CREATE TYPE "JobApplicationTemplateScope" AS ENUM ('ORGANIZATION', 'JOB');
3
-
4
- -- CreateTable
5
- CREATE TABLE "JobApplicationTemplate" (
6
- "id" TEXT NOT NULL,
7
- "organisation_id" TEXT NOT NULL,
8
- "job_description_id" TEXT,
9
- "name" TEXT NOT NULL,
10
- "description" TEXT,
11
- "scope" "JobApplicationTemplateScope" NOT NULL DEFAULT 'ORGANIZATION',
12
- "is_active" BOOLEAN NOT NULL DEFAULT true,
13
- "created_by" TEXT NOT NULL,
14
- "updated_by" TEXT NOT NULL,
15
- "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
16
- "updated_at" TIMESTAMP(3) NOT NULL,
17
-
18
- CONSTRAINT "JobApplicationTemplate_pkey" PRIMARY KEY ("id")
19
- );
20
-
21
- -- Drop legacy scope model on JobApplicationField (greenfield — no data backfill)
22
- ALTER TABLE "JobApplicationField" DROP CONSTRAINT IF EXISTS "JobApplicationField_job_description_id_fkey";
23
- ALTER TABLE "JobApplicationField" DROP CONSTRAINT IF EXISTS "JobApplicationField_application_id_fkey";
24
- DROP INDEX IF EXISTS "JobApplicationField_organisation_id_scope_idx";
25
- DROP INDEX IF EXISTS "JobApplicationField_job_description_id_idx";
26
- DROP INDEX IF EXISTS "JobApplicationField_application_id_idx";
27
-
28
- ALTER TABLE "JobApplicationField" DROP COLUMN IF EXISTS "scope";
29
- ALTER TABLE "JobApplicationField" DROP COLUMN IF EXISTS "job_description_id";
30
- ALTER TABLE "JobApplicationField" DROP COLUMN IF EXISTS "application_id";
31
-
32
- DROP TYPE IF EXISTS "JobApplicationFieldScope";
33
-
34
- ALTER TABLE "JobApplicationField" ADD COLUMN IF NOT EXISTS "template_id" TEXT;
35
-
36
- -- JobApplicationResponse snapshot columns
37
- ALTER TABLE "JobApplicationResponse" DROP CONSTRAINT IF EXISTS "JobApplicationResponse_job_application_field_id_fkey";
38
- DROP INDEX IF EXISTS "JobApplicationResponse_application_id_job_application_field_id_key";
39
-
40
- ALTER TABLE "JobApplicationResponse" ALTER COLUMN "job_application_field_id" DROP NOT NULL;
41
-
42
- ALTER TABLE "JobApplicationResponse" ADD COLUMN IF NOT EXISTS "field_type" "JobApplicationFieldType";
43
- ALTER TABLE "JobApplicationResponse" ADD COLUMN IF NOT EXISTS "label" TEXT;
44
- ALTER TABLE "JobApplicationResponse" ADD COLUMN IF NOT EXISTS "description" TEXT;
45
- ALTER TABLE "JobApplicationResponse" ADD COLUMN IF NOT EXISTS "is_mandatory" BOOLEAN;
46
- ALTER TABLE "JobApplicationResponse" ADD COLUMN IF NOT EXISTS "options" TEXT[] DEFAULT ARRAY[]::TEXT[];
47
-
48
- -- Document: remove application link
49
- ALTER TABLE "Document" DROP CONSTRAINT IF EXISTS "Document_application_id_fkey";
50
- DROP INDEX IF EXISTS "Document_application_id_idx";
51
- ALTER TABLE "Document" DROP COLUMN IF EXISTS "application_id";
52
-
53
- -- Greenfield: no legacy JAF rows — clear any orphan fields before NOT NULL
54
- DELETE FROM "JobApplicationField";
55
- ALTER TABLE "JobApplicationField" ALTER COLUMN "template_id" SET NOT NULL;
56
-
57
- -- Indexes and foreign keys
58
- CREATE UNIQUE INDEX IF NOT EXISTS "JobApplicationTemplate_job_description_id_key" ON "JobApplicationTemplate"("job_description_id");
59
- CREATE INDEX IF NOT EXISTS "JobApplicationTemplate_organisation_id_scope_idx" ON "JobApplicationTemplate"("organisation_id", "scope");
60
- CREATE INDEX IF NOT EXISTS "JobApplicationTemplate_job_description_id_idx" ON "JobApplicationTemplate"("job_description_id");
61
-
62
- ALTER TABLE "JobApplicationTemplate" ADD CONSTRAINT "JobApplicationTemplate_organisation_id_fkey" FOREIGN KEY ("organisation_id") REFERENCES "Organisation"("id") ON DELETE CASCADE ON UPDATE CASCADE;
63
- ALTER TABLE "JobApplicationTemplate" ADD CONSTRAINT "JobApplicationTemplate_job_description_id_fkey" FOREIGN KEY ("job_description_id") REFERENCES "JobDescription"("id") ON DELETE CASCADE ON UPDATE CASCADE;
64
-
65
- ALTER TABLE "JobApplicationField" ADD CONSTRAINT "JobApplicationField_template_id_fkey" FOREIGN KEY ("template_id") REFERENCES "JobApplicationTemplate"("id") ON DELETE CASCADE ON UPDATE CASCADE;
66
- CREATE INDEX IF NOT EXISTS "JobApplicationField_organisation_id_template_id_idx" ON "JobApplicationField"("organisation_id", "template_id");
67
-
68
- ALTER TABLE "JobApplicationResponse" ADD CONSTRAINT "JobApplicationResponse_job_application_field_id_fkey" FOREIGN KEY ("job_application_field_id") REFERENCES "JobApplicationField"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
69
-
70
- CREATE UNIQUE INDEX "JobApplicationResponse_application_id_job_application_field_id_key" ON "JobApplicationResponse"("application_id", "job_application_field_id") WHERE "job_application_field_id" IS NOT NULL;
@@ -1,15 +0,0 @@
1
- -- AlterTable
2
- ALTER TABLE "Assignment" ADD COLUMN "solution_document_id" TEXT,
3
- ADD COLUMN "zip_document_id" TEXT;
4
-
5
- -- CreateIndex
6
- CREATE UNIQUE INDEX "Assignment_solution_document_id_key" ON "Assignment"("solution_document_id");
7
-
8
- -- CreateIndex
9
- CREATE UNIQUE INDEX "Assignment_zip_document_id_key" ON "Assignment"("zip_document_id");
10
-
11
- -- AddForeignKey
12
- ALTER TABLE "Assignment" ADD CONSTRAINT "Assignment_solution_document_id_fkey" FOREIGN KEY ("solution_document_id") REFERENCES "Document"("id") ON DELETE SET NULL ON UPDATE CASCADE;
13
-
14
- -- AddForeignKey
15
- ALTER TABLE "Assignment" ADD CONSTRAINT "Assignment_zip_document_id_fkey" FOREIGN KEY ("zip_document_id") REFERENCES "Document"("id") ON DELETE SET NULL ON UPDATE CASCADE;
@@ -1,12 +0,0 @@
1
- -- JobApplicationField: draft gate for template/job fields
2
- ALTER TABLE "JobApplicationField" ADD COLUMN IF NOT EXISTS "is_draft" BOOLEAN DEFAULT true;
3
- UPDATE "JobApplicationField" SET "is_draft" = false WHERE "is_draft" IS NULL;
4
- ALTER TABLE "JobApplicationField" ALTER COLUMN "is_draft" SET NOT NULL;
5
- ALTER TABLE "JobApplicationField" ALTER COLUMN "is_draft" SET DEFAULT true;
6
-
7
- -- JobApplicationResponse: per-row draft/submit state
8
- ALTER TABLE "JobApplicationResponse" ADD COLUMN IF NOT EXISTS "is_draft" BOOLEAN;
9
- ALTER TABLE "JobApplicationResponse" ADD COLUMN IF NOT EXISTS "is_submitted" BOOLEAN DEFAULT false;
10
- UPDATE "JobApplicationResponse" SET "is_draft" = false WHERE "is_draft" IS NULL;
11
- UPDATE "JobApplicationResponse" SET "is_submitted" = false WHERE "is_submitted" IS NULL;
12
- ALTER TABLE "JobApplicationResponse" ALTER COLUMN "is_draft" SET DEFAULT false;