@curviate/sdk 0.12.0 → 0.13.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.
- package/CHANGELOG.md +40 -0
- package/dist/index.d.ts +345 -234
- package/dist/index.js +102 -37
- package/package.json +1 -1
- package/src/generated/types.ts +236 -190
package/dist/index.js
CHANGED
|
@@ -76,6 +76,7 @@ var KNOWN_CODES = /* @__PURE__ */ new Set([
|
|
|
76
76
|
"PAYLOAD_TOO_LARGE",
|
|
77
77
|
"ACCOUNT_NOT_FOUND",
|
|
78
78
|
"ACCOUNT_RESTRICTED",
|
|
79
|
+
"ACCOUNT_ALREADY_LINKED",
|
|
79
80
|
"RESOURCE_NOT_FOUND",
|
|
80
81
|
"RESOURCE_ACCESS_RESTRICTED",
|
|
81
82
|
"TIER_NOT_ACTIVE",
|
|
@@ -332,7 +333,20 @@ var AccountsResource = class {
|
|
|
332
333
|
* Connect a LinkedIn account to an empty seat.
|
|
333
334
|
*
|
|
334
335
|
* Returns an account (201) or a checkpoint challenge (202) when LinkedIn
|
|
335
|
-
* requires verification. Callers discriminate on `result.object
|
|
336
|
+
* requires verification. Callers discriminate on `result.object`; resolve a
|
|
337
|
+
* 202 with {@link solveCheckpoint} (code) or {@link pollCheckpoint}
|
|
338
|
+
* (mobile-app approval).
|
|
339
|
+
*
|
|
340
|
+
* For `auth_method: "cookie"`, `user_agent` is **required** — connecting by
|
|
341
|
+
* session cookie without one is rejected with `INVALID_REQUEST`. It stays
|
|
342
|
+
* optional for `auth_method: "credentials"`.
|
|
343
|
+
*
|
|
344
|
+
* On a 201 account, `recovered` is `true` only when the connect reclaimed a
|
|
345
|
+
* LinkedIn identity already present on the workspace (claiming it into your
|
|
346
|
+
* account) rather than connecting a brand-new one — it is absent on a normal
|
|
347
|
+
* connect. Its `status` reflects the account's real observed state: as well as
|
|
348
|
+
* `active` it may be `reconnect_needed`, `restricted`, or `disconnected` (a
|
|
349
|
+
* recovered identity often needs a reconnect).
|
|
336
350
|
*/
|
|
337
351
|
link(body) {
|
|
338
352
|
return this.ctx.request({
|
|
@@ -342,45 +356,75 @@ var AccountsResource = class {
|
|
|
342
356
|
});
|
|
343
357
|
}
|
|
344
358
|
/**
|
|
345
|
-
*
|
|
359
|
+
* Solve a checkpoint challenge by submitting an OTP or 2FA code.
|
|
360
|
+
*
|
|
361
|
+
* The account is addressed by `accountId` (the provisional `account_id`
|
|
362
|
+
* returned on the 202 `checkpoint_required` response); the body carries the
|
|
363
|
+
* `code`. Returns the connected account (201) or, when LinkedIn chains a
|
|
364
|
+
* second challenge, another checkpoint (202) — resolve that one with a
|
|
365
|
+
* further `solveCheckpoint` call for the same `accountId`.
|
|
366
|
+
*
|
|
367
|
+
* On the 201 account, `recovered` is `true` only when solving the challenge
|
|
368
|
+
* reclaimed a LinkedIn identity already present on the workspace (rather than
|
|
369
|
+
* connecting a brand-new one); it is absent otherwise. Its `status` reflects
|
|
370
|
+
* the account's real observed state — as well as `active` it may be
|
|
371
|
+
* `reconnect_needed`, `restricted`, or `disconnected`.
|
|
372
|
+
*
|
|
373
|
+
* @param accountId - the provisional `account_id` from the 202 response.
|
|
374
|
+
* @param body - the verification `code`.
|
|
346
375
|
*/
|
|
347
|
-
|
|
376
|
+
solveCheckpoint(accountId, body) {
|
|
348
377
|
return this.ctx.request({
|
|
349
378
|
method: "POST",
|
|
350
|
-
path:
|
|
379
|
+
path: `/v1/accounts/${accountId}/checkpoint/solve`,
|
|
351
380
|
body
|
|
352
381
|
});
|
|
353
382
|
}
|
|
354
383
|
/**
|
|
355
|
-
*
|
|
384
|
+
* Re-request the pending verification challenge notification for an account.
|
|
385
|
+
*
|
|
386
|
+
* Useful when the end user says they never received the code or push
|
|
387
|
+
* notification for a pending checkpoint. `resent` echoes the outcome
|
|
388
|
+
* honestly: `true` once the notification was actually re-sent, `false` when
|
|
389
|
+
* there was nothing to re-send for that challenge type (this call never
|
|
390
|
+
* throws just because a re-send wasn't applicable). Does not reset the
|
|
391
|
+
* checkpoint's expiry.
|
|
392
|
+
*
|
|
393
|
+
* @param accountId - the provisional `account_id` from the 202 response.
|
|
356
394
|
*/
|
|
357
|
-
|
|
395
|
+
requestCheckpoint(accountId) {
|
|
358
396
|
return this.ctx.request({
|
|
359
397
|
method: "POST",
|
|
360
|
-
path:
|
|
361
|
-
body
|
|
398
|
+
path: `/v1/accounts/${accountId}/checkpoint/request`
|
|
362
399
|
});
|
|
363
400
|
}
|
|
364
401
|
/**
|
|
365
|
-
*
|
|
402
|
+
* Poll for mobile-app approval of a pending checkpoint challenge.
|
|
366
403
|
*
|
|
367
|
-
*
|
|
368
|
-
*
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
* the
|
|
404
|
+
* The account is addressed by `accountId` (the provisional `account_id`
|
|
405
|
+
* from the 202 response). `status` is `pending` until the end user approves
|
|
406
|
+
* on their device, then `active` (the account is connected), or
|
|
407
|
+
* `expired` / `failed`. Poll until it leaves `pending`.
|
|
408
|
+
*
|
|
409
|
+
* On `status: "expired"` (the approval timed out), the response carries
|
|
410
|
+
* `challenge_type` (`"mobile_app_approval"`) and a human-readable
|
|
411
|
+
* `recovery_hint` — the actionable next step — so a client can render the
|
|
412
|
+
* right recovery guidance without parsing prose.
|
|
413
|
+
*
|
|
414
|
+
* @param accountId - the provisional `account_id` from the 202 response.
|
|
373
415
|
*/
|
|
374
|
-
|
|
416
|
+
pollCheckpoint(accountId) {
|
|
375
417
|
return this.ctx.request({
|
|
376
418
|
method: "POST",
|
|
377
|
-
path:
|
|
378
|
-
body
|
|
419
|
+
path: `/v1/accounts/${accountId}/checkpoint/poll`
|
|
379
420
|
});
|
|
380
421
|
}
|
|
381
422
|
/**
|
|
382
|
-
* Generate a one-time hosted connection link the end user opens to authorize
|
|
383
|
-
* LinkedIn connection without credentials transiting the API or LLM
|
|
423
|
+
* Generate a one-time hosted connection link the end user opens to authorize
|
|
424
|
+
* a new LinkedIn connection without credentials transiting the API or LLM
|
|
425
|
+
* context. Poll completion with {@link getConnectSession} using the returned
|
|
426
|
+
* `session_id`. To re-authorize an existing account, use
|
|
427
|
+
* {@link createReconnectLink} instead.
|
|
384
428
|
*/
|
|
385
429
|
createConnectLink(body) {
|
|
386
430
|
return this.ctx.request({
|
|
@@ -390,8 +434,25 @@ var AccountsResource = class {
|
|
|
390
434
|
});
|
|
391
435
|
}
|
|
392
436
|
/**
|
|
393
|
-
*
|
|
394
|
-
*
|
|
437
|
+
* Generate a one-time hosted **re-authorization** link for an existing
|
|
438
|
+
* account that became disconnected — the hosted counterpart of
|
|
439
|
+
* {@link reconnect}. The end user opens the returned `url`; poll completion
|
|
440
|
+
* with {@link getConnectSession} using the returned `session_id`. The account
|
|
441
|
+
* keeps its `account_id` and seat.
|
|
442
|
+
*
|
|
443
|
+
* @param accountId - the account to re-authorize.
|
|
444
|
+
* @param body - optional `expires_in_seconds` and `redirect_url`.
|
|
445
|
+
*/
|
|
446
|
+
createReconnectLink(accountId, body) {
|
|
447
|
+
return this.ctx.request({
|
|
448
|
+
method: "POST",
|
|
449
|
+
path: `/v1/accounts/${accountId}/reconnect-link`,
|
|
450
|
+
...body !== void 0 ? { body } : {}
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Poll a hosted connect session minted by {@link createConnectLink} or
|
|
455
|
+
* {@link createReconnectLink} (its `session_id`).
|
|
395
456
|
*
|
|
396
457
|
* A pure status read — it makes no external call and does not itself complete
|
|
397
458
|
* the connection. `status` is `pending` until the end user finishes the
|
|
@@ -413,10 +474,11 @@ var AccountsResource = class {
|
|
|
413
474
|
* seat this account occupies, `null` for an admin seatless account).
|
|
414
475
|
*
|
|
415
476
|
* This is a stale-while-revalidate read — it always returns immediately
|
|
416
|
-
* from the cached row (never blocks on a live substrate call)
|
|
417
|
-
*
|
|
418
|
-
*
|
|
419
|
-
* `
|
|
477
|
+
* from the cached row (never blocks on a live substrate call). The cached
|
|
478
|
+
* enrichment fields `full_name` and `substrate_created_at` are populated by
|
|
479
|
+
* a background enrichment pass; `username`, `premium_id`,
|
|
480
|
+
* `public_identifier`, `signatures`, and `groups` are not sourced on the
|
|
481
|
+
* current connection surface and read `null`/`[]`.
|
|
420
482
|
*/
|
|
421
483
|
get(accountId) {
|
|
422
484
|
return this.ctx.request({
|
|
@@ -425,7 +487,13 @@ var AccountsResource = class {
|
|
|
425
487
|
});
|
|
426
488
|
}
|
|
427
489
|
/**
|
|
428
|
-
* Re-authorize a disconnected account in place (same account_id
|
|
490
|
+
* Re-authorize a disconnected account in place (same `account_id`, same
|
|
491
|
+
* seat). Returns the reconnected account (200) or a checkpoint challenge
|
|
492
|
+
* (202) when LinkedIn requires verification — resolve a 202 with
|
|
493
|
+
* {@link solveCheckpoint} / {@link pollCheckpoint}, exactly like {@link link}.
|
|
494
|
+
*
|
|
495
|
+
* For `auth_method: "cookie"`, `user_agent` is **required** (as on
|
|
496
|
+
* {@link link}). For the hosted re-auth flow, use {@link createReconnectLink}.
|
|
429
497
|
*/
|
|
430
498
|
reconnect(accountId, body) {
|
|
431
499
|
return this.ctx.request({
|
|
@@ -435,16 +503,13 @@ var AccountsResource = class {
|
|
|
435
503
|
});
|
|
436
504
|
}
|
|
437
505
|
/**
|
|
438
|
-
*
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
}
|
|
446
|
-
/**
|
|
447
|
-
* Update managed-proxy configuration for an account.
|
|
506
|
+
* Update an account's configuration.
|
|
507
|
+
*
|
|
508
|
+
* `metadata` is a flat string→string map that **replaces** the account's
|
|
509
|
+
* custom-data store wholesale (keys not provided are removed). `proxy` sets a
|
|
510
|
+
* custom egress proxy, or clears it (reverting to automatic proxy protection)
|
|
511
|
+
* when passed as `null`. The `proxy.password`, if given, is stored securely
|
|
512
|
+
* and never returned.
|
|
448
513
|
*/
|
|
449
514
|
update(accountId, body) {
|
|
450
515
|
return this.ctx.request({
|