@omnicross/subscriptions 0.1.4 → 0.1.6
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/NOTICE +4 -33
- package/dist/index.cjs +315 -152
- package/dist/index.d.cts +12 -12
- package/dist/index.d.ts +12 -12
- package/dist/index.js +271 -108
- package/dist/oauth.d.cts +1 -5
- package/dist/oauth.d.ts +1 -5
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -80,13 +80,11 @@ interface SubscriptionCredentialStore {
|
|
|
80
80
|
* → sort by `priority` asc → effective `lastUsedAt` asc (LRU) → `createdAt` asc
|
|
81
81
|
* → `[0]`.
|
|
82
82
|
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* constructed at bootstrap and SHARED by all three auth strategies (each scopes
|
|
89
|
-
* its calls by `providerId`), mirroring the single long-lived CRS scheduler.
|
|
83
|
+
* The class holds process-lived state: a session-affinity map and an in-memory
|
|
84
|
+
* `lastUsedAt` overlay. The overlay is seeded from persisted state and advanced
|
|
85
|
+
* to `now` on each selection, so repeated selections rotate fairly even before
|
|
86
|
+
* durable persistence. One instance is constructed at bootstrap and shared by
|
|
87
|
+
* all three auth strategies, with every call scoped by `providerId`.
|
|
90
88
|
*
|
|
91
89
|
* ZERO-REGRESSION CARRIER: `select()` returns `null` when the schedulable account
|
|
92
90
|
* count is ≤ 1. Callers treat `null` (and an `isActive` result) as "use the
|
|
@@ -96,15 +94,17 @@ interface SubscriptionCredentialStore {
|
|
|
96
94
|
* @module scheduler/SubscriptionAccountSelector
|
|
97
95
|
*/
|
|
98
96
|
|
|
99
|
-
/** Sticky session→account affinity TTL (
|
|
97
|
+
/** Sticky session→account affinity TTL (1 hour). */
|
|
100
98
|
declare const SESSION_AFFINITY_TTL_MS = 3600000;
|
|
101
99
|
/** Min gap between best-effort `lastUsedAt` durable persists, per account. */
|
|
102
100
|
declare const LAST_USED_PERSIST_THROTTLE_MS = 60000;
|
|
103
|
-
/** Precedence assumed for an account with no `priority
|
|
101
|
+
/** Precedence assumed for an account with no explicit `priority`. */
|
|
104
102
|
declare const DEFAULT_ACCOUNT_PRIORITY = 50;
|
|
105
103
|
/** One schedulable candidate — the scheduling projection of an account entry. */
|
|
106
104
|
interface SchedulableAccount {
|
|
107
105
|
id: string;
|
|
106
|
+
/** Operator-defined pool group used by resource-level gateway bindings. */
|
|
107
|
+
group?: string;
|
|
108
108
|
/** Default `50` (lower = higher precedence). */
|
|
109
109
|
priority?: number;
|
|
110
110
|
/** ISO — LRU tie-break; absent ⇒ treated as least-recently-used (`0`). */
|
|
@@ -226,9 +226,9 @@ declare class SubscriptionProviderRegistry {
|
|
|
226
226
|
* process singleton, built here and captured by the opencodego profile's
|
|
227
227
|
* `nextFallback` (consult) + `recordModelOutcome` (record) closures. Because
|
|
228
228
|
* the `SubscriptionProviderRegistry` is itself a process singleton (via
|
|
229
|
-
* `setSubscriptionProviderRegistry`), breaker state persists across requests
|
|
230
|
-
*
|
|
231
|
-
*
|
|
229
|
+
* `setSubscriptionProviderRegistry`), breaker state persists across requests.
|
|
230
|
+
* Constructed with the production thresholds (3 / 30s / 3) and the default
|
|
231
|
+
* `Date.now` clock.
|
|
232
232
|
*/
|
|
233
233
|
private readonly breaker;
|
|
234
234
|
constructor(accounts: SubscriptionAccountService, tokens: SubscriptionCredentialStore);
|
package/dist/index.d.ts
CHANGED
|
@@ -80,13 +80,11 @@ interface SubscriptionCredentialStore {
|
|
|
80
80
|
* → sort by `priority` asc → effective `lastUsedAt` asc (LRU) → `createdAt` asc
|
|
81
81
|
* → `[0]`.
|
|
82
82
|
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* constructed at bootstrap and SHARED by all three auth strategies (each scopes
|
|
89
|
-
* its calls by `providerId`), mirroring the single long-lived CRS scheduler.
|
|
83
|
+
* The class holds process-lived state: a session-affinity map and an in-memory
|
|
84
|
+
* `lastUsedAt` overlay. The overlay is seeded from persisted state and advanced
|
|
85
|
+
* to `now` on each selection, so repeated selections rotate fairly even before
|
|
86
|
+
* durable persistence. One instance is constructed at bootstrap and shared by
|
|
87
|
+
* all three auth strategies, with every call scoped by `providerId`.
|
|
90
88
|
*
|
|
91
89
|
* ZERO-REGRESSION CARRIER: `select()` returns `null` when the schedulable account
|
|
92
90
|
* count is ≤ 1. Callers treat `null` (and an `isActive` result) as "use the
|
|
@@ -96,15 +94,17 @@ interface SubscriptionCredentialStore {
|
|
|
96
94
|
* @module scheduler/SubscriptionAccountSelector
|
|
97
95
|
*/
|
|
98
96
|
|
|
99
|
-
/** Sticky session→account affinity TTL (
|
|
97
|
+
/** Sticky session→account affinity TTL (1 hour). */
|
|
100
98
|
declare const SESSION_AFFINITY_TTL_MS = 3600000;
|
|
101
99
|
/** Min gap between best-effort `lastUsedAt` durable persists, per account. */
|
|
102
100
|
declare const LAST_USED_PERSIST_THROTTLE_MS = 60000;
|
|
103
|
-
/** Precedence assumed for an account with no `priority
|
|
101
|
+
/** Precedence assumed for an account with no explicit `priority`. */
|
|
104
102
|
declare const DEFAULT_ACCOUNT_PRIORITY = 50;
|
|
105
103
|
/** One schedulable candidate — the scheduling projection of an account entry. */
|
|
106
104
|
interface SchedulableAccount {
|
|
107
105
|
id: string;
|
|
106
|
+
/** Operator-defined pool group used by resource-level gateway bindings. */
|
|
107
|
+
group?: string;
|
|
108
108
|
/** Default `50` (lower = higher precedence). */
|
|
109
109
|
priority?: number;
|
|
110
110
|
/** ISO — LRU tie-break; absent ⇒ treated as least-recently-used (`0`). */
|
|
@@ -226,9 +226,9 @@ declare class SubscriptionProviderRegistry {
|
|
|
226
226
|
* process singleton, built here and captured by the opencodego profile's
|
|
227
227
|
* `nextFallback` (consult) + `recordModelOutcome` (record) closures. Because
|
|
228
228
|
* the `SubscriptionProviderRegistry` is itself a process singleton (via
|
|
229
|
-
* `setSubscriptionProviderRegistry`), breaker state persists across requests
|
|
230
|
-
*
|
|
231
|
-
*
|
|
229
|
+
* `setSubscriptionProviderRegistry`), breaker state persists across requests.
|
|
230
|
+
* Constructed with the production thresholds (3 / 30s / 3) and the default
|
|
231
|
+
* `Date.now` clock.
|
|
232
232
|
*/
|
|
233
233
|
private readonly breaker;
|
|
234
234
|
constructor(accounts: SubscriptionAccountService, tokens: SubscriptionCredentialStore);
|