@configdirector/nuxt-sdk 1.13.2 → 1.14.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.
Files changed (27) hide show
  1. package/dist/module.d.mts +43 -4
  2. package/dist/module.json +1 -1
  3. package/dist/runtime/app/composables/useConfigDirectorClient.d.mts +1 -1
  4. package/dist/runtime/app/composables/useConfigDirectorClient.d.ts +1 -1
  5. package/dist/runtime/app/composables/useConfigDirectorClientHooks.d.mts +1 -1
  6. package/dist/runtime/app/composables/useConfigDirectorClientHooks.d.ts +1 -1
  7. package/dist/runtime/app/composables/useConfigDirectorContext.d.mts +1 -1
  8. package/dist/runtime/app/composables/useConfigDirectorContext.d.ts +1 -1
  9. package/dist/runtime/app/composables/useConfigDirectorValue.d.mts +1 -1
  10. package/dist/runtime/app/composables/useConfigDirectorValue.d.ts +1 -1
  11. package/dist/runtime/{native-values-CfhP0yLS.d.mts → native-values-Cq3SCmEH.d.mts} +49 -4
  12. package/dist/runtime/nitro/offline-values.d.mts +1 -1
  13. package/dist/runtime/nitro/offline-values.d.ts +1 -1
  14. package/dist/runtime/nitro/plugin.d.mts +9 -2
  15. package/dist/runtime/nitro/plugin.d.ts +9 -2
  16. package/dist/runtime/nitro/plugin.mjs +316 -81
  17. package/dist/runtime/plugin.client.mjs +191 -3
  18. package/dist/runtime/plugin.server.mjs +3 -0
  19. package/dist/runtime/server/composables/useConfigDirectorServerClient.d.mts +1 -1
  20. package/dist/runtime/server/composables/useConfigDirectorServerClient.d.ts +1 -1
  21. package/dist/runtime/server/composables/useConfigDirectorServerHooks.d.mts +1 -1
  22. package/dist/runtime/server/composables/useConfigDirectorServerHooks.d.ts +1 -1
  23. package/dist/runtime/{types-BvqduMQP.d.mts → types-BNw2c3C0.d.mts} +17 -3
  24. package/dist/runtime/{types-qDEc6g8R.d.mts → types-CYquNKWW.d.mts} +18 -3
  25. package/dist/testing.d.mts +78 -7
  26. package/dist/testing.mjs +158 -5
  27. package/package.json +2 -2
package/dist/module.d.mts CHANGED
@@ -8,24 +8,63 @@ type ConfigEnumLikeType = {
8
8
  type ConfigValueType = string | number | boolean | object | ConfigEnumLikeType;
9
9
  /**
10
10
  * Why an evaluation returned the value it did. `found-match` returns a value from ConfigDirector,
11
- * and `cached` a value kept on the device while a client SDK waits for live values. `value-missing`
11
+ * and `cached` a value kept on the device while a client SDK waits for live values.
12
+ * `rollout-skipped-no-identifier` returns the default targeting rule value: a server SDK skipped a
13
+ * percentage rollout because the context has no `id` to place it in a share. `value-missing`
12
14
  * returns the in-code default value because the config has no value. Every other reason returns the
13
15
  * in-code default value because of an error: the config does not exist (`config-state-missing`), no
14
16
  * values have arrived yet (`client-not-ready`), or the value cannot be read as the type of the in-code
15
17
  * default value.
16
18
  */
17
- type EvaluationReason = "found-match" | "config-state-missing" | "client-not-ready" | "type-mismatch" | "value-missing" | "invalid-number" | "invalid-json" | "invalid-boolean" | "cached";
19
+ type EvaluationReason = "found-match" | "rollout-skipped-no-identifier" | "config-state-missing" | "client-not-ready" | "type-mismatch" | "value-missing" | "invalid-number" | "invalid-json" | "invalid-boolean" | "cached";
20
+ /**
21
+ * One of the values a config can serve, such as the control or a treatment of an experiment.
22
+ */
23
+ type Variation = {
24
+ /** The ID ConfigDirector assigned to the variation, which stays the same when it is renamed. */id: string; /** The variation's name, when it has one. */
25
+ name?: string;
26
+ };
18
27
  /**
19
28
  * One evaluation of a config: the value it returned, why, and the context it was evaluated for.
20
29
  */
21
30
  type ConfigEvaluation<T extends ConfigValueType = ConfigValueType> = {
22
31
  /** The config key that was evaluated. */key: string; /** The value returned, which is the in-code default value when {@link isDefaultValue} is `true`. */
23
32
  value: T; /** The ID ConfigDirector assigned to the value returned, when ConfigDirector sent one with it. */
24
- valueId?: string; /** Whether the evaluation returned the in-code default value. */
33
+ valueId?: string;
34
+ /**
35
+ * The variation that was served. It is `undefined` when the config has no variations or the
36
+ * in-code default value is returned.
37
+ */
38
+ variation?: Variation; /** Whether the evaluation returned the in-code default value. */
25
39
  isDefaultValue: boolean; /** Why the evaluation returned this value. */
26
40
  reason: EvaluationReason; /** The context the config was evaluated for, if any. */
27
41
  context?: ConfigDirectorContext;
28
42
  };
43
+ /**
44
+ * A value in the details of a tracked event: a string, a number, a boolean, or an array or object
45
+ * of such values.
46
+ */
47
+ type TrackedEventDetailValue = string | number | boolean | TrackedEventDetailValue[] | {
48
+ [key: string]: TrackedEventDetailValue;
49
+ };
50
+ /**
51
+ * Details of a tracked event, such as the plan a customer chose. Details with more than 20
52
+ * top-level keys, or larger than 1 KB as JSON, are left out and the event is still reported.
53
+ */
54
+ type TrackedEventDetails = {
55
+ [key: string]: TrackedEventDetailValue;
56
+ };
57
+ /**
58
+ * What a tracked event carries besides its name.
59
+ */
60
+ type TrackOptions = {
61
+ /**
62
+ * A number the event measures, such as an amount of money, a count or a duration. A value that
63
+ * is not a finite number is left out and the event is still reported.
64
+ */
65
+ value?: number; /** Details of the event. */
66
+ details?: TrackedEventDetails;
67
+ };
29
68
  /**
30
69
  * The context to be sent to ConfigDirector: the user or other entity, such as a device or an
31
70
  * organization, that configs are evaluated for. This context will be used for targeting rules
@@ -294,4 +333,4 @@ interface ModuleOptions {
294
333
  }
295
334
  declare const _default: _$_nuxt_schema0.NuxtModule<ModuleOptions, ModuleOptions, false>;
296
335
  //#endregion
297
- export { type ConfigEvaluation, type EvaluationReason, ModuleOptions, type OfflineValue, type OfflineValues, _default as default };
336
+ export { type ConfigEvaluation, type EvaluationReason, ModuleOptions, type OfflineValue, type OfflineValues, type TrackOptions, type TrackedEventDetailValue, type TrackedEventDetails, type Variation, _default as default };
package/dist/module.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=4.0.0"
6
6
  },
7
- "version": "1.13.2"
7
+ "version": "1.14.0"
8
8
  }
@@ -1,4 +1,4 @@
1
- import { n as ConfigDirectorClient } from "../../types-BvqduMQP.mjs";
1
+ import { n as ConfigDirectorClient } from "../../types-BNw2c3C0.mjs";
2
2
 
3
3
  //#region src/runtime/app/composables/useConfigDirectorClient.d.ts
4
4
  declare const useConfigDirectorClient: () => {
@@ -1,4 +1,4 @@
1
- import { n as ConfigDirectorClient } from "../../types-BvqduMQP.mjs";
1
+ import { n as ConfigDirectorClient } from "../../types-BNw2c3C0.mjs";
2
2
 
3
3
  //#region src/runtime/app/composables/useConfigDirectorClient.d.ts
4
4
  declare const useConfigDirectorClient: () => {
@@ -1,4 +1,4 @@
1
- import { t as ClientHooks } from "../../types-BvqduMQP.mjs";
1
+ import { t as ClientHooks } from "../../types-BNw2c3C0.mjs";
2
2
 
3
3
  //#region src/runtime/app/composables/useConfigDirectorClientHooks.d.ts
4
4
  declare const useConfigDirectorClientHooks: (hooks: ClientHooks) => void;
@@ -1,4 +1,4 @@
1
- import { t as ClientHooks } from "../../types-BvqduMQP.mjs";
1
+ import { t as ClientHooks } from "../../types-BNw2c3C0.mjs";
2
2
 
3
3
  //#region src/runtime/app/composables/useConfigDirectorClientHooks.d.ts
4
4
  declare const useConfigDirectorClientHooks: (hooks: ClientHooks) => void;
@@ -1,4 +1,4 @@
1
- import { n as ConfigDirectorContext } from "../../native-values-CfhP0yLS.mjs";
1
+ import { n as ConfigDirectorContext } from "../../native-values-Cq3SCmEH.mjs";
2
2
  import { Ref } from "vue";
3
3
 
4
4
  //#region src/runtime/app/composables/useConfigDirectorContext.d.ts
@@ -1,4 +1,4 @@
1
- import { n as ConfigDirectorContext } from "../../native-values-CfhP0yLS.mjs";
1
+ import { n as ConfigDirectorContext } from "../../native-values-Cq3SCmEH.mjs";
2
2
  import { Ref } from "vue";
3
3
 
4
4
  //#region src/runtime/app/composables/useConfigDirectorContext.d.ts
@@ -1,4 +1,4 @@
1
- import { a as ConfigValueType } from "../../native-values-CfhP0yLS.mjs";
1
+ import { a as ConfigValueType } from "../../native-values-Cq3SCmEH.mjs";
2
2
  import { t as ClientStatus } from "../../types-C30VJ25l.mjs";
3
3
  import { DeepReadonly, Ref, ShallowRef } from "vue";
4
4
 
@@ -1,4 +1,4 @@
1
- import { a as ConfigValueType } from "../../native-values-CfhP0yLS.mjs";
1
+ import { a as ConfigValueType } from "../../native-values-Cq3SCmEH.mjs";
2
2
  import { t as ClientStatus } from "../../types-C30VJ25l.mjs";
3
3
  import { DeepReadonly, Ref, ShallowRef } from "vue";
4
4
 
@@ -11,27 +11,72 @@ type ConfigState = {
11
11
  type: ConfigType;
12
12
  value: string | undefined | null;
13
13
  valueId?: string | undefined | null;
14
+ variation?: {
15
+ id: string;
16
+ name?: string | undefined | null;
17
+ } | undefined | null;
18
+ ruleId?: string | undefined | null;
19
+ shareId?: string | undefined | null;
14
20
  };
15
21
  /**
16
22
  * Why an evaluation returned the value it did. `found-match` returns a value from ConfigDirector,
17
- * and `cached` a value kept on the device while a client SDK waits for live values. `value-missing`
23
+ * and `cached` a value kept on the device while a client SDK waits for live values.
24
+ * `rollout-skipped-no-identifier` returns the default targeting rule value: a server SDK skipped a
25
+ * percentage rollout because the context has no `id` to place it in a share. `value-missing`
18
26
  * returns the in-code default value because the config has no value. Every other reason returns the
19
27
  * in-code default value because of an error: the config does not exist (`config-state-missing`), no
20
28
  * values have arrived yet (`client-not-ready`), or the value cannot be read as the type of the in-code
21
29
  * default value.
22
30
  */
23
- type EvaluationReason = "found-match" | "config-state-missing" | "client-not-ready" | "type-mismatch" | "value-missing" | "invalid-number" | "invalid-json" | "invalid-boolean" | "cached";
31
+ type EvaluationReason = "found-match" | "rollout-skipped-no-identifier" | "config-state-missing" | "client-not-ready" | "type-mismatch" | "value-missing" | "invalid-number" | "invalid-json" | "invalid-boolean" | "cached";
32
+ /**
33
+ * One of the values a config can serve, such as the control or a treatment of an experiment.
34
+ */
35
+ type Variation = {
36
+ /** The ID ConfigDirector assigned to the variation, which stays the same when it is renamed. */id: string; /** The variation's name, when it has one. */
37
+ name?: string;
38
+ };
24
39
  /**
25
40
  * One evaluation of a config: the value it returned, why, and the context it was evaluated for.
26
41
  */
27
42
  type ConfigEvaluation<T extends ConfigValueType = ConfigValueType> = {
28
43
  /** The config key that was evaluated. */key: string; /** The value returned, which is the in-code default value when {@link isDefaultValue} is `true`. */
29
44
  value: T; /** The ID ConfigDirector assigned to the value returned, when ConfigDirector sent one with it. */
30
- valueId?: string; /** Whether the evaluation returned the in-code default value. */
45
+ valueId?: string;
46
+ /**
47
+ * The variation that was served. It is `undefined` when the config has no variations or the
48
+ * in-code default value is returned.
49
+ */
50
+ variation?: Variation; /** Whether the evaluation returned the in-code default value. */
31
51
  isDefaultValue: boolean; /** Why the evaluation returned this value. */
32
52
  reason: EvaluationReason; /** The context the config was evaluated for, if any. */
33
53
  context?: ConfigDirectorContext;
34
54
  };
55
+ /**
56
+ * A value in the details of a tracked event: a string, a number, a boolean, or an array or object
57
+ * of such values.
58
+ */
59
+ type TrackedEventDetailValue = string | number | boolean | TrackedEventDetailValue[] | {
60
+ [key: string]: TrackedEventDetailValue;
61
+ };
62
+ /**
63
+ * Details of a tracked event, such as the plan a customer chose. Details with more than 20
64
+ * top-level keys, or larger than 1 KB as JSON, are left out and the event is still reported.
65
+ */
66
+ type TrackedEventDetails = {
67
+ [key: string]: TrackedEventDetailValue;
68
+ };
69
+ /**
70
+ * What a tracked event carries besides its name.
71
+ */
72
+ type TrackOptions = {
73
+ /**
74
+ * A number the event measures, such as an amount of money, a count or a duration. A value that
75
+ * is not a finite number is left out and the event is still reported.
76
+ */
77
+ value?: number; /** Details of the event. */
78
+ details?: TrackedEventDetails;
79
+ };
35
80
  /**
36
81
  * The context to be sent to ConfigDirector: the user or other entity, such as a device or an
37
82
  * organization, that configs are evaluated for. This context will be used for targeting rules
@@ -93,4 +138,4 @@ type NativeValue = boolean | number | string | NativeJsonValue[] | {
93
138
  };
94
139
  type NativeValues = Record<string, NativeValue>;
95
140
  //#endregion
96
- export { ConfigValueType as a, ConfigState as i, ConfigDirectorContext as n, ConnectionMode as o, ConfigEvaluation as r, NativeValues as t };
141
+ export { ConfigValueType as a, ConfigState as i, ConfigDirectorContext as n, ConnectionMode as o, ConfigEvaluation as r, TrackOptions as s, NativeValues as t };
@@ -1,4 +1,4 @@
1
- import { t as NativeValues } from "../native-values-CfhP0yLS.mjs";
1
+ import { t as NativeValues } from "../native-values-Cq3SCmEH.mjs";
2
2
  import * as _$h3 from "h3";
3
3
 
4
4
  //#region src/runtime/nitro/offline-values.d.ts
@@ -1,4 +1,4 @@
1
- import { t as NativeValues } from "../native-values-CfhP0yLS.mjs";
1
+ import { t as NativeValues } from "../native-values-Cq3SCmEH.mjs";
2
2
  import * as _$h3 from "h3";
3
3
 
4
4
  //#region src/runtime/nitro/offline-values.d.ts
@@ -1,5 +1,5 @@
1
- import { o as ConnectionMode } from "../native-values-CfhP0yLS.mjs";
2
- import { n as ConfigDirectorClient } from "../types-qDEc6g8R.mjs";
1
+ import { o as ConnectionMode } from "../native-values-Cq3SCmEH.mjs";
2
+ import { n as ConfigDirectorClient } from "../types-CYquNKWW.mjs";
3
3
  import * as _$nitropack from "nitropack";
4
4
 
5
5
  //#region src/runtime/nitro/plugin.d.ts
@@ -11,5 +11,12 @@ declare module "nitropack" {
11
11
  configDirectorInitialization: Promise<void>;
12
12
  }
13
13
  }
14
+ declare module "nitropack/types" {
15
+ interface NitroApp {
16
+ configDirectorClient: ConfigDirectorClient;
17
+ configDirectorConnectionMode: ConnectionMode;
18
+ configDirectorInitialization: Promise<void>;
19
+ }
20
+ }
14
21
  //#endregion
15
22
  export { _default as default };
@@ -1,5 +1,5 @@
1
- import { o as ConnectionMode } from "../native-values-CfhP0yLS.mjs";
2
- import { n as ConfigDirectorClient } from "../types-qDEc6g8R.mjs";
1
+ import { o as ConnectionMode } from "../native-values-Cq3SCmEH.mjs";
2
+ import { n as ConfigDirectorClient } from "../types-CYquNKWW.mjs";
3
3
  import * as _$nitropack from "nitropack";
4
4
 
5
5
  //#region src/runtime/nitro/plugin.d.ts
@@ -11,5 +11,12 @@ declare module "nitropack" {
11
11
  configDirectorInitialization: Promise<void>;
12
12
  }
13
13
  }
14
+ declare module "nitropack/types" {
15
+ interface NitroApp {
16
+ configDirectorClient: ConfigDirectorClient;
17
+ configDirectorConnectionMode: ConnectionMode;
18
+ configDirectorInitialization: Promise<void>;
19
+ }
20
+ }
14
21
  //#endregion
15
22
  export { _default as default };