@replanejs/svelte 0.8.20 → 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 +20 -14
- package/dist/ReplaneContext.svelte +40 -24
- package/dist/ReplaneContext.svelte.d.ts.map +1 -1
- package/dist/context.d.ts +2 -2
- package/dist/context.d.ts.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/stores.d.ts +4 -4
- package/dist/stores.d.ts.map +1 -1
- package/dist/types.d.ts +64 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +2 -2
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -17,9 +17,10 @@ npm install @replanejs/svelte
|
|
|
17
17
|
```svelte
|
|
18
18
|
<script>
|
|
19
19
|
import { ReplaneContext, config } from '@replanejs/svelte';
|
|
20
|
-
import {
|
|
20
|
+
import { Replane } from '@replanejs/svelte';
|
|
21
21
|
|
|
22
|
-
const replane =
|
|
22
|
+
const replane = new Replane();
|
|
23
|
+
await replane.connect({
|
|
23
24
|
baseUrl: 'https://your-replane-server.com',
|
|
24
25
|
sdkKey: 'your-sdk-key',
|
|
25
26
|
});
|
|
@@ -47,18 +48,22 @@ npm install @replanejs/svelte
|
|
|
47
48
|
|
|
48
49
|
## Client Options
|
|
49
50
|
|
|
50
|
-
The `options` prop accepts
|
|
51
|
+
The `options` prop accepts the following options:
|
|
51
52
|
|
|
52
|
-
| Option
|
|
53
|
-
|
|
|
54
|
-
| `baseUrl`
|
|
55
|
-
| `sdkKey`
|
|
56
|
-
| `context`
|
|
57
|
-
| `defaults`
|
|
58
|
-
| `
|
|
59
|
-
| `
|
|
53
|
+
| Option | Type | Required | Description |
|
|
54
|
+
| --------------------- | --------------------- | -------- | ---------------------------------------- |
|
|
55
|
+
| `baseUrl` | `string` | Yes | Replane server URL |
|
|
56
|
+
| `sdkKey` | `string` | Yes | SDK key for authentication |
|
|
57
|
+
| `context` | `Record<string, any>` | No | Default context for override evaluations |
|
|
58
|
+
| `defaults` | `Record<string, any>` | No | Default values if server is unavailable |
|
|
59
|
+
| `connectTimeoutMs` | `number` | No | SDK connection timeout (default: 5000) |
|
|
60
|
+
| `requestTimeoutMs` | `number` | No | Timeout for SSE requests (default: 2000) |
|
|
61
|
+
| `retryDelayMs` | `number` | No | Base delay between retries (default: 200)|
|
|
62
|
+
| `inactivityTimeoutMs` | `number` | No | SSE inactivity timeout (default: 30000) |
|
|
63
|
+
| `fetchFn` | `typeof fetch` | No | Custom fetch implementation |
|
|
64
|
+
| `logger` | `ReplaneLogger` | No | Custom logger (default: console) |
|
|
60
65
|
|
|
61
|
-
See [`@replanejs/sdk` documentation](https://github.com/replane-dev/replane-javascript/tree/main/packages/sdk#
|
|
66
|
+
See [`@replanejs/sdk` documentation](https://github.com/replane-dev/replane-javascript/tree/main/packages/sdk#api) for more details.
|
|
62
67
|
|
|
63
68
|
## API
|
|
64
69
|
|
|
@@ -131,9 +136,10 @@ Can be used in three ways:
|
|
|
131
136
|
|
|
132
137
|
```svelte
|
|
133
138
|
<script>
|
|
134
|
-
import { ReplaneContext,
|
|
139
|
+
import { ReplaneContext, Replane } from '@replanejs/svelte';
|
|
135
140
|
|
|
136
|
-
const replane =
|
|
141
|
+
const replane = new Replane();
|
|
142
|
+
await replane.connect({
|
|
137
143
|
baseUrl: 'https://your-replane-server.com',
|
|
138
144
|
sdkKey: 'your-sdk-key',
|
|
139
145
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type {
|
|
2
|
+
import type { Replane } from "@replanejs/sdk";
|
|
3
3
|
import type {
|
|
4
4
|
ReplaneContextProps,
|
|
5
5
|
ReplaneContextWithClientProps,
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
17
|
<script lang="ts" generics="T extends object">
|
|
18
|
-
import {
|
|
18
|
+
import { Replane as ReplaneClass } from "@replanejs/sdk";
|
|
19
19
|
import { setReplaneContext } from "./context";
|
|
20
20
|
import { hasClient } from "./types";
|
|
21
21
|
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
|
|
24
24
|
type ClientState =
|
|
25
25
|
| { status: "loading"; client: null; error: null }
|
|
26
|
-
| { status: "ready"; client:
|
|
26
|
+
| { status: "ready"; client: Replane<T>; error: null }
|
|
27
27
|
| { status: "error"; client: null; error: Error };
|
|
28
28
|
|
|
29
29
|
let state = $state<ClientState>({ status: "loading", client: null, error: null });
|
|
30
|
-
let clientRef:
|
|
30
|
+
let clientRef: Replane<T> | null = null;
|
|
31
31
|
let cancelled = false;
|
|
32
32
|
|
|
33
33
|
// Handle client initialization based on props
|
|
@@ -44,21 +44,24 @@
|
|
|
44
44
|
const { options, snapshot } = props;
|
|
45
45
|
|
|
46
46
|
if (snapshot) {
|
|
47
|
-
// Restore from snapshot synchronously
|
|
47
|
+
// Restore from snapshot synchronously, connect in background
|
|
48
48
|
try {
|
|
49
|
-
const client =
|
|
49
|
+
const client = new ReplaneClass<T>({
|
|
50
50
|
snapshot,
|
|
51
|
-
|
|
52
|
-
baseUrl: options.baseUrl,
|
|
53
|
-
sdkKey: options.sdkKey,
|
|
54
|
-
fetchFn: options.fetchFn,
|
|
55
|
-
requestTimeoutMs: options.requestTimeoutMs,
|
|
56
|
-
retryDelayMs: options.retryDelayMs,
|
|
57
|
-
inactivityTimeoutMs: options.inactivityTimeoutMs,
|
|
58
|
-
logger: options.logger,
|
|
59
|
-
agent: options.agent ?? DEFAULT_AGENT,
|
|
60
|
-
},
|
|
51
|
+
logger: options.logger,
|
|
61
52
|
context: options.context,
|
|
53
|
+
defaults: options.defaults,
|
|
54
|
+
});
|
|
55
|
+
// Start connection in background (don't await)
|
|
56
|
+
client.connect({
|
|
57
|
+
baseUrl: options.baseUrl,
|
|
58
|
+
sdkKey: options.sdkKey,
|
|
59
|
+
fetchFn: options.fetchFn,
|
|
60
|
+
requestTimeoutMs: options.requestTimeoutMs,
|
|
61
|
+
retryDelayMs: options.retryDelayMs,
|
|
62
|
+
inactivityTimeoutMs: options.inactivityTimeoutMs,
|
|
63
|
+
connectTimeoutMs: options.connectTimeoutMs,
|
|
64
|
+
agent: options.agent ?? DEFAULT_AGENT,
|
|
62
65
|
});
|
|
63
66
|
clientRef = client;
|
|
64
67
|
state = { status: "ready", client, error: null };
|
|
@@ -72,13 +75,26 @@
|
|
|
72
75
|
// Async client creation
|
|
73
76
|
state = { status: "loading", client: null, error: null };
|
|
74
77
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
const client = new ReplaneClass<T>({
|
|
79
|
+
logger: options.logger,
|
|
80
|
+
context: options.context,
|
|
81
|
+
defaults: options.defaults,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
client
|
|
85
|
+
.connect({
|
|
86
|
+
baseUrl: options.baseUrl,
|
|
87
|
+
sdkKey: options.sdkKey,
|
|
88
|
+
fetchFn: options.fetchFn,
|
|
89
|
+
requestTimeoutMs: options.requestTimeoutMs,
|
|
90
|
+
retryDelayMs: options.retryDelayMs,
|
|
91
|
+
inactivityTimeoutMs: options.inactivityTimeoutMs,
|
|
92
|
+
connectTimeoutMs: options.connectTimeoutMs,
|
|
93
|
+
agent: options.agent ?? DEFAULT_AGENT,
|
|
94
|
+
})
|
|
95
|
+
.then(() => {
|
|
80
96
|
if (cancelled) {
|
|
81
|
-
client.
|
|
97
|
+
client.disconnect();
|
|
82
98
|
return;
|
|
83
99
|
}
|
|
84
100
|
clientRef = client;
|
|
@@ -92,9 +108,9 @@
|
|
|
92
108
|
|
|
93
109
|
return () => {
|
|
94
110
|
cancelled = true;
|
|
95
|
-
// Only
|
|
111
|
+
// Only disconnect client if we created it (not pre-created)
|
|
96
112
|
if (clientRef && !hasClient(props)) {
|
|
97
|
-
clientRef.
|
|
113
|
+
clientRef.disconnect();
|
|
98
114
|
clientRef = null;
|
|
99
115
|
}
|
|
100
116
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReplaneContext.svelte.d.ts","sourceRoot":"","sources":["../src/ReplaneContext.svelte.ts"],"names":[],"mappings":"AAIE,OAAO,KAAK,EACV,mBAAmB,EACnB,6BAA6B,EAC7B,8BAA8B,EAC/B,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,mBAAmB,EACnB,6BAA6B,EAC7B,8BAA8B,GAC/B,CAAC;AAMJ,iBAAS,QAAQ,CAAC,CAAC,SAAS,MAAM;
|
|
1
|
+
{"version":3,"file":"ReplaneContext.svelte.d.ts","sourceRoot":"","sources":["../src/ReplaneContext.svelte.ts"],"names":[],"mappings":"AAIE,OAAO,KAAK,EACV,mBAAmB,EACnB,6BAA6B,EAC7B,8BAA8B,EAC/B,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,mBAAmB,EACnB,6BAA6B,EAC7B,8BAA8B,GAC/B,CAAC;AAMJ,iBAAS,QAAQ,CAAC,CAAC,SAAS,MAAM;WAkIL,mBAAmB,CAAC,CAAC,CAAC;;;;;EAA4E;AAC/H,cAAM,iBAAiB,CAAC,CAAC,SAAS,MAAM;IACpC,KAAK,IAAI,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAChD,MAAM,IAAI,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAClD,KAAK,IAAI,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAChD,QAAQ;IACR,OAAO;CACV;AAED,UAAU,qBAAqB;IAC3B,KAAK,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,OAAO,QAAQ,EAAE,2BAA2B,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAA;KAAE,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IAC3Y,CAAC,CAAC,SAAS,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IAC1I,YAAY,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;CACjE;AACD,QAAA,MAAM,cAAc,EAAE,qBAAmC,CAAC;AACxC,KAAK,cAAc,CAAC,CAAC,SAAS,MAAM,IAAI,YAAY,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;AACjF,eAAe,cAAc,CAAC"}
|
package/dist/context.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Replane } from "@replanejs/sdk";
|
|
2
2
|
import type { ReplaneContextValue } from "./types";
|
|
3
3
|
/**
|
|
4
4
|
* Set the Replane client in Svelte context.
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
7
|
-
export declare function setReplaneContext<T extends object>(client:
|
|
7
|
+
export declare function setReplaneContext<T extends object>(client: Replane<T>): void;
|
|
8
8
|
/**
|
|
9
9
|
* Get the Replane context from Svelte context.
|
|
10
10
|
* @internal
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAInD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAG5E;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KACvC,mBAAmB,CAAC,CAAC,CAAC,CAM1B;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAO3C"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { default as ReplaneContext } from "./ReplaneContext.svelte";
|
|
2
2
|
export { getReplane, config, configFrom, createTypedReplane, createTypedConfig } from "./stores";
|
|
3
3
|
export { setReplaneContext, getReplaneContext, hasReplaneContext } from "./context";
|
|
4
|
-
export {
|
|
5
|
-
export type {
|
|
6
|
-
export type { ReplaneContextValue, ReplaneContextProps, ReplaneContextWithClientProps, ReplaneContextWithOptionsProps, } from "./types";
|
|
4
|
+
export { Replane, getReplaneSnapshot, ReplaneError, ReplaneErrorCode } from "@replanejs/sdk";
|
|
5
|
+
export type { ReplaneSnapshot, ReplaneContext as ReplaneContextType, ReplaneLogger, ReplaneOptions, ConnectOptions, GetConfigOptions, GetReplaneSnapshotOptions, } from "@replanejs/sdk";
|
|
6
|
+
export type { ReplaneContextValue, ReplaneContextProps, ReplaneContextWithClientProps, ReplaneContextWithOptionsProps, ReplaneContextOptions, } from "./types";
|
|
7
7
|
export { hasClient, hasOptions } from "./types";
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGpE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGjG,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAGpF,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGpE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGjG,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAGpF,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAE7F,YAAY,EACV,eAAe,EACf,cAAc,IAAI,kBAAkB,EACpC,aAAa,EACb,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,yBAAyB,GAC1B,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACV,mBAAmB,EACnB,mBAAmB,EACnB,6BAA6B,EAC7B,8BAA8B,EAC9B,qBAAqB,GACtB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,6 @@ export { getReplane, config, configFrom, createTypedReplane, createTypedConfig }
|
|
|
5
5
|
// Context utilities (for advanced use cases)
|
|
6
6
|
export { setReplaneContext, getReplaneContext, hasReplaneContext } from "./context";
|
|
7
7
|
// Re-export from SDK for convenience
|
|
8
|
-
export {
|
|
8
|
+
export { Replane, getReplaneSnapshot, ReplaneError, ReplaneErrorCode } from "@replanejs/sdk";
|
|
9
9
|
// Type guards
|
|
10
10
|
export { hasClient, hasOptions } from "./types";
|
package/dist/stores.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Readable } from "svelte/store";
|
|
2
|
-
import type { GetConfigOptions,
|
|
2
|
+
import type { GetConfigOptions, Replane } from "@replanejs/sdk";
|
|
3
3
|
/**
|
|
4
4
|
* Get the Replane client from context.
|
|
5
5
|
*
|
|
@@ -18,7 +18,7 @@ import type { GetConfigOptions, ReplaneClient } from "@replanejs/sdk";
|
|
|
18
18
|
* </script>
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
|
21
|
-
export declare function getReplane<T extends Record<string, unknown> = any>():
|
|
21
|
+
export declare function getReplane<T extends Record<string, unknown> = any>(): Replane<T>;
|
|
22
22
|
/**
|
|
23
23
|
* Create a reactive store for a specific config value.
|
|
24
24
|
*
|
|
@@ -71,7 +71,7 @@ export declare function config<T>(name: string, options?: GetConfigOptions<T>):
|
|
|
71
71
|
* {/if}
|
|
72
72
|
* ```
|
|
73
73
|
*/
|
|
74
|
-
export declare function configFrom<TConfigs extends Record<string, unknown>, K extends keyof TConfigs>(replane:
|
|
74
|
+
export declare function configFrom<TConfigs extends Record<string, unknown>, K extends keyof TConfigs>(replane: Replane<TConfigs>, name: K, options?: GetConfigOptions<TConfigs[K]>): Readable<TConfigs[K]>;
|
|
75
75
|
/**
|
|
76
76
|
* Creates a typed version of getReplane().
|
|
77
77
|
*
|
|
@@ -101,7 +101,7 @@ export declare function configFrom<TConfigs extends Record<string, unknown>, K e
|
|
|
101
101
|
* </script>
|
|
102
102
|
* ```
|
|
103
103
|
*/
|
|
104
|
-
export declare function createTypedReplane<TConfigs extends Record<string, unknown>>(): () =>
|
|
104
|
+
export declare function createTypedReplane<TConfigs extends Record<string, unknown>>(): () => Replane<TConfigs>;
|
|
105
105
|
/**
|
|
106
106
|
* Creates a typed version of config().
|
|
107
107
|
*
|
package/dist/stores.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stores.d.ts","sourceRoot":"","sources":["../src/stores.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"stores.d.ts","sourceRoot":"","sources":["../src/stores.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGhE;;;;;;;;;;;;;;;;;GAiBG;AAEH,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC,CAEhF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAYlF;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,UAAU,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,SAAS,MAAM,QAAQ,EAC3F,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,IAAI,EAAE,CAAC,EACP,OAAO,CAAC,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GACtC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAOvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,WACrD,OAAO,CAAC,QAAQ,CAAC,CAGtC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,MACvD,CAAC,SAAS,MAAM,QAAQ,EACvC,MAAM,CAAC,EACP,UAAU,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KACtC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAGzB"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,17 +1,75 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Replane, ReplaneSnapshot, ReplaneContext, ReplaneLogger } from "@replanejs/sdk";
|
|
2
2
|
import type { Snippet } from "svelte";
|
|
3
3
|
/**
|
|
4
4
|
* Context value containing the Replane client
|
|
5
5
|
*/
|
|
6
6
|
export interface ReplaneContextValue<T extends object = Record<string, unknown>> {
|
|
7
|
-
client:
|
|
7
|
+
client: Replane<T>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Combined options for ReplaneContext.
|
|
11
|
+
* Includes both constructor options (context, logger, defaults) and connection options.
|
|
12
|
+
*/
|
|
13
|
+
export interface ReplaneContextOptions<T extends object = Record<string, unknown>> {
|
|
14
|
+
/**
|
|
15
|
+
* Base URL of the Replane instance (no trailing slash).
|
|
16
|
+
* @example "https://app.replane.dev"
|
|
17
|
+
*/
|
|
18
|
+
baseUrl: string;
|
|
19
|
+
/**
|
|
20
|
+
* Project SDK key for authorization.
|
|
21
|
+
* @example "rp_XXXXXXXXX"
|
|
22
|
+
*/
|
|
23
|
+
sdkKey: string;
|
|
24
|
+
/**
|
|
25
|
+
* Default context for all config evaluations.
|
|
26
|
+
*/
|
|
27
|
+
context?: ReplaneContext;
|
|
28
|
+
/**
|
|
29
|
+
* Optional logger (defaults to console).
|
|
30
|
+
*/
|
|
31
|
+
logger?: ReplaneLogger;
|
|
32
|
+
/**
|
|
33
|
+
* Default values to use before connection is established.
|
|
34
|
+
*/
|
|
35
|
+
defaults?: {
|
|
36
|
+
[K in keyof T]?: T[K];
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Optional timeout in ms for the initial connection.
|
|
40
|
+
* @default 5000
|
|
41
|
+
*/
|
|
42
|
+
connectTimeoutMs?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Delay between retries in ms.
|
|
45
|
+
* @default 200
|
|
46
|
+
*/
|
|
47
|
+
retryDelayMs?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Optional timeout in ms for individual requests.
|
|
50
|
+
* @default 2000
|
|
51
|
+
*/
|
|
52
|
+
requestTimeoutMs?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Timeout in ms for SSE connection inactivity.
|
|
55
|
+
* @default 30000
|
|
56
|
+
*/
|
|
57
|
+
inactivityTimeoutMs?: number;
|
|
58
|
+
/**
|
|
59
|
+
* Custom fetch implementation (useful for tests / polyfills).
|
|
60
|
+
*/
|
|
61
|
+
fetchFn?: typeof fetch;
|
|
62
|
+
/**
|
|
63
|
+
* Agent identifier sent in User-Agent header.
|
|
64
|
+
*/
|
|
65
|
+
agent?: string;
|
|
8
66
|
}
|
|
9
67
|
/**
|
|
10
68
|
* Props for ReplaneContext when using a pre-created client.
|
|
11
69
|
*/
|
|
12
70
|
export interface ReplaneContextWithClientProps<T extends object = Record<string, unknown>> {
|
|
13
|
-
/** Pre-created
|
|
14
|
-
client:
|
|
71
|
+
/** Pre-created Replane client instance */
|
|
72
|
+
client: Replane<T>;
|
|
15
73
|
/** Children snippet */
|
|
16
74
|
children: Snippet;
|
|
17
75
|
}
|
|
@@ -19,8 +77,8 @@ export interface ReplaneContextWithClientProps<T extends object = Record<string,
|
|
|
19
77
|
* Props for ReplaneContext when letting it manage the client internally.
|
|
20
78
|
*/
|
|
21
79
|
export interface ReplaneContextWithOptionsProps<T extends object = Record<string, unknown>> {
|
|
22
|
-
/** Options to create or restore the
|
|
23
|
-
options:
|
|
80
|
+
/** Options to create or restore the Replane client */
|
|
81
|
+
options: ReplaneContextOptions<T>;
|
|
24
82
|
/** Children snippet */
|
|
25
83
|
children: Snippet;
|
|
26
84
|
/**
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC9F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC7E,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC/E;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB;;OAEG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB;;OAEG;IACH,QAAQ,CAAC,EAAE;SAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;KAAE,CAAC;IACrC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;IACvB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACvF,0CAA0C;IAC1C,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACnB,uBAAuB;IACvB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,8BAA8B,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACxF,sDAAsD;IACtD,OAAO,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAClC,uBAAuB;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IAC9B;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IACtE,6BAA6B,CAAC,CAAC,CAAC,GAChC,8BAA8B,CAAC,CAAC,CAAC,CAAC;AAEtC;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EACxC,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAC5B,KAAK,IAAI,6BAA6B,CAAC,CAAC,CAAC,CAE3C;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EACzC,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAC5B,KAAK,IAAI,8BAA8B,CAAC,CAAC,CAAC,CAE5C"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
2
|
-
export declare const DEFAULT_AGENT = "replane-js-svelte/0.
|
|
1
|
+
export declare const VERSION = "0.9.0";
|
|
2
|
+
export declare const DEFAULT_AGENT = "replane-js-svelte/0.9.0";
|
|
3
3
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,eAAO,MAAM,aAAa,4BAAiC,CAAC"}
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@replanejs/svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Svelte SDK for Replane - feature flags and remote configuration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"svelte": "./dist/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"svelte": ">=4.0.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@replanejs/sdk": "^0.
|
|
42
|
+
"@replanejs/sdk": "^0.9.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@sveltejs/package": "^2.3.10",
|