@launchdarkly/react-native-client-sdk 0.1.0-alpha
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/CHANGELOG.md +3 -0
- package/LICENSE +13 -0
- package/README.md +120 -0
- package/dist/package.json +77 -0
- package/dist/src/ReactNativeLDClient.d.ts +6 -0
- package/dist/src/ReactNativeLDClient.d.ts.map +1 -0
- package/dist/src/ReactNativeLDClient.js +21 -0
- package/dist/src/ReactNativeLDClient.js.map +1 -0
- package/dist/src/hooks/index.d.ts +4 -0
- package/dist/src/hooks/index.d.ts.map +1 -0
- package/dist/src/hooks/index.js +4 -0
- package/dist/src/hooks/index.js.map +1 -0
- package/dist/src/hooks/useLDClient.d.ts +3 -0
- package/dist/src/hooks/useLDClient.d.ts.map +1 -0
- package/dist/src/hooks/useLDClient.js +8 -0
- package/dist/src/hooks/useLDClient.js.map +1 -0
- package/dist/src/hooks/variation/index.d.ts +3 -0
- package/dist/src/hooks/variation/index.d.ts.map +1 -0
- package/dist/src/hooks/variation/index.js +3 -0
- package/dist/src/hooks/variation/index.js.map +1 -0
- package/dist/src/hooks/variation/useTypedVariation.d.ts +32 -0
- package/dist/src/hooks/variation/useTypedVariation.d.ts.map +1 -0
- package/dist/src/hooks/variation/useTypedVariation.js +62 -0
- package/dist/src/hooks/variation/useTypedVariation.js.map +1 -0
- package/dist/src/hooks/variation/useVariation.d.ts +131 -0
- package/dist/src/hooks/variation/useVariation.d.ts.map +1 -0
- package/dist/src/hooks/variation/useVariation.js +132 -0
- package/dist/src/hooks/variation/useVariation.js.map +1 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +15 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/platform/ConditionalAsyncStorage.d.ts +20 -0
- package/dist/src/platform/ConditionalAsyncStorage.d.ts.map +1 -0
- package/dist/src/platform/ConditionalAsyncStorage.js +29 -0
- package/dist/src/platform/ConditionalAsyncStorage.js.map +1 -0
- package/dist/src/platform/index.d.ts +4 -0
- package/dist/src/platform/index.d.ts.map +1 -0
- package/dist/src/platform/index.js +81 -0
- package/dist/src/platform/index.js.map +1 -0
- package/dist/src/polyfills/CustomEvent.d.ts +17 -0
- package/dist/src/polyfills/CustomEvent.d.ts.map +1 -0
- package/dist/src/polyfills/CustomEvent.js +13 -0
- package/dist/src/polyfills/CustomEvent.js.map +1 -0
- package/dist/src/polyfills/btoa.d.ts +2 -0
- package/dist/src/polyfills/btoa.d.ts.map +1 -0
- package/dist/src/polyfills/btoa.js +12 -0
- package/dist/src/polyfills/btoa.js.map +1 -0
- package/dist/src/polyfills/index.d.ts +5 -0
- package/dist/src/polyfills/index.d.ts.map +1 -0
- package/dist/src/polyfills/index.js +12 -0
- package/dist/src/polyfills/index.js.map +1 -0
- package/dist/src/polyfills/uuid.d.ts +10 -0
- package/dist/src/polyfills/uuid.d.ts.map +1 -0
- package/dist/src/polyfills/uuid.js +17 -0
- package/dist/src/polyfills/uuid.js.map +1 -0
- package/dist/src/provider/LDProvider.d.ts +22 -0
- package/dist/src/provider/LDProvider.d.ts.map +1 -0
- package/dist/src/provider/LDProvider.js +29 -0
- package/dist/src/provider/LDProvider.js.map +1 -0
- package/dist/src/provider/index.d.ts +3 -0
- package/dist/src/provider/index.d.ts.map +1 -0
- package/dist/src/provider/index.js +4 -0
- package/dist/src/provider/index.js.map +1 -0
- package/dist/src/provider/reactContext.d.ts +8 -0
- package/dist/src/provider/reactContext.d.ts.map +1 -0
- package/dist/src/provider/reactContext.js +7 -0
- package/dist/src/provider/reactContext.js.map +1 -0
- package/dist/src/provider/setupListeners.d.ts +6 -0
- package/dist/src/provider/setupListeners.d.ts.map +1 -0
- package/dist/src/provider/setupListeners.js +7 -0
- package/dist/src/provider/setupListeners.js.map +1 -0
- package/dist/src/react-native-sse/EventSource.d.ts +47 -0
- package/dist/src/react-native-sse/EventSource.d.ts.map +1 -0
- package/dist/src/react-native-sse/EventSource.js +264 -0
- package/dist/src/react-native-sse/EventSource.js.map +1 -0
- package/dist/src/react-native-sse/index.d.ts +3 -0
- package/dist/src/react-native-sse/index.d.ts.map +1 -0
- package/dist/src/react-native-sse/index.js +3 -0
- package/dist/src/react-native-sse/index.js.map +1 -0
- package/dist/src/react-native-sse/types.d.ts +59 -0
- package/dist/src/react-native-sse/types.d.ts.map +1 -0
- package/dist/src/react-native-sse/types.js +2 -0
- package/dist/src/react-native-sse/types.js.map +1 -0
- package/package.json +77 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventSource.d.ts","sourceRoot":"","sources":["../../../src/react-native-sse/EventSource.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAgBpG,MAAM,CAAC,OAAO,OAAO,WAAW,CAAC,CAAC,SAAS,MAAM,GAAG,KAAK;IACvD,KAAK,SAAM;IACX,UAAU,SAAK;IACf,IAAI,SAAK;IACT,MAAM,SAAK;IAEX,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,kBAAkB,CAAK;IAC/B,OAAO,CAAC,SAAS,CAA2B;IAC5C,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,aAAa,CAKnB;IAEF,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,uBAAuB,CAAS;IACxC,OAAO,CAAC,eAAe,CAAU;IACjC,OAAO,CAAC,OAAO,CAAsB;IACrC,OAAO,CAAC,IAAI,CAAM;IAClB,OAAO,CAAC,KAAK,CAAU;IACvB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,GAAG,CAAwC;IACnD,OAAO,CAAC,SAAS,CAAM;IACvB,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,mBAAmB,CAAC,CAAwB;gBAExC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB;IAoBrD,OAAO,CAAC,SAAS;IAUjB,IAAI;IA6HJ,OAAO,CAAC,QAAQ;IAOhB,OAAO,CAAC,WAAW;IA+CnB,gBAAgB,CAAC,CAAC,SAAS,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI;IAQ5F,mBAAmB,CAAC,CAAC,SAAS,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI;IAQ/F,uBAAuB,CAAC,CAAC,SAAS,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC;IAgBxD,QAAQ,CAAC,CAAC,SAAS,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAqBnE,KAAK;IAUL,MAAM;IACN,OAAO;IACP,OAAO,CAAC,IAAI,EAAE,GAAG;IACjB,UAAU,CAAC,EAAE,EAAE,GAAG;CACnB"}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
const XMLReadyStateMap = ['UNSENT', 'OPENED', 'HEADERS_RECEIVED', 'LOADING', 'DONE'];
|
|
2
|
+
const defaultOptions = {
|
|
3
|
+
body: undefined,
|
|
4
|
+
debug: false,
|
|
5
|
+
headers: {},
|
|
6
|
+
method: 'GET',
|
|
7
|
+
pollingInterval: 5000,
|
|
8
|
+
timeout: 0,
|
|
9
|
+
timeoutBeforeConnection: 0,
|
|
10
|
+
withCredentials: false,
|
|
11
|
+
retryAndHandleError: undefined,
|
|
12
|
+
};
|
|
13
|
+
export default class EventSource {
|
|
14
|
+
constructor(url, options) {
|
|
15
|
+
this.ERROR = -1;
|
|
16
|
+
this.CONNECTING = 0;
|
|
17
|
+
this.OPEN = 1;
|
|
18
|
+
this.CLOSED = 2;
|
|
19
|
+
this.lastIndexProcessed = 0;
|
|
20
|
+
this.status = this.CONNECTING;
|
|
21
|
+
this.eventHandlers = {
|
|
22
|
+
open: [],
|
|
23
|
+
message: [],
|
|
24
|
+
error: [],
|
|
25
|
+
close: [],
|
|
26
|
+
};
|
|
27
|
+
this.xhr = new XMLHttpRequest();
|
|
28
|
+
const opts = Object.assign(Object.assign({}, defaultOptions), options);
|
|
29
|
+
this.url = url;
|
|
30
|
+
this.method = opts.method;
|
|
31
|
+
this.timeout = opts.timeout;
|
|
32
|
+
this.timeoutBeforeConnection = opts.timeoutBeforeConnection;
|
|
33
|
+
this.withCredentials = opts.withCredentials;
|
|
34
|
+
this.headers = opts.headers;
|
|
35
|
+
this.body = opts.body;
|
|
36
|
+
this.debug = opts.debug;
|
|
37
|
+
this.pollingInterval = opts.pollingInterval;
|
|
38
|
+
this.retryAndHandleError = opts.retryAndHandleError;
|
|
39
|
+
this.pollAgain(this.timeoutBeforeConnection, true);
|
|
40
|
+
}
|
|
41
|
+
pollAgain(time, allowZero) {
|
|
42
|
+
if (time > 0 || allowZero) {
|
|
43
|
+
this.logDebug(`[EventSource] Will open new connection in ${time} ms.`);
|
|
44
|
+
this.dispatch('retry', { type: 'retry' });
|
|
45
|
+
this.pollTimer = setTimeout(() => {
|
|
46
|
+
this.open();
|
|
47
|
+
}, time);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
open() {
|
|
51
|
+
try {
|
|
52
|
+
this.lastIndexProcessed = 0;
|
|
53
|
+
this.status = this.CONNECTING;
|
|
54
|
+
this.xhr.open(this.method, this.url, true);
|
|
55
|
+
if (this.withCredentials) {
|
|
56
|
+
this.xhr.withCredentials = true;
|
|
57
|
+
}
|
|
58
|
+
this.xhr.setRequestHeader('Accept', 'text/event-stream');
|
|
59
|
+
this.xhr.setRequestHeader('Cache-Control', 'no-cache');
|
|
60
|
+
this.xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
|
61
|
+
if (this.headers) {
|
|
62
|
+
Object.entries(this.headers).forEach(([key, value]) => {
|
|
63
|
+
this.xhr.setRequestHeader(key, value);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
if (typeof this.lastEventId !== 'undefined') {
|
|
67
|
+
this.xhr.setRequestHeader('Last-Event-ID', this.lastEventId);
|
|
68
|
+
}
|
|
69
|
+
this.xhr.timeout = this.timeout;
|
|
70
|
+
this.xhr.onreadystatechange = () => {
|
|
71
|
+
if (this.status === this.CLOSED) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
this.logDebug(`[EventSource][onreadystatechange] ReadyState: ${XMLReadyStateMap[this.xhr.readyState] || 'Unknown'}(${this.xhr.readyState}), status: ${this.xhr.status}`);
|
|
75
|
+
if (this.xhr.readyState !== XMLHttpRequest.DONE &&
|
|
76
|
+
this.xhr.readyState !== XMLHttpRequest.LOADING) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (this.xhr.status >= 200 && this.xhr.status < 400) {
|
|
80
|
+
if (this.status === this.CONNECTING) {
|
|
81
|
+
this.status = this.OPEN;
|
|
82
|
+
this.dispatch('open', { type: 'open' });
|
|
83
|
+
this.logDebug('[EventSource][onreadystatechange][OPEN] Connection opened.');
|
|
84
|
+
}
|
|
85
|
+
this.handleEvent(this.xhr.responseText || '');
|
|
86
|
+
if (this.xhr.readyState === XMLHttpRequest.DONE) {
|
|
87
|
+
this.logDebug('[EventSource][onreadystatechange][DONE] Operation done.');
|
|
88
|
+
this.pollAgain(this.pollingInterval, false);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
else if (this.xhr.status !== 0) {
|
|
92
|
+
this.status = this.ERROR;
|
|
93
|
+
this.dispatch('error', {
|
|
94
|
+
type: 'error',
|
|
95
|
+
message: this.xhr.responseText,
|
|
96
|
+
xhrStatus: this.xhr.status,
|
|
97
|
+
xhrState: this.xhr.readyState,
|
|
98
|
+
});
|
|
99
|
+
if (this.xhr.readyState === XMLHttpRequest.DONE) {
|
|
100
|
+
this.logDebug('[EventSource][onreadystatechange][ERROR] Response status error.');
|
|
101
|
+
if (!this.retryAndHandleError) {
|
|
102
|
+
// default implementation
|
|
103
|
+
this.pollAgain(this.pollingInterval, false);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
// custom retry logic
|
|
107
|
+
const shouldRetry = this.retryAndHandleError({
|
|
108
|
+
status: this.xhr.status,
|
|
109
|
+
message: this.xhr.responseText,
|
|
110
|
+
});
|
|
111
|
+
if (shouldRetry) {
|
|
112
|
+
this.pollAgain(this.pollingInterval, true);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
this.xhr.onerror = () => {
|
|
119
|
+
if (this.status === this.CLOSED) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
this.status = this.ERROR;
|
|
123
|
+
this.dispatch('error', {
|
|
124
|
+
type: 'error',
|
|
125
|
+
message: this.xhr.responseText,
|
|
126
|
+
xhrStatus: this.xhr.status,
|
|
127
|
+
xhrState: this.xhr.readyState,
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
if (this.body) {
|
|
131
|
+
this.xhr.send(this.body);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
this.xhr.send();
|
|
135
|
+
}
|
|
136
|
+
if (this.timeout > 0) {
|
|
137
|
+
setTimeout(() => {
|
|
138
|
+
if (this.xhr.readyState === XMLHttpRequest.LOADING) {
|
|
139
|
+
this.dispatch('error', { type: 'timeout' });
|
|
140
|
+
this.close();
|
|
141
|
+
}
|
|
142
|
+
}, this.timeout);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
catch (e) {
|
|
146
|
+
this.status = this.ERROR;
|
|
147
|
+
this.dispatch('error', {
|
|
148
|
+
type: 'exception',
|
|
149
|
+
message: e.message,
|
|
150
|
+
error: e,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
logDebug(...msg) {
|
|
155
|
+
if (this.debug) {
|
|
156
|
+
// eslint-disable-next-line no-console
|
|
157
|
+
console.debug(...msg);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
handleEvent(response) {
|
|
161
|
+
const parts = response.slice(this.lastIndexProcessed).split('\n');
|
|
162
|
+
const indexOfDoubleNewline = response.lastIndexOf('\n\n');
|
|
163
|
+
if (indexOfDoubleNewline !== -1) {
|
|
164
|
+
this.lastIndexProcessed = indexOfDoubleNewline + 2;
|
|
165
|
+
}
|
|
166
|
+
let data = [];
|
|
167
|
+
let retry = 0;
|
|
168
|
+
let line = '';
|
|
169
|
+
// eslint-disable-next-line no-plusplus
|
|
170
|
+
for (let i = 0; i < parts.length; i++) {
|
|
171
|
+
line = parts[i].replace(/^(\s|\u00A0)+|(\s|\u00A0)+$/g, '');
|
|
172
|
+
if (line.indexOf('event') === 0) {
|
|
173
|
+
this.eventType = line.replace(/event:?\s*/, '');
|
|
174
|
+
}
|
|
175
|
+
else if (line.indexOf('retry') === 0) {
|
|
176
|
+
retry = parseInt(line.replace(/retry:?\s*/, ''), 10);
|
|
177
|
+
if (!Number.isNaN(retry)) {
|
|
178
|
+
this.pollingInterval = retry;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
else if (line.indexOf('data') === 0) {
|
|
182
|
+
data.push(line.replace(/data:?\s*/, ''));
|
|
183
|
+
}
|
|
184
|
+
else if (line.indexOf('id:') === 0) {
|
|
185
|
+
this.lastEventId = line.replace(/id:?\s*/, '');
|
|
186
|
+
}
|
|
187
|
+
else if (line.indexOf('id') === 0) {
|
|
188
|
+
this.lastEventId = undefined;
|
|
189
|
+
}
|
|
190
|
+
else if (line === '') {
|
|
191
|
+
if (data.length > 0) {
|
|
192
|
+
const eventType = this.eventType || 'message';
|
|
193
|
+
const event = {
|
|
194
|
+
type: eventType,
|
|
195
|
+
data: data.join('\n'),
|
|
196
|
+
url: this.url,
|
|
197
|
+
lastEventId: this.lastEventId,
|
|
198
|
+
};
|
|
199
|
+
this.dispatch(eventType, event);
|
|
200
|
+
data = [];
|
|
201
|
+
this.eventType = undefined;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
addEventListener(type, listener) {
|
|
207
|
+
if (this.eventHandlers[type] === undefined) {
|
|
208
|
+
this.eventHandlers[type] = [];
|
|
209
|
+
}
|
|
210
|
+
this.eventHandlers[type].push(listener);
|
|
211
|
+
}
|
|
212
|
+
removeEventListener(type, listener) {
|
|
213
|
+
if (this.eventHandlers[type] !== undefined) {
|
|
214
|
+
this.eventHandlers[type] = this.eventHandlers[type].filter((handler) => handler !== listener);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
removeAllEventListeners(type) {
|
|
218
|
+
const availableTypes = Object.keys(this.eventHandlers);
|
|
219
|
+
if (type === undefined) {
|
|
220
|
+
availableTypes.forEach((eventType) => {
|
|
221
|
+
this.eventHandlers[eventType] = [];
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
if (!availableTypes.includes(type)) {
|
|
226
|
+
throw Error(`[EventSource] '${type}' type is not supported event type.`);
|
|
227
|
+
}
|
|
228
|
+
this.eventHandlers[type] = [];
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
dispatch(type, data) {
|
|
232
|
+
var _a;
|
|
233
|
+
(_a = this.eventHandlers[type]) === null || _a === void 0 ? void 0 : _a.forEach((handler) => handler(data));
|
|
234
|
+
switch (type) {
|
|
235
|
+
case 'open':
|
|
236
|
+
this.onopen();
|
|
237
|
+
break;
|
|
238
|
+
case 'close':
|
|
239
|
+
this.onclose();
|
|
240
|
+
break;
|
|
241
|
+
case 'error':
|
|
242
|
+
this.onerror(data);
|
|
243
|
+
break;
|
|
244
|
+
case 'retry':
|
|
245
|
+
this.onretrying({ delayMillis: this.pollingInterval });
|
|
246
|
+
break;
|
|
247
|
+
default:
|
|
248
|
+
break;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
close() {
|
|
252
|
+
this.status = this.CLOSED;
|
|
253
|
+
clearTimeout(this.pollTimer);
|
|
254
|
+
if (this.xhr) {
|
|
255
|
+
this.xhr.abort();
|
|
256
|
+
}
|
|
257
|
+
this.dispatch('close', { type: 'close' });
|
|
258
|
+
}
|
|
259
|
+
onopen() { }
|
|
260
|
+
onclose() { }
|
|
261
|
+
onerror(_err) { }
|
|
262
|
+
onretrying(_e) { }
|
|
263
|
+
}
|
|
264
|
+
//# sourceMappingURL=EventSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventSource.js","sourceRoot":"","sources":["../../../src/react-native-sse/EventSource.ts"],"names":[],"mappings":"AAUA,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;AAErF,MAAM,cAAc,GAAuB;IACzC,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,KAAK;IACZ,OAAO,EAAE,EAAE;IACX,MAAM,EAAE,KAAK;IACb,eAAe,EAAE,IAAI;IACrB,OAAO,EAAE,CAAC;IACV,uBAAuB,EAAE,CAAC;IAC1B,eAAe,EAAE,KAAK;IACtB,mBAAmB,EAAE,SAAS;CAC/B,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,WAAW;IA8B9B,YAAY,GAAW,EAAE,OAA4B;QA7BrD,UAAK,GAAG,CAAC,CAAC,CAAC;QACX,eAAU,GAAG,CAAC,CAAC;QACf,SAAI,GAAG,CAAC,CAAC;QACT,WAAM,GAAG,CAAC,CAAC;QAGH,uBAAkB,GAAG,CAAC,CAAC;QAEvB,WAAM,GAAG,IAAI,CAAC,UAAU,CAAC;QACzB,kBAAa,GAAQ;YAC3B,IAAI,EAAE,EAAE;YACR,OAAO,EAAE,EAAE;YACX,KAAK,EAAE,EAAE;YACT,KAAK,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,eAAe,CAAC;AAExC,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react-native-sse/index.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export type BuiltInEventType = 'open' | 'message' | 'error' | 'close' | 'retry';
|
|
2
|
+
export type EventType<E extends string = never> = E | BuiltInEventType;
|
|
3
|
+
export interface MessageEvent {
|
|
4
|
+
type: 'message';
|
|
5
|
+
data: string | null;
|
|
6
|
+
lastEventId: string | undefined;
|
|
7
|
+
url: string;
|
|
8
|
+
}
|
|
9
|
+
export interface OpenEvent {
|
|
10
|
+
type: 'open';
|
|
11
|
+
}
|
|
12
|
+
export interface CloseEvent {
|
|
13
|
+
type: 'close';
|
|
14
|
+
}
|
|
15
|
+
export interface RetryEvent {
|
|
16
|
+
type: 'retry';
|
|
17
|
+
}
|
|
18
|
+
export interface TimeoutEvent {
|
|
19
|
+
type: 'timeout';
|
|
20
|
+
}
|
|
21
|
+
export interface ErrorEvent {
|
|
22
|
+
type: 'error';
|
|
23
|
+
message: string;
|
|
24
|
+
xhrState: number;
|
|
25
|
+
xhrStatus: number;
|
|
26
|
+
}
|
|
27
|
+
export interface CustomEvent<E extends string> {
|
|
28
|
+
type: E;
|
|
29
|
+
data: string | null;
|
|
30
|
+
lastEventId: string | null;
|
|
31
|
+
url: string;
|
|
32
|
+
}
|
|
33
|
+
export interface ExceptionEvent {
|
|
34
|
+
type: 'exception';
|
|
35
|
+
message: string;
|
|
36
|
+
error: Error;
|
|
37
|
+
}
|
|
38
|
+
export interface EventSourceOptions {
|
|
39
|
+
method?: string;
|
|
40
|
+
timeout?: number;
|
|
41
|
+
timeoutBeforeConnection?: number;
|
|
42
|
+
withCredentials?: boolean;
|
|
43
|
+
headers?: Record<string, any>;
|
|
44
|
+
body?: any;
|
|
45
|
+
debug?: boolean;
|
|
46
|
+
pollingInterval?: number;
|
|
47
|
+
retryAndHandleError?: (err: any) => boolean;
|
|
48
|
+
}
|
|
49
|
+
type BuiltInEventMap = {
|
|
50
|
+
message: MessageEvent;
|
|
51
|
+
open: OpenEvent;
|
|
52
|
+
close: CloseEvent;
|
|
53
|
+
error: ErrorEvent | TimeoutEvent | ExceptionEvent;
|
|
54
|
+
retry: RetryEvent;
|
|
55
|
+
};
|
|
56
|
+
export type EventSourceEvent<E extends T, T extends string = any> = E extends BuiltInEventType ? BuiltInEventMap[E] : CustomEvent<E>;
|
|
57
|
+
export type EventSourceListener<E extends string = never, T extends EventType<E> = EventType<E>> = (event: EventSourceEvent<T>) => void;
|
|
58
|
+
export {};
|
|
59
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/react-native-sse/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAChF,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,GAAG,KAAK,IAAI,CAAC,GAAG,gBAAgB,CAAC;AAEvE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB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,CAAC,CAAC,CAAC;AAEnB,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,MAAM,GAAG,KAAK,EAAE,CAAC,SAAS,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,CACjG,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,KACvB,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/react-native-sse/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@launchdarkly/react-native-client-sdk",
|
|
3
|
+
"version": "0.1.0-alpha",
|
|
4
|
+
"description": "React Native LaunchDarkly SDK",
|
|
5
|
+
"homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/sdk/react-native",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/launchdarkly/js-core.git"
|
|
9
|
+
},
|
|
10
|
+
"license": "Apache-2.0",
|
|
11
|
+
"packageManager": "yarn@3.4.1",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"launchdarkly",
|
|
14
|
+
"react-native"
|
|
15
|
+
],
|
|
16
|
+
"type": "commonjs",
|
|
17
|
+
"main": "./dist/src/index.js",
|
|
18
|
+
"types": "./dist/src/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/src/index.d.ts",
|
|
22
|
+
"default": "./dist/src/index.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"clean": "rimraf dist",
|
|
30
|
+
"build": "npx tsc && yarn link-dev",
|
|
31
|
+
"tsw": "yarn tsc --watch",
|
|
32
|
+
"start": "rimraf dist && yarn tsw",
|
|
33
|
+
"lint": "eslint . --ext .ts",
|
|
34
|
+
"prettier": "prettier --write '**/*.@(js|ts|tsx|json|css)' --ignore-path ../../../.prettierignore",
|
|
35
|
+
"test": "NODE_OPTIONS=\"--experimental-vm-modules --no-warnings\" jest --ci --runInBand",
|
|
36
|
+
"coverage": "yarn test --coverage",
|
|
37
|
+
"check": "yarn prettier && yarn lint && yarn build && yarn test",
|
|
38
|
+
"link-dev": "./link-dev.sh",
|
|
39
|
+
"android": "yarn && yarn ./example && yarn build && (cd example/ && yarn android-release)",
|
|
40
|
+
"ios": "yarn && yarn ./example && yarn build && (cd example/ && yarn ios-go)"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"react": "*",
|
|
44
|
+
"react-native": "*"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@launchdarkly/js-client-sdk-common": "0.1.0-alpha",
|
|
48
|
+
"@react-native-async-storage/async-storage": "^1.21.0",
|
|
49
|
+
"base64-js": "^1.5.1",
|
|
50
|
+
"event-target-shim": "^6.0.2"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
|
|
54
|
+
"@types/jest": "^29.5.0",
|
|
55
|
+
"@types/react": "^18.2.31",
|
|
56
|
+
"@typescript-eslint/eslint-plugin": "^6.1.0",
|
|
57
|
+
"@typescript-eslint/parser": "^6.1.0",
|
|
58
|
+
"eslint": "^8.45.0",
|
|
59
|
+
"eslint-config-airbnb-base": "^15.0.0",
|
|
60
|
+
"eslint-config-airbnb-typescript": "^17.1.0",
|
|
61
|
+
"eslint-config-prettier": "^8.8.0",
|
|
62
|
+
"eslint-plugin-import": "^2.27.5",
|
|
63
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
64
|
+
"jest": "^29.5.0",
|
|
65
|
+
"launchdarkly-js-test-helpers": "^2.2.0",
|
|
66
|
+
"prettier": "^3.0.0",
|
|
67
|
+
"react": "^18.2.0",
|
|
68
|
+
"react-native": "^0.73.1",
|
|
69
|
+
"rimraf": "^5.0.5",
|
|
70
|
+
"ts-jest": "^29.1.0",
|
|
71
|
+
"typedoc": "0.25.0",
|
|
72
|
+
"typescript": "5.1.6"
|
|
73
|
+
},
|
|
74
|
+
"installConfig": {
|
|
75
|
+
"hoistingLimits": "workspaces"
|
|
76
|
+
}
|
|
77
|
+
}
|