@ionite/redis-core 0.0.23-beta.20260812.6 → 0.0.23-beta.20260820.2

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +17 -42
  2. package/dist/index.js +2268 -11
  3. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -25,7 +25,7 @@ interface RedisAdapter {
25
25
  srem(key: string, ...members: string[]): Promise<void>;
26
26
  smembers(key: string): Promise<string[]>;
27
27
  mget(keys: string[]): Promise<(string | null)[]>;
28
- /** Optional Redis Pub/Sub publisher used by distributed LFV callback transports. */
28
+ /** Optional Redis Pub/Sub publisher used by reactive Redis integrations. */
29
29
  publish?(channel: string, message: string): Promise<void>;
30
30
  /**
31
31
  * Optional Redis Pub/Sub subscription. Implementations MUST use a dedicated subscriber connection
@@ -33,9 +33,8 @@ interface RedisAdapter {
33
33
  */
34
34
  subscribeChannel?(channel: string, listener: (message: string) => void): Promise<() => void | Promise<void>>;
35
35
  /**
36
- * Optional: atomically get a key's value and delete it (Redis `GETDEL`, 6.2+). When implemented,
37
- * the magic-link store uses it for a truly atomic single-use consume; otherwise it falls back to
38
- * a best-effort get-then-del.
36
+ * Optional: atomically get a key's value and delete it (Redis `GETDEL`, 6.2+). Required by the LFV
37
+ * OTP mailbox and used by the magic-link store for truly atomic single-use consumption.
39
38
  */
40
39
  getdel?(key: string): Promise<string | null>;
41
40
  /**
@@ -151,22 +150,14 @@ declare class RedisAccessCatalogStore implements AccessCatalogStore {
151
150
  * already live there; use this store only when Redis IS the app's resource storage).
152
151
  *
153
152
  * `set`/`delete` emit the `changed` signal after the durable write lands, driving the SDK's
154
- * adjacency-cache invalidation, targeted reconcile, and incremental OAA projection. Provide
155
- * `deriveEntitlements`/`resolveEntitlement` to expose resource-derived entitlement Groups.
153
+ * adjacency-cache invalidation, targeted reconcile, and incremental OAA projection.
156
154
  */
157
155
  declare class RedisResourceStore implements ResourceProvider {
158
156
  private readonly redis;
159
157
  private readonly prefix;
160
158
  private readonly log;
161
159
  private readonly listeners;
162
- entitlements?: (resource: Resource) => Group[];
163
- entitlement?: (id: string) => Promise<Group | undefined>;
164
- constructor(options: RedisStoreOptions & {
165
- /** Pure derivation of a resource's requestable entitlement Groups (see {@link ResourceProvider.entitlements}). */
166
- deriveEntitlements?: (resource: Resource) => Group[];
167
- /** Reverse resolution of a resource-derived entitlement id (see {@link ResourceProvider.entitlement}). */
168
- resolveEntitlement?: (id: string, get: (resourceId: string) => Promise<Resource | undefined>) => Promise<Group | undefined>;
169
- });
160
+ constructor(options: RedisStoreOptions);
170
161
  private key;
171
162
  private entityKey;
172
163
  private idsSetKey;
@@ -329,31 +320,6 @@ declare function createEvalshaRunner(client: {
329
320
  eval(script: string, keys: string[], args: string[]): Promise<unknown>;
330
321
  evalsha(sha: string, keys: string[], args: string[]): Promise<unknown>;
331
322
  }): (script: string, keys: string[], args: string[]) => Promise<unknown>;
332
- import { IamDeltaIdMapKey, IamDeltaIdMapStore } from "@ionite/core";
333
- type RedisIamDeltaIdMapStoreOptions = RedisStoreOptions & {
334
- /**
335
- * TTL (seconds) applied to each id-map entry so abandoned externalId mappings (deleted resources,
336
- * decommissioned destinations) self-evict instead of accumulating forever (§6.7). Each `set`
337
- * refreshes the TTL, so actively-used mappings persist. Pass `0` to disable expiry.
338
- */
339
- idMapTtlSeconds?: number;
340
- };
341
- /**
342
- * Redis-backed {@link IamDeltaIdMapStore}. Durable externalId -> destination provider-id cache for
343
- * IAM delta `'patch'` egress, shared across app instances and surviving restarts so the patch
344
- * adapter resolves each resource once and reuses the id thereafter (self-healing on stale ids is
345
- * handled by the adapter via `delete` + re-resolve).
346
- */
347
- declare class RedisIamDeltaIdMapStore implements IamDeltaIdMapStore {
348
- private readonly redis;
349
- private readonly prefix;
350
- private readonly ttlSeconds;
351
- constructor(options: RedisIamDeltaIdMapStoreOptions);
352
- private key;
353
- get(key: IamDeltaIdMapKey): Promise<string | undefined>;
354
- set(key: IamDeltaIdMapKey, providerId: string): Promise<void>;
355
- delete(key: IamDeltaIdMapKey): Promise<void>;
356
- }
357
323
  import { Logger as Logger2, SecretsOperationOptions, SecretsSubscriptionOptions } from "@ionite/core";
358
324
  /**
359
325
  * Options shared by the client-specific `ionRedis(...)` factories in `@ionite/redis` and
@@ -387,8 +353,9 @@ type RedisLfvTransportOptions = {
387
353
  logger?: Logger3;
388
354
  };
389
355
  /**
390
- * Distributes original signed LFV callback envelopes through Redis Pub/Sub. Redis is a transport,
391
- * never a trust anchor: every receiving LFV source verifies the envelope against its own JWKS.
356
+ * Parks signed LFV OTP callback envelopes in Redis for single-consume retrieval by the process that
357
+ * initiated the request. Redis is a transport, never a trust anchor: the consumer verifies the
358
+ * envelope against its own JWKS. Values always carry a bounded TTL.
392
359
  */
393
360
  declare function createRedisLfvTransport(adapter: RedisAdapter, options?: RedisLfvTransportOptions): LfvCallbackTransport;
394
361
  /** Default page size applied to a paginated `list()` when the caller omits `limit` (§7.3). */
@@ -433,6 +400,12 @@ type ReactiveRedisOptions<TSecret> = {
433
400
  endpointOf?: (secret: Secret<TSecret>) => string;
434
401
  };
435
402
  type ReactiveRedisAdapter = RedisAdapter & {
403
+ /**
404
+ * Always present on the reactive adapter (verified against the live client at call time), so
405
+ * synchronous capability checks such as `createRedisLfvTransport`'s pass at module scope.
406
+ */
407
+ publish(channel: string, message: string): Promise<void>;
408
+ subscribeChannel(channel: string, listener: (message: string) => void): Promise<() => void | Promise<void>>;
436
409
  ready(timeout?: number): Promise<void>;
437
410
  isReady(): boolean;
438
411
  close(): Promise<void>;
@@ -481,7 +454,9 @@ declare class RedisUserStore<TExtended = Record<string, never>> implements UserS
481
454
  private entityKey;
482
455
  private idsSetKey;
483
456
  private nameIndexKey;
457
+ private externalIdIndexKey;
484
458
  get(sub: string): Promise<BaseUser2<TExtended> | undefined>;
459
+ getByExternalId(externalId: string): Promise<BaseUser2<TExtended> | undefined>;
485
460
  lookup(user: BaseUser2<TExtended>): Promise<BaseUser2<TExtended> | undefined>;
486
461
  upsert(user: BaseUser2<TExtended>): Promise<BaseUser2<TExtended>>;
487
462
  delete(sub: string): Promise<number>;
@@ -522,4 +497,4 @@ declare class RedisWorkloadTokenStore<TExtended = object> implements WorkloadTok
522
497
  isValid(workload_id: string): Promise<boolean>;
523
498
  cleanup(): Promise<void>;
524
499
  }
525
- export { supportsRunScript, splitIonRedisSecret, scriptSha1, prefixedKey, getLogger, getKeyPrefix, encodeKeyId, createRedisLfvTransport, createReactiveRedis, createEvalshaRunner, chunkedMget, atomicCreate, atomicCompareAndSet, RedisWorkloadTokenStore, RedisWorkloadIdentityStoreOptions, RedisWorkloadIdentityStore, RedisUserStoreOptions, RedisUserStore, RedisTxn, RedisTenantStoreOptions, RedisTenantStore, RedisStoreOptions, RedisSessionStore, RedisResourceStore, RedisMagicLinkStore, RedisLfvTransportOptions, RedisIamDeltaIdMapStoreOptions, RedisIamDeltaIdMapStore, RedisCustomerStoreOptions, RedisCustomerStore, RedisAdapter, RedisAccessIndex, RedisAccessCatalogStore, RedisAccessAssignmentStore, ReactiveRedisOptions, ReactiveRedisClient, ReactiveRedisAdapter, MAX_LIST_LIMIT, IonRedisOptions, DEFAULT_MGET_CHUNK_SIZE, DEFAULT_LIST_LIMIT, AtomicCreateResult, AtomicCompareAndSetResult };
500
+ export { supportsRunScript, splitIonRedisSecret, scriptSha1, prefixedKey, getLogger, getKeyPrefix, encodeKeyId, createRedisLfvTransport, createReactiveRedis, createEvalshaRunner, chunkedMget, atomicCreate, atomicCompareAndSet, RedisWorkloadTokenStore, RedisWorkloadIdentityStoreOptions, RedisWorkloadIdentityStore, RedisUserStoreOptions, RedisUserStore, RedisTxn, RedisTenantStoreOptions, RedisTenantStore, RedisStoreOptions, RedisSessionStore, RedisResourceStore, RedisMagicLinkStore, RedisLfvTransportOptions, RedisCustomerStoreOptions, RedisCustomerStore, RedisAdapter, RedisAccessIndex, RedisAccessCatalogStore, RedisAccessAssignmentStore, ReactiveRedisOptions, ReactiveRedisClient, ReactiveRedisAdapter, MAX_LIST_LIMIT, IonRedisOptions, DEFAULT_MGET_CHUNK_SIZE, DEFAULT_LIST_LIMIT, AtomicCreateResult, AtomicCompareAndSetResult };