@configdirector/nextjs-sdk 1.9.2 → 1.10.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 (49) hide show
  1. package/dist/client/index.cjs +1 -1
  2. package/dist/client/index.d.cts +1 -1
  3. package/dist/client/index.d.mts +1 -1
  4. package/dist/client/index.mjs +1 -1
  5. package/dist/client/index.mjs.map +1 -1
  6. package/dist/client/installedTestClient-CW29YuQC.cjs +6 -0
  7. package/dist/client/installedTestClient-CpjJvHZD.mjs +7 -0
  8. package/dist/client/installedTestClient-CpjJvHZD.mjs.map +1 -0
  9. package/dist/client/testing.cjs +1 -1
  10. package/dist/client/testing.d.cts +3 -2
  11. package/dist/client/testing.d.cts.map +1 -1
  12. package/dist/client/testing.d.mts +3 -2
  13. package/dist/client/testing.d.mts.map +1 -1
  14. package/dist/client/testing.mjs +1 -1
  15. package/dist/client/testing.mjs.map +1 -1
  16. package/dist/client/{types-fL7X5zwg.d.cts → types-Cz68hQ6f.d.cts} +35 -14
  17. package/dist/client/types-Cz68hQ6f.d.cts.map +1 -0
  18. package/dist/client/{types-DA2VZKNX.d.mts → types-De4z0tu4.d.mts} +35 -14
  19. package/dist/client/types-De4z0tu4.d.mts.map +1 -0
  20. package/dist/server/{DefaultConfigDirectorClient-DyFVzSHP.mjs → DefaultConfigDirectorClient-BTTja_j3.mjs} +2 -2
  21. package/dist/server/DefaultConfigDirectorClient-BTTja_j3.mjs.map +1 -0
  22. package/dist/server/{DefaultConfigDirectorClient-BZwAj0iJ.cjs → DefaultConfigDirectorClient-CqXqwNpW.cjs} +1 -1
  23. package/dist/server/index.cjs +1 -1
  24. package/dist/server/index.d.cts +1 -1
  25. package/dist/server/index.d.cts.map +1 -1
  26. package/dist/server/index.d.mts +1 -1
  27. package/dist/server/index.d.mts.map +1 -1
  28. package/dist/server/index.mjs +1 -1
  29. package/dist/server/index.mjs.map +1 -1
  30. package/dist/server/testing.cjs +1 -1
  31. package/dist/server/testing.d.cts +4 -2
  32. package/dist/server/testing.d.cts.map +1 -1
  33. package/dist/server/testing.d.mts +4 -2
  34. package/dist/server/testing.d.mts.map +1 -1
  35. package/dist/server/testing.mjs +1 -1
  36. package/dist/server/testing.mjs.map +1 -1
  37. package/dist/server/{types-DnzM2ukj.d.cts → types-BBEEMV5Y.d.cts} +23 -10
  38. package/dist/server/types-BBEEMV5Y.d.cts.map +1 -0
  39. package/dist/server/{types-qIeNbtNf.d.mts → types-B_mGbQaa.d.mts} +23 -10
  40. package/dist/server/types-B_mGbQaa.d.mts.map +1 -0
  41. package/package.json +1 -1
  42. package/dist/client/installedTestClient-CDdDsfVQ.mjs +0 -7
  43. package/dist/client/installedTestClient-CDdDsfVQ.mjs.map +0 -1
  44. package/dist/client/installedTestClient-DH7rRR-J.cjs +0 -6
  45. package/dist/client/types-DA2VZKNX.d.mts.map +0 -1
  46. package/dist/client/types-fL7X5zwg.d.cts.map +0 -1
  47. package/dist/server/DefaultConfigDirectorClient-DyFVzSHP.mjs.map +0 -1
  48. package/dist/server/types-DnzM2ukj.d.cts.map +0 -1
  49. package/dist/server/types-qIeNbtNf.d.mts.map +0 -1
@@ -40,27 +40,40 @@ type ConfigEvaluation = {
40
40
  context?: ConfigDirectorContext;
41
41
  };
42
42
  /**
43
- * The user's context to be sent to ConfigDirector. This context will be used for targeting
44
- * rules evaluation.
43
+ * The context to be sent to ConfigDirector: the user or other entity, such as a device or an
44
+ * organization, that configs are evaluated for. This context will be used for targeting rules
45
+ * evaluation.
45
46
  */
46
47
  type ConfigDirectorContext = {
47
48
  /**
48
- * The user's identifier. This should be a value that uniquely identifies an application
49
- * user.
49
+ * The context's identifier. This should be a value that uniquely identifies the user or other
50
+ * entity among contexts of the same {@link kind}.
50
51
  * In the case of anonymous users, you could generate a UUID or alternatively not provide
51
52
  * the {@link id} and the SDK will generate a random UUID. However, keep in mind that this
52
- * value is used for segmenting users in percentage rollouts, and changes to the {@link id}
53
- * could result in the user being assigned to a different percentile.
53
+ * value is used for segmenting contexts in percentage rollouts, and changes to the {@link id}
54
+ * could result in the context being assigned to a different percentile.
54
55
  */
55
56
  id?: string;
56
57
  /**
57
- * The user's display name. This will be shown in the ConfigDirector dashboard and may be
58
+ * The kind of entity this context represents, such as `user`, `device`, `organization`,
59
+ * `tenant` or `listing`. You can use any other kind that fits your application. A kind has 1
60
+ * to 64 characters, using only lowercase letters (`a`-`z`), digits, `-` and `_`. It is used
61
+ * exactly as given, without trimming or changing its case.
62
+ *
63
+ * A context with an invalid kind is ignored as a whole: the SDK logs an error and evaluates
64
+ * as if no context had been provided.
65
+ *
66
+ * @default "user"
67
+ */
68
+ kind?: string;
69
+ /**
70
+ * The context's display name. This will be shown in the ConfigDirector dashboard and may be
58
71
  * used for targeting rules.
59
72
  */
60
73
  name?: string;
61
74
  /**
62
- * Any arbitrary traits for the current user. They will be shown in the ConfigDirector
63
- * dashboard and may be used for targeting rules.
75
+ * Any arbitrary traits for the context. They will be shown in the ConfigDirector dashboard
76
+ * and may be used for targeting rules.
64
77
  */
65
78
  traits?: {
66
79
  [key: string]: unknown;
@@ -126,17 +139,25 @@ interface ConfigDirectorClient extends EventProvider<ClientEvents> {
126
139
  * not attempt to re-connect and an error will be logged to the console or the provided
127
140
  * logger.
128
141
  *
129
- * @param context The current user's context to be used for evaluating targeting rules (optional).
142
+ * A context whose {@link ConfigDirectorContext.kind} is invalid is ignored as a whole: an error is
143
+ * logged, and the client connects as if no context had been provided.
144
+ *
145
+ * @param context The current context to be used for evaluating targeting rules (optional).
130
146
  */
131
147
  initialize(context?: ConfigDirectorContext): Promise<void>;
132
148
  /**
133
- * Updates the user's context and re-evaluates all config and flag values based on the new context.
149
+ * Updates the context and re-evaluates all config and flag values based on the new context.
150
+ *
151
+ * A context whose {@link ConfigDirectorContext.kind} is invalid is ignored as a whole: an error is
152
+ * logged, the previous context is no longer used, and the client connects as if no context had been
153
+ * provided.
134
154
  *
135
- * @param context The current user's context to be used for evaluating targeting rules (required).
155
+ * @param context The current context to be used for evaluating targeting rules (required).
136
156
  */
137
157
  updateContext(context: ConfigDirectorContext): Promise<void>;
138
158
  /**
139
- * Returns the current context the client is configured with, or undefined if there is no context.
159
+ * Returns the current context the client is configured with, or undefined if there is no context,
160
+ * including after a context with an invalid kind was ignored.
140
161
  *
141
162
  * Note that the value returned does not updated immediately after calling {@link updateContext}. Only
142
163
  * once the underlying connection was successful or timed out, the current context is updated. This is
@@ -217,4 +238,4 @@ interface ConfigDirectorClient extends EventProvider<ClientEvents> {
217
238
  }
218
239
  //#endregion
219
240
  export { ConfigDirectorLoggingLevel as a, ConnectionMode as c, ConfigDirectorLogger as i, ConfigDirectorClient as n, ConfigState as o, ConfigDirectorContext as r, ConfigValueType as s, ClientHooks as t };
220
- //# sourceMappingURL=types-DA2VZKNX.d.mts.map
241
+ //# sourceMappingURL=types-De4z0tu4.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-De4z0tu4.d.mts","names":[],"sources":["../../../js-client-core/src/Emitter.ts","../../../shared/src/types.ts","../../../js-client-core/src/types.ts"],"mappings":";;KAAK,SAAA;AAAA,KACA,YAAA,GAAe,MAAA,CAAO,SAAA;AAAA,KAEtB,OAAA,uBAA8B,YAAA,qBAAiC,aAAA,KAClE,OAAA,EAAS,aAAA,CAAc,IAAA;AAAA,UAGR,aAAA,uBAAoC,YAAA;EACnD,EAAA,qBAAuB,aAAA,EAAe,IAAA,EAAM,KAAA,EAAO,OAAA,EAAS,OAAA,CAAQ,aAAA,EAAe,KAAA;EACnF,GAAA,qBAAwB,aAAA,EAAe,IAAA,EAAM,KAAA,EAAO,OAAA,GAAU,OAAA,CAAQ,aAAA,EAAe,KAAA;EACrF,KAAA;AAAA;;;cCVW,cAAA;AAAA,KAUD,UAAA,WAAqB,cAAA;AAAA,KAErB,kBAAA;EAAA,CAAwB,GAAA;AAAA;AAAA,KAExB,eAAA,wCAAuD,kBAAA;AAAA,KAEvD,WAAA;EACV,EAAA;EACA,GAAA;EACA,IAA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