@dakkitor/api-contracts 1.4.0 → 1.5.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 (46) hide show
  1. package/dist/abilities/abilities.contract.d.ts +3 -1
  2. package/dist/abilities/abilities.contract.d.ts.map +1 -1
  3. package/dist/abilities/abilities.contract.js +4 -1
  4. package/dist/abilities/first-agent.abilities.json +13 -0
  5. package/dist/abilities/outreach-service.abilities.json +14 -0
  6. package/dist/abilities/second-agent.abilities.json +13 -0
  7. package/dist/actives/actives.contract.d.ts +8657 -8657
  8. package/dist/bookings/bookings.contract.d.ts +13082 -13082
  9. package/dist/curated-worker-leads/candidate-coordination.contract.d.ts +4322 -4322
  10. package/dist/curated-worker-leads/candidate-edit-session.contract.d.ts +398 -398
  11. package/dist/curated-worker-leads/consent-queue.contract.d.ts +1205 -1205
  12. package/dist/curated-worker-leads/jobs-tab.contract.d.ts +5811 -5629
  13. package/dist/curated-worker-leads/jobs-tab.contract.d.ts.map +1 -1
  14. package/dist/curated-worker-leads/jobs-tab.contract.js +31 -1
  15. package/dist/curated-worker-leads/owned-jobs-tab.contract.d.ts +190 -190
  16. package/dist/dashboards/dashboard-widgets.contract.d.ts +262 -262
  17. package/dist/export-jobs/export-jobs.contract.d.ts +828 -818
  18. package/dist/export-jobs/export-jobs.contract.d.ts.map +1 -1
  19. package/dist/exports-events/exports-events.schemas.d.ts +2 -2
  20. package/dist/index.d.ts +4 -0
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +4 -0
  23. package/dist/jobs/jobs.contract.d.ts +9534 -9522
  24. package/dist/jobs/jobs.contract.d.ts.map +1 -1
  25. package/dist/jobs/jobs.contract.js +9 -0
  26. package/dist/notifications/notifications.contract.d.ts +42 -42
  27. package/dist/outreach/__tests__/outreach-claim.test.js +1 -0
  28. package/dist/outreach/__tests__/outreach-contract-additions.spec.d.ts +2 -0
  29. package/dist/outreach/__tests__/outreach-contract-additions.spec.d.ts.map +1 -0
  30. package/dist/outreach/__tests__/outreach-contract-additions.spec.js +78 -0
  31. package/dist/outreach/__tests__/outreach-requests.contract.spec.d.ts +2 -0
  32. package/dist/outreach/__tests__/outreach-requests.contract.spec.d.ts.map +1 -0
  33. package/dist/outreach/__tests__/outreach-requests.contract.spec.js +64 -0
  34. package/dist/outreach/__tests__/outreach.schemas.test.js +5 -1
  35. package/dist/outreach/outreach-requests.contract.d.ts +1108 -0
  36. package/dist/outreach/outreach-requests.contract.d.ts.map +1 -0
  37. package/dist/outreach/outreach-requests.contract.js +134 -0
  38. package/dist/outreach/outreach-requests.schemas.d.ts +49 -0
  39. package/dist/outreach/outreach-requests.schemas.d.ts.map +1 -0
  40. package/dist/outreach/outreach-requests.schemas.js +60 -0
  41. package/dist/outreach/outreach.contract.d.ts +145 -135
  42. package/dist/outreach/outreach.contract.d.ts.map +1 -1
  43. package/dist/outreach/outreach.schemas.d.ts +15 -10
  44. package/dist/outreach/outreach.schemas.d.ts.map +1 -1
  45. package/dist/outreach/outreach.schemas.js +5 -2
  46. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outreach-requests.contract.d.ts","sourceRoot":"","sources":["../../contracts/outreach/outreach-requests.contract.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,cAAc,6BAA6B,CAAC;AAI5C,2EAA2E;AAC3E,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEM,CAAC;AAElD,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAC5C,OAAO,8BAA8B,CACtC,CAAC;AAEF,eAAO,MAAM,+BAA+B;;;;;;EAIM,CAAC;AAEnD,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,+BAA+B,CACvC,CAAC;AAEF,eAAO,MAAM,kCAAkC;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8FpC,CAAC"}
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.outreachRequestsContract = exports.ListOutreachRequestsResponseSchema = exports.CreateOutreachRequestBodySchema = exports.OutreachRequestQueueItemSchema = void 0;
18
+ /**
19
+ * Project: Internal Recruitment Platform API
20
+ * File: outreach-requests.contract.ts
21
+ *
22
+ * Description: Agents mark jobs for outreach; the rack works the queue.
23
+ *
24
+ * Two lanes share one router because ts-rest does not model auth: `create` and
25
+ * `cancel` are the agent's JWT, `list` / `start` / `complete` are the service
26
+ * key. The server enforces the split with different guards per controller — see
27
+ * outreach-requests.v2.controller.ts and outreach.v2.controller.ts.
28
+ */
29
+ const core_1 = require("@ts-rest/core");
30
+ const zod_1 = require("zod");
31
+ const error_schemas_1 = require("../common/error-schemas");
32
+ const outreach_schemas_1 = require("./outreach.schemas");
33
+ const outreach_requests_schemas_1 = require("./outreach-requests.schemas");
34
+ __exportStar(require("./outreach-requests.schemas"), exports);
35
+ const c = (0, core_1.initContract)();
36
+ /** A queue row plus enough of the job to label a campaign in Relay Lab. */
37
+ exports.OutreachRequestQueueItemSchema = outreach_requests_schemas_1.OutreachRequestSchema.extend({
38
+ job: outreach_schemas_1.OutreachJobSchema,
39
+ }).openapi({ title: 'OutreachRequestQueueItem' });
40
+ exports.CreateOutreachRequestBodySchema = zod_1.z
41
+ .object({
42
+ jobId: zod_1.z.string().uuid().describe('Job to mark for outreach'),
43
+ })
44
+ .openapi({ title: 'CreateOutreachRequestBody' });
45
+ exports.ListOutreachRequestsResponseSchema = zod_1.z
46
+ .object({
47
+ items: zod_1.z.array(exports.OutreachRequestQueueItemSchema),
48
+ })
49
+ .openapi({ title: 'ListOutreachRequestsResponse' });
50
+ exports.outreachRequestsContract = c.router({
51
+ create: {
52
+ method: 'POST',
53
+ path: '/outreach/requests',
54
+ body: exports.CreateOutreachRequestBodySchema,
55
+ responses: {
56
+ // A second "Start outreach" click is NOT an error: the route returns
57
+ // the existing open request so the button can render its state. There
58
+ // is deliberately no 409 here.
59
+ 200: outreach_requests_schemas_1.OutreachRequestSchema,
60
+ 404: error_schemas_1.ErrorResponseSchema,
61
+ },
62
+ summary: 'Mark a job for outreach',
63
+ description: 'Idempotent per job: if an open (PENDING or RUNNING) request already ' +
64
+ 'exists it is returned unchanged. Snapshots the eligible-candidate ' +
65
+ 'count onto the row at creation. 404 when the job does not exist or ' +
66
+ 'is not open (AVAILABLE with a free position).',
67
+ metadata: { tags: ['Outreach'] },
68
+ },
69
+ cancel: {
70
+ method: 'POST',
71
+ path: '/outreach/requests/:id/cancel',
72
+ pathParams: zod_1.z.object({ id: zod_1.z.string().uuid() }),
73
+ body: zod_1.z.object({}),
74
+ responses: {
75
+ 200: outreach_requests_schemas_1.OutreachRequestSchema,
76
+ 404: error_schemas_1.ErrorResponseSchema,
77
+ },
78
+ summary: 'Withdraw an outreach request',
79
+ description: 'Terminal. Frees the job for a new request. Cancelling an already ' +
80
+ 'terminal request is a 200 no-op returning the row unchanged.',
81
+ metadata: { tags: ['Outreach'] },
82
+ },
83
+ list: {
84
+ method: 'GET',
85
+ path: '/outreach/requests',
86
+ query: zod_1.z.object({
87
+ status: outreach_requests_schemas_1.OutreachRequestStatusSchema.optional().describe('Narrow to one state. Default: PENDING and RUNNING.'),
88
+ }),
89
+ responses: {
90
+ 200: exports.ListOutreachRequestsResponseSchema,
91
+ },
92
+ summary: 'The open outreach queue',
93
+ description: 'PENDING and RUNNING requests, oldest first, with job facts for ' +
94
+ 'labelling. Service lane only — the service account still cannot ' +
95
+ 'read jobs generally.',
96
+ metadata: { tags: ['Outreach'] },
97
+ },
98
+ start: {
99
+ method: 'POST',
100
+ path: '/outreach/requests/:id/start',
101
+ pathParams: zod_1.z.object({ id: zod_1.z.string().uuid() }),
102
+ body: zod_1.z.object({}),
103
+ responses: {
104
+ 200: outreach_requests_schemas_1.OutreachRequestSchema,
105
+ 404: error_schemas_1.ErrorResponseSchema,
106
+ },
107
+ summary: 'Mark a request as being worked',
108
+ description: 'PENDING -> RUNNING. Idempotent: starting a RUNNING request returns ' +
109
+ 'it unchanged. Starting a terminal request is a 404.',
110
+ metadata: { tags: ['Outreach'] },
111
+ },
112
+ complete: {
113
+ method: 'POST',
114
+ path: '/outreach/requests/:id/complete',
115
+ pathParams: zod_1.z.object({ id: zod_1.z.string().uuid() }),
116
+ body: zod_1.z.object({}),
117
+ responses: {
118
+ 200: outreach_requests_schemas_1.OutreachRequestSchema,
119
+ 404: error_schemas_1.ErrorResponseSchema,
120
+ },
121
+ summary: 'Mark a request as drained or ended',
122
+ description: 'PENDING or RUNNING -> COMPLETED. Terminal; frees the job for a new ' +
123
+ 'request. Completing an already COMPLETED request is a 200 no-op.',
124
+ metadata: { tags: ['Outreach'] },
125
+ },
126
+ }, {
127
+ pathPrefix: '/v2',
128
+ commonResponses: {
129
+ 400: error_schemas_1.ErrorResponseSchema,
130
+ 401: error_schemas_1.ErrorResponseSchema,
131
+ 403: error_schemas_1.ErrorResponseSchema,
132
+ 500: error_schemas_1.ErrorResponseSchema,
133
+ },
134
+ });
@@ -0,0 +1,49 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * `COMPLETED` and `CANCELLED` are terminal and free the job for a new
4
+ * request. The invariant that at most one PENDING-or-RUNNING request exists
5
+ * per job is a partial unique index in the database, not an application
6
+ * check — mirroring uq_candidate_contact_sessions_active_canonical, which is
7
+ * the real guarantee behind the claim path.
8
+ */
9
+ export declare const OutreachRequestStatusSchema: z.ZodEnum<["PENDING", "RUNNING", "COMPLETED", "CANCELLED"]>;
10
+ export type OutreachRequestStatus = z.infer<typeof OutreachRequestStatusSchema>;
11
+ /**
12
+ * `eligibleAtRequest` is a POINT-IN-TIME snapshot taken when the request was
13
+ * raised, not a live figure. The pool changes on every send, and refreshing it
14
+ * would reintroduce the per-job counting cost this design avoids on the feed.
15
+ * The live number is whatever claim-next finds. Label it as a snapshot.
16
+ */
17
+ export declare const OutreachRequestSchema: z.ZodObject<{
18
+ id: z.ZodString;
19
+ jobId: z.ZodString;
20
+ status: z.ZodEnum<["PENDING", "RUNNING", "COMPLETED", "CANCELLED"]>;
21
+ eligibleAtRequest: z.ZodNumber;
22
+ requestedByName: z.ZodNullable<z.ZodString>;
23
+ contactedCount: z.ZodNumber;
24
+ createdAt: z.ZodString;
25
+ startedAt: z.ZodNullable<z.ZodString>;
26
+ completedAt: z.ZodNullable<z.ZodString>;
27
+ }, "strip", z.ZodTypeAny, {
28
+ id: string;
29
+ createdAt: string;
30
+ status: "PENDING" | "COMPLETED" | "CANCELLED" | "RUNNING";
31
+ jobId: string;
32
+ startedAt: string | null;
33
+ completedAt: string | null;
34
+ requestedByName: string | null;
35
+ contactedCount: number;
36
+ eligibleAtRequest: number;
37
+ }, {
38
+ id: string;
39
+ createdAt: string;
40
+ status: "PENDING" | "COMPLETED" | "CANCELLED" | "RUNNING";
41
+ jobId: string;
42
+ startedAt: string | null;
43
+ completedAt: string | null;
44
+ requestedByName: string | null;
45
+ contactedCount: number;
46
+ eligibleAtRequest: number;
47
+ }>;
48
+ export type OutreachRequest = z.infer<typeof OutreachRequestSchema>;
49
+ //# sourceMappingURL=outreach-requests.schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outreach-requests.schemas.d.ts","sourceRoot":"","sources":["../../contracts/outreach/outreach-requests.schemas.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,6DAEM,CAAC;AAE/C,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuBM,CAAC;AAEzC,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OutreachRequestSchema = exports.OutreachRequestStatusSchema = void 0;
4
+ /**
5
+ * Project: Internal Recruitment Platform API
6
+ * File: outreach-requests.schemas.ts
7
+ *
8
+ * Description: The outreach REQUEST queue — an agent marks a job for outreach,
9
+ * the rack polls the queue and launches a campaign against it.
10
+ *
11
+ * Split out of outreach-requests.contract.ts so jobs-tab.contract.ts can import
12
+ * the status enum for its feed-card payload without importing a ts-rest router.
13
+ *
14
+ * Auth: two lanes. Creating and cancelling is a human agent's JWT; listing,
15
+ * starting and completing is the service account's Bearer key — the same key
16
+ * the claim routes already accept.
17
+ */
18
+ const zod_openapi_1 = require("@anatine/zod-openapi");
19
+ const zod_1 = require("zod");
20
+ (0, zod_openapi_1.extendZodWithOpenApi)(zod_1.z);
21
+ /**
22
+ * `COMPLETED` and `CANCELLED` are terminal and free the job for a new
23
+ * request. The invariant that at most one PENDING-or-RUNNING request exists
24
+ * per job is a partial unique index in the database, not an application
25
+ * check — mirroring uq_candidate_contact_sessions_active_canonical, which is
26
+ * the real guarantee behind the claim path.
27
+ */
28
+ exports.OutreachRequestStatusSchema = zod_1.z
29
+ .enum(['PENDING', 'RUNNING', 'COMPLETED', 'CANCELLED'])
30
+ .openapi({ title: 'OutreachRequestStatus' });
31
+ /**
32
+ * `eligibleAtRequest` is a POINT-IN-TIME snapshot taken when the request was
33
+ * raised, not a live figure. The pool changes on every send, and refreshing it
34
+ * would reintroduce the per-job counting cost this design avoids on the feed.
35
+ * The live number is whatever claim-next finds. Label it as a snapshot.
36
+ */
37
+ exports.OutreachRequestSchema = zod_1.z
38
+ .object({
39
+ id: zod_1.z.string().uuid(),
40
+ jobId: zod_1.z.string().uuid(),
41
+ status: exports.OutreachRequestStatusSchema,
42
+ eligibleAtRequest: zod_1.z
43
+ .number()
44
+ .int()
45
+ .min(0)
46
+ .describe('Eligible candidates counted when the request was raised'),
47
+ requestedByName: zod_1.z
48
+ .string()
49
+ .nullable()
50
+ .describe('Agent who raised the request'),
51
+ contactedCount: zod_1.z
52
+ .number()
53
+ .int()
54
+ .min(0)
55
+ .describe('Sends confirmed against this job so far'),
56
+ createdAt: zod_1.z.string().datetime(),
57
+ startedAt: zod_1.z.string().datetime().nullable(),
58
+ completedAt: zod_1.z.string().datetime().nullable(),
59
+ })
60
+ .openapi({ title: 'OutreachRequest' });