@cavuno/board 1.20.0 → 1.21.1

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/dist/index.js CHANGED
@@ -149,7 +149,7 @@ async function clearSession(storage) {
149
149
  }
150
150
 
151
151
  // src/version.ts
152
- var SDK_VERSION = "1.20.0";
152
+ var SDK_VERSION = "1.21.1";
153
153
 
154
154
  // src/client.ts
155
155
  function isRawBody(body) {
@@ -1100,6 +1100,414 @@ function meNamespace(client) {
1100
1100
  });
1101
1101
  }
1102
1102
  },
1103
+ /**
1104
+ * The authenticated board user's employer facet (doc 35 / ADR-0052):
1105
+ * claiming/creating a company, the work-email verification state machine,
1106
+ * and editing the company profile. A board user becomes an employer by
1107
+ * claiming a company — the same identity can also be a candidate.
1108
+ */
1109
+ companies: {
1110
+ /**
1111
+ * Search companies on this board to claim.
1112
+ *
1113
+ * @example
1114
+ * const { data } = await board.me.companies.search({ q: 'acme' });
1115
+ */
1116
+ search(query, options) {
1117
+ return client.fetch(
1118
+ "/me/companies/search",
1119
+ { ...options, query }
1120
+ );
1121
+ },
1122
+ /**
1123
+ * List my company memberships, each with its computed claim `status`.
1124
+ *
1125
+ * @example
1126
+ * const { data } = await board.me.companies.list();
1127
+ */
1128
+ list(options) {
1129
+ return client.fetch(
1130
+ "/me/companies",
1131
+ options
1132
+ );
1133
+ },
1134
+ /**
1135
+ * Create (or adopt an existing same-domain) company and open a
1136
+ * membership. Returns the membership.
1137
+ *
1138
+ * @example
1139
+ * await board.me.companies.create({ name: 'Acme', website: 'acme.com' });
1140
+ */
1141
+ create(body, options) {
1142
+ return client.fetch("/me/companies", {
1143
+ ...options,
1144
+ method: "POST",
1145
+ body
1146
+ });
1147
+ },
1148
+ /**
1149
+ * Claim an existing company by slug. Returns the membership with its
1150
+ * computed status (`approved` on email-domain match, else pending).
1151
+ *
1152
+ * @example
1153
+ * await board.me.companies.claim('acme');
1154
+ */
1155
+ claim(slug, options) {
1156
+ return client.fetch(
1157
+ `/me/companies/${encodeURIComponent(slug)}/claim`,
1158
+ { ...options, method: "POST" }
1159
+ );
1160
+ },
1161
+ /**
1162
+ * Cancel my pending claim on a company. Resolves void on success (204).
1163
+ *
1164
+ * @example
1165
+ * await board.me.companies.cancelClaim('acme');
1166
+ */
1167
+ cancelClaim(slug, options) {
1168
+ return client.fetch(
1169
+ `/me/companies/${encodeURIComponent(slug)}/claim`,
1170
+ { ...options, method: "DELETE" }
1171
+ );
1172
+ },
1173
+ /**
1174
+ * Edit my company profile (merge-patch — omitted fields stay
1175
+ * unchanged). Requires an approved membership. Returns the company.
1176
+ *
1177
+ * @example
1178
+ * await board.me.companies.update('acme', { website: 'acme.io' });
1179
+ */
1180
+ update(slug, body, options) {
1181
+ return client.fetch(
1182
+ `/me/companies/${encodeURIComponent(slug)}`,
1183
+ { ...options, method: "PATCH", body }
1184
+ );
1185
+ },
1186
+ /** The work-email verification state machine for a pending claim. */
1187
+ workEmail: {
1188
+ /**
1189
+ * Email a 24h verification link to a work email for my pending claim.
1190
+ * Returns the membership with the work email recorded.
1191
+ *
1192
+ * @example
1193
+ * await board.me.companies.workEmail.verify('acme', {
1194
+ * workEmail: 'me@acme.com',
1195
+ * });
1196
+ */
1197
+ verify(slug, body, options) {
1198
+ return client.fetch(
1199
+ `/me/companies/${encodeURIComponent(slug)}/work-email/verify`,
1200
+ { ...options, method: "POST", body }
1201
+ );
1202
+ },
1203
+ /**
1204
+ * Confirm a verification token (from the email link) — no session
1205
+ * required, the token IS the authorization. Returns the membership in
1206
+ * its new state.
1207
+ *
1208
+ * @example
1209
+ * await board.me.companies.workEmail.confirm('acme', { token });
1210
+ */
1211
+ confirm(slug, body, options) {
1212
+ return client.fetch(
1213
+ `/me/companies/${encodeURIComponent(slug)}/work-email/confirm`,
1214
+ { ...options, method: "POST", body }
1215
+ );
1216
+ }
1217
+ },
1218
+ /**
1219
+ * Manage the jobs of a company I am an approved member of (doc 35 /
1220
+ * ADR-0052). Every method is scoped to the company `slug`. New jobs are
1221
+ * created as held drafts — publishing is `publish` (within a live paid
1222
+ * window) or the paid-post checkout flow.
1223
+ */
1224
+ jobs: {
1225
+ /**
1226
+ * List a company's jobs (all statuses), newest first.
1227
+ *
1228
+ * @example
1229
+ * const { data } = await board.me.companies.jobs.list('acme');
1230
+ */
1231
+ list(slug, query, options) {
1232
+ return client.fetch(
1233
+ `/me/companies/${encodeURIComponent(slug)}/jobs`,
1234
+ { ...options, query }
1235
+ );
1236
+ },
1237
+ /**
1238
+ * Retrieve one of my company's jobs (any status), fully enriched.
1239
+ *
1240
+ * @example
1241
+ * const job = await board.me.companies.jobs.retrieve('acme', jobId);
1242
+ */
1243
+ retrieve(slug, id, options) {
1244
+ return client.fetch(
1245
+ `/me/companies/${encodeURIComponent(slug)}/jobs/${encodeURIComponent(id)}`,
1246
+ options
1247
+ );
1248
+ },
1249
+ /**
1250
+ * Create a job as a held draft. Returns the created job.
1251
+ *
1252
+ * @example
1253
+ * await board.me.companies.jobs.create('acme', {
1254
+ * title: 'Staff Engineer',
1255
+ * description: '…',
1256
+ * applicationUrl: 'https://acme.com/apply',
1257
+ * });
1258
+ */
1259
+ create(slug, body, options) {
1260
+ return client.fetch(
1261
+ `/me/companies/${encodeURIComponent(slug)}/jobs`,
1262
+ { ...options, method: "POST", body }
1263
+ );
1264
+ },
1265
+ /**
1266
+ * Edit a job (merge-patch — omitted fields stay unchanged). Returns the
1267
+ * updated job.
1268
+ *
1269
+ * @example
1270
+ * await board.me.companies.jobs.update('acme', jobId, {
1271
+ * salaryMax: 220000,
1272
+ * });
1273
+ */
1274
+ update(slug, id, body, options) {
1275
+ return client.fetch(
1276
+ `/me/companies/${encodeURIComponent(slug)}/jobs/${encodeURIComponent(id)}`,
1277
+ { ...options, method: "PATCH", body }
1278
+ );
1279
+ },
1280
+ /**
1281
+ * Delete a job (cascade). Resolves void on success (204).
1282
+ *
1283
+ * @example
1284
+ * await board.me.companies.jobs.delete('acme', jobId);
1285
+ */
1286
+ delete(slug, id, options) {
1287
+ return client.fetch(
1288
+ `/me/companies/${encodeURIComponent(slug)}/jobs/${encodeURIComponent(id)}`,
1289
+ { ...options, method: "DELETE" }
1290
+ );
1291
+ },
1292
+ /**
1293
+ * Publish a job that is still inside its paid window (republish — a held
1294
+ * draft or expired job must instead pay via checkout). Returns the
1295
+ * updated job.
1296
+ *
1297
+ * @example
1298
+ * await board.me.companies.jobs.publish('acme', jobId);
1299
+ */
1300
+ publish(slug, id, options) {
1301
+ return client.fetch(
1302
+ `/me/companies/${encodeURIComponent(slug)}/jobs/${encodeURIComponent(id)}/publish`,
1303
+ { ...options, method: "POST" }
1304
+ );
1305
+ },
1306
+ /**
1307
+ * Unpublish a job (back to draft; the paid window is preserved). Returns
1308
+ * the updated job.
1309
+ *
1310
+ * @example
1311
+ * await board.me.companies.jobs.unpublish('acme', jobId);
1312
+ */
1313
+ unpublish(slug, id, options) {
1314
+ return client.fetch(
1315
+ `/me/companies/${encodeURIComponent(slug)}/jobs/${encodeURIComponent(id)}/unpublish`,
1316
+ { ...options, method: "POST" }
1317
+ );
1318
+ },
1319
+ /**
1320
+ * Pay for / publish a held draft (ADR-0031). Select billing: a paid plan
1321
+ * returns `{ status: 'checkout', checkoutUrl }` (send the buyer there;
1322
+ * the webhook publishes on payment); a free / bundle / subscription plan
1323
+ * publishes immediately (`status: 'published'`); an invoice plan emails a
1324
+ * Stripe invoice (`status: 'invoice_sent'`).
1325
+ *
1326
+ * @example
1327
+ * const r = await board.me.companies.jobs.checkout('acme', jobId, {
1328
+ * billing: { type: 'new', planId },
1329
+ * });
1330
+ * if (r.status === 'checkout') location.href = r.checkoutUrl!;
1331
+ */
1332
+ checkout(slug, id, body, options) {
1333
+ return client.fetch(
1334
+ `/me/companies/${encodeURIComponent(slug)}/jobs/${encodeURIComponent(id)}/checkout`,
1335
+ { ...options, method: "POST", body }
1336
+ );
1337
+ }
1338
+ },
1339
+ /**
1340
+ * My reusable billing options for a company — active subscription slots +
1341
+ * remaining pre-purchased (bundle) order slots, the options a held draft
1342
+ * can be published with at no new charge (the checkout `billing.type:
1343
+ * 'order' | 'subscription'`).
1344
+ */
1345
+ billingOptions: {
1346
+ /**
1347
+ * List my reusable billing options for the company.
1348
+ *
1349
+ * @example
1350
+ * const { data } = await board.me.companies.billingOptions.list('acme');
1351
+ */
1352
+ list(slug, options) {
1353
+ return client.fetch(
1354
+ `/me/companies/${encodeURIComponent(slug)}/billing-options`,
1355
+ options
1356
+ );
1357
+ }
1358
+ },
1359
+ /**
1360
+ * The applicant pipeline (ATS) for a company I am an approved member of
1361
+ * (doc 35 / ADR-0052 / ADR-0004). Reads return the full pipeline (job
1362
+ * header + stage rail + applicants with timelines); the move/reject/note
1363
+ * writes resolve void — re-read the pipeline for fresh state, mirroring
1364
+ * the hosted portal's single reactive query.
1365
+ */
1366
+ applicants: {
1367
+ /**
1368
+ * Read a job's applicant pipeline: its header, stage rail, and every
1369
+ * applicant (candidate snapshot, signed resume URL, activity timeline).
1370
+ * `query.job` is required; `query.stage` filters to one stage.
1371
+ *
1372
+ * @example
1373
+ * const pipeline = await board.me.companies.applicants.list('acme', {
1374
+ * job: jobId,
1375
+ * });
1376
+ */
1377
+ list(slug, query, options) {
1378
+ return client.fetch(
1379
+ `/me/companies/${encodeURIComponent(slug)}/applicants`,
1380
+ { ...options, query }
1381
+ );
1382
+ },
1383
+ /**
1384
+ * Move one applicant to a visible stage of its job's pipeline. Resolves
1385
+ * void on success (204).
1386
+ *
1387
+ * @example
1388
+ * await board.me.companies.applicants.move('acme', applicationId, {
1389
+ * stageId,
1390
+ * });
1391
+ */
1392
+ move(slug, applicationId, body, options) {
1393
+ return client.fetch(
1394
+ `/me/companies/${encodeURIComponent(slug)}/applicants/${encodeURIComponent(applicationId)}/stage`,
1395
+ { ...options, method: "PATCH", body }
1396
+ );
1397
+ },
1398
+ /**
1399
+ * Move many applicants of one job to a visible stage atomically.
1400
+ * Resolves void on success (204).
1401
+ *
1402
+ * @example
1403
+ * await board.me.companies.applicants.bulkMove('acme', {
1404
+ * applicationIds, stageId,
1405
+ * });
1406
+ */
1407
+ bulkMove(slug, body, options) {
1408
+ return client.fetch(
1409
+ `/me/companies/${encodeURIComponent(slug)}/applicants/bulk/move`,
1410
+ { ...options, method: "POST", body }
1411
+ );
1412
+ },
1413
+ /**
1414
+ * Reject many applicants of one job atomically (move to the rejected
1415
+ * stage). Resolves void on success (204).
1416
+ *
1417
+ * @example
1418
+ * await board.me.companies.applicants.bulkReject('acme', {
1419
+ * applicationIds,
1420
+ * });
1421
+ */
1422
+ bulkReject(slug, body, options) {
1423
+ return client.fetch(
1424
+ `/me/companies/${encodeURIComponent(slug)}/applicants/bulk/reject`,
1425
+ { ...options, method: "POST", body }
1426
+ );
1427
+ },
1428
+ /**
1429
+ * Append a company-private note to an applicant (it surfaces in the
1430
+ * applicant timeline). Resolves void on success (204).
1431
+ *
1432
+ * @example
1433
+ * await board.me.companies.applicants.addNote('acme', applicationId, {
1434
+ * body: 'Strong candidate.',
1435
+ * });
1436
+ */
1437
+ addNote(slug, applicationId, body, options) {
1438
+ return client.fetch(
1439
+ `/me/companies/${encodeURIComponent(slug)}/applicants/${encodeURIComponent(applicationId)}/notes`,
1440
+ { ...options, method: "POST", body }
1441
+ );
1442
+ }
1443
+ },
1444
+ /**
1445
+ * The pipeline stage rail (ATS) for a company I am an approved member of.
1446
+ * Every write resolves void (the backing portal mutations return void) —
1447
+ * re-read the pipeline via `applicants.list` for the fresh stage rail.
1448
+ */
1449
+ pipelineStages: {
1450
+ /**
1451
+ * Add a custom stage to a job pipeline (before the terminal
1452
+ * Hired/Rejected stages; up to 10 custom per job). Resolves void (204).
1453
+ *
1454
+ * @example
1455
+ * await board.me.companies.pipelineStages.create('acme', {
1456
+ * jobId, label: 'Phone screen',
1457
+ * });
1458
+ */
1459
+ create(slug, body, options) {
1460
+ return client.fetch(
1461
+ `/me/companies/${encodeURIComponent(slug)}/pipeline-stages`,
1462
+ { ...options, method: "POST", body }
1463
+ );
1464
+ },
1465
+ /**
1466
+ * Rename a stage (`{ label }`) or show/hide it (`{ hidden }`) — exactly
1467
+ * one. Resolves void on success (204).
1468
+ *
1469
+ * @example
1470
+ * await board.me.companies.pipelineStages.update('acme', stageId, {
1471
+ * label: 'Tech screen',
1472
+ * });
1473
+ */
1474
+ update(slug, stageId, body, options) {
1475
+ return client.fetch(
1476
+ `/me/companies/${encodeURIComponent(slug)}/pipeline-stages/${encodeURIComponent(stageId)}`,
1477
+ { ...options, method: "PATCH", body }
1478
+ );
1479
+ },
1480
+ /**
1481
+ * Remove a custom stage (protected stages cannot be removed). Resolves
1482
+ * void on success (204).
1483
+ *
1484
+ * @example
1485
+ * await board.me.companies.pipelineStages.remove('acme', stageId);
1486
+ */
1487
+ remove(slug, stageId, options) {
1488
+ return client.fetch(
1489
+ `/me/companies/${encodeURIComponent(slug)}/pipeline-stages/${encodeURIComponent(stageId)}`,
1490
+ { ...options, method: "DELETE" }
1491
+ );
1492
+ },
1493
+ /**
1494
+ * Set the full stage order for a job (list every stage exactly once,
1495
+ * keeping Review first and Hired immediately before Rejected). Resolves
1496
+ * void on success (204).
1497
+ *
1498
+ * @example
1499
+ * await board.me.companies.pipelineStages.reorder('acme', {
1500
+ * jobId, orderedStageIds,
1501
+ * });
1502
+ */
1503
+ reorder(slug, body, options) {
1504
+ return client.fetch(
1505
+ `/me/companies/${encodeURIComponent(slug)}/pipeline-stages/reorder`,
1506
+ { ...options, method: "PUT", body }
1507
+ );
1508
+ }
1509
+ }
1510
+ },
1103
1511
  savedJobs: {
1104
1512
  /**
1105
1513
  * List the authenticated user's saved jobs (each embeds the full