@genesislcap/foundation-filters 9.0.1-alpha-b5c5eb7.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.
- package/MODULE_FEDERATION.md +11 -0
- package/README.md +173 -0
- package/dist/1.0.0.remoteEntry.js +1 -0
- package/dist/191.191.64feeeeeb6c4132a6cae.js +2 -0
- package/dist/191.d7c8a7fc5c69e4190ea53a04618e0459.js.map +1 -0
- package/dist/195.195.2c71a4e018ba860ab228.js +3 -0
- package/dist/195.195.2c71a4e018ba860ab228.js.LICENSE.txt +4 -0
- package/dist/195.331a5c4d39a8a3d001d3344cb66ef3b8.js.map +1 -0
- package/dist/259.0acac2573f700ecd1acac239926438a5.js.map +1 -0
- package/dist/259.259.3aa926921ed1388957f1.js +2 -0
- package/dist/338.338.cd6e49db31e7adc808c6.js +3 -0
- package/dist/338.338.cd6e49db31e7adc808c6.js.LICENSE.txt +1 -0
- package/dist/338.7a143cd09921b756e7fe871d338dcb67.js.map +1 -0
- package/dist/410.410.76d9d4b118ba230b93c4.js +2 -0
- package/dist/410.cda4ae21eb38efbf2dbfd913db12d66f.js.map +1 -0
- package/dist/755.755.ec31a791472b4b3fcb0f.js +2 -0
- package/dist/755.c71c3a1801dd2c0461f8b831d09ec90f.js.map +1 -0
- package/dist/dashboard.json +1 -0
- package/dist/dts/clientFilter.d.ts +108 -0
- package/dist/dts/clientFilter.d.ts.map +1 -0
- package/dist/dts/index.d.ts +9 -0
- package/dist/dts/index.d.ts.map +1 -0
- package/dist/dts/index.federated.d.ts +1 -0
- package/dist/dts/index.federated.d.ts.map +1 -0
- package/dist/dts/logger.d.ts +17 -0
- package/dist/dts/logger.d.ts.map +1 -0
- package/dist/dts/nodeEnv.d.ts +81 -0
- package/dist/dts/nodeEnv.d.ts.map +1 -0
- package/dist/dts/percentage.d.ts +81 -0
- package/dist/dts/percentage.d.ts.map +1 -0
- package/dist/dts/timeWindow.d.ts +91 -0
- package/dist/dts/timeWindow.d.ts.map +1 -0
- package/dist/dts/tsdoc-metadata.json +11 -0
- package/dist/dts/urlTargeting.d.ts +94 -0
- package/dist/dts/urlTargeting.d.ts.map +1 -0
- package/dist/dts/userAgent.d.ts +96 -0
- package/dist/dts/userAgent.d.ts.map +1 -0
- package/dist/dts/userTargeting.d.ts +107 -0
- package/dist/dts/userTargeting.d.ts.map +1 -0
- package/dist/esm/clientFilter.js +84 -0
- package/dist/esm/clientFilter.js.map +1 -0
- package/dist/esm/index.federated.js +2 -0
- package/dist/esm/index.federated.js.map +1 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/logger.js +18 -0
- package/dist/esm/logger.js.map +1 -0
- package/dist/esm/nodeEnv.js +48 -0
- package/dist/esm/nodeEnv.js.map +1 -0
- package/dist/esm/percentage.js +38 -0
- package/dist/esm/percentage.js.map +1 -0
- package/dist/esm/timeWindow.js +49 -0
- package/dist/esm/timeWindow.js.map +1 -0
- package/dist/esm/urlTargeting.js +68 -0
- package/dist/esm/urlTargeting.js.map +1 -0
- package/dist/esm/userAgent.js +59 -0
- package/dist/esm/userAgent.js.map +1 -0
- package/dist/esm/userTargeting.js +73 -0
- package/dist/esm/userTargeting.js.map +1 -0
- package/dist/favicon.ico +0 -0
- package/dist/foundation-filters.api.json +3065 -0
- package/dist/foundation-filters.d.ts +707 -0
- package/dist/foundation-filters.iife.min.js +3 -0
- package/dist/foundation-filters.js +8608 -0
- package/dist/foundation-filters.min.js +3 -0
- package/dist/foundationFilters.c0ca375607bf5b49304e9efbcfb9ec0d.js.map +1 -0
- package/dist/index.ejs +23 -0
- package/dist/index.html +16 -0
- package/dist/info.ejs +13 -0
- package/dist/main.479db3c6a61354c4d21c4a52177a4fc9.js.map +1 -0
- package/dist/main.8bf3ac27c0d922605d1f.js +2 -0
- package/dist/npm.analytics.343.d4561facd9660fd45482.js +2 -0
- package/dist/npm.analytics.50acd47759b15e99bc3ad79caad7c672.js.map +1 -0
- package/dist/npm.consola.0f92c98545c00deac8a01e6e5c25e63c.js.map +1 -0
- package/dist/npm.consola.713.4cfd0e26a2fd1e472409.js +2 -0
- package/dist/npm.finos.690.4b909dcccf246b8fb074.js +2 -0
- package/dist/npm.finos.83f8bd7cc8c58aabd1049256a8d005fe.js.map +1 -0
- package/dist/npm.microsoft.127.2934a743e3e0797a43e6.js +1469 -0
- package/dist/npm.microsoft.127.2934a743e3e0797a43e6.js.LICENSE.txt +14 -0
- package/dist/npm.microsoft.e17056c760df168ceb07617558d61f7e.js.map +1 -0
- package/dist/npm.rxjs.271.11caf676e6c2aaf1715a.js +2 -0
- package/dist/npm.rxjs.2d42120c7dd915e4ea92bdec64a19f45.js.map +1 -0
- package/dist/npm.ua-parser-js.809.92491f7cd444ab77d377.js +2 -0
- package/dist/npm.ua-parser-js.b1390f6f6c6080318a30bc73abe8add8.js.map +1 -0
- package/dist/remoteEntry.js +2 -0
- package/dist/serve.json +3 -0
- package/docs/api/foundation-filters.clientfilter.filter.md +24 -0
- package/docs/api/foundation-filters.clientfilter.md +24 -0
- package/docs/api/foundation-filters.clientfiltername.md +19 -0
- package/docs/api/foundation-filters.clientfilterrunner.md +20 -0
- package/docs/api/foundation-filters.clientfilterrunner.run.md +23 -0
- package/docs/api/foundation-filters.clientfilterschema.md +22 -0
- package/docs/api/foundation-filters.clientfilterschemas.md +15 -0
- package/docs/api/foundation-filters.defaultclientfilterrunner.container.md +11 -0
- package/docs/api/foundation-filters.defaultclientfilterrunner.md +27 -0
- package/docs/api/foundation-filters.defaultclientfilterrunner.run.md +23 -0
- package/docs/api/foundation-filters.defaultnodeenv.filter.md +24 -0
- package/docs/api/foundation-filters.defaultnodeenv.isdevelopment.md +16 -0
- package/docs/api/foundation-filters.defaultnodeenv.isproduction.md +16 -0
- package/docs/api/foundation-filters.defaultnodeenv.istesting.md +16 -0
- package/docs/api/foundation-filters.defaultnodeenv.md +29 -0
- package/docs/api/foundation-filters.defaultpercentage.filter.md +24 -0
- package/docs/api/foundation-filters.defaultpercentage.md +21 -0
- package/docs/api/foundation-filters.defaulttimewindow.filter.md +24 -0
- package/docs/api/foundation-filters.defaulttimewindow.md +21 -0
- package/docs/api/foundation-filters.defaulturltargeting.filter.md +24 -0
- package/docs/api/foundation-filters.defaulturltargeting.issecure.md +26 -0
- package/docs/api/foundation-filters.defaulturltargeting.md +22 -0
- package/docs/api/foundation-filters.defaultuseragent.filter.md +24 -0
- package/docs/api/foundation-filters.defaultuseragent.issafari.md +16 -0
- package/docs/api/foundation-filters.defaultuseragent.md +27 -0
- package/docs/api/foundation-filters.defaultusertargeting._constructor_.md +20 -0
- package/docs/api/foundation-filters.defaultusertargeting.auth.md +11 -0
- package/docs/api/foundation-filters.defaultusertargeting.filter.md +24 -0
- package/docs/api/foundation-filters.defaultusertargeting.hasadminprofile.md +16 -0
- package/docs/api/foundation-filters.defaultusertargeting.isloggedin.md +16 -0
- package/docs/api/foundation-filters.defaultusertargeting.md +35 -0
- package/docs/api/foundation-filters.getfilterbyname.md +25 -0
- package/docs/api/foundation-filters.logger.md +27 -0
- package/docs/api/foundation-filters.md +71 -0
- package/docs/api/foundation-filters.nodeenv.isdevelopment.md +16 -0
- package/docs/api/foundation-filters.nodeenv.isproduction.md +16 -0
- package/docs/api/foundation-filters.nodeenv.istesting.md +16 -0
- package/docs/api/foundation-filters.nodeenv.md +23 -0
- package/docs/api/foundation-filters.nodeenvfilter.md +28 -0
- package/docs/api/foundation-filters.nodeenvparams.md +25 -0
- package/docs/api/foundation-filters.nodeenvschema.md +19 -0
- package/docs/api/foundation-filters.percentage.md +19 -0
- package/docs/api/foundation-filters.percentagefilter.md +29 -0
- package/docs/api/foundation-filters.percentageparams.md +41 -0
- package/docs/api/foundation-filters.percentageschema.md +19 -0
- package/docs/api/foundation-filters.runner.md +29 -0
- package/docs/api/foundation-filters.timewindow.md +19 -0
- package/docs/api/foundation-filters.timewindowfilter.md +29 -0
- package/docs/api/foundation-filters.timewindowparams.md +59 -0
- package/docs/api/foundation-filters.timewindowschema.md +19 -0
- package/docs/api/foundation-filters.urltargeting.issecure.md +26 -0
- package/docs/api/foundation-filters.urltargeting.md +21 -0
- package/docs/api/foundation-filters.urltargetingfilter.md +32 -0
- package/docs/api/foundation-filters.urltargetingparams.md +30 -0
- package/docs/api/foundation-filters.urltargetingschema.md +19 -0
- package/docs/api/foundation-filters.useragent.issafari.md +16 -0
- package/docs/api/foundation-filters.useragent.md +25 -0
- package/docs/api/foundation-filters.useragentfilter.md +31 -0
- package/docs/api/foundation-filters.useragentparams.md +30 -0
- package/docs/api/foundation-filters.useragentschema.md +19 -0
- package/docs/api/foundation-filters.usertargeting.hasadminprofile.md +16 -0
- package/docs/api/foundation-filters.usertargeting.isloggedin.md +16 -0
- package/docs/api/foundation-filters.usertargeting.md +26 -0
- package/docs/api/foundation-filters.usertargetingfilter.md +31 -0
- package/docs/api/foundation-filters.usertargetingparams.md +29 -0
- package/docs/api/foundation-filters.usertargetingschema.md +19 -0
- package/docs/api/index.md +12 -0
- package/docs/api-report.md +283 -0
- package/jsdom.setup.ts +1 -0
- package/license.txt +46 -0
- package/package.json +122 -0
|
@@ -0,0 +1,707 @@
|
|
|
1
|
+
import { Auth } from '@genesislcap/foundation-comms';
|
|
2
|
+
import { Container } from '@microsoft/fast-foundation';
|
|
3
|
+
import { InterfaceSymbol } from '@microsoft/fast-foundation';
|
|
4
|
+
import { Logger } from '@genesislcap/foundation-utils';
|
|
5
|
+
import { User } from '@genesislcap/foundation-comms';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* ClientFilter interface.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* Simplifies access to runtime data / state contained within the DI container.
|
|
12
|
+
*
|
|
13
|
+
* @typeParam P - The filter parameter type.
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export declare interface ClientFilter<P = any> {
|
|
18
|
+
/**
|
|
19
|
+
* @param parameters - The filter parameters.
|
|
20
|
+
*
|
|
21
|
+
* @returns The filter outcome.
|
|
22
|
+
*
|
|
23
|
+
* @privateRemarks
|
|
24
|
+
* Not sure if there's a need for an async api here.
|
|
25
|
+
*/
|
|
26
|
+
filter(parameters: P): boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
export declare const ClientFilterName: {
|
|
33
|
+
readonly nodeEnv: "nodeEnv";
|
|
34
|
+
readonly percentage: "percentage";
|
|
35
|
+
readonly timeWindow: "timeWindow";
|
|
36
|
+
readonly urlTargeting: "urlTargeting";
|
|
37
|
+
readonly userAgent: "userAgent";
|
|
38
|
+
readonly userTargeting: "userTargeting";
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
export declare type ClientFilterName = (typeof ClientFilterName)[keyof typeof ClientFilterName];
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* ClientFilterRunner DI interface.
|
|
48
|
+
*
|
|
49
|
+
* @public
|
|
50
|
+
*/
|
|
51
|
+
export declare interface ClientFilterRunner {
|
|
52
|
+
run(filters: ClientFilterSchemas[], container?: Container): boolean;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* ClientFilterRunner DI key.
|
|
57
|
+
*
|
|
58
|
+
* @privateRemarks
|
|
59
|
+
* Marked as internal to stop api-extractor becoming confused cross-linking tokens with the same name.
|
|
60
|
+
*
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
export declare const ClientFilterRunner: InterfaceSymbol<ClientFilterRunner>;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* ClientFilterSchema type.
|
|
67
|
+
*
|
|
68
|
+
* @remarks
|
|
69
|
+
* JSON schema type.
|
|
70
|
+
*
|
|
71
|
+
* @typeParam N - The filter name type.
|
|
72
|
+
* @typeParam P - The filter parameters type.
|
|
73
|
+
*
|
|
74
|
+
* @public
|
|
75
|
+
*/
|
|
76
|
+
export declare type ClientFilterSchema<N extends ClientFilterName, P> = {
|
|
77
|
+
readonly name: N;
|
|
78
|
+
readonly parameters: P;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* ClientFilterSchemas type.
|
|
83
|
+
*
|
|
84
|
+
* @public
|
|
85
|
+
*/
|
|
86
|
+
export declare type ClientFilterSchemas = NodeEnvSchema | PercentageSchema | TimeWindowSchema | URLTargetingSchema | UserAgentSchema | UserTargetingSchema;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Default ClientFilterRunner DI implementation.
|
|
90
|
+
* @public
|
|
91
|
+
*/
|
|
92
|
+
export declare class DefaultClientFilterRunner implements ClientFilterRunner {
|
|
93
|
+
container: Container;
|
|
94
|
+
run(filters: ClientFilterSchemas[], container?: Container): boolean;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Default NodeEnv DI implementation.
|
|
99
|
+
* @public
|
|
100
|
+
*/
|
|
101
|
+
export declare class DefaultNodeEnv implements NodeEnv {
|
|
102
|
+
/** {@inheritDoc ClientFilter.filter} */
|
|
103
|
+
filter(params: NodeEnvParams): boolean;
|
|
104
|
+
/** {@inheritDoc NodeEnv.isDevelopment} */
|
|
105
|
+
get isDevelopment(): boolean;
|
|
106
|
+
/** {@inheritDoc NodeEnv.isTesting} */
|
|
107
|
+
get isTesting(): boolean;
|
|
108
|
+
/** {@inheritDoc NodeEnv.isProduction} */
|
|
109
|
+
get isProduction(): boolean;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Default Percentage DI implementation.
|
|
114
|
+
* @public
|
|
115
|
+
*/
|
|
116
|
+
export declare class DefaultPercentage implements Percentage {
|
|
117
|
+
/** {@inheritDoc ClientFilter.filter} */
|
|
118
|
+
filter(params: PercentageParams): boolean;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Default TimeWindow DI implementation.
|
|
123
|
+
* @public
|
|
124
|
+
*/
|
|
125
|
+
export declare class DefaultTimeWindow implements TimeWindow {
|
|
126
|
+
/** {@inheritDoc ClientFilter.filter} */
|
|
127
|
+
filter(params: TimeWindowParams): boolean;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Default URLTargeting DI implementation.
|
|
132
|
+
* @public
|
|
133
|
+
*/
|
|
134
|
+
export declare class DefaultURLTargeting implements URLTargeting {
|
|
135
|
+
/** {@inheritDoc ClientFilter.filter} */
|
|
136
|
+
filter(params: URLTargetingParams): boolean;
|
|
137
|
+
/** {@inheritDoc URLTargeting.isSecure} */
|
|
138
|
+
isSecure(url: any): boolean;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Default UserAgent DI implementation.
|
|
143
|
+
* @public
|
|
144
|
+
*/
|
|
145
|
+
export declare class DefaultUserAgent implements UserAgent {
|
|
146
|
+
/** {@inheritDoc ClientFilter.filter} */
|
|
147
|
+
filter(params: UserAgentParams): boolean;
|
|
148
|
+
/** {@inheritDoc UserAgent.isSafari} */
|
|
149
|
+
get isSafari(): boolean;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Default UserTargeting DI implementation.
|
|
154
|
+
* @public
|
|
155
|
+
*/
|
|
156
|
+
export declare class DefaultUserTargeting implements UserTargeting {
|
|
157
|
+
auth: Auth;
|
|
158
|
+
constructor(auth: Auth);
|
|
159
|
+
/** {@inheritDoc ClientFilter.filter} */
|
|
160
|
+
filter(params: UserTargetingParams): boolean;
|
|
161
|
+
/** {@inheritDoc UserTargeting.hasAdminProfile} */
|
|
162
|
+
get hasAdminProfile(): boolean;
|
|
163
|
+
/** {@inheritDoc UserTargeting.isLoggedIn} */
|
|
164
|
+
get isLoggedIn(): boolean;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Filer lookup by name.
|
|
169
|
+
*
|
|
170
|
+
* @public
|
|
171
|
+
*/
|
|
172
|
+
export declare function getFilterByName(name: ClientFilterName, container: Container): NodeEnv | Percentage | TimeWindow | URLTargeting | UserAgent | UserTargeting;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Client filter logger
|
|
176
|
+
*
|
|
177
|
+
* @remarks
|
|
178
|
+
* Exposed so that the logging level within this package can be tailored differently to the default level when needed.
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* ```ts
|
|
182
|
+
* import { LogLevel } from '@genesislcap/foundation-utils';
|
|
183
|
+
* import { logger as clientFilterLogger } from '@genesislcap/foundation-filters';
|
|
184
|
+
* clientFilterLogger.level = LogLevel.Error;
|
|
185
|
+
* ```
|
|
186
|
+
*
|
|
187
|
+
* @public
|
|
188
|
+
*/
|
|
189
|
+
export declare const logger: Logger;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* NodeEnv client filter DI interface.
|
|
193
|
+
* @public
|
|
194
|
+
*/
|
|
195
|
+
export declare interface NodeEnv extends ClientFilter<NodeEnvParams> {
|
|
196
|
+
/**
|
|
197
|
+
* @remarks
|
|
198
|
+
* Running in development mode.
|
|
199
|
+
*/
|
|
200
|
+
readonly isDevelopment: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* @remarks
|
|
203
|
+
* Running in test mode.
|
|
204
|
+
*/
|
|
205
|
+
readonly isTesting: boolean;
|
|
206
|
+
/**
|
|
207
|
+
* @remarks
|
|
208
|
+
* Running in production mode.
|
|
209
|
+
*/
|
|
210
|
+
readonly isProduction: boolean;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* NodeEnv DI key.
|
|
215
|
+
*
|
|
216
|
+
* @privateRemarks
|
|
217
|
+
* Marked as internal to stop api-extractor becoming confused cross-linking tokens with the same name.
|
|
218
|
+
*
|
|
219
|
+
* @internal
|
|
220
|
+
*/
|
|
221
|
+
export declare const NodeEnv: InterfaceSymbol<NodeEnv>;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* NodeEnv client filter function.
|
|
225
|
+
* @remarks
|
|
226
|
+
* This will return true when the current node env matches target parameters.
|
|
227
|
+
* @param envs - Environments to target.
|
|
228
|
+
* @public
|
|
229
|
+
*/
|
|
230
|
+
export declare function nodeEnvFilter(envs: string[]): boolean;
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* NodeEnvParams
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* ```json
|
|
237
|
+
* {
|
|
238
|
+
* "envs": ["development", "testing"],
|
|
239
|
+
* }
|
|
240
|
+
* ```
|
|
241
|
+
*
|
|
242
|
+
* @public
|
|
243
|
+
*/
|
|
244
|
+
export declare type NodeEnvParams = {
|
|
245
|
+
/**
|
|
246
|
+
* Envs to target.
|
|
247
|
+
*/
|
|
248
|
+
readonly envs: string[];
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* NodeEnvSchema type.
|
|
253
|
+
*
|
|
254
|
+
* @remarks
|
|
255
|
+
* JSON schema type.
|
|
256
|
+
*
|
|
257
|
+
* @public
|
|
258
|
+
*/
|
|
259
|
+
export declare type NodeEnvSchema = ClientFilterSchema<typeof ClientFilterName.nodeEnv, NodeEnvParams>;
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Percentage client filter DI interface.
|
|
263
|
+
*
|
|
264
|
+
* @remarks
|
|
265
|
+
* Simplifies access to runtime data / state contained within the DI container.
|
|
266
|
+
*
|
|
267
|
+
* @public
|
|
268
|
+
* @privateRemarks
|
|
269
|
+
* Created for consistency with other filters that required DI container access.
|
|
270
|
+
*/
|
|
271
|
+
export declare interface Percentage extends ClientFilter<PercentageParams> {
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Percentage DI key.
|
|
276
|
+
*
|
|
277
|
+
* @privateRemarks
|
|
278
|
+
* Marked as internal to stop api-extractor becoming confused cross-linking tokens with the same name.
|
|
279
|
+
*
|
|
280
|
+
* @internal
|
|
281
|
+
*/
|
|
282
|
+
export declare const Percentage: InterfaceSymbol<Percentage>;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Percentage client filter function.
|
|
286
|
+
* @remarks
|
|
287
|
+
* This will return true a certain percentage of the time.
|
|
288
|
+
* @param percent - The percent of the time to pass, a numeric value between 0 and 1.
|
|
289
|
+
* @param random - Math.random() generated floating-point.
|
|
290
|
+
* @public
|
|
291
|
+
*/
|
|
292
|
+
export declare function percentageFilter(percent: number, random?: number): boolean;
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* PercentageParams
|
|
296
|
+
*
|
|
297
|
+
* @remarks
|
|
298
|
+
* Percent should be a numeric value between 0 and 1.
|
|
299
|
+
*
|
|
300
|
+
* @example
|
|
301
|
+
* ```json
|
|
302
|
+
* {
|
|
303
|
+
* "percent": 0.5
|
|
304
|
+
* }
|
|
305
|
+
* ```
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* In a rare case where you need to control the random floating-point creation, you can do so externally and provide it.
|
|
309
|
+
* ```json
|
|
310
|
+
* {
|
|
311
|
+
* "percent": 0.34
|
|
312
|
+
* "random": 0.08901819974272063
|
|
313
|
+
* }
|
|
314
|
+
* ```
|
|
315
|
+
*
|
|
316
|
+
* @public
|
|
317
|
+
*/
|
|
318
|
+
export declare type PercentageParams = {
|
|
319
|
+
readonly percent: number;
|
|
320
|
+
/**
|
|
321
|
+
* @remarks
|
|
322
|
+
* Provided for fine-grain control over the random floating-point
|
|
323
|
+
*/
|
|
324
|
+
readonly random?: number;
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* PercentageSchema type.
|
|
329
|
+
*
|
|
330
|
+
* @remarks
|
|
331
|
+
* JSON schema type.
|
|
332
|
+
*
|
|
333
|
+
* @public
|
|
334
|
+
*/
|
|
335
|
+
export declare type PercentageSchema = ClientFilterSchema<typeof ClientFilterName.percentage, PercentageParams>;
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Client filter runner function.
|
|
339
|
+
* @remarks
|
|
340
|
+
* This will return true when all the filters in the array pass.
|
|
341
|
+
* @param filters - An array of client filters to run.
|
|
342
|
+
* @param container - The DI container.
|
|
343
|
+
* @public
|
|
344
|
+
* @privateRemarks
|
|
345
|
+
* As a runner working off static input, we can't know or source the runtime dependencies of each filter. As such we use
|
|
346
|
+
* the DI version of each which have those encapsulated.
|
|
347
|
+
*/
|
|
348
|
+
export declare function runner(filters: ClientFilterSchemas[], container: Container): boolean;
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* TimeWindow client filter DI interface.
|
|
352
|
+
*
|
|
353
|
+
* @remarks
|
|
354
|
+
* Simplifies access to runtime data / state contained within the DI container.
|
|
355
|
+
*
|
|
356
|
+
* @public
|
|
357
|
+
*/
|
|
358
|
+
export declare interface TimeWindow extends ClientFilter<TimeWindowParams> {
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* TimeWindow DI key.
|
|
363
|
+
*
|
|
364
|
+
* @privateRemarks
|
|
365
|
+
* Marked as internal to stop api-extractor becoming confused cross-linking tokens with the same name.
|
|
366
|
+
*
|
|
367
|
+
* @internal
|
|
368
|
+
*/
|
|
369
|
+
export declare const TimeWindow: InterfaceSymbol<TimeWindow>;
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* TimeWindow client filter function.
|
|
373
|
+
* @remarks
|
|
374
|
+
* This will return true between a certain time window. Start and end can be provided in any format recognized by the
|
|
375
|
+
* Date.parse() method.
|
|
376
|
+
*
|
|
377
|
+
* @param start - The start of the time window.
|
|
378
|
+
* @param end - The end of the time window.
|
|
379
|
+
* @public
|
|
380
|
+
*/
|
|
381
|
+
export declare function timeWindowFilter(start?: string, end?: string): boolean;
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* TimeWindowParams
|
|
385
|
+
*
|
|
386
|
+
* @remarks
|
|
387
|
+
* Both params can be provided in any format recognized by the Date.parse() method.
|
|
388
|
+
*
|
|
389
|
+
* @example
|
|
390
|
+
* ```json
|
|
391
|
+
* {
|
|
392
|
+
* "start": "Sun Sep 25 2022 16:51:55 GMT+0000",
|
|
393
|
+
* "end": "Fri Nov 25 2022 17:51:55 GMT+0000"
|
|
394
|
+
* }
|
|
395
|
+
* ```
|
|
396
|
+
*
|
|
397
|
+
* @example
|
|
398
|
+
* ```json
|
|
399
|
+
* {
|
|
400
|
+
* "start": "2022-10-01",
|
|
401
|
+
* "end": "2022-12-01"
|
|
402
|
+
* }
|
|
403
|
+
* ```
|
|
404
|
+
*
|
|
405
|
+
* @example
|
|
406
|
+
* ```json
|
|
407
|
+
* {
|
|
408
|
+
* "end": "Dec 31, 2022"
|
|
409
|
+
* }
|
|
410
|
+
* ```
|
|
411
|
+
*
|
|
412
|
+
* @example
|
|
413
|
+
* ```json
|
|
414
|
+
* {
|
|
415
|
+
* "start": "2023-01-01T00:00:00.000+00:00"
|
|
416
|
+
* }
|
|
417
|
+
* ```
|
|
418
|
+
*
|
|
419
|
+
* @public
|
|
420
|
+
*/
|
|
421
|
+
export declare type TimeWindowParams = {
|
|
422
|
+
readonly start?: string;
|
|
423
|
+
readonly end?: string;
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* TimeWindowSchema type.
|
|
428
|
+
*
|
|
429
|
+
* @remarks
|
|
430
|
+
* JSON schema type.
|
|
431
|
+
*
|
|
432
|
+
* @public
|
|
433
|
+
*/
|
|
434
|
+
export declare type TimeWindowSchema = ClientFilterSchema<typeof ClientFilterName.timeWindow, TimeWindowParams>;
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* URLTargeting client filter DI interface.
|
|
438
|
+
*
|
|
439
|
+
* @public
|
|
440
|
+
*/
|
|
441
|
+
export declare interface URLTargeting extends ClientFilter<URLTargetingParams> {
|
|
442
|
+
/**
|
|
443
|
+
* @remarks
|
|
444
|
+
* Check if a url is secure.
|
|
445
|
+
*
|
|
446
|
+
* @param url - A url.
|
|
447
|
+
*/
|
|
448
|
+
isSecure(url: string): boolean;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* URLTargeting DI key.
|
|
453
|
+
*
|
|
454
|
+
* @privateRemarks
|
|
455
|
+
* Marked as internal to stop api-extractor becoming confused cross-linking tokens with the same name.
|
|
456
|
+
*
|
|
457
|
+
* @internal
|
|
458
|
+
*/
|
|
459
|
+
export declare const URLTargeting: InterfaceSymbol<URLTargeting>;
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* URLTargeting client filter function.
|
|
463
|
+
* @remarks
|
|
464
|
+
* This will return true when the current URL matches on ANY of the parameters. If you wish to match on multiple
|
|
465
|
+
* parameters, consider chaining an array of urlTargeting filters together.
|
|
466
|
+
* @param url - A url.
|
|
467
|
+
* @param pattern - A regex.
|
|
468
|
+
* @param schemes - Schemes/protocols to target.
|
|
469
|
+
* @param hosts - Hosts to target.
|
|
470
|
+
* @param paths - Paths to target.
|
|
471
|
+
* @public
|
|
472
|
+
* @privateRemarks
|
|
473
|
+
* The pattern regex can cover everything here, but some devs will likely welcome the explicit arguments.
|
|
474
|
+
*/
|
|
475
|
+
export declare function urlTargetingFilter(url: string, pattern?: RegExp, schemes?: string[], hosts?: string[], paths?: string[]): boolean;
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* URLTargetingParams
|
|
479
|
+
*
|
|
480
|
+
* @example
|
|
481
|
+
* ```json
|
|
482
|
+
* {
|
|
483
|
+
* "schemes": ["https"],
|
|
484
|
+
* "hosts": ["neptx.genesislab.global", "neptune-uat2-axes-server2"]
|
|
485
|
+
* }
|
|
486
|
+
* ```
|
|
487
|
+
*
|
|
488
|
+
* @public
|
|
489
|
+
*/
|
|
490
|
+
export declare type URLTargetingParams = {
|
|
491
|
+
/**
|
|
492
|
+
* A url.
|
|
493
|
+
*/
|
|
494
|
+
readonly url?: string;
|
|
495
|
+
/**
|
|
496
|
+
* A regex.
|
|
497
|
+
*/
|
|
498
|
+
readonly pattern?: RegExp;
|
|
499
|
+
/**
|
|
500
|
+
* Schemes/protocols to target.
|
|
501
|
+
*/
|
|
502
|
+
readonly schemes?: string[];
|
|
503
|
+
/**
|
|
504
|
+
* Hosts to target.
|
|
505
|
+
*/
|
|
506
|
+
readonly hosts?: string[];
|
|
507
|
+
/**
|
|
508
|
+
* Paths to target.
|
|
509
|
+
*/
|
|
510
|
+
readonly paths?: string[];
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* URLTargetingSchema type.
|
|
515
|
+
*
|
|
516
|
+
* @remarks
|
|
517
|
+
* JSON schema type.
|
|
518
|
+
*
|
|
519
|
+
* @public
|
|
520
|
+
*/
|
|
521
|
+
export declare type URLTargetingSchema = ClientFilterSchema<typeof ClientFilterName.urlTargeting, URLTargetingParams>;
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* UserAgent client filter DI interface.
|
|
525
|
+
*
|
|
526
|
+
* @remarks
|
|
527
|
+
* Simplifies access to runtime data / state contained within the DI container.
|
|
528
|
+
*
|
|
529
|
+
* @public
|
|
530
|
+
* @privateRemarks
|
|
531
|
+
* Created for consistency with other filters that required DI container access.
|
|
532
|
+
*/
|
|
533
|
+
export declare interface UserAgent extends ClientFilter<UserAgentParams> {
|
|
534
|
+
/**
|
|
535
|
+
* @remarks
|
|
536
|
+
* Is the user-agent safari.
|
|
537
|
+
*
|
|
538
|
+
* @privateRemarks
|
|
539
|
+
* Added as an example, see comment in implementation.
|
|
540
|
+
*/
|
|
541
|
+
readonly isSafari: boolean;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* UserAgent DI key.
|
|
546
|
+
*
|
|
547
|
+
* @privateRemarks
|
|
548
|
+
* Marked as internal to stop api-extractor becoming confused cross-linking tokens with the same name.
|
|
549
|
+
*
|
|
550
|
+
* @internal
|
|
551
|
+
*/
|
|
552
|
+
export declare const UserAgent: InterfaceSymbol<UserAgent>;
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* UserAgent client filter function.
|
|
556
|
+
*
|
|
557
|
+
* @remarks
|
|
558
|
+
* See {@link https://github.com/faisalman/ua-parser-js} for more information.
|
|
559
|
+
*
|
|
560
|
+
* @param browsers - Browser names to target.
|
|
561
|
+
* @param devices - Device types to target.
|
|
562
|
+
* @param oss - Operating system names to target.
|
|
563
|
+
* @param ua - User-agent string (required in nodejs environment).
|
|
564
|
+
* @public
|
|
565
|
+
*/
|
|
566
|
+
export declare function userAgentFilter(browsers?: string[], devices?: string[], oss?: string[], ua?: string): boolean;
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* UserAgentParams
|
|
570
|
+
*
|
|
571
|
+
* @example
|
|
572
|
+
* ```json
|
|
573
|
+
* {
|
|
574
|
+
* "browsers": ["Safari", "Firefox", "Chrome", "Chromium"],
|
|
575
|
+
* "devices": ["mobile", "tablet"],
|
|
576
|
+
* "oss": ["Mac OS", "Linux"]
|
|
577
|
+
* }
|
|
578
|
+
* ```
|
|
579
|
+
*
|
|
580
|
+
* @public
|
|
581
|
+
*/
|
|
582
|
+
export declare type UserAgentParams = {
|
|
583
|
+
/**
|
|
584
|
+
* Browser names to target.
|
|
585
|
+
*/
|
|
586
|
+
readonly browsers?: string[];
|
|
587
|
+
/**
|
|
588
|
+
* Device types to target.
|
|
589
|
+
*/
|
|
590
|
+
readonly devices?: string[];
|
|
591
|
+
/**
|
|
592
|
+
* Operating system names to target.
|
|
593
|
+
*/
|
|
594
|
+
readonly oss?: string[];
|
|
595
|
+
/**
|
|
596
|
+
* @remarks
|
|
597
|
+
* Provided for fine-grain control over the user-agent string in browser, and nodejs usage.
|
|
598
|
+
*/
|
|
599
|
+
readonly ua?: string;
|
|
600
|
+
};
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* UserAgentSchema type.
|
|
604
|
+
*
|
|
605
|
+
* @remarks
|
|
606
|
+
* JSON schema type.
|
|
607
|
+
*
|
|
608
|
+
* @public
|
|
609
|
+
*/
|
|
610
|
+
export declare type UserAgentSchema = ClientFilterSchema<typeof ClientFilterName.userAgent, UserAgentParams>;
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* UserTargeting client filter DI interface.
|
|
614
|
+
*
|
|
615
|
+
* @remarks
|
|
616
|
+
* Simplifies access to runtime data / state contained within the DI container.
|
|
617
|
+
*
|
|
618
|
+
* @public
|
|
619
|
+
*/
|
|
620
|
+
export declare interface UserTargeting extends ClientFilter<UserTargetingParams> {
|
|
621
|
+
/**
|
|
622
|
+
* @remarks
|
|
623
|
+
* Has the user got the 'ADMIN' profile assigned.
|
|
624
|
+
*
|
|
625
|
+
* @privateRemarks
|
|
626
|
+
* Added as an example, see comment in implementation.
|
|
627
|
+
*/
|
|
628
|
+
readonly hasAdminProfile: boolean;
|
|
629
|
+
/**
|
|
630
|
+
* @remarks
|
|
631
|
+
* Has the user logged in, regardless of their identity.
|
|
632
|
+
*/
|
|
633
|
+
readonly isLoggedIn: boolean;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* UserTargeting DI key.
|
|
638
|
+
*
|
|
639
|
+
* @privateRemarks
|
|
640
|
+
* Marked as internal to stop api-extractor becoming confused cross-linking tokens with the same name.
|
|
641
|
+
*
|
|
642
|
+
* @internal
|
|
643
|
+
*/
|
|
644
|
+
export declare const UserTargeting: InterfaceSymbol<UserTargeting>;
|
|
645
|
+
|
|
646
|
+
/**
|
|
647
|
+
* UserTargeting client filter function.
|
|
648
|
+
* @remarks
|
|
649
|
+
* This will return true when the current user matches on ANY of the parameters. If you wish to match on multiple
|
|
650
|
+
* parameters, consider chaining an array of userTargeting filters together.
|
|
651
|
+
* @param user - A user object.
|
|
652
|
+
* @param usernames - Usernames to target.
|
|
653
|
+
* @param profiles - Profiles to target.
|
|
654
|
+
* @param permissions - Permissions to target.
|
|
655
|
+
* @public
|
|
656
|
+
* @privateRemarks
|
|
657
|
+
* We could provide another parameter to indicate a complete match is required?
|
|
658
|
+
*/
|
|
659
|
+
export declare function userTargetingFilter(user: User, usernames?: string[], profiles?: string[], permissions?: string[]): boolean;
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* UserTargetingParams
|
|
663
|
+
*
|
|
664
|
+
* @example
|
|
665
|
+
* ```json
|
|
666
|
+
* {
|
|
667
|
+
* "usernames": ["JohnDoe"],
|
|
668
|
+
* "profiles": ["ADMIN", "READ_WRITE_DEALER"],
|
|
669
|
+
* "permissions": ["ExportClientDashboard"]
|
|
670
|
+
* }
|
|
671
|
+
* ```
|
|
672
|
+
*
|
|
673
|
+
* @public
|
|
674
|
+
*/
|
|
675
|
+
export declare type UserTargetingParams = {
|
|
676
|
+
/**
|
|
677
|
+
* Usernames to target.
|
|
678
|
+
*/
|
|
679
|
+
readonly usernames?: string[];
|
|
680
|
+
/**
|
|
681
|
+
* Profiles to target.
|
|
682
|
+
*
|
|
683
|
+
* @remarks
|
|
684
|
+
* Profiles are assigned to users, and users may have multiple profiles assigned to them.
|
|
685
|
+
*/
|
|
686
|
+
readonly profiles?: string[];
|
|
687
|
+
/**
|
|
688
|
+
* Permissions to target.
|
|
689
|
+
*
|
|
690
|
+
* @remarks
|
|
691
|
+
* Permissions are assigned to profiles, NEVER to users directly.
|
|
692
|
+
* The user permissions array will contain everything from the assigned profiles for fine-grained control.
|
|
693
|
+
*/
|
|
694
|
+
readonly permissions?: string[];
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* UserTargetingSchema type.
|
|
699
|
+
*
|
|
700
|
+
* @remarks
|
|
701
|
+
* JSON schema type.
|
|
702
|
+
*
|
|
703
|
+
* @public
|
|
704
|
+
*/
|
|
705
|
+
export declare type UserTargetingSchema = ClientFilterSchema<typeof ClientFilterName.userTargeting, UserTargetingParams>;
|
|
706
|
+
|
|
707
|
+
export { }
|