Skip to content

Commit 99bcc95

Browse files
committed
Squashed commit of the following:
commit 2cf166d Author: Nick Pleis <[email protected]> Date: Tue Mar 28 14:26:20 2023 -0700 Brought into compliance with ESLint commit 30bd3f8 Author: Nick Pleis <[email protected]> Date: Tue Mar 28 13:04:21 2023 -0700 Updated tests to new framework, all tests pass commit fb3430f Author: Nick Pleis <[email protected]> Date: Mon Mar 20 13:10:09 2023 -0700 refactor: changing things around to support this as a common sdk The existing js-client-sdk only works for the web but the actual differences required to support react-native are very small. I'm refactoring the client sdk into a common package that is shared by both javascript client SDKs. This requires small changes to how the SDK works. Basically storage is different between the two and the native SDK has no concept of session storage. This reflects that.
1 parent a1d1a21 commit 99bcc95

15 files changed

+17482
-4006
lines changed

.eslintcache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[{"/Users/nick/projects/js-client-sdk-common/src/assignment-logger.ts":"1","/Users/nick/projects/js-client-sdk-common/src/client/eppo-client.spec.ts":"2","/Users/nick/projects/js-client-sdk-common/src/client/eppo-client.ts":"3","/Users/nick/projects/js-client-sdk-common/src/configuration-store.ts":"4","/Users/nick/projects/js-client-sdk-common/src/constants.ts":"5","/Users/nick/projects/js-client-sdk-common/src/dto/allocation-dto.ts":"6","/Users/nick/projects/js-client-sdk-common/src/dto/experiment-configuration-dto.ts":"7","/Users/nick/projects/js-client-sdk-common/src/dto/rule-dto.ts":"8","/Users/nick/projects/js-client-sdk-common/src/dto/variation-dto.ts":"9","/Users/nick/projects/js-client-sdk-common/src/experiment-configuration-requestor.ts":"10","/Users/nick/projects/js-client-sdk-common/src/http-client.ts":"11","/Users/nick/projects/js-client-sdk-common/src/index.spec.ts":"12","/Users/nick/projects/js-client-sdk-common/src/index.ts":"13","/Users/nick/projects/js-client-sdk-common/src/rule_evaluator.spec.ts":"14","/Users/nick/projects/js-client-sdk-common/src/rule_evaluator.ts":"15","/Users/nick/projects/js-client-sdk-common/src/shard.ts":"16","/Users/nick/projects/js-client-sdk-common/src/validation.ts":"17","/Users/nick/projects/js-client-sdk-common/test/testHelpers.ts":"18"},{"size":893,"mtime":1679282040448,"results":"19","hashOfConfig":"20"},{"size":8936,"mtime":1680038760666,"results":"21","hashOfConfig":"20"},{"size":5310,"mtime":1680038659507,"results":"22","hashOfConfig":"20"},{"size":118,"mtime":1680038668737,"results":"23","hashOfConfig":"20"},{"size":346,"mtime":1679282040449,"results":"24","hashOfConfig":"20"},{"size":135,"mtime":1679282040449,"results":"25","hashOfConfig":"20"},{"size":291,"mtime":1679282040449,"results":"26","hashOfConfig":"20"},{"size":396,"mtime":1679282040449,"results":"27","hashOfConfig":"20"},{"size":220,"mtime":1679282040449,"results":"28","hashOfConfig":"20"},{"size":797,"mtime":1680038687033,"results":"29","hashOfConfig":"20"},{"size":854,"mtime":1679286586855,"results":"30","hashOfConfig":"20"},{"size":88,"mtime":1679282040450,"results":"31","hashOfConfig":"20"},{"size":472,"mtime":1680038705256,"results":"32","hashOfConfig":"20"},{"size":5392,"mtime":1679282040450,"results":"33","hashOfConfig":"20"},{"size":2485,"mtime":1680033855312,"results":"34","hashOfConfig":"20"},{"size":579,"mtime":1679282040451,"results":"35","hashOfConfig":"20"},{"size":225,"mtime":1679282040451,"results":"36","hashOfConfig":"20"},{"size":1235,"mtime":1680032856679,"results":"37","hashOfConfig":"20"},{"filePath":"38","messages":"39","suppressedMessages":"40","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"109tjyf",{"filePath":"41","messages":"42","suppressedMessages":"43","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"44","messages":"45","suppressedMessages":"46","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"47","messages":"48","suppressedMessages":"49","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"50","messages":"51","suppressedMessages":"52","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"53","messages":"54","suppressedMessages":"55","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"56","messages":"57","suppressedMessages":"58","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"59","messages":"60","suppressedMessages":"61","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"62","messages":"63","suppressedMessages":"64","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"65","messages":"66","suppressedMessages":"67","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"68","messages":"69","suppressedMessages":"70","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"71","messages":"72","suppressedMessages":"73","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"74","messages":"75","suppressedMessages":"76","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"77","messages":"78","suppressedMessages":"79","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"80","messages":"81","suppressedMessages":"82","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"83","messages":"84","suppressedMessages":"85","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"86","messages":"87","suppressedMessages":"88","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"89","messages":"90","suppressedMessages":"91","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/nick/projects/js-client-sdk-common/src/assignment-logger.ts",[],["92"],"/Users/nick/projects/js-client-sdk-common/src/client/eppo-client.spec.ts",[],["93","94"],"/Users/nick/projects/js-client-sdk-common/src/client/eppo-client.ts",[],["95","96"],"/Users/nick/projects/js-client-sdk-common/src/configuration-store.ts",[],[],"/Users/nick/projects/js-client-sdk-common/src/constants.ts",[],[],"/Users/nick/projects/js-client-sdk-common/src/dto/allocation-dto.ts",[],[],"/Users/nick/projects/js-client-sdk-common/src/dto/experiment-configuration-dto.ts",[],[],"/Users/nick/projects/js-client-sdk-common/src/dto/rule-dto.ts",[],["97"],"/Users/nick/projects/js-client-sdk-common/src/dto/variation-dto.ts",[],["98"],"/Users/nick/projects/js-client-sdk-common/src/experiment-configuration-requestor.ts",[],[],"/Users/nick/projects/js-client-sdk-common/src/http-client.ts",[],["99"],"/Users/nick/projects/js-client-sdk-common/src/index.spec.ts",[],[],"/Users/nick/projects/js-client-sdk-common/src/index.ts",[],[],"/Users/nick/projects/js-client-sdk-common/src/rule_evaluator.spec.ts",[],[],"/Users/nick/projects/js-client-sdk-common/src/rule_evaluator.ts",[],["100","101","102","103","104","105","106","107"],"/Users/nick/projects/js-client-sdk-common/src/shard.ts",[],[],"/Users/nick/projects/js-client-sdk-common/src/validation.ts",[],[],"/Users/nick/projects/js-client-sdk-common/test/testHelpers.ts",[],["108"],{"ruleId":"109","severity":1,"message":"110","line":27,"column":37,"nodeType":"111","messageId":"112","endLine":27,"endColumn":40,"suggestions":"113","suppressions":"114"},{"ruleId":"115","severity":2,"message":"116","line":23,"column":21,"nodeType":"117","messageId":"118","endLine":23,"endColumn":50,"suppressions":"119"},{"ruleId":"109","severity":1,"message":"110","line":291,"column":41,"nodeType":"111","messageId":"112","endLine":291,"endColumn":44,"suggestions":"120","suppressions":"121"},{"ruleId":"109","severity":1,"message":"110","line":31,"column":40,"nodeType":"111","messageId":"112","endLine":31,"endColumn":43,"suggestions":"122","suppressions":"123"},{"ruleId":"109","severity":1,"message":"110","line":98,"column":39,"nodeType":"111","messageId":"112","endLine":98,"endColumn":42,"suggestions":"124","suppressions":"125"},{"ruleId":"109","severity":1,"message":"110","line":15,"column":10,"nodeType":"111","messageId":"112","endLine":15,"endColumn":13,"suggestions":"126","suppressions":"127"},{"ruleId":"109","severity":1,"message":"110","line":9,"column":10,"nodeType":"111","messageId":"112","endLine":9,"endColumn":13,"suggestions":"128","suppressions":"129"},{"ruleId":"109","severity":1,"message":"110","line":30,"column":34,"nodeType":"111","messageId":"112","endLine":30,"endColumn":37,"suggestions":"130","suppressions":"131"},{"ruleId":"109","severity":1,"message":"110","line":4,"column":68,"nodeType":"111","messageId":"112","endLine":4,"endColumn":71,"suggestions":"132","suppressions":"133"},{"ruleId":"109","severity":1,"message":"110","line":13,"column":56,"nodeType":"111","messageId":"112","endLine":13,"endColumn":59,"suggestions":"134","suppressions":"135"},{"ruleId":"109","severity":1,"message":"110","line":19,"column":37,"nodeType":"111","messageId":"112","endLine":19,"endColumn":40,"suggestions":"136","suppressions":"137"},{"ruleId":"109","severity":1,"message":"110","line":25,"column":62,"nodeType":"111","messageId":"112","endLine":25,"endColumn":65,"suggestions":"138","suppressions":"139"},{"ruleId":"109","severity":1,"message":"110","line":48,"column":34,"nodeType":"111","messageId":"112","endLine":48,"endColumn":37,"suggestions":"140","suppressions":"141"},{"ruleId":"109","severity":1,"message":"110","line":52,"column":37,"nodeType":"111","messageId":"112","endLine":52,"endColumn":40,"suggestions":"142","suppressions":"143"},{"ruleId":"109","severity":1,"message":"110","line":61,"column":19,"nodeType":"111","messageId":"112","endLine":61,"endColumn":22,"suggestions":"144","suppressions":"145"},{"ruleId":"109","severity":1,"message":"110","line":62,"column":19,"nodeType":"111","messageId":"112","endLine":62,"endColumn":22,"suggestions":"146","suppressions":"147"},{"ruleId":"109","severity":1,"message":"110","line":16,"column":83,"nodeType":"111","messageId":"112","endLine":16,"endColumn":86,"suggestions":"148","suppressions":"149"},"@typescript-eslint/no-explicit-any","Unexpected any. Specify a different type.","TSAnyKeyword","unexpectedAny",["150","151"],["152"],"@typescript-eslint/no-var-requires","Require statement not part of import statement.","CallExpression","noVarReqs",["153"],["154","155"],["156"],["157","158"],["159"],["160","161"],["162"],["163","164"],["165"],["166","167"],["168"],["169","170"],["171"],["172","173"],["174"],["175","176"],["177"],["178","179"],["180"],["181","182"],["183"],["184","185"],["186"],["187","188"],["189"],["190","191"],["192"],["193","194"],["195"],["196","197"],["198"],{"messageId":"199","fix":"200","desc":"201"},{"messageId":"202","fix":"203","desc":"204"},{"kind":"205","justification":"206"},{"kind":"205","justification":"206"},{"messageId":"199","fix":"207","desc":"201"},{"messageId":"202","fix":"208","desc":"204"},{"kind":"205","justification":"206"},{"messageId":"199","fix":"209","desc":"201"},{"messageId":"202","fix":"210","desc":"204"},{"kind":"205","justification":"206"},{"messageId":"199","fix":"211","desc":"201"},{"messageId":"202","fix":"212","desc":"204"},{"kind":"205","justification":"206"},{"messageId":"199","fix":"213","desc":"201"},{"messageId":"202","fix":"214","desc":"204"},{"kind":"205","justification":"206"},{"messageId":"199","fix":"215","desc":"201"},{"messageId":"202","fix":"216","desc":"204"},{"kind":"205","justification":"206"},{"messageId":"199","fix":"217","desc":"201"},{"messageId":"202","fix":"218","desc":"204"},{"kind":"205","justification":"206"},{"messageId":"199","fix":"219","desc":"201"},{"messageId":"202","fix":"220","desc":"204"},{"kind":"205","justification":"206"},{"messageId":"199","fix":"221","desc":"201"},{"messageId":"202","fix":"222","desc":"204"},{"kind":"205","justification":"206"},{"messageId":"199","fix":"223","desc":"201"},{"messageId":"202","fix":"224","desc":"204"},{"kind":"205","justification":"206"},{"messageId":"199","fix":"225","desc":"201"},{"messageId":"202","fix":"226","desc":"204"},{"kind":"205","justification":"206"},{"messageId":"199","fix":"227","desc":"201"},{"messageId":"202","fix":"228","desc":"204"},{"kind":"205","justification":"206"},{"messageId":"199","fix":"229","desc":"201"},{"messageId":"202","fix":"230","desc":"204"},{"kind":"205","justification":"206"},{"messageId":"199","fix":"231","desc":"201"},{"messageId":"202","fix":"232","desc":"204"},{"kind":"205","justification":"206"},{"messageId":"199","fix":"233","desc":"201"},{"messageId":"202","fix":"234","desc":"204"},{"kind":"205","justification":"206"},{"messageId":"199","fix":"235","desc":"201"},{"messageId":"202","fix":"236","desc":"204"},{"kind":"205","justification":"206"},"suggestUnknown",{"range":"237","text":"238"},"Use `unknown` instead, this will force you to explicitly, and safely assert the type is correct.","suggestNever",{"range":"237","text":"239"},"Use `never` instead, this is useful when instantiating generic type parameters that you don't need to know the type of.","directive","",{"range":"240","text":"238"},{"range":"240","text":"239"},{"range":"241","text":"238"},{"range":"241","text":"239"},{"range":"242","text":"238"},{"range":"242","text":"239"},{"range":"243","text":"238"},{"range":"243","text":"239"},{"range":"244","text":"238"},{"range":"244","text":"239"},{"range":"245","text":"238"},{"range":"245","text":"239"},{"range":"246","text":"238"},{"range":"246","text":"239"},{"range":"247","text":"238"},{"range":"247","text":"239"},{"range":"248","text":"238"},{"range":"248","text":"239"},{"range":"249","text":"238"},{"range":"249","text":"239"},{"range":"250","text":"238"},{"range":"250","text":"239"},{"range":"251","text":"238"},{"range":"251","text":"239"},{"range":"252","text":"238"},{"range":"252","text":"239"},{"range":"253","text":"238"},{"range":"253","text":"239"},{"range":"254","text":"238"},{"range":"254","text":"239"},[521,524],"unknown","never",[8712,8715],[1305,1308],[3802,3805],[309,312],[186,189],[742,745],[189,192],[400,403],[641,644],[842,845],[1732,1735],[1892,1895],[2257,2260],[2280,2283],[644,647]]

js-client-sdk-common.api.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
## API Report File for "@eppo/js-client-sdk-common"
2+
3+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4+
5+
```ts
6+
7+
import { AxiosInstance } from 'axios';
8+
9+
// @public (undocumented)
10+
const BASE_URL = "https://eppo.cloud/api";
11+
12+
declare namespace constants {
13+
export {
14+
REQUEST_TIMEOUT_MILLIS,
15+
BASE_URL,
16+
SESSION_ASSIGNMENT_CONFIG_LOADED,
17+
NULL_SENTINEL,
18+
MAX_EVENT_QUEUE_SIZE
19+
}
20+
}
21+
export { constants }
22+
23+
// @public (undocumented)
24+
export class EppoClient implements IEppoClient {
25+
// Warning: (ae-forgotten-export) The symbol "IConfigurationStore" needs to be exported by the entry point index.d.ts
26+
constructor(configurationStore: IConfigurationStore);
27+
// (undocumented)
28+
getAssignment(subjectKey: string, experimentKey: string, subjectAttributes?: {}): string;
29+
// (undocumented)
30+
setLogger(logger: IAssignmentLogger): void;
31+
}
32+
33+
// @public (undocumented)
34+
export class ExperimentConfigurationRequestor {
35+
constructor(configurationStore: IConfigurationStore, httpClient: HttpClient);
36+
// Warning: (ae-forgotten-export) The symbol "IExperimentConfiguration" needs to be exported by the entry point index.d.ts
37+
//
38+
// (undocumented)
39+
fetchAndStoreConfigurations(): Promise<Record<string, IExperimentConfiguration>>;
40+
}
41+
42+
// @public (undocumented)
43+
export class HttpClient {
44+
// Warning: (ae-forgotten-export) The symbol "ISdkParams" needs to be exported by the entry point index.d.ts
45+
constructor(axiosInstance: AxiosInstance, sdkParams: ISdkParams);
46+
// (undocumented)
47+
get<T>(resource: string): Promise<T>;
48+
}
49+
50+
// @public
51+
export interface IAssignmentLogger {
52+
// Warning: (ae-forgotten-export) The symbol "IAssignmentEvent" needs to be exported by the entry point index.d.ts
53+
logAssignment(assignment: IAssignmentEvent): void;
54+
}
55+
56+
// @public
57+
export interface IEppoClient {
58+
getAssignment(subjectKey: string, experimentKey: string, subjectAttributes?: Record<string, any>): string;
59+
}
60+
61+
// @public (undocumented)
62+
class InvalidArgumentError extends Error {
63+
}
64+
65+
// @public (undocumented)
66+
const MAX_EVENT_QUEUE_SIZE = 100;
67+
68+
// @public (undocumented)
69+
const NULL_SENTINEL = "EPPO_NULL";
70+
71+
// @public (undocumented)
72+
const REQUEST_TIMEOUT_MILLIS = 5000;
73+
74+
// @public (undocumented)
75+
const SESSION_ASSIGNMENT_CONFIG_LOADED = "eppo-session-assignment-config-loaded";
76+
77+
// @public (undocumented)
78+
function validateNotBlank(value: string, errorMessage: string): void;
79+
80+
declare namespace validation {
81+
export {
82+
validateNotBlank,
83+
InvalidArgumentError
84+
}
85+
}
86+
export { validation }
87+
88+
// (No @packageDocumentation comment for this package)
89+
90+
```

0 commit comments

Comments
 (0)