@replanejs/next 0.8.19 → 0.9.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.
- package/README.md +17 -13
- package/dist/index.cjs +9 -21
- package/dist/index.d.cts +3 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -176,18 +176,22 @@ export function ConfigDisplay() {
|
|
|
176
176
|
|
|
177
177
|
## Client Options
|
|
178
178
|
|
|
179
|
-
The `options` prop accepts
|
|
180
|
-
|
|
181
|
-
| Option
|
|
182
|
-
|
|
|
183
|
-
| `baseUrl`
|
|
184
|
-
| `sdkKey`
|
|
185
|
-
| `context`
|
|
186
|
-
| `defaults`
|
|
187
|
-
| `
|
|
188
|
-
| `
|
|
189
|
-
|
|
190
|
-
|
|
179
|
+
The `options` prop accepts the following options:
|
|
180
|
+
|
|
181
|
+
| Option | Type | Required | Description |
|
|
182
|
+
| --------------------- | --------------------- | -------- | ---------------------------------------- |
|
|
183
|
+
| `baseUrl` | `string` | Yes | Replane server URL |
|
|
184
|
+
| `sdkKey` | `string` | Yes | SDK key for authentication |
|
|
185
|
+
| `context` | `Record<string, any>` | No | Default context for override evaluations |
|
|
186
|
+
| `defaults` | `Record<string, any>` | No | Default values if server is unavailable |
|
|
187
|
+
| `connectTimeoutMs` | `number` | No | SDK connection timeout (default: 5000) |
|
|
188
|
+
| `requestTimeoutMs` | `number` | No | Timeout for SSE requests (default: 2000) |
|
|
189
|
+
| `retryDelayMs` | `number` | No | Base delay between retries (default: 200)|
|
|
190
|
+
| `inactivityTimeoutMs` | `number` | No | SSE inactivity timeout (default: 30000) |
|
|
191
|
+
| `fetchFn` | `typeof fetch` | No | Custom fetch implementation |
|
|
192
|
+
| `logger` | `ReplaneLogger` | No | Custom logger (default: console) |
|
|
193
|
+
|
|
194
|
+
See [`@replanejs/sdk` documentation](https://github.com/replane-dev/replane-javascript/tree/main/packages/sdk#api) for more details.
|
|
191
195
|
|
|
192
196
|
## API Reference
|
|
193
197
|
|
|
@@ -235,7 +239,7 @@ Returns the value of a config by name. Re-renders when the config changes.
|
|
|
235
239
|
const theme = useConfig<{ darkMode: boolean }>("theme");
|
|
236
240
|
```
|
|
237
241
|
|
|
238
|
-
#### `useReplane<T>():
|
|
242
|
+
#### `useReplane<T>(): Replane<T>`
|
|
239
243
|
|
|
240
244
|
Returns the Replane client instance for advanced usage.
|
|
241
245
|
|
package/dist/index.cjs
CHANGED
|
@@ -26,7 +26,7 @@ const __replanejs_react = __toESM(require("@replanejs/react"));
|
|
|
26
26
|
const react_jsx_runtime = __toESM(require("react/jsx-runtime"));
|
|
27
27
|
|
|
28
28
|
//#region src/version.ts
|
|
29
|
-
const VERSION = "0.
|
|
29
|
+
const VERSION = "0.9.0";
|
|
30
30
|
const DEFAULT_AGENT = `replane-js-next/${VERSION}`;
|
|
31
31
|
|
|
32
32
|
//#endregion
|
|
@@ -72,16 +72,22 @@ async function ReplaneRoot({ options, children }) {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
//#endregion
|
|
75
|
+
Object.defineProperty(exports, 'Replane', {
|
|
76
|
+
enumerable: true,
|
|
77
|
+
get: function () {
|
|
78
|
+
return __replanejs_react.Replane;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
75
81
|
Object.defineProperty(exports, 'ReplaneError', {
|
|
76
82
|
enumerable: true,
|
|
77
83
|
get: function () {
|
|
78
|
-
return
|
|
84
|
+
return __replanejs_react.ReplaneError;
|
|
79
85
|
}
|
|
80
86
|
});
|
|
81
87
|
Object.defineProperty(exports, 'ReplaneErrorCode', {
|
|
82
88
|
enumerable: true,
|
|
83
89
|
get: function () {
|
|
84
|
-
return
|
|
90
|
+
return __replanejs_react.ReplaneErrorCode;
|
|
85
91
|
}
|
|
86
92
|
});
|
|
87
93
|
Object.defineProperty(exports, 'ReplaneProvider', {
|
|
@@ -103,18 +109,6 @@ Object.defineProperty(exports, 'createConfigHook', {
|
|
|
103
109
|
return __replanejs_react.createConfigHook;
|
|
104
110
|
}
|
|
105
111
|
});
|
|
106
|
-
Object.defineProperty(exports, 'createInMemoryReplaneClient', {
|
|
107
|
-
enumerable: true,
|
|
108
|
-
get: function () {
|
|
109
|
-
return __replanejs_sdk.createInMemoryReplaneClient;
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
Object.defineProperty(exports, 'createReplaneClient', {
|
|
113
|
-
enumerable: true,
|
|
114
|
-
get: function () {
|
|
115
|
-
return __replanejs_sdk.createReplaneClient;
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
112
|
Object.defineProperty(exports, 'createReplaneHook', {
|
|
119
113
|
enumerable: true,
|
|
120
114
|
get: function () {
|
|
@@ -127,12 +121,6 @@ Object.defineProperty(exports, 'getReplaneSnapshot', {
|
|
|
127
121
|
return __replanejs_react.getReplaneSnapshot;
|
|
128
122
|
}
|
|
129
123
|
});
|
|
130
|
-
Object.defineProperty(exports, 'restoreReplaneClient', {
|
|
131
|
-
enumerable: true,
|
|
132
|
-
get: function () {
|
|
133
|
-
return __replanejs_sdk.restoreReplaneClient;
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
124
|
Object.defineProperty(exports, 'useConfig', {
|
|
137
125
|
enumerable: true,
|
|
138
126
|
get: function () {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
|
-
import { GetConfigOptions,
|
|
4
|
-
import { GetReplaneSnapshotOptions, ReplaneProvider, ReplaneProviderProps, ReplaneProviderWithClientProps, ReplaneProviderWithOptionsProps, clearSuspenseCache, createConfigHook, createReplaneHook, getReplaneSnapshot, useConfig, useReplane } from "@replanejs/react";
|
|
3
|
+
import { ConnectOptions, GetConfigOptions, GetReplaneSnapshotOptions, Replane, ReplaneContext, ReplaneError, ReplaneErrorCode, ReplaneLogger, ReplaneOptions, ReplaneProvider, ReplaneProviderOptions, ReplaneProviderOptions as ReplaneProviderOptions$1, ReplaneProviderProps, ReplaneProviderWithClientProps, ReplaneProviderWithOptionsProps, ReplaneSnapshot, clearSuspenseCache, createConfigHook, createReplaneHook, getReplaneSnapshot, useConfig, useReplane } from "@replanejs/react";
|
|
5
4
|
|
|
6
5
|
//#region src/root.d.ts
|
|
7
6
|
|
|
@@ -13,7 +12,7 @@ interface ReplaneRootProps<T extends object> {
|
|
|
13
12
|
* Options for Replane client.
|
|
14
13
|
* Used for both server-side fetching and client-side live updates.
|
|
15
14
|
*/
|
|
16
|
-
options:
|
|
15
|
+
options: ReplaneProviderOptions$1<T>;
|
|
17
16
|
/**
|
|
18
17
|
* React children to render inside the provider
|
|
19
18
|
*/
|
|
@@ -52,5 +51,5 @@ declare function ReplaneRoot<T extends object>({
|
|
|
52
51
|
}: ReplaneRootProps<T>): Promise<react_jsx_runtime0.JSX.Element>;
|
|
53
52
|
//# sourceMappingURL=root.d.ts.map
|
|
54
53
|
//#endregion
|
|
55
|
-
export { type
|
|
54
|
+
export { type ConnectOptions, type GetConfigOptions, type GetReplaneSnapshotOptions, Replane, type ReplaneContext, ReplaneError, ReplaneErrorCode, type ReplaneLogger, type ReplaneOptions, ReplaneProvider, type ReplaneProviderOptions, type ReplaneProviderProps, type ReplaneProviderWithClientProps, type ReplaneProviderWithOptionsProps, ReplaneRoot, type ReplaneRootProps, type ReplaneSnapshot, clearSuspenseCache, createConfigHook, createReplaneHook, getReplaneSnapshot, useConfig, useReplane };
|
|
56
55
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/root.tsx"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/root.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;AAsBY,UATK,gBASL,CAAA,UAAA,MAAA,CAAA,CAAA;EAAS;AA8BrB;;;EAA6D,OAAE,EAlCpD,wBAkCoD,CAlC7B,CAkC6B,CAAA;EAAQ;;;EAAuB,QAAA,EA9BlF,SA8BkF;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAxE;;;GAAqD,iBAAiB,KAAE,QAAA,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { GetConfigOptions,
|
|
2
|
-
import { GetReplaneSnapshotOptions, ReplaneProvider, ReplaneProviderProps, ReplaneProviderWithClientProps, ReplaneProviderWithOptionsProps, clearSuspenseCache, createConfigHook, createReplaneHook, getReplaneSnapshot, useConfig, useReplane } from "@replanejs/react";
|
|
1
|
+
import { ConnectOptions, GetConfigOptions, GetReplaneSnapshotOptions, Replane, ReplaneContext, ReplaneError, ReplaneErrorCode, ReplaneLogger, ReplaneOptions, ReplaneProvider, ReplaneProviderOptions, ReplaneProviderOptions as ReplaneProviderOptions$1, ReplaneProviderProps, ReplaneProviderWithClientProps, ReplaneProviderWithOptionsProps, ReplaneSnapshot, clearSuspenseCache, createConfigHook, createReplaneHook, getReplaneSnapshot, useConfig, useReplane } from "@replanejs/react";
|
|
3
2
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
3
|
import { ReactNode } from "react";
|
|
5
4
|
|
|
@@ -13,7 +12,7 @@ interface ReplaneRootProps<T extends object> {
|
|
|
13
12
|
* Options for Replane client.
|
|
14
13
|
* Used for both server-side fetching and client-side live updates.
|
|
15
14
|
*/
|
|
16
|
-
options:
|
|
15
|
+
options: ReplaneProviderOptions$1<T>;
|
|
17
16
|
/**
|
|
18
17
|
* React children to render inside the provider
|
|
19
18
|
*/
|
|
@@ -52,5 +51,5 @@ declare function ReplaneRoot<T extends object>({
|
|
|
52
51
|
}: ReplaneRootProps<T>): Promise<react_jsx_runtime0.JSX.Element>;
|
|
53
52
|
//# sourceMappingURL=root.d.ts.map
|
|
54
53
|
//#endregion
|
|
55
|
-
export { type
|
|
54
|
+
export { type ConnectOptions, type GetConfigOptions, type GetReplaneSnapshotOptions, Replane, type ReplaneContext, ReplaneError, ReplaneErrorCode, type ReplaneLogger, type ReplaneOptions, ReplaneProvider, type ReplaneProviderOptions, type ReplaneProviderProps, type ReplaneProviderWithClientProps, type ReplaneProviderWithOptionsProps, ReplaneRoot, type ReplaneRootProps, type ReplaneSnapshot, clearSuspenseCache, createConfigHook, createReplaneHook, getReplaneSnapshot, useConfig, useReplane };
|
|
56
55
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/root.tsx"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/root.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;AAsBY,UATK,gBASL,CAAA,UAAA,MAAA,CAAA,CAAA;EAAS;AA8BrB;;;EAA6D,OAAE,EAlCpD,wBAkCoD,CAlC7B,CAkC6B,CAAA;EAAQ;;;EAAuB,QAAA,EA9BlF,SA8BkF;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAxE;;;GAAqD,iBAAiB,KAAE,QAAA,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ReplaneProvider, ReplaneProvider as ReplaneProvider$1, clearSuspenseCache, createConfigHook, createReplaneHook, getReplaneSnapshot, useConfig, useReplane } from "@replanejs/react";
|
|
1
|
+
import { getReplaneSnapshot as getReplaneSnapshot$1 } from "@replanejs/sdk";
|
|
2
|
+
import { Replane, ReplaneError, ReplaneErrorCode, ReplaneProvider, ReplaneProvider as ReplaneProvider$1, clearSuspenseCache, createConfigHook, createReplaneHook, getReplaneSnapshot, useConfig, useReplane } from "@replanejs/react";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/version.ts
|
|
6
|
-
const VERSION = "0.
|
|
6
|
+
const VERSION = "0.9.0";
|
|
7
7
|
const DEFAULT_AGENT = `replane-js-next/${VERSION}`;
|
|
8
8
|
|
|
9
9
|
//#endregion
|
|
@@ -49,5 +49,5 @@ async function ReplaneRoot({ options, children }) {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
//#endregion
|
|
52
|
-
export { ReplaneError, ReplaneErrorCode, ReplaneProvider, ReplaneRoot, clearSuspenseCache, createConfigHook,
|
|
52
|
+
export { Replane, ReplaneError, ReplaneErrorCode, ReplaneProvider, ReplaneRoot, clearSuspenseCache, createConfigHook, createReplaneHook, getReplaneSnapshot, useConfig, useReplane };
|
|
53
53
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ReplaneProvider"],"sources":["../src/version.ts","../src/root.tsx"],"sourcesContent":["// Auto-generated - do not edit manually\nexport const VERSION = \"0.
|
|
1
|
+
{"version":3,"file":"index.js","names":["ReplaneProvider"],"sources":["../src/version.ts","../src/root.tsx"],"sourcesContent":["// Auto-generated - do not edit manually\nexport const VERSION = \"0.9.0\";\nexport const DEFAULT_AGENT = `replane-js-next/${VERSION}`;\n","/**\n * Server-side utilities for Next.js\n * Use this module in Server Components, getServerSideProps, or getStaticProps\n */\n\nimport type { ReactNode } from \"react\";\nimport { getReplaneSnapshot } from \"@replanejs/sdk\";\nimport { ReplaneProvider, type ReplaneProviderOptions } from \"@replanejs/react\";\nimport { DEFAULT_AGENT } from \"./version\";\n\n/**\n * Props for ReplaneRoot server component\n */\nexport interface ReplaneRootProps<T extends object> {\n /**\n * Options for Replane client.\n * Used for both server-side fetching and client-side live updates.\n */\n options: ReplaneProviderOptions<T>;\n /**\n * React children to render inside the provider\n */\n children: ReactNode;\n}\n\n/**\n * Server component that fetches Replane configs and provides them to the app.\n * This is the simplest way to set up Replane in Next.js App Router.\n *\n * @example Basic usage in layout.tsx\n * ```tsx\n * // app/layout.tsx\n * import { ReplaneRoot } from \"@replanejs/next\";\n *\n * export default function RootLayout({ children }) {\n * return (\n * <html>\n * <body>\n * <ReplaneRoot\n * options={{\n * baseUrl: process.env.NEXT_PUBLIC_REPLANE_BASE_URL!,\n * sdkKey: process.env.NEXT_PUBLIC_REPLANE_SDK_KEY!,\n * }}\n * >\n * {children}\n * </ReplaneRoot>\n * </body>\n * </html>\n * );\n * }\n * ```\n */\nexport async function ReplaneRoot<T extends object>({ options, children }: ReplaneRootProps<T>) {\n const optionsWithAgent = {\n ...options,\n agent: options.agent ?? DEFAULT_AGENT,\n };\n const snapshot = await getReplaneSnapshot(optionsWithAgent);\n\n return (\n <ReplaneProvider options={optionsWithAgent} snapshot={snapshot}>\n {children}\n </ReplaneProvider>\n );\n}\n"],"mappings":";;;;;AACA,MAAa,UAAU;AACvB,MAAa,iBAAiB,kBAAkB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACkDxD,eAAsB,YAA8B,EAAE,SAAS,UAA+B,EAAE;CAC9F,MAAM,mBAAmB;EACvB,GAAG;EACH,OAAO,QAAQ,SAAS;CACzB;CACD,MAAM,WAAW,MAAM,qBAAmB,iBAAiB;AAE3D,wBACE,IAACA;EAAgB,SAAS;EAA4B;EACnD;GACe;AAErB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@replanejs/next",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Next.js SDK for Replane - feature flags and remote configuration with SSR support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"react": ">=18.0.0"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@replanejs/
|
|
49
|
-
"@replanejs/
|
|
48
|
+
"@replanejs/sdk": "^0.9.0",
|
|
49
|
+
"@replanejs/react": "^0.9.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/node": "^22.19.3",
|