@revturbine/sdk 0.10.9 → 0.10.10

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/dist/index.d.ts CHANGED
@@ -13187,8 +13187,8 @@ declare const PlaybookObjectSchema: z.ZodObject<{
13187
13187
  /**
13188
13188
  * The one canonical config schema. Parses BOTH a canonical Playbook and a legacy
13189
13189
  * `export-config.json` (via `normalizeConfigHeaderInput`) into the canonical
13190
- * Playbook shape, so `ExportedConfigSchema` / `RevTurbineConfigSchema` are true
13191
- * aliases of it. `.meta({ id: 'Playbook' })` rides on this preprocess wrapper
13190
+ * Playbook shape, so `RevTurbineConfigSchema` (and its deprecated
13191
+ * `ExportedConfigSchema` alias) are true aliases of it. `.meta({ id: 'Playbook' })` rides on this preprocess wrapper
13192
13192
  * (the underlying object is id-less) so the OpenAPI / JSON-Schema generators emit
13193
13193
  * a single well-formed `Playbook` component. Introspection that needs `.shape`
13194
13194
  * must read `PlaybookObjectSchema`, not this wrapper.
@@ -17164,6 +17164,50 @@ type JsonObject = {
17164
17164
  [key: string]: JsonValue;
17165
17165
  };
17166
17166
 
17167
+ /**
17168
+ * BL-0156 — `playbook` is the canonical option name; `exportedConfig` is a
17169
+ * deprecated alias.
17170
+ *
17171
+ * "ExportedConfig" is dead vocabulary. Plan 118 renamed the domain object to
17172
+ * **Playbook** and plan 104 renamed the schema type to `RevTurbineConfig`, but
17173
+ * the *option* and *parameter* names that carry a Playbook around core still
17174
+ * spelled it `exportedConfig`. This module is the single place that reconciles
17175
+ * the two spellings, mirroring the plan-257 `publicKey` mechanism:
17176
+ *
17177
+ * - the canonical `playbook` wins whenever it is supplied,
17178
+ * - the deprecated `exportedConfig` is still accepted,
17179
+ * - supplying only the alias emits ONE warning naming the canonical option,
17180
+ * - supplying BOTH with *different* Playbooks throws instead of silently
17181
+ * picking one — that combination is always a caller bug.
17182
+ *
17183
+ * Every read site resolves through `resolvePlaybookOption` /
17184
+ * `requirePlaybookOption`, so the precedence cannot drift per call site.
17185
+ *
17186
+ * **Why the warning is not gated on a development build.** Core's ESLint config
17187
+ * blocks the `process` global outright (`no-restricted-globals`) because core
17188
+ * must run unchanged on edge runtimes and in browsers, so core cannot read
17189
+ * `NODE_ENV` the way `web-sdk/build-mode.ts` does. The warning is therefore
17190
+ * emitted once per runtime in every build — a single line, only for callers
17191
+ * still on the deprecated spelling, and it names the fix.
17192
+ *
17193
+ * Aliases are removed in the minor after the SDK 0.11.0 cascade.
17194
+ */
17195
+
17196
+ /**
17197
+ * An options bag that must carry a Playbook, under either the canonical
17198
+ * `playbook` name or the deprecated `exportedConfig` alias.
17199
+ *
17200
+ * Modelled as a union so TypeScript still requires one of the two, exactly as
17201
+ * the single required property did before the rename.
17202
+ */
17203
+ type PlaybookOption = {
17204
+ playbook: RevTurbineConfig;
17205
+ exportedConfig?: RevTurbineConfig;
17206
+ } | {
17207
+ playbook?: RevTurbineConfig;
17208
+ exportedConfig: RevTurbineConfig;
17209
+ };
17210
+
17167
17211
  /**
17168
17212
  * User context lifecycle — pure functions for building, merging,
17169
17213
  * and deriving targeting state from user context + RevTurbineConfig.
@@ -18118,12 +18162,18 @@ interface LocalPlacementDataset {
18118
18162
  type LocalPlacementEntry = NonNullable<RevTurbineConfig['placements']>[number];
18119
18163
  type LocalPlacementPayload = LocalPlacementEntry['payloads'][number];
18120
18164
  type LocalPlacementSurface = LocalPlacementPayload['surfaces'][number];
18121
- /** Backward-compat JSON entry point. */
18122
- interface StaticPlacementResolverOptions {
18165
+ /** Backward-compat JSON entry point, minus the Playbook. */
18166
+ interface StaticPlacementResolverOptionsBase {
18123
18167
  placements: LocalPlacementDataset;
18124
- exportedConfig: RevTurbineConfig;
18125
18168
  impressionHistory?: ImpressionHistory;
18126
18169
  }
18170
+ /**
18171
+ * Options for {@link createStaticPlacementResolver}.
18172
+ *
18173
+ * The Playbook is supplied as `playbook`; `exportedConfig` is a deprecated
18174
+ * alias removed in the minor after the SDK 0.11.0 cascade (BL-0156).
18175
+ */
18176
+ type StaticPlacementResolverOptions = StaticPlacementResolverOptionsBase & PlaybookOption;
18127
18177
  /**
18128
18178
  * Backward-compat JSON entry. Thin wrapper around the unified
18129
18179
  * `createLocalPlacementResolver`. Use the unified factory directly
@@ -18596,8 +18646,8 @@ declare function createHydrationProviders(options: HydrationAdapterOptions): Any
18596
18646
  * const runtime = new LocalRuntime({
18597
18647
  * tenantId: 'tenant_abc',
18598
18648
  * userId: 'user_123',
18599
- * exportedConfig: myConfig,
18600
- * providers: createStaticProviders({ config: myConfig, planHandle: 'pro' }),
18649
+ * playbook: myPlaybook,
18650
+ * providers: createStaticProviders({ config: myPlaybook, planHandle: 'pro' }),
18601
18651
  * storage: new InMemoryStorage(),
18602
18652
  * });
18603
18653
  *
@@ -18606,18 +18656,21 @@ declare function createHydrationProviders(options: HydrationAdapterOptions): Any
18606
18656
  * ```
18607
18657
  */
18608
18658
 
18609
- interface LocalRuntimeOptions {
18659
+ /**
18660
+ * `LocalRuntimeOptions` minus the Playbook, which arrives through
18661
+ * {@link PlaybookOption} so both the canonical `playbook` name and the
18662
+ * deprecated `exportedConfig` alias are accepted.
18663
+ */
18664
+ interface LocalRuntimeOptionsBase {
18610
18665
  /** Tenant identifier. */
18611
18666
  tenantId: string;
18612
18667
  /** Current user identifier. */
18613
18668
  userId: string;
18614
- /** Full RevTurbineConfig for local resolution. */
18615
- exportedConfig: RevTurbineConfig;
18616
18669
  /** Pre-built domain providers (from createStaticProviders, etc.). */
18617
18670
  providers: AnyDomainProvider[];
18618
18671
  /**
18619
18672
  * Optional pre-built placements dataset. If not provided, derived from
18620
- * `exportedConfig.placements`.
18673
+ * `playbook.placements`.
18621
18674
  */
18622
18675
  placements?: LocalPlacementDataset;
18623
18676
  /**
@@ -18634,6 +18687,14 @@ interface LocalRuntimeOptions {
18634
18687
  /** Interaction tracker options. */
18635
18688
  interactionOptions?: Partial<Pick<InteractionTrackerOptions, 'defaultDismissCooldownMs' | 'defaultRemindLaterMs'>>;
18636
18689
  }
18690
+ /**
18691
+ * Options for {@link LocalRuntime}.
18692
+ *
18693
+ * The Playbook is supplied as `playbook`. The `exportedConfig` spelling is a
18694
+ * deprecated alias kept so consumers can migrate incrementally; it is removed
18695
+ * in the minor after the SDK 0.11.0 cascade (BL-0156).
18696
+ */
18697
+ type LocalRuntimeOptions = LocalRuntimeOptionsBase & PlaybookOption;
18637
18698
  declare class LocalRuntime {
18638
18699
  readonly tenantId: string;
18639
18700
  readonly registry: DomainProviderRegistry;
@@ -18641,7 +18702,7 @@ declare class LocalRuntime {
18641
18702
  readonly interactionTracker: InteractionTracker;
18642
18703
  readonly capEnforcer: CapEnforcer;
18643
18704
  readonly impressionHistory: ImpressionHistory;
18644
- private readonly exportedConfig;
18705
+ private readonly playbook;
18645
18706
  private readonly registeredPlacements;
18646
18707
  private userId;
18647
18708
  constructor(options: LocalRuntimeOptions);
@@ -18713,7 +18774,14 @@ declare class LocalRuntime {
18713
18774
  setUserId(userId: string): void;
18714
18775
  /** Current user ID. */
18715
18776
  getUserId(): string;
18716
- /** Return the active RevTurbineConfig snapshot. */
18777
+ /** Return the active Playbook snapshot. */
18778
+ getPlaybook(): RevTurbineConfig;
18779
+ /**
18780
+ * Return the active Playbook snapshot.
18781
+ *
18782
+ * @deprecated Use {@link LocalRuntime.getPlaybook}. Removed in the minor
18783
+ * after the SDK 0.11.0 cascade (BL-0156).
18784
+ */
18717
18785
  getExportedConfig(): RevTurbineConfig;
18718
18786
  /**
18719
18787
  * Pre-warm caches (impression history, etc.) for synchronous access.