@openfeature/flagd-provider 0.13.0 → 0.13.2
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 +23 -18
- package/index.cjs.js +1807 -1738
- package/index.esm.d.ts +1 -0
- package/index.esm.js +1807 -1736
- package/package.json +12 -11
- package/src/lib/configuration.d.ts +6 -6
- package/src/lib/flagd-provider.d.ts +2 -6
- package/src/lib/service/in-process/file/file-fetch.d.ts +1 -1
- package/src/lib/service/in-process/grpc/grpc-fetch.d.ts +1 -1
- package/src/lib/service/in-process/in-process-service.d.ts +2 -6
- package/src/proto/ts/flagd/evaluation/v1/evaluation.d.ts +50 -589
- package/src/proto/ts/flagd/sync/v1/sync.d.ts +18 -79
- package/src/proto/ts/google/protobuf/struct.d.ts +8 -88
- package/src/proto/ts/schema/v1/schema.d.ts +49 -589
- package/src/proto/ts/sync/v1/sync_service.d.ts +15 -57
- package/src/e2e/constants.d.ts +0 -4
- package/src/e2e/jest.config.d.ts +0 -11
- package/src/e2e/setup-in-process-provider.d.ts +0 -1
- package/src/e2e/setup-rpc-provider.d.ts +0 -1
package/README.md
CHANGED
|
@@ -27,17 +27,23 @@ Options can be defined in the constructor or as environment variables. Construct
|
|
|
27
27
|
|
|
28
28
|
### Available Configuration Options
|
|
29
29
|
|
|
30
|
-
| Option name | Environment variable name | Type | Default
|
|
31
|
-
| -------------------------------------- | ------------------------------ | -------
|
|
32
|
-
| host | FLAGD_HOST | string | localhost
|
|
33
|
-
| port | FLAGD_PORT | number |
|
|
34
|
-
| tls | FLAGD_TLS | boolean | false
|
|
35
|
-
| socketPath | FLAGD_SOCKET_PATH | string | -
|
|
36
|
-
| resolverType | FLAGD_RESOLVER | string | rpc
|
|
37
|
-
| offlineFlagSourcePath | FLAGD_OFFLINE_FLAG_SOURCE_PATH | string | -
|
|
38
|
-
| selector | FLAGD_SOURCE_SELECTOR | string | -
|
|
39
|
-
| cache | FLAGD_CACHE | string | lru
|
|
40
|
-
| maxCacheSize | FLAGD_MAX_CACHE_SIZE | int | 1000
|
|
30
|
+
| Option name | Environment variable name | Type | Default | Supported values |
|
|
31
|
+
| -------------------------------------- | ------------------------------ | ------- |----------------------------------------------------------------| ---------------- |
|
|
32
|
+
| host | FLAGD_HOST | string | localhost | |
|
|
33
|
+
| port | FLAGD_PORT | number | [resolver specific defaults](#resolver-type-specific-defaults) | |
|
|
34
|
+
| tls | FLAGD_TLS | boolean | false | |
|
|
35
|
+
| socketPath | FLAGD_SOCKET_PATH | string | - | |
|
|
36
|
+
| resolverType | FLAGD_RESOLVER | string | rpc | rpc, in-process |
|
|
37
|
+
| offlineFlagSourcePath | FLAGD_OFFLINE_FLAG_SOURCE_PATH | string | - | |
|
|
38
|
+
| selector | FLAGD_SOURCE_SELECTOR | string | - | |
|
|
39
|
+
| cache | FLAGD_CACHE | string | lru | lru, disabled |
|
|
40
|
+
| maxCacheSize | FLAGD_MAX_CACHE_SIZE | int | 1000 | |
|
|
41
|
+
|
|
42
|
+
#### Resolver type-specific Defaults
|
|
43
|
+
|
|
44
|
+
| Option name | Environment variable name | in-process | rpc | default |
|
|
45
|
+
| -------------------------------------- | ------------------------------ |-------------|------|---------|
|
|
46
|
+
| port | FLAGD_PORT | 8015 | 8013 | 8013 |
|
|
41
47
|
|
|
42
48
|
Below are examples of usage patterns.
|
|
43
49
|
|
|
@@ -55,7 +61,7 @@ In the above example, the provider expects flagd to be available at `localhost:8
|
|
|
55
61
|
|
|
56
62
|
Alternatively, you can use socket paths to connect to flagd.
|
|
57
63
|
|
|
58
|
-
```
|
|
64
|
+
```ts
|
|
59
65
|
OpenFeature.setProvider(new FlagdProvider({
|
|
60
66
|
socketPath: "/tmp/flagd.socks",
|
|
61
67
|
}))
|
|
@@ -66,18 +72,18 @@ Alternatively, you can use socket paths to connect to flagd.
|
|
|
66
72
|
This mode performs flag evaluations locally (in-process).
|
|
67
73
|
Flag configurations for evaluation are obtained via gRPC protocol using [sync protobuf schema](https://buf.build/open-feature/flagd/file/main:sync/v1/sync_service.proto) service definition.
|
|
68
74
|
|
|
69
|
-
```
|
|
75
|
+
```ts
|
|
70
76
|
OpenFeature.setProvider(new FlagdProvider({
|
|
71
77
|
resolverType: 'in-process',
|
|
72
78
|
}))
|
|
73
79
|
```
|
|
74
80
|
|
|
75
|
-
In the above example, the provider expects a flag sync service implementation to be available at `localhost:
|
|
81
|
+
In the above example, the provider expects a flag sync service implementation to be available at `localhost:8015` (default host and port).
|
|
76
82
|
|
|
77
83
|
In-process resolver can also work in an offline mode.
|
|
78
84
|
To enable this mode, you should provide a valid flag configuration file with the option `offlineFlagSourcePath`.
|
|
79
85
|
|
|
80
|
-
```
|
|
86
|
+
```ts
|
|
81
87
|
OpenFeature.setProvider(new FlagdProvider({
|
|
82
88
|
resolverType: 'in-process',
|
|
83
89
|
offlineFlagSourcePath: './flags.json',
|
|
@@ -101,9 +107,8 @@ For general information on events, see the [official documentation](https://open
|
|
|
101
107
|
|
|
102
108
|
### Flag Metadata
|
|
103
109
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
| `scope` | string | "selector" set for the associated source in flagd |
|
|
110
|
+
[Flag metadata](https://flagd.dev/reference/flag-definitions/#metadata) is a set of key-value pairs that can be associated with a flag.
|
|
111
|
+
The values come from the flag definition in flagd.
|
|
107
112
|
|
|
108
113
|
## Building
|
|
109
114
|
|