@curviate/sdk 0.30.0 → 0.32.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 +91 -0
- package/README.md +2 -1
- package/dist/index.d.ts +496 -24
- package/dist/index.js +37 -31
- package/package.json +1 -1
- package/src/generated/types.ts +467 -18
package/dist/index.js
CHANGED
|
@@ -49,31 +49,17 @@ var ERROR_CODES = [
|
|
|
49
49
|
"NO_ACTIVE_SEAT",
|
|
50
50
|
"LINKEDIN_FEATURE_NOT_SUBSCRIBED",
|
|
51
51
|
"BETA_NOT_ENABLED",
|
|
52
|
-
/**
|
|
53
|
-
* @deprecated Replaced by {@link NO_ACTIVE_SEAT}. Product tiers are retired,
|
|
54
|
-
* so no refusal names one any more.
|
|
55
|
-
*
|
|
56
|
-
* STILL EXPORTED ON PURPOSE, and this is not a courtesy: API deployments
|
|
57
|
-
* that predate the seat-based entitlement rollout still emit this code, and
|
|
58
|
-
* a client that stopped recognising it would decode it to `INTERNAL`: a
|
|
59
|
-
* fixable billing refusal arriving as a server fault, against the very
|
|
60
|
-
* deployments most likely to send it. It is withdrawn in the first release
|
|
61
|
-
* after every deployment carries the new contract.
|
|
62
|
-
*
|
|
63
|
-
* Handle both while that is true: `NO_ACTIVE_SEAT` from a current
|
|
64
|
-
* deployment, this from an older one. They mean the same thing to a caller.
|
|
65
|
-
*/
|
|
66
|
-
"TIER_NOT_ACTIVE",
|
|
67
52
|
// Rate limits
|
|
68
53
|
"RATE_LIMIT_ACCOUNT",
|
|
69
54
|
"RATE_LIMIT_TENANT",
|
|
70
55
|
"PLATFORM_RATE_LIMIT",
|
|
71
56
|
// Curviate's OWN account-safety ceiling, not a request-rate limit and not
|
|
72
57
|
// LinkedIn refusing. A 429 that never reached LinkedIn and spent nothing:
|
|
73
|
-
// the budget row named by `budgetRow` is at
|
|
74
|
-
//
|
|
75
|
-
// activity window. Deliberately absent from
|
|
76
|
-
// row's reset can be weeks out, so backing off
|
|
58
|
+
// the budget row named by `budgetRow` is at its ceiling, set by the account's
|
|
59
|
+
// safety policy or else the tenant default (`GET`/`PATCH /v1/safety-policy`),
|
|
60
|
+
// or the account is outside its activity window. Deliberately absent from
|
|
61
|
+
// RETRYABLE_CODES: a monthly row's reset can be weeks out, so backing off
|
|
62
|
+
// is the wrong recovery.
|
|
77
63
|
// Read `resetAt`, `safetyReason` and `safetyHint` instead.
|
|
78
64
|
"BUDGET_EXHAUSTED",
|
|
79
65
|
// Platform errors
|
|
@@ -91,17 +77,6 @@ var ERROR_CODES = [
|
|
|
91
77
|
"CHECKPOINT_ALREADY_RESOLVED",
|
|
92
78
|
"CHECKPOINT_UNSUPPORTED",
|
|
93
79
|
"CONNECTION_IN_PROGRESS",
|
|
94
|
-
/**
|
|
95
|
-
* @deprecated Withdrawn with no replacement. The one-premium conflict it
|
|
96
|
-
* reported cannot be expressed on the current input, because
|
|
97
|
-
* `linkedin_premium` is single-valued.
|
|
98
|
-
*
|
|
99
|
-
* STILL EXPORTED for the same reason as {@link TIER_NOT_ACTIVE}: deployments
|
|
100
|
-
* that predate the connect rework can still emit it, and dropping it early
|
|
101
|
-
* would turn a fixable refusal into `INTERNAL` on exactly those. Withdrawn
|
|
102
|
-
* in the first release after every deployment carries the new contract.
|
|
103
|
-
*/
|
|
104
|
-
"PREMIUM_CONFLICT",
|
|
105
80
|
// A reconnect whose seat-derived scope differs from the account's recorded
|
|
106
81
|
// scope was attempted with cookie auth; a cookie replay cannot change
|
|
107
82
|
// scope, so a full credentials re-authentication is required. user_fixable,
|
|
@@ -182,6 +157,14 @@ var ERROR_CODES = [
|
|
|
182
157
|
// returned by `/v1` billing routes at nine sites; it was previously cited
|
|
183
158
|
// in this file as a code that never reaches a caller, which was wrong.
|
|
184
159
|
"ADMIN_BYPASS",
|
|
160
|
+
// Checkout refused closed (503): Curviate's own seat-price configuration
|
|
161
|
+
// disagrees with the price it displays, so completing checkout would charge
|
|
162
|
+
// an amount you were never shown. A misconfiguration on Curviate's side, not
|
|
163
|
+
// a mistake in the request and not a transient fault: user_fixable false,
|
|
164
|
+
// and a retry fails the same way until Curviate corrects the price. Nothing
|
|
165
|
+
// was charged. Stop and surface it to a human (or support) rather than
|
|
166
|
+
// backing off.
|
|
167
|
+
"STRIPE_DRIFT_DETECTED",
|
|
185
168
|
// Generic
|
|
186
169
|
"INTERNAL"
|
|
187
170
|
];
|
|
@@ -529,6 +512,28 @@ var AccountsResource = class {
|
|
|
529
512
|
...params !== void 0 ? { query: params } : {}
|
|
530
513
|
});
|
|
531
514
|
}
|
|
515
|
+
/**
|
|
516
|
+
* List the workspace's live seats: each `seat_id`, whether an account
|
|
517
|
+
* `occupied` it, and that `account_id` (`null` when free). Not paginated.
|
|
518
|
+
*
|
|
519
|
+
* Only live seats are listed, and an empty seat is listed only when
|
|
520
|
+
* connecting an account to it would be accepted right now. So an empty seat
|
|
521
|
+
* that is provisional, cancelling, on an ended trial, or blocked by billing
|
|
522
|
+
* does not appear, and `items` can be `[]` even though the workspace has
|
|
523
|
+
* seats. Any seat with `occupied: false` is a valid `seat_id` for connecting
|
|
524
|
+
* a new account with `auth.intent`. Carries no billing fields.
|
|
525
|
+
*
|
|
526
|
+
* @returns `{ object: "seat_list", items: { seat_id, occupied, account_id }[] }`.
|
|
527
|
+
*
|
|
528
|
+
* @example
|
|
529
|
+
* const { items } = await curviate.accounts.listSeats();
|
|
530
|
+
* const free = items.find((seat) => !seat.occupied);
|
|
531
|
+
* if (!free) throw new Error("No seat is free to connect to right now (add a seat, or check billing).");
|
|
532
|
+
* await curviate.auth.intent({ seat_id: free.seat_id, auth_method: "cookie", cookie: { li_at }, user_agent });
|
|
533
|
+
*/
|
|
534
|
+
listSeats() {
|
|
535
|
+
return this.ctx.request({ method: "GET", path: "/v1/accounts/seats" });
|
|
536
|
+
}
|
|
532
537
|
/**
|
|
533
538
|
* Return metadata and current state for one connected account, including the
|
|
534
539
|
* central `quotas[]` account-safety view, `account_states[]` and `seat_id`
|
|
@@ -605,7 +610,8 @@ var AuthResource = class {
|
|
|
605
610
|
/**
|
|
606
611
|
* Authenticate a LinkedIn account with credentials or a session cookie.
|
|
607
612
|
*
|
|
608
|
-
* Omit `account_id` to connect a NEW account into an empty seat
|
|
613
|
+
* Omit `account_id` to connect a NEW account into an empty seat (find one
|
|
614
|
+
* with `accounts.listSeats()`: any seat with `occupied: false`); include it
|
|
609
615
|
* to re-authenticate an EXISTING account in place. Returns the account on
|
|
610
616
|
* success (200 re-authenticated in place / 201 new), or a checkpoint
|
|
611
617
|
* challenge (202) when LinkedIn requires verification; resolve it with
|