@mfdj/tsc-as-build-tool 2.6.0 → 2.8.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/dist/Client.d.ts +9 -0
- package/dist/Client.d.ts.map +1 -0
- package/dist/Client.js +16 -0
- package/dist/Client.js.map +1 -0
- package/dist/EntryPoint.d.ts +12 -0
- package/dist/EntryPoint.d.ts.map +1 -0
- package/dist/EntryPoint.js +72 -0
- package/dist/EntryPoint.js.map +1 -0
- package/dist/ExperimentationRoot.d.ts +11 -0
- package/dist/ExperimentationRoot.d.ts.map +1 -0
- package/dist/ExperimentationRoot.js +24 -0
- package/dist/ExperimentationRoot.js.map +1 -0
- package/dist/http/ScopedServiceClient.d.ts +23 -0
- package/dist/http/ScopedServiceClient.d.ts.map +1 -0
- package/dist/http/ScopedServiceClient.js +60 -0
- package/dist/http/ScopedServiceClient.js.map +1 -0
- package/dist/http/createEndpoint.d.ts +8 -12
- package/dist/http/createEndpoint.d.ts.map +1 -1
- package/dist/http/createEndpoint.js +9 -6
- package/dist/http/createEndpoint.js.map +1 -1
- package/dist/http/response-parsers.d.ts +3 -0
- package/dist/http/response-parsers.d.ts.map +1 -0
- package/dist/http/response-parsers.js +24 -0
- package/dist/http/response-parsers.js.map +1 -0
- package/dist/http/serialize.d.ts +3 -2
- package/dist/http/serialize.d.ts.map +1 -1
- package/dist/http/serialize.js +6 -6
- package/dist/http/serialize.js.map +1 -1
- package/dist/http/serviceFetch.d.ts.map +1 -1
- package/dist/http/serviceFetch.js +3 -24
- package/dist/http/serviceFetch.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/logging.d.ts +5 -2
- package/dist/logging.d.ts.map +1 -1
- package/dist/logging.js +103 -23
- package/dist/logging.js.map +1 -1
- package/dist/misc/arbitrary.d.ts.map +1 -0
- package/dist/misc/arbitrary.js.map +1 -0
- package/dist/misc/throwAnError.d.ts.map +1 -0
- package/dist/misc/throwAnError.js.map +1 -0
- package/dist/misc/toLowercase.d.ts.map +1 -0
- package/dist/misc/toLowercase.js.map +1 -0
- package/dist/persistent-storage/DefaultStore.d.ts +9 -0
- package/dist/persistent-storage/DefaultStore.d.ts.map +1 -0
- package/dist/persistent-storage/DefaultStore.js +23 -0
- package/dist/persistent-storage/DefaultStore.js.map +1 -0
- package/dist/types.d.ts +36 -16
- package/dist/types.d.ts.map +1 -1
- package/package.json +20 -3
- package/dist/utils/arbitrary.d.ts.map +0 -1
- package/dist/utils/arbitrary.js.map +0 -1
- package/dist/utils/throwAnError.d.ts.map +0 -1
- package/dist/utils/throwAnError.js.map +0 -1
- package/dist/utils/toLowercase.d.ts.map +0 -1
- package/dist/utils/toLowercase.js.map +0 -1
- /package/dist/{utils → misc}/arbitrary.d.ts +0 -0
- /package/dist/{utils → misc}/arbitrary.js +0 -0
- /package/dist/{utils → misc}/throwAnError.d.ts +0 -0
- /package/dist/{utils → misc}/throwAnError.js +0 -0
- /package/dist/{utils → misc}/toLowercase.d.ts +0 -0
- /package/dist/{utils → misc}/toLowercase.js +0 -0
package/dist/Client.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ScopedServiceClient, type ClientOptions } from "./http/ScopedServiceClient.ts";
|
|
2
|
+
export declare class Client {
|
|
3
|
+
readonly accountClient: ScopedServiceClient<"account">;
|
|
4
|
+
readonly userClient: ScopedServiceClient<"user">;
|
|
5
|
+
constructor(options?: ClientOptions);
|
|
6
|
+
get account(): ScopedServiceClient<"account">;
|
|
7
|
+
get user(): ScopedServiceClient<"user">;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=Client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Client.d.ts","sourceRoot":"","sources":["../src/Client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,KAAK,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAExF,qBAAa,MAAM;IACjB,QAAQ,CAAC,aAAa,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACvD,QAAQ,CAAC,UAAU,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC;gBAErC,OAAO,CAAC,EAAE,aAAa;IAKnC,IAAI,OAAO,IAAI,mBAAmB,CAAC,SAAS,CAAC,CAE5C;IAED,IAAI,IAAI,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAEtC;CACF"}
|
package/dist/Client.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ScopedServiceClient } from "./http/ScopedServiceClient.js";
|
|
2
|
+
export class Client {
|
|
3
|
+
accountClient;
|
|
4
|
+
userClient;
|
|
5
|
+
constructor(options) {
|
|
6
|
+
this.accountClient = new ScopedServiceClient("account", options);
|
|
7
|
+
this.userClient = new ScopedServiceClient("user", options);
|
|
8
|
+
}
|
|
9
|
+
get account() {
|
|
10
|
+
return this.accountClient;
|
|
11
|
+
}
|
|
12
|
+
get user() {
|
|
13
|
+
return this.userClient;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=Client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Client.js","sourceRoot":"","sources":["../src/Client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAsB,MAAM,+BAA+B,CAAC;AAExF,MAAM,OAAO,MAAM;IACR,aAAa,CAAiC;IAC9C,UAAU,CAA8B;IAEjD,YAAY,OAAuB;QACjC,IAAI,CAAC,aAAa,GAAG,IAAI,mBAAmB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACjE,IAAI,CAAC,UAAU,GAAG,IAAI,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { EntryPointConfig, ExperimentConfig, ExperimentScope } from "./types.ts";
|
|
3
|
+
export type EntryPointProps = Omit<EntryPointConfig, "name"> & {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
experimentName?: ExperimentConfig["name"];
|
|
6
|
+
experiments?: EntryPointConfig | EntryPointConfig[];
|
|
7
|
+
name: ExperimentConfig["entryPointName"];
|
|
8
|
+
scope?: ExperimentScope;
|
|
9
|
+
};
|
|
10
|
+
export declare function EntryPoint({ children, ...props }: EntryPointProps): ReactNode;
|
|
11
|
+
export declare function entryPointParser(props: Omit<EntryPointProps, "children">): ExperimentConfig[];
|
|
12
|
+
//# sourceMappingURL=EntryPoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntryPoint.d.ts","sourceRoot":"","sources":["../src/EntryPoint.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEtF,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,GAAG;IAC7D,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,cAAc,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC1C,WAAW,CAAC,EAAE,gBAAgB,GAAG,gBAAgB,EAAE,CAAC;IACpD,IAAI,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IACzC,KAAK,CAAC,EAAE,eAAe,CAAC;CACzB,CAAC;AAIF,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,GAAG,SAAS,CAmB7E;AAOD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,GAAG,gBAAgB,EAAE,CAqE7F"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { debug, info, warn } from "./logging.js";
|
|
3
|
+
import { Client } from "./Client.js";
|
|
4
|
+
const serviceClient = new Client(); // TODO: fetch from container/store
|
|
5
|
+
export function EntryPoint({ children, ...props }) {
|
|
6
|
+
const configs = entryPointParser(props);
|
|
7
|
+
const fingerprint = JSON.stringify(configs);
|
|
8
|
+
debug("EntryPoint configs", ...configs);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
info("EntryPoint configs useEffect", fingerprint);
|
|
11
|
+
configs.forEach((config) => {
|
|
12
|
+
config.readyToRequest &&
|
|
13
|
+
serviceClient[config.scope].createParticipation(config.name, config.customFilters, config.filterGroups);
|
|
14
|
+
});
|
|
15
|
+
}, [fingerprint]);
|
|
16
|
+
return children;
|
|
17
|
+
}
|
|
18
|
+
// units
|
|
19
|
+
const mixedConfigWarning = "EntryPoint was passed both a standalone experiment and a list of experiments. The standalone will be appended to the list. When there are multiple experiments it's recommended to consolidate them all into the experiments list for clarity.";
|
|
20
|
+
export function entryPointParser(props) {
|
|
21
|
+
debug("EntryPointProps", props);
|
|
22
|
+
const { experiments, name: entryPointName, ...standalone } = props;
|
|
23
|
+
// DX: allow non-list values for experiments
|
|
24
|
+
const list = experiments
|
|
25
|
+
? Array.isArray(experiments)
|
|
26
|
+
? experiments
|
|
27
|
+
: [experiments]
|
|
28
|
+
: null;
|
|
29
|
+
if (standalone && list) {
|
|
30
|
+
warn(mixedConfigWarning, { standalone, list });
|
|
31
|
+
}
|
|
32
|
+
let configs = [];
|
|
33
|
+
// list and standalone are *nearly* identical but pay attention to the minor differences and separate parsing logic
|
|
34
|
+
// EntrypointConfig[]
|
|
35
|
+
if (list) {
|
|
36
|
+
debug("entryPointParser - list", list);
|
|
37
|
+
list.forEach((entryPointConfig) => {
|
|
38
|
+
const { filterGroups: fg, readyToRequest = true, // experiments default to ready-to-request
|
|
39
|
+
scope = "account", // account is the default scope
|
|
40
|
+
...passThru } = entryPointConfig;
|
|
41
|
+
configs.push({
|
|
42
|
+
...passThru,
|
|
43
|
+
entryPointName,
|
|
44
|
+
filterGroups: fg ? (Array.isArray(fg) ? fg : [fg]) : null, // DX: allow non-list values of filterGroups
|
|
45
|
+
readyToRequest,
|
|
46
|
+
scope,
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
// subset of EntryPointProps
|
|
51
|
+
if (standalone) {
|
|
52
|
+
debug("entryPointParser - standalone", standalone);
|
|
53
|
+
const { experimentName: name, filterGroups: fg, readyToRequest = true, // experiments default to ready-to-request
|
|
54
|
+
scope = "account", // account is the default scope
|
|
55
|
+
...passThru } = standalone;
|
|
56
|
+
if (name) {
|
|
57
|
+
configs.push({
|
|
58
|
+
...passThru,
|
|
59
|
+
entryPointName,
|
|
60
|
+
filterGroups: fg ? (Array.isArray(fg) ? fg : [fg]) : null, // DX: allow non-list values of filterGroups
|
|
61
|
+
name,
|
|
62
|
+
readyToRequest,
|
|
63
|
+
scope,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
debug("entryPointParser - ignoring standalone since it's missing an experimentName");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return configs;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=EntryPoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntryPoint.js","sourceRoot":"","sources":["../src/EntryPoint.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAarC,MAAM,aAAa,GAAG,IAAI,MAAM,EAAE,CAAC,CAAC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4C;gBACvG,IAAI;gBACJ,cAAc;gBACd,KAAK;aACN,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,6EAA6E,CAAC,CAAC;QACvF,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
interface ExperimentationRootProps {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
applicationName?: string;
|
|
5
|
+
disableHydration?: boolean;
|
|
6
|
+
hasIgnoreRenderBlocking?: boolean;
|
|
7
|
+
hasVerboseLogs?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function ExperimentationRoot({ children, ...props }: ExperimentationRootProps): ReactNode;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=ExperimentationRoot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExperimentationRoot.d.ts","sourceRoot":"","sources":["../src/ExperimentationRoot.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,UAAU,wBAAwB;IAChC,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,wBAAwB,GAAG,SAAS,CAmBtC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
import { debug } from "./logging.js";
|
|
3
|
+
export function ExperimentationRoot({ children, ...props }) {
|
|
4
|
+
const { disableHydration = false, hasVerboseLogs = false, applicationName, } = props;
|
|
5
|
+
const hasVerboseLogsRef = useRef(hasVerboseLogs);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const init = { hasVerboseLogs: hasVerboseLogsRef.current, applicationName };
|
|
8
|
+
if (disableHydration) {
|
|
9
|
+
initialize(init);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
void hydrate(init);
|
|
13
|
+
}
|
|
14
|
+
}, [initialize, hydrate, disableHydration, applicationName]);
|
|
15
|
+
return children;
|
|
16
|
+
}
|
|
17
|
+
// stubs
|
|
18
|
+
function initialize(a) {
|
|
19
|
+
debug(`TODO: initialize - ${a}`);
|
|
20
|
+
}
|
|
21
|
+
function hydrate(a) {
|
|
22
|
+
debug(`TODO: hydrate - ${a}`);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=ExperimentationRoot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExperimentationRoot.js","sourceRoot":"","sources":["../src/ExperimentationRoot.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAYrC,MAAM,UAAU,mBAAmB,CAAC,EAClC,QAAQ,EACR,GAAG,KAAK,EACiB;IACzB,MAAM,EACJ,gBAAgB,GAAG,KAAK,EACxB,cAAc,GAAG,KAAK,EACtB,eAAe,GAChB,GAAG,KAAK,CAAC;IAEV,MAAM,iBAAiB,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;IAEjD,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,IAAI,GAAG,EAAE,cAAc,EAAE,iBAAiB,CAAC,OAAO,EAAE,eAAe,EAAE,CAAC;QAC5E,IAAI,gBAAgB,EAAE,CAAC;YACrB,UAAU,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;aAAM,CAAC;YACN,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;IACH,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,EAAE,gBAAgB,EAAE,eAAe,CAAC,CAAC,CAAC;IAE7D,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,QAAQ;AACR,SAAS,UAAU,CAAC,CAAM;IACxB,KAAK,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,OAAO,CAAC,CAAM;IACrB,KAAK,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { AccountFilterGroup, CustomFilters, ExperimentName, ExperimentScope, Participation, ParticipationResponseBody, PersistentStore, UserFilterGroup } from "../types.ts";
|
|
2
|
+
export type ClientOptions = {
|
|
3
|
+
host?: string;
|
|
4
|
+
persistentStore?: PersistentStore;
|
|
5
|
+
};
|
|
6
|
+
export declare class ScopedServiceClient<ES extends ExperimentScope> {
|
|
7
|
+
readonly scope: ES;
|
|
8
|
+
readonly host: string;
|
|
9
|
+
constructor(scope: ES, { host }?: ClientOptions);
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
createEvent(experiment: ExperimentName, event: string): Promise<Response | null>;
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
createParticipation(experiment: ExperimentName, cfs?: CustomFilters | null, fgs?: AccountFilterGroup[] | UserFilterGroup[] | null): Promise<Participation>;
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
getParticipations(): Promise<Response | ParticipationResponseBody[] | null>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=ScopedServiceClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScopedServiceClient.d.ts","sourceRoot":"","sources":["../../src/http/ScopedServiceClient.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,eAAe,EACf,aAAa,EACb,yBAAyB,EACzB,eAAe,EACf,eAAe,EAChB,MAAM,aAAa,CAAC;AAGrB,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC,CAAC;AAEF,qBAAa,mBAAmB,CAAC,EAAE,SAAS,eAAe;IACzD,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,KAAK,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAE,aAAkB;IAMnD;;OAEG;IACG,WAAW,CAAC,UAAU,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAoBtF;;OAEG;IACG,mBAAmB,CACvB,UAAU,EAAE,cAAc,EAC1B,GAAG,GAAE,aAAa,GAAG,IAAW,EAChC,GAAG,GAAE,kBAAkB,EAAE,GAAG,eAAe,EAAE,GAAG,IAAW,GAC1D,OAAO,CAAC,aAAa,CAAC;IAgBzB;;OAEG;IACG,iBAAiB,IAAI,OAAO,CAAC,QAAQ,GAAG,yBAAyB,EAAE,GAAG,IAAI,CAAC;CAOlF"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { debug, info, error as logError } from "../logging.js";
|
|
2
|
+
import { createEndpoint } from "./createEndpoint.js";
|
|
3
|
+
import { parseParticipation } from "./response-parsers.js";
|
|
4
|
+
import { serviceFetch } from "./serviceFetch.js";
|
|
5
|
+
import { serializeParticipationRequest } from "./serialize.js";
|
|
6
|
+
export class ScopedServiceClient {
|
|
7
|
+
scope;
|
|
8
|
+
host;
|
|
9
|
+
constructor(scope, { host } = {}) {
|
|
10
|
+
this.scope = scope;
|
|
11
|
+
this.host = host || "";
|
|
12
|
+
debug("ScopedServiceClient constructor", this);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
async createEvent(experiment, event) {
|
|
18
|
+
const scope = this.scope;
|
|
19
|
+
const host = this.host;
|
|
20
|
+
const endpoint = createEndpoint(scope, "event", { experiment, host });
|
|
21
|
+
info(`creating ${event} event for ${experiment} ${scope}-experiment`);
|
|
22
|
+
try {
|
|
23
|
+
return serviceFetch(endpoint, {
|
|
24
|
+
body: JSON.stringify({ event_name: event }),
|
|
25
|
+
method: "POST",
|
|
26
|
+
skipJson: true,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
catch (e) {
|
|
30
|
+
// swallow error
|
|
31
|
+
logError("Failure to transmit event", e);
|
|
32
|
+
return Promise.resolve(null);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
38
|
+
async createParticipation(experiment, cfs = null, fgs = null) {
|
|
39
|
+
const scope = this.scope;
|
|
40
|
+
const host = this.host;
|
|
41
|
+
const endpoint = createEndpoint(scope, "participation", { experiment, host });
|
|
42
|
+
const body = serializeParticipationRequest(cfs, fgs);
|
|
43
|
+
const result = await serviceFetch(endpoint, {
|
|
44
|
+
body: JSON.stringify(body),
|
|
45
|
+
method: "POST",
|
|
46
|
+
});
|
|
47
|
+
debug(`createParticipation ${scope} - serviceFetch result`, result);
|
|
48
|
+
return parseParticipation(experiment, result);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
*
|
|
52
|
+
*/
|
|
53
|
+
async getParticipations() {
|
|
54
|
+
const scope = this.scope;
|
|
55
|
+
const host = this.host;
|
|
56
|
+
const endpoint = createEndpoint(scope, "participations", { host });
|
|
57
|
+
return serviceFetch(endpoint);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=ScopedServiceClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScopedServiceClient.js","sourceRoot":"","sources":["../../src/http/ScopedServiceClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,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AC;QAC/B,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,mBAAmB,CACvB,UAA0B,EAC1B,MAA4B,IAAI,EAChC,MAAuD,IAAI;QAE3D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACvB,MAAM,QAAQ,GAAG,cAAc,CAAC,KAAK,EAAE,eAAe,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9E,MAAM,IAAI,GAAG,6BAA6B,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAErD,MAAM,MAAM,GAAG,MAAM,YAAY,CAA4B,QAAQ,EAAE;YACrE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;YAC1B,MAAM,EAAE,MAAM;SACf,CAAC,CAAC;QAEH,KAAK,CAAC,uBAAuB,KAAK,wBAAwB,EAAE,MAAM,CAAC,CAAC;QAEpE,OAAO,kBAAkB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,iBAAiB;QACrB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACvB,MAAM,QAAQ,GAAG,cAAc,CAAC,KAAK,EAAE,gBAAgB,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QAEnE,OAAO,YAAY,CAA8B,QAAQ,CAAC,CAAC;IAC7D,CAAC;CACF"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
host?: string;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export declare function createEndpoint(
|
|
8
|
-
|
|
9
|
-
experimentType: ExperimentType;
|
|
10
|
-
host?: string;
|
|
11
|
-
resource: "event" | "participation";
|
|
12
|
-
}): string;
|
|
1
|
+
import type { ExperimentScope } from "../types.ts";
|
|
2
|
+
type EndpointOptions = {
|
|
3
|
+
experiment: string;
|
|
4
|
+
host?: string | undefined;
|
|
5
|
+
};
|
|
6
|
+
export declare function createEndpoint(type: ExperimentScope, resource: "participations", options?: Omit<EndpointOptions, "experiment">): string;
|
|
7
|
+
export declare function createEndpoint(type: ExperimentScope, resource: "event" | "participation", options: EndpointOptions): string;
|
|
8
|
+
export {};
|
|
13
9
|
//# sourceMappingURL=createEndpoint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createEndpoint.d.ts","sourceRoot":"","sources":["../../src/http/createEndpoint.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createEndpoint.d.ts","sourceRoot":"","sources":["../../src/http/createEndpoint.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAInD,KAAK,eAAe,GAAG;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B,CAAC;AAGF,wBAAgB,cAAc,CAC5B,IAAI,EAAE,eAAe,EACrB,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,GAC5C,MAAM,CAAC;AAGV,wBAAgB,cAAc,CAC5B,IAAI,EAAE,eAAe,EACrB,QAAQ,EAAE,OAAO,GAAG,eAAe,EACnC,OAAO,EAAE,eAAe,GACvB,MAAM,CAAC"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { debug } from "../logging.js";
|
|
2
|
+
export function createEndpoint(type, resource, options) {
|
|
3
|
+
const { host, experiment } = options || {};
|
|
4
|
+
const url = host ? new URL(host) : null;
|
|
5
|
+
const finalHost = url === null ? "" : `${url.protocol}//${url.host}`;
|
|
6
|
+
debug("createEndpoint", { host, finalHost, type, resource, experiment });
|
|
7
|
+
if (experiment) {
|
|
8
|
+
return `${finalHost}/api/services/experiments/${type}/experiments/${experiment}/${resource}`;
|
|
6
9
|
}
|
|
7
|
-
return `${finalHost}/api/services/experiments/${
|
|
10
|
+
return `${finalHost}/api/services/experiments/${type}/experiments/${resource}`;
|
|
8
11
|
}
|
|
9
12
|
//# sourceMappingURL=createEndpoint.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createEndpoint.js","sourceRoot":"","sources":["../../src/http/createEndpoint.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createEndpoint.js","sourceRoot":"","sources":["../../src/http/createEndpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAwBtC,MAAM,UAAU,cAAc,CAC5B,IAAqB,EACrB,QAAsB,EACtB,OAAkC;IAElC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACxC,MAAM,SAAS,GAAG,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,QAAQ,KAAK,GAAG,CAAC,IAAI,EAAE,CAAC;IAErE,KAAK,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC;IAEzE,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,GAAG,SAAS,6BAA6B,IAAI,gBAAgB,UAAU,IAAI,QAAQ,EAAE,CAAC;IAC/F,CAAC;IAED,OAAO,GAAG,SAAS,6BAA6B,IAAI,gBAAgB,QAAQ,EAAE,CAAC;AACjF,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ExperimentName, Participation, ParticipationResponseBody } from "../types.ts";
|
|
2
|
+
export declare function parseParticipation(experimentName: ExperimentName, result: ParticipationResponseBody | Response | null): Participation;
|
|
3
|
+
//# sourceMappingURL=response-parsers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response-parsers.d.ts","sourceRoot":"","sources":["../../src/http/response-parsers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAE5F,wBAAgB,kBAAkB,CAChC,cAAc,EAAE,cAAc,EAC9B,MAAM,EAAE,yBAAyB,GAAG,QAAQ,GAAG,IAAI,GAClD,aAAa,CA0Bf"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { debug, warn } from "../logging.js";
|
|
2
|
+
export function parseParticipation(experimentName, result) {
|
|
3
|
+
if (!result || result instanceof Response || result.inactive) {
|
|
4
|
+
debug("result parsed as inactive", result);
|
|
5
|
+
return {
|
|
6
|
+
active: false,
|
|
7
|
+
experimentName,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
if (!result.variation) {
|
|
11
|
+
warn("result parsed as inactive because variation is unexpectedly missing", result);
|
|
12
|
+
return {
|
|
13
|
+
active: false,
|
|
14
|
+
experimentName,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
debug("result parsed as active", result);
|
|
18
|
+
return {
|
|
19
|
+
active: true,
|
|
20
|
+
experimentName,
|
|
21
|
+
variation: result.variation,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=response-parsers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response-parsers.js","sourceRoot":"","sources":["../../src/http/response-parsers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAG5C,MAAM,UAAU,kBAAkB,CAChC,cAA8B,EAC9B,MAAmD;IAEnD,IAAI,CAAC,MAAM,IAAI,MAAM,YAAY,QAAQ,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QAC7D,KAAK,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC;QAE3C,OAAO;YACL,MAAM,EAAE,KAAK;YACb,cAAc;SACf,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;QACtB,IAAI,CAAC,qEAAqE,EAAE,MAAM,CAAC,CAAC;QAEpF,OAAO;YACL,MAAM,EAAE,KAAK;YACb,cAAc;SACf,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,yBAAyB,EAAE,MAAM,CAAC,CAAC;IAEzC,OAAO;QACL,MAAM,EAAE,IAAI;QACZ,cAAc;QACd,SAAS,EAAE,MAAM,CAAC,SAAS;KAC5B,CAAC;AACJ,CAAC"}
|
package/dist/http/serialize.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function
|
|
1
|
+
import type { AccountFilterGroup, CustomFilters, CustomFiltersRequest, ParticipationRequestBody, UserFilterGroup } from "../types.ts";
|
|
2
|
+
export declare function serializeCustomFilters(customFilters: CustomFilters): CustomFiltersRequest;
|
|
3
|
+
export declare function serializeParticipationRequest(customFilters: CustomFilters | null, filterGroups: AccountFilterGroup[] | UserFilterGroup[] | null): ParticipationRequestBody;
|
|
3
4
|
//# sourceMappingURL=serialize.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/http/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/http/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,aAAa,EACb,oBAAoB,EACpB,wBAAwB,EACxB,eAAe,EAChB,MAAM,aAAa,CAAC;AAErB,wBAAgB,sBAAsB,CAAC,aAAa,EAAE,aAAa,GAAG,oBAAoB,CAazF;AAED,wBAAgB,6BAA6B,CAC3C,aAAa,EAAE,aAAa,GAAG,IAAI,EACnC,YAAY,EAAE,kBAAkB,EAAE,GAAG,eAAe,EAAE,GAAG,IAAI,GAC5D,wBAAwB,CAY1B"}
|
package/dist/http/serialize.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function serializeCustomFilters(customFilters) {
|
|
1
|
+
export function serializeCustomFilters(customFilters) {
|
|
2
2
|
return Object.keys(customFilters)
|
|
3
3
|
.map((name) => {
|
|
4
4
|
const value = customFilters[name];
|
|
@@ -11,13 +11,13 @@ function serializeCustomFilters(customFilters) {
|
|
|
11
11
|
})
|
|
12
12
|
.filter((item) => item !== null);
|
|
13
13
|
}
|
|
14
|
-
export function serializeParticipationRequest(
|
|
14
|
+
export function serializeParticipationRequest(customFilters, filterGroups) {
|
|
15
15
|
const request = {};
|
|
16
|
-
if (
|
|
17
|
-
request.custom_filters = serializeCustomFilters(
|
|
16
|
+
if (customFilters) {
|
|
17
|
+
request.custom_filters = serializeCustomFilters(customFilters);
|
|
18
18
|
}
|
|
19
|
-
if (
|
|
20
|
-
request.filter_groups =
|
|
19
|
+
if (filterGroups) {
|
|
20
|
+
request.filter_groups = filterGroups;
|
|
21
21
|
}
|
|
22
22
|
return request;
|
|
23
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialize.js","sourceRoot":"","sources":["../../src/http/serialize.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serialize.js","sourceRoot":"","sources":["../../src/http/serialize.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,sBAAsB,CAAC,aAA4B;IACjE,OAAO,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC;SAC9B,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACZ,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;QAElC,OAAO,OAAO,KAAK,KAAK,WAAW;YACjC,CAAC,CAAC;gBACE,IAAI;gBACJ,KAAK;aACN;YACH,CAAC,CAAC,IAAI,CAAC;IACX,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,6BAA6B,CAC3C,aAAmC,EACnC,YAA6D;IAE7D,MAAM,OAAO,GAA6B,EAAE,CAAC;IAE7C,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,CAAC,cAAc,GAAG,sBAAsB,CAAC,aAAa,CAAC,CAAC;IACjE,CAAC;IAED,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,CAAC,aAAa,GAAG,YAAY,CAAC;IACvC,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serviceFetch.d.ts","sourceRoot":"","sources":["../../src/http/serviceFetch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serviceFetch.d.ts","sourceRoot":"","sources":["../../src/http/serviceFetch.ts"],"names":[],"mappings":"AAGA,wBAAsB,YAAY,CAAC,CAAC,EAClC,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,WAAW,GAAG;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GACA,OAAO,CAAC,CAAC,GAAG,QAAQ,GAAG,IAAI,CAAC,CAsB9B"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { error as logError, info } from "../logging.js";
|
|
2
2
|
import { globalFetch } from "./globalFetch.js";
|
|
3
|
-
// import type { Participation, ParticipationResponseJson } from "../types.ts";
|
|
4
3
|
export async function serviceFetch(endpoint, options) {
|
|
5
4
|
const { skipJson = false, ...fetchOptions } = options ?? {};
|
|
6
5
|
try {
|
|
7
|
-
info(`
|
|
6
|
+
info(`serviceFetch: ${endpoint}`, fetchOptions);
|
|
8
7
|
const response = await globalFetch(endpoint, {
|
|
9
8
|
headers: {
|
|
10
9
|
"Content-Type": "application/json",
|
|
@@ -12,32 +11,12 @@ export async function serviceFetch(endpoint, options) {
|
|
|
12
11
|
method: "GET",
|
|
13
12
|
...(fetchOptions || {}),
|
|
14
13
|
});
|
|
14
|
+
info(`serviceFetch: response`, response);
|
|
15
15
|
return skipJson ? response : response.json();
|
|
16
16
|
}
|
|
17
17
|
catch (error) {
|
|
18
|
-
logError(error);
|
|
18
|
+
logError("serviceFetch catch", error);
|
|
19
19
|
return null;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
// Commented out for now to keep test coverage up
|
|
23
|
-
/*
|
|
24
|
-
export function parseParticipation(
|
|
25
|
-
participation: ParticipationResponseJson,
|
|
26
|
-
): Participation | null {
|
|
27
|
-
if (!participation) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const experimentName = participation.experiment_name;
|
|
32
|
-
|
|
33
|
-
if (!experimentName) {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
experimentName,
|
|
39
|
-
variation: participation.variation,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
*/
|
|
43
22
|
//# sourceMappingURL=serviceFetch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serviceFetch.js","sourceRoot":"","sources":["../../src/http/serviceFetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,QAAQ,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C
|
|
1
|
+
{"version":3,"file":"serviceFetch.js","sourceRoot":"","sources":["../../src/http/serviceFetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,QAAQ,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,QAAgB,EAChB,OAEC;IAED,MAAM,EAAE,QAAQ,GAAG,KAAK,EAAE,GAAG,YAAY,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAE5D,IAAI,CAAC;QACH,IAAI,CAAC,iBAAiB,QAAQ,EAAE,EAAE,YAAY,CAAC,CAAC;QAEhD,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,QAAQ,EAAE;YAC3C,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;YACD,MAAM,EAAE,KAAK;YACb,GAAG,CAAC,YAAY,IAAI,EAAE,CAAC;SACxB,CAAC,CAAC;QAEH,IAAI,CAAC,wBAAwB,EAAE,QAAQ,CAAC,CAAC;QAEzC,OAAO,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC/C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,QAAQ,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;QAEtC,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,wBAAgB,yBAAyB,CACvC,EAAE,OAAO,EAAE,GAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAuB,GACrD,IAAI,GAAG,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,wBAAgB,yBAAyB,CACvC,EAAE,OAAO,EAAE,GAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAuB,GACrD,IAAI,GAAG,KAAK,CAkBd;AAED,qBAAa,WAAW;IAEtB,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAIrC,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;CAG1C"}
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { throwAnError } from "./
|
|
2
|
-
import { toLowercase } from "./
|
|
1
|
+
import { throwAnError } from "./misc/throwAnError.js";
|
|
2
|
+
import { toLowercase } from "./misc/toLowercase.js";
|
|
3
3
|
export function usesCodeThatThrowsAnError({ rethrow } = { rethrow: false }) {
|
|
4
4
|
try {
|
|
5
5
|
throwAnError();
|
|
6
6
|
}
|
|
7
7
|
catch (e) {
|
|
8
8
|
const cause = e;
|
|
9
|
+
// including `{ cause }` as 2nd argument requires `"target": "es2022"`
|
|
9
10
|
const nextError = new Error("throwAnError did what it said on the tin", {
|
|
10
11
|
cause,
|
|
11
12
|
});
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,MAAM,UAAU,yBAAyB,CACvC,EAAE,OAAO,KAA2B,EAAE,OAAO,EAAE,KAAK,EAAE;IAEtD,IAAI,CAAC;QACH,YAAY,EAAE,CAAC;IACjB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,KAAK,GAAY,CAAC,CAAC;QACzB,sEAAsE;QACtE,MAAM,SAAS,GAAG,IAAI,KAAK,CAAC,0CAA0C,EAAE;YACtE,KAAK;SACN,CAAC,CAAC;QAEH,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,SAAS,CAAC;QAClB,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO;AACT,CAAC;AAED,MAAM,OAAO,WAAW;IACtB,sCAAsC;IACtC,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,KAAa;QAC9B,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;CACF"}
|
package/dist/logging.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
declare const channels: readonly ["debug", "error", "info", "warn"];
|
|
2
|
+
type LoggingChannel = (typeof channels)[number];
|
|
2
3
|
export declare function debug(...args: unknown[]): void;
|
|
3
4
|
export declare function error(...args: unknown[]): void;
|
|
4
5
|
export declare function info(...args: unknown[]): void;
|
|
5
6
|
export declare function warn(...args: unknown[]): void;
|
|
6
|
-
export declare function
|
|
7
|
+
export declare function enableLogging(channels?: "all" | "default" | LoggingChannel[]): void;
|
|
8
|
+
export declare function disableLogging(): void;
|
|
9
|
+
export declare function logger(channel: LoggingChannel, ...args: unknown[]): void;
|
|
7
10
|
export {};
|
|
8
11
|
//# sourceMappingURL=logging.d.ts.map
|
package/dist/logging.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../src/logging.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../src/logging.ts"],"names":[],"mappings":"AAaA,QAAA,MAAM,QAAQ,6CAA8C,CAAC;AAC7D,KAAK,cAAc,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhD,wBAAgB,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAE9C;AAED,wBAAgB,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAE9C;AAED,wBAAgB,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAE7C;AAED,wBAAgB,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAE7C;AAED,wBAAgB,aAAa,CAAC,QAAQ,GAAE,KAAK,GAAG,SAAS,GAAG,cAAc,EAAc,GAAG,IAAI,CAG9F;AAED,wBAAgB,cAAc,IAAI,IAAI,CAErC;AAED,wBAAgB,MAAM,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CA0CxE"}
|
package/dist/logging.js
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
// configuration (module scoped)
|
|
2
|
+
let outputAllowed;
|
|
3
|
+
let include_debug = false;
|
|
4
|
+
let include_info = false;
|
|
5
|
+
let include_error = false;
|
|
6
|
+
let include_warn = false;
|
|
7
|
+
let stanza_debug = "[esc]";
|
|
8
|
+
let stanza_info = "[esc]";
|
|
9
|
+
let stanza_error = "[esc]";
|
|
10
|
+
let stanza_warn = "[esc]";
|
|
11
|
+
const channels = ["debug", "error", "info", "warn"];
|
|
2
12
|
export function debug(...args) {
|
|
3
13
|
logger("debug", ...args);
|
|
4
14
|
}
|
|
@@ -11,37 +21,107 @@ export function info(...args) {
|
|
|
11
21
|
export function warn(...args) {
|
|
12
22
|
logger("warn", ...args);
|
|
13
23
|
}
|
|
14
|
-
export function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
export function enableLogging(channels = "default") {
|
|
25
|
+
configureLogging(channels);
|
|
26
|
+
outputAllowed = true;
|
|
27
|
+
}
|
|
28
|
+
export function disableLogging() {
|
|
29
|
+
outputAllowed = false;
|
|
30
|
+
}
|
|
31
|
+
export function logger(channel, ...args) {
|
|
32
|
+
// If not already configured lazily configure the logger using process.env (once per module)
|
|
33
|
+
if (typeof outputAllowed === "undefined") {
|
|
34
|
+
const process = globalThis.process;
|
|
35
|
+
const nodeEnv = process?.env["NODE_ENV"] || "";
|
|
36
|
+
const disabled = Boolean(process?.env["ESC_LOGGING_DISABLE"]);
|
|
37
|
+
const logging = process?.env["ESC_LOGGING"] || ""; // "all", ""
|
|
38
|
+
// Enable if ESC_LOGGING is truthy, or if NODE_ENV looks like "dev" and ESC_LOGGING_DISABLE is not truthy
|
|
39
|
+
outputAllowed = Boolean(logging) || Boolean(nodeEnv.match(/dev/i) && disabled === false);
|
|
40
|
+
if (logging === "all" || logging === "default") {
|
|
41
|
+
configureLogging(logging);
|
|
42
|
+
}
|
|
43
|
+
else if (["1", "true"].includes(logging) || (outputAllowed && logging === "")) {
|
|
44
|
+
configureLogging("default");
|
|
45
|
+
}
|
|
46
|
+
else if (logging) {
|
|
47
|
+
// user configured channels
|
|
48
|
+
configureLogging(logging.split(",").filter(isChannel));
|
|
49
|
+
}
|
|
23
50
|
}
|
|
24
|
-
if (
|
|
25
|
-
switch (
|
|
51
|
+
if (outputAllowed) {
|
|
52
|
+
switch (channel) {
|
|
53
|
+
// std-out
|
|
26
54
|
case "debug":
|
|
27
|
-
|
|
28
|
-
console.debug("[esc]", ...args);
|
|
29
|
-
break;
|
|
30
|
-
case "error":
|
|
31
|
-
// eslint-disable-next-line no-console
|
|
32
|
-
console.error("[esc]", ...args);
|
|
55
|
+
include_debug && console.debug(stanza_debug, ...args);
|
|
33
56
|
break;
|
|
34
|
-
// std-out
|
|
35
57
|
case "info":
|
|
36
|
-
|
|
37
|
-
console.info("[esc]", ...args);
|
|
58
|
+
include_info && console.info(stanza_info, ...args);
|
|
38
59
|
break;
|
|
39
60
|
// std-err
|
|
61
|
+
case "error":
|
|
62
|
+
include_error && console.error(stanza_error, ...args);
|
|
63
|
+
break;
|
|
40
64
|
case "warn":
|
|
41
|
-
|
|
42
|
-
console.warn("[esc]", ...args);
|
|
65
|
+
include_warn && console.warn(stanza_warn, ...args);
|
|
43
66
|
break;
|
|
44
67
|
}
|
|
45
68
|
}
|
|
46
69
|
}
|
|
70
|
+
// private
|
|
71
|
+
function isChannel(value) {
|
|
72
|
+
// `as readonly string[]` is a type widening trick from https://8hob.io/posts/elegant-safe-solution-for-typing-array-includes/
|
|
73
|
+
const included = channels.includes(value);
|
|
74
|
+
if (!included)
|
|
75
|
+
console.warn(stanza_warn, `Ignoring unknown logger channel: ${value}`);
|
|
76
|
+
return included;
|
|
77
|
+
}
|
|
78
|
+
function configureLogging(channels = "default") {
|
|
79
|
+
// reset
|
|
80
|
+
include_debug = false;
|
|
81
|
+
include_info = false;
|
|
82
|
+
include_error = false;
|
|
83
|
+
include_warn = false;
|
|
84
|
+
const probablyNode = typeof globalThis.process?.versions?.node === "string";
|
|
85
|
+
if (probablyNode) {
|
|
86
|
+
stanza_debug = "[esc-debug]";
|
|
87
|
+
stanza_info = "[esc-info]";
|
|
88
|
+
stanza_error = "[esc-error]";
|
|
89
|
+
stanza_warn = "[esc-warn]";
|
|
90
|
+
}
|
|
91
|
+
// "all" | "default"
|
|
92
|
+
if (typeof channels === "string") {
|
|
93
|
+
if (channels === "all") {
|
|
94
|
+
include_debug = include_info = include_error = include_warn = true;
|
|
95
|
+
}
|
|
96
|
+
if (channels === "default") {
|
|
97
|
+
include_debug = false;
|
|
98
|
+
include_info = true;
|
|
99
|
+
include_error = true;
|
|
100
|
+
include_warn = true;
|
|
101
|
+
}
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
// LoggingChannel[]
|
|
105
|
+
if (Array.isArray(channels)) {
|
|
106
|
+
// user configured channels
|
|
107
|
+
channels.forEach((channel) => {
|
|
108
|
+
switch (channel) {
|
|
109
|
+
case "debug":
|
|
110
|
+
include_debug = true;
|
|
111
|
+
break;
|
|
112
|
+
case "error":
|
|
113
|
+
include_error = true;
|
|
114
|
+
break;
|
|
115
|
+
case "info":
|
|
116
|
+
include_info = true;
|
|
117
|
+
break;
|
|
118
|
+
case "warn":
|
|
119
|
+
include_warn = true;
|
|
120
|
+
break;
|
|
121
|
+
default:
|
|
122
|
+
console.warn(stanza_warn, `Ignoring unknown logger channel: ${channel}`);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
47
127
|
//# sourceMappingURL=logging.js.map
|
package/dist/logging.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../src/logging.ts"],"names":[],"mappings":"AAAA,IAAI,
|
|
1
|
+
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../src/logging.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,IAAI,aAAkC,CAAC;AAEvC,IAAI,aAAa,GAAG,KAAK,CAAC;AAC1B,IAAI,YAAY,GAAG,KAAK,CAAC;AACzB,IAAI,aAAa,GAAG,KAAK,CAAC;AAC1B,IAAI,YAAY,GAAG,KAAK,CAAC;AAEzB,IAAI,YAAY,GAAG,OAAO,CAAC;AAC3B,IAAI,WAAW,GAAG,OAAO,CAAC;AAC1B,IAAI,YAAY,GAAG,OAAO,CAAC;AAC3B,IAAI,WAAW,GAAG,OAAO,CAAC;AAE1B,MAAM,QAAQ,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AAG7D,MAAM,UAAU,KAAK,CAAC,GAAG,IAAe;IACtC,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,GAAG,IAAe;IACtC,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,GAAG,IAAe;IACrC,MAAM,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,GAAG,IAAe;IACrC,MAAM,CAAC,MAAM,EAAE,GAAG,IAAI,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QAC7B,WAAW,GAAG,YAAY,CAAC;IAC7B,CAAC;IAED,oBAAoB;IACpB,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,IAAI,QAAQ,KAAK,KAAK,EAAE,CAAC;YACvB,aAAa,GAAG,YAAY,GAAG,aAAa,GAAG,YAAY,GAAG,IAAI,CAAC;QACrE,CAAC;QAED,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,aAAa,GAAG,KAAK,CAAC;YACtB,YAAY,GAAG,IAAI,CAAC;YACpB,aAAa,GAAG,IAAI,CAAC;YACrB,YAAY,GAAG,IAAI,CAAC;QACtB,CAAC;QAED,OAAO;IACT,CAAC;IAED,mBAAmB;IACnB,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,2BAA2B;QAC3B,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAuB,EAAQ,EAAE;YACjD,QAAQ,OAAO,EAAE,CAAC;gBAChB,KAAK,OAAO;oBACV,aAAa,GAAG,IAAI,CAAC;oBACrB,MAAM;gBACR,KAAK,OAAO;oBACV,aAAa,GAAG,IAAI,CAAC;oBACrB,MAAM;gBACR,KAAK,MAAM;oBACT,YAAY,GAAG,IAAI,CAAC;oBACpB,MAAM;gBACR,KAAK,MAAM;oBACT,YAAY,GAAG,IAAI,CAAC;oBACpB,MAAM;gBACR;oBACE,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,oCAAoC,OAAO,EAAE,CAAC,CAAC;YAC7E,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arbitrary.d.ts","sourceRoot":"","sources":["../../src/misc/arbitrary.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arbitrary.js","sourceRoot":"","sources":["../../src/misc/arbitrary.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throwAnError.d.ts","sourceRoot":"","sources":["../../src/misc/throwAnError.ts"],"names":[],"mappings":"AACA,wBAAgB,YAAY,IAAI,IAAI,CAEnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throwAnError.js","sourceRoot":"","sources":["../../src/misc/throwAnError.ts"],"names":[],"mappings":"AACA,MAAM,UAAU,YAAY;IAC1B,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toLowercase.d.ts","sourceRoot":"","sources":["../../src/misc/toLowercase.ts"],"names":[],"mappings":"AAGA,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAyBjD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toLowercase.js","sourceRoot":"","sources":["../../src/misc/toLowercase.ts"],"names":[],"mappings":"AAAA;;EAEE;AACF,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,IAAI,MAAM,GAAG,EAAE,CAAC;IAEhB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,IAAI,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACnC,8BAA8B;QAE9B,IAAI,QAAQ,IAAI,EAAE,IAAI,QAAQ,IAAI,EAAE,EAAE,CAAC;YACrC,IAAI,OAAO,GAAG,MAAM,CAAC,YAAY,CAAC,QAAQ,GAAG,EAAE,CAAC,CAAC;YAEjD,eAAe;YACf,wDAAwD;YACxD,oBAAoB;YACpB,2BAA2B;YAC3B,KAAK;YAEL,MAAM,IAAI,OAAO,CAAC;QACpB,CAAC;aAAM,CAAC;YACN,8DAA8D;YAE9D,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PersistentStore, StorageKey } from "../types.ts";
|
|
2
|
+
export declare class DefaultStore implements PersistentStore {
|
|
3
|
+
delete(key: StorageKey): void;
|
|
4
|
+
deserialize(data: string | null): any;
|
|
5
|
+
get(key: string): any;
|
|
6
|
+
serialize(data: any): string;
|
|
7
|
+
set(key: StorageKey, data: any): void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=DefaultStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultStore.d.ts","sourceRoot":"","sources":["../../src/persistent-storage/DefaultStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE/D,qBAAa,YAAa,YAAW,eAAe;IAClD,MAAM,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI;IAI7B,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,GAAG;IAQrC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG;IAMrB,SAAS,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM;IAI5B,GAAG,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,GAAG,IAAI;CAKtC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export class DefaultStore {
|
|
2
|
+
delete(key) {
|
|
3
|
+
globalThis.localStorage.removeItem(key);
|
|
4
|
+
}
|
|
5
|
+
deserialize(data) {
|
|
6
|
+
if (!data) {
|
|
7
|
+
return '';
|
|
8
|
+
}
|
|
9
|
+
return JSON.parse(data);
|
|
10
|
+
}
|
|
11
|
+
get(key) {
|
|
12
|
+
const raw = globalThis.localStorage.getItem(key);
|
|
13
|
+
return this.deserialize(raw);
|
|
14
|
+
}
|
|
15
|
+
serialize(data) {
|
|
16
|
+
return JSON.stringify(data);
|
|
17
|
+
}
|
|
18
|
+
set(key, data) {
|
|
19
|
+
const serialized = this.serialize(data);
|
|
20
|
+
globalThis.localStorage.setItem(key, serialized);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=DefaultStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultStore.js","sourceRoot":"","sources":["../../src/persistent-storage/DefaultStore.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,YAAY;IACvB,MAAM,CAAC,GAAe;QACpB,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAC1C,CAAC;IAED,WAAW,CAAC,IAAmB;QAC7B,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED,GAAG,CAAC,GAAW;QACb,MAAM,GAAG,GAAG,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAEjD,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IAED,SAAS,CAAC,IAAS;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED,GAAG,CAAC,GAAe,EAAE,IAAS;QAC5B,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAExC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IACnD,CAAC;CACF"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,25 +1,35 @@
|
|
|
1
1
|
export declare const CREATED_KEY = "ls:created";
|
|
2
|
-
export type
|
|
2
|
+
export type ExperimentScope = "account" | "user";
|
|
3
3
|
export type AccountFilterGroup = "account" | "guide";
|
|
4
4
|
export type UserFilterGroup = "account";
|
|
5
|
+
export type ExperimentName = string;
|
|
6
|
+
export type ExperimentConfig = {
|
|
7
|
+
readonly customFilters?: CustomFilters | null;
|
|
8
|
+
readonly entryPointName: string;
|
|
9
|
+
readonly filterGroups?: AccountFilterGroup[] | UserFilterGroup[] | null;
|
|
10
|
+
readonly name: ExperimentName;
|
|
11
|
+
readonly readyToRequest?: boolean;
|
|
12
|
+
readonly scope: ExperimentScope;
|
|
13
|
+
};
|
|
14
|
+
export type EntryPointConfig = Pick<ExperimentConfig, "customFilters" | "name" | "readyToRequest"> & {
|
|
15
|
+
readonly filterGroups?: AccountFilterGroup | AccountFilterGroup[] | UserFilterGroup | UserFilterGroup[];
|
|
16
|
+
readonly scope?: ExperimentConfig["scope"];
|
|
17
|
+
};
|
|
5
18
|
export interface Participation {
|
|
6
|
-
|
|
7
|
-
|
|
19
|
+
active: boolean;
|
|
20
|
+
experimentName: ExperimentName;
|
|
21
|
+
variation?: string | number | boolean;
|
|
8
22
|
}
|
|
9
23
|
export interface Participations {
|
|
10
|
-
[experimentName:
|
|
11
|
-
}
|
|
12
|
-
export interface ParticipationResponseJson {
|
|
13
|
-
experiment_name: Participation["experimentName"];
|
|
14
|
-
variation: Participation["variation"];
|
|
24
|
+
[experimentName: ExperimentName]: Participation;
|
|
15
25
|
}
|
|
16
|
-
export interface
|
|
17
|
-
|
|
18
|
-
|
|
26
|
+
export interface ParticipationResponseBody {
|
|
27
|
+
inactive?: Participation["active"];
|
|
28
|
+
variation?: Participation["variation"];
|
|
19
29
|
}
|
|
20
|
-
export interface
|
|
21
|
-
custom_filters?:
|
|
22
|
-
filter_groups?:
|
|
30
|
+
export interface ParticipationRequestBody {
|
|
31
|
+
custom_filters?: CustomFiltersRequest;
|
|
32
|
+
filter_groups?: AccountFilterGroup[] | UserFilterGroup[];
|
|
23
33
|
}
|
|
24
34
|
export type CustomFilterName = string;
|
|
25
35
|
export type CustomFilterValue = string | number | boolean;
|
|
@@ -29,7 +39,7 @@ type KnownCustomFilters = {
|
|
|
29
39
|
requested_via: string;
|
|
30
40
|
};
|
|
31
41
|
export type CustomFilters = Partial<KnownCustomFilters> & Record<CustomFilterName, CustomFilterValue>;
|
|
32
|
-
export type
|
|
42
|
+
export type CustomFiltersRequest = Array<{
|
|
33
43
|
name: CustomFilterName;
|
|
34
44
|
value: CustomFilterValue;
|
|
35
45
|
}>;
|
|
@@ -39,7 +49,7 @@ export interface ParticipationInStore {
|
|
|
39
49
|
[CREATED_KEY]: number;
|
|
40
50
|
}
|
|
41
51
|
export type StoreData = {
|
|
42
|
-
[K in
|
|
52
|
+
[K in ExperimentScope]: Record<string, {
|
|
43
53
|
variation: unknown;
|
|
44
54
|
[CREATED_KEY]: number;
|
|
45
55
|
}>;
|
|
@@ -49,5 +59,15 @@ export type LikeLocalStorage = Omit<Storage, "getItem" | "setItem"> & {
|
|
|
49
59
|
getItem: (key: string) => StoragePossibilities;
|
|
50
60
|
setItem: (key: string, value: StoragePossibilities) => void;
|
|
51
61
|
};
|
|
62
|
+
export type RenderBlocking = {
|
|
63
|
+
enable: boolean;
|
|
64
|
+
maxWaitSeconds: number;
|
|
65
|
+
};
|
|
66
|
+
export type StorageKey = string;
|
|
67
|
+
export interface PersistentStore {
|
|
68
|
+
delete: (key: StorageKey) => void;
|
|
69
|
+
get: (key: string) => any;
|
|
70
|
+
set: (key: StorageKey, data: any) => void;
|
|
71
|
+
}
|
|
52
72
|
export {};
|
|
53
73
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,WAAW,eAAe,CAAC;AAExC,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mapp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AC;IAC/C,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB,KAAK,IAAI,CAAC;CAC7D,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,IAAI,CAAC;IAElC,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,GAAG,CAAC;IAE1B,GAAG,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;CAC3C"}
|
package/package.json
CHANGED
|
@@ -1,28 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"devDependencies": {
|
|
3
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
4
|
+
"@testing-library/react": "^16.3.2",
|
|
3
5
|
"@types/jest": "^30.0.0",
|
|
6
|
+
"@types/react": "^19.2.10",
|
|
7
|
+
"@types/react-dom": "^19.2.3",
|
|
4
8
|
"jest": "^30.2.0",
|
|
9
|
+
"jest-environment-jsdom": "^30.2.0",
|
|
10
|
+
"prettier": "^3.8.1",
|
|
11
|
+
"react": "^19.2.4",
|
|
12
|
+
"react-dom": "^19.2.4",
|
|
5
13
|
"typescript": "^5.9.3"
|
|
6
14
|
},
|
|
7
15
|
"exports": {
|
|
8
|
-
".":
|
|
16
|
+
".": {
|
|
17
|
+
"require": "./dist/index.js",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
|
+
},
|
|
9
20
|
"./*.js": "./dist/*.js"
|
|
10
21
|
},
|
|
11
22
|
"files": [
|
|
12
23
|
"dist",
|
|
13
24
|
"!dist/__tests__",
|
|
25
|
+
"dist-cjs",
|
|
14
26
|
"!*tsbuildInfo"
|
|
15
27
|
],
|
|
16
28
|
"name": "@mfdj/tsc-as-build-tool",
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"react": "+18",
|
|
31
|
+
"react-dom": "+18"
|
|
32
|
+
},
|
|
17
33
|
"private": false,
|
|
18
34
|
"scripts": {
|
|
19
|
-
"build": "rm -rf dist/*; tsc --
|
|
35
|
+
"build": "rm -rf dist/*; tsc --project tsconfig.json",
|
|
20
36
|
"prepare": "npm run build",
|
|
21
37
|
"preversion": "npm run typecheck",
|
|
38
|
+
"server-start": "php -S localhost:3000 ./script/server.php",
|
|
22
39
|
"test": "npm run build; NODE_OPTIONS=--experimental-vm-modules jest",
|
|
23
40
|
"test:watch": "./script/test-watch.sh",
|
|
24
41
|
"typecheck": "tsc --build --noEmit"
|
|
25
42
|
},
|
|
26
|
-
"version": "2.
|
|
43
|
+
"version": "2.8.0",
|
|
27
44
|
"type": "module"
|
|
28
45
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"arbitrary.d.ts","sourceRoot":"","sources":["../../src/utils/arbitrary.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,mBAAmB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"arbitrary.js","sourceRoot":"","sources":["../../src/utils/arbitrary.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG,gBAAgB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwAnError.d.ts","sourceRoot":"","sources":["../../src/utils/throwAnError.ts"],"names":[],"mappings":"AACA,wBAAgB,YAAY,IAAI,IAAI,CAEnC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwAnError.js","sourceRoot":"","sources":["../../src/utils/throwAnError.ts"],"names":[],"mappings":"AACA,MAAM,UAAU,YAAY;IAC1B,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toLowercase.d.ts","sourceRoot":"","sources":["../../src/utils/toLowercase.ts"],"names":[],"mappings":"AAGA,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAyBjD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toLowercase.js","sourceRoot":"","sources":["../../src/utils/toLowercase.ts"],"names":[],"mappings":"AAAA;;EAEE;AACF,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,IAAI,MAAM,GAAG,EAAE,CAAC;IAEhB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,IAAI,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACnC,8BAA8B;QAE9B,IAAI,QAAQ,IAAI,EAAE,IAAI,QAAQ,IAAI,EAAE,EAAE,CAAC;YACrC,IAAI,OAAO,GAAG,MAAM,CAAC,YAAY,CAAC,QAAQ,GAAG,EAAE,CAAC,CAAC;YAEjD,eAAe;YACf,wDAAwD;YACxD,oBAAoB;YACpB,2BAA2B;YAC3B,KAAK;YAEL,MAAM,IAAI,OAAO,CAAC;QACpB,CAAC;aAAM,CAAC;YACN,8DAA8D;YAE9D,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|