@conterra/ct-mapapps-typings 4.13.0-next.20220121045321 → 4.13.0-next.20220128050323

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.
@@ -0,0 +1,6 @@
1
+ export class TokenRequestInterceptor {
2
+ before(params: any): Promise<void>;
3
+ activate(): void;
4
+ deactivate(): void;
5
+ #private;
6
+ }
@@ -1 +1,2 @@
1
1
  export { default as Activator } from "./Activator";
2
+ export { TokenRequestInterceptor } from "./TokenRequestInterceptor";
@@ -1,35 +1,7 @@
1
- export default request;
1
+ import "dojo/request";
2
+ import { ConfigurableRequestFunction } from "./api";
2
3
  /**
3
4
  * Execute http request.
4
- * @param {string} url
5
- * @param {Record<string,any>} options
6
- * @returns {Promise<any>}
7
5
  */
8
- declare function request(url: string, options: Record<string, any>): Promise<any>;
9
- declare namespace request {
10
- export function registered(): boolean;
11
- export function register(): void;
12
- export { unregister };
13
- export { conf as config };
14
- export const getProxiedUrl: (url: any, opts: any) => any;
15
- }
16
- declare function unregister(): void;
17
- declare const conf: {
18
- buildProvider: () => {
19
- (url: any, options: any): any;
20
- getProxiedUrl(url: any, opts: any): any;
21
- };
22
- set: (name: any, value: any) => void;
23
- get: (name: any) => any;
24
- addProxyRule: (rule: any) => void;
25
- removeProxyRule: (proxyRule: any) => void;
26
- addTrustedServer: (trustedServer: any) => void;
27
- addCorsEnabledServer: (corsServer: any) => void;
28
- removeTrustedServer: (trustedServer: any) => void;
29
- removeCorsEnabledServer: (corsServer: any) => void;
30
- addPreProcessor: (preProcessor: any) => void;
31
- removePreProcessor: (preProcessor: any) => void;
32
- addPostProcessor: (postProcessor: any) => void;
33
- removePostProcessor: (postProcessor: any) => void;
34
- reset: () => void;
35
- };
6
+ export declare const request: ConfigurableRequestFunction;
7
+ export default request;
@@ -0,0 +1,329 @@
1
+ /**
2
+ * Format of a proxy rule config option.
3
+ */
4
+ export interface ProxyRuleDescriptor {
5
+ origin: string;
6
+ proxyUrl?: string | undefined;
7
+ }
8
+ /**
9
+ * Format of a trusted server config option.
10
+ */
11
+ export interface TrustedServerDescriptor {
12
+ origin: string;
13
+ }
14
+ /**
15
+ * Format of a CORS server config option.
16
+ * Cors is enabled by default.
17
+ * @deprecated
18
+ */
19
+ export interface CorsServerDescriptor extends TrustedServerDescriptor {
20
+ withCredentials?: boolean;
21
+ }
22
+ /**
23
+ * Pre/Post-Processor parameters.
24
+ */
25
+ export interface ProcessorParams {
26
+ /**
27
+ * Processors may add flags to the parameters to communicate state changes.
28
+ */
29
+ [additionalKey: string]: any;
30
+ /**
31
+ * Flag which indicates that the url was wrapped into a proxy url.
32
+ */
33
+ proxyAppended?: boolean;
34
+ /**
35
+ * URL to request.
36
+ */
37
+ url: string;
38
+ /**
39
+ * Request options.
40
+ */
41
+ options: ProcessorRequestOptions;
42
+ }
43
+ /**
44
+ * A request pre-processor function.
45
+ */
46
+ export interface PreProcessor {
47
+ /**
48
+ * @param params input parameter, allowed to be changed.
49
+ * @returns If a value is returned and the processor is not async then the value is the response.
50
+ * If a Promise is returned and the processor is async, then the processing will wait until the promise resolves.
51
+ * If the promise resolves not to undefined then this is interpreted as the response.
52
+ * If the result is interpreted as response it will be wrapped in a promise.
53
+ */
54
+ (params: ProcessorParams): Promise<any> | any;
55
+ /**
56
+ * Indicates that this processors behaves async.
57
+ */
58
+ async?: boolean;
59
+ }
60
+ /**
61
+ * A request post-processor function.
62
+ */
63
+ export interface PostProcessor {
64
+ /**
65
+ * @param result the request response manipulated maybe by other processors.
66
+ * @param params the request input parameter.
67
+ * @returns manipulated response. If it is not a promise, it will be wrapped, into one.
68
+ */
69
+ (result: Promise<any>, params: ProcessorParams): Promise<any> | any;
70
+ }
71
+ /**
72
+ * All config options.
73
+ */
74
+ export interface ConfigProperties {
75
+ /**
76
+ * Maximal length of a url before a GET request is switched to POST.
77
+ */
78
+ maxUrlLength: number;
79
+ /**
80
+ * Request timeout in msec.
81
+ */
82
+ timeout: number;
83
+ /**
84
+ * Default proxy url.
85
+ */
86
+ proxyUrl: string;
87
+ /**
88
+ * Proxy use rules.
89
+ */
90
+ proxyRules: ProxyRuleDescriptor[];
91
+ /**
92
+ * Globally disable the proxy support.
93
+ */
94
+ disableProxySupport: boolean;
95
+ /**
96
+ * Trusted servers, for which 'withCredentials' will be enabled.
97
+ */
98
+ trustedServers: TrustedServerDescriptor[];
99
+ /**
100
+ * Custom pre-processors.
101
+ */
102
+ customPreProcessors: PreProcessor[];
103
+ /**
104
+ * Custom post-processors.
105
+ */
106
+ customPostProcessors: PostProcessor[];
107
+ /**
108
+ * Flag to enable/disable to return dojo deferred instead of a Promise.
109
+ */
110
+ returnDojoDeferred: boolean;
111
+ }
112
+ /**
113
+ * Config property key.
114
+ */
115
+ export declare type ConfigPropertyKey = keyof ConfigProperties;
116
+ export interface ExtendedDojoProvider extends RequestFunction {
117
+ getProxiedUrl(url: string, opts?: {
118
+ force?: boolean;
119
+ }): string;
120
+ }
121
+ /**
122
+ * Configuration interface.
123
+ */
124
+ export interface Config {
125
+ /**
126
+ * Only for internal usage.
127
+ */
128
+ buildProvider(): ExtendedDojoProvider;
129
+ /**
130
+ * Set a config option.
131
+ * @param name name of the option.
132
+ * @param value value of the option.
133
+ */
134
+ set<Name extends ConfigPropertyKey>(name: Name, value: ConfigProperties[Name]): void;
135
+ set(name: string, value: unknown): void;
136
+ /**
137
+ * Get a config option.
138
+ * @param name name of the option.
139
+ */
140
+ get<Name extends ConfigPropertyKey>(name: Name): ConfigProperties[Name];
141
+ get(name: string): unknown;
142
+ /**
143
+ * Register a proxy rule. If the rule matches, the request will be routed over a proxy.
144
+ * @param rule a proxy rule.
145
+ */
146
+ addProxyRule(rule: ProxyRuleDescriptor): void;
147
+ /**
148
+ * Removes a proxy rule.
149
+ * @param rule the rule to remove.
150
+ */
151
+ removeProxyRule(rule: ProxyRuleDescriptor): void;
152
+ /**
153
+ * Register a trusted server, for which 'withCredentials' will be activated.
154
+ * @param server a trusted server.
155
+ */
156
+ addTrustedServer(server: TrustedServerDescriptor): void;
157
+ /**
158
+ * Removes a trusted servers.
159
+ * @param server a trusted server.
160
+ */
161
+ removeTrustedServer(server: TrustedServerDescriptor): void;
162
+ /** @deprecated */
163
+ addCorsEnabledServer(server: CorsServerDescriptor): void;
164
+ /** @deprecated */
165
+ removeCorsEnabledServer(server: CorsServerDescriptor): void;
166
+ /**
167
+ * Register a pre-processor
168
+ * @param processor a pre-processor
169
+ */
170
+ addPreProcessor(processor: PreProcessor): void;
171
+ /**
172
+ * Unregister a pre-processor
173
+ * @param processor a pre-processor
174
+ */
175
+ removePreProcessor(processor: PreProcessor): void;
176
+ /**
177
+ * Register a post-processor
178
+ * @param processor a post-processor
179
+ */
180
+ addPostProcessor(processor: PostProcessor): void;
181
+ /**
182
+ * Unregister a post-processor
183
+ * @param processor a post-processor
184
+ */
185
+ removePostProcessor(processor: PostProcessor): void;
186
+ /**
187
+ * Reset the configuration to it's defaults.
188
+ * Only intended for tests.
189
+ */
190
+ reset(): void;
191
+ }
192
+ /**
193
+ * Request options
194
+ */
195
+ export interface RequestOptions {
196
+ /**
197
+ * Processors may allow additional properties
198
+ */
199
+ [key: string]: any;
200
+ /**
201
+ * HTTP METHOD
202
+ * If not specified GET is used.
203
+ */
204
+ method?: "GET" | "POST" | "PUT" | "DELETE" | "HEAD";
205
+ /**
206
+ Request timeout in msec.
207
+ */
208
+ timeout?: number;
209
+ /**
210
+ * AbortSignal to cancel the request.
211
+ */
212
+ signal?: AbortSignal;
213
+ /**
214
+ * HTTP Headers.
215
+ */
216
+ headers?: Record<string, any>;
217
+ /**
218
+ * Query Parameter.
219
+ * Note, if data is not defined and method is post this will be converted to the post body.
220
+ */
221
+ query?: Record<string, any>;
222
+ /**
223
+ * Request body (used if POST/PUT)
224
+ */
225
+ data?: Record<string, any> | string;
226
+ /**
227
+ * How to interpret the response. Default is "json".
228
+ */
229
+ handleAs?: "json" | "javascript" | "text" | "xml" | "blob" | "binary";
230
+ /**
231
+ * Option to mark target url as 'cors' trusted.
232
+ * Please prefer to register a trusted servers via config.
233
+ */
234
+ useCors?: {
235
+ withCredentials?: boolean;
236
+ };
237
+ /**
238
+ * Option to mark request to include credentials.
239
+ * Please prefer to register a trusted servers via config.
240
+ * @deprecated
241
+ */
242
+ withCredentials?: boolean;
243
+ /**
244
+ * Allows per request configuration of maximal url length. If it is to long a GET request will be switched to POST.
245
+ * Please prefer the config option 'maxUrlLength'.
246
+ */
247
+ maxUrlLength?: number;
248
+ /**
249
+ * Flag will create random 'salt' to the query parameters to prevent browser caching.
250
+ */
251
+ preventCache?: boolean;
252
+ /**
253
+ * Enables jsonp request processing (response is interpreted as javascript).
254
+ * If true it appends query parameter 'callback=<methodname>'.
255
+ * If it is a string then `<jsonp value>=<methodname>` will be appended.
256
+ * Please use CORS, this will not be supported in future versions.
257
+ * @deprecated
258
+ */
259
+ jsonp?: boolean | string;
260
+ /**
261
+ * Allows 'static' jsonp.
262
+ * If jsonp is true and jsonpfn is configured the the
263
+ * query parameter 'callback=<jsonpfn value>' is appended.
264
+ * The javascript method name is controlled by the caller and not dynamically created.
265
+ * @deprecated
266
+ */
267
+ jsonpfn?: string;
268
+ /**
269
+ * Enables/disables the use of a proxy.
270
+ * True is the default value and a proxy is used if the CORS communication, fails.
271
+ * False prevents the use of a proxy.
272
+ * "force" skips the CORS detection and enforces the use of a proxy.
273
+ * Please prefer the config option 'proxyRules' for that.
274
+ */
275
+ useProxy?: boolean | "force";
276
+ /**
277
+ * Custom pre-processors only valid for the current request.
278
+ * Helpful in tests.
279
+ * Please prefer the config option to register processors for all requests.
280
+ */
281
+ preprocessors?: PreProcessor[];
282
+ /**
283
+ * Custom post-processors only valid for the current request.
284
+ * Helpful in tests.
285
+ * Please prefer the config option to register processors for all requests.
286
+ */
287
+ postprocessors?: PostProcessor[];
288
+ }
289
+ /**
290
+ * Request options available in the processors.
291
+ */
292
+ export declare type ProcessorRequestOptions = RequestOptions;
293
+ /**
294
+ * A function executing a request function.
295
+ */
296
+ export declare type RequestFunction = (url: string, options?: RequestOptions | undefined) => Promise<any>;
297
+ /**
298
+ * The main interface of 'apprt-request'.
299
+ */
300
+ export interface ConfigurableRequestFunction extends RequestFunction {
301
+ /**
302
+ * Provides access to configuration.
303
+ */
304
+ readonly config: Config;
305
+ /**
306
+ * Executes a GET request (sets method=GET in the options)
307
+ */
308
+ readonly get: RequestFunction;
309
+ /**
310
+ * Executes a POST request (sets method=POST in the options)
311
+ */
312
+ readonly post: RequestFunction;
313
+ /**
314
+ * Executes a PUT request (sets method=PUT in the options)
315
+ */
316
+ readonly put: RequestFunction;
317
+ /**
318
+ * Executes a DELETE request (sets method=DELETE in the options)
319
+ */
320
+ readonly del: RequestFunction;
321
+ /**
322
+ * Utility to create a 'proxied' url.
323
+ * By default it returns the input url, if no proxy rule applies.
324
+ * If the flag 'force' is enabled it will wrap the url with the default proxy.
325
+ */
326
+ readonly getProxiedUrl: (url: string, options?: {
327
+ force?: boolean;
328
+ }) => string;
329
+ }
@@ -1,19 +1,2 @@
1
- export default function _default(): {
2
- buildProvider: () => {
3
- (url: any, options: any): any;
4
- getProxiedUrl(url: any, opts: any): any;
5
- };
6
- set: (name: any, value: any) => void;
7
- get: (name: any) => any;
8
- addProxyRule: (rule: any) => void;
9
- removeProxyRule: (proxyRule: any) => void;
10
- addTrustedServer: (trustedServer: any) => void;
11
- addCorsEnabledServer: (corsServer: any) => void;
12
- removeTrustedServer: (trustedServer: any) => void;
13
- removeCorsEnabledServer: (corsServer: any) => void;
14
- addPreProcessor: (preProcessor: any) => void;
15
- removePreProcessor: (preProcessor: any) => void;
16
- addPostProcessor: (postProcessor: any) => void;
17
- removePostProcessor: (postProcessor: any) => void;
18
- reset: () => void;
19
- };
1
+ import type { Config } from "./api";
2
+ export default function createConfig(): Config;
@@ -1,2 +1,2 @@
1
- export function configure(configRoot: any): void;
2
- export function load(id: any, require: any, callback: any): void;
1
+ export declare function configure(configRoot?: any): void;
2
+ export declare function load(this: any, id: string, require: any, callback: (value: any) => void): void;
@@ -1 +1,2 @@
1
- export default function PostProcessorCorsProxyFallback(proxyUrl: any, proxyRules: any): (result: any, params: any) => any;
1
+ import { ProxyRuleDescriptor, PostProcessor } from "../api";
2
+ export default function PostProcessorCorsProxyFallback(proxyUrl: string, proxyRules: ProxyRuleDescriptor[]): PostProcessor;
@@ -1 +1,12 @@
1
- export default function PrePostProcessorEngine(engineConfig: any): (url: any, options: any) => any;
1
+ import { RequestOptions, PreProcessor, PostProcessor } from "../api";
2
+ export interface EngineConfig {
3
+ providerSelector: any;
4
+ preProcessors: PreProcessor[];
5
+ postProcessors: PostProcessor[];
6
+ }
7
+ export declare type RequestEngineOptions = RequestOptions & {
8
+ skipAsyncPreProcessors?: boolean;
9
+ executePostProcessors?: boolean;
10
+ };
11
+ export declare type PrePostProcessorEngine = (url: string, options: RequestEngineOptions) => any;
12
+ export declare function PrePostProcessorEngineFactory(engineConfig: EngineConfig): PrePostProcessorEngine;
@@ -1 +1,2 @@
1
- export default function PreProcessorDefaults(defaults: any): (params: any) => void;
1
+ import { PreProcessor, RequestOptions } from "../api";
2
+ export default function PreProcessorDefaults(defaults: Pick<RequestOptions, "method" | "timeout">): PreProcessor;
@@ -1 +1,2 @@
1
- export default function PreProcessorHandleAs(mappings: any): (params: any) => void;
1
+ import { PreProcessor } from "../api";
2
+ export default function PreProcessorHandleAs(): PreProcessor;
@@ -1 +1,2 @@
1
- export default function PreProcessorMaxUrlLength(postLength: any): (params: any) => void;
1
+ import { PreProcessor } from "../api";
2
+ export default function PreProcessorMaxUrlLength(postLength: number): PreProcessor;
@@ -1 +1,3 @@
1
- export default function PreProcessorProxy(proxyRules: any, defaultProxyUrl: any): (params: any) => void;
1
+ import { PreProcessor } from "../api";
2
+ import { ProxyRule } from "./ProxyRule";
3
+ export default function PreProcessorProxy(proxyRules: ProxyRule[], defaultProxyUrl: string): PreProcessor;
@@ -1 +1,3 @@
1
- export default function PreProcessorSecureProtocolRewrite(proxyUrl: any, origin?: any): (params: any) => void;
1
+ import { Origin } from "./origin";
2
+ import { PreProcessor } from "../api";
3
+ export default function PreProcessorSecureProtocolRewrite(proxyUrl: string, origin?: Origin): PreProcessor;
@@ -1 +1,2 @@
1
- export default function PreProcessorTrusted(trustedServers: any): (params: any) => void;
1
+ import { TrustedServerDescriptor, PreProcessor } from "../api";
2
+ export default function PreProcessorTrusted(trustedServers: TrustedServerDescriptor[]): PreProcessor;
@@ -1,2 +1,3 @@
1
- export default function _default(url: any, options: any): Promise<any>;
2
- import Promise from "apprt-core/CancelablePromise";
1
+ import { CancelablePromise } from "apprt-core/CancelablePromise";
2
+ import { RequestOptions } from "../api";
3
+ export default function providerSelector(url: string, options: RequestOptions): CancelablePromise<any>;
@@ -1,5 +1,10 @@
1
- export default function ProxyRule(options: any): {
2
- match(url: any): boolean;
3
- apply(url: any): any;
4
- };
5
- export function applyProxyUrl(proxyUrl: any, url: any): any;
1
+ export interface ProxyRule {
2
+ match(url: string): boolean;
3
+ apply(url: string): string;
4
+ }
5
+ export declare function ProxyRule(options: {
6
+ origin: string;
7
+ proxyUrl: string;
8
+ }): ProxyRule;
9
+ export default ProxyRule;
10
+ export declare function applyProxyUrl(proxyUrl: string, url: string): string;
@@ -1,2 +1,16 @@
1
- export default master;
2
- declare let master: any;
1
+ export interface OriginUtil {
2
+ readonly $origin: Origin;
3
+ isFileLocation(): boolean;
4
+ isCrossDomainUrl(url: string | Origin): boolean;
5
+ isMatchingOrigin(origin: string | Origin, url: string | Origin): boolean;
6
+ }
7
+ export interface Origin {
8
+ protocol: string;
9
+ hostname: string;
10
+ port: string;
11
+ path: string;
12
+ equals(other: Origin): boolean;
13
+ }
14
+ declare const _default: OriginUtil;
15
+ export default _default;
16
+ export declare function createOriginUtil(originStr: string, injectWildcards?: boolean): OriginUtil;
@@ -1,2 +1,2 @@
1
- export default req;
2
1
  import req from "./_request";
2
+ export default req;
@@ -0,0 +1,9 @@
1
+ import type { TokenService } from "apprt-tokens/api";
2
+ import type { ProcessorParams } from "apprt-request/api";
3
+ export declare class TokenRequestPreProcessor {
4
+ #private;
5
+ set tokenService(srv: TokenService);
6
+ preprocess(params: ProcessorParams): Promise<void> | undefined;
7
+ activate(): void;
8
+ deactivate(): void;
9
+ }
@@ -0,0 +1,21 @@
1
+ import type { Token, TokenService } from "./api";
2
+ import type { UserAdminService } from "system/module";
3
+ interface ConfigProperties {
4
+ secMode: string;
5
+ tokenServiceUrl: string;
6
+ }
7
+ interface TokenState {
8
+ error?: Error | undefined;
9
+ token?: InternalToken;
10
+ }
11
+ interface InternalToken extends Token {
12
+ issuer?: string;
13
+ }
14
+ export declare class TokenServiceImpl implements TokenService {
15
+ #private;
16
+ set userAdmin(value: UserAdminService);
17
+ set _properties(value: ConfigProperties);
18
+ findTokenFor(target: string): Promise<Token | undefined>;
19
+ fetchTokenInfo(target: string): Promise<TokenState>;
20
+ }
21
+ export {};
@@ -0,0 +1,7 @@
1
+ export interface Token {
2
+ readonly value: string;
3
+ readonly expires?: Date;
4
+ }
5
+ export interface TokenService {
6
+ findTokenFor(target: string): Promise<Token | undefined>;
7
+ }
@@ -0,0 +1,2 @@
1
+ export { TokenServiceImpl as TokenService } from "./TokenServiceImpl";
2
+ export { TokenRequestPreProcessor } from "./TokenRequestPreProcessor";
@@ -1,4 +1,3 @@
1
- export { isSupportedWebAssembly as isSupported };
2
1
  export default class ProjectionEngineTransformerStrategy {
3
2
  init(opts: any): Promise<void>;
4
3
  transform: ((geometry: any, sourceSRS: any, targetSRS: any) => Promise<__esri.Geometry | __esri.Geometry[]>) | ((geometry: any, sourceSRS: any, targetSRS: any) => __esri.Geometry | __esri.Geometry[]) | undefined;
@@ -6,4 +5,4 @@ export default class ProjectionEngineTransformerStrategy {
6
5
  _transformAsync(geometry: any, sourceSRS: any, targetSRS: any): Promise<__esri.Geometry | __esri.Geometry[]>;
7
6
  #private;
8
7
  }
9
- declare function isSupportedWebAssembly(): boolean;
8
+ export function isSupported(): boolean;
package/ct/request.d.ts CHANGED
@@ -3,7 +3,9 @@ declare function request(opts: any, flags: any): Promise<any>;
3
3
  declare namespace request {
4
4
  export { request };
5
5
  export function requestJSON(params: any, flags: any): Promise<any>;
6
- export const getProxiedUrl: (url: any, opts: any) => any;
6
+ export const getProxiedUrl: (url: string, options?: {
7
+ force?: boolean | undefined;
8
+ } | undefined) => string;
7
9
  export namespace preprocessors {
8
10
  function add(p: any, first: any): void;
9
11
  function remove(p: any): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conterra/ct-mapapps-typings",
3
- "version": "4.13.0-next.20220121045321",
3
+ "version": "4.13.0-next.20220128050323",
4
4
  "description": "TypeDefinitions for ct-mapapps",
5
5
  "author": "conterra",
6
6
  "license": "Apache-2.0"
@@ -18,7 +18,7 @@ declare function PortalItemService(): {
18
18
  getPortalUrlById(id: any): any;
19
19
  updateItem(portalItem: any, properties: any): any;
20
20
  updateThumbnailItem(portalItemId: any, thumbnailUrl: any): any;
21
- getAppRegistrationInfo(portalItem: any): any;
22
- registerOAuth(portalItemId: any, appName: any): any;
23
- unregisterOAuth(clientId: any): any;
21
+ getAppRegistrationInfo(portalItem: any): Promise<any>;
22
+ registerOAuth(portalItemId: any, appName: any): Promise<any>;
23
+ unregisterOAuth(clientId: any): Promise<any>;
24
24
  };
@@ -150,6 +150,10 @@ export interface SelectedEvent {
150
150
  }
151
151
  /** Describes the item source for a selection event. */
152
152
  export interface ItemSource {
153
+ /**
154
+ * The type of this source. Currently always 'store', but more types (with different properties)
155
+ * may be added later.
156
+ */
153
157
  readonly type: "store";
154
158
  /** Store instance that returned the item. */
155
159
  readonly store: Store<any>;