clients/libs/scheduling
Jonathan Prusik 2c2067388a
[PM-33139] Targeting Rules initial implementation (#19693)
* create the FillAssistTargetingRules feature flag

* create TargetingRulesService

* move TargetingRulesService functionality into DomainSettingsService

* use targeting rules to qualify relevant fields

* add user autofill settings toggle for Fill Assist feature

* add feature flag check to getTargetingRulesForUrl

* add TargetingRulesDataService to update local state from data source

* enable the server to specify an override URI for targeting rules data

* add working data shape

* update data shape

* update logic to match new data shape expectations

* switch from hostname to host to support port inclusions

* add resource cache-buster

* do not update meta timestamp on resource fetch failure

* consolidate email and password update category to account update

* update targeting rules maps consumer logic

* add tests

* add support for host unicode key lookup

* cleanup

* address missing www-prefixed punycode URI case handling

* reduce targeting rules data fetching interval to 6 hours

* add punycode overflow guard and other edges

* cleanup

* add state handling for environment switching

* move constants

* update logic to match provider changes

* codify targeting rules form category requirement

* remove targeting rules totp implementation

* refactor targeting rules storage to key off resource domain

* use constants instead of string literals in cipher to field mapping

* add some basic schema validation
2026-04-13 16:35:20 -05:00
..
src [PM-33139] Targeting Rules initial implementation (#19693) 2026-04-13 16:35:20 -05:00
eslint.config.mjs refactor(scheduling): extract @bitwarden/scheduling Nx leaf library (#19771) 2026-03-27 11:23:22 +00:00
jest.config.js refactor(scheduling): extract @bitwarden/scheduling Nx leaf library (#19771) 2026-03-27 11:23:22 +00:00
package.json refactor(scheduling): extract @bitwarden/scheduling Nx leaf library (#19771) 2026-03-27 11:23:22 +00:00
project.json refactor(scheduling): extract @bitwarden/scheduling Nx leaf library (#19771) 2026-03-27 11:23:22 +00:00
README.md refactor(scheduling): extract @bitwarden/scheduling Nx leaf library (#19771) 2026-03-27 11:23:22 +00:00
tsconfig.eslint.json refactor(scheduling): extract @bitwarden/scheduling Nx leaf library (#19771) 2026-03-27 11:23:22 +00:00
tsconfig.json refactor(scheduling): extract @bitwarden/scheduling Nx leaf library (#19771) 2026-03-27 11:23:22 +00:00
tsconfig.lib.json refactor(scheduling): extract @bitwarden/scheduling Nx leaf library (#19771) 2026-03-27 11:23:22 +00:00
tsconfig.spec.json refactor(scheduling): extract @bitwarden/scheduling Nx leaf library (#19771) 2026-03-27 11:23:22 +00:00

@bitwarden/scheduling

Owned by: platform

Background task scheduling infrastructure for Bitwarden clients.

Overview

This library provides the shared abstractions for scheduling recurring and one-shot background tasks across Bitwarden client platforms. It defines a common contract that each platform implements according to its own execution model — for example, browser extensions use chrome.alarms because service workers can be killed at any time, while desktop and CLI clients use standard setTimeout/setInterval.

Key Abstractions

TaskSchedulerService — The abstract service interface that all scheduling consumers depend on. Platform packages provide their own concrete implementations; nothing in this library should be imported to fulfill this contract at runtime.

DefaultTaskSchedulerService — The concrete implementation backed by globalThis.setTimeout and globalThis.setInterval. This is the scheduler used by the desktop and CLI clients, where a persistent process can be relied upon.

ScheduledTaskName — A const object enumerating every named scheduled task in the monorepo (e.g., loginStrategySessionTimeout, vaultTimeoutCheckInterval, eventUploadsInterval). All tasks must be registered here to ensure unique, trackable identifiers across platforms.

toScheduler() — A utility that bridges TaskSchedulerService to the RxJS SchedulerLike interface, enabling use with RxJS operators such as timer.

Platform Extensions

Platform-specific scheduler implementations live outside this library in their respective app packages. The browser implementation (apps/browser/src/_background/services/browser-task-scheduler.service.ts) is the primary example — it wraps chrome.alarms to survive service worker lifecycle events. Adding a new platform scheduler means implementing TaskSchedulerService and registering it in that platform's dependency injection setup.

Backward Compatibility

The original source location at libs/common/src/platform/scheduling/ has been retained as a re-export shim so that existing imports continue to resolve without requiring a bulk migration. New code should import directly from @bitwarden/scheduling.