@servicetitan/docs-uikit 39.2.0 → 40.0.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.
@@ -3,6 +3,34 @@ title: BREAKING CHANGES
3
3
  sidebar_position: 0
4
4
  ---
5
5
 
6
+ ## v40.0.0
7
+
8
+ ### [@servicetitan/install](./install)
9
+
10
+ - Enforces a minimum release age of `3` days for non-`@servicetitan` packages by default on npm (`>=11.10.0`), and warns if pnpm doesn't configure `minimumReleaseAge` in `pnpm-workspace.yaml`. This can delay installing a package version published within the last `3` days.
11
+
12
+ To opt out, configure `min-release-age`/`minimumReleaseAge` directly in your project. See [Minimum Release Age](./install#minimum-release-age).
13
+
14
+ ### [@servicetitan/launchdarkly-service](./launchdarkly-service.mdx)
15
+
16
+ - Updated `launchdarkly-js-client-sdk` to `3.9.5` and `launchdarkly-react-client-sdk` to `3.9.4`.
17
+
18
+ `startup review`'s `require-compatible-launch-darkly-sdk` fails for any project using the older versions. Run `npx startup review --fix` to update them.
19
+
20
+ ### [@servicetitan/startup](./startup/)
21
+
22
+ - Added the `require-min-release-age` review rule, enabled by default at `error` severity. Projects without a configured minimum release age will now fail `startup review`.
23
+
24
+ Run `npx startup review --fix` to configure it automatically, or set the rule to `"warn"` or `"off"` in `package.json`. See [require-min-release-age](./startup/review#require-min-release-age).
25
+
26
+ - Requires npm `10` or `>=11.17.0` (previously `>=10`). Projects on npm 11 must upgrade to `11.17.0` or later, since `min-release-age-exclude` isn't recognized before that version.
27
+
28
+ - Upgraded **lerna** from v9 to v10.
29
+
30
+ If your project calls `lerna version` or `lerna publish` directly, and the checkout is behind its remote, CI runs now fail with `EBEHIND` (previously this check only applied outside of CI). Pass `--ci-behind-behavior=skip`, or set `command.version.ciBehindBehavior` in `lerna.json`, to restore the old behavior.
31
+
32
+ See the [lerna CHANGELOG](https://github.com/lerna/lerna/blob/main/CHANGELOG.md) for the full list of changes.
33
+
6
34
  ## v39.0.0
7
35
 
8
36
  ### [@servicetitan/launchdarkly-service](./launchdarkly-service.mdx)
@@ -119,7 +119,7 @@ const { cleanup, setServiceContext } = init({
119
119
  },
120
120
  },
121
121
  application: {
122
- // optional — first caller wins; ignored if a host already initialized
122
+ // optional: ignored when a host offered or already started an application
123
123
  applicationId: '<TASK_HUB_APPLICATION_ID>',
124
124
  clientToken: '<TASK_HUB_CLIENT_TOKEN>',
125
125
  env: window.location.hostname,
@@ -152,7 +152,7 @@ Each app or MFE has a **service name** used to attribute every RUM event to its
152
152
 
153
153
  Registers a service and, optionally, initializes the Datadog RUM SDK. Returns a [`RumServiceRegistration`](#rumserviceregistration) — `{ cleanup, setServiceContext }`, both bound to this service.
154
154
 
155
- Any caller — host or MFE — may pass `application`. The first call that includes it initializes the SDK and becomes the SDK initializer; subsequent callers' `application` config is ignored with a warning. Callers that omit `application` register their service without attempting SDK init.
155
+ Any caller — host or MFE — may pass `application`. The first `application` passed wins, and a later caller's `application` config is ignored. The SDK starts on the first call that asks for a session, which is not always the call that supplied the winning `application`. Callers that omit `application` register their service without attempting SDK init.
156
156
 
157
157
  ```ts
158
158
  import { init } from '@servicetitan/datadog-rum';
@@ -198,7 +198,7 @@ cleanup();
198
198
  | Name | Type | Description |
199
199
  | :------------ | :---------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
200
200
  | `service` | [`ServiceConfig`](#serviceconfig) | Per-service handlers and tracing URL matchers |
201
- | `application` | [`ApplicationConfig`](#applicationconfig) | (optional) SDK initialization config; first caller wins |
201
+ | `application` | [`ApplicationConfig`](#applicationconfig) | (optional) SDK initialization config. See [`init`](#init) for which caller starts the session |
202
202
  | `enabled` | `boolean` | (optional) Controls whether Datadog RUM data collection is turned on. Defaults to `true`. Set this instead of gating the `init` call to allow [runtime enablement for development](#dev-runtime-enable). |
203
203
 
204
204
  ##### `RumServiceRegistration` {#rumserviceregistration}
@@ -242,7 +242,7 @@ Where:
242
242
  - `ServiceBeforeSendHandler` is `(event: RumEvent, context: RumEventDomainContext) => void`.
243
243
 
244
244
  :::caution
245
- `excludedActivityUrls` tells RUM which URLs not to count toward view-loading time. The exclusion applies app-wide; the first `application` config locks the list, so the host should set the complete list there. If an MFE set it, its choices would distort view metrics for the host and any other MFEs sharing the session.
245
+ `excludedActivityUrls` tells RUM which URLs not to count toward view-loading time. The exclusion applies app-wide; the `application` config that starts the session locks the list, so the host should set the complete list there. If an MFE set it, its choices would distort view metrics for the host and any other MFEs sharing the session.
246
246
  :::
247
247
 
248
248
  ### `useRumService`
package/docs/install.mdx CHANGED
@@ -60,6 +60,8 @@ In npm projects `@servicetitan/install` blocks untrusted packages from running a
60
60
 
61
61
  Projects that depend on `@servicetitan/startup` automatically trust a small built-in allowlist of packages. Projects that don't depend on `@servicetitan/startup` trust only the packages listed explicitly via `--allow-scripts`.
62
62
 
63
+ Each built-in allowlist entry is pinned to a maximum audited version. If an installed package's version exceeds it, the package is treated the same as an unaudited package: excluded from the allowlist and shown in the warning below, until the maximum is reviewed and updated.
64
+
63
65
  ```
64
66
  WARNING: The following packages have untrusted install scripts.
65
67
  Review and add trusted packages to --allow-scripts:
@@ -92,6 +94,28 @@ npx --yes @servicetitan/install --no-allow-scripts
92
94
 
93
95
  pnpm blocks install scripts by default and emits a "Ignored build scripts" warning for packages whose scripts were skipped and must be approved.
94
96
 
97
+ ## Minimum Release Age
98
+
99
+ To reduce exposure to supply-chain attacks, both npm (`>=11.10.0`) and pnpm (`>=10.16.0`) can be configured to require packages to have been published for a minimum number of days before they can be installed. We recommend that projects configure a minimum release age of at least `3` days.
100
+
101
+ ### npm projects
102
+
103
+ If a project hasn't configured its own [`min-release-age`](https://docs.npmjs.com/cli/v11/using-npm/config#min-release-age), `@servicetitan/install` runs `npm` with `3`-day default (excluding `@servicetitan/*` packages). Once a project configures its own `min-release-age`, `@servicetitan/install` defers to it entirely.
104
+
105
+ On npm versions older than `11.10.0`, `@servicetitan/install` warns and installs without release age protection:
106
+
107
+ ```
108
+ WARNING: npm 10.9.0 does not support minimum release age protection. Installing without it.
109
+ ```
110
+
111
+ ### pnpm projects
112
+
113
+ pnpm has no per-invocation flag for minimum release age; it must be configured directly in `pnpm-workspace.yaml`. If the project doesn't configure [`minimumReleaseAge`](https://pnpm.io/settings/dependency-resolution#minimumreleaseage), `@servicetitan/install` warns and installs without release age protection
114
+
115
+ ```
116
+ WARNING: this project does not enforce a minimum release age for pnpm installs. Configure minimumReleaseAge in pnpm-workspace.yaml.
117
+ ```
118
+
95
119
  ## Configuring NPM Token in Development
96
120
 
97
121
  In development environments, `@servicetitan/install` automatically configures an npm authentication token that grants access to private ServiceTitan packages. It securely retrieves the token and updates your npm configuration so you can install dependencies without any further setup.
@@ -44,7 +44,7 @@ and automatically [provides a store](#use-flags-in-mobx-store) that allows flag
44
44
  To configure additional [`LDOptions`](https://launchdarkly.github.io/js-client-sdk/interfaces/LDOptions.html) (for example, inspectors that forward flag evaluations to Datadog RUM), pass them to [`LDServiceProvider`](#ldserviceprovider) at the host level. They apply to every nested `LDProvider`.
45
45
 
46
46
  :::caution
47
- When a `context` is provided, only the initial value takes affect. Subsequent calls with the same client-side ID reuse the client that was created with the initial context.
47
+ When a `context` is provided, only the initial value takes effect. Subsequent calls with the same client-side ID reuse the client that was created with the initial context.
48
48
 
49
49
  This is typically only a problem when different code paths call `LDProvider` with different contexts. To avoid this, create a standard `LDProvider` wrapper for each project (see example below).
50
50
  If that isn't practical, you can use [`getContext`](https://launchdarkly.github.io/js-client-sdk/interfaces/LDClient.html#getContext) and [`identify`](https://launchdarkly.github.io/js-client-sdk/interfaces/LDClient.html#identify) to fetch and amend the active context.
@@ -195,6 +195,11 @@ The `LDService` interface enables [headless bundles](./microfrontends/developing
195
195
  ```ts
196
196
  export interface LDService {
197
197
  getClient: (config: ClientConfig) => LDClient;
198
+ getVersionClient?: (
199
+ version: string,
200
+ config: ClientConfig,
201
+ createClient: (config: ClientConfig) => LDClient
202
+ ) => LDClient;
198
203
  application?: LDApplication;
199
204
  options?: Omit<LDOptions, 'application'>;
200
205
  }
@@ -208,6 +213,11 @@ export interface ClientConfig {
208
213
 
209
214
  #### getClient
210
215
 
216
+ :::note
217
+ Prefer the top-level [`getClient`](#getclient-helper) helper function over calling `ldService.getClient` directly.
218
+ It uses [`getVersionClient`](#getversionclient) when `ldService` supports it.
219
+ :::
220
+
211
221
  Returns an `LDClient` instance configured with the following parameters.
212
222
 
213
223
  | Name | Type | Description |
@@ -216,6 +226,11 @@ Returns an `LDClient` instance configured with the following parameters.
216
226
  | `context` | `object` | Context for targeting rules. |
217
227
  | `options` | `LDOptions` | (Optional) LaunchDarkly initialization options. |
218
228
 
229
+ #### getVersionClient
230
+
231
+ Like `getClient`, but lets hosts and MFEs on different `launchdarkly-js-client-sdk` versions share one client per `version` and `clientSideID`.
232
+ This function is for provider authors. Most code should call the top-level [`getClient`](#getclient-helper) helper function instead of calling `ldService.getVersionClient` directly.
233
+
219
234
  #### application
220
235
 
221
236
  Optional [LDApplication](#ldapplication) that was passed to [LDServiceProvider](#ldserviceprovider).
@@ -224,6 +239,29 @@ Optional [LDApplication](#ldapplication) that was passed to [LDServiceProvider](
224
239
 
225
240
  Optional default `LDOptions` (excluding `application`) that were passed to [LDServiceProvider](#ldserviceprovider). Applied to every [LDProvider](#ldprovider) within the host.
226
241
 
242
+ ### getClient {#getclient-helper}
243
+
244
+ Returns an `LDClient` for the given [`ClientConfig`](#ldservice), using the injected [`LDService`](#ldservice) when one is available. [Headless bundles](./microfrontends/developing/headless-bundle) should call this instead of calling `ldService.getClient` directly.
245
+
246
+ ```ts title="src/headless.ts"
247
+ import { getClient } from '@servicetitan/launchdarkly-service';
248
+ import type { HeadlessCallback } from '@servicetitan/web-components';
249
+
250
+ export const connectedCallback: HeadlessCallback<{ userId: string }> = ({ ldService, mfeData }) => {
251
+ const client = getClient(ldService, {
252
+ clientSideID: '669fe6e5cc97eb103be7a620',
253
+ context: { kind: 'user', key: mfeData.userId },
254
+ });
255
+ };
256
+ ```
257
+
258
+ #### Parameters
259
+
260
+ | Name | Type | Description |
261
+ | :---------- | :--------------------------- | :---------------------------------------------- |
262
+ | `ldService` | `LDService \| undefined` | The injected [`LDService`](#ldservice), if any. |
263
+ | `config` | [`ClientConfig`](#ldservice) | Configuration for the client. |
264
+
227
265
  ### FeatureFlagStore
228
266
 
229
267
  `LDProvider` automatically provides a `FeatureFlagStore` that allows you to access
@@ -447,6 +447,48 @@ npm pkg set sideEffects=false -w @servicetitan/package
447
447
 
448
448
  ---
449
449
 
450
+ ### require-min-release-age
451
+
452
+ Ensures the project enforces a minimum release age of at least `3` days.
453
+
454
+ This reduces exposure to supply-chain attacks by giving the community time to detect and take down malicious packages.
455
+
456
+ :::note
457
+ This rule is skipped when the project's npm (`<11.10.0`) or pnpm (`<10.16.0`) version doesn't support minimum release age.
458
+ :::
459
+
460
+ #### ✅ Autofix
461
+
462
+ This rule supports autofix. For npm projects, it runs
463
+
464
+ ```sh
465
+ npm config set --location=project min-release-age=3
466
+ ```
467
+
468
+ For pnpm projects, it runs
469
+
470
+ ```sh
471
+ pnpm config set --location=project minimumReleaseAge 4320
472
+ ```
473
+
474
+ If no exclusion is already configured, the fix also adds one for `@servicetitan` packages. For npm,
475
+
476
+ ```sh
477
+ npm config set --location=project 'min-release-age-exclude=@servicetitan/*'
478
+ ```
479
+
480
+ :::caution
481
+ `npx` has a bug where it ignores `min-release-age-exclude` ([npm/cli#9765](https://github.com/npm/cli/issues/9765)). Once a project sets `min-release-age`, `npx --yes @servicetitan/install` can resolve to an older version despite being excluded. Only bootstrap is affected: `npx startup` and other commands using an already-installed local copy aren't.
482
+ :::
483
+
484
+ Or, for pnpm,
485
+
486
+ ```sh
487
+ pnpm config set --location=project --json minimumReleaseAgeExclude '["@servicetitan/*"]'
488
+ ```
489
+
490
+ ---
491
+
450
492
  ### require-npmrc
451
493
 
452
494
  Checks that your project contains a `.npmrc` file with the following required and recommended settings:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/docs-uikit",
3
- "version": "39.2.0",
3
+ "version": "40.0.0",
4
4
  "description": "Documentation content for Uikit packages published at docs.st.dev",
5
5
  "repository": {
6
6
  "type": "git",