@configdirector/nuxt-sdk 0.1.0 → 0.1.1

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 CHANGED
@@ -59,6 +59,21 @@ const { value } = useConfigDirectorValue<string>("my-config", "default value");
59
59
  </template>
60
60
  ```
61
61
 
62
+ The `value` returned is a ShallowRef that will update whenever the config value is updated in the ConfigDirector dashboard, or if it evaluates to a different value due to targeting rules (for example, if the user context is updated). Keep in mind that it is a ShallowRef when accessing it in scripts:
63
+
64
+ ```ts
65
+ <script setup lang="ts">
66
+ const { value: myConfigValue } = useConfigDirectorValue<string>("my-config", "default value");
67
+
68
+ const someOtherDerivedValue = computed(() => `Hello ${myConfigValue.value}`);
69
+ </script>
70
+
71
+ <template>
72
+ <div>my-config is : {{ someOtherDerivedValue }}</div>
73
+ </template>
74
+ ```
75
+
76
+
62
77
  You can also determine if the client is still initializing, so rather than transition from the default value to the evaluated value, you can show a loading state until the client is ready and config values are evaluated:
63
78
 
64
79
  ```ts
@@ -72,7 +87,7 @@ const { value, loading } = useConfigDirectorValue<string>("my-config", "default
72
87
  </template>
73
88
  ```
74
89
 
75
- Alternatively, you can also use the `useConfigDirectorStatus` composable to retrieve just the status:
90
+ Additionally, you can also use the `useConfigDirectorStatus` composable to retrieve just the status:
76
91
 
77
92
  ```ts
78
93
  <script setup lang="ts">
@@ -120,7 +135,7 @@ export default defineEventHandler(async (_event) => {
120
135
  });
121
136
  ```
122
137
 
123
- `getValue` can also accepts an optional user context:
138
+ `getValue` also accepts an optional user context:
124
139
 
125
140
  ```ts
126
141
  export default defineEventHandler(async (_event) => {
package/dist/module.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=4.0.0"
6
6
  },
7
- "version": "0.1.0"
7
+ "version": "0.1.1"
8
8
  }
@@ -1,10 +1,10 @@
1
1
  import { n as ConfigValueType } from "../../types-CQWNx-gI.mjs";
2
2
  import { t as ClientStatus } from "../../types-CkzBXJwA.mjs";
3
- import { Ref, ShallowRef } from "vue";
3
+ import { DeepReadonly, Ref, ShallowRef } from "vue";
4
4
 
5
5
  //#region src/runtime/app/composables/useConfigDirectorValue.d.ts
6
6
  declare const useConfigDirectorValue: <T extends ConfigValueType>(configKey: string, defaultValue: T) => {
7
- value: ShallowRef<T>;
7
+ value: DeepReadonly<ShallowRef<T>>;
8
8
  readyStatus: Readonly<Ref<ClientStatus>>;
9
9
  loading: Readonly<Ref<boolean>>;
10
10
  };
@@ -1,10 +1,10 @@
1
1
  import { n as ConfigValueType } from "../../types-CQWNx-gI.mjs";
2
2
  import { t as ClientStatus } from "../../types-CkzBXJwA.mjs";
3
- import { Ref, ShallowRef } from "vue";
3
+ import { DeepReadonly, Ref, ShallowRef } from "vue";
4
4
 
5
5
  //#region src/runtime/app/composables/useConfigDirectorValue.d.ts
6
6
  declare const useConfigDirectorValue: <T extends ConfigValueType>(configKey: string, defaultValue: T) => {
7
- value: ShallowRef<T>;
7
+ value: DeepReadonly<ShallowRef<T>>;
8
8
  readyStatus: Readonly<Ref<ClientStatus>>;
9
9
  loading: Readonly<Ref<boolean>>;
10
10
  };
@@ -1,6 +1,6 @@
1
1
  import { useConfigDirectorClient } from "./useConfigDirectorClient.mjs";
2
2
  import { useConfigDirectorStatus } from "./useConfigDirectorStatus.mjs";
3
- import { onBeforeUnmount, shallowRef } from "vue";
3
+ import { onBeforeUnmount, readonly, shallowRef } from "vue";
4
4
  //#region src/runtime/app/composables/useConfigDirectorValue.ts
5
5
  const useConfigDirectorValue = (configKey, defaultValue) => {
6
6
  const { client } = useConfigDirectorClient();
@@ -10,7 +10,7 @@ const useConfigDirectorValue = (configKey, defaultValue) => {
10
10
  client.watch(configKey, defaultValue, watcher);
11
11
  onBeforeUnmount(() => client.unwatch(configKey, watcher));
12
12
  return {
13
- value: configValue,
13
+ value: readonly(configValue),
14
14
  readyStatus,
15
15
  loading
16
16
  };
@@ -1385,7 +1385,7 @@ var plugin_default = defineNitroPlugin((nitroApp) => {
1385
1385
  const { serverSdkKey, baseUrl } = runtimeConfig.configdirector;
1386
1386
  const client = new DefaultConfigDirectorClient(serverSdkKey, {
1387
1387
  sdkName: "nuxt-sdk",
1388
- sdkVersion: "0.1.0"
1388
+ sdkVersion: "0.1.1"
1389
1389
  }, {
1390
1390
  logger,
1391
1391
  ...baseUrl ? { connection: { url: baseUrl } } : {}
@@ -1130,7 +1130,7 @@ var plugin_client_default = defineNuxtPlugin((nuxtApp) => {
1130
1130
  const { clientSdkKey, appName, appVersion, baseUrl } = runtimeConfig.public.configdirector;
1131
1131
  const client = createBrowserClient(clientSdkKey, {
1132
1132
  sdkName: "nuxt-sdk",
1133
- sdkVersion: "0.1.0"
1133
+ sdkVersion: "0.1.1"
1134
1134
  }, {
1135
1135
  metadata: {
1136
1136
  appName,
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@configdirector/nuxt-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Nuxt SDK for ConfigDirector. ConfigDirector is a remote configuration and feature flag service.",
5
5
  "license": "MIT",
6
6
  "author": "ConfigDirector",
7
7
  "keywords": [
8
8
  "configdirector",
9
- "configdirector vue",
9
+ "configdirector nuxt",
10
10
  "config",
11
11
  "configuration",
12
12
  "remote config",