@aws-lambda-powertools/feature-flags 0.0.0-stage → 2.37.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 (196) hide show
  1. package/README.md +71 -2
  2. package/lib/cjs/FeatureFlags.d.ts +98 -0
  3. package/lib/cjs/FeatureFlags.d.ts.map +1 -0
  4. package/lib/cjs/FeatureFlags.js +260 -0
  5. package/lib/cjs/appconfig/appConfigStore.d.ts +38 -0
  6. package/lib/cjs/appconfig/appConfigStore.d.ts.map +1 -0
  7. package/lib/cjs/appconfig/appConfigStore.js +65 -0
  8. package/lib/cjs/appconfig/index.d.ts +4 -0
  9. package/lib/cjs/appconfig/index.d.ts.map +1 -0
  10. package/lib/cjs/appconfig/index.js +5 -0
  11. package/lib/cjs/appconfig-agent/appConfigAgentStore.d.ts +37 -0
  12. package/lib/cjs/appconfig-agent/appConfigAgentStore.d.ts.map +1 -0
  13. package/lib/cjs/appconfig-agent/appConfigAgentStore.js +59 -0
  14. package/lib/cjs/appconfig-agent/appConfigVariantStore.d.ts +46 -0
  15. package/lib/cjs/appconfig-agent/appConfigVariantStore.d.ts.map +1 -0
  16. package/lib/cjs/appconfig-agent/appConfigVariantStore.js +176 -0
  17. package/lib/cjs/appconfig-agent/index.d.ts +6 -0
  18. package/lib/cjs/appconfig-agent/index.d.ts.map +1 -0
  19. package/lib/cjs/appconfig-agent/index.js +8 -0
  20. package/lib/cjs/constants.d.ts +56 -0
  21. package/lib/cjs/constants.d.ts.map +1 -0
  22. package/lib/cjs/constants.js +86 -0
  23. package/lib/cjs/context.d.ts +21 -0
  24. package/lib/cjs/context.d.ts.map +1 -0
  25. package/lib/cjs/context.js +42 -0
  26. package/lib/cjs/envelope/index.d.ts +20 -0
  27. package/lib/cjs/envelope/index.d.ts.map +1 -0
  28. package/lib/cjs/envelope/index.js +29 -0
  29. package/lib/cjs/errors.d.ts +74 -0
  30. package/lib/cjs/errors.d.ts.map +1 -0
  31. package/lib/cjs/errors.js +116 -0
  32. package/lib/cjs/index.d.ts +6 -0
  33. package/lib/cjs/index.d.ts.map +1 -0
  34. package/lib/cjs/index.js +15 -0
  35. package/lib/cjs/package.json +1 -0
  36. package/lib/cjs/parameters-stores/classify.d.ts +20 -0
  37. package/lib/cjs/parameters-stores/classify.d.ts.map +1 -0
  38. package/lib/cjs/parameters-stores/classify.js +50 -0
  39. package/lib/cjs/parameters-stores/createDocumentSource.d.ts +17 -0
  40. package/lib/cjs/parameters-stores/createDocumentSource.d.ts.map +1 -0
  41. package/lib/cjs/parameters-stores/createDocumentSource.js +31 -0
  42. package/lib/cjs/parameters-stores/envelope.d.ts +22 -0
  43. package/lib/cjs/parameters-stores/envelope.d.ts.map +1 -0
  44. package/lib/cjs/parameters-stores/envelope.js +39 -0
  45. package/lib/cjs/ruleEngine/actions.d.ts +5 -0
  46. package/lib/cjs/ruleEngine/actions.d.ts.map +1 -0
  47. package/lib/cjs/ruleEngine/actions.js +155 -0
  48. package/lib/cjs/ruleEngine/datetime.d.ts +12 -0
  49. package/lib/cjs/ruleEngine/datetime.d.ts.map +1 -0
  50. package/lib/cjs/ruleEngine/datetime.js +134 -0
  51. package/lib/cjs/ruleEngine/evaluate.d.ts +15 -0
  52. package/lib/cjs/ruleEngine/evaluate.d.ts.map +1 -0
  53. package/lib/cjs/ruleEngine/evaluate.js +60 -0
  54. package/lib/cjs/ruleEngine/guards.d.ts +51 -0
  55. package/lib/cjs/ruleEngine/guards.d.ts.map +1 -0
  56. package/lib/cjs/ruleEngine/guards.js +123 -0
  57. package/lib/cjs/ruleEngine/index.d.ts +35 -0
  58. package/lib/cjs/ruleEngine/index.d.ts.map +1 -0
  59. package/lib/cjs/ruleEngine/index.js +70 -0
  60. package/lib/cjs/ruleEngine/json.d.ts +16 -0
  61. package/lib/cjs/ruleEngine/json.d.ts.map +1 -0
  62. package/lib/cjs/ruleEngine/json.js +38 -0
  63. package/lib/cjs/ruleEngine/time.d.ts +14 -0
  64. package/lib/cjs/ruleEngine/time.d.ts.map +1 -0
  65. package/lib/cjs/ruleEngine/time.js +102 -0
  66. package/lib/cjs/ruleEngine/validate.d.ts +11 -0
  67. package/lib/cjs/ruleEngine/validate.d.ts.map +1 -0
  68. package/lib/cjs/ruleEngine/validate.js +134 -0
  69. package/lib/cjs/ruleEngine/validateScheduleAndModulo.d.ts +13 -0
  70. package/lib/cjs/ruleEngine/validateScheduleAndModulo.d.ts.map +1 -0
  71. package/lib/cjs/ruleEngine/validateScheduleAndModulo.js +38 -0
  72. package/lib/cjs/ruleEngine/validationCache.d.ts +12 -0
  73. package/lib/cjs/ruleEngine/validationCache.d.ts.map +1 -0
  74. package/lib/cjs/ruleEngine/validationCache.js +29 -0
  75. package/lib/cjs/types/AppConfigAgentStore.d.ts +20 -0
  76. package/lib/cjs/types/AppConfigAgentStore.d.ts.map +1 -0
  77. package/lib/cjs/types/AppConfigAgentStore.js +2 -0
  78. package/lib/cjs/types/AppConfigStore.d.ts +25 -0
  79. package/lib/cjs/types/AppConfigStore.d.ts.map +1 -0
  80. package/lib/cjs/types/AppConfigStore.js +2 -0
  81. package/lib/cjs/types/AppConfigVariantStore.d.ts +16 -0
  82. package/lib/cjs/types/AppConfigVariantStore.d.ts.map +1 -0
  83. package/lib/cjs/types/AppConfigVariantStore.js +2 -0
  84. package/lib/cjs/types/Envelope.d.ts +16 -0
  85. package/lib/cjs/types/Envelope.d.ts.map +1 -0
  86. package/lib/cjs/types/Envelope.js +2 -0
  87. package/lib/cjs/types/RuleEngine.d.ts +83 -0
  88. package/lib/cjs/types/RuleEngine.d.ts.map +1 -0
  89. package/lib/cjs/types/RuleEngine.js +2 -0
  90. package/lib/cjs/types/VariantEvaluation.d.ts +20 -0
  91. package/lib/cjs/types/VariantEvaluation.d.ts.map +1 -0
  92. package/lib/cjs/types/VariantEvaluation.js +2 -0
  93. package/lib/cjs/types/index.d.ts +81 -0
  94. package/lib/cjs/types/index.d.ts.map +1 -0
  95. package/lib/cjs/types/index.js +2 -0
  96. package/lib/cjs/variant.d.ts +9 -0
  97. package/lib/cjs/variant.d.ts.map +1 -0
  98. package/lib/cjs/variant.js +26 -0
  99. package/lib/esm/FeatureFlags.d.ts +98 -0
  100. package/lib/esm/FeatureFlags.d.ts.map +1 -0
  101. package/lib/esm/FeatureFlags.js +257 -0
  102. package/lib/esm/appconfig/appConfigStore.d.ts +38 -0
  103. package/lib/esm/appconfig/appConfigStore.d.ts.map +1 -0
  104. package/lib/esm/appconfig/appConfigStore.js +62 -0
  105. package/lib/esm/appconfig/index.d.ts +4 -0
  106. package/lib/esm/appconfig/index.d.ts.map +1 -0
  107. package/lib/esm/appconfig/index.js +1 -0
  108. package/lib/esm/appconfig-agent/appConfigAgentStore.d.ts +37 -0
  109. package/lib/esm/appconfig-agent/appConfigAgentStore.d.ts.map +1 -0
  110. package/lib/esm/appconfig-agent/appConfigAgentStore.js +56 -0
  111. package/lib/esm/appconfig-agent/appConfigVariantStore.d.ts +46 -0
  112. package/lib/esm/appconfig-agent/appConfigVariantStore.d.ts.map +1 -0
  113. package/lib/esm/appconfig-agent/appConfigVariantStore.js +172 -0
  114. package/lib/esm/appconfig-agent/index.d.ts +6 -0
  115. package/lib/esm/appconfig-agent/index.d.ts.map +1 -0
  116. package/lib/esm/appconfig-agent/index.js +2 -0
  117. package/lib/esm/constants.d.ts +56 -0
  118. package/lib/esm/constants.d.ts.map +1 -0
  119. package/lib/esm/constants.js +77 -0
  120. package/lib/esm/context.d.ts +21 -0
  121. package/lib/esm/context.d.ts.map +1 -0
  122. package/lib/esm/context.js +37 -0
  123. package/lib/esm/envelope/index.d.ts +20 -0
  124. package/lib/esm/envelope/index.d.ts.map +1 -0
  125. package/lib/esm/envelope/index.js +26 -0
  126. package/lib/esm/errors.d.ts +74 -0
  127. package/lib/esm/errors.d.ts.map +1 -0
  128. package/lib/esm/errors.js +107 -0
  129. package/lib/esm/index.d.ts +6 -0
  130. package/lib/esm/index.d.ts.map +1 -0
  131. package/lib/esm/index.js +3 -0
  132. package/lib/esm/package.json +1 -0
  133. package/lib/esm/parameters-stores/classify.d.ts +20 -0
  134. package/lib/esm/parameters-stores/classify.d.ts.map +1 -0
  135. package/lib/esm/parameters-stores/classify.js +47 -0
  136. package/lib/esm/parameters-stores/createDocumentSource.d.ts +17 -0
  137. package/lib/esm/parameters-stores/createDocumentSource.d.ts.map +1 -0
  138. package/lib/esm/parameters-stores/createDocumentSource.js +28 -0
  139. package/lib/esm/parameters-stores/envelope.d.ts +22 -0
  140. package/lib/esm/parameters-stores/envelope.d.ts.map +1 -0
  141. package/lib/esm/parameters-stores/envelope.js +35 -0
  142. package/lib/esm/ruleEngine/actions.d.ts +5 -0
  143. package/lib/esm/ruleEngine/actions.d.ts.map +1 -0
  144. package/lib/esm/ruleEngine/actions.js +152 -0
  145. package/lib/esm/ruleEngine/datetime.d.ts +12 -0
  146. package/lib/esm/ruleEngine/datetime.d.ts.map +1 -0
  147. package/lib/esm/ruleEngine/datetime.js +131 -0
  148. package/lib/esm/ruleEngine/evaluate.d.ts +15 -0
  149. package/lib/esm/ruleEngine/evaluate.d.ts.map +1 -0
  150. package/lib/esm/ruleEngine/evaluate.js +57 -0
  151. package/lib/esm/ruleEngine/guards.d.ts +51 -0
  152. package/lib/esm/ruleEngine/guards.d.ts.map +1 -0
  153. package/lib/esm/ruleEngine/guards.js +113 -0
  154. package/lib/esm/ruleEngine/index.d.ts +35 -0
  155. package/lib/esm/ruleEngine/index.d.ts.map +1 -0
  156. package/lib/esm/ruleEngine/index.js +67 -0
  157. package/lib/esm/ruleEngine/json.d.ts +16 -0
  158. package/lib/esm/ruleEngine/json.d.ts.map +1 -0
  159. package/lib/esm/ruleEngine/json.js +34 -0
  160. package/lib/esm/ruleEngine/time.d.ts +14 -0
  161. package/lib/esm/ruleEngine/time.d.ts.map +1 -0
  162. package/lib/esm/ruleEngine/time.js +97 -0
  163. package/lib/esm/ruleEngine/validate.d.ts +11 -0
  164. package/lib/esm/ruleEngine/validate.d.ts.map +1 -0
  165. package/lib/esm/ruleEngine/validate.js +131 -0
  166. package/lib/esm/ruleEngine/validateScheduleAndModulo.d.ts +13 -0
  167. package/lib/esm/ruleEngine/validateScheduleAndModulo.d.ts.map +1 -0
  168. package/lib/esm/ruleEngine/validateScheduleAndModulo.js +35 -0
  169. package/lib/esm/ruleEngine/validationCache.d.ts +12 -0
  170. package/lib/esm/ruleEngine/validationCache.d.ts.map +1 -0
  171. package/lib/esm/ruleEngine/validationCache.js +26 -0
  172. package/lib/esm/types/AppConfigAgentStore.d.ts +20 -0
  173. package/lib/esm/types/AppConfigAgentStore.d.ts.map +1 -0
  174. package/lib/esm/types/AppConfigAgentStore.js +1 -0
  175. package/lib/esm/types/AppConfigStore.d.ts +25 -0
  176. package/lib/esm/types/AppConfigStore.d.ts.map +1 -0
  177. package/lib/esm/types/AppConfigStore.js +1 -0
  178. package/lib/esm/types/AppConfigVariantStore.d.ts +16 -0
  179. package/lib/esm/types/AppConfigVariantStore.d.ts.map +1 -0
  180. package/lib/esm/types/AppConfigVariantStore.js +1 -0
  181. package/lib/esm/types/Envelope.d.ts +16 -0
  182. package/lib/esm/types/Envelope.d.ts.map +1 -0
  183. package/lib/esm/types/Envelope.js +1 -0
  184. package/lib/esm/types/RuleEngine.d.ts +83 -0
  185. package/lib/esm/types/RuleEngine.d.ts.map +1 -0
  186. package/lib/esm/types/RuleEngine.js +1 -0
  187. package/lib/esm/types/VariantEvaluation.d.ts +20 -0
  188. package/lib/esm/types/VariantEvaluation.d.ts.map +1 -0
  189. package/lib/esm/types/VariantEvaluation.js +1 -0
  190. package/lib/esm/types/index.d.ts +81 -0
  191. package/lib/esm/types/index.d.ts.map +1 -0
  192. package/lib/esm/types/index.js +1 -0
  193. package/lib/esm/variant.d.ts +9 -0
  194. package/lib/esm/variant.d.ts.map +1 -0
  195. package/lib/esm/variant.js +21 -0
  196. package/package.json +137 -3
@@ -0,0 +1,20 @@
1
+ import type { GenericLogger } from '@aws-lambda-powertools/commons/types';
2
+ import type { EnvelopeOptions } from './Envelope.js';
3
+ /**
4
+ * Configures Agent retrieval and local evaluation of a freeform Flag Document.
5
+ * @expand
6
+ */
7
+ type AppConfigAgentStoreOptions = EnvelopeOptions & {
8
+ /** Identifies the configuration profile by name or ID. */
9
+ name: string;
10
+ /** Identifies the environment by name or ID. */
11
+ environment: string;
12
+ /** Identifies the application, defaulting to `POWERTOOLS_SERVICE_NAME`. */
13
+ application?: string;
14
+ /** Sets the Agent request timeout in milliseconds. */
15
+ timeout?: number;
16
+ /** Logs rule engine warnings and outcomes without values. */
17
+ logger?: GenericLogger;
18
+ };
19
+ export type { AppConfigAgentStoreOptions };
20
+ //# sourceMappingURL=AppConfigAgentStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppConfigAgentStore.d.ts","sourceRoot":"","sources":["../../../src/types/AppConfigAgentStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD;;;GAGG;AACH,KAAK,0BAA0B,GAAG,eAAe,GAAG;IAClD,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,WAAW,EAAE,MAAM,CAAC;IACpB,2EAA2E;IAC3E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB,CAAC;AAEF,YAAY,EAAE,0BAA0B,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ import type { GenericLogger } from '@aws-lambda-powertools/commons/types';
2
+ import type { AppConfigDataClient, AppConfigDataClientConfig } from '@aws-sdk/client-appconfigdata';
3
+ import type { EnvelopeOptions } from './Envelope.js';
4
+ /**
5
+ * Configures retrieval and local evaluation of an AppConfig freeform Flag Document.
6
+ * @expand
7
+ */
8
+ type AppConfigStoreOptions = EnvelopeOptions & {
9
+ /** Identifies the configuration profile by name or ID. */
10
+ name: string;
11
+ /** Identifies the environment by name or ID. */
12
+ environment: string;
13
+ /** Identifies the application, defaulting to `POWERTOOLS_SERVICE_NAME`. */
14
+ application?: string;
15
+ /** Sets the Parameters cache duration in seconds. */
16
+ maxAge?: number;
17
+ /** Supplies the AppConfigData client instead of creating one. */
18
+ awsSdkV3Client?: AppConfigDataClient;
19
+ /** Configures the AppConfigData client when no client is supplied. */
20
+ clientConfig?: AppConfigDataClientConfig;
21
+ /** Logs rule engine warnings and outcomes without values. */
22
+ logger?: GenericLogger;
23
+ };
24
+ export type { AppConfigStoreOptions };
25
+ //# sourceMappingURL=AppConfigStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppConfigStore.d.ts","sourceRoot":"","sources":["../../../src/types/AppConfigStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,KAAK,EACV,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD;;;GAGG;AACH,KAAK,qBAAqB,GAAG,eAAe,GAAG;IAC7C,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,WAAW,EAAE,MAAM,CAAC;IACpB,2EAA2E;IAC3E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,cAAc,CAAC,EAAE,mBAAmB,CAAC;IACrC,sEAAsE;IACtE,YAAY,CAAC,EAAE,yBAAyB,CAAC;IACzC,6DAA6D;IAC7D,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB,CAAC;AAEF,YAAY,EAAE,qBAAqB,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ import type { GenericLogger } from '@aws-lambda-powertools/commons/types';
2
+ /** Configures Agent retrieval of evaluated AppConfig Variants. */
3
+ type AppConfigVariantStoreOptions = {
4
+ /** Identifies the configuration profile by name or ID. */
5
+ name: string;
6
+ /** Identifies the environment by name or ID. */
7
+ environment: string;
8
+ /** Identifies the application, defaulting to `POWERTOOLS_SERVICE_NAME`. */
9
+ application?: string;
10
+ /** Sets the Agent request timeout in milliseconds. */
11
+ timeout?: number;
12
+ /** Logs selected Variant names without values. */
13
+ logger?: GenericLogger;
14
+ };
15
+ export type { AppConfigVariantStoreOptions };
16
+ //# sourceMappingURL=AppConfigVariantStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppConfigVariantStore.d.ts","sourceRoot":"","sources":["../../../src/types/AppConfigVariantStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAE1E,kEAAkE;AAClE,KAAK,4BAA4B,GAAG;IAClC,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,WAAW,EAAE,MAAM,CAAC;IACpB,2EAA2E;IAC3E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kDAAkD;IAClD,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB,CAAC;AAEF,YAAY,EAAE,4BAA4B,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ /** Searches a configuration for an embedded Flag Document. */
2
+ type EnvelopeSearchFn = (expression: string, data: unknown) => unknown;
3
+ /** Configures document selection with both an expression and a search function. @internal */
4
+ type EnvelopeOptions = {
5
+ /** Selects an embedded Flag Document with the supplied search function. */
6
+ envelope: string;
7
+ /** Applies the envelope expression to the retrieved configuration. */
8
+ envelopeSearchFn: EnvelopeSearchFn;
9
+ } | {
10
+ /** Leaves the retrieved configuration unchanged. */
11
+ envelope?: never;
12
+ /** Omits document selection when no envelope is supplied. */
13
+ envelopeSearchFn?: never;
14
+ };
15
+ export type { EnvelopeOptions, EnvelopeSearchFn };
16
+ //# sourceMappingURL=Envelope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Envelope.d.ts","sourceRoot":"","sources":["../../../src/types/Envelope.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,KAAK,gBAAgB,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC;AAEvE,6FAA6F;AAC7F,KAAK,eAAe,GAChB;IACE,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,gBAAgB,EAAE,gBAAgB,CAAC;CACpC,GACD;IACE,oDAAoD;IACpD,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,6DAA6D;IAC7D,gBAAgB,CAAC,EAAE,KAAK,CAAC;CAC1B,CAAC;AAEN,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,83 @@
1
+ import type { GenericLogger, JSONValue } from '@aws-lambda-powertools/commons/types';
2
+ import type { RuleActions, TimeActionKeys } from '../constants.js';
3
+ import type { EvaluationContext } from './index.js';
4
+ /** Configures retrieval and optional logging for a local rule engine Store. */
5
+ type RuleEngineStoreOptions = {
6
+ /** Names the Store, defaulting to `rule-engine`. */
7
+ name?: string;
8
+ /** Retrieves a Python-format Flag Document for each Store call. */
9
+ source: () => Promise<JSONValue>;
10
+ /** Logs validation warnings and evaluation outcomes without values. */
11
+ logger?: GenericLogger;
12
+ /** Supplies the clock for schedule Actions, ignoring caller context. Defaults to () => new Date(). */
13
+ now?: () => Date;
14
+ };
15
+ /** Identifies a supported Action. @internal */
16
+ type RuleAction = (typeof RuleActions)[keyof typeof RuleActions];
17
+ /** Compares a context operand with a document operand. @internal */
18
+ type Comparator = (context: unknown, value: JSONValue) => boolean;
19
+ /** Carries a validated Action and its operands' key and value. @internal */
20
+ type Condition = {
21
+ action: RuleAction;
22
+ key: string;
23
+ value: JSONValue;
24
+ };
25
+ /** Carries a validated result and its AND-connected Conditions. @internal */
26
+ type Rule = {
27
+ when_match: JSONValue;
28
+ conditions: Condition[];
29
+ };
30
+ /** Carries a validated Flag Default and ordered named Rules. @internal */
31
+ type Flag = {
32
+ default: JSONValue;
33
+ rules: Record<string, Rule>;
34
+ };
35
+ /** Maps flag names to validated flag definitions. @internal */
36
+ type FlagDocument = Record<string, Flag>;
37
+ /** Holds the last validated document and its serialized source content. @internal */
38
+ type RuleEngineSnapshot = {
39
+ key: string;
40
+ document: FlagDocument;
41
+ };
42
+ /** Validates a retrieved document and returns compiled flag definitions. @internal */
43
+ type DocumentValidator = (document: unknown) => FlagDocument;
44
+ /** Identifies an Action that reads the clock instead of caller context. @internal */
45
+ type TimeAction = keyof typeof TimeActionKeys;
46
+ /** Carries validated bounds for a schedule Action. @internal */
47
+ type TimeRange = {
48
+ START: string;
49
+ END: string;
50
+ TIMEZONE?: string;
51
+ };
52
+ /** Carries validated naive ISO bounds for a datetime schedule Action. @internal */
53
+ type DatetimeRange = {
54
+ START: string;
55
+ END: string;
56
+ TIMEZONE?: string;
57
+ };
58
+ /** Carries validated day names for a schedule Action. @internal */
59
+ type DaysOfWeek = {
60
+ DAYS: string[];
61
+ TIMEZONE?: string;
62
+ };
63
+ /** Carries validated integer bounds for a modulo Action. @internal */
64
+ type ModuloRange = {
65
+ BASE: number;
66
+ START: number;
67
+ END: number;
68
+ };
69
+ /** Configures one flag evaluation without changing its identifying arguments. @internal */
70
+ type EvaluateFlagOptions = {
71
+ context: EvaluationContext;
72
+ logger?: GenericLogger;
73
+ now: Date;
74
+ };
75
+ /** Supplies identifiers, caller facts, and the shared clock instant for a Condition. @internal */
76
+ type MatchConditionOptions = {
77
+ name: string;
78
+ rule: string;
79
+ context: EvaluationContext;
80
+ now: Date;
81
+ };
82
+ export type { Comparator, Condition, DatetimeRange, DaysOfWeek, DocumentValidator, EvaluateFlagOptions, Flag, FlagDocument, MatchConditionOptions, ModuloRange, Rule, RuleAction, RuleEngineSnapshot, RuleEngineStoreOptions, TimeAction, TimeRange, };
83
+ //# sourceMappingURL=RuleEngine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RuleEngine.d.ts","sourceRoot":"","sources":["../../../src/types/RuleEngine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,SAAS,EACV,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,+EAA+E;AAC/E,KAAK,sBAAsB,GAAG;IAC5B,oDAAoD;IACpD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,MAAM,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC;IACjC,uEAAuE;IACvE,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,sGAAsG;IACtG,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAClB,CAAC;AAEF,+CAA+C;AAC/C,KAAK,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAEjE,oEAAoE;AACpE,KAAK,UAAU,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,KAAK,OAAO,CAAC;AAElE,4EAA4E;AAC5E,KAAK,SAAS,GAAG;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAEvE,6EAA6E;AAC7E,KAAK,IAAI,GAAG;IAAE,UAAU,EAAE,SAAS,CAAC;IAAC,UAAU,EAAE,SAAS,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AAEF,kGAAkG;AAClG,KAAK,qBAAqB,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,iBAAiB,CAAC;IAC3B,GAAG,EAAE,IAAI,CAAC;CACX,CAAC;AAEF,YAAY,EACV,UAAU,EACV,SAAS,EACT,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,IAAI,EACJ,YAAY,EACZ,qBAAqB,EACrB,WAAW,EACX,IAAI,EACJ,UAAU,EACV,kBAAkB,EAClB,sBAAsB,EACtB,UAAU,EACV,SAAS,GACV,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ import type { EvaluationContext, Variant } from './index.js';
2
+ /** Supplies a full Variant fallback without a schema. */
3
+ type EvaluateVariantOptions = {
4
+ name: string;
5
+ context?: EvaluationContext;
6
+ default: Variant;
7
+ schema?: never;
8
+ };
9
+ /** Supplies a full Variant fallback per flag without schemas. */
10
+ type EvaluateManyVariantOptions<Flags> = {
11
+ flags: Flags & Record<string, Variant>;
12
+ context?: EvaluationContext;
13
+ schemas?: never;
14
+ };
15
+ /** Preserves batch keys while returning full Variants rather than fallback literals. */
16
+ type EvaluateManyVariantResult<Flags> = {
17
+ [Name in keyof Flags]: Variant;
18
+ };
19
+ export type { EvaluateManyVariantOptions, EvaluateManyVariantResult, EvaluateVariantOptions, };
20
+ //# sourceMappingURL=VariantEvaluation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VariantEvaluation.d.ts","sourceRoot":"","sources":["../../../src/types/VariantEvaluation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE7D,yDAAyD;AACzD,KAAK,sBAAsB,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,KAAK,CAAC;CAChB,CAAC;AAEF,iEAAiE;AACjE,KAAK,0BAA0B,CAAC,KAAK,IAAI;IACvC,KAAK,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB,CAAC;AAEF,wFAAwF;AACxF,KAAK,yBAAyB,CAAC,KAAK,IAAI;KACrC,IAAI,IAAI,MAAM,KAAK,GAAG,OAAO;CAC/B,CAAC;AAEF,YAAY,EACV,0BAA0B,EAC1B,yBAAyB,EACzB,sBAAsB,GACvB,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,81 @@
1
+ import type { GenericLogger, JSONValue } from '@aws-lambda-powertools/commons/types';
2
+ import type { StandardSchemaV1 } from '@standard-schema/spec';
3
+ /** Configures the Store and optional logger for flag evaluation. */
4
+ type FeatureFlagsOptions<Value = JSONValue> = {
5
+ /** Provides flag lookups. */
6
+ store: Store<Value>;
7
+ /** Logs evaluation outcomes without values. */
8
+ logger?: GenericLogger;
9
+ };
10
+ /**
11
+ * Widens primitive fallbacks and uses JSONValue for structured fallbacks.
12
+ *
13
+ * A structured literal cannot soundly describe a Store result.
14
+ */
15
+ type EvaluateResult<Fallback> = Fallback extends boolean ? boolean : Fallback extends number ? number : Fallback extends string ? string : JSONValue;
16
+ /** Supplies the flag name, context, and required fallback for evaluation. */
17
+ type EvaluateOptions<Fallback extends JSONValue> = {
18
+ name: string;
19
+ context?: EvaluationContext;
20
+ default: Fallback;
21
+ };
22
+ /** Supplies a schema and its input fallback to {@link FeatureFlags.evaluate | `evaluate`}. */
23
+ type EvaluateWithSchemaOptions<Schema extends StandardSchemaV1> = {
24
+ name: string;
25
+ context?: EvaluationContext;
26
+ default: StandardSchemaV1.InferInput<Schema>;
27
+ /** Validates the fallback and result without producing undefined. */
28
+ schema: undefined extends StandardSchemaV1.InferOutput<Schema> ? never : Schema;
29
+ };
30
+ /** Supplies per-flag fallbacks, optional schemas, and context to {@link FeatureFlags.evaluateMany | `evaluateMany`}. */
31
+ type EvaluateManyOptions<Flags extends Record<string, JSONValue>, Schemas extends Partial<Record<string, StandardSchemaV1>> = Partial<Record<string, never>>> = {
32
+ flags: Flags;
33
+ context?: EvaluationContext;
34
+ /** Validates selected flags without producing undefined. */
35
+ schemas?: Schemas & {
36
+ [Name in keyof Schemas]: Name extends keyof Flags ? NonNullable<Schemas[Name]> extends StandardSchemaV1 ? undefined extends StandardSchemaV1.InferOutput<NonNullable<Schemas[Name]>> ? never : Schemas[Name] : Schemas[Name] : never;
37
+ };
38
+ };
39
+ /**
40
+ * Infers a schema output or widens the fallback when no schema exists.
41
+ * @internal
42
+ */
43
+ type EvaluateSchemaResult<Schema, Fallback> = Schema extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<Schema> : EvaluateResult<Fallback>;
44
+ /** Infers schema outputs and widens other fallbacks through {@link EvaluateResult | `EvaluateResult`}. */
45
+ type EvaluateManyResult<Flags extends Record<string, JSONValue>, Schemas extends Partial<Record<string, StandardSchemaV1>> = Partial<Record<string, never>>> = {
46
+ [Name in keyof Flags]: Name extends keyof Schemas ? EvaluateSchemaResult<Schemas[Name], Flags[Name]> : EvaluateResult<Flags[Name]>;
47
+ };
48
+ /** Supplies context to {@link FeatureFlags.getEnabledFeatures | `getEnabledFeatures`}. */
49
+ type GetEnabledFeaturesOptions = {
50
+ context?: EvaluationContext;
51
+ };
52
+ /** Represents a scalar fact in an evaluation context. */
53
+ type ContextScalar = string | number | boolean;
54
+ /** Represents a scalar fact or a list of scalar facts. */
55
+ type ContextValue = ContextScalar | ContextScalar[];
56
+ /** Carries caller-supplied per-request facts for flag evaluation. */
57
+ type EvaluationContext = Record<string, ContextValue>;
58
+ /** Distinguishes a found flag and its value from a missing flag. */
59
+ type StoreResult<Value = JSONValue> = {
60
+ found: true;
61
+ value: Value;
62
+ enabled: boolean;
63
+ } | {
64
+ found: false;
65
+ };
66
+ /** Answers the value of a flag for a given evaluation context. */
67
+ type Store<Value = JSONValue> = {
68
+ name: string;
69
+ getMany(names: readonly string[], context: EvaluationContext): Promise<Record<string, StoreResult<Value>>>;
70
+ getAll(context: EvaluationContext): Promise<Record<string, StoreResult<Value>>>;
71
+ };
72
+ /** Represents a normalized AWS AppConfig multi-variant result. */
73
+ type Variant = {
74
+ enabled: boolean;
75
+ variant: string;
76
+ attributes: Record<string, ContextValue>;
77
+ };
78
+ export type { ContextScalar, ContextValue, EvaluateManyOptions, EvaluateManyResult, EvaluateOptions, EvaluateResult, EvaluateSchemaResult, EvaluateWithSchemaOptions, EvaluationContext, FeatureFlagsOptions, GetEnabledFeaturesOptions, Store, StoreResult, Variant, };
79
+ export type { EnvelopeOptions, EnvelopeSearchFn } from './Envelope.js';
80
+ export type { EvaluateManyVariantOptions, EvaluateManyVariantResult, EvaluateVariantOptions, } from './VariantEvaluation.js';
81
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,SAAS,EACV,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAG9D,oEAAoE;AACpE,KAAK,mBAAmB,CAAC,KAAK,GAAG,SAAS,IAAI;IAC5C,6BAA6B;IAC7B,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACpB,+CAA+C;IAC/C,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB,CAAC;AAEF;;;;GAIG;AACH,KAAK,cAAc,CAAC,QAAQ,IAAI,QAAQ,SAAS,OAAO,GACpD,OAAO,GACP,QAAQ,SAAS,MAAM,GACrB,MAAM,GACN,QAAQ,SAAS,MAAM,GACrB,MAAM,GACN,SAAS,CAAC;AAElB,6EAA6E;AAC7E,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AC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC/C,MAAM,CACJ,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;CAChD,CAAC;AAEF,kEAAkE;AAClE,KAAK,OAAO,GAAG;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;CAC1C,CAAC;AAEF,YAAY,EACV,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,yBAAyB,EACzB,KAAK,EACL,WAAW,EACX,OAAO,GACR,CAAC;AACF,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACvE,YAAY,EACV,0BAA0B,EAC1B,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { Variant } from './types/index.js';
2
+ /** Registers a Variant store for runtime fallback validation. @internal */
3
+ declare const registerVariantStore: (store: object) => void;
4
+ /** Checks whether a store requires Variant fallbacks. @internal */
5
+ declare const isVariantStore: (store: object) => boolean;
6
+ /** Checks the exact normalized Variant shape and every attribute. @internal */
7
+ declare const isVariant: (value: unknown) => value is Variant;
8
+ export { isVariant, isVariantStore, registerVariantStore };
9
+ //# sourceMappingURL=variant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variant.d.ts","sourceRoot":"","sources":["../../src/variant.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAKhD,2EAA2E;AAC3E,QAAA,MAAM,oBAAoB,GAAI,OAAO,MAAM,KAAG,IAE7C,CAAC;AAEF,mEAAmE;AACnE,QAAA,MAAM,cAAc,GAAI,OAAO,MAAM,KAAG,OAAmC,CAAC;AAE5E,+EAA+E;AAC/E,QAAA,MAAM,SAAS,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,OASgB,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,oBAAoB,EAAE,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { isRecord } from '@aws-lambda-powertools/commons';
2
+ import { isFiniteContextValue } from './context.js';
3
+ /** Tracks built-in Variant stores without importing their transport. @internal */
4
+ const variantStores = new WeakSet();
5
+ /** Registers a Variant store for runtime fallback validation. @internal */
6
+ const registerVariantStore = (store) => {
7
+ variantStores.add(store);
8
+ };
9
+ /** Checks whether a store requires Variant fallbacks. @internal */
10
+ const isVariantStore = (store) => variantStores.has(store);
11
+ /** Checks the exact normalized Variant shape and every attribute. @internal */
12
+ const isVariant = (value) => isRecord(value) &&
13
+ Reflect.ownKeys(value).length === 3 &&
14
+ Object.hasOwn(value, 'enabled') &&
15
+ typeof value.enabled === 'boolean' &&
16
+ Object.hasOwn(value, 'variant') &&
17
+ typeof value.variant === 'string' &&
18
+ Object.hasOwn(value, 'attributes') &&
19
+ isRecord(value.attributes) &&
20
+ Object.values(value.attributes).every(isFiniteContextValue);
21
+ export { isVariant, isVariantStore, registerVariantStore };
package/package.json CHANGED
@@ -1,6 +1,140 @@
1
1
  {
2
2
  "name": "@aws-lambda-powertools/feature-flags",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "2.37.0",
4
+ "description": "The feature flags package for the Powertools for AWS Lambda (TypeScript) library.",
5
+ "author": {
6
+ "name": "Amazon Web Services",
7
+ "url": "https://aws.amazon.com"
8
+ },
9
+ "license": "MIT-0",
10
+ "homepage": "https://github.com/aws-powertools/powertools-lambda-typescript/tree/main/packages/feature-flags#readme",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/aws-powertools/powertools-lambda-typescript.git"
14
+ },
15
+ "bugs": {
16
+ "url": "https://github.com/aws-powertools/powertools-lambda-typescript/issues"
17
+ },
18
+ "keywords": [
19
+ "aws",
20
+ "lambda",
21
+ "powertools",
22
+ "feature-flags",
23
+ "appconfig",
24
+ "serverless",
25
+ "typescript",
26
+ "nodejs"
27
+ ],
28
+ "dependencies": {
29
+ "@aws-lambda-powertools/commons": "2.37.0",
30
+ "@standard-schema/spec": "^1.1.0"
31
+ },
32
+ "peerDependencies": {
33
+ "@aws-lambda-powertools/parameters": "2.37.0",
34
+ "@aws-lambda-powertools/jmespath": "2.37.0"
35
+ },
36
+ "peerDependenciesMeta": {
37
+ "@aws-lambda-powertools/parameters": {
38
+ "optional": true
39
+ },
40
+ "@aws-lambda-powertools/jmespath": {
41
+ "optional": true
42
+ }
43
+ },
44
+ "main": "./lib/cjs/index.js",
45
+ "types": "./lib/cjs/index.d.ts",
46
+ "files": [
47
+ "lib"
48
+ ],
49
+ "type": "module",
50
+ "exports": {
51
+ ".": {
52
+ "require": {
53
+ "types": "./lib/cjs/index.d.ts",
54
+ "default": "./lib/cjs/index.js"
55
+ },
56
+ "import": {
57
+ "types": "./lib/esm/index.d.ts",
58
+ "default": "./lib/esm/index.js"
59
+ }
60
+ },
61
+ "./appconfig": {
62
+ "require": {
63
+ "types": "./lib/cjs/appconfig/index.d.ts",
64
+ "default": "./lib/cjs/appconfig/index.js"
65
+ },
66
+ "import": {
67
+ "types": "./lib/esm/appconfig/index.d.ts",
68
+ "default": "./lib/esm/appconfig/index.js"
69
+ }
70
+ },
71
+ "./appconfig-agent": {
72
+ "require": {
73
+ "types": "./lib/cjs/appconfig-agent/index.d.ts",
74
+ "default": "./lib/cjs/appconfig-agent/index.js"
75
+ },
76
+ "import": {
77
+ "types": "./lib/esm/appconfig-agent/index.d.ts",
78
+ "default": "./lib/esm/appconfig-agent/index.js"
79
+ }
80
+ },
81
+ "./envelope": {
82
+ "require": {
83
+ "types": "./lib/cjs/envelope/index.d.ts",
84
+ "default": "./lib/cjs/envelope/index.js"
85
+ },
86
+ "import": {
87
+ "types": "./lib/esm/envelope/index.d.ts",
88
+ "default": "./lib/esm/envelope/index.js"
89
+ }
90
+ },
91
+ "./errors": {
92
+ "require": {
93
+ "types": "./lib/cjs/errors.d.ts",
94
+ "default": "./lib/cjs/errors.js"
95
+ },
96
+ "import": {
97
+ "types": "./lib/esm/errors.d.ts",
98
+ "default": "./lib/esm/errors.js"
99
+ }
100
+ },
101
+ "./types": {
102
+ "require": {
103
+ "types": "./lib/cjs/types/index.d.ts",
104
+ "default": "./lib/cjs/types/index.js"
105
+ },
106
+ "import": {
107
+ "types": "./lib/esm/types/index.d.ts",
108
+ "default": "./lib/esm/types/index.js"
109
+ }
110
+ }
111
+ },
112
+ "typesVersions": {
113
+ "*": {
114
+ "index": [
115
+ "lib/cjs/index.d.ts",
116
+ "lib/esm/index.d.ts"
117
+ ],
118
+ "appconfig": [
119
+ "lib/cjs/appconfig/index.d.ts",
120
+ "lib/esm/appconfig/index.d.ts"
121
+ ],
122
+ "appconfig-agent": [
123
+ "lib/cjs/appconfig-agent/index.d.ts",
124
+ "lib/esm/appconfig-agent/index.d.ts"
125
+ ],
126
+ "envelope": [
127
+ "lib/cjs/envelope/index.d.ts",
128
+ "lib/esm/envelope/index.d.ts"
129
+ ],
130
+ "errors": [
131
+ "lib/cjs/errors.d.ts",
132
+ "lib/esm/errors.d.ts"
133
+ ],
134
+ "types": [
135
+ "lib/cjs/types/index.d.ts",
136
+ "lib/esm/types/index.d.ts"
137
+ ]
138
+ }
139
+ }
6
140
  }