@conterra/ct-mapapps-typings 4.13.2-next.20220701040636 → 4.13.2-next.20220704040728

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.
@@ -6,7 +6,7 @@ export default class AGOLAuthenticationPlugin {
6
6
  _roleMapping: any;
7
7
  _organizationId: any;
8
8
  _fetchSelf: any;
9
- _oauth: any;
9
+ _oauth: boolean | undefined;
10
10
  /**
11
11
  * @returns {Authentication} authentication instance
12
12
  */
@@ -10,7 +10,7 @@ export interface LayerStoreMetadata extends Metadata {
10
10
  /** Whether the store supports pagination or not. */
11
11
  readonly supportsPagination: boolean;
12
12
  /** Maximum number of features that can be requested from the server. */
13
- readonly maxRecordCount: number;
13
+ readonly maxRecordCount: number | undefined;
14
14
  }
15
15
  declare type FeatureLayerProps = "type" | "destroy" | "load" | "loaded" | "url" | "layerId" | "capabilities" | "sourceJSON" | "objectIdField" | "title" | "displayField" | "geometryType" | "fullExtent" | "popupTemplate" | "fields" | "createQuery" | "queryObjectIds" | "queryFeatures" | "queryFeatureCount" | "definitionExpression";
16
16
  export declare type SimpleFeatureLayer = Pick<FeatureLayer, FeatureLayerProps>;
@@ -1,4 +1,8 @@
1
- import { RegisterFunction } from "./config";
1
+ import { RegisterOptions, ValueOrProvider } from "./config";
2
2
  import "dojo/_base/sniff";
3
+ interface RegisterFunction<T> {
4
+ (key: keyof T, valueOrProvider: ValueOrProvider<T>, options?: RegisterOptions): void;
5
+ }
3
6
  export declare function registerDojoConfigKey<T>(registerFn: RegisterFunction<T>, name: keyof T, path: string, dconfig?: any): void;
4
7
  export declare function registerHasKey<T>(registerFn: RegisterFunction<T>, name: keyof T): void;
8
+ export {};
@@ -138,7 +138,7 @@ export interface WellknownConfigKeys {
138
138
  * Url to a callback page which consumes the access token.
139
139
  * Only of interest if oauth-use-popup is true.
140
140
  */
141
- "oauth-callback-page": string;
141
+ "oauth-popup-callback-page": string;
142
142
  /**
143
143
  * Flag to enforce a login,
144
144
  * Experimental, ignore that.
@@ -180,6 +180,9 @@ export interface WellknownConfigKeys {
180
180
  }
181
181
  /** Valid configuration property names. */
182
182
  export declare type ConfigKey = keyof WellknownConfigKeys;
183
+ /**
184
+ * Lists well known environment property names and their types.
185
+ */
183
186
  export interface WellknownEnvKeys {
184
187
  /**
185
188
  * True if content security policy settings prevent eval() etc.
@@ -214,7 +217,7 @@ export interface WellknownEnvKeys {
214
217
  */
215
218
  "android": number;
216
219
  }
217
- /** Valid configuration property names. */
220
+ /** Valid environment property names. */
218
221
  export declare type EnvKey = keyof WellknownEnvKeys;
219
222
  /** Supported value types. */
220
223
  export declare type SupportedValueTypes = undefined | null | boolean | number | string | SupportedValueTypes[] | {
@@ -222,25 +225,61 @@ export declare type SupportedValueTypes = undefined | null | boolean | number |
222
225
  };
223
226
  declare type ValueCallback<K, R> = (key: K) => R | undefined;
224
227
  declare type ValueOrCallback<K, R> = R | ValueCallback<K, R>;
228
+ /**
229
+ * Type used by the register functions.
230
+ * To distinguish a plain value or a function providing the value.
231
+ */
225
232
  export declare type ValueOrProvider<T, K extends keyof T = keyof T> = ValueOrCallback<K, Extract<T[K], SupportedValueTypes>>;
226
- export declare type RegisterFunction<T, K extends keyof T = keyof T> = (n: K, valueOrProvider: ValueOrProvider<T, K>, cacheProvidedValue?: boolean) => void;
227
- export declare type LookupFunction<T, K extends keyof T = keyof T> = (n: K) => DeepReadonly<T[K]> | undefined;
233
+ /**
234
+ * Options accepted by the register* functions.
235
+ */
236
+ export interface RegisterOptions {
237
+ /**
238
+ * If true and the value is a provider function it is only invoked once,
239
+ * otherwise the function is invoked for every call for key.
240
+ * Default is true.
241
+ */
242
+ cacheProvidedValue?: boolean;
243
+ /**
244
+ * If true and and there is an already existing provider, then the existing provider is replaced.
245
+ * Otherwise an error is thrown.
246
+ */
247
+ overwrite?: boolean;
248
+ }
249
+ /**
250
+ * A value interceptor.
251
+ */
252
+ export interface Interceptor {
253
+ /**
254
+ * The interceptor is informed about any config key access.
255
+ * The lookupValue function can be used to fetch the original configuration value.
256
+ * Or the interceptor may return custom values.
257
+ *
258
+ * @param key config key
259
+ * @param lookupValue a function providing the original config value
260
+ */
261
+ (key: string, lookupValue: () => SupportedValueTypes): SupportedValueTypes | undefined;
262
+ }
263
+ /**
264
+ * This class implements the internal lazy configuration state.
265
+ * It is exported for test purpose only.
266
+ *
267
+ * @internal
268
+ */
228
269
  export declare class LazyValues<SupportedKeys, Key extends keyof SupportedKeys = keyof SupportedKeys> {
229
270
  #private;
271
+ interceptor: Interceptor | undefined;
230
272
  get<K extends Key>(k: K): DeepReadonly<SupportedKeys[K]> | undefined;
231
273
  registeredKeys(): Set<Key>;
232
- register<K extends Key>(key: K, valueProvider: ValueOrProvider<SupportedKeys, K>, cacheProvidedValue?: boolean): void;
274
+ register<K extends Key>(key: K, valueProvider: ValueOrProvider<SupportedKeys, K>, { cacheProvidedValue, overwrite }?: RegisterOptions): void;
275
+ isRegistered(key: Key): boolean;
276
+ unregister(key: Key): boolean;
233
277
  }
234
278
  /**
235
279
  * Returns the configuration value associated with the given key.
236
280
  * Returns undefined if the key is not known.
237
281
  */
238
282
  export declare function configValue<K extends ConfigKey>(k: K): DeepReadonly<WellknownConfigKeys[K]> | undefined;
239
- /**
240
- * Returns the environment value associated with the given key.
241
- * Returns undefined if the key is not known.
242
- */
243
- export declare function envValue<K extends EnvKey>(k: K): DeepReadonly<WellknownEnvKeys[K]> | undefined;
244
283
  /**
245
284
  * Registers a new key with the configuration.
246
285
  * Keys and values must also be declared at the type level by extending the `WellknownConfigKeys` interface.
@@ -249,10 +288,28 @@ export declare function envValue<K extends EnvKey>(k: K): DeepReadonly<Wellknown
249
288
  *
250
289
  * @param key the configuration key
251
290
  * @param value the value or a function returning the value (for lazy evaluation).
252
- * @param cacheProvidedValue if true and the value is a function it is only invoked once,
253
- * otherwise the function is invoked for every call for key.
291
+ * @param options registration flags
292
+ */
293
+ export declare function registerConfigValue<K extends keyof WellknownConfigKeys>(key: K, valueOrProvider: ValueOrProvider<WellknownConfigKeys, K>, options?: RegisterOptions): void;
294
+ /**
295
+ * The intention of this function is to make testing simpler.
296
+ * A test can register a config value and unregister it afterwards.
297
+ * @param key a config key
298
+ * @returns true if conf value was un-registered(previously registered)
299
+ */
300
+ export declare function unregisterConfigValue<K extends keyof WellknownConfigKeys>(key: K): boolean;
301
+ /**
302
+ * The intention of this function is to make testing simpler.
303
+ *
304
+ * Do not forget to unset your interceptor after the tests.
305
+ * @param interceptor a callback informed about any config value access.
254
306
  */
255
- export declare const registerConfigValue: RegisterFunction<WellknownConfigKeys>;
307
+ export declare function setConfigValueInterceptor(interceptor?: Interceptor): void;
308
+ /**
309
+ * Returns the environment value associated with the given key.
310
+ * Returns undefined if the key is not known.
311
+ */
312
+ export declare function envValue<K extends EnvKey>(k: K): DeepReadonly<WellknownEnvKeys[K]> | undefined;
256
313
  /**
257
314
  * Registers a new environment key with the configuration.
258
315
  * Keys and values must also be declared at the type level by extending the `WellknownEnvKeys` interface.
@@ -261,8 +318,21 @@ export declare const registerConfigValue: RegisterFunction<WellknownConfigKeys>;
261
318
  *
262
319
  * @param key the env key
263
320
  * @param value the value or a function returning the value (for lazy evaluation).
264
- * @param cacheProvidedValue if true and the value is a function it is only invoked once,
265
- * otherwise the function is invoked for every call for key.
321
+ * @param options registration flags
322
+ */
323
+ export declare function registerEnvValue<K extends keyof WellknownEnvKeys>(key: K, valueOrProvider: ValueOrProvider<WellknownEnvKeys, K>, options?: RegisterOptions): void;
324
+ /**
325
+ * The intention of this function is to make testing simpler.
326
+ * A test can register a env value and unregister it afterwards.
327
+ * @param key a env key
328
+ * @returns true if env value was un-registered(previously registered)
329
+ */
330
+ export declare function unregisterEnvValue<K extends keyof WellknownEnvKeys>(key: K): boolean;
331
+ /**
332
+ * The intention of this function is to make testing simpler.
333
+ *
334
+ * Do not forget to unset the interceptor after the tests.
335
+ * @param interceptor a callback informed about any env value access.
266
336
  */
267
- export declare const registerEnvValue: RegisterFunction<WellknownEnvKeys>;
337
+ export declare function setEnvValueInterceptor(interceptor?: Interceptor): void;
268
338
  export {};
@@ -4,5 +4,5 @@ export default function _default(identityManager: any, opts: any): {
4
4
  get: () => any;
5
5
  clear: () => void;
6
6
  watchForChanges: () => void;
7
- isWatchingForChanges: () => boolean;
7
+ isWatchingForChanges(): boolean;
8
8
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conterra/ct-mapapps-typings",
3
- "version": "4.13.2-next.20220701040636",
3
+ "version": "4.13.2-next.20220704040728",
4
4
  "description": "TypeDefinitions for ct-mapapps",
5
5
  "author": "conterra",
6
6
  "license": "Apache-2.0"
@@ -17,16 +17,15 @@ export default class CachingStore {
17
17
  getMetadata(object: any): any;
18
18
  getIdentity(object: any): any;
19
19
  _getAllMasterStoreFields(): import("../../apprt/apprt-core/Promise").ExtendedPromise<{}>;
20
- _getItems(itemIds: any, opts: any): any;
21
- _fixCount(opts: any, itemIds: any): any;
20
+ _getItems(itemIds: any, opts: any): Promise<any[]>;
22
21
  _buildQuery(itemIds: any): {};
23
22
  _isGeometryRequired(options: any, defaultRequired: any): Any;
24
23
  _getGeometryFromCache(id: any, offset: any): any;
25
24
  _isSpatialQuery(query: any): boolean;
26
- _getItemsFromCache(query: any, options?: {}): import("../store-api/api/Store").ResultItems<Readonly<Record<string, any>>>;
25
+ _getItemsFromCache(query: any, options?: {}): import("store-api/api/Store").ResultItems<Readonly<Record<string, any>>>;
27
26
  _getGeometryForItems(items: any, options: any): import("../../apprt/apprt-core/Promise").ExtendedPromise<any>;
28
27
  _getItemsForQuery(query: any, options: any): import("../../apprt/apprt-core/Promise").ExtendedPromise<any[]>;
29
- query(query: any, options: any): import("../store-api/api/Store").ResultItems<any>;
28
+ query(query: any, options: any): import("store-api/api/Store").ResultItems<any>;
30
29
  _synchronizedQueryOnCache(query: any, opts: any): any;
31
30
  querySequence: any;
32
31
  _queryOnCache(query: any, opts: any): import("../../apprt/apprt-core/Promise").ExtendedPromise<any>;
@@ -9,6 +9,11 @@ export declare type IndexableThing = Readonly<Record<string, any>>;
9
9
  export interface ResultItems<ItemType extends IndexableThing> extends ReadonlyArray<ItemType> {
10
10
  /** Total number of available items in the result. */
11
11
  readonly total?: number;
12
+ /**
13
+ * Set to true if by the store to indicate that there are more results.
14
+ * The client may query again with an appropriate `start` value.
15
+ */
16
+ readonly hasMore?: boolean;
12
17
  /** Function to cancel the query. It is always 'undefined' in synchronous responses. */
13
18
  readonly cancel?: undefined;
14
19
  /** Function to react on the provided result. It is always 'undefined' in synchronous responses. */