@in-human-resources/backend-proto 0.1.2 → 0.1.4

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,82 +1,85 @@
1
- # `@in-human-resources/backend-proto`
2
-
3
- Published npm package: **Protobuf-ES** message types and **Connect-ES** service stubs for `api.v1`, `auth.v1`, and `common.v1`.
4
-
5
- ## Install
6
-
7
- ```bash
8
- npm install @in-human-resources/backend-proto
9
- ```
10
-
11
- Peer dependencies (install in your app):
12
-
13
- ```bash
14
- npm install @bufbuild/protobuf @connectrpc/connect
15
- ```
16
-
17
- For browsers you may also use `@connectrpc/connect-web`.
18
-
19
- ## Usage
20
-
21
- Import Connect service definitions and create a client (example: gateway `api.v1`):
22
-
23
- ```typescript
24
- import { createClient } from '@connectrpc/connect';
25
- import { createGrpcTransport } from '@connectrpc/connect-node';
26
- import { AuthService } from '@in-human-resources/backend-proto/gen/ts/api/v1/auth_connect.js';
27
-
28
- const transport = createGrpcTransport({ baseUrl: 'http://localhost:8082', httpVersion: '2' });
29
- export const authClient = createClient(AuthService, transport);
30
- ```
31
-
32
- Use the same pattern for `company_connect.js`, `candidate_connect.js`, or internal `auth/v1/service_connect.js` as needed.
33
-
34
- ## Source `.proto` files (contract reference)
35
-
36
- The package ships the **original Protobuf schemas** next to generated code so you can read RPCs and messages without leaving `node_modules`:
37
-
38
- | Location in the package | Contents |
39
- |-------------------------|----------|
40
- | `api/v1/*.proto` | Public gateway API (`AuthService`, `CompanyService`, `CandidateService`, shared types) |
41
- | `auth/v1/service.proto` | Internal auth service (`auth.v1.AuthService`) |
42
- | `common/v1/common.proto` | Shared `common.v1` messages |
43
-
44
- Example path after install:
45
-
46
- `node_modules/@in-human-resources/backend-proto/api/v1/auth.proto`
47
-
48
- `buf.yaml` / `buf.gen.yaml` are included for Buf-based tooling if you point at this folder as a module.
49
-
50
- ## Regenerate (maintainers)
51
-
52
- From this directory:
53
-
54
- ```bash
55
- npm install
56
- npx buf generate
57
- ```
58
-
59
- This refreshes **Go** output under `gen/` and **TypeScript** under `gen/ts/`. Commit both when APIs change.
60
-
61
- ## Publish
62
-
63
- 1. Bump `"version"` in `package.json`.
64
- 2. `npm login` (npmjs.com account with permission to publish the `@in-human-resources` scope).
65
- 3. **npm requires 2FA to publish** (or a [granular access token](https://docs.npmjs.com/about-access-tokens) with publish rights). Enable 2FA on [npm account settings](https://www.npmjs.com/settings/~/auth) (Authorization and publishing), or create a token with “Bypass two-factor authentication” if your org allows it.
66
- 4. From `proto/`:
67
-
68
- ```bash
69
- npm publish
70
- ```
71
-
72
- `publishConfig.access` is set to `public` in `package.json` for this scoped package.
73
-
74
- ## What ships on npm
75
-
76
- | Path | Contents |
77
- |------|----------|
78
- | `gen/ts/` | Generated TypeScript (`*_pb.ts`, `*_connect.ts`) |
79
- | `api/`, `auth/`, `common/` | **Source `.proto` files** (API contract) |
80
- | `buf.yaml`, `buf.gen.yaml` | Buf module + codegen config |
81
-
82
- Go stubs under `gen/*.go` are **not** published (they stay in the git repo for the backend workspace only).
1
+ # `@in-human-resources/backend-proto`
2
+
3
+ Published npm package: **Protobuf-ES** message types and **Connect-ES** service stubs for `api.v1`, `auth.v1`, and `common.v1`.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @in-human-resources/backend-proto
9
+ ```
10
+
11
+ Peer dependencies (install in your app):
12
+
13
+ ```bash
14
+ npm install @bufbuild/protobuf @connectrpc/connect
15
+ ```
16
+
17
+ For browsers you may also use `@connectrpc/connect-web`.
18
+
19
+ ## Usage
20
+
21
+ Import Connect service definitions and create a client (example: gateway `api.v1`):
22
+
23
+ ```typescript
24
+ import { createClient } from '@connectrpc/connect';
25
+ import { createGrpcTransport } from '@connectrpc/connect-node';
26
+ import { AuthService } from '@in-human-resources/backend-proto/gen/ts/api/v1/auth_connect';
27
+
28
+ const transport = createGrpcTransport({ baseUrl: 'http://localhost:8082', httpVersion: '2' });
29
+ export const authClient = createClient(AuthService, transport);
30
+ ```
31
+
32
+ Use the same pattern for `company_connect`, `candidate_connect`, or internal `auth/v1/service_connect` (extensionless so Next/Turbopack can resolve the published `.ts` files).
33
+
34
+ > **Note:** Code is generated with `import_extension=none` so local imports inside `gen/ts` omit `.js`. The package only publishes TypeScript under `gen/ts` (not precompiled `.js`); a `.js` suffix in import specifiers is incorrect for that layout.
35
+
36
+ ## Source `.proto` files (contract reference)
37
+
38
+ The package ships the **original Protobuf schemas** next to generated code so you can read RPCs and messages without leaving `node_modules`:
39
+
40
+ | Location in the package | Contents |
41
+ |-------------------------|----------|
42
+ | `api/v1/*.proto` | Public gateway API (`AuthService`, `CompanyService`, `CandidateService`, `HiringService`, shared types) |
43
+ | `auth/v1/service.proto` | Internal auth service (`auth.v1.AuthService`) |
44
+ | `hiring/v1/service.proto` | Private hiring service (`hiring.v1.HiringService`) |
45
+ | `common/v1/common.proto` | Shared `common.v1` messages |
46
+
47
+ Example path after install:
48
+
49
+ `node_modules/@in-human-resources/backend-proto/api/v1/auth.proto`
50
+
51
+ `buf.yaml` / `buf.gen.yaml` are included for Buf-based tooling if you point at this folder as a module.
52
+
53
+ ## Regenerate (maintainers)
54
+
55
+ From the repository root:
56
+
57
+ ```bash
58
+ (cd proto && npm ci) # first time or after dependency changes
59
+ make proto-gen
60
+ ```
61
+
62
+ This refreshes **Go** output under `gen/` and **TypeScript** under `gen/ts/`. Commit both when APIs change.
63
+
64
+ ## Publish
65
+
66
+ 1. Bump `"version"` in `package.json`.
67
+ 2. `npm login` (npmjs.com account with permission to publish the `@in-human-resources` scope).
68
+ 3. **npm requires 2FA to publish** (or a [granular access token](https://docs.npmjs.com/about-access-tokens) with publish rights). Enable 2FA on [npm account settings](https://www.npmjs.com/settings/~/auth) (Authorization and publishing), or create a token with “Bypass two-factor authentication” if your org allows it.
69
+ 4. From `proto/`:
70
+
71
+ ```bash
72
+ npm publish
73
+ ```
74
+
75
+ `publishConfig.access` is set to `public` in `package.json` for this scoped package.
76
+
77
+ ## What ships on npm
78
+
79
+ | Path | Contents |
80
+ |------|----------|
81
+ | `gen/ts/` | Generated TypeScript (`*_pb.ts`, `*_connect.ts`) |
82
+ | `api/`, `auth/`, `hiring/`, `common/` | **Source `.proto` files** (API contract) |
83
+ | `buf.yaml`, `buf.gen.yaml` | Buf module + codegen config |
84
+
85
+ Go stubs under `gen/*.go` are **not** published (they stay in the git repo for the backend workspace only).
package/api/v1/auth.proto CHANGED
@@ -4,10 +4,19 @@ package api.v1;
4
4
 
5
5
  option go_package = "github.com/InHuman-Resources/Backend/Go/proto/gen/api/v1;apiv1";
6
6
 
7
+ // api.v1 versioning: prefer additive field/RPC changes; never renumber fields. A future
8
+ // api.v2 would be a breaking, coordinated release. See proto/AGENTS.md and ROADMAP.md.
9
+
7
10
  import "api/v1/common.proto";
8
11
 
9
- // AuthService is the client-facing authentication service.
10
- // Mobile and web clients call these RPCs directly.
12
+ // AuthService public identity and session edge for product clients.
13
+ //
14
+ // Business context: registration and login (credentials + OAuth), email verification,
15
+ // password lifecycle, session listing/revocation, and basic profile reads/updates on the
16
+ // gateway. Permission and role truth beyond the token remains in auth-service; hiring
17
+ // and other domains enforce their own authorization.
18
+ //
19
+ // Clients call only through the API gateway with Bearer tokens on protected RPCs.
11
20
  service AuthService {
12
21
  // Core authentication
13
22
  rpc Register(RegisterRequest) returns (RegisterResponse);
@@ -4,9 +4,16 @@ package api.v1;
4
4
 
5
5
  option go_package = "github.com/InHuman-Resources/Backend/Go/proto/gen/api/v1;apiv1";
6
6
 
7
+ // api.v1 versioning: prefer additive field/RPC changes; never renumber fields.
8
+
7
9
  import "api/v1/common.proto";
8
10
 
9
- // CandidateService is the client-facing candidate profile service.
11
+ // CandidateService candidate profile, skills, experience, and onboarding.
12
+ //
13
+ // Business context: profile CRUD, application-readiness hints, and step-based candidate
14
+ // onboarding. Canonical hiring applications and stages live under HiringService, not here.
15
+ // Next upgrades: richer profile or assessment-prep fields should be additive; hiring
16
+ // artifacts (applications) stay on HiringService.
10
17
  service CandidateService {
11
18
  // Profile management
12
19
  rpc GetCandidateProfile(GetCandidateProfileRequest) returns (CandidateProfileResponse);
@@ -4,6 +4,9 @@ package api.v1;
4
4
 
5
5
  option go_package = "github.com/InHuman-Resources/Backend/Go/proto/gen/api/v1;apiv1";
6
6
 
7
+ // Shared api.v1 types. Versioning: add fields with new tags only; do not rename or
8
+ // repurpose existing fields without a breaking-change process.
9
+
7
10
  // RequestContext contains metadata about the client request.
8
11
  // This is optional and can be used for idempotency, tracing, etc.
9
12
  message RequestContext {
@@ -4,9 +4,16 @@ package api.v1;
4
4
 
5
5
  option go_package = "github.com/InHuman-Resources/Backend/Go/proto/gen/api/v1;apiv1";
6
6
 
7
+ // api.v1 versioning: prefer additive field/RPC changes; never renumber fields.
8
+
7
9
  import "api/v1/common.proto";
8
10
 
9
- // CompanyService is the client-facing company management service.
11
+ // CompanyService company profile, membership, and onboarding for company users.
12
+ //
13
+ // Business context: company record updates, member invites and roles, and step-based
14
+ // company onboarding aligned with auth-owned onboarding state. Not hiring pipeline data.
15
+ // Next upgrades: new onboarding steps or compliance fields should be added as optional
16
+ // fields or new RPCs; avoid breaking existing mobile/web clients without a version bump plan.
10
17
  service CompanyService {
11
18
  // Company CRUD
12
19
  rpc GetCompany(GetCompanyRequest) returns (GetCompanyResponse);
@@ -0,0 +1,326 @@
1
+ syntax = "proto3";
2
+
3
+ package api.v1;
4
+
5
+ option go_package = "github.com/InHuman-Resources/Backend/Go/proto/gen/api/v1;apiv1";
6
+
7
+ // =============================================================================
8
+ // api.v1 public contract — versioning and evolution (HiringService)
9
+ // =============================================================================
10
+ // Clients (web, mobile) MUST call only this package via the API gateway. Do not
11
+ // import or call private hiring.v1 from product apps.
12
+ //
13
+ // Evolution policy until a deliberate major bump:
14
+ // - Prefer additive changes only: new optional fields, new RPCs. Never renumber or
15
+ // recycle field tags; reserve deprecated fields if you must stop using them.
16
+ // - Run `make proto-gen` and buf breaking change checks before releases that alter
17
+ // protos (see proto/AGENTS.md).
18
+ // - Next upgrades (roadmap): workflow orchestration may cause the gateway to perform
19
+ // additional side effects (e.g. signal Temporal) on some RPCs while keeping the
20
+ // same api.v1 signatures; auth-sensitive operations may gain stricter permission
21
+ // errors from the hiring service without contract changes.
22
+ // - A future api.v2 would only be introduced for incompatible reshapes (new service
23
+ // splits, renamed RPCs); until then, extend api.v1 additively.
24
+
25
+ // HiringService — public hiring surface for the product.
26
+ //
27
+ // Business context: companies create and publish jobs; candidates discover open
28
+ // roles and apply; recruiters manage the pipeline (stages, decisions, screening
29
+ // outcomes, interviews, assessment links, offers). Authoritative state lives in the
30
+ // hiring service; the gateway authenticates and forwards; authorization is enforced
31
+ // downstream (company tenant vs candidate).
32
+ service HiringService {
33
+ // Recruiter: create an internal draft job for the authenticated company.
34
+ rpc CreateJob(CreateJobRequest) returns (CreateJobResponse);
35
+ // Recruiter: make a draft job visible to candidates (requires public_slug set server-side).
36
+ rpc PublishJob(PublishJobRequest) returns (PublishJobResponse);
37
+ // Candidate: submit an application to a published job (idempotent per candidate+job server-side).
38
+ rpc ApplyToJob(ApplyToJobRequest) returns (ApplyToJobResponse);
39
+
40
+ // Read job details. Published jobs are visible broadly; drafts only to owning company.
41
+ rpc GetJob(GetJobRequest) returns (GetJobResponse);
42
+ // Read application — candidate sees own; company sees applications for their jobs.
43
+ rpc GetApplication(GetApplicationRequest) returns (GetApplicationResponse);
44
+
45
+ // Recruiter: paginated jobs for the current company (optional status filter).
46
+ rpc ListJobs(ListJobsRequest) returns (ListJobsResponse);
47
+ // Published job search (e.g. job board). Authenticated; filter by query string.
48
+ rpc SearchJobs(SearchJobsRequest) returns (SearchJobsResponse);
49
+ // Recruiter: update editable fields on a company-owned job.
50
+ rpc UpdateJob(UpdateJobRequest) returns (UpdateJobResponse);
51
+ // Recruiter: stop accepting new applications for a job.
52
+ rpc CloseJob(CloseJobRequest) returns (CloseJobResponse);
53
+
54
+ // Candidate: all applications for the token user (pagination).
55
+ rpc ListMyApplications(ListMyApplicationsRequest) returns (ListMyApplicationsResponse);
56
+ // Recruiter: company-wide application inbox across jobs (filters optional).
57
+ rpc ListApplications(ListApplicationsRequest) returns (ListApplicationsResponse);
58
+ // Recruiter: applications for one job (must own the job).
59
+ rpc ListApplicationsForJob(ListApplicationsForJobRequest) returns (ListApplicationsForJobResponse);
60
+
61
+ // Recruiter: move pipeline stage following the server’s allowed transition graph; append-only audit.
62
+ // Future: gateway may also trigger workflow signals; hiring remains source of truth for stage.
63
+ rpc TransitionApplicationStage(TransitionApplicationStageRequest) returns (TransitionApplicationStageResponse);
64
+ // Recruiter: record a structured human decision (approve/reject/etc.) with reasoning.
65
+ rpc RecordRecruiterDecision(RecordRecruiterDecisionRequest) returns (RecordRecruiterDecisionResponse);
66
+ // Recruiter: store hiring-owned screening summary (scores/explanation/skills); not the AI model.
67
+ rpc RecordScreeningResult(RecordScreeningResultRequest) returns (RecordScreeningResultResponse);
68
+ // Recruiter: attach interview facts (times, notes, transcript ref, structured scores JSON).
69
+ rpc RecordInterview(RecordInterviewRequest) returns (RecordInterviewResponse);
70
+ // Recruiter: link an external assessment id and status/score summary; assessment content lives elsewhere.
71
+ rpc LinkAssessment(LinkAssessmentRequest) returns (LinkAssessmentResponse);
72
+ // Recruiter: create/update offer terms and status for an application.
73
+ rpc RecordOffer(RecordOfferRequest) returns (RecordOfferResponse);
74
+
75
+ // Audit/history timeline for one application (candidate or owning company).
76
+ rpc ListApplicationEvents(ListApplicationEventsRequest) returns (ListApplicationEventsResponse);
77
+ }
78
+
79
+ message PageRequest {
80
+ int32 page_size = 1;
81
+ string page_token = 2;
82
+ }
83
+
84
+ message PageResponse {
85
+ string next_page_token = 1;
86
+ }
87
+
88
+ message CreateJobRequest {
89
+ string title = 1;
90
+ string description = 2;
91
+ string public_slug = 3;
92
+ }
93
+
94
+ message CreateJobResponse {
95
+ string job_id = 1;
96
+ }
97
+
98
+ message PublishJobRequest {
99
+ string job_id = 1;
100
+ }
101
+
102
+ message PublishJobResponse {
103
+ string status = 1;
104
+ }
105
+
106
+ message ApplyToJobRequest {
107
+ string job_id = 1;
108
+ }
109
+
110
+ message ApplyToJobResponse {
111
+ string application_id = 1;
112
+ }
113
+
114
+ message GetJobRequest {
115
+ string job_id = 1;
116
+ }
117
+
118
+ message Job {
119
+ string job_id = 1;
120
+ string company_id = 2;
121
+ string title = 3;
122
+ string description = 4;
123
+ string status = 5;
124
+ string public_slug = 6;
125
+ string requirements = 7;
126
+ string team_metadata_json = 8;
127
+ string created_at = 9;
128
+ string updated_at = 10;
129
+ }
130
+
131
+ message GetJobResponse {
132
+ string job_id = 1;
133
+ string company_id = 2;
134
+ string title = 3;
135
+ string description = 4;
136
+ string status = 5;
137
+ string public_slug = 6;
138
+ string requirements = 7;
139
+ string team_metadata_json = 8;
140
+ string created_at = 9;
141
+ string updated_at = 10;
142
+ }
143
+
144
+ message ListJobsRequest {
145
+ string status_filter = 1;
146
+ PageRequest page = 2;
147
+ }
148
+
149
+ message ListJobsResponse {
150
+ repeated Job jobs = 1;
151
+ PageResponse page = 2;
152
+ }
153
+
154
+ message SearchJobsRequest {
155
+ string query = 1;
156
+ PageRequest page = 2;
157
+ }
158
+
159
+ message SearchJobsResponse {
160
+ repeated Job jobs = 1;
161
+ PageResponse page = 2;
162
+ }
163
+
164
+ message UpdateJobRequest {
165
+ string job_id = 1;
166
+ string title = 2;
167
+ string description = 3;
168
+ string public_slug = 4;
169
+ string requirements = 5;
170
+ string team_metadata_json = 6;
171
+ }
172
+
173
+ message UpdateJobResponse {
174
+ Job job = 1;
175
+ }
176
+
177
+ message CloseJobRequest {
178
+ string job_id = 1;
179
+ }
180
+
181
+ message CloseJobResponse {
182
+ string status = 1;
183
+ }
184
+
185
+ message Application {
186
+ string application_id = 1;
187
+ string job_id = 2;
188
+ string candidate_user_id = 3;
189
+ string current_stage = 4;
190
+ string applied_at = 5;
191
+ string job_title = 6;
192
+ string company_id = 7;
193
+ }
194
+
195
+ message GetApplicationRequest {
196
+ string application_id = 1;
197
+ }
198
+
199
+ message GetApplicationResponse {
200
+ string application_id = 1;
201
+ string job_id = 2;
202
+ string candidate_user_id = 3;
203
+ string current_stage = 4;
204
+ string applied_at = 5;
205
+ string requirements = 6;
206
+ string team_metadata_json = 7;
207
+ }
208
+
209
+ message ListMyApplicationsRequest {
210
+ PageRequest page = 1;
211
+ }
212
+
213
+ message ListMyApplicationsResponse {
214
+ repeated Application applications = 1;
215
+ PageResponse page = 2;
216
+ }
217
+
218
+ message ListApplicationsRequest {
219
+ string status_filter = 1;
220
+ string stage_filter = 2;
221
+ PageRequest page = 3;
222
+ }
223
+
224
+ message ListApplicationsResponse {
225
+ repeated Application applications = 1;
226
+ PageResponse page = 2;
227
+ }
228
+
229
+ message ListApplicationsForJobRequest {
230
+ string job_id = 1;
231
+ PageRequest page = 2;
232
+ }
233
+
234
+ message ListApplicationsForJobResponse {
235
+ repeated Application applications = 1;
236
+ PageResponse page = 2;
237
+ }
238
+
239
+ message TransitionApplicationStageRequest {
240
+ string application_id = 1;
241
+ string target_stage = 2;
242
+ string reason = 3;
243
+ }
244
+
245
+ message TransitionApplicationStageResponse {
246
+ string current_stage = 1;
247
+ }
248
+
249
+ message RecordRecruiterDecisionRequest {
250
+ string application_id = 1;
251
+ string stage_context = 2;
252
+ string outcome = 3;
253
+ string reasoning = 4;
254
+ }
255
+
256
+ message RecordRecruiterDecisionResponse {
257
+ string decision_id = 1;
258
+ }
259
+
260
+ message RecordScreeningResultRequest {
261
+ string application_id = 1;
262
+ double score = 2;
263
+ string explanation = 3;
264
+ string skill_extractions_json = 4;
265
+ string source_model_id = 5;
266
+ string raw_output_ref = 6;
267
+ }
268
+
269
+ message RecordScreeningResultResponse {
270
+ string screening_result_id = 1;
271
+ }
272
+
273
+ message RecordInterviewRequest {
274
+ string application_id = 1;
275
+ string scheduled_at = 2;
276
+ string actual_at = 3;
277
+ string notes = 4;
278
+ string transcript_ref = 5;
279
+ string structured_scores_json = 6;
280
+ }
281
+
282
+ message RecordInterviewResponse {
283
+ string interview_record_id = 1;
284
+ }
285
+
286
+ message LinkAssessmentRequest {
287
+ string application_id = 1;
288
+ string external_assessment_id = 2;
289
+ string status = 3;
290
+ string score_summary = 4;
291
+ }
292
+
293
+ message LinkAssessmentResponse {
294
+ string assessment_link_id = 1;
295
+ }
296
+
297
+ message RecordOfferRequest {
298
+ string application_id = 1;
299
+ string terms = 2;
300
+ string status = 3;
301
+ }
302
+
303
+ message RecordOfferResponse {
304
+ string offer_id = 1;
305
+ }
306
+
307
+ message ApplicationEvent {
308
+ string event_id = 1;
309
+ string application_id = 2;
310
+ string from_stage = 3;
311
+ string to_stage = 4;
312
+ string actor_type = 5;
313
+ string actor_user_id = 6;
314
+ string metadata_json = 7;
315
+ string created_at = 8;
316
+ }
317
+
318
+ message ListApplicationEventsRequest {
319
+ string application_id = 1;
320
+ PageRequest page = 2;
321
+ }
322
+
323
+ message ListApplicationEventsResponse {
324
+ repeated ApplicationEvent events = 1;
325
+ PageResponse page = 2;
326
+ }