@revturbine/sdk 0.5.0 → 0.6.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.
@@ -32,7 +32,7 @@
32
32
  * return { props: { rtPayload: payload } };
33
33
  * ```
34
34
  */
35
- import type { ClientSessionResult, CreateClientSessionInput, RevTurbineServerOptions, ServerEvaluationPayload, ServerEvaluationPayloadDecisionsItem, ServerEvaluationPayloadEntitlementsValue, ServerEvaluationPayloadTrialStatus, ServerEvaluationRequest, ServerPlacementRequest } from './types';
35
+ import type { ClientSessionResult, CreateClientSessionInput, RevTurbineServerOptions } from './types';
36
36
  /**
37
37
  * Error thrown when a client-session mint request is rejected by the control
38
38
  * plane. Carries only the HTTP status and a correlation id — deliberately never
@@ -72,40 +72,6 @@ export declare class RevTurbineServer {
72
72
  get clientSessions(): {
73
73
  create: (input: CreateClientSessionInput) => Promise<ClientSessionResult>;
74
74
  };
75
- /**
76
- * Evaluate placement decisions, entitlements, and context for a user.
77
- *
78
- * Returns a `ServerEvaluationPayload` that can be serialized and sent
79
- * to the client for hydration.
80
- */
81
- evaluate(request: ServerEvaluationRequest): Promise<ServerEvaluationPayload>;
82
- /**
83
- * Evaluate a single placement.
84
- */
85
- getPlacement(userId: string, placement: ServerPlacementRequest, traits?: Record<string, unknown>): Promise<ServerEvaluationPayloadDecisionsItem>;
86
- /**
87
- * Check a single entitlement for a user.
88
- */
89
- checkEntitlement(userId: string, handle: string, context?: {
90
- used?: number;
91
- balance?: number;
92
- requiredTier?: string;
93
- }): Promise<ServerEvaluationPayloadEntitlementsValue>;
94
- /**
95
- * Check whether a user can do something — the advertised `can` alias of
96
- * {@link checkEntitlement}. Declared for the `server` surface in the scaffold
97
- * SDK function-surface manifest (`@revt-eng/core` `SDK_FUNCTION_SURFACE`), so
98
- * the hero-API verb is consistent across the web and server SDKs.
99
- */
100
- can(userId: string, handle: string, context?: {
101
- used?: number;
102
- balance?: number;
103
- requiredTier?: string;
104
- }): Promise<ServerEvaluationPayloadEntitlementsValue>;
105
- /**
106
- * Fetch trial status for a user.
107
- */
108
- getTrialStatus(userId: string): Promise<ServerEvaluationPayloadTrialStatus>;
109
75
  /**
110
76
  * Mint a short-lived, opaque per-user client-session token (plan 157).
111
77
  *
@@ -125,11 +91,5 @@ export declare class RevTurbineServer {
125
91
  createClientSession(input: CreateClientSessionInput): Promise<ClientSessionResult>;
126
92
  private apiCall;
127
93
  private apiGet;
128
- private evaluatePlacements;
129
- private evaluatePlacementsBatch;
130
- private evaluateEntitlements;
131
- private fetchTrialStatus;
132
- private fetchUserContext;
133
- private fetchTheme;
134
94
  }
135
95
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../server-node/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EAExB,uBAAuB,EACvB,uBAAuB,EACvB,oCAAoC,EACpC,wCAAwC,EACxC,kCAAkC,EAElC,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,SAAS,CAAC;AASjB;;;;;GAKG;AACH,qBAAa,4BAA6B,SAAQ,KAAK;IAEnD,iDAAiD;IACjD,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,6CAA6C;IAC7C,QAAQ,CAAC,SAAS,EAAE,MAAM;;IAH1B,iDAAiD;IACxC,MAAM,EAAE,MAAM;IACvB,6CAA6C;IACpC,SAAS,EAAE,MAAM;CAK7B;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAS;IAC3C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA0B;gBAEtC,OAAO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version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../server-node/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EAExB,uBAAuB,EAQxB,MAAM,SAAS,CAAC;AASjB;;;;;GAKG;AACH,qBAAa,4BAA6B,SAAQ,KAAK;IAEnD,iDAAiD;IACjD,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,6CAA6C;IAC7C,QAAQ,CAAC,SAAS,EAAE,MAAM;;IAH1B,iDAAiD;IACxC,MAAM,EAAE,MAAM;IACvB,6CAA6C;IACpC,SAAS,EAAE,MAAM;CAK7B;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAS;IAC3C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA0B;gBAEtC,OAAO,EAAE,uBAAuB;IAQ5C;;;;;;;;;;;OAWG;IACH,IAAI,cAAc,IAAI;QACpB,MAAM,EAAE,CAAC,KAAK,EAAE,wBAAwB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;KAC3E,CAEA;IAED;;;;;;;;;;;;;;;OAeG;IACG,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,mBAAmB,CAAC;YAoB1E,OAAO;YAaP,MAAM;CAWrB"}
@@ -1,12 +1,22 @@
1
1
  /**
2
2
  * @module @revt-eng/sdk/server-node
3
3
  *
4
- * Server-side evaluation SDK for RevTurbine.
4
+ * Server-side support for RevTurbine on Node.
5
5
  *
6
- * Use `RevTurbineServer` to pre-evaluate placement decisions, entitlements,
7
- * and user context on the server. The resulting `ServerEvaluationPayload`
8
- * can be serialized into your page props and consumed by the client-side SDK
9
- * via `sdk.hydrate(payload)`.
6
+ * **Evaluation does not happen here.** It is a pure function of
7
+ * (UserContext, Playbook) and runs in the customer SDKs there is no hosted
8
+ * decision endpoint (plan 192). For local server-side evaluation use
9
+ * `LocalEvaluationServer`, which fetches a Playbook and evaluates in-process.
10
+ *
11
+ * `RevTurbineServer` is now a **client-session minter**: it exchanges your
12
+ * secret key for a short-lived, browser-safe `rt_client_` token that the
13
+ * client SDK's `clientSession` callback consumes to ingest server-derived
14
+ * plan, trial, and payment state.
15
+ *
16
+ * Its decision methods — `evaluate`, `getPlacement`, `checkEntitlement`,
17
+ * `getTrialStatus` — were REMOVED in plan 194 TASK-9. Every one of them
18
+ * called an endpoint plan 192 deleted, so each had been returning a network
19
+ * error since that shipped.
10
20
  *
11
21
  * @example
12
22
  * ```ts
@@ -18,12 +28,8 @@
18
28
  * endpoint: 'https://edge.example.com',
19
29
  * });
20
30
  *
21
- * const payload = await server.evaluate({
22
- * userId: 'user_123',
23
- * traits: { plan: 'pro' },
24
- * placements: [{ slotId: 'hero_banner' }],
25
- * includeTheme: true,
26
- * });
31
+ * // Hand this to the browser; the client SDK re-mints on expiry.
32
+ * const { token } = await server.createClientSession({ userId: 'user_123' });
27
33
  * ```
28
34
  */
29
35
  export { RevTurbineServer, RevTurbineClientSessionError } from './client';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server-node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,gBAAgB,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAC1E,YAAY,EACV,uBAAuB,EACvB,uBAAuB,EACvB,oCAAoC,EACpC,wCAAwC,EACxC,kCAAkC,EAClC,2BAA2B,EAC3B,kCAAkC,EAClC,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,EACjB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AACpF,YAAY,EAAE,4BAA4B,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAG3F,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,wBAAwB,EACxB,cAAc,EACd,sBAAsB,EACtB,kBAAkB,EAClB,WAAW,EACX,eAAe,GAChB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server-node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,EAAE,gBAAgB,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAC1E,YAAY,EACV,uBAAuB,EACvB,uBAAuB,EACvB,oCAAoC,EACpC,wCAAwC,EACxC,kCAAkC,EAClC,2BAA2B,EAC3B,kCAAkC,EAClC,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,EACjB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AACpF,YAAY,EAAE,4BAA4B,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAG3F,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,wBAAwB,EACxB,cAAc,EACd,sBAAsB,EACtB,kBAAkB,EAClB,WAAW,EACX,eAAe,GAChB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revturbine/sdk",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "RevTurbine customer-facing SDK — placement decisioning, entitlement checks, and usage tracking.",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@11.12.0",
@@ -35,9 +35,9 @@
35
35
  }
36
36
  },
37
37
  "devDependencies": {
38
- "@revt-eng/core": "0.1.202",
39
- "@revt-eng/schema": "0.1.202",
40
- "@revt-eng/schema-external": "0.1.202",
38
+ "@revt-eng/core": "0.1.203",
39
+ "@revt-eng/schema": "0.1.203",
40
+ "@revt-eng/schema-external": "0.1.203",
41
41
  "@types/react": "^19.2.17",
42
42
  "@types/react-dom": "^19.2.3",
43
43
  "openapi-fetch": "^0.17.0",