@opengeni/core 1.4.5-canary.38533006839001 → 2.0.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.
@@ -41,9 +41,12 @@ export type OnePasswordVaultProviderFactory = (input: {
41
41
  }) => Promise<VaultProvider>;
42
42
  export declare function onePasswordCredentialBundle(token: string): Record<string, unknown>;
43
43
  /**
44
- * Decrypts the token of one 1Password connection the caller can see
45
- * (workspace-shared, or personal to `subjectId`). The token goes only to the
46
- * provider factory; it is never logged or returned to a client.
44
+ * Decrypts the token of one 1Password connection the caller can use from
45
+ * `workspaceId`: one in this workspace (shared, or personal to `subjectId`),
46
+ * or one added in another workspace that still serves vaults reached here
47
+ * (the caller's own personal connection, or a shared connection behind an
48
+ * organization vault). The token goes only to the provider factory; it is
49
+ * never logged or returned to a client.
47
50
  */
48
51
  export declare function loadOnePasswordConnectionToken(db: Database, settings: Settings, input: {
49
52
  workspaceId: string;
@@ -90,7 +90,7 @@ export declare function providerPrimaryFieldId(item: Pick<ProviderItemMeta, "typ
90
90
  /**
91
91
  * Deterministic mirror projection. Items are ordered by provider name then
92
92
  * external id before de-duplication, so the same provider state always yields
93
- * the same OpenGeni names; field names are de-duplicated within each item.
93
+ * the same Opengeni names; field names are de-duplicated within each item.
94
94
  */
95
95
  export declare function planProviderMirror(items: readonly ProviderItemMeta[], contentVersion: string | null): ProviderMirrorPlan;
96
96
  /** Sync status for a provider failure; rate limits persist `rateLimitedUntil`. */
@@ -125,3 +125,46 @@ export declare function syncLinkedProviderVault(input: {
125
125
  force?: boolean;
126
126
  now?: () => Date;
127
127
  }): Promise<ProviderVaultSyncResult>;
128
+ /** How stale a linked vault's mirror may be before a search refreshes it. */
129
+ export declare const LINKED_VAULT_SEARCH_MAX_AGE_MS: number;
130
+ /** How stale it may be before a reference that found nothing refreshes it. */
131
+ export declare const LINKED_VAULT_MISS_MAX_AGE_MS: number;
132
+ /** How long a search or resolution waits for refreshes before answering. */
133
+ export declare const LINKED_VAULT_REFRESH_WAIT_MS = 8000;
134
+ /** The vault fields a freshness check needs (a `VaultRow` has them all). */
135
+ export type LinkedVaultFreshness = {
136
+ id: string;
137
+ source: string;
138
+ syncStatus: VaultSyncStatus;
139
+ lastSyncedAt: string | null;
140
+ rateLimitedUntil: string | null;
141
+ updatedAt: string;
142
+ };
143
+ /**
144
+ * Whether a linked vault's mirror is older than `maxAgeMs`. A vault whose last
145
+ * sync failed counts from that failure (it is recorded as `updatedAt`), so a
146
+ * broken connection is retried once per `maxAgeMs`, not on every call. A vault
147
+ * under a provider rate limit is never stale until the limit lifts.
148
+ */
149
+ export declare function linkedVaultNeedsRefresh(vault: LinkedVaultFreshness, maxAgeMs: number, now: Date): boolean;
150
+ /**
151
+ * Bring stale linked vault mirrors up to date, so items added in the provider
152
+ * (for example straight in 1Password) are found without anyone pressing Sync.
153
+ *
154
+ * Each refresh is the ordinary non-forced sync: one `listVaults` call, and an
155
+ * item listing only when the provider says the vault changed. Refreshes of the
156
+ * same vault share one call per process. The caller waits at most `waitMs`;
157
+ * slower refreshes finish in the background and record their own status.
158
+ * Never throws: failures are recorded as the vault's sync status.
159
+ *
160
+ * Returns the ids of the vaults whose mirror changed before the wait ended.
161
+ */
162
+ export declare function refreshStaleLinkedVaults(input: {
163
+ db: Database;
164
+ context: VaultDbContext;
165
+ vaults: readonly LinkedVaultFreshness[];
166
+ providers: VaultProviderRegistry;
167
+ maxAgeMs: number;
168
+ waitMs?: number;
169
+ now?: () => Date;
170
+ }): Promise<string[]>;
@@ -5,7 +5,7 @@ import { type ProviderCallBudget, type VaultProviderRegistry } from "@opengeni/v
5
5
  * Edits of items in a read-write connected vault (OP-3): the change is written
6
6
  * to the provider (1Password `items.get` → patch → `items.put`, with the
7
7
  * mirrored version as the expected version), then the metadata mirror is
8
- * refreshed. Values never touch OpenGeni storage.
8
+ * refreshed. Values never touch Opengeni storage.
9
9
  */
10
10
  /** One field change; the REST `VaultFieldInput` and the agent `secret_save` field both fit. */
11
11
  export interface ProviderFieldChange {
@@ -115,7 +115,6 @@ export declare function resolveGoalModelAdmission(db: Database, settings: Settin
115
115
  onePasswordFakeTokens: boolean;
116
116
  integrationsEnabled: boolean;
117
117
  integrationsStateSecret?: string | undefined;
118
- integrationsOauthShortStateEnabled: boolean;
119
118
  integrationsAllowPrivateNetworkTargets: boolean;
120
119
  privacyOnlyMeAllowed: boolean;
121
120
  privacyWorkspaceDefaultRequired: boolean;