@legendapp/state 3.0.0-alpha.33 → 3.0.0-alpha.35

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.
@@ -1,5 +1,5 @@
1
- import { SyncedGetSetSubscribeBaseParams, SyncedOptions, SyncedSetParams } from '@legendapp/state/sync';
2
- import { SyncedCrudPropsBase, CrudAsOption, SyncedCrudReturnType, SyncedCrudPropsSingle, CrudResult, SyncedCrudPropsMany } from '@legendapp/state/sync-plugins/crud';
1
+ import { SyncedGetSetSubscribeBaseParams, OnErrorRetryParams, SyncedSetParams } from '@legendapp/state/sync';
2
+ import { SyncedCrudPropsBase, SyncedCrudReturnType, CrudAsOption, SyncedCrudPropsSingle, CrudResult, SyncedCrudPropsMany } from '@legendapp/state/sync-plugins/crud';
3
3
 
4
4
  interface KeelObjectBase {
5
5
  id: string;
@@ -39,30 +39,17 @@ interface KeelListParams<Where = {}> {
39
39
  before?: string;
40
40
  }
41
41
  interface KeelRealtimePlugin {
42
- subscribe: (realtimeKey: string, params: SyncedGetSetSubscribeBaseParams) => void;
43
- setLatestChange: (realtimeKey: string, time: Date) => void;
42
+ subscribe: (realtimeKey: string, params: SyncedGetSetSubscribeBaseParams) => () => void;
43
+ setSaved: (realtimeKey: string) => void;
44
44
  }
45
- interface SyncedKeelConfiguration extends Omit<SyncedCrudPropsBase<any>, keyof SyncedOptions | 'create' | 'update' | 'delete' | 'onSaved' | 'updatePartial' | 'fieldCreatedAt' | 'fieldUpdatedAt' | 'generateId'> {
46
- client: {
47
- auth: {
48
- refresh: () => Promise<APIResult<boolean>>;
49
- isAuthenticated: () => Promise<APIResult<boolean>>;
50
- };
51
- api: {
52
- queries: Record<string, (i: any) => Promise<any>>;
53
- };
45
+ interface KeelClient {
46
+ auth: {
47
+ refresh: () => Promise<APIResult<boolean>>;
48
+ isAuthenticated: () => Promise<APIResult<boolean>>;
49
+ };
50
+ api: {
51
+ queries: Record<string, (i: any) => Promise<any>>;
54
52
  };
55
- realtimePlugin?: KeelRealtimePlugin;
56
- as?: Exclude<CrudAsOption, 'value'>;
57
- enabled?: boolean;
58
- onError?: (params: {
59
- type: 'create' | 'update' | 'delete';
60
- params: SyncedSetParams<any>;
61
- input: any;
62
- action: string;
63
- error: APIResult<any>['error'];
64
- }) => void;
65
- refreshAuth?: () => void | Promise<void>;
66
53
  }
67
54
  interface SyncedKeelPropsManyBase<TRemote extends {
68
55
  id: string;
@@ -101,9 +88,17 @@ interface SyncedKeelPropsSingle<TRemote extends {
101
88
  list?: never;
102
89
  as?: never;
103
90
  }
91
+ interface ErrorDetails {
92
+ type: 'create' | 'update' | 'delete';
93
+ params: SyncedSetParams<any>;
94
+ input: any;
95
+ action: string;
96
+ error: APIResult<any>['error'];
97
+ }
104
98
  interface SyncedKeelPropsBase<TRemote extends {
105
99
  id: string;
106
- }, TLocal = TRemote> extends Omit<SyncedCrudPropsBase<TRemote, TLocal>, 'create' | 'update' | 'delete' | 'updatePartial' | 'fieldUpdatedAt' | 'fieldCreatedAt'> {
100
+ }, TLocal = TRemote> extends Omit<SyncedCrudPropsBase<TRemote, TLocal>, 'create' | 'update' | 'delete' | 'updatePartial' | 'fieldUpdatedAt' | 'fieldCreatedAt' | 'onError'> {
101
+ client?: KeelClient;
107
102
  create?: (i: NoInfer<Partial<TRemote>>) => Promise<APIResult<NoInfer<TRemote>>>;
108
103
  update?: (params: {
109
104
  where: any;
@@ -112,9 +107,14 @@ interface SyncedKeelPropsBase<TRemote extends {
112
107
  delete?: (params: {
113
108
  id: string;
114
109
  }) => Promise<APIResult<string>>;
110
+ realtime?: {
111
+ path?: (action: string, inputs: any) => string | Promise<string>;
112
+ plugin?: KeelRealtimePlugin;
113
+ };
114
+ refreshAuth?: () => void | Promise<void>;
115
+ requireAuth?: boolean;
116
+ onError?: (error: Error, retryParams: OnErrorRetryParams, details: ErrorDetails) => void;
115
117
  }
116
- declare function getSyncedKeelConfiguration(): SyncedKeelConfiguration;
117
- declare function configureSyncedKeel(config: SyncedKeelConfiguration): void;
118
118
  declare function syncedKeel<TRemote extends {
119
119
  id: string;
120
120
  }, TLocal = TRemote>(props: SyncedKeelPropsBase<TRemote, TLocal> & SyncedKeelPropsSingle<TRemote, TLocal>): SyncedCrudReturnType<TLocal, 'value'>;
@@ -122,4 +122,4 @@ declare function syncedKeel<TRemote extends {
122
122
  id: string;
123
123
  }, TLocal = TRemote, TOption extends CrudAsOption = 'object', Where extends Record<string, any> = {}>(props: SyncedKeelPropsBase<TRemote, TLocal> & SyncedKeelPropsMany<TRemote, TLocal, TOption, Where>): SyncedCrudReturnType<TLocal, Exclude<TOption, 'value'>>;
124
124
 
125
- export { type KeelGetParams, type KeelKey, KeelKeys, type KeelListParams, type KeelObjectBase, type KeelRealtimePlugin, type OmitKeelBuiltins, type SyncedKeelConfiguration, configureSyncedKeel, generateKeelId, getSyncedKeelConfiguration, syncedKeel };
125
+ export { type KeelClient, type KeelGetParams, type KeelKey, KeelKeys, type KeelListParams, type KeelObjectBase, type KeelRealtimePlugin, type OmitKeelBuiltins, type SyncedKeelPropsBase, generateKeelId, syncedKeel };
@@ -1,5 +1,5 @@
1
- import { SyncedGetSetSubscribeBaseParams, SyncedOptions, SyncedSetParams } from '@legendapp/state/sync';
2
- import { SyncedCrudPropsBase, CrudAsOption, SyncedCrudReturnType, SyncedCrudPropsSingle, CrudResult, SyncedCrudPropsMany } from '@legendapp/state/sync-plugins/crud';
1
+ import { SyncedGetSetSubscribeBaseParams, OnErrorRetryParams, SyncedSetParams } from '@legendapp/state/sync';
2
+ import { SyncedCrudPropsBase, SyncedCrudReturnType, CrudAsOption, SyncedCrudPropsSingle, CrudResult, SyncedCrudPropsMany } from '@legendapp/state/sync-plugins/crud';
3
3
 
4
4
  interface KeelObjectBase {
5
5
  id: string;
@@ -39,30 +39,17 @@ interface KeelListParams<Where = {}> {
39
39
  before?: string;
40
40
  }
41
41
  interface KeelRealtimePlugin {
42
- subscribe: (realtimeKey: string, params: SyncedGetSetSubscribeBaseParams) => void;
43
- setLatestChange: (realtimeKey: string, time: Date) => void;
42
+ subscribe: (realtimeKey: string, params: SyncedGetSetSubscribeBaseParams) => () => void;
43
+ setSaved: (realtimeKey: string) => void;
44
44
  }
45
- interface SyncedKeelConfiguration extends Omit<SyncedCrudPropsBase<any>, keyof SyncedOptions | 'create' | 'update' | 'delete' | 'onSaved' | 'updatePartial' | 'fieldCreatedAt' | 'fieldUpdatedAt' | 'generateId'> {
46
- client: {
47
- auth: {
48
- refresh: () => Promise<APIResult<boolean>>;
49
- isAuthenticated: () => Promise<APIResult<boolean>>;
50
- };
51
- api: {
52
- queries: Record<string, (i: any) => Promise<any>>;
53
- };
45
+ interface KeelClient {
46
+ auth: {
47
+ refresh: () => Promise<APIResult<boolean>>;
48
+ isAuthenticated: () => Promise<APIResult<boolean>>;
49
+ };
50
+ api: {
51
+ queries: Record<string, (i: any) => Promise<any>>;
54
52
  };
55
- realtimePlugin?: KeelRealtimePlugin;
56
- as?: Exclude<CrudAsOption, 'value'>;
57
- enabled?: boolean;
58
- onError?: (params: {
59
- type: 'create' | 'update' | 'delete';
60
- params: SyncedSetParams<any>;
61
- input: any;
62
- action: string;
63
- error: APIResult<any>['error'];
64
- }) => void;
65
- refreshAuth?: () => void | Promise<void>;
66
53
  }
67
54
  interface SyncedKeelPropsManyBase<TRemote extends {
68
55
  id: string;
@@ -101,9 +88,17 @@ interface SyncedKeelPropsSingle<TRemote extends {
101
88
  list?: never;
102
89
  as?: never;
103
90
  }
91
+ interface ErrorDetails {
92
+ type: 'create' | 'update' | 'delete';
93
+ params: SyncedSetParams<any>;
94
+ input: any;
95
+ action: string;
96
+ error: APIResult<any>['error'];
97
+ }
104
98
  interface SyncedKeelPropsBase<TRemote extends {
105
99
  id: string;
106
- }, TLocal = TRemote> extends Omit<SyncedCrudPropsBase<TRemote, TLocal>, 'create' | 'update' | 'delete' | 'updatePartial' | 'fieldUpdatedAt' | 'fieldCreatedAt'> {
100
+ }, TLocal = TRemote> extends Omit<SyncedCrudPropsBase<TRemote, TLocal>, 'create' | 'update' | 'delete' | 'updatePartial' | 'fieldUpdatedAt' | 'fieldCreatedAt' | 'onError'> {
101
+ client?: KeelClient;
107
102
  create?: (i: NoInfer<Partial<TRemote>>) => Promise<APIResult<NoInfer<TRemote>>>;
108
103
  update?: (params: {
109
104
  where: any;
@@ -112,9 +107,14 @@ interface SyncedKeelPropsBase<TRemote extends {
112
107
  delete?: (params: {
113
108
  id: string;
114
109
  }) => Promise<APIResult<string>>;
110
+ realtime?: {
111
+ path?: (action: string, inputs: any) => string | Promise<string>;
112
+ plugin?: KeelRealtimePlugin;
113
+ };
114
+ refreshAuth?: () => void | Promise<void>;
115
+ requireAuth?: boolean;
116
+ onError?: (error: Error, retryParams: OnErrorRetryParams, details: ErrorDetails) => void;
115
117
  }
116
- declare function getSyncedKeelConfiguration(): SyncedKeelConfiguration;
117
- declare function configureSyncedKeel(config: SyncedKeelConfiguration): void;
118
118
  declare function syncedKeel<TRemote extends {
119
119
  id: string;
120
120
  }, TLocal = TRemote>(props: SyncedKeelPropsBase<TRemote, TLocal> & SyncedKeelPropsSingle<TRemote, TLocal>): SyncedCrudReturnType<TLocal, 'value'>;
@@ -122,4 +122,4 @@ declare function syncedKeel<TRemote extends {
122
122
  id: string;
123
123
  }, TLocal = TRemote, TOption extends CrudAsOption = 'object', Where extends Record<string, any> = {}>(props: SyncedKeelPropsBase<TRemote, TLocal> & SyncedKeelPropsMany<TRemote, TLocal, TOption, Where>): SyncedCrudReturnType<TLocal, Exclude<TOption, 'value'>>;
124
124
 
125
- export { type KeelGetParams, type KeelKey, KeelKeys, type KeelListParams, type KeelObjectBase, type KeelRealtimePlugin, type OmitKeelBuiltins, type SyncedKeelConfiguration, configureSyncedKeel, generateKeelId, getSyncedKeelConfiguration, syncedKeel };
125
+ export { type KeelClient, type KeelGetParams, type KeelKey, KeelKeys, type KeelListParams, type KeelObjectBase, type KeelRealtimePlugin, type OmitKeelBuiltins, type SyncedKeelPropsBase, generateKeelId, syncedKeel };
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  var state = require('@legendapp/state');
4
- var sync = require('@legendapp/state/sync');
5
4
  var crud = require('@legendapp/state/sync-plugins/crud');
6
5
  var ksuid = require('ksuid');
7
6
 
@@ -14,24 +13,50 @@ var KeelKeys = ["createdAt", "updatedAt"];
14
13
  function generateKeelId() {
15
14
  return ksuid__default.default.randomSync().string;
16
15
  }
17
- var keelConfig = {};
18
16
  var modifiedClients = /* @__PURE__ */ new WeakSet();
19
- var isEnabled$ = state.observable(true);
20
- async function ensureAuthToken() {
21
- await state.when(isEnabled$.get());
22
- if (keelConfig.refreshAuth) {
23
- await keelConfig.refreshAuth();
17
+ var isAuthed$ = state.observable(false);
18
+ var isAuthing$ = state.observable(false);
19
+ async function ensureAuthToken(props, force) {
20
+ if (!force && isAuthed$.get()) {
21
+ return true;
24
22
  }
25
- let isAuthed = await keelConfig.client.auth.isAuthenticated();
23
+ const { client, refreshAuth } = props;
24
+ let isAuthed = await client.auth.isAuthenticated().then(({ data }) => data);
26
25
  if (!isAuthed) {
27
- isAuthed = await keelConfig.client.auth.refresh();
26
+ if (!force && isAuthing$.get()) {
27
+ return state.when(
28
+ () => !isAuthing$.get(),
29
+ () => isAuthed$.get()
30
+ );
31
+ }
32
+ isAuthing$.set(true);
33
+ if (refreshAuth) {
34
+ await refreshAuth();
35
+ }
36
+ isAuthed = await client.auth.isAuthenticated().then(({ data }) => data);
37
+ if (!isAuthed) {
38
+ isAuthed = await client.auth.refresh().then(({ data }) => data);
39
+ }
40
+ }
41
+ if (isAuthed) {
42
+ state.batch(() => {
43
+ isAuthed$.set(true);
44
+ isAuthing$.set(false);
45
+ });
46
+ } else {
47
+ setTimeout(() => ensureAuthToken(
48
+ props,
49
+ /*force*/
50
+ true
51
+ ), 1e3);
28
52
  }
29
53
  return isAuthed;
30
54
  }
31
- async function handleApiError(error, retry) {
55
+ async function handleApiError(props, error, retry) {
32
56
  if (error.type === "unauthorized" || error.type === "forbidden") {
33
57
  console.warn("Keel token expired, refreshing...");
34
- await ensureAuthToken();
58
+ isAuthed$.set(false);
59
+ await ensureAuthToken(props);
35
60
  }
36
61
  }
37
62
  function convertObjectToCreate(item) {
@@ -51,49 +76,30 @@ function convertObjectToCreate(item) {
51
76
  });
52
77
  return cloned;
53
78
  }
54
- function getSyncedKeelConfiguration() {
55
- return keelConfig;
56
- }
57
- function configureSyncedKeel(config) {
58
- const { enabled, realtimePlugin, client, ...rest } = config;
59
- Object.assign(keelConfig, sync.removeNullUndefined(rest));
60
- if (enabled !== void 0) {
61
- isEnabled$.set(enabled);
62
- }
63
- if (realtimePlugin) {
64
- keelConfig.realtimePlugin = realtimePlugin;
65
- if (client && !modifiedClients.has(client)) {
66
- modifiedClients.add(client);
67
- const queries = client.api.queries;
68
- Object.keys(queries).forEach((key) => {
69
- if (key.startsWith("list")) {
70
- const oldFn = queries[key];
71
- queries[key] = (i) => {
72
- const realtimeKey = [key, ...Object.values(i.where || {})].filter((value) => value && typeof value !== "object").join("/");
73
- const subscribe = (params) => {
74
- if (realtimeKey) {
75
- return realtimePlugin.subscribe(realtimeKey, params);
76
- }
77
- };
78
- return oldFn(i).then((ret) => {
79
- if (subscribe) {
80
- ret.subscribe = subscribe;
81
- ret.subscribeKey = realtimeKey;
82
- }
83
- return ret;
84
- });
79
+ var realtimeState = { current: {} };
80
+ function setupRealtime(props) {
81
+ const { client } = props;
82
+ if (client && !modifiedClients.has(client)) {
83
+ modifiedClients.add(client);
84
+ const queries = client.api.queries;
85
+ Object.keys(queries).forEach((key) => {
86
+ if (key.startsWith("list")) {
87
+ const origFn = queries[key];
88
+ queries[key] = (i) => {
89
+ realtimeState.current = {
90
+ lastAction: key,
91
+ lastParams: i
85
92
  };
86
- }
87
- });
88
- }
93
+ return origFn(i);
94
+ };
95
+ }
96
+ });
89
97
  }
90
98
  }
91
99
  var NumPerPage = 200;
92
- async function getAllPages(listFn, params) {
100
+ async function getAllPages(props, listFn, params) {
93
101
  const allData = [];
94
102
  let pageInfo = void 0;
95
- let subscribe_;
96
- let subscribeKey_;
97
103
  const { first: firstParam } = params;
98
104
  do {
99
105
  const first = firstParam ? Math.min(firstParam - allData.length, NumPerPage) : NumPerPage;
@@ -105,13 +111,9 @@ async function getAllPages(listFn, params) {
105
111
  pageInfo = void 0;
106
112
  const ret = await listFn(paramsWithCursor);
107
113
  if (ret) {
108
- const { data, error, subscribe, subscribeKey } = ret;
109
- if (subscribe) {
110
- subscribe_ = subscribe;
111
- subscribeKey_ = subscribeKey;
112
- }
114
+ const { data, error } = ret;
113
115
  if (error) {
114
- await handleApiError(error);
116
+ await handleApiError(props, error);
115
117
  throw new Error(error.message);
116
118
  } else if (data) {
117
119
  pageInfo = data.pageInfo;
@@ -119,23 +121,25 @@ async function getAllPages(listFn, params) {
119
121
  }
120
122
  }
121
123
  } while (pageInfo == null ? void 0 : pageInfo.hasNextPage);
122
- return { results: allData, subscribe: subscribe_, subscribeKey: subscribeKey_ };
124
+ return allData;
123
125
  }
124
126
  function syncedKeel(props) {
125
- const { realtimePlugin } = keelConfig;
126
- props = { ...keelConfig, ...props };
127
127
  const {
128
128
  get: getParam,
129
129
  list: listParam,
130
130
  create: createParam,
131
131
  update: updateParam,
132
132
  delete: deleteParam,
133
+ subscribe: subscribeParam,
133
134
  first,
134
135
  where: whereParam,
135
136
  waitFor,
136
137
  waitForSet,
137
138
  fieldDeleted,
139
+ realtime,
138
140
  mode,
141
+ onError,
142
+ requireAuth = true,
139
143
  ...rest
140
144
  } = props;
141
145
  const { changesSince } = props;
@@ -144,13 +148,15 @@ function syncedKeel(props) {
144
148
  const subscribeFnKey$ = state.observable("");
145
149
  const fieldCreatedAt = "createdAt";
146
150
  const fieldUpdatedAt = "updatedAt";
147
- const setupSubscribe = (doSubscribe, subscribeKey, lastSync) => {
148
- subscribeFn = doSubscribe;
149
- subscribeFnKey$.set(subscribeKey);
150
- if (realtimePlugin && lastSync) {
151
- realtimePlugin.setLatestChange(subscribeKey, new Date(lastSync));
151
+ const setupSubscribe = realtime ? async (getParams) => {
152
+ const { lastAction, lastParams } = realtimeState.current;
153
+ const { path, plugin } = realtime;
154
+ if (lastAction && path && plugin) {
155
+ const key = await path(lastAction, lastParams);
156
+ subscribeFn = () => realtime.plugin.subscribe(key, getParams);
157
+ subscribeFnKey$.set(key);
152
158
  }
153
- };
159
+ } : void 0;
154
160
  const list = listParam ? async (listParams) => {
155
161
  const { lastSync } = listParams;
156
162
  const queryBySync = !!lastSync && changesSince === "last-sync";
@@ -159,18 +165,21 @@ function syncedKeel(props) {
159
165
  state.isFunction(whereParam) ? whereParam() : whereParam
160
166
  );
161
167
  const params = { where, first };
162
- const { results, subscribe: subscribe2, subscribeKey } = await getAllPages(listParam, params);
163
- if (subscribe2) {
164
- setupSubscribe(() => subscribe2(listParams), subscribeKey, lastSync);
168
+ realtimeState.current = {};
169
+ const promise = getAllPages(props, listParam, params);
170
+ if (realtime) {
171
+ setupSubscribe(listParams);
165
172
  }
166
- return results;
173
+ return promise;
167
174
  } : void 0;
168
175
  const get = getParam ? async (getParams) => {
169
176
  const { refresh } = getParams;
170
- const { data, error, subscribe: subscribe2, subscribeKey } = await getParam({ refresh });
171
- if (subscribe2) {
172
- setupSubscribe(() => subscribe2(getParams), subscribeKey);
177
+ realtimeState.current = {};
178
+ const promise = getParam({ refresh });
179
+ if (realtime) {
180
+ setupSubscribe(getParams);
173
181
  }
182
+ const { data, error } = await promise;
174
183
  if (error) {
175
184
  throw new Error(error.message);
176
185
  } else {
@@ -179,17 +188,16 @@ function syncedKeel(props) {
179
188
  } : void 0;
180
189
  const onSaved = ({ saved }) => {
181
190
  if (saved) {
182
- const updatedAt = saved[fieldUpdatedAt];
183
- if (updatedAt && realtimePlugin) {
191
+ if (realtime == null ? void 0 : realtime.plugin) {
184
192
  const subscribeFnKey = subscribeFnKey$.get();
185
193
  if (subscribeFnKey) {
186
- realtimePlugin.setLatestChange(subscribeFnKey, updatedAt);
194
+ realtime == null ? void 0 : realtime.plugin.setSaved(subscribeFnKey);
187
195
  }
188
196
  }
189
197
  }
190
198
  };
191
199
  const handleSetError = async (error, params, input, fn, from) => {
192
- var _a, _b, _c;
200
+ var _a, _b;
193
201
  const { retryNum, update: update2 } = params;
194
202
  if (from === "create" && ((_a = error.message) == null ? void 0 : _a.includes("for the unique")) && ((_b = error.message) == null ? void 0 : _b.includes("must be unique"))) {
195
203
  if (__DEV__) {
@@ -208,13 +216,19 @@ function syncedKeel(props) {
208
216
  params.cancelRetry = true;
209
217
  }
210
218
  } else if (error.type === "bad_request") {
211
- (_c = keelConfig.onError) == null ? void 0 : _c.call(keelConfig, { error, params, input, type: from, action: fn.name || fn.toString() });
219
+ onError == null ? void 0 : onError(new Error(error.message), params, {
220
+ error,
221
+ params,
222
+ input,
223
+ type: from,
224
+ action: fn.name || fn.toString()
225
+ });
212
226
  if (retryNum > 4) {
213
227
  params.cancelRetry = true;
214
228
  }
215
229
  throw new Error(error.message, { cause: { input } });
216
230
  } else {
217
- await handleApiError(error);
231
+ await handleApiError(props, error);
218
232
  throw new Error(error.message, { cause: { input } });
219
233
  }
220
234
  };
@@ -244,7 +258,10 @@ function syncedKeel(props) {
244
258
  }
245
259
  return data;
246
260
  } : void 0;
247
- const subscribe = (params) => {
261
+ if (realtime) {
262
+ setupRealtime(props);
263
+ }
264
+ const subscribe = subscribeParam || (realtime ? (params) => {
248
265
  let unsubscribe = void 0;
249
266
  state.when(subscribeFnKey$, () => {
250
267
  unsubscribe = subscribeFn(params);
@@ -252,7 +269,7 @@ function syncedKeel(props) {
252
269
  return () => {
253
270
  unsubscribe == null ? void 0 : unsubscribe();
254
271
  };
255
- };
272
+ } : void 0);
256
273
  return crud.syncedCrud({
257
274
  ...rest,
258
275
  as: asType,
@@ -261,8 +278,17 @@ function syncedKeel(props) {
261
278
  create,
262
279
  update,
263
280
  delete: deleteFn,
264
- waitFor: () => isEnabled$.get() && (waitFor ? state.computeSelector(waitFor) : true),
265
- waitForSet: (params) => isEnabled$.get() && (waitForSet ? state.isFunction(waitForSet) ? waitForSet(params) : waitForSet : true),
281
+ waitFor: () => {
282
+ ensureAuthToken(props);
283
+ return [requireAuth ? isAuthed$ : true, waitFor || true];
284
+ },
285
+ waitForSet: (params) => {
286
+ ensureAuthToken(props);
287
+ return [
288
+ requireAuth ? isAuthed$ : true,
289
+ () => waitForSet ? state.isFunction(waitForSet) ? waitForSet(params) : waitForSet : true
290
+ ];
291
+ },
266
292
  onSaved,
267
293
  fieldCreatedAt,
268
294
  fieldUpdatedAt,
@@ -277,7 +303,5 @@ function syncedKeel(props) {
277
303
  }
278
304
 
279
305
  exports.KeelKeys = KeelKeys;
280
- exports.configureSyncedKeel = configureSyncedKeel;
281
306
  exports.generateKeelId = generateKeelId;
282
- exports.getSyncedKeelConfiguration = getSyncedKeelConfiguration;
283
307
  exports.syncedKeel = syncedKeel;