@isrd-isi-edu/ermrestjs 2.0.0
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/LICENSE +202 -0
- package/README.md +55 -0
- package/dist/ermrest.d.ts +3481 -0
- package/dist/ermrest.js +45 -0
- package/dist/ermrest.js.gz +0 -0
- package/dist/ermrest.js.map +1 -0
- package/dist/ermrest.min.js +45 -0
- package/dist/ermrest.min.js.gz +0 -0
- package/dist/ermrest.min.js.map +1 -0
- package/dist/ermrest.ver.txt +1 -0
- package/dist/stats.html +4949 -0
- package/js/ag_reference.js +1483 -0
- package/js/core.js +4931 -0
- package/js/datapath.js +336 -0
- package/js/export.js +956 -0
- package/js/filters.js +192 -0
- package/js/format.js +344 -0
- package/js/hatrac.js +1130 -0
- package/js/json_ld_validator.js +285 -0
- package/js/parser.js +2320 -0
- package/js/setup/node.js +27 -0
- package/js/utils/helpers.js +2300 -0
- package/js/utils/json_ld_schema.js +680 -0
- package/js/utils/pseudocolumn_helpers.js +2196 -0
- package/package.json +79 -0
- package/src/index.ts +204 -0
- package/src/models/comment.ts +14 -0
- package/src/models/deferred-promise.ts +16 -0
- package/src/models/display-name.ts +5 -0
- package/src/models/errors.ts +408 -0
- package/src/models/path-prefix-alias-mapping.ts +130 -0
- package/src/models/reference/bulk-create-foreign-key-object.ts +133 -0
- package/src/models/reference/citation.ts +98 -0
- package/src/models/reference/contextualize.ts +535 -0
- package/src/models/reference/google-dataset-metadata.ts +72 -0
- package/src/models/reference/index.ts +14 -0
- package/src/models/reference/page.ts +520 -0
- package/src/models/reference/reference-aggregate-fn.ts +37 -0
- package/src/models/reference/reference.ts +2813 -0
- package/src/models/reference/related-reference.ts +467 -0
- package/src/models/reference/tuple.ts +652 -0
- package/src/models/reference-column/asset-pseudo-column.ts +498 -0
- package/src/models/reference-column/column-aggregate.ts +313 -0
- package/src/models/reference-column/facet-column.ts +1380 -0
- package/src/models/reference-column/foreign-key-pseudo-column.ts +626 -0
- package/src/models/reference-column/inbound-foreign-key-pseudo-column.ts +131 -0
- package/src/models/reference-column/index.ts +13 -0
- package/src/models/reference-column/key-pseudo-column.ts +236 -0
- package/src/models/reference-column/pseudo-column.ts +850 -0
- package/src/models/reference-column/reference-column.ts +740 -0
- package/src/models/source-object-node.ts +156 -0
- package/src/models/source-object-wrapper.ts +694 -0
- package/src/models/table-source-definitions.ts +98 -0
- package/src/services/authn.ts +43 -0
- package/src/services/catalog.ts +37 -0
- package/src/services/config.ts +202 -0
- package/src/services/error.ts +247 -0
- package/src/services/handlebars.ts +607 -0
- package/src/services/history.ts +136 -0
- package/src/services/http.ts +536 -0
- package/src/services/logger.ts +70 -0
- package/src/services/mustache.ts +0 -0
- package/src/utils/column-utils.ts +308 -0
- package/src/utils/constants.ts +526 -0
- package/src/utils/markdown-utils.ts +855 -0
- package/src/utils/reference-utils.ts +1658 -0
- package/src/utils/template-utils.ts +0 -0
- package/src/utils/type-utils.ts +89 -0
- package/src/utils/value-utils.ts +127 -0
- package/tsconfig.json +30 -0
- package/vite.config.mts +104 -0
|
@@ -0,0 +1,3481 @@
|
|
|
1
|
+
import { AttributeGroupColumn } from '../js/ag_reference';
|
|
2
|
+
import { AttributeGroupLocation } from '../js/ag_reference';
|
|
3
|
+
import { AttributeGroupReference } from '../js/ag_reference';
|
|
4
|
+
import { AttributeGroupReference as AttributeGroupReference_2 } from '../../../js/ag_reference';
|
|
5
|
+
import { AxiosStatic } from 'axios';
|
|
6
|
+
import { BinaryPredicate } from '../js/filters';
|
|
7
|
+
import { BucketAttributeGroupReference } from '../js/ag_reference';
|
|
8
|
+
import { BucketAttributeGroupReference as BucketAttributeGroupReference_2 } from '../../../js/ag_reference';
|
|
9
|
+
import { Catalog } from '../../../js/core';
|
|
10
|
+
import { Catalog as Catalog_2 } from '../../js/core';
|
|
11
|
+
import { Checksum } from '../js/hatrac';
|
|
12
|
+
import { Column } from '../../../js/core';
|
|
13
|
+
import { Column as Column_2 } from '../../js/core';
|
|
14
|
+
import { createLocation } from '../js/parser';
|
|
15
|
+
import { createPath } from '../js/parser';
|
|
16
|
+
import { createSearchPath } from '../js/parser';
|
|
17
|
+
import { _currDate } from '../js/utils/helpers';
|
|
18
|
+
import { DataPath } from '../js/datapath';
|
|
19
|
+
import { decodeFacet } from '../js/utils/helpers';
|
|
20
|
+
import { default as default_2 } from 'q';
|
|
21
|
+
import { default as default_3 } from 'handlebars';
|
|
22
|
+
import { encodeFacet } from '../js/utils/helpers';
|
|
23
|
+
import { encodeFacetString } from '../js/utils/helpers';
|
|
24
|
+
import { ermrestFactory } from '../js/core';
|
|
25
|
+
import { Exporter } from '../js/export';
|
|
26
|
+
import { ForeignKeyRef } from '../../../js/core';
|
|
27
|
+
import { ForeignKeyRef as ForeignKeyRef_2 } from '../../js/core';
|
|
28
|
+
import { _formatUtils } from '../js/utils/helpers';
|
|
29
|
+
import { getElapsedTime } from '../js/setup/node';
|
|
30
|
+
import { Key } from '../../../js/core';
|
|
31
|
+
import { Key as Key_2 } from '../../js/core';
|
|
32
|
+
import { Location as Location_2 } from '../../../js/parser';
|
|
33
|
+
import { onload as onload_2 } from '../js/setup/node';
|
|
34
|
+
import { parse } from '../js/parser';
|
|
35
|
+
import { default as printf } from '../js/format';
|
|
36
|
+
import { processMarkdownPattern } from '../js/utils/helpers';
|
|
37
|
+
import { renderMustacheTemplate } from '../js/utils/helpers';
|
|
38
|
+
import { Server } from '../../../js/core';
|
|
39
|
+
import { Table } from '../../js/core';
|
|
40
|
+
import { Table as Table_2 } from '../../../js/core';
|
|
41
|
+
import { Type } from '../../../js/core';
|
|
42
|
+
import { Upload } from '../js/hatrac';
|
|
43
|
+
import { default as validateJSONLD } from '../js/json_ld_validator.js';
|
|
44
|
+
import { _validateMustacheTemplate } from '../js/utils/helpers';
|
|
45
|
+
|
|
46
|
+
declare type ActiveList = {
|
|
47
|
+
requests: any[];
|
|
48
|
+
allOutBounds: Array<ForeignKeyPseudoColumn | PseudoColumn>;
|
|
49
|
+
selfLinks: Array<KeyPseudoColumn>;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export declare const appLinkFn: typeof ConfigService.setAppLinkFn;
|
|
53
|
+
|
|
54
|
+
declare type AppLinkFnType = (tag: string, location: any, context: string) => string;
|
|
55
|
+
|
|
56
|
+
declare type AssetMetadata = {
|
|
57
|
+
url: string;
|
|
58
|
+
caption: string;
|
|
59
|
+
filename: string;
|
|
60
|
+
byteCount: string;
|
|
61
|
+
md5: string;
|
|
62
|
+
sha256: string;
|
|
63
|
+
sameHost: boolean;
|
|
64
|
+
hostInformation: string;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @class
|
|
69
|
+
* @param {Reference} reference column's reference
|
|
70
|
+
* @param {Column} column the asset column
|
|
71
|
+
* @param {SourceObjectWrapper} sourceObjectWrapper the source object wrapper
|
|
72
|
+
* @param {string=} name the name of this column
|
|
73
|
+
*
|
|
74
|
+
* @property {string} urlPattern A desired upload location can be derived by Pattern Expansion on pattern.
|
|
75
|
+
* @property {(Column|null)} filenameColumn if it's string, then it is the name of column we want to store filename inside of it.
|
|
76
|
+
* @property {(Column|null)} byteCountColumn if it's string, then it is the name of column we want to store byte count inside of it.
|
|
77
|
+
* @property {(Column|boolean|null)} md5 if it's string, then it is the name of column we want to store md5 inside of it. If it's true, that means we must use md5.
|
|
78
|
+
* @property {(Column|boolean|null)} sha256 if it's string, then it is the name of column we want to store sha256 inside of it. If it's true, that means we must use sha256.
|
|
79
|
+
* @property {(string[]|null)} filenameExtFilter set of filename extension filters for use by upload agents to indicate to the user the acceptable filename patterns.
|
|
80
|
+
*
|
|
81
|
+
* @desc
|
|
82
|
+
* Constructor for AssetPseudoColumn.
|
|
83
|
+
* This class is a wrapper for {@link Column} objects that have asset annotation.
|
|
84
|
+
* This class extends the {@link ReferenceColumn}
|
|
85
|
+
*/
|
|
86
|
+
declare class AssetPseudoColumn extends ReferenceColumn {
|
|
87
|
+
/**
|
|
88
|
+
* @type {boolean}
|
|
89
|
+
* @desc indicates that this object represents a PseudoColumn.
|
|
90
|
+
*/
|
|
91
|
+
isPseudo: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* @type {boolean}
|
|
94
|
+
* @desc Indicates that this ReferenceColumn is an asset.
|
|
95
|
+
*/
|
|
96
|
+
isAsset: boolean;
|
|
97
|
+
private _baseCol;
|
|
98
|
+
private _annotation;
|
|
99
|
+
private _templateEngine?;
|
|
100
|
+
private _urlPattern?;
|
|
101
|
+
private _filenameColumn?;
|
|
102
|
+
private _byteCountColumn?;
|
|
103
|
+
private _md5?;
|
|
104
|
+
private _sha256?;
|
|
105
|
+
private _filenamePattern?;
|
|
106
|
+
private _filenameExtFilter?;
|
|
107
|
+
private _filenameExtRegexp?;
|
|
108
|
+
private _displayImagePreview?;
|
|
109
|
+
private _filePreview?;
|
|
110
|
+
constructor(reference: Reference, column: Column, sourceObjectWrapper?: SourceObjectWrapper, name?: string, mainTuple?: Tuple);
|
|
111
|
+
/**
|
|
112
|
+
* If url_pattern is invalid or browser_upload=false the input will be disabled.
|
|
113
|
+
* @param {string} context the context
|
|
114
|
+
* @return {boolean|object}
|
|
115
|
+
*/
|
|
116
|
+
protected _determineInputDisabled(context: string): boolean | {
|
|
117
|
+
message: string;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Given the data, will return the appropriate metadata values. The returned object
|
|
121
|
+
* will have the following attributes:
|
|
122
|
+
* - filename
|
|
123
|
+
* - byteCount
|
|
124
|
+
* - md5
|
|
125
|
+
* - sha256
|
|
126
|
+
* - origin
|
|
127
|
+
* - caption: the string that can be used for showing the selected file.
|
|
128
|
+
* The heuristics for origin and caption:
|
|
129
|
+
* 1. if filenameColumn is defined and its value is not null, use it as caption.
|
|
130
|
+
* 2. otherwise, if the url is from hatrac, extract the filename and use it as caption.
|
|
131
|
+
* 3. otherwise, use the last part of url as caption. in detailed context, if url is absolute find the origin.
|
|
132
|
+
* @param {Object} data key-value pair of data
|
|
133
|
+
* @param {String} context context string
|
|
134
|
+
* @param {Object} options
|
|
135
|
+
* @return {Object} metadata object with `caption`, `filename`, `byteCount`, `md5`, and `sha256` attributes.
|
|
136
|
+
*/
|
|
137
|
+
getMetadata(data: any, context?: string, options?: any): AssetMetadata;
|
|
138
|
+
/**
|
|
139
|
+
* Format the presentation value corresponding to this asset definition.
|
|
140
|
+
* 1. return the raw data in entry contexts.
|
|
141
|
+
* 2. otherwise if it has wait-for return empty.
|
|
142
|
+
* 3. otherwise if column-display is defined, use it.
|
|
143
|
+
* 4. otherwise if value is null, return null.
|
|
144
|
+
* 5. otherwise use getMetadata to genarate caption and origin and return a download button.
|
|
145
|
+
*
|
|
146
|
+
* @param {Object} data the raw data of the table
|
|
147
|
+
* @param {String=} context the app context (optional)
|
|
148
|
+
* @param {Object=} templateVariables the template variables that should be used (optional)
|
|
149
|
+
* @param {Object=} options (optional)
|
|
150
|
+
* @returns {Object} A key value pair containing value and isHTML that detemrines the presentation.
|
|
151
|
+
*/
|
|
152
|
+
formatPresentation(data: any, context?: string, templateVariables?: any, options?: any): any;
|
|
153
|
+
/**
|
|
154
|
+
* Modify the default column_order heuristics for the asset, by using the filename
|
|
155
|
+
* if
|
|
156
|
+
* - the filename_column is defined and valid
|
|
157
|
+
* - column_order is not defined on the column-display
|
|
158
|
+
* This has been done to ensure the sorted column is the same as displayed value.
|
|
159
|
+
* In most default cases, all the conditions will met.
|
|
160
|
+
* @private
|
|
161
|
+
*/
|
|
162
|
+
protected _determineSortable(): void;
|
|
163
|
+
/**
|
|
164
|
+
* Returns the template_engine defined in the annotation
|
|
165
|
+
*/
|
|
166
|
+
get templateEngine(): string;
|
|
167
|
+
/**
|
|
168
|
+
* Returns the url_pattern defined in the annotation (the raw value and not computed).
|
|
169
|
+
*/
|
|
170
|
+
get urlPattern(): string;
|
|
171
|
+
/**
|
|
172
|
+
* The column object that filename is stored in.
|
|
173
|
+
*/
|
|
174
|
+
get filenameColumn(): Column | null;
|
|
175
|
+
/**
|
|
176
|
+
* The column object that byte count is stored in.
|
|
177
|
+
*/
|
|
178
|
+
get byteCountColumn(): Column | null;
|
|
179
|
+
/**
|
|
180
|
+
* The column object that md5 hash is stored in.
|
|
181
|
+
*/
|
|
182
|
+
get md5(): Column | boolean | null;
|
|
183
|
+
/**
|
|
184
|
+
* The column object that sha256 hash is stored in.
|
|
185
|
+
*/
|
|
186
|
+
get sha256(): Column | boolean | null;
|
|
187
|
+
/**
|
|
188
|
+
* Returns the stored filename pattern.
|
|
189
|
+
*/
|
|
190
|
+
get filenamePattern(): string;
|
|
191
|
+
/**
|
|
192
|
+
* The column object that file extension is stored in.
|
|
193
|
+
*/
|
|
194
|
+
get filenameExtFilter(): string[];
|
|
195
|
+
/**
|
|
196
|
+
* The regular expressions that will be used for extracting the extension
|
|
197
|
+
*/
|
|
198
|
+
get filenameExtRegexp(): string[];
|
|
199
|
+
/**
|
|
200
|
+
* whether we should show the image preview or not
|
|
201
|
+
*/
|
|
202
|
+
get displayImagePreview(): boolean;
|
|
203
|
+
/**
|
|
204
|
+
* whether we should show the file preview or not
|
|
205
|
+
*/
|
|
206
|
+
get filePreview(): null | {
|
|
207
|
+
showCsvHeader: boolean;
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* Returns the wait for list for this column.
|
|
211
|
+
*/
|
|
212
|
+
get waitFor(): VisibleColumn[];
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export { AttributeGroupColumn }
|
|
216
|
+
|
|
217
|
+
export { AttributeGroupLocation }
|
|
218
|
+
|
|
219
|
+
export { AttributeGroupReference }
|
|
220
|
+
|
|
221
|
+
export declare class AuthnService {
|
|
222
|
+
private static _session;
|
|
223
|
+
static setClientSession(session: object): void;
|
|
224
|
+
static get session(): any;
|
|
225
|
+
/**
|
|
226
|
+
* check if at least one of the groups in the groupArray is included in the session attributes.
|
|
227
|
+
* If the groupArray is null or contains "*", it will return true.
|
|
228
|
+
* @param groupArray the array of globus group IDs
|
|
229
|
+
* @param session the session object to check against (if not provided, it will use the current session)
|
|
230
|
+
*/
|
|
231
|
+
static isUserInAcl(groupArray: string[] | null, session?: any): boolean;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export declare class BadGatewayError extends ERMrestError {
|
|
235
|
+
constructor(status: string, message: string);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export declare class BadRequestError extends ERMrestError {
|
|
239
|
+
constructor(status: string, message: string);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export declare class BatchDeleteResponse extends ERMrestError {
|
|
243
|
+
successTupleData: any;
|
|
244
|
+
failedTupleData: any;
|
|
245
|
+
constructor(successTupleData: any, failedTupleData: any, subMessage?: string);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export declare class BatchUnlinkResponse extends ERMrestError {
|
|
249
|
+
successTupleData: any;
|
|
250
|
+
failedTupleData: any;
|
|
251
|
+
constructor(successTupleData: any, failedTupleData: any, subMessage?: string);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export { BinaryPredicate }
|
|
255
|
+
|
|
256
|
+
export { BucketAttributeGroupReference }
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Constructor to create a BulkCreateForeignKeyObject object
|
|
260
|
+
*
|
|
261
|
+
* NOTE: Potential improvement to the heuristics when there is no annotation defined
|
|
262
|
+
* if we have:
|
|
263
|
+
* - >2 FK columns
|
|
264
|
+
* - there is a key with 2 foreign key columns in it
|
|
265
|
+
* - that key includes the _mainColumn mentioned in prefillObject
|
|
266
|
+
* should we assume that's the main/leaf columns for the association?
|
|
267
|
+
*/
|
|
268
|
+
declare class BulkCreateForeignKeyObject {
|
|
269
|
+
private _reference;
|
|
270
|
+
private _prefillObject;
|
|
271
|
+
private _mainColumn;
|
|
272
|
+
private _leafColumn;
|
|
273
|
+
private _isUnique;
|
|
274
|
+
private _disabledRowsFilters?;
|
|
275
|
+
private _andFilters?;
|
|
276
|
+
/**
|
|
277
|
+
* @param reference reference for the association table
|
|
278
|
+
* @param prefillObject generated prefill object from chaise after extracting the query param and fetching the data from cookie storage
|
|
279
|
+
* @param fkCols set of foreignkey columns that are not system columns (they might be overlapping so we're not using array)
|
|
280
|
+
* @param mainColumn the column from the assocation table that points to the main table in the association
|
|
281
|
+
* @param leafColumn the column from the assocation table that points to the leaf table in the association we are selecting rows from to associate to main
|
|
282
|
+
*/
|
|
283
|
+
constructor(reference: Reference, prefillObject: any, fkCols: Record<string, boolean>, mainColumn: ForeignKeyPseudoColumn, leafColumn: ForeignKeyPseudoColumn);
|
|
284
|
+
/**
|
|
285
|
+
* the column that points to the table that rows are being selected from
|
|
286
|
+
*/
|
|
287
|
+
get leafColumn(): ForeignKeyPseudoColumn;
|
|
288
|
+
/**
|
|
289
|
+
* if the 2 foreign key columns are part of a unqiue key
|
|
290
|
+
*/
|
|
291
|
+
get isUnique(): boolean;
|
|
292
|
+
/**
|
|
293
|
+
* @returns filters array for getting the rows that should be disabled
|
|
294
|
+
*/
|
|
295
|
+
disabledRowsFilter(): any[];
|
|
296
|
+
/**
|
|
297
|
+
* @returns filters array to use on leafColumn.reference for ensuring rows from the table are only able to be added if their key information is not null
|
|
298
|
+
*/
|
|
299
|
+
andFiltersForLeaf(): any[];
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
declare class CatalogService {
|
|
303
|
+
private static constraintNames;
|
|
304
|
+
static addConstraintName(catalogId: string, schemaName: string, constraintName: string, obj: any, subject: _constraintTypes): void;
|
|
305
|
+
static getConstraintObject(catalogId: string, schemaName: string, constraintName: string, subject?: _constraintTypes): {
|
|
306
|
+
subject: _constraintTypes;
|
|
307
|
+
object: Key_2 | ForeignKeyRef_2;
|
|
308
|
+
RID: string;
|
|
309
|
+
} | null;
|
|
310
|
+
static clearConstraintNames(): void;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export declare const _certifyContextHeader: typeof HTTPService.certifyContextHeader;
|
|
314
|
+
|
|
315
|
+
export { Checksum }
|
|
316
|
+
|
|
317
|
+
declare class ChoiceFacetFilter extends FacetFilter {
|
|
318
|
+
facetFilterKey: string;
|
|
319
|
+
constructor(value: unknown, column: Column);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Constructs a citation for the given tuple.
|
|
324
|
+
* The given citationAnnotation must be valid and have the appropriate variables.
|
|
325
|
+
*/
|
|
326
|
+
declare class Citation {
|
|
327
|
+
private _table;
|
|
328
|
+
private _citationAnnotation;
|
|
329
|
+
waitFor: VisibleColumn[];
|
|
330
|
+
hasWaitFor: boolean;
|
|
331
|
+
hasWaitForAggregate: boolean;
|
|
332
|
+
constructor(reference: Reference, citationAnnotation: CitationAnnotation);
|
|
333
|
+
/**
|
|
334
|
+
* Given the templateVariables variables, will generate the citaiton.
|
|
335
|
+
* @param tuple - the tuple object that this citaiton is based on
|
|
336
|
+
* @param templateVariables - if it's not an obect, we will use the tuple templateVariables
|
|
337
|
+
* @return if the returned template for required attributes are empty, it will return null.
|
|
338
|
+
*/
|
|
339
|
+
compute(tuple: Tuple, templateVariables?: any): CitationObject | null;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
declare interface CitationAnnotation {
|
|
343
|
+
journal_pattern?: string;
|
|
344
|
+
year_pattern?: string;
|
|
345
|
+
url_pattern?: string;
|
|
346
|
+
author_pattern?: string;
|
|
347
|
+
title_pattern?: string;
|
|
348
|
+
id_pattern?: string;
|
|
349
|
+
template_engine?: string;
|
|
350
|
+
wait_for?: any;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
declare interface CitationObject {
|
|
354
|
+
author?: string | null;
|
|
355
|
+
title?: string | null;
|
|
356
|
+
journal?: string | null;
|
|
357
|
+
year?: string | null;
|
|
358
|
+
url?: string | null;
|
|
359
|
+
id?: string | null;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export declare const _clearConstraintNames: typeof CatalogService.clearConstraintNames;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Constructs an Aggregate Function object
|
|
366
|
+
*
|
|
367
|
+
* Column Aggregate Functions is a collection of available aggregates for the
|
|
368
|
+
* particular ReferenceColumn (min, max, count not null, and count distinct for it's column).
|
|
369
|
+
* Each aggregate should return the string representation for querying for that information.
|
|
370
|
+
*
|
|
371
|
+
* Usage:
|
|
372
|
+
* Clients _do not_ directly access this constructor. ERMrest.ReferenceColumn
|
|
373
|
+
* will access this constructor for purposes of fetching aggregate data
|
|
374
|
+
* for a specific column
|
|
375
|
+
*/
|
|
376
|
+
declare class ColumnAggregateFn {
|
|
377
|
+
column: ReferenceColumn;
|
|
378
|
+
constructor(column: ReferenceColumn);
|
|
379
|
+
/**
|
|
380
|
+
* minimum aggregate representation
|
|
381
|
+
*/
|
|
382
|
+
get minAgg(): string;
|
|
383
|
+
/**
|
|
384
|
+
* maximum aggregate representation
|
|
385
|
+
*/
|
|
386
|
+
get maxAgg(): string;
|
|
387
|
+
/**
|
|
388
|
+
* not null count aggregate representation
|
|
389
|
+
*/
|
|
390
|
+
get countNotNullAgg(): string;
|
|
391
|
+
/**
|
|
392
|
+
* distinct count aggregate representation
|
|
393
|
+
*/
|
|
394
|
+
get countDistinctAgg(): string;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Can be used to access group aggregate functions.
|
|
399
|
+
* Usage:
|
|
400
|
+
* Clients _do not_ directly access this constructor. ERMrest.ReferenceColumn
|
|
401
|
+
* will access this constructor for purposes of fetching grouped aggregate data
|
|
402
|
+
* for a specific column
|
|
403
|
+
*/
|
|
404
|
+
declare class ColumnGroupAggregateFn {
|
|
405
|
+
column: ReferenceColumn;
|
|
406
|
+
private _ref;
|
|
407
|
+
constructor(column: ReferenceColumn, ref: Reference);
|
|
408
|
+
/**
|
|
409
|
+
* Will return a compact/select attribute group reference which can be used to show distinct values and their counts
|
|
410
|
+
* The result is based on shortest key of the parent table. If we have join
|
|
411
|
+
* in the path, we are counting the shortest key of the parent table (not the end table).
|
|
412
|
+
* NOTE: Will create a new reference by each call.
|
|
413
|
+
* @param columnDisplayname the displayname of main column.
|
|
414
|
+
* @param sortColumns the sort column object that you want to pass
|
|
415
|
+
* @param hideNumOccurrences whether we should add number of Occurrences or not.
|
|
416
|
+
* @param dontAllowNull whether the null value should be returned for the facet or not.
|
|
417
|
+
* @returns AttributeGroupReference
|
|
418
|
+
*/
|
|
419
|
+
entityCounts(columnDisplayname?: DisplayName | string, sortColumns?: SortColumn[], hideNumOccurrences?: boolean, dontAllowNull?: boolean): AttributeGroupReference_2;
|
|
420
|
+
/**
|
|
421
|
+
* Given number of buckets, min and max will return bin of results.
|
|
422
|
+
* The result is based on shortest key of the parent table. If we have join
|
|
423
|
+
* in the path, we are creating the histogram based on shortest key of the
|
|
424
|
+
* parent table (not the end table).
|
|
425
|
+
* @param bucketCount number of buckets
|
|
426
|
+
* @param min minimum value
|
|
427
|
+
* @param max maximum value
|
|
428
|
+
* @return BucketAttributeGroupReference
|
|
429
|
+
*/
|
|
430
|
+
histogram(bucketCount: number, min: any, max: any): BucketAttributeGroupReference_2;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
declare enum CommentDisplayModes {
|
|
434
|
+
INLINE = "inline",
|
|
435
|
+
TOOLTIP = "tooltip"
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
declare type CommentType = {
|
|
439
|
+
value: string;
|
|
440
|
+
isHTML: boolean;
|
|
441
|
+
unformatted: string;
|
|
442
|
+
displayMode: CommentDisplayModes;
|
|
443
|
+
} | false | null;
|
|
444
|
+
|
|
445
|
+
declare class ConfigService {
|
|
446
|
+
private static _http;
|
|
447
|
+
private static _q;
|
|
448
|
+
private static _clientConfig;
|
|
449
|
+
private static _appLinkFn;
|
|
450
|
+
private static _systemColumnsHeuristicsMode;
|
|
451
|
+
private static _markdownItDefaultLinkOpenRenderer;
|
|
452
|
+
/**
|
|
453
|
+
* This function is used to configure the module
|
|
454
|
+
* Notes:
|
|
455
|
+
* - if this configure function is not called, we're going to use axios by default.
|
|
456
|
+
* - The second parameter is not used and only added for backwards compatibility.
|
|
457
|
+
* @param http any http service (like Angular $http or axios)
|
|
458
|
+
* @param q Any promise library (like Angular $q or Q library)
|
|
459
|
+
*/
|
|
460
|
+
static configure(http: any, q: any): void;
|
|
461
|
+
static get http(): AxiosStatic;
|
|
462
|
+
static get q(): typeof default_2;
|
|
463
|
+
/**
|
|
464
|
+
* This function will be called to set the config object
|
|
465
|
+
*/
|
|
466
|
+
static setClientConfig(clientConfig: any): Promise<void>;
|
|
467
|
+
static get clientConfig(): any;
|
|
468
|
+
/**
|
|
469
|
+
* check whether the client config is set or not
|
|
470
|
+
*/
|
|
471
|
+
static verifyClientConfig(dontThrowError?: boolean): boolean;
|
|
472
|
+
static setAppLinkFn(fn: AppLinkFnType): void;
|
|
473
|
+
/**
|
|
474
|
+
* Given an app tag, location object and context will return the full url.
|
|
475
|
+
* @param tag the tag that is defined in the annotation. If null, should use context.
|
|
476
|
+
* @param location the location object that ERMrest will return.
|
|
477
|
+
* @param context - optional, used to determine default app if tag is null/undefined
|
|
478
|
+
*/
|
|
479
|
+
static get appLinkFn(): AppLinkFnType;
|
|
480
|
+
static setSystemColumnsHeuristicsMode(fn: (context: string) => any): void;
|
|
481
|
+
static get systemColumnsHeuristicsMode(): (context: string) => any | undefined;
|
|
482
|
+
/**
|
|
483
|
+
* @private
|
|
484
|
+
* @desc
|
|
485
|
+
* Change the link_open function to add classes to links, based on clientConfig
|
|
486
|
+
* It will add
|
|
487
|
+
* - external-link-icon
|
|
488
|
+
* - exteranl-link if clientConfig.disableExternalLinkModal is not true
|
|
489
|
+
*
|
|
490
|
+
* NOTE we should call this function only ONCE when the setClientConfig is done
|
|
491
|
+
*/
|
|
492
|
+
static _markdownItLinkOpenAddExternalLink(): void;
|
|
493
|
+
/**
|
|
494
|
+
* Expose authCookie function, to reset ermrest cookie
|
|
495
|
+
* NOTE meant to be used only in node environments
|
|
496
|
+
*/
|
|
497
|
+
static resetUserCookie(): void;
|
|
498
|
+
/**
|
|
499
|
+
* Expose authCookie function, to set ermrest cookie
|
|
500
|
+
* NOTE meant to be used only in node environments
|
|
501
|
+
*/
|
|
502
|
+
static setUserCookie(authCookie: string): void;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
export declare const configure: typeof ConfigService.configure;
|
|
506
|
+
|
|
507
|
+
export declare class ConflictError extends ERMrestError {
|
|
508
|
+
constructor(status: string, message: string, subMessage?: string);
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
declare enum _constraintTypes {
|
|
512
|
+
KEY = "k",
|
|
513
|
+
FOREIGN_KEY = "fk"
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
export declare const contextHeaderName = "Deriva-Client-Context";
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* Contructs the Contextualize object.
|
|
520
|
+
*
|
|
521
|
+
* Usage:
|
|
522
|
+
* Clients _do not_ directly access this constructor.
|
|
523
|
+
* See {@link Reference#contextualize}
|
|
524
|
+
*
|
|
525
|
+
* It will be used for creating contextualized references.
|
|
526
|
+
*/
|
|
527
|
+
declare class Contextualize {
|
|
528
|
+
private _reference;
|
|
529
|
+
constructor(reference: Reference);
|
|
530
|
+
/**
|
|
531
|
+
* The _record_ context of this reference.
|
|
532
|
+
*/
|
|
533
|
+
get detailed(): Reference;
|
|
534
|
+
/**
|
|
535
|
+
* The _compact_ context of this reference.
|
|
536
|
+
*/
|
|
537
|
+
get compact(): Reference;
|
|
538
|
+
/**
|
|
539
|
+
* The _compact/brief_ context of this reference.
|
|
540
|
+
*/
|
|
541
|
+
get compactBrief(): Reference;
|
|
542
|
+
/**
|
|
543
|
+
* The _compact/select_ context of this reference.
|
|
544
|
+
*/
|
|
545
|
+
get compactSelect(): Reference;
|
|
546
|
+
/**
|
|
547
|
+
* The _compact/select/association_ context of this reference.
|
|
548
|
+
*/
|
|
549
|
+
get compactSelectAssociation(): Reference;
|
|
550
|
+
/**
|
|
551
|
+
* The _compact/select/association/link_ context of this reference.
|
|
552
|
+
*/
|
|
553
|
+
get compactSelectAssociationLink(): Reference;
|
|
554
|
+
/**
|
|
555
|
+
* The _compact/select/association/unlink_ context of this reference.
|
|
556
|
+
*/
|
|
557
|
+
get compactSelectAssociationUnlink(): Reference;
|
|
558
|
+
/**
|
|
559
|
+
* The _compact/select/foreign_key_ context of this reference.
|
|
560
|
+
*/
|
|
561
|
+
get compactSelectForeignKey(): Reference;
|
|
562
|
+
/**
|
|
563
|
+
* The _compact/select/foreign_key/bulk_ context of this reference.
|
|
564
|
+
*/
|
|
565
|
+
get compactSelectBulkForeignKey(): Reference;
|
|
566
|
+
/**
|
|
567
|
+
* The _compact/select/saved_queries_ context of this reference.
|
|
568
|
+
*/
|
|
569
|
+
get compactSelectSavedQueries(): Reference;
|
|
570
|
+
/**
|
|
571
|
+
* The _compact/select/show_more_ context of this reference.
|
|
572
|
+
*/
|
|
573
|
+
get compactSelectShowMore(): Reference;
|
|
574
|
+
/**
|
|
575
|
+
* The _entry_ context of this reference.
|
|
576
|
+
*/
|
|
577
|
+
get entry(): Reference;
|
|
578
|
+
/**
|
|
579
|
+
* The _entry/create_ context of this reference.
|
|
580
|
+
*/
|
|
581
|
+
get entryCreate(): Reference;
|
|
582
|
+
/**
|
|
583
|
+
* The _entry/edit_ context of this reference.
|
|
584
|
+
*/
|
|
585
|
+
get entryEdit(): Reference;
|
|
586
|
+
/**
|
|
587
|
+
* The _entry/compact_ context of this reference.
|
|
588
|
+
*/
|
|
589
|
+
get compactEntry(): Reference;
|
|
590
|
+
/**
|
|
591
|
+
* get compactBriefInline - The compact brief inline context of the reference
|
|
592
|
+
*/
|
|
593
|
+
get compactBriefInline(): Reference;
|
|
594
|
+
/**
|
|
595
|
+
* get Export - export context
|
|
596
|
+
*/
|
|
597
|
+
get export(): Reference;
|
|
598
|
+
/**
|
|
599
|
+
* get exportCompact - export context for compact view
|
|
600
|
+
*/
|
|
601
|
+
get exportCompact(): Reference;
|
|
602
|
+
/**
|
|
603
|
+
* get exportDetailed - export context for detailed view
|
|
604
|
+
*/
|
|
605
|
+
get exportDetailed(): Reference;
|
|
606
|
+
private _contextualize;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
export { createLocation }
|
|
610
|
+
|
|
611
|
+
export declare const _createPage: (reference: Reference, etag: string, data: any, hasPrevious: boolean, hasNext: boolean) => Page;
|
|
612
|
+
|
|
613
|
+
export { createPath }
|
|
614
|
+
|
|
615
|
+
export { createSearchPath }
|
|
616
|
+
|
|
617
|
+
export { _currDate }
|
|
618
|
+
|
|
619
|
+
export { DataPath }
|
|
620
|
+
|
|
621
|
+
export { decodeFacet }
|
|
622
|
+
|
|
623
|
+
declare class DerivedAssociationReference extends Reference {
|
|
624
|
+
private _origFKR;
|
|
625
|
+
private _associationToRelatedFKR;
|
|
626
|
+
constructor(location: Location_2, catalog: Catalog, origFKR: ForeignKeyRef, associationToRelatedFKR: ForeignKeyRef);
|
|
627
|
+
/**
|
|
628
|
+
* the main tuple
|
|
629
|
+
*/
|
|
630
|
+
get associationToRelatedFKR(): ForeignKeyRef;
|
|
631
|
+
get origFKR(): ForeignKeyRef;
|
|
632
|
+
copy(): DerivedAssociationReference;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
declare type DisplayName = {
|
|
636
|
+
value: string | null;
|
|
637
|
+
isHTML: boolean;
|
|
638
|
+
unformatted?: string | null;
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
export declare class DuplicateConflictError extends ConflictError {
|
|
642
|
+
duplicateReference: any;
|
|
643
|
+
constructor(status: string, message: string, subMessage?: string, duplicateReference?: any);
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
export { encodeFacet }
|
|
647
|
+
|
|
648
|
+
export { encodeFacetString }
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* @memberof ERMrest
|
|
652
|
+
* @param {int} code http error code
|
|
653
|
+
* @param {string} status message status/title in the modal box
|
|
654
|
+
* @param {string} message main user error message
|
|
655
|
+
* @param {string} subMessage technical details about the error. Appear in collapsible span in the modal box
|
|
656
|
+
* @param {string} redirectPath path that would be added to the host to create full redirect link in Chaise
|
|
657
|
+
* @constructor
|
|
658
|
+
*/
|
|
659
|
+
export declare class ERMrestError extends Error {
|
|
660
|
+
code: string | number;
|
|
661
|
+
status: string;
|
|
662
|
+
message: string;
|
|
663
|
+
subMessage?: string | undefined;
|
|
664
|
+
errorData: {
|
|
665
|
+
redirectPath?: string;
|
|
666
|
+
};
|
|
667
|
+
constructor(code: string | number, status: string, message: string, subMessage?: string | undefined, redirectPath?: string);
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
export { ermrestFactory }
|
|
671
|
+
|
|
672
|
+
declare class ErrorService {
|
|
673
|
+
/**
|
|
674
|
+
* Log the error object to the given ermrest location.
|
|
675
|
+
* It will generate a put request to the /terminal_error with the correct headers.
|
|
676
|
+
* ermrset will return a 400 page, but will log the message.
|
|
677
|
+
* @param {object} err the error object
|
|
678
|
+
* @param {string} ermrestLocation the ermrest location
|
|
679
|
+
*/
|
|
680
|
+
static logError(err: any, ermrestLocation: any, contextHeaderParams?: any): Promise<void>;
|
|
681
|
+
/**
|
|
682
|
+
* create an error object from http response
|
|
683
|
+
* @param response http response object
|
|
684
|
+
* @param reference the reference object
|
|
685
|
+
* @param ctionFlag the flag that signals the action that the error occurred from
|
|
686
|
+
*/
|
|
687
|
+
static responseToError(response: any, reference?: any, actionFlag?: string): Error;
|
|
688
|
+
/**
|
|
689
|
+
* @function
|
|
690
|
+
* @param {string} errorStatusText http error status text
|
|
691
|
+
* @param {string} generatedErrMessage response data returned by http request
|
|
692
|
+
* @return {object} error object
|
|
693
|
+
* @desc
|
|
694
|
+
* - Integrity error message: This entry cannot be deleted as it is still referenced from the Human Age table.
|
|
695
|
+
* All dependent entries must be removed before this item can be deleted.
|
|
696
|
+
* - Duplicate error message: The entry cannot be created/updated. Please use a different ID for this record.
|
|
697
|
+
* Or (The entry cannot be created. Please use a combination of different _fields_ to create new record.)
|
|
698
|
+
*
|
|
699
|
+
*/
|
|
700
|
+
private static _conflictErrorMapping;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
export { Exporter }
|
|
704
|
+
|
|
705
|
+
declare interface FacetChoiceDisplayName {
|
|
706
|
+
uniqueId: any;
|
|
707
|
+
displayname: DisplayName;
|
|
708
|
+
tuple: Tuple | null;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* @param {Reference} reference the reference that this FacetColumn blongs to.
|
|
713
|
+
* @param {int} index The index of this FacetColumn in the list of facetColumns
|
|
714
|
+
* @param {SourceObjectWrapper} facetObjectWrapper The filter object that this FacetColumn will be created based on
|
|
715
|
+
* @param {?FacetFilter[]} filters Array of filters
|
|
716
|
+
*/
|
|
717
|
+
declare class FacetColumn {
|
|
718
|
+
/**
|
|
719
|
+
* The column object that the filters are based on
|
|
720
|
+
*/
|
|
721
|
+
_column: Column;
|
|
722
|
+
/**
|
|
723
|
+
* The reference that this facet blongs to
|
|
724
|
+
*/
|
|
725
|
+
reference: Reference;
|
|
726
|
+
/**
|
|
727
|
+
* The index of facetColumn in the list of facetColumns
|
|
728
|
+
* NOTE: Might not be needed
|
|
729
|
+
*/
|
|
730
|
+
index: number;
|
|
731
|
+
/**
|
|
732
|
+
* A valid data-source path
|
|
733
|
+
* NOTE: we're not validating this data-source, we assume that this is valid.
|
|
734
|
+
*/
|
|
735
|
+
dataSource: any;
|
|
736
|
+
/**
|
|
737
|
+
* the compressed version of data source data-source path
|
|
738
|
+
*/
|
|
739
|
+
compressedDataSource: any;
|
|
740
|
+
/**
|
|
741
|
+
* Filters that are applied to this facet.
|
|
742
|
+
*/
|
|
743
|
+
filters: Array<FacetFilter | NotNullFacetFilter>;
|
|
744
|
+
_facetObject: any;
|
|
745
|
+
sourceObjectWrapper: SourceObjectWrapper;
|
|
746
|
+
sourceObjectNodes: SourceObjectNode[];
|
|
747
|
+
lastForeignKeyNode?: SourceObjectNode;
|
|
748
|
+
foreignKeyPathLength: number;
|
|
749
|
+
/**
|
|
750
|
+
* Whether the source has path or not
|
|
751
|
+
*/
|
|
752
|
+
hasPath: boolean;
|
|
753
|
+
/**
|
|
754
|
+
* Returns true if the source is on a key column.
|
|
755
|
+
* If facetObject['entity'] is defined as false, it will return false,
|
|
756
|
+
* otherwise it will true if filter is based on key.
|
|
757
|
+
*/
|
|
758
|
+
isEntityMode: boolean;
|
|
759
|
+
private _isOpen?;
|
|
760
|
+
private _preferredMode?;
|
|
761
|
+
private _barPlot?;
|
|
762
|
+
private _numBuckets?;
|
|
763
|
+
private _referenceColumn?;
|
|
764
|
+
private _sourceReference?;
|
|
765
|
+
private _displayname?;
|
|
766
|
+
private _comment?;
|
|
767
|
+
private _hideNullChoice?;
|
|
768
|
+
private _hideNotNullChoice?;
|
|
769
|
+
private _hideNumOccurrences?;
|
|
770
|
+
private _sortColumns?;
|
|
771
|
+
private _scalarValuesRef?;
|
|
772
|
+
private _fastFilterSource?;
|
|
773
|
+
private _hasNotNullFilter?;
|
|
774
|
+
private _hasNullFilter?;
|
|
775
|
+
private _searchFilters?;
|
|
776
|
+
private _choiceFilters?;
|
|
777
|
+
private _rangeFilters?;
|
|
778
|
+
constructor(reference: Reference, index: number, facetObjectWrapper: SourceObjectWrapper, filters?: Array<FacetFilter | NotNullFacetFilter>);
|
|
779
|
+
/**
|
|
780
|
+
* If has filters it will return true,
|
|
781
|
+
* otherwise returns facetObject['open']
|
|
782
|
+
*/
|
|
783
|
+
get isOpen(): boolean;
|
|
784
|
+
/**
|
|
785
|
+
* The Preferred ux mode.
|
|
786
|
+
* Any of:
|
|
787
|
+
* `choices`, `ranges`, or `check_presence`
|
|
788
|
+
* This should be used if we're not in entity mode. In entity mode it will
|
|
789
|
+
* always return `choices`.
|
|
790
|
+
*
|
|
791
|
+
* The logic is as follows,
|
|
792
|
+
* 1. if facet has only choice or range filter, return that.
|
|
793
|
+
* 2. use ux_mode if available
|
|
794
|
+
* 3. use choices if in entity mode
|
|
795
|
+
* 4. return choices if int or serial, part of key, and not null.
|
|
796
|
+
* 5. return ranges or choices based on the type.
|
|
797
|
+
*
|
|
798
|
+
* Note:
|
|
799
|
+
* - null and not-null are applicaple in all types, so we're ignoring those while figuring out the preferred mode.
|
|
800
|
+
*/
|
|
801
|
+
get preferredMode(): string;
|
|
802
|
+
/**
|
|
803
|
+
* Returns true if the plotly histogram graph should be shown in the UI
|
|
804
|
+
* If _facetObject.barPlot is not defined, the value is true. By default
|
|
805
|
+
* the histogram should be shown unless specified otherwise
|
|
806
|
+
*/
|
|
807
|
+
get barPlot(): boolean;
|
|
808
|
+
/**
|
|
809
|
+
* Returns the value of `barPlot.nBins` if it was defined as part of the
|
|
810
|
+
* `facetObject` in the annotation. If undefined, the default # of buckets is 30
|
|
811
|
+
*/
|
|
812
|
+
get histogramBucketCount(): number;
|
|
813
|
+
/**
|
|
814
|
+
* ReferenceColumn that this facetColumn is based on
|
|
815
|
+
*/
|
|
816
|
+
get column(): ReferenceColumn;
|
|
817
|
+
/**
|
|
818
|
+
* uncontextualized {@link ERMrest.Reference} that has all the joins specified
|
|
819
|
+
* in the source with all the filters of other FacetColumns in the reference.
|
|
820
|
+
*
|
|
821
|
+
* The returned reference will be in the following format:
|
|
822
|
+
* <main-table>/<facets of main table except current facet>/<path to current facet>
|
|
823
|
+
*
|
|
824
|
+
*
|
|
825
|
+
* Consider the following scenario:
|
|
826
|
+
* Table T has two foreignkeys to R1 (fk1), R2 (fk2), and R3 (fk3).
|
|
827
|
+
* R1 has a fitler for term=1, and R2 has a filter for term=2
|
|
828
|
+
* Then the source reference for R3 will be the following:
|
|
829
|
+
* T:=S:T/(fk1)/term=1/$T/(fk2)/term2/$T/M:=(fk3)
|
|
830
|
+
* As you can see it has all the filters of the main table + join to current table.
|
|
831
|
+
*
|
|
832
|
+
* Notes:
|
|
833
|
+
* - This function used to reverse the path from the current facet to each of the
|
|
834
|
+
* other facets in the main reference. Since this was very inefficient, we decided
|
|
835
|
+
* to rewrite it to start from the main table instead.
|
|
836
|
+
* - The path from the main table to facet is based on the given column directive and
|
|
837
|
+
* therefore might have filters or reused table instances (shared path). That's why
|
|
838
|
+
* we're ensuring to pass the whole facetObjectWrapper to parser, so it can properly
|
|
839
|
+
* parse it.
|
|
840
|
+
*/
|
|
841
|
+
get sourceReference(): Reference;
|
|
842
|
+
/**
|
|
843
|
+
* Returns the displayname object that should be used for this facetColumn.
|
|
844
|
+
* TODO the heuristics should be changed to be aligned with PseudoColumn
|
|
845
|
+
* Heuristics are as follows (first applicable rule):
|
|
846
|
+
* 0. If markdown_name is defined, use it.
|
|
847
|
+
* 1. If column is part of the main table (there's no join), use the column's displayname.
|
|
848
|
+
* 2. If last foreignkey is outbound and has to_name, use it.
|
|
849
|
+
* 3. If last foreignkey is inbound and has from_name, use it.
|
|
850
|
+
* 4. Otherwise use the table name.
|
|
851
|
+
* - If it's in `scalar` mode, append the column name. `table_name (column_name)`.
|
|
852
|
+
*
|
|
853
|
+
* Returned object has `value`, `unformatted`, and `isHTML` properties.
|
|
854
|
+
*/
|
|
855
|
+
get displayname(): DisplayName;
|
|
856
|
+
/**
|
|
857
|
+
* Could be used as tooltip to provide more information about the facetColumn
|
|
858
|
+
*/
|
|
859
|
+
get comment(): CommentType;
|
|
860
|
+
/**
|
|
861
|
+
* Whether client should hide the null choice.
|
|
862
|
+
*
|
|
863
|
+
* Before going through the logic, it's good to know the following:
|
|
864
|
+
* -`null` filter could mean any of the following:
|
|
865
|
+
* - Scalar value being `null`. In terms of ermrest, a simple col::null:: query
|
|
866
|
+
* - No value exists in the given path (checking presence of a value in the path). In terms of ermrest,
|
|
867
|
+
* we have to construct an outer join. For performance we're going to use right outer join.
|
|
868
|
+
* Because of ermrest limitation, we cannot have more than two right outer joins and therefore
|
|
869
|
+
* two such null checks cannot co-exist.
|
|
870
|
+
* - Since we're not going to show two different options for these two meanings,
|
|
871
|
+
* we have to make sure to offer `null` option when only one of these two meanings would make sense.
|
|
872
|
+
* - There are some cases when the `null` is not even possible based on the model. So we shouldn't offer this option.
|
|
873
|
+
* - Due to ermrest and our parse limitations, facets with filter cannot support null.
|
|
874
|
+
*
|
|
875
|
+
* Therefore, the following is the logic for this function:
|
|
876
|
+
* 1. If the facet already has `null` filter, return `false`.
|
|
877
|
+
* 2. If facet has `"hide_null_choice": true`, return `true`.
|
|
878
|
+
* 3. If facet has filer, return `true` as our parse can't handle it.
|
|
879
|
+
* 4. If it's a local column,
|
|
880
|
+
* 4.1. if it's not-null, return `true`.
|
|
881
|
+
* 4.2. if it's nullable, return `false`.
|
|
882
|
+
* 5. If it's an all-outbound path where all the columns in the path are not-null,
|
|
883
|
+
* 5.1. If the end column is nullable, return `false` as null value only means scalar value being null.
|
|
884
|
+
* 5.2. If the end column is not-null, return `true` as null value is not possible.
|
|
885
|
+
* 6. For any other paths, if the end column is nullable, `null` filter could mean both scalar and path. so return `true`.
|
|
886
|
+
* 7. Facets with only one hop where the column used in foreignkey is the same column for faceting.
|
|
887
|
+
* In this case, we can completely ignore the foreignkey path and just do a value check on main table. so return `false`.
|
|
888
|
+
* 8. any other cases (facet with arbiarty path),
|
|
889
|
+
* 8.1. if other facets have `null` filter, return `true` as we cannot support multiple right outer joins.
|
|
890
|
+
* 8.2. otherwise, return `false`.
|
|
891
|
+
*
|
|
892
|
+
* NOTE this function used to check for select access as well as versioned catalog,
|
|
893
|
+
* but we decided to remove them since it's not the desired behavior:
|
|
894
|
+
* https://github.com/informatics-isi-edu/ermrestjs/issues/888
|
|
895
|
+
*/
|
|
896
|
+
get hideNullChoice(): boolean;
|
|
897
|
+
/**
|
|
898
|
+
* Whether client should hide the not-null choice. The logic is as follows:
|
|
899
|
+
* - `false` if facet has not-null filter.
|
|
900
|
+
* - `true` if facet has hide_not_null_choice in it's definition
|
|
901
|
+
* - `true` if facet is from the same table and it's not-nullable.
|
|
902
|
+
* - `true` if facet is all outbound not null.
|
|
903
|
+
* - otherwise `false`
|
|
904
|
+
*/
|
|
905
|
+
get hideNotNullChoice(): boolean;
|
|
906
|
+
/**
|
|
907
|
+
* Whether we should hide the number of Occurrences column
|
|
908
|
+
*/
|
|
909
|
+
get hideNumOccurrences(): boolean;
|
|
910
|
+
/**
|
|
911
|
+
* Returns the sortColumns when we're sorting this facet in scalar mode
|
|
912
|
+
* - uses row_order if defined.
|
|
913
|
+
* - otherwise it will be descending of num_occurrences and column order of base column.
|
|
914
|
+
*/
|
|
915
|
+
get sortColumns(): any[];
|
|
916
|
+
private _determineSortable;
|
|
917
|
+
/**
|
|
918
|
+
* An {@link ERMrest.AttributeGroupReference} object that can be used to get
|
|
919
|
+
* the available scalar values of this facet. This will use the sortColumns, and hideNumOccurrences APIs.
|
|
920
|
+
* It will throw an error if it's used in entity-mode.
|
|
921
|
+
*/
|
|
922
|
+
get scalarValuesReference(): AttributeGroupReference_2;
|
|
923
|
+
get fastFilterSourceObjectWrapper(): SourceObjectWrapper | null;
|
|
924
|
+
/**
|
|
925
|
+
* When presenting the applied choice filters, the displayname might be differnt from the value.
|
|
926
|
+
* This only happens in case of entity-picker. Othercases we can just return the list of fitleres as is.
|
|
927
|
+
* In case of entity-picker, we should get the displayname of the choices.
|
|
928
|
+
* Therefore heuristic is as follows:
|
|
929
|
+
* - If no fitler -> resolve with empty list.
|
|
930
|
+
* - If in scalar mode -> resolve with list of filters (don't change their displaynames.)
|
|
931
|
+
* - Otherwise (entity-mode) -> generate an ermrest request to get the displaynames.
|
|
932
|
+
*
|
|
933
|
+
* NOTE This function will not return the null filter.
|
|
934
|
+
* NOTE the request might not return any result for a given filter (because of user access or missing data),
|
|
935
|
+
* in this case, we will return the raw value instead.
|
|
936
|
+
*
|
|
937
|
+
* @param contextHeaderParams object that we want to be logged with the request
|
|
938
|
+
* @return A promise resolved with list of objects that have `uniqueId`, and `displayname`.
|
|
939
|
+
*/
|
|
940
|
+
getChoiceDisplaynames(contextHeaderParams: any): Promise<FacetChoiceDisplayName[]>;
|
|
941
|
+
/**
|
|
942
|
+
* Return JSON presentation of the filters. This will be used in the location.
|
|
943
|
+
* Anything that we want to leak to the url should be here.
|
|
944
|
+
* It will be in the following format:
|
|
945
|
+
*
|
|
946
|
+
* ```
|
|
947
|
+
* {
|
|
948
|
+
* "source": <data-source>,
|
|
949
|
+
* "choices": [v, ...],
|
|
950
|
+
* "ranges": [{"min": v1, "max": v2}, ...],
|
|
951
|
+
* "search": [v, ...],
|
|
952
|
+
* "not_null": true
|
|
953
|
+
* }
|
|
954
|
+
* ```
|
|
955
|
+
*/
|
|
956
|
+
toJSON(): any;
|
|
957
|
+
/**
|
|
958
|
+
* Given an object will create list of filters.
|
|
959
|
+
*
|
|
960
|
+
* NOTE: if we have not_null, other filters except =null are not relevant.
|
|
961
|
+
* That means if we saw not_null:
|
|
962
|
+
* 1. If =null exist, then set the filters to empty array.
|
|
963
|
+
* 2. otherwise set the filter to just the not_null
|
|
964
|
+
*
|
|
965
|
+
* Expected object format format:
|
|
966
|
+
* ```
|
|
967
|
+
* {
|
|
968
|
+
* "source": <data-source>,
|
|
969
|
+
* "choices": [v, ...],
|
|
970
|
+
* "ranges": [{"min": v1, "max": v2}, ...],
|
|
971
|
+
* "search": [v, ...],
|
|
972
|
+
* "not_null": true
|
|
973
|
+
* }
|
|
974
|
+
* ```
|
|
975
|
+
*
|
|
976
|
+
* @param json JSON representation of filters
|
|
977
|
+
*/
|
|
978
|
+
private _setFilters;
|
|
979
|
+
/**
|
|
980
|
+
* Returns true if the not-null filter exists.
|
|
981
|
+
*/
|
|
982
|
+
get hasNotNullFilter(): boolean;
|
|
983
|
+
/**
|
|
984
|
+
* Returns true if choice null filter exists.
|
|
985
|
+
*/
|
|
986
|
+
get hasNullFilter(): boolean;
|
|
987
|
+
/**
|
|
988
|
+
* search filters
|
|
989
|
+
* NOTE ASSUMES that filters is immutable
|
|
990
|
+
*/
|
|
991
|
+
get searchFilters(): SearchFacetFilter[];
|
|
992
|
+
/**
|
|
993
|
+
* choice filters
|
|
994
|
+
* NOTE ASSUMES that filters is immutable
|
|
995
|
+
*/
|
|
996
|
+
get choiceFilters(): ChoiceFacetFilter[];
|
|
997
|
+
/**
|
|
998
|
+
* range filters
|
|
999
|
+
* NOTE ASSUMES that filters is immutable
|
|
1000
|
+
*/
|
|
1001
|
+
get rangeFilters(): RangeFacetFilter[];
|
|
1002
|
+
/**
|
|
1003
|
+
* Create a new Reference with appending a new Search filter to current FacetColumn
|
|
1004
|
+
* @param term the term for search
|
|
1005
|
+
* @return the Reference with the new filter
|
|
1006
|
+
*/
|
|
1007
|
+
addSearchFilter(term: string): Reference;
|
|
1008
|
+
/**
|
|
1009
|
+
* Create a new Reference with appending a list of choice filters to current FacetColumn
|
|
1010
|
+
* @return the reference with the new filter
|
|
1011
|
+
*/
|
|
1012
|
+
addChoiceFilters(values: unknown[]): Reference;
|
|
1013
|
+
/**
|
|
1014
|
+
* Create a new Reference with replacing choice facet filters by the given input
|
|
1015
|
+
* This will also remove NotNullFacetFilter
|
|
1016
|
+
* @return the reference with the new filter
|
|
1017
|
+
*/
|
|
1018
|
+
replaceAllChoiceFilters(values: unknown[]): Reference;
|
|
1019
|
+
/**
|
|
1020
|
+
* Given a term, it will remove any choice filter with that term (if any).
|
|
1021
|
+
* @param terms array of terms
|
|
1022
|
+
* @return the reference with the new filter
|
|
1023
|
+
*/
|
|
1024
|
+
removeChoiceFilters(terms: unknown[]): Reference;
|
|
1025
|
+
/**
|
|
1026
|
+
* Create a new Reference with appending a new range filter to current FacetColumn
|
|
1027
|
+
* @param min minimum value. Can be null or undefined.
|
|
1028
|
+
* @param minExclusive whether the minimum boundary is exclusive or not.
|
|
1029
|
+
* @param max maximum value. Can be null or undefined.
|
|
1030
|
+
* @param maxExclusive whether the maximum boundary is exclusive or not.
|
|
1031
|
+
* @return the reference with the new filter
|
|
1032
|
+
*/
|
|
1033
|
+
addRangeFilter(min?: unknown, minExclusive?: boolean, max?: unknown, maxExclusive?: boolean): FacetFilterResult | false;
|
|
1034
|
+
/**
|
|
1035
|
+
* Create a new Reference with removing any range filter that has the given min and max combination.
|
|
1036
|
+
* @param min minimum value. Can be null or undefined.
|
|
1037
|
+
* @param minExclusive whether the minimum boundary is exclusive or not.
|
|
1038
|
+
* @param max maximum value. Can be null or undefined.
|
|
1039
|
+
* @param maxExclusive whether the maximum boundary is exclusive or not.
|
|
1040
|
+
* @return the reference with the new filter
|
|
1041
|
+
*/
|
|
1042
|
+
removeRangeFilter(min?: unknown, minExclusive?: boolean, max?: unknown, maxExclusive?: boolean): FacetFilterResult;
|
|
1043
|
+
/**
|
|
1044
|
+
* Create a new Reference with removing all the filters and adding a not-null filter.
|
|
1045
|
+
* NOTE based on current usecases this is currently removing all the previous filters.
|
|
1046
|
+
* We might need to change this behavior in the future. I could change the behavior of
|
|
1047
|
+
* this function to only add the filter, and then in the client first remove all and thenadd
|
|
1048
|
+
* addNotNullFilter, but since the code is not very optimized that would result on a heavy
|
|
1049
|
+
* operation.
|
|
1050
|
+
*/
|
|
1051
|
+
addNotNullFilter(): Reference;
|
|
1052
|
+
/**
|
|
1053
|
+
* Create a new Reference without any filters.
|
|
1054
|
+
*/
|
|
1055
|
+
removeNotNullFilter(): Reference;
|
|
1056
|
+
/**
|
|
1057
|
+
* Create a new Reference by removing all the filters from current facet.
|
|
1058
|
+
* @return the reference with the new filter
|
|
1059
|
+
*/
|
|
1060
|
+
removeAllFilters(): Reference;
|
|
1061
|
+
/**
|
|
1062
|
+
* Create a new Reference by removing a filter from current facet.
|
|
1063
|
+
* @param index index of element that we want to remove from list
|
|
1064
|
+
* @return the reference with the new filter
|
|
1065
|
+
*/
|
|
1066
|
+
removeFilter(index: number): Reference;
|
|
1067
|
+
/**
|
|
1068
|
+
* Given an array of {@link ERMrest.FacetFilter}, will return a new
|
|
1069
|
+
* {@link ERMrest.Reference} with the applied filters to the current FacetColumn
|
|
1070
|
+
* @private
|
|
1071
|
+
* @param filters array of filters
|
|
1072
|
+
* @return the reference with the new filter
|
|
1073
|
+
*/
|
|
1074
|
+
private _applyFilters;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
declare abstract class FacetFilter {
|
|
1078
|
+
_column: Column;
|
|
1079
|
+
term: unknown;
|
|
1080
|
+
uniqueId: unknown;
|
|
1081
|
+
facetFilterKey?: string;
|
|
1082
|
+
constructor(term: unknown, column: Column);
|
|
1083
|
+
/**
|
|
1084
|
+
* String representation of filter
|
|
1085
|
+
*/
|
|
1086
|
+
toString(): string | null;
|
|
1087
|
+
/**
|
|
1088
|
+
* JSON representation of filter
|
|
1089
|
+
*/
|
|
1090
|
+
toJSON(): any;
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
declare interface FacetFilterResult {
|
|
1094
|
+
reference: Reference;
|
|
1095
|
+
filter?: FacetFilter;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
declare type FilterPropsType = {
|
|
1099
|
+
/**
|
|
1100
|
+
* whether the filter is processed or not
|
|
1101
|
+
*/
|
|
1102
|
+
isFilterProcessed: boolean;
|
|
1103
|
+
/**
|
|
1104
|
+
* whether there's any filter applied to the root (the first node)
|
|
1105
|
+
*/
|
|
1106
|
+
hasRootFilter: boolean;
|
|
1107
|
+
/**
|
|
1108
|
+
* whether there's any filter applied to the nodes in between
|
|
1109
|
+
* (i.e. not the root and not the leaf)
|
|
1110
|
+
*/
|
|
1111
|
+
hasFilterInBetween: boolean;
|
|
1112
|
+
/**
|
|
1113
|
+
* the leaf filter string
|
|
1114
|
+
*/
|
|
1115
|
+
leafFilterString: string;
|
|
1116
|
+
};
|
|
1117
|
+
|
|
1118
|
+
/**
|
|
1119
|
+
* converts a string to an URI encoded string
|
|
1120
|
+
*/
|
|
1121
|
+
export declare function fixedEncodeURIComponent(str: string): string;
|
|
1122
|
+
|
|
1123
|
+
export declare class ForbiddenError extends ERMrestError {
|
|
1124
|
+
constructor(status: string, message: string);
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
/**
|
|
1128
|
+
* @class
|
|
1129
|
+
* @param {Reference} reference column's reference
|
|
1130
|
+
* @param {ForeignKeyRef} fk the foreignkey
|
|
1131
|
+
* @desc
|
|
1132
|
+
* Constructor for ForeignKeyPseudoColumn. This class is a wrapper for {@link ForeignKeyRef}.
|
|
1133
|
+
* This class extends the {@link ReferenceColumn}
|
|
1134
|
+
*/
|
|
1135
|
+
declare class ForeignKeyPseudoColumn extends ReferenceColumn {
|
|
1136
|
+
/**
|
|
1137
|
+
* @type {boolean}
|
|
1138
|
+
* @desc indicates that this object represents a PseudoColumn.
|
|
1139
|
+
*/
|
|
1140
|
+
isPseudo: boolean;
|
|
1141
|
+
/**
|
|
1142
|
+
* @type {boolean}
|
|
1143
|
+
* @desc Indicates that this ReferenceColumn is a Foreign key.
|
|
1144
|
+
*/
|
|
1145
|
+
isForeignKey: boolean;
|
|
1146
|
+
/**
|
|
1147
|
+
* @type {Reference}
|
|
1148
|
+
* @desc The reference object that represents the table of this PseudoColumn
|
|
1149
|
+
*/
|
|
1150
|
+
reference: Reference;
|
|
1151
|
+
/**
|
|
1152
|
+
* @type {ForeignKeyRef}
|
|
1153
|
+
* @desc The Foreign key object that this PseudoColumn is created based on
|
|
1154
|
+
*/
|
|
1155
|
+
foreignKey: ForeignKeyRef;
|
|
1156
|
+
/**
|
|
1157
|
+
* the table that this fk refers to
|
|
1158
|
+
*/
|
|
1159
|
+
table: Table_2;
|
|
1160
|
+
/**
|
|
1161
|
+
* the concatenate version of names
|
|
1162
|
+
* TODO should we rename this? or change it to private?
|
|
1163
|
+
*/
|
|
1164
|
+
_constraintName: string;
|
|
1165
|
+
private _hasDomainFilter?;
|
|
1166
|
+
private _domainFilterUsedColumns?;
|
|
1167
|
+
private _domainFilterRawString?;
|
|
1168
|
+
private _defaultValues?;
|
|
1169
|
+
private _defaultReference?;
|
|
1170
|
+
constructor(reference: Reference, fk: ForeignKeyRef, sourceObjectWrapper?: SourceObjectWrapper, name?: string);
|
|
1171
|
+
/**
|
|
1172
|
+
* Given the available tuple data, generate the uniqueId for the selected row from the table this pseudo column points to
|
|
1173
|
+
*
|
|
1174
|
+
* @param {Object} linkedData key-value pairs of column values of the table this pseudocolumn points to
|
|
1175
|
+
*/
|
|
1176
|
+
generateUniqueId(linkedData: any): string;
|
|
1177
|
+
/**
|
|
1178
|
+
* This function takes in a tuple and generates a reference that is
|
|
1179
|
+
* constrained based on the domain_filter_pattern annotation. If this
|
|
1180
|
+
* annotation doesn't exist, it returns this (reference)
|
|
1181
|
+
* `this` is the same as column.reference
|
|
1182
|
+
* @param {ReferenceColumn} column - column that `this` is based on
|
|
1183
|
+
* @param {Object} data - tuple data with potential constraints
|
|
1184
|
+
* @returns {Reference} the constrained reference
|
|
1185
|
+
*/
|
|
1186
|
+
filteredRef(data: any, linkedData: any): Reference;
|
|
1187
|
+
getDefaultDisplay(rowValues: any): any;
|
|
1188
|
+
_determineDefaultValue(): void;
|
|
1189
|
+
formatPresentation(data: any, context?: string, templateVariables?: any, options?: any): any;
|
|
1190
|
+
sourceFormatPresentation(templateVariables: any, columnValue: any, mainTuple: Tuple): any;
|
|
1191
|
+
_determineSortable(): void;
|
|
1192
|
+
get hasDomainFilter(): boolean;
|
|
1193
|
+
get domainFilterUsedColumns(): any[];
|
|
1194
|
+
get domainFilterRawString(): string;
|
|
1195
|
+
get defaultValues(): any;
|
|
1196
|
+
get defaultReference(): Reference | null;
|
|
1197
|
+
get name(): string;
|
|
1198
|
+
get RID(): string | undefined;
|
|
1199
|
+
get displayname(): DisplayName;
|
|
1200
|
+
get default(): any;
|
|
1201
|
+
/**
|
|
1202
|
+
* use the underlying column comment if available, otherwise get it from the foreign key
|
|
1203
|
+
* (similar to displayname logic)
|
|
1204
|
+
*/
|
|
1205
|
+
get comment(): CommentType;
|
|
1206
|
+
get display(): any;
|
|
1207
|
+
get compressedDataSource(): any;
|
|
1208
|
+
get nullok(): boolean;
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
export { _formatUtils }
|
|
1212
|
+
|
|
1213
|
+
export { getElapsedTime }
|
|
1214
|
+
|
|
1215
|
+
/**
|
|
1216
|
+
* Constructs the Google Dataset metadata for the given tuple.
|
|
1217
|
+
* The given metadata must be valid and have the appropriate variables.
|
|
1218
|
+
*/
|
|
1219
|
+
declare class GoogleDatasetMetadata {
|
|
1220
|
+
private _reference;
|
|
1221
|
+
private _table;
|
|
1222
|
+
private _gdsMetadataAnnotation;
|
|
1223
|
+
constructor(reference: Reference, gdsMetadataAnnotation: any);
|
|
1224
|
+
/**
|
|
1225
|
+
* Given the templateVariables variables, will generate the metadata.
|
|
1226
|
+
* @param tuple - the tuple object that this metadata is based on
|
|
1227
|
+
* @param templateVariables - if it's not an object, we will use the tuple templateVariables
|
|
1228
|
+
* @return if the returned template for required attributes are empty or invalid, it will return null.
|
|
1229
|
+
*/
|
|
1230
|
+
compute(tuple: Tuple, templateVariables?: any): any | null;
|
|
1231
|
+
private setMetadataFromTemplate;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
declare class HandlebarsService {
|
|
1235
|
+
private static _setupDone;
|
|
1236
|
+
private static _handlebarsHelpersHash;
|
|
1237
|
+
private static _handlebarsCompiledTemplates;
|
|
1238
|
+
static get handlebars(): typeof default_3;
|
|
1239
|
+
/**
|
|
1240
|
+
* @function
|
|
1241
|
+
* @public
|
|
1242
|
+
* @param template The template string to transform
|
|
1243
|
+
* @param keyValues The key-value pair of object to be used for template tags replacement.
|
|
1244
|
+
* @param catalog The catalog object created by ermrestJS representing the current catalog from the url
|
|
1245
|
+
* @param options Configuration options.
|
|
1246
|
+
* @return {string} A string produced after templating
|
|
1247
|
+
* @desc Calls the private function to return a string produced as a result of templating using `Handlebars`.
|
|
1248
|
+
*/
|
|
1249
|
+
static render(template: string, keyValues: Record<string, any>, catalog: Catalog_2 | {
|
|
1250
|
+
id: string;
|
|
1251
|
+
}, options: any): string | null;
|
|
1252
|
+
/**
|
|
1253
|
+
* Returns true if all the used keys have values.
|
|
1254
|
+
*
|
|
1255
|
+
* NOTE:
|
|
1256
|
+
* This implementation is very limited and if conditional Handlebar statements
|
|
1257
|
+
* of the form {{#if }}{{/if}} or {{^if VARNAME}}{{/if}} or {{#unless VARNAME}}{{/unless}} or {{^unless }}{{/unless}} found then it won't check
|
|
1258
|
+
* for null values and will return true.s
|
|
1259
|
+
*
|
|
1260
|
+
* @param template mustache template
|
|
1261
|
+
* @param keyValues key-value pairs
|
|
1262
|
+
* @param catalog the catalog object
|
|
1263
|
+
* @param ignoredColumns the columns that should be ignored (optional)
|
|
1264
|
+
* @return true if all the used keys have values
|
|
1265
|
+
*/
|
|
1266
|
+
static validate(template: string, keyValues: Record<string, any>, catalog: any, ignoredColumns?: string[]): boolean;
|
|
1267
|
+
private static _injectCustomHandlebarHelpers;
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
export declare class HistoryService {
|
|
1271
|
+
/**
|
|
1272
|
+
* convert ISO datetime string to snapshot version string
|
|
1273
|
+
* @throws {Error} Might throw some errors if the input is invalid
|
|
1274
|
+
*/
|
|
1275
|
+
static datetimeISOToSnapshot(value: string): string;
|
|
1276
|
+
/**
|
|
1277
|
+
* convert snapshot version string to ISO datetime string
|
|
1278
|
+
* @param {string} snapshot - the snapshot version string
|
|
1279
|
+
* @param {boolean} dontThrowError - if true, will return empty string instead of throwing error
|
|
1280
|
+
* when the input is invalid
|
|
1281
|
+
* @returns {string} the ISO datetime string
|
|
1282
|
+
* @throws {Error} Might throw some errors if the input is invalid
|
|
1283
|
+
*/
|
|
1284
|
+
static snapshotToDatetimeISO(snapshot: string, dontThrowError?: boolean): string;
|
|
1285
|
+
/**
|
|
1286
|
+
* Return microseconds-since-epoch integer for given ISO datetime string
|
|
1287
|
+
*/
|
|
1288
|
+
static datetimeEpochUs(isoString: string): bigint;
|
|
1289
|
+
/**
|
|
1290
|
+
* Encode integer as per ERMrest's base-32 snapshot encoding
|
|
1291
|
+
*/
|
|
1292
|
+
static urlb32Encode(i: bigint): string;
|
|
1293
|
+
/**
|
|
1294
|
+
* Decode base-32 snapshot encoding back to integer
|
|
1295
|
+
*/
|
|
1296
|
+
static urlb32Decode(encoded: string): bigint;
|
|
1297
|
+
/**
|
|
1298
|
+
* Convert microseconds-since-epoch back to ISO datetime string
|
|
1299
|
+
*/
|
|
1300
|
+
static epochUsToIso(epochUs: bigint): string;
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
declare class HTTPService {
|
|
1304
|
+
private static _http401Handler;
|
|
1305
|
+
private static _onHTTPSuccess;
|
|
1306
|
+
/**
|
|
1307
|
+
* A flag to determine whether emrest authorization error has occured
|
|
1308
|
+
* as well as to determine the login flow is currently in progress to avoid
|
|
1309
|
+
* calling the _http401Handler callback again
|
|
1310
|
+
*/
|
|
1311
|
+
private static _encountered401Error;
|
|
1312
|
+
/**
|
|
1313
|
+
* All the calls that were paused because of 401 error are added to this array
|
|
1314
|
+
* Once the _encountered401Error is false, all of them will be resolved/restarted
|
|
1315
|
+
*/
|
|
1316
|
+
private static _authorizationDefers;
|
|
1317
|
+
private static _onHttpAuthFlowFn;
|
|
1318
|
+
/**
|
|
1319
|
+
* Given an object will make sure it's safe for header.
|
|
1320
|
+
*/
|
|
1321
|
+
private static _encodeHeaderContent;
|
|
1322
|
+
static setHTTP401Handler(fn: () => Promise<boolean>): void;
|
|
1323
|
+
static setOnHTTPSuccess(fn: () => void): void;
|
|
1324
|
+
/**
|
|
1325
|
+
* Given a respone object from http module, will return the headers
|
|
1326
|
+
* This is to ensure angularjs and axios behave the same way.
|
|
1327
|
+
* In case of angularjs' $http the headers is a function while for axios
|
|
1328
|
+
* it's an object.
|
|
1329
|
+
*
|
|
1330
|
+
* The response is always going to be an object
|
|
1331
|
+
*/
|
|
1332
|
+
static getResponseHeader(response: any): any;
|
|
1333
|
+
static wrapHTTP(http: any): any;
|
|
1334
|
+
/**
|
|
1335
|
+
* Given a header object, will encode and if neccessary truncate it.
|
|
1336
|
+
* Maximum allowed length of a header after encoding: 6500 characters.
|
|
1337
|
+
* The logic is as follows:
|
|
1338
|
+
* 1. If the encoded string is not lengthy, return it.
|
|
1339
|
+
* 2. otherwise,
|
|
1340
|
+
* 2.1. Return an empty object if the minimal header (defined below) goes over the limit.
|
|
1341
|
+
* 2.2. Otherwise start truncating `stack` object by doing the following. In each step,
|
|
1342
|
+
* if the encoded and truncated header goes below the length limit, return it.
|
|
1343
|
+
* - replace all foreign key constraints with their RIDs (if RID is defined for all of them).
|
|
1344
|
+
* - replace values (`choices`, `ranges`, `search`) in the filters with the number of values.
|
|
1345
|
+
* - replace all `filters.and` with the number of filters.
|
|
1346
|
+
* - replace all source paths with the number of path nodes.
|
|
1347
|
+
* - use replace stack value with the number of stack nodes.
|
|
1348
|
+
* If after performing all these steps, the header is still lengthy, return the minimal header.
|
|
1349
|
+
*
|
|
1350
|
+
* A minimal header will have the following attributes:
|
|
1351
|
+
* - cid, pid, wid, action, schema_table, catalog, t:1
|
|
1352
|
+
* And might have these optional attributes:
|
|
1353
|
+
* - elapsed_ms, cqp, ppid, pcid
|
|
1354
|
+
*
|
|
1355
|
+
*/
|
|
1356
|
+
static certifyContextHeader(header: any): string | Record<string, unknown>;
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
/**
|
|
1360
|
+
* @class
|
|
1361
|
+
* @param {Reference} reference column's reference
|
|
1362
|
+
* @param {Reference} relatedReference the related reference
|
|
1363
|
+
* @desc
|
|
1364
|
+
* Constructor for InboundForeignKeyPseudoColumn. This class is a wrapper for {@link ForeignKeyRef}.
|
|
1365
|
+
* This is a bit different than the {@link ForeignKeyPseudoColumn}, as that was for foreign keys
|
|
1366
|
+
* of current table. This wrapper is for inbound foreignkeys. It is actually warpping the whole reference (table).
|
|
1367
|
+
*
|
|
1368
|
+
* Note: The sourceObjectWrapper might include filters and therefore the relatedReference
|
|
1369
|
+
* might not be a simple path from main to related table and it could have filters.
|
|
1370
|
+
*
|
|
1371
|
+
* This class extends the {@link ReferenceColumn}
|
|
1372
|
+
*/
|
|
1373
|
+
declare class InboundForeignKeyPseudoColumn extends ReferenceColumn {
|
|
1374
|
+
/**
|
|
1375
|
+
* The reference that can be used to get the data for this pseudo-column
|
|
1376
|
+
*/
|
|
1377
|
+
reference: RelatedReference;
|
|
1378
|
+
/**
|
|
1379
|
+
* The table that this pseudo-column represents
|
|
1380
|
+
*/
|
|
1381
|
+
table: Table_2;
|
|
1382
|
+
/**
|
|
1383
|
+
* The {@link ForeignKeyRef} that this pseudo-column is based on.
|
|
1384
|
+
*/
|
|
1385
|
+
foreignKey: ForeignKeyRef;
|
|
1386
|
+
/**
|
|
1387
|
+
* @desc indicates that this object represents a PseudoColumn.
|
|
1388
|
+
*/
|
|
1389
|
+
isPseudo: boolean;
|
|
1390
|
+
/**
|
|
1391
|
+
* @desc Indicates that this ReferenceColumn is an inbound foreign key.
|
|
1392
|
+
*/
|
|
1393
|
+
isInboundForeignKey: boolean;
|
|
1394
|
+
isUnique: boolean;
|
|
1395
|
+
private _currentRef;
|
|
1396
|
+
private _constraintName;
|
|
1397
|
+
constructor(reference: Reference, relatedReference: RelatedReference, sourceObjectWrapper?: SourceObjectWrapper, name?: string);
|
|
1398
|
+
formatPresentation(data: any, context?: string, templateVariables?: any, options?: any): any;
|
|
1399
|
+
_determineSortable(): void;
|
|
1400
|
+
_determineInputDisabled(_: string): boolean | {
|
|
1401
|
+
message: string;
|
|
1402
|
+
};
|
|
1403
|
+
get name(): string;
|
|
1404
|
+
get displayname(): DisplayName;
|
|
1405
|
+
get comment(): CommentType;
|
|
1406
|
+
get default(): unknown;
|
|
1407
|
+
get nullok(): boolean;
|
|
1408
|
+
get compressedDataSource(): unknown;
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
declare type InputIframePropsType = {
|
|
1412
|
+
/**
|
|
1413
|
+
* the url pattern that should be used to generate the iframe url
|
|
1414
|
+
*/
|
|
1415
|
+
urlPattern: string;
|
|
1416
|
+
/**
|
|
1417
|
+
* the template engine that should be used to generate the url
|
|
1418
|
+
*/
|
|
1419
|
+
urlTemplateEngine?: string;
|
|
1420
|
+
/**
|
|
1421
|
+
* the columns used in the mapping
|
|
1422
|
+
*/
|
|
1423
|
+
columns: ReferenceColumn[];
|
|
1424
|
+
/**
|
|
1425
|
+
* an object from field name to column.
|
|
1426
|
+
*/
|
|
1427
|
+
fieldMapping: Record<string, ReferenceColumn>;
|
|
1428
|
+
/**
|
|
1429
|
+
* name of optional fields
|
|
1430
|
+
*/
|
|
1431
|
+
optionalFieldNames: string[];
|
|
1432
|
+
/**
|
|
1433
|
+
* the message that we should show when user wants to submit empty.
|
|
1434
|
+
*/
|
|
1435
|
+
emptyFieldConfirmMessage: string;
|
|
1436
|
+
};
|
|
1437
|
+
|
|
1438
|
+
export declare class IntegrityConflictError extends ConflictError {
|
|
1439
|
+
constructor(status: string, message: string, subMessage?: string);
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
export declare class InternalServerError extends ERMrestError {
|
|
1443
|
+
constructor(status: string, message: string);
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
export declare class InvalidCustomFacetOperatorError extends ERMrestError {
|
|
1447
|
+
constructor(path: string, subMessage?: string);
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
export declare class InvalidFacetOperatorError extends ERMrestError {
|
|
1451
|
+
constructor(path: string, subMessage?: string);
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
export declare class InvalidFilterOperatorError extends ERMrestError {
|
|
1455
|
+
constructor(message: string, path: string, invalidFilter?: string);
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
export declare class InvalidInputError extends ERMrestError {
|
|
1459
|
+
constructor(message: string);
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
export declare class InvalidPageCriteria extends ERMrestError {
|
|
1463
|
+
constructor(message: string, path?: string);
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
export declare class InvalidServerResponse extends ERMrestError {
|
|
1467
|
+
constructor(uri: string, data: any, logAction: string);
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
export declare class InvalidSortCriteria extends ERMrestError {
|
|
1471
|
+
constructor(message: string, path?: string);
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
/**
|
|
1475
|
+
* @class
|
|
1476
|
+
* @param {Reference} reference column's reference
|
|
1477
|
+
* @param {Key} key the key
|
|
1478
|
+
* @desc
|
|
1479
|
+
* Constructor for KeyPseudoColumn. This class is a wrapper for {@link Key}.
|
|
1480
|
+
* This class extends the {@link ReferenceColumn}
|
|
1481
|
+
*/
|
|
1482
|
+
declare class KeyPseudoColumn extends ReferenceColumn {
|
|
1483
|
+
/**
|
|
1484
|
+
* @type {boolean}
|
|
1485
|
+
* @desc indicates that this object represents a PseudoColumn.
|
|
1486
|
+
*/
|
|
1487
|
+
isPseudo: boolean;
|
|
1488
|
+
/**
|
|
1489
|
+
* @type {boolean}
|
|
1490
|
+
* @desc Indicates that this ReferenceColumn is a key.
|
|
1491
|
+
*/
|
|
1492
|
+
isKey: boolean;
|
|
1493
|
+
/**
|
|
1494
|
+
* @type {Key}
|
|
1495
|
+
* @desc The Key object that this PseudoColumn is created based on
|
|
1496
|
+
*/
|
|
1497
|
+
key: Key;
|
|
1498
|
+
/**
|
|
1499
|
+
* the table that the key belongs to
|
|
1500
|
+
*/
|
|
1501
|
+
table: Table_2;
|
|
1502
|
+
/**
|
|
1503
|
+
* the constraint name for the key
|
|
1504
|
+
* TODO should we rename this? or change it to private?
|
|
1505
|
+
*/
|
|
1506
|
+
_constraintName: string;
|
|
1507
|
+
constructor(reference: Reference, key: Key, sourceObjectWrapper?: SourceObjectWrapper, name?: string);
|
|
1508
|
+
/**
|
|
1509
|
+
* Return the value that should be presented for this column.
|
|
1510
|
+
* It usually is a self-link to the given row of data.
|
|
1511
|
+
*
|
|
1512
|
+
* The following is the logic:
|
|
1513
|
+
* 1. if the key data is not present, return null.
|
|
1514
|
+
* 2. Otherwise if key has markdown pattern, return it.
|
|
1515
|
+
* 3. Otherwise try to generate the value in `col1:col2` format. if it resulted in empty string return null.
|
|
1516
|
+
* - If any of the constituent columnhas markdown don't add self-link, otherwise add the self-link.
|
|
1517
|
+
* @param {Object} data given raw data for the table columns
|
|
1518
|
+
* @param {String=} context the app context (optional)
|
|
1519
|
+
* @param {Object=} templateVariables the template variables that should be used (optional)
|
|
1520
|
+
* @param {Object=} options (optional)
|
|
1521
|
+
* @return {Object} A key value pair containing value and isHTML that detemrines the presentation.
|
|
1522
|
+
*/
|
|
1523
|
+
formatPresentation(data: any, context?: string, templateVariables?: any, options?: any): any;
|
|
1524
|
+
sourceFormatPresentation(templateVariables: any, columnValue: any, mainTuple: Tuple): any;
|
|
1525
|
+
_determineSortable(): void;
|
|
1526
|
+
get name(): string;
|
|
1527
|
+
get displayname(): DisplayName;
|
|
1528
|
+
/**
|
|
1529
|
+
* use the underlying column comment if available, otherwise get it from the key
|
|
1530
|
+
* (similar to displayname logic)
|
|
1531
|
+
*/
|
|
1532
|
+
get comment(): CommentType;
|
|
1533
|
+
get default(): undefined;
|
|
1534
|
+
get display(): any;
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
export declare const logError: typeof ErrorService.logError;
|
|
1538
|
+
|
|
1539
|
+
export declare class MalformedURIError extends ERMrestError {
|
|
1540
|
+
constructor(message: string);
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
export declare class NoConnectionError extends ERMrestError {
|
|
1544
|
+
constructor(message: string);
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
export declare class NoDataChangedError extends ERMrestError {
|
|
1548
|
+
constructor(message: string);
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
export declare class NotFoundError extends ERMrestError {
|
|
1552
|
+
constructor(status: string, message: string);
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1555
|
+
declare class NotNullFacetFilter {
|
|
1556
|
+
facetFilterKey: string;
|
|
1557
|
+
constructor();
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
export declare const onHTTPSuccess: typeof HTTPService.setOnHTTPSuccess;
|
|
1561
|
+
|
|
1562
|
+
export { onload_2 as onload }
|
|
1563
|
+
|
|
1564
|
+
/**
|
|
1565
|
+
* Constructs a Page. A Page is a collection of Tuples. A page can contain no
|
|
1566
|
+
* data, but the reference is still valid. This is useful if you want to use
|
|
1567
|
+
* the reference later and need to represent a page, but you haven't read any
|
|
1568
|
+
* data yet.
|
|
1569
|
+
*/
|
|
1570
|
+
declare class Page {
|
|
1571
|
+
private _ref;
|
|
1572
|
+
private _etag;
|
|
1573
|
+
private _linkedData;
|
|
1574
|
+
private _linkedDataRIDs;
|
|
1575
|
+
private _data;
|
|
1576
|
+
private _rightsSummary;
|
|
1577
|
+
private _associationRightsSummary;
|
|
1578
|
+
private _extraData?;
|
|
1579
|
+
private _extraLinkedData?;
|
|
1580
|
+
private _hasNext;
|
|
1581
|
+
private _hasPrevious;
|
|
1582
|
+
private _tuples?;
|
|
1583
|
+
private _length?;
|
|
1584
|
+
private _content?;
|
|
1585
|
+
private _templateVariables?;
|
|
1586
|
+
constructor(reference: Reference, etag: string | null, data: any[], hasPrevious: boolean, hasNext: boolean, extraData?: any);
|
|
1587
|
+
get extraData(): any;
|
|
1588
|
+
get extraLinkedData(): any;
|
|
1589
|
+
/**
|
|
1590
|
+
* The page's associated reference.
|
|
1591
|
+
*/
|
|
1592
|
+
get reference(): Reference | RelatedReference;
|
|
1593
|
+
/**
|
|
1594
|
+
* An array of processed tuples. The results will be processed
|
|
1595
|
+
* according to the contextualized scheme (model) of this reference.
|
|
1596
|
+
*
|
|
1597
|
+
* Usage:
|
|
1598
|
+
* ```
|
|
1599
|
+
* for (var i=0, len=page.tuples.length; i<len; i++) {
|
|
1600
|
+
* var tuple = page.tuples[i];
|
|
1601
|
+
* console.log("Tuple:", tuple.displayname.value, "has values:", tuple.values);
|
|
1602
|
+
* }
|
|
1603
|
+
* ```
|
|
1604
|
+
*/
|
|
1605
|
+
get tuples(): Tuple[];
|
|
1606
|
+
/**
|
|
1607
|
+
* the page length (number of rows in the page)
|
|
1608
|
+
*/
|
|
1609
|
+
get length(): number;
|
|
1610
|
+
/**
|
|
1611
|
+
* Whether there is more entities before this page
|
|
1612
|
+
*/
|
|
1613
|
+
get hasPrevious(): boolean;
|
|
1614
|
+
/**
|
|
1615
|
+
* A reference to the previous set of results.
|
|
1616
|
+
* Will return null if the sortObject of reference is missing or is invalid
|
|
1617
|
+
*
|
|
1618
|
+
* Usage:
|
|
1619
|
+
* ```
|
|
1620
|
+
* if (reference.previous) {
|
|
1621
|
+
* // more tuples in the 'previous' direction are available
|
|
1622
|
+
* reference.previous.read(10).then(
|
|
1623
|
+
* ...
|
|
1624
|
+
* );
|
|
1625
|
+
* }
|
|
1626
|
+
* ```
|
|
1627
|
+
*/
|
|
1628
|
+
get previous(): Reference | null;
|
|
1629
|
+
/**
|
|
1630
|
+
* Whether there is more entities after this page
|
|
1631
|
+
*/
|
|
1632
|
+
get hasNext(): boolean;
|
|
1633
|
+
/**
|
|
1634
|
+
* A reference to the next set of results.
|
|
1635
|
+
* Will return null if the sortObject of reference is missing or is invalid
|
|
1636
|
+
*
|
|
1637
|
+
* Usage:
|
|
1638
|
+
* ```
|
|
1639
|
+
* if (reference.next) {
|
|
1640
|
+
* // more tuples in the 'next' direction are available
|
|
1641
|
+
* reference.next.read(10).then(
|
|
1642
|
+
* ...
|
|
1643
|
+
* );
|
|
1644
|
+
* }
|
|
1645
|
+
* ```
|
|
1646
|
+
*/
|
|
1647
|
+
get next(): Reference | null;
|
|
1648
|
+
/**
|
|
1649
|
+
* Returns previous or next page
|
|
1650
|
+
* Clients should not directly use this. This is used in next and previous getters.
|
|
1651
|
+
* @param next whether we want the next page or previous
|
|
1652
|
+
* @private
|
|
1653
|
+
*/
|
|
1654
|
+
private _getSiblingReference;
|
|
1655
|
+
getContent(templateVariables?: any): string | null;
|
|
1656
|
+
/**
|
|
1657
|
+
* HTML representation of the whole page which uses table-display annotation.
|
|
1658
|
+
* If markdownPattern is defined then renderTemplate is called to get the correct display.
|
|
1659
|
+
* In case of no such markdownPattern is defined output is displayed in form of
|
|
1660
|
+
* unordered list with displayname as text content of the list.
|
|
1661
|
+
* For more info you can refer {ERM.reference.display}
|
|
1662
|
+
*
|
|
1663
|
+
* Usage:
|
|
1664
|
+
*```
|
|
1665
|
+
* var content = page.content;
|
|
1666
|
+
* if (content) {
|
|
1667
|
+
* console.log(content);
|
|
1668
|
+
* }
|
|
1669
|
+
*```
|
|
1670
|
+
*
|
|
1671
|
+
* It will return:
|
|
1672
|
+
* 1. the rendered page_markdown_pattern if it's defined.
|
|
1673
|
+
* 2. the rendered row_markdown_pattern if it's defined.
|
|
1674
|
+
* 3. list of links that point to the row. Caption is going to be the row-name.
|
|
1675
|
+
*/
|
|
1676
|
+
get content(): string | null;
|
|
1677
|
+
get templateVariables(): any[];
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
export { parse }
|
|
1681
|
+
|
|
1682
|
+
export declare class PreconditionFailedError extends ERMrestError {
|
|
1683
|
+
constructor(status: string, message: string);
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1686
|
+
export { printf }
|
|
1687
|
+
|
|
1688
|
+
export { processMarkdownPattern }
|
|
1689
|
+
|
|
1690
|
+
/**
|
|
1691
|
+
* If you want to create an object of this type, use the `createPseudoColumn` method.
|
|
1692
|
+
* This will only be used for general purpose pseudo-columns, using that method ensures That
|
|
1693
|
+
* we're creating the more specific object instead. Therefore only these cases should
|
|
1694
|
+
* be using this type of object:
|
|
1695
|
+
* 1. When sourceObject has aggregate
|
|
1696
|
+
* 2. When sourceObject has a path that is not just an outbound fk, or it doesn't define a related
|
|
1697
|
+
* entity (inbound or p&b association)
|
|
1698
|
+
*
|
|
1699
|
+
* @memberof ERMrest
|
|
1700
|
+
* @param {Reference} reference column's reference
|
|
1701
|
+
* @param {Column} column the column that this pseudo-column is representing
|
|
1702
|
+
* @param {SourceObjectWrapper} sourceObjectWrapper the sourceObjectWrapper object (might be undefined)
|
|
1703
|
+
* @param {string=} name to avoid processing the name again, this might be undefined.
|
|
1704
|
+
* @param {Tuple=} mainTuple if the reference is referring to just one tuple, this is defined.
|
|
1705
|
+
* @constructor
|
|
1706
|
+
* @class
|
|
1707
|
+
*/
|
|
1708
|
+
declare class PseudoColumn extends ReferenceColumn {
|
|
1709
|
+
/**
|
|
1710
|
+
* indicates that this object represents a PseudoColumn.
|
|
1711
|
+
*/
|
|
1712
|
+
isPseudo: boolean;
|
|
1713
|
+
isPathColumn: boolean;
|
|
1714
|
+
/**
|
|
1715
|
+
* If the pseudo-column is connected via a path to the table or not.
|
|
1716
|
+
*/
|
|
1717
|
+
hasPath: boolean;
|
|
1718
|
+
/**
|
|
1719
|
+
* If the pseudoColumn is in entity mode
|
|
1720
|
+
*/
|
|
1721
|
+
isEntityMode: boolean;
|
|
1722
|
+
/**
|
|
1723
|
+
* If the pseudoColumn is referring to a unique row (the path is one to one)
|
|
1724
|
+
*/
|
|
1725
|
+
isUnique: boolean;
|
|
1726
|
+
/**
|
|
1727
|
+
* If aggregate function is defined on the column.
|
|
1728
|
+
*/
|
|
1729
|
+
hasAggregate: boolean;
|
|
1730
|
+
baseColumn: Column;
|
|
1731
|
+
constructor(reference: Reference, column: Column, sourceObjectWrapper: SourceObjectWrapper, name?: string, mainTuple?: Tuple);
|
|
1732
|
+
/**
|
|
1733
|
+
* Format the presentation value corresponding to this pseudo-column definition.
|
|
1734
|
+
* 1. If source is not in entity mode: use the column's heuristic
|
|
1735
|
+
* 2. Otherwise if it's not a path, apply the same logic as KeyPseudoColumn presentation based on the key.
|
|
1736
|
+
* 2. Otherwise if path is one to one (all outbound), use the same logic as ForeignKeyPseudoColumn based on last fk.
|
|
1737
|
+
* 3. Otherwise return null value.
|
|
1738
|
+
*
|
|
1739
|
+
* @param {Object} data the raw data of the table
|
|
1740
|
+
* @param {String=} context the app context (optional)
|
|
1741
|
+
* @param {Object=} templateVariables the template variables that should be used (optional)
|
|
1742
|
+
* @param {Object=} options (optional)
|
|
1743
|
+
* @returns {Object} A key value pair containing value and isHTML that detemrines the presentation.
|
|
1744
|
+
*/
|
|
1745
|
+
formatPresentation(data?: any, context?: string, templateVariables?: any, options?: any): any;
|
|
1746
|
+
sourceFormatPresentation(templateVariables: any, columnValue: any, mainTuple: Tuple): any;
|
|
1747
|
+
/**
|
|
1748
|
+
* Returns a promise that gets resolved with list of aggregated values in the same
|
|
1749
|
+
* order of tuples of the page that is passed.
|
|
1750
|
+
* Each returned value has the following attributes:
|
|
1751
|
+
* - value
|
|
1752
|
+
* - isHTML
|
|
1753
|
+
* - templateVariables: the template variables that the client uses to eventually pass to sourceFormatPresentation
|
|
1754
|
+
*
|
|
1755
|
+
* implementation Notes:
|
|
1756
|
+
* 1. This function will take care of url limitation. It might generate multiple
|
|
1757
|
+
* ermrest requests based on the url length, and will resolve the promise when
|
|
1758
|
+
* all the requests have been succeeded. If we cannot fit all the requests, an
|
|
1759
|
+
* error will be thrown.
|
|
1760
|
+
* 2. Only in case of entity scalar aggregate we are going to get all the row data.
|
|
1761
|
+
* In other cases, the returned data will only include the scalar value.
|
|
1762
|
+
* 3. Regarding the returned value:
|
|
1763
|
+
* 3.0. Null and empty string values are treated the same way as any array column.
|
|
1764
|
+
* We are going to show the special value for them.
|
|
1765
|
+
* 3.1. If it's an array aggregate:
|
|
1766
|
+
* 3.1.1. array_display will dictate how we should join the values (csv, olist, ulist, raw).
|
|
1767
|
+
* 3.1.2. array_options will dictate the sort and length criteria.
|
|
1768
|
+
* 3.1.3. Based on entity/scalar mode:
|
|
1769
|
+
* 3.1.3.1. In scalar mode, only pre_format will be applied to each value.
|
|
1770
|
+
* 3.1.3.2. In entity mode, we are going to return list of row_names derived from `row_name/compact`.
|
|
1771
|
+
* 3.2. Otherwise we will only apply the pre_format annotation for the column.
|
|
1772
|
+
*
|
|
1773
|
+
* @param {Page} page the page object of main (current) refernece
|
|
1774
|
+
* @param {Object} contextHeaderParams the object that we want to log.
|
|
1775
|
+
* @return {Promise}
|
|
1776
|
+
*/
|
|
1777
|
+
getAggregatedValue(page: Page, contextHeaderParams?: any): Promise<{
|
|
1778
|
+
value: any;
|
|
1779
|
+
isHTML: boolean;
|
|
1780
|
+
templateVariables: any;
|
|
1781
|
+
}[]>;
|
|
1782
|
+
protected _determineSortable(): void;
|
|
1783
|
+
protected _determineInputDisabled(context: string): boolean | {
|
|
1784
|
+
message: string;
|
|
1785
|
+
};
|
|
1786
|
+
/**
|
|
1787
|
+
* If the first foreign key is outbound, this function will return the value that this pseudo-column represents.
|
|
1788
|
+
*
|
|
1789
|
+
* The first fk must be outbound because the path is generated from the table that the first fk refers to. This is
|
|
1790
|
+
* useful for fetching the values of wait-fors in the entry contexts. Since the main record might not be available yet,
|
|
1791
|
+
* we're starting from the fk table.
|
|
1792
|
+
*
|
|
1793
|
+
* Ideally this and getAggregatedValue should be merged, these are the differences:
|
|
1794
|
+
* - for this function agg fn is not required.
|
|
1795
|
+
* - this function requires the first fk to be outbound, while getAggregatedValue doesn't.
|
|
1796
|
+
* - the generated path here ignores the first hop.
|
|
1797
|
+
* - if the key value for any of the rows is null, this will only ignore that row (getAggregatedValue will just give up and return empty).
|
|
1798
|
+
*
|
|
1799
|
+
* @param {any} data the submission data
|
|
1800
|
+
* @param {Record<string, any>} contextHeaderParams
|
|
1801
|
+
*/
|
|
1802
|
+
getFirstOutboundValue(data: any[], contextHeaderParams?: Record<string, any>): Promise<any[]>;
|
|
1803
|
+
private _key?;
|
|
1804
|
+
private _aggregateFn?;
|
|
1805
|
+
private _reference?;
|
|
1806
|
+
private _canUseScalarProjection?;
|
|
1807
|
+
/**
|
|
1808
|
+
* The tooltip that should be used for this column.
|
|
1809
|
+
* It will return the first applicable rule:
|
|
1810
|
+
* 1. comment that is defined on the sourceObject, use it.
|
|
1811
|
+
* 2. if aggregate and scalar use the "<function> <col_displayname>"
|
|
1812
|
+
* 3. if aggregate and entity use the "<function> <table_displayname>"
|
|
1813
|
+
* 3. In entity mode, return the table's displayname.
|
|
1814
|
+
* 4. In scalar return the column's displayname.
|
|
1815
|
+
*/
|
|
1816
|
+
get comment(): CommentType;
|
|
1817
|
+
/**
|
|
1818
|
+
* The tooltip that should be used for this column.
|
|
1819
|
+
* It will return the first applicable rule:
|
|
1820
|
+
* 1. comment that is defined on the sourceObject, use it.
|
|
1821
|
+
* 2. if aggregate and scalar use the "<function> <col_displayname>"
|
|
1822
|
+
* 3. if aggregate and entity use the "<function> <table_displayname>"
|
|
1823
|
+
* 3. In entity mode, return the table's displayname.
|
|
1824
|
+
* 4. In scalar return the column's displayname.
|
|
1825
|
+
*/
|
|
1826
|
+
get displayname(): DisplayName;
|
|
1827
|
+
/**
|
|
1828
|
+
* If the pseudoColumn is in entity mode will return the key that this column represents
|
|
1829
|
+
*/
|
|
1830
|
+
get key(): Key | null;
|
|
1831
|
+
get aggregateFn(): string | null;
|
|
1832
|
+
/**
|
|
1833
|
+
* Returns a reference to the current pseudo-column
|
|
1834
|
+
* This is how it behaves:
|
|
1835
|
+
* 1. If pseudo-column has no path, it will return the base reference.
|
|
1836
|
+
* 3. if mainTuple is available, create the reference based on this path:
|
|
1837
|
+
* <pseudoColumnSchema:PseudoColumnTable>/<path from pseudo-column to main table>/<facets based on value of shortestkey of main table>
|
|
1838
|
+
* 4. Otherwise create the path by traversing the path
|
|
1839
|
+
*/
|
|
1840
|
+
get reference(): Reference | RelatedReference;
|
|
1841
|
+
set reference(ref: Reference);
|
|
1842
|
+
get default(): unknown;
|
|
1843
|
+
get nullok(): boolean;
|
|
1844
|
+
/**
|
|
1845
|
+
* Whether we can use the raw column in the projection list or not.
|
|
1846
|
+
*
|
|
1847
|
+
* If we only need the value of scalar column and none of the other columns of the
|
|
1848
|
+
* all-outbound path then we can simply use the scalar projection.
|
|
1849
|
+
* Therefore the pseudo-column must:
|
|
1850
|
+
* - be all-outbound path in scalar mode
|
|
1851
|
+
* - the leaf column cannot have any column_display annotation
|
|
1852
|
+
* - the leaf column cannot be sorted or doesn't have a sort based on other columns of the table.
|
|
1853
|
+
*/
|
|
1854
|
+
get canUseScalarProjection(): boolean;
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1857
|
+
export declare class QueryTimeoutError extends ERMrestError {
|
|
1858
|
+
constructor(status: string, message: string);
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
declare class RangeFacetFilter extends FacetFilter {
|
|
1862
|
+
min: unknown;
|
|
1863
|
+
minExclusive: boolean;
|
|
1864
|
+
max: unknown;
|
|
1865
|
+
maxExclusive: boolean;
|
|
1866
|
+
facetFilterKey: string;
|
|
1867
|
+
constructor(min: unknown, minExclusive: boolean, max: unknown, maxExclusive: boolean, column: Column);
|
|
1868
|
+
/**
|
|
1869
|
+
* String representation of range filter. With the format of:
|
|
1870
|
+
*
|
|
1871
|
+
* - both min and max defined: `{{min}}-{{max}}`
|
|
1872
|
+
* - only min defined: `> {{min}}`
|
|
1873
|
+
* - only max defined: `< {{max}}`
|
|
1874
|
+
*/
|
|
1875
|
+
toString(): string;
|
|
1876
|
+
/**
|
|
1877
|
+
* JSON representation of range filter.
|
|
1878
|
+
*/
|
|
1879
|
+
toJSON(): any;
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
/**
|
|
1883
|
+
* Constructs a Reference object.
|
|
1884
|
+
*
|
|
1885
|
+
* For most uses, maybe all, of the library, the Reference
|
|
1886
|
+
* will be the main object that the client will interact with. References
|
|
1887
|
+
* are immutable objects and therefore can be safely passed around and
|
|
1888
|
+
* used between multiple client components without risk that the underlying
|
|
1889
|
+
* reference to server-side resources could change.
|
|
1890
|
+
*
|
|
1891
|
+
* Usage:
|
|
1892
|
+
* Clients _do not_ directly access this constructor.
|
|
1893
|
+
* See {@link resolve}.
|
|
1894
|
+
* @param location - The location object generated from parsing the URI
|
|
1895
|
+
* @param catalog - The catalog object. Since location.catalog is just an id, we need the actual catalog object too.
|
|
1896
|
+
*/
|
|
1897
|
+
declare class Reference {
|
|
1898
|
+
/**
|
|
1899
|
+
* The members of this object are _contextualized references_.
|
|
1900
|
+
*
|
|
1901
|
+
* These references will behave and reflect state according to the mode.
|
|
1902
|
+
* For instance, in a `record` mode on a table some columns may be
|
|
1903
|
+
* hidden.
|
|
1904
|
+
*
|
|
1905
|
+
* Usage:
|
|
1906
|
+
* ```
|
|
1907
|
+
* // assumes we have an uncontextualized `Reference` object
|
|
1908
|
+
* var recordref = reference.contextualize.detailed;
|
|
1909
|
+
* ```
|
|
1910
|
+
* The `reference` is unchanged, while `recordref` now represents a
|
|
1911
|
+
* reconfigured reference. For instance, `recordref.columns` may be
|
|
1912
|
+
* different compared to `reference.columns`.
|
|
1913
|
+
*/
|
|
1914
|
+
contextualize: Contextualize;
|
|
1915
|
+
/**
|
|
1916
|
+
* The function that can be used to perform aggregation operations on columns in this reference.
|
|
1917
|
+
*/
|
|
1918
|
+
aggregate: ReferenceAggregateFn;
|
|
1919
|
+
private _context;
|
|
1920
|
+
private _location;
|
|
1921
|
+
private _server;
|
|
1922
|
+
private _table;
|
|
1923
|
+
private _facetBaseTable;
|
|
1924
|
+
private _shortestKey;
|
|
1925
|
+
private _bulkCreateForeignKeyObject?;
|
|
1926
|
+
private _canCreate?;
|
|
1927
|
+
private _canCreateReason?;
|
|
1928
|
+
private _canRead?;
|
|
1929
|
+
private _canUpdate?;
|
|
1930
|
+
private _canUpdateReason?;
|
|
1931
|
+
private _canDelete?;
|
|
1932
|
+
private _canUseTRS?;
|
|
1933
|
+
private _canUseTCRS?;
|
|
1934
|
+
private _readPath?;
|
|
1935
|
+
private _readAttributeGroupPathProps_cached?;
|
|
1936
|
+
private _display?;
|
|
1937
|
+
private _defaultExportTemplate?;
|
|
1938
|
+
private _csvDownloadLink?;
|
|
1939
|
+
private _searchColumns?;
|
|
1940
|
+
private _cascadingDeletedItems?;
|
|
1941
|
+
private _referenceColumns?;
|
|
1942
|
+
private _related?;
|
|
1943
|
+
private _facetColumns?;
|
|
1944
|
+
private _activeList?;
|
|
1945
|
+
private _citation?;
|
|
1946
|
+
private _googleDatasetMetadata?;
|
|
1947
|
+
protected _displayname?: DisplayName;
|
|
1948
|
+
protected _comment?: CommentType | null;
|
|
1949
|
+
protected _pseudoColumn?: VisibleColumn;
|
|
1950
|
+
constructor(location: Location_2, catalog: Catalog, displayname?: DisplayName, comment?: CommentType, pseudoColumn?: VisibleColumn);
|
|
1951
|
+
get server(): Server;
|
|
1952
|
+
/**
|
|
1953
|
+
* The table object for this reference
|
|
1954
|
+
*/
|
|
1955
|
+
get table(): Table_2;
|
|
1956
|
+
/**
|
|
1957
|
+
* The base table object that is used for faceting,
|
|
1958
|
+
* if there's a join in path, this will return a different object from .table
|
|
1959
|
+
*/
|
|
1960
|
+
get facetBaseTable(): Table_2;
|
|
1961
|
+
get shortestKey(): Column[];
|
|
1962
|
+
/**
|
|
1963
|
+
* the pseudo column that this reference is based on
|
|
1964
|
+
*
|
|
1965
|
+
*/
|
|
1966
|
+
get pseudoColumn(): VisibleColumn | undefined;
|
|
1967
|
+
setPseudoColumn(value: VisibleColumn): void;
|
|
1968
|
+
/**
|
|
1969
|
+
* the reference's context
|
|
1970
|
+
*/
|
|
1971
|
+
get context(): string;
|
|
1972
|
+
/**
|
|
1973
|
+
* used by Contextualize to set the context of the reference
|
|
1974
|
+
*/
|
|
1975
|
+
setContext(value: string): void;
|
|
1976
|
+
/**
|
|
1977
|
+
* The display name for this reference.
|
|
1978
|
+
* displayname.isHTML will return true/false
|
|
1979
|
+
* displayname.value has the value
|
|
1980
|
+
*/
|
|
1981
|
+
get displayname(): DisplayName;
|
|
1982
|
+
/**
|
|
1983
|
+
* The comment for this reference.
|
|
1984
|
+
*/
|
|
1985
|
+
get comment(): CommentType | null;
|
|
1986
|
+
/**
|
|
1987
|
+
* The display mode configuration for this reference.
|
|
1988
|
+
* This returns an object with properties for configuring how the reference should be displayed:
|
|
1989
|
+
*
|
|
1990
|
+
* - `type`: The display type ('table', 'markdown', or 'module')
|
|
1991
|
+
* - `hideRowCount`: Whether to hide the row count
|
|
1992
|
+
* - `showFaceting`: Whether faceting is enabled
|
|
1993
|
+
* - `maxFacetDepth`: Maximum facet depth allowed
|
|
1994
|
+
* - `facetPanelOpen`: Whether the facet panel should be open by default
|
|
1995
|
+
* - `showSavedQuery`: Whether saved query UI should be shown
|
|
1996
|
+
*
|
|
1997
|
+
* For markdown type displays, it also includes:
|
|
1998
|
+
* - `_rowMarkdownPattern`: The markdown pattern for rows
|
|
1999
|
+
* - `_pageMarkdownPattern`: The markdown pattern for pages
|
|
2000
|
+
* - `_separator`, `_prefix`, `_suffix`: Markdown formatting options
|
|
2001
|
+
*
|
|
2002
|
+
* @returns The display configuration object
|
|
2003
|
+
*/
|
|
2004
|
+
get display(): ReferenceDisplay;
|
|
2005
|
+
/**
|
|
2006
|
+
* The string form of the `URI` for this reference.
|
|
2007
|
+
* NOTE: It is not understandable by ermrest, and it also doesn't have the modifiers (sort, page).
|
|
2008
|
+
* Should not be used for sending requests to ermrest, use this.location.ermrestCompactUri instead.
|
|
2009
|
+
*/
|
|
2010
|
+
get uri(): string;
|
|
2011
|
+
/**
|
|
2012
|
+
* Location object that has uri of current reference
|
|
2013
|
+
*/
|
|
2014
|
+
get location(): Location_2;
|
|
2015
|
+
/**
|
|
2016
|
+
* this is used when we want to change the location of a reference without creating a new one.
|
|
2017
|
+
* it will also attach the current reference to the location object.
|
|
2018
|
+
*/
|
|
2019
|
+
setLocation(loc: Location_2): void;
|
|
2020
|
+
get readPath(): string;
|
|
2021
|
+
/**
|
|
2022
|
+
* This will generate a new unfiltered reference each time.
|
|
2023
|
+
* Returns a reference that points to all entities of current table
|
|
2024
|
+
*
|
|
2025
|
+
* NOTE: This will not have any context, and always returns a Reference object (not RelatedReference or other special reference types).
|
|
2026
|
+
*/
|
|
2027
|
+
get unfilteredReference(): Reference;
|
|
2028
|
+
/**
|
|
2029
|
+
* App-specific URL
|
|
2030
|
+
*
|
|
2031
|
+
* @throws {Error} if `_appLinkFn` is not defined.
|
|
2032
|
+
*/
|
|
2033
|
+
get appLink(): string;
|
|
2034
|
+
/**
|
|
2035
|
+
* Returns a uri that will properly generate the download link for a csv document
|
|
2036
|
+
* NOTE It will honor the visible columns in `export` context
|
|
2037
|
+
*
|
|
2038
|
+
**/
|
|
2039
|
+
get csvDownloadLink(): string | null;
|
|
2040
|
+
/**
|
|
2041
|
+
* The default information that we want to be logged. This includes:
|
|
2042
|
+
* - catalog, schema_table
|
|
2043
|
+
* TODO Evaluate whether we even need this function
|
|
2044
|
+
*/
|
|
2045
|
+
get defaultLogInfo(): {
|
|
2046
|
+
catalog: string;
|
|
2047
|
+
schema_table: string;
|
|
2048
|
+
};
|
|
2049
|
+
/**
|
|
2050
|
+
* The object that can be logged to capture the filter state of the reference.
|
|
2051
|
+
* The return object can have:
|
|
2052
|
+
* - filters: the facet object.
|
|
2053
|
+
* - custom_filters:
|
|
2054
|
+
* - the filter strings that parser couldn't turn to facet.
|
|
2055
|
+
* - if we could turn the custom filter to facet, this will return `true`
|
|
2056
|
+
* - cfacet: if there's a cfacet it will be 1
|
|
2057
|
+
* - cfacet_str: if cfacet=1, it will be displayname of cfacet.
|
|
2058
|
+
* - cfacet_path: if cfacet=1, it will be ermrest path of cfacet.
|
|
2059
|
+
* This function creates a new object everytime that it's called, so it
|
|
2060
|
+
* can be manipulated further.
|
|
2061
|
+
*/
|
|
2062
|
+
get filterLogInfo(): {
|
|
2063
|
+
cfacet?: 1;
|
|
2064
|
+
cfacet_str?: unknown;
|
|
2065
|
+
cfacet_path?: string;
|
|
2066
|
+
filters?: unknown;
|
|
2067
|
+
custom_filters?: string | boolean;
|
|
2068
|
+
};
|
|
2069
|
+
/**
|
|
2070
|
+
* This will ensure the ermrestCompactPath is also
|
|
2071
|
+
* using the same aliases that we are going to use for allOutbounds
|
|
2072
|
+
* I'm attaching this to Reference so it's cached and we don't have to
|
|
2073
|
+
* compute it multiple times
|
|
2074
|
+
* @private
|
|
2075
|
+
*/
|
|
2076
|
+
get _readAttributeGroupPathProps(): any;
|
|
2077
|
+
/**
|
|
2078
|
+
* The array of column definitions which represent the model of
|
|
2079
|
+
* the resources accessible via this reference.
|
|
2080
|
+
*
|
|
2081
|
+
* _Note_: in database jargon, technically everything returned from
|
|
2082
|
+
* ERMrest is a 'tuple' or a 'relation'. A tuple consists of attributes
|
|
2083
|
+
* and the definitions of those attributes are represented here as the
|
|
2084
|
+
* array of {@link Column}s. The column definitions may be
|
|
2085
|
+
* contextualized (see {@link Reference#contextualize}).
|
|
2086
|
+
*
|
|
2087
|
+
* Usage:
|
|
2088
|
+
* ```
|
|
2089
|
+
* for (var i=0, len=reference.columns.length; i<len; i++) {
|
|
2090
|
+
* var col = reference.columns[i];
|
|
2091
|
+
* console.log("Column name:", col.name, "has display name:", col.displayname);
|
|
2092
|
+
* }
|
|
2093
|
+
* ```
|
|
2094
|
+
*/
|
|
2095
|
+
get columns(): VisibleColumn[];
|
|
2096
|
+
/**
|
|
2097
|
+
* Generate the list of columns for this reference based on context and annotations
|
|
2098
|
+
*/
|
|
2099
|
+
generateColumnsList(tuple?: Tuple, columnsList?: any[], dontChangeReference?: boolean, skipLog?: boolean): ReferenceColumn[];
|
|
2100
|
+
/**
|
|
2101
|
+
* NOTE this will not map the entity choice pickers, use "generateFacetColumns" instead.
|
|
2102
|
+
* so directly using this is not recommended.
|
|
2103
|
+
*/
|
|
2104
|
+
get facetColumns(): FacetColumn[];
|
|
2105
|
+
/**
|
|
2106
|
+
* Returns the facets that should be represented to the user.
|
|
2107
|
+
* It will return a promise resolved with the following object:
|
|
2108
|
+
* {
|
|
2109
|
+
* facetColumns: <an array of FacetColumn objects>
|
|
2110
|
+
* issues: <if null it means that there wasn't any issues, otherwise will be a UnsupportedFilters object>
|
|
2111
|
+
* }
|
|
2112
|
+
*
|
|
2113
|
+
* - If `filter` context is not defined for the table, following heuristics will be used:
|
|
2114
|
+
* - All the visible columns in compact context.
|
|
2115
|
+
* - All the related entities in detailed context.
|
|
2116
|
+
* - This function will modify the Reference.location to reflect the preselected filters
|
|
2117
|
+
* per annotation as well as validation.
|
|
2118
|
+
* - This function will validate the facets in the url, by doing the following (any invalid filter will be ignored):
|
|
2119
|
+
* - Making sure given `source` or `sourcekey` are valid
|
|
2120
|
+
* - If `source_domain` is passed,
|
|
2121
|
+
* - Making sure `source_domain.table` and `source_domain.schema` are valid
|
|
2122
|
+
* - Using `source_domain.column` instead of end column in case of scalars
|
|
2123
|
+
* - Sending request to fetch the rows associated with the entity choices,
|
|
2124
|
+
* and ignoring the ones that don't return any result.
|
|
2125
|
+
* - The valid filters in the url will either be matched with an existing facet,
|
|
2126
|
+
* or result in a new facet column.
|
|
2127
|
+
* Usage:
|
|
2128
|
+
* ```
|
|
2129
|
+
* reference.generateFacetColumns().then((result) => {
|
|
2130
|
+
* var newRef = result.facetColumns[0].addChoiceFilters(['value']);
|
|
2131
|
+
* var newRef2 = newRef.facetColumns[1].addSearchFilter('text 1');
|
|
2132
|
+
* var newRef3 = newRef2.facetColumns[2].addRangeFilter(1, 2);
|
|
2133
|
+
* var newRef4 = newRef3.facetColumns[3].removeAllFilters();
|
|
2134
|
+
* for (var i=0, len=newRef4.facetColumns.length; i<len; i++) {
|
|
2135
|
+
* var fc = reference.facetColumns[i];
|
|
2136
|
+
* console.log("Column name:", fc.column.name, "has following facets:", fc.filters);
|
|
2137
|
+
* }
|
|
2138
|
+
* });
|
|
2139
|
+
* ```
|
|
2140
|
+
*/
|
|
2141
|
+
generateFacetColumns(): Promise<{
|
|
2142
|
+
facetColumns: FacetColumn[];
|
|
2143
|
+
issues: UnsupportedFilters | null;
|
|
2144
|
+
}>;
|
|
2145
|
+
/**
|
|
2146
|
+
* This is only added so _applyFilters in facet-column can use it.
|
|
2147
|
+
* SHOULD NOT be used outside of this library.
|
|
2148
|
+
*/
|
|
2149
|
+
manuallySetFacetColumns(facetCols: FacetColumn[]): void;
|
|
2150
|
+
/**
|
|
2151
|
+
* The "related" references. Relationships are defined by foreign key
|
|
2152
|
+
* references between {@link Table}s. Those references can be
|
|
2153
|
+
* considered "outbound" where the table has FKRs to other entities or
|
|
2154
|
+
* "inbound" where other entities have FKRs to this entity. Finally,
|
|
2155
|
+
* entities can be "associated" by means of associative entities. Those
|
|
2156
|
+
* are entities in another table that establish _many-to-many_
|
|
2157
|
+
* relationships between entities. If this help `A <- B -> C` where
|
|
2158
|
+
* entities in `B` establish relationships between entities in `A` and
|
|
2159
|
+
* `C`. Thus entities in `A` and `C` may be associated and we may
|
|
2160
|
+
* ignore `B` and think of this relationship as `A <-> C`, unless `B`
|
|
2161
|
+
* has other moderating attributes, for instance that indicate the
|
|
2162
|
+
* `type` of relationship, but this is a model-depenent detail.
|
|
2163
|
+
*
|
|
2164
|
+
* NOTE: This API should not be used for generating related references
|
|
2165
|
+
* since we need the main tuple data for generating related references.
|
|
2166
|
+
* Please use `generateRelatedList` or `generateActiveList` before
|
|
2167
|
+
* calling this API.
|
|
2168
|
+
*/
|
|
2169
|
+
get related(): Array<RelatedReference>;
|
|
2170
|
+
/**
|
|
2171
|
+
* The function that can be used to generate .related API.
|
|
2172
|
+
* The logic is as follows:
|
|
2173
|
+
*
|
|
2174
|
+
* 1. Get the list of visible inbound foreign keys (if annotation is not defined,
|
|
2175
|
+
* it will consider all the inbound foreign keys).
|
|
2176
|
+
*
|
|
2177
|
+
* 2. Go through the list of visible inbound foreign keys
|
|
2178
|
+
* 2.1 if it's not part of InboundForeignKeyPseudoColumn apply the generateRelatedRef logic.
|
|
2179
|
+
* The logic for are sorted based on following attributes:
|
|
2180
|
+
* 1. displayname
|
|
2181
|
+
* 2. position of key columns that are involved in the foreignkey
|
|
2182
|
+
* 3. position of columns that are involved in the foreignkey
|
|
2183
|
+
*
|
|
2184
|
+
* NOTE: Passing "tuple" to this function is highly recommended.
|
|
2185
|
+
* Without tuple related references will be generated by appending the compactPath with
|
|
2186
|
+
* join statements. Because of this we cannot optimize the URL and other
|
|
2187
|
+
* parts of the code cannot behave properly (e.g. getUnlinkTRS in read cannot be used).
|
|
2188
|
+
* By passing "tuple", we can create the related references by creaing a facet blob
|
|
2189
|
+
* which can be integrated with other parts of the code.
|
|
2190
|
+
*
|
|
2191
|
+
*/
|
|
2192
|
+
generateRelatedList(tuple?: Tuple): Array<RelatedReference>;
|
|
2193
|
+
/**
|
|
2194
|
+
* Refer to Reference.generateActiveList
|
|
2195
|
+
*/
|
|
2196
|
+
get activeList(): ActiveList;
|
|
2197
|
+
/**
|
|
2198
|
+
* Generates the list of extra elements that the page might need,
|
|
2199
|
+
* this should include
|
|
2200
|
+
* - requests: An array of the secondary request objects which includes aggregates, entitysets, inline tables, and related tables.
|
|
2201
|
+
* Depending on the type of request it can have different attributes.
|
|
2202
|
+
* - for aggregate, entitysets, uniquefiltered, and outboundFirst (in entry):
|
|
2203
|
+
* {column: ERMrest.ReferenceColumn, <type>: true, objects: [{index: integer, column: boolean, related: boolean, inline: boolean, citation: boolean}]
|
|
2204
|
+
* where the type is aggregate`, `entity`, `entityset`, or `firstOutbound`. Each object is capturing where in the page needs this pseudo-column.
|
|
2205
|
+
* - for related and inline tables:
|
|
2206
|
+
* {<type>: true, index: integer}
|
|
2207
|
+
* where the type is `inline` or `related`.
|
|
2208
|
+
* - allOutBounds: the all-outbound foreign keys (added so we can later append to the url).
|
|
2209
|
+
* ERMrest.ReferenceColumn[]
|
|
2210
|
+
* - selfLinks: the self-links (so it can be added to the template variables)
|
|
2211
|
+
* ERMrest.KeyPseudoColumn[]
|
|
2212
|
+
*
|
|
2213
|
+
* TODO we might want to detect duplicates in allOutBounds better?
|
|
2214
|
+
* currently it's done based on name, but based on the path should be enough..
|
|
2215
|
+
* as long as it's entity the last column is useless...
|
|
2216
|
+
* the old code was kinda handling this by just adding the multi ones,
|
|
2217
|
+
* so if the fk definition is based on fkcolumn and not the RID, it would handle it.
|
|
2218
|
+
*
|
|
2219
|
+
* @param tuple - optional tuple parameter
|
|
2220
|
+
* @private
|
|
2221
|
+
*/
|
|
2222
|
+
generateActiveList(tuple?: Tuple): ActiveList;
|
|
2223
|
+
/**
|
|
2224
|
+
* List of columns that are used for search
|
|
2225
|
+
* if it's false, then we're using all the columns for search
|
|
2226
|
+
*/
|
|
2227
|
+
get searchColumns(): Array<VisibleColumn> | false;
|
|
2228
|
+
/**
|
|
2229
|
+
* Will return the expor templates that are available for this reference.
|
|
2230
|
+
* It will validate the templates that are defined in annotations.
|
|
2231
|
+
* If its `detailed` context and annotation was missing,
|
|
2232
|
+
* it will return the default export template.
|
|
2233
|
+
* @param useDefault whether we should use default template or not
|
|
2234
|
+
*/
|
|
2235
|
+
getExportTemplates(useDefault?: boolean): any[];
|
|
2236
|
+
/**
|
|
2237
|
+
* Returns a object, that can be used as a default export template.
|
|
2238
|
+
* NOTE SHOULD ONLY BE USED IN DETAILED CONTEXT
|
|
2239
|
+
* It will include:
|
|
2240
|
+
* - csv of the main table.
|
|
2241
|
+
* - csv of all the related entities
|
|
2242
|
+
* - fetch all the assets. For fetch, we need to provide url, length, and md5 (or other checksum types).
|
|
2243
|
+
* if these columns are missing from the asset annotation, they won't be added.
|
|
2244
|
+
* - fetch all the assetes of related tables.
|
|
2245
|
+
* @type {string}
|
|
2246
|
+
*/
|
|
2247
|
+
get defaultExportTemplate(): any;
|
|
2248
|
+
/**
|
|
2249
|
+
* Find a column given its name. It will search in this order:
|
|
2250
|
+
* 1. Visible columns
|
|
2251
|
+
* 2. Table columns
|
|
2252
|
+
* 3. search by constraint name in visible foreignkey and keys (backward compatibility)
|
|
2253
|
+
* Will throw an error if column is not found
|
|
2254
|
+
* @param name name of column
|
|
2255
|
+
* @returns ReferenceColumn
|
|
2256
|
+
*/
|
|
2257
|
+
getColumnByName(name: string): VisibleColumn;
|
|
2258
|
+
/**
|
|
2259
|
+
* Given a page, will return a reference that has
|
|
2260
|
+
* - the sorting and paging of the given page.
|
|
2261
|
+
* - the merged facets of the based reference and given page's facet.
|
|
2262
|
+
* to match the page.
|
|
2263
|
+
* NOTE: The given page must be based on the same table that this current table is based on.
|
|
2264
|
+
*/
|
|
2265
|
+
setSamePaging(page: Page): Reference;
|
|
2266
|
+
/**
|
|
2267
|
+
* Remove all the filters, facets, and custom-facets from the reference
|
|
2268
|
+
* @param {boolean} sameFilter By default we're removing filters, if this is true filters won't be changed.
|
|
2269
|
+
* @param {boolean} sameCustomFacet By default we're removing custom-facets, if this is true custom-facets won't be changed.
|
|
2270
|
+
* @param {boolean} sameFacet By default we're removing facets, if this is true facets won't be changed.
|
|
2271
|
+
*
|
|
2272
|
+
* @return {reference} A reference without facet filters
|
|
2273
|
+
*/
|
|
2274
|
+
removeAllFacetFilters(sameFilter?: boolean, sameCustomFacet?: boolean, sameFacet?: boolean): Reference;
|
|
2275
|
+
/**
|
|
2276
|
+
* Given a list of facet and filters, will add them to the existing conjunctive facet filters.
|
|
2277
|
+
*
|
|
2278
|
+
* @param facetAndFilters - an array of facets that will be added
|
|
2279
|
+
* @param customFacets - the custom facets object
|
|
2280
|
+
*/
|
|
2281
|
+
addFacets(facetAndFilters: unknown[], customFacets: unknown): Reference;
|
|
2282
|
+
/**
|
|
2283
|
+
* Will return a reference with the same facets but hidden.
|
|
2284
|
+
*/
|
|
2285
|
+
hideFacets(): Reference;
|
|
2286
|
+
/**
|
|
2287
|
+
*
|
|
2288
|
+
* @param table
|
|
2289
|
+
*/
|
|
2290
|
+
setNewTable(table: Table_2): void;
|
|
2291
|
+
/**
|
|
2292
|
+
* If annotation is defined and has the required attributes, will return
|
|
2293
|
+
* a Citation object that can be used to generate citation.
|
|
2294
|
+
*/
|
|
2295
|
+
get citation(): Citation | null;
|
|
2296
|
+
/**
|
|
2297
|
+
* If annotation is defined and has the required attributes, will return
|
|
2298
|
+
* a Metadata object
|
|
2299
|
+
*/
|
|
2300
|
+
get googleDatasetMetadata(): GoogleDatasetMetadata | null;
|
|
2301
|
+
/**
|
|
2302
|
+
* The related reference or tables that might be deleted as a result of deleting the current table.
|
|
2303
|
+
*/
|
|
2304
|
+
get cascadingDeletedItems(): Array<Table_2 | RelatedReference | Reference>;
|
|
2305
|
+
/**
|
|
2306
|
+
* If prefill object is defined and has the required attributes, will return
|
|
2307
|
+
* a BulkCreateForeignKeyObject object with the necessary objects used for a association modal picker
|
|
2308
|
+
*/
|
|
2309
|
+
get bulkCreateForeignKeyObject(): BulkCreateForeignKeyObject | null;
|
|
2310
|
+
/**
|
|
2311
|
+
* Will compute and return a BulkCreateForeignKeyObject if:
|
|
2312
|
+
* - the prefillObject is defined
|
|
2313
|
+
* - there are only 2 foreign key columns for this table that are not system columns
|
|
2314
|
+
* - using the prefill object, we can determine the main column for prefilling and leaf column for bulk selection
|
|
2315
|
+
*
|
|
2316
|
+
* @param prefillObject computed prefill object from chaise
|
|
2317
|
+
*/
|
|
2318
|
+
computeBulkCreateForeignKeyObject(prefillObject: any): BulkCreateForeignKeyObject | null | undefined;
|
|
2319
|
+
/**
|
|
2320
|
+
* Indicates whether the client has the permission to _create_
|
|
2321
|
+
* the referenced resource(s). Reporting a `true` value DOES NOT
|
|
2322
|
+
* guarantee the user right since some policies may be undecidable until
|
|
2323
|
+
* query execution.
|
|
2324
|
+
*/
|
|
2325
|
+
get canCreate(): boolean;
|
|
2326
|
+
/**
|
|
2327
|
+
* Indicates the reason as to why a user cannot create the
|
|
2328
|
+
* referenced resource(s).
|
|
2329
|
+
*/
|
|
2330
|
+
get canCreateReason(): string;
|
|
2331
|
+
/**
|
|
2332
|
+
* Indicates whether the client has the permission to _read_
|
|
2333
|
+
* the referenced resource(s). Reporting a `true` value DOES NOT
|
|
2334
|
+
* guarantee the user right since some policies may be undecidable until
|
|
2335
|
+
* query execution.
|
|
2336
|
+
*/
|
|
2337
|
+
get canRead(): boolean;
|
|
2338
|
+
/**
|
|
2339
|
+
* Indicates whether the client has the permission to _update_
|
|
2340
|
+
* the referenced resource(s). Reporting a `true` value DOES NOT
|
|
2341
|
+
* guarantee the user right since some policies may be undecidable until
|
|
2342
|
+
* query execution.
|
|
2343
|
+
*/
|
|
2344
|
+
get canUpdate(): boolean;
|
|
2345
|
+
/**
|
|
2346
|
+
* Indicates the reason as to why a user cannot update the
|
|
2347
|
+
* referenced resource(s).
|
|
2348
|
+
*/
|
|
2349
|
+
get canUpdateReason(): string;
|
|
2350
|
+
/**
|
|
2351
|
+
* Indicates whether the client has the permission to _delete_
|
|
2352
|
+
* the referenced resource(s). Reporting a `true` value DOES NOT
|
|
2353
|
+
* guarantee the user right since some policies may be undecidable until
|
|
2354
|
+
* query execution.
|
|
2355
|
+
*/
|
|
2356
|
+
get canDelete(): boolean;
|
|
2357
|
+
/**
|
|
2358
|
+
* Returns true if
|
|
2359
|
+
* - ermrest supports trs, and
|
|
2360
|
+
* - table has dynamic acls, and
|
|
2361
|
+
* - table has RID column, and
|
|
2362
|
+
* - table is not marked non-deletable non-updatable by annotation
|
|
2363
|
+
*/
|
|
2364
|
+
get canUseTRS(): boolean;
|
|
2365
|
+
/**
|
|
2366
|
+
* Returns true if
|
|
2367
|
+
* - ermrest supports tcrs, and
|
|
2368
|
+
* - table has dynamic acls, and
|
|
2369
|
+
* - table has RID column, and
|
|
2370
|
+
* - table is not marked non-updatable by annotation
|
|
2371
|
+
*/
|
|
2372
|
+
get canUseTCRS(): boolean;
|
|
2373
|
+
/**
|
|
2374
|
+
* This is a private function that checks the user permissions for modifying the affiliated entity, record or table
|
|
2375
|
+
* Sets a property on the reference object used by canCreate/canUpdate/canDelete
|
|
2376
|
+
*/
|
|
2377
|
+
checkPermissions(permission: string): boolean;
|
|
2378
|
+
_generateContextHeader(contextHeaderParams: Record<string, unknown>): Record<string, unknown>;
|
|
2379
|
+
/**
|
|
2380
|
+
* create a new reference with the new search
|
|
2381
|
+
* by copying this reference and clears previous search filters
|
|
2382
|
+
* search term can be:
|
|
2383
|
+
* a) A string with no space: single term or regular expression
|
|
2384
|
+
* b) A single term with space using ""
|
|
2385
|
+
* c) use space for conjunction of terms
|
|
2386
|
+
*/
|
|
2387
|
+
search(term: string): Reference;
|
|
2388
|
+
/**
|
|
2389
|
+
* Return a new Reference with the new sorting
|
|
2390
|
+
* TODO this should validate the given sort objects,
|
|
2391
|
+
* but I'm not sure how much adding that validation will affect other apis and client
|
|
2392
|
+
*
|
|
2393
|
+
* @param sort an array of objects in the format
|
|
2394
|
+
* {"column":columname, "descending":true|false}
|
|
2395
|
+
* in order of priority. Undfined, null or Empty array to use default sorting.
|
|
2396
|
+
*
|
|
2397
|
+
*/
|
|
2398
|
+
sort(sort: Array<{
|
|
2399
|
+
column: string;
|
|
2400
|
+
descending?: boolean;
|
|
2401
|
+
}> | null): Reference;
|
|
2402
|
+
/**
|
|
2403
|
+
*
|
|
2404
|
+
* @param {ColumnAggregateFn[]} aggregateList - list of aggregate functions to apply to GET uri
|
|
2405
|
+
* @return Promise contains an array of the aggregate values in the same order as the supplied aggregate list
|
|
2406
|
+
*/
|
|
2407
|
+
getAggregates(aggregateList: ColumnAggregateFn[], contextHeaderParams?: Record<string, unknown>): Promise<unknown[]>;
|
|
2408
|
+
/**
|
|
2409
|
+
* Reads the referenced resources and returns a promise for a page of
|
|
2410
|
+
* tuples. The `limit` parameter is required and must be a positive
|
|
2411
|
+
* integer. The page of tuples returned will be described by the
|
|
2412
|
+
* {@link ERMrest.Reference#columns} array of column definitions.
|
|
2413
|
+
*
|
|
2414
|
+
* Usage:
|
|
2415
|
+
* ```
|
|
2416
|
+
* // assumes the client holds a reference
|
|
2417
|
+
* reference.read(10).then(
|
|
2418
|
+
* function(page) {
|
|
2419
|
+
* // we now have a page of tuples
|
|
2420
|
+
* ...
|
|
2421
|
+
* },
|
|
2422
|
+
* function(error) {
|
|
2423
|
+
* // an error occurred
|
|
2424
|
+
* ...
|
|
2425
|
+
* });
|
|
2426
|
+
* ```
|
|
2427
|
+
*
|
|
2428
|
+
* @param {!number} limit The limit of results to be returned by the
|
|
2429
|
+
* read request. __required__
|
|
2430
|
+
* @param {Object} contextHeaderParams the object that we want to log.
|
|
2431
|
+
* @param {Boolean=} useEntity whether we should use entity api or not (if true, we won't get foreignkey data)
|
|
2432
|
+
* @param {Boolean=} dontCorrectPage whether we should modify the page.
|
|
2433
|
+
* If there's a @before in url and the number of results is less than the
|
|
2434
|
+
* given limit, we will remove the @before and run the read again. Setting
|
|
2435
|
+
* dontCorrectPage to true, will not do this extra check.
|
|
2436
|
+
* @param {Boolean=} getTRS whether we should fetch the table-level row acls (if table supports it)
|
|
2437
|
+
* @param {Boolean=} getTCRS whether we should fetch the table-level and column-level row acls (if table supports it)
|
|
2438
|
+
* @param {Boolean=} getUnlinkTRS whether we should fetch the acls of association
|
|
2439
|
+
* table. Use this only if the association is based on facet syntax
|
|
2440
|
+
*
|
|
2441
|
+
* NOTE setting useEntity to true, will ignore any sort that is based on
|
|
2442
|
+
* pseduo-columns.
|
|
2443
|
+
* TODO we might want to chagne the above statement, so useEntity can
|
|
2444
|
+
* be used more generally.
|
|
2445
|
+
*
|
|
2446
|
+
* NOTE getUnlinkTRS can only be used on related references that are generated
|
|
2447
|
+
* after calling `generateRelatedReference` or `generateActiveList` with the main
|
|
2448
|
+
* tuple data. As part of generating related references, if the main tuple is available
|
|
2449
|
+
* we will use a facet filter and the alias is added in there. Without the main tuple,
|
|
2450
|
+
* the alias is not added to the path and therefore `getUnlinkTRS` cannot be used.
|
|
2451
|
+
* TODO this is a bit hacky and should be refactored
|
|
2452
|
+
*
|
|
2453
|
+
* @returns A promise resolved with {@link Page} of results,
|
|
2454
|
+
* or rejected with any of these errors:
|
|
2455
|
+
* - {@link InvalidInputError}: If `limit` is invalid.
|
|
2456
|
+
* - {@link BadRequestError}: If asks for sorting based on columns that are not sortable.
|
|
2457
|
+
* - {@link NotFoundError}: If asks for sorting based on columns that are not valid.
|
|
2458
|
+
* - ERMrestjs corresponding http errors, if ERMrest returns http error.
|
|
2459
|
+
*/
|
|
2460
|
+
read(limit: number, contextHeaderParams?: Record<string, unknown>, useEntity?: boolean, dontCorrectPage?: boolean, getTRS?: boolean, getTCRS?: boolean, getUnlinkTRS?: boolean): Promise<Page>;
|
|
2461
|
+
/**
|
|
2462
|
+
* Creates a set of tuples in the references relation. Note, this
|
|
2463
|
+
* operation sets the `defaults` list according to the table
|
|
2464
|
+
* specification, and not according to the contents of in the input
|
|
2465
|
+
* tuple.
|
|
2466
|
+
* @param data The array of data to be created as new tuples.
|
|
2467
|
+
* @param contextHeaderParams the object that we want to log.
|
|
2468
|
+
* @param skipOnConflict if true, it will not complain about conflict
|
|
2469
|
+
* @returns A promise resolved with a object containing `successful` and `failure` attributes.
|
|
2470
|
+
* Both are {@link Page} of results.
|
|
2471
|
+
* or rejected with any of the following errors:
|
|
2472
|
+
* - {@link InvalidInputError}: If `data` is not valid, or reference is not in `entry/create` context.
|
|
2473
|
+
* - {@link InvalidInputError}: If `limit` is invalid.
|
|
2474
|
+
* - ERMrestjs corresponding http errors, if ERMrest returns http error.
|
|
2475
|
+
*/
|
|
2476
|
+
create(data: Record<string, unknown>[], contextHeaderParams?: any, skipOnConflict?: boolean): Promise<{
|
|
2477
|
+
successful: Page;
|
|
2478
|
+
failed: Page | null;
|
|
2479
|
+
disabled: Page | null;
|
|
2480
|
+
}>;
|
|
2481
|
+
/**
|
|
2482
|
+
* Updates a set of resources.
|
|
2483
|
+
* @param tuples array of tuple objects so that the new data nd old data can be used to determine key changes.
|
|
2484
|
+
* tuple.data has the new data
|
|
2485
|
+
* tuple._oldData has the data before changes were made
|
|
2486
|
+
* @param contextHeaderParams the object that we want to log.
|
|
2487
|
+
* @returns A promise resolved with a object containing:
|
|
2488
|
+
* - `successful`: Page of results that were stored.
|
|
2489
|
+
* - `failed`: Page of results that failed to be stored.
|
|
2490
|
+
* - `disabled`: Page of results that were not sent to ermrest (because of acl)
|
|
2491
|
+
* or rejected with any of these errors:
|
|
2492
|
+
* - {@link InvalidInputError}: If `limit` is invalid or reference is not in `entry/edit` context.
|
|
2493
|
+
* - ERMrestjs corresponding http errors, if ERMrest returns http error.
|
|
2494
|
+
*/
|
|
2495
|
+
update(tuples: Tuple[], contextHeaderParams?: any): Promise<{
|
|
2496
|
+
successful: Page;
|
|
2497
|
+
failed: Page | null;
|
|
2498
|
+
disabled: Page | null;
|
|
2499
|
+
}>;
|
|
2500
|
+
/**
|
|
2501
|
+
* Deletes the referenced resources or the given tuples.
|
|
2502
|
+
* NOTE This will ignore the provided sort and paging on the reference, make
|
|
2503
|
+
* sure you are calling this on specific set or rows (filtered).
|
|
2504
|
+
*
|
|
2505
|
+
* @param tuples (optional) the tuples that should be deleted
|
|
2506
|
+
* @param contextHeaderParams (optional) the object that we want to log.
|
|
2507
|
+
* @returns A promise resolved with empty object or rejected with any of these errors:
|
|
2508
|
+
* - ERMrestjs corresponding http errors, if ERMrest returns http error.
|
|
2509
|
+
*/
|
|
2510
|
+
delete(tuples?: Tuple[], contextHeaderParams?: any): Promise<void | BatchDeleteResponse>;
|
|
2511
|
+
/**
|
|
2512
|
+
* create a new instance with the same properties.
|
|
2513
|
+
*
|
|
2514
|
+
* you can customized the properties of the new instance by passing new ones to this function.
|
|
2515
|
+
* You must pass undefined for other props that you don't want to change.
|
|
2516
|
+
*/
|
|
2517
|
+
copy(displayname?: DisplayName, comment?: CommentType, pseudoColumn?: VisibleColumn): Reference;
|
|
2518
|
+
/**
|
|
2519
|
+
* return the columns that we should add to the defaults list during creation
|
|
2520
|
+
* @private
|
|
2521
|
+
*/
|
|
2522
|
+
private getDefaults;
|
|
2523
|
+
}
|
|
2524
|
+
|
|
2525
|
+
/**
|
|
2526
|
+
* Constructs an Aggregate Funciton object
|
|
2527
|
+
*
|
|
2528
|
+
* Reference Aggregate Functions is a collection of available aggregates for the
|
|
2529
|
+
* particular Reference (count for the table). Each aggregate should return the string
|
|
2530
|
+
* representation for querying that information.
|
|
2531
|
+
*
|
|
2532
|
+
* Usage:
|
|
2533
|
+
* Clients _do not_ directly access this constructor. ERMrest.Reference will
|
|
2534
|
+
* access this constructor for purposes of fetching aggregate data about the table.
|
|
2535
|
+
*/
|
|
2536
|
+
declare class ReferenceAggregateFn {
|
|
2537
|
+
private _ref;
|
|
2538
|
+
constructor(reference: Reference);
|
|
2539
|
+
/**
|
|
2540
|
+
* count aggregate representation
|
|
2541
|
+
*/
|
|
2542
|
+
get countAgg(): string;
|
|
2543
|
+
}
|
|
2544
|
+
|
|
2545
|
+
/**
|
|
2546
|
+
* Constructor for ReferenceColumn. This class is a wrapper for Column.
|
|
2547
|
+
*/
|
|
2548
|
+
declare class ReferenceColumn {
|
|
2549
|
+
referenceColumnType: ReferenceColumnTypes;
|
|
2550
|
+
baseColumns: Column[];
|
|
2551
|
+
/**
|
|
2552
|
+
* the source object wrapper that this column is based on
|
|
2553
|
+
*/
|
|
2554
|
+
sourceObjectWrapper?: SourceObjectWrapper;
|
|
2555
|
+
/**
|
|
2556
|
+
* the column-directive object
|
|
2557
|
+
*/
|
|
2558
|
+
sourceObject: any;
|
|
2559
|
+
/**
|
|
2560
|
+
* The source object nodes
|
|
2561
|
+
*/
|
|
2562
|
+
sourceObjectNodes?: SourceObjectNode[];
|
|
2563
|
+
/**
|
|
2564
|
+
* the last fk node
|
|
2565
|
+
*/
|
|
2566
|
+
lastForeignKeyNode?: SourceObjectNode;
|
|
2567
|
+
/**
|
|
2568
|
+
* the first fk node
|
|
2569
|
+
*/
|
|
2570
|
+
firstForeignKeyNode?: SourceObjectNode;
|
|
2571
|
+
/**
|
|
2572
|
+
* how many fks node are in the path
|
|
2573
|
+
*/
|
|
2574
|
+
foreignKeyPathLength?: number;
|
|
2575
|
+
/**
|
|
2576
|
+
* whether the path is filtered
|
|
2577
|
+
*/
|
|
2578
|
+
isFiltered: boolean;
|
|
2579
|
+
/**
|
|
2580
|
+
* the filter props
|
|
2581
|
+
*/
|
|
2582
|
+
filterProps?: FilterPropsType;
|
|
2583
|
+
/**
|
|
2584
|
+
* whether input iframe is defined
|
|
2585
|
+
*/
|
|
2586
|
+
isInputIframe?: boolean;
|
|
2587
|
+
/**
|
|
2588
|
+
* input iframe props
|
|
2589
|
+
*/
|
|
2590
|
+
inputIframeProps?: InputIframePropsType;
|
|
2591
|
+
/**
|
|
2592
|
+
* whether the column is a pseudo column (differentiate between this base type and other more specific ones)
|
|
2593
|
+
*/
|
|
2594
|
+
isPseudo: boolean;
|
|
2595
|
+
isUnique: boolean;
|
|
2596
|
+
/**
|
|
2597
|
+
* the table that this column belongs to
|
|
2598
|
+
*/
|
|
2599
|
+
table: Table_2;
|
|
2600
|
+
protected _displayname?: DisplayName;
|
|
2601
|
+
protected _RID?: string;
|
|
2602
|
+
private _type?;
|
|
2603
|
+
protected _nullok?: boolean;
|
|
2604
|
+
protected _default?: any;
|
|
2605
|
+
private _aggregate?;
|
|
2606
|
+
private _groupAggregate?;
|
|
2607
|
+
protected _comment?: CommentType;
|
|
2608
|
+
private _hideColumnHeader?;
|
|
2609
|
+
private _inputDisabled?;
|
|
2610
|
+
protected _sortable?: boolean;
|
|
2611
|
+
protected _sortColumns_cached?: any[];
|
|
2612
|
+
protected _display_cached?: any;
|
|
2613
|
+
protected _compressedDataSource?: any;
|
|
2614
|
+
protected _hasWaitFor?: boolean;
|
|
2615
|
+
protected _hasWaitForAggregate?: boolean;
|
|
2616
|
+
protected _waitFor?: ReferenceColumn[];
|
|
2617
|
+
/**
|
|
2618
|
+
* the reference that this column is defined on
|
|
2619
|
+
*/
|
|
2620
|
+
protected _baseReference: Reference;
|
|
2621
|
+
protected _context: string;
|
|
2622
|
+
protected _name?: string;
|
|
2623
|
+
protected _mainTuple?: Tuple;
|
|
2624
|
+
protected _currentTable: Table_2;
|
|
2625
|
+
constructor(reference: Reference, cols: Column[], sourceObjectWrapper?: SourceObjectWrapper, name?: string, mainTuple?: Tuple);
|
|
2626
|
+
/**
|
|
2627
|
+
* Name of the column.
|
|
2628
|
+
*/
|
|
2629
|
+
get name(): string;
|
|
2630
|
+
/**
|
|
2631
|
+
* The compressed source path from the main reference to this column
|
|
2632
|
+
*/
|
|
2633
|
+
get compressedDataSource(): any;
|
|
2634
|
+
/**
|
|
2635
|
+
* Display name of the column.
|
|
2636
|
+
*/
|
|
2637
|
+
get displayname(): DisplayName;
|
|
2638
|
+
/**
|
|
2639
|
+
* ERMrest generated RID for this column
|
|
2640
|
+
*/
|
|
2641
|
+
get RID(): string | undefined;
|
|
2642
|
+
/**
|
|
2643
|
+
* Type of the column
|
|
2644
|
+
*/
|
|
2645
|
+
get type(): Type;
|
|
2646
|
+
/**
|
|
2647
|
+
* As long as any of the base columns are nullok, the ReferenceColumn is nullok.
|
|
2648
|
+
*/
|
|
2649
|
+
get nullok(): boolean;
|
|
2650
|
+
/**
|
|
2651
|
+
* Returns the default value
|
|
2652
|
+
*/
|
|
2653
|
+
get default(): any;
|
|
2654
|
+
/**
|
|
2655
|
+
* Returns the aggregate function object
|
|
2656
|
+
*/
|
|
2657
|
+
get aggregate(): ColumnAggregateFn | null;
|
|
2658
|
+
/**
|
|
2659
|
+
* Returns the aggregate group object
|
|
2660
|
+
*/
|
|
2661
|
+
get groupAggregate(): ColumnGroupAggregateFn | null;
|
|
2662
|
+
/**
|
|
2663
|
+
* Documentation for this reference-column
|
|
2664
|
+
*/
|
|
2665
|
+
get comment(): CommentType;
|
|
2666
|
+
/**
|
|
2667
|
+
* Whether the UI should hide the column header or not.
|
|
2668
|
+
*/
|
|
2669
|
+
get hideColumnHeader(): boolean;
|
|
2670
|
+
/**
|
|
2671
|
+
* Indicates if the input should be disabled
|
|
2672
|
+
*/
|
|
2673
|
+
get inputDisabled(): boolean | {
|
|
2674
|
+
message: string;
|
|
2675
|
+
};
|
|
2676
|
+
/**
|
|
2677
|
+
* Whether the column is sortable
|
|
2678
|
+
*/
|
|
2679
|
+
get sortable(): boolean;
|
|
2680
|
+
/**
|
|
2681
|
+
* An array of objects that have `column` which is a Column object, and `descending` which is true/false
|
|
2682
|
+
*/
|
|
2683
|
+
get _sortColumns(): any[];
|
|
2684
|
+
/**
|
|
2685
|
+
* An object which contains column display properties
|
|
2686
|
+
*/
|
|
2687
|
+
get display(): any;
|
|
2688
|
+
/**
|
|
2689
|
+
* Indicates if this object is wrapping just one column or not
|
|
2690
|
+
*/
|
|
2691
|
+
protected get _simple(): boolean;
|
|
2692
|
+
/**
|
|
2693
|
+
* Whether there are aggregate or entity set columns in the wait_for list of this column.
|
|
2694
|
+
*/
|
|
2695
|
+
get hasWaitFor(): boolean;
|
|
2696
|
+
/**
|
|
2697
|
+
* Whether there are aggregate columns in the wait_for list of this column.
|
|
2698
|
+
*/
|
|
2699
|
+
get hasWaitForAggregate(): boolean;
|
|
2700
|
+
/**
|
|
2701
|
+
* Array of columns that the current column value depends on.
|
|
2702
|
+
*/
|
|
2703
|
+
get waitFor(): ReferenceColumn[];
|
|
2704
|
+
/**
|
|
2705
|
+
* Formats a value corresponding to this reference-column definition.
|
|
2706
|
+
*/
|
|
2707
|
+
formatvalue(data: any, context?: string, options?: any): string | string[];
|
|
2708
|
+
/**
|
|
2709
|
+
* Formats the presentation value corresponding to this reference-column definition.
|
|
2710
|
+
*/
|
|
2711
|
+
formatPresentation(data: any, context?: string, templateVariables?: any, options?: any): DisplayName;
|
|
2712
|
+
protected _determineInputDisabled(context: string): boolean | {
|
|
2713
|
+
message: string;
|
|
2714
|
+
};
|
|
2715
|
+
protected _determineSortable(): void;
|
|
2716
|
+
protected _getNullValue(context: string): string | null;
|
|
2717
|
+
/**
|
|
2718
|
+
* Whether we should show the link for the foreignkey value.
|
|
2719
|
+
*/
|
|
2720
|
+
protected _getShowForeignKeyLink(context: string): boolean;
|
|
2721
|
+
sourceFormatPresentation(templateVariables: any, columnValue: any, mainTuple: Tuple): any;
|
|
2722
|
+
/**
|
|
2723
|
+
* This function should not be used in entry context
|
|
2724
|
+
*/
|
|
2725
|
+
/**
|
|
2726
|
+
* Render the location of iframe. will return empty string if invalid or missing.
|
|
2727
|
+
*/
|
|
2728
|
+
renderInputIframeUrl(data: any, linkedData: any): string;
|
|
2729
|
+
}
|
|
2730
|
+
|
|
2731
|
+
declare enum ReferenceColumnTypes {
|
|
2732
|
+
PSEUDO = "pseudo",
|
|
2733
|
+
KEY = "key",
|
|
2734
|
+
ASSET = "asset",
|
|
2735
|
+
FOREIGN_KEY = "foreign_key",
|
|
2736
|
+
VIRTUAL = "virtual",
|
|
2737
|
+
INBOUND_FOREIGN_KEY = "inbound_foreign_key",
|
|
2738
|
+
GENERAL = "general"
|
|
2739
|
+
}
|
|
2740
|
+
|
|
2741
|
+
declare type ReferenceDisplay = {
|
|
2742
|
+
/**
|
|
2743
|
+
* The display type ('table', 'markdown', or 'module')
|
|
2744
|
+
*/
|
|
2745
|
+
type: string;
|
|
2746
|
+
/**
|
|
2747
|
+
* Whether to hide the row count
|
|
2748
|
+
*/
|
|
2749
|
+
hideRowCount: boolean;
|
|
2750
|
+
/**
|
|
2751
|
+
* Whether faceting is enabled
|
|
2752
|
+
*/
|
|
2753
|
+
showFaceting: boolean;
|
|
2754
|
+
/**
|
|
2755
|
+
* Maximum facet depth allowed
|
|
2756
|
+
*/
|
|
2757
|
+
maxFacetDepth: number;
|
|
2758
|
+
/**
|
|
2759
|
+
* Whether the facet panel should be open by default
|
|
2760
|
+
*/
|
|
2761
|
+
facetPanelOpen: boolean | null;
|
|
2762
|
+
/**
|
|
2763
|
+
* whether to show the saved query panel
|
|
2764
|
+
*/
|
|
2765
|
+
showSavedQuery: boolean;
|
|
2766
|
+
/**
|
|
2767
|
+
* used for computing "custom display" for related tables
|
|
2768
|
+
*/
|
|
2769
|
+
_separator: string;
|
|
2770
|
+
/**
|
|
2771
|
+
* used for computing "custom display" for related tables
|
|
2772
|
+
*/
|
|
2773
|
+
_prefix: string;
|
|
2774
|
+
/**
|
|
2775
|
+
* used for computing "custom display" for related tables
|
|
2776
|
+
*/
|
|
2777
|
+
_suffix: string;
|
|
2778
|
+
/**
|
|
2779
|
+
* how to order the rows
|
|
2780
|
+
*/
|
|
2781
|
+
_rowOrder?: Array<{
|
|
2782
|
+
column: Column_2;
|
|
2783
|
+
descending: boolean;
|
|
2784
|
+
} | {
|
|
2785
|
+
num_occurrences: true;
|
|
2786
|
+
descending: boolean;
|
|
2787
|
+
}>;
|
|
2788
|
+
/**
|
|
2789
|
+
* default page size (25)
|
|
2790
|
+
*/
|
|
2791
|
+
defaultPageSize?: number;
|
|
2792
|
+
/**
|
|
2793
|
+
* whether the column headers should be hidden (in record page)
|
|
2794
|
+
*/
|
|
2795
|
+
hideColumnHeaders?: boolean;
|
|
2796
|
+
/**
|
|
2797
|
+
* whether the toc should be collapsed (in record page)
|
|
2798
|
+
*/
|
|
2799
|
+
collapseToc?: boolean;
|
|
2800
|
+
/**
|
|
2801
|
+
* The template engine to use with the markdown patterns
|
|
2802
|
+
*/
|
|
2803
|
+
templateEngine?: string;
|
|
2804
|
+
/**
|
|
2805
|
+
* The markdown pattern to use for the page
|
|
2806
|
+
*/
|
|
2807
|
+
_pageMarkdownPattern?: string;
|
|
2808
|
+
/**
|
|
2809
|
+
* The markdown pattern to use for the row
|
|
2810
|
+
*/
|
|
2811
|
+
_rowMarkdownPattern?: string;
|
|
2812
|
+
/**
|
|
2813
|
+
* the wait-fors that the markdown pattern has
|
|
2814
|
+
*/
|
|
2815
|
+
sourceWaitFor: Array<VisibleColumn>;
|
|
2816
|
+
/**
|
|
2817
|
+
* whether the markdown pattern has any wait-fors
|
|
2818
|
+
*/
|
|
2819
|
+
sourceHasWaitFor: boolean;
|
|
2820
|
+
/**
|
|
2821
|
+
* the markdown pattern defined on the source def
|
|
2822
|
+
*/
|
|
2823
|
+
sourceMarkdownPattern?: string;
|
|
2824
|
+
/**
|
|
2825
|
+
* the template engine to use with the source markdown pattern
|
|
2826
|
+
*/
|
|
2827
|
+
sourceTemplateEngine?: string;
|
|
2828
|
+
};
|
|
2829
|
+
|
|
2830
|
+
declare class RelatedReference extends Reference {
|
|
2831
|
+
private _mainTable;
|
|
2832
|
+
private _mainTuple?;
|
|
2833
|
+
private _origFKR;
|
|
2834
|
+
private _compressedDataSource?;
|
|
2835
|
+
private _derivedAssociationReference?;
|
|
2836
|
+
_relatedKeyColumnPositions: number[];
|
|
2837
|
+
_relatedFkColumnPositions: number[];
|
|
2838
|
+
constructor(location: Location_2, catalog: Catalog, mainTable: Table_2, origFKR: ForeignKeyRef, relatedKeyColumnPositions: number[], relatedFkColumnPositions: number[], compressedDataSource?: any, mainTuple?: Tuple, displayname?: DisplayName, comment?: CommentType, pseudoColumn?: VisibleColumn);
|
|
2839
|
+
/**
|
|
2840
|
+
* the main table
|
|
2841
|
+
* NOTE: the table that this reference represents is the related one, and
|
|
2842
|
+
* it is not the same as the main table.
|
|
2843
|
+
*/
|
|
2844
|
+
get mainTable(): Table_2;
|
|
2845
|
+
/**
|
|
2846
|
+
* the main tuple
|
|
2847
|
+
*/
|
|
2848
|
+
get mainTuple(): Tuple | undefined;
|
|
2849
|
+
get origFKR(): ForeignKeyRef;
|
|
2850
|
+
get compressedDataSource(): any;
|
|
2851
|
+
set derivedAssociationReference(ref: DerivedAssociationReference);
|
|
2852
|
+
get derivedAssociationReference(): DerivedAssociationReference | undefined;
|
|
2853
|
+
/**
|
|
2854
|
+
* create a new instance with the same properties.
|
|
2855
|
+
*
|
|
2856
|
+
* you can customized the properties of the new instance by passing new ones to this function.
|
|
2857
|
+
* You must pass undefined for other props that you don't want to change.
|
|
2858
|
+
*/
|
|
2859
|
+
copy(displayname?: DisplayName, comment?: CommentType, pseudoColumn?: VisibleColumn): RelatedReference;
|
|
2860
|
+
/**
|
|
2861
|
+
* If the current reference is derived from an association related table and filtered, this
|
|
2862
|
+
* function will delete the set of tuples included and return a set of success responses and
|
|
2863
|
+
* a set of errors for the corresponding delete actions for the provided entity set from the
|
|
2864
|
+
* corresponding association table denoted by the list of tuples.
|
|
2865
|
+
*
|
|
2866
|
+
* For example, assume
|
|
2867
|
+
* Table1(K1,C1) <- AssociationTable(FK1, FK2) -> Table2(K2,C2)
|
|
2868
|
+
* and the current tuples are from Table2 with k2 = "2" and k2 = "3".
|
|
2869
|
+
* With origFKRData = {"k1": "1"} this function will return a set of success and error responses for
|
|
2870
|
+
* delete requests to AssociationTable with FK1 = "1" as a part of the path and FK2 = "2" and FK2 = "3"
|
|
2871
|
+
* as the filters that define the set and how they are related to Table1.
|
|
2872
|
+
*
|
|
2873
|
+
* To make sure a deletion occurs only for the tuples specified, we need to verify each reference path that
|
|
2874
|
+
* is created includes a parent constraint and has one or more filters based on the other side of the association
|
|
2875
|
+
* table's uniqueness constraint. Some more information about the validations that need to occur based on the above example:
|
|
2876
|
+
* - parent value has to be not null
|
|
2877
|
+
* - FK1 has to have a not null constraint
|
|
2878
|
+
* - child values have to have at least 1 value and all not null
|
|
2879
|
+
* - for FK2, all selected values are not null
|
|
2880
|
+
*
|
|
2881
|
+
* @param {Array} mainTuple - an ERMrest.Tuple from Table1 (from example above)
|
|
2882
|
+
* @param {Array} tuples - an array of ERMrest.Tuple objects from Table2 (same as self) (from example above)
|
|
2883
|
+
* @param {Object} contextHeaderParams the object that we want to log.
|
|
2884
|
+
*
|
|
2885
|
+
* @returns {Object} an ERMrest.BatchUnlinkResponse "error" object
|
|
2886
|
+
**/
|
|
2887
|
+
deleteBatchAssociationTuples(parentTuple: Tuple, tuples: Array<Tuple>, contextHeaderParams?: Record<string, unknown>): Promise<BatchUnlinkResponse>;
|
|
2888
|
+
}
|
|
2889
|
+
|
|
2890
|
+
export declare const renderHandlebarsTemplate: typeof HandlebarsService.render;
|
|
2891
|
+
|
|
2892
|
+
/**
|
|
2893
|
+
* returns the rendered markdown content
|
|
2894
|
+
* @param value the markdown value
|
|
2895
|
+
* @param inline whether we should parse this as as inline element or not
|
|
2896
|
+
* @param throwError if true, it will throw the error instead of swalloing it
|
|
2897
|
+
*/
|
|
2898
|
+
export declare function renderMarkdown(value: string, inline?: boolean, throwError?: boolean): string;
|
|
2899
|
+
|
|
2900
|
+
export { renderMustacheTemplate }
|
|
2901
|
+
|
|
2902
|
+
export declare const resetUserCookie: typeof ConfigService.resetUserCookie;
|
|
2903
|
+
|
|
2904
|
+
/**
|
|
2905
|
+
* This function resolves a URI reference to a {@link Reference}
|
|
2906
|
+
* object. It validates the syntax of the URI and validates that the
|
|
2907
|
+
* references to model elements in it are correct. This function makes a
|
|
2908
|
+
* call to the ERMrest server in order to get the `schema` which it uses to
|
|
2909
|
+
* validate the URI path.
|
|
2910
|
+
*
|
|
2911
|
+
* For a consistent behavior, always contextualize the resolved `Reference` object.
|
|
2912
|
+
* See {@link Reference#contextualize} for more information.
|
|
2913
|
+
*
|
|
2914
|
+
* Usage:
|
|
2915
|
+
* ```
|
|
2916
|
+
* // This example assumes that the client has access to the module
|
|
2917
|
+
* resolve('https://example.org/catalog/42/entity/s:t/k=123').then(
|
|
2918
|
+
* function(reference) {
|
|
2919
|
+
* // the uri was successfully resolved to a `Reference` object
|
|
2920
|
+
* console.log("The reference has URI", reference.uri);
|
|
2921
|
+
* console.log("It has", reference.columns.length, "columns");
|
|
2922
|
+
* console.log("Is it unique?", (reference.isUnique ? 'yes' : 'no'));
|
|
2923
|
+
* ...
|
|
2924
|
+
* },
|
|
2925
|
+
* function(error) {
|
|
2926
|
+
* // there was an error returned here
|
|
2927
|
+
* ...
|
|
2928
|
+
* });
|
|
2929
|
+
* ```
|
|
2930
|
+
* @param uri - An ERMrest resource URI, such as
|
|
2931
|
+
* `https://example.org/ermrest/catalog/1/entity/s:t/k=123`.
|
|
2932
|
+
* @param contextHeaderParams - An optional context header parameters object. The (key, value)
|
|
2933
|
+
* pairs from the object are converted to URL `key=value` query parameters
|
|
2934
|
+
* and appended to every request to the ERMrest service.
|
|
2935
|
+
* @return Promise when resolved passes the
|
|
2936
|
+
* {@link Reference} object. If rejected, passes one of the ermrest errors
|
|
2937
|
+
*/
|
|
2938
|
+
export declare const resolve: (uri: string, contextHeaderParams?: any) => Promise<Reference>;
|
|
2939
|
+
|
|
2940
|
+
export declare const responseToError: typeof ErrorService.responseToError;
|
|
2941
|
+
|
|
2942
|
+
declare class SearchFacetFilter extends FacetFilter {
|
|
2943
|
+
facetFilterKey: string;
|
|
2944
|
+
constructor(term: unknown, column: Column);
|
|
2945
|
+
}
|
|
2946
|
+
|
|
2947
|
+
export declare class ServiceUnavailableError extends ERMrestError {
|
|
2948
|
+
constructor(status: string, message: string);
|
|
2949
|
+
}
|
|
2950
|
+
|
|
2951
|
+
export declare const setClientConfig: typeof ConfigService.setClientConfig;
|
|
2952
|
+
|
|
2953
|
+
export declare const setClientSession: typeof AuthnService.setClientSession;
|
|
2954
|
+
|
|
2955
|
+
export declare const setHTTP401Handler: typeof HTTPService.setHTTP401Handler;
|
|
2956
|
+
|
|
2957
|
+
export declare const setUserCookie: typeof ConfigService.setUserCookie;
|
|
2958
|
+
|
|
2959
|
+
/**
|
|
2960
|
+
* Interface for sort column objects used in entityCounts method
|
|
2961
|
+
*/
|
|
2962
|
+
declare interface SortColumn {
|
|
2963
|
+
column?: Column;
|
|
2964
|
+
num_occurrences?: boolean;
|
|
2965
|
+
descending?: boolean;
|
|
2966
|
+
}
|
|
2967
|
+
|
|
2968
|
+
/**
|
|
2969
|
+
* This is the source object node that is used to represent a source object.
|
|
2970
|
+
* It can be a filter, foreign key, inbound, outbound, or path prefix.
|
|
2971
|
+
*/
|
|
2972
|
+
declare class SourceObjectNode {
|
|
2973
|
+
/**
|
|
2974
|
+
* the object that represents this node
|
|
2975
|
+
* - if this is a filter, it will be the parsed filter node (Object)
|
|
2976
|
+
* - if this is a foreign key, it will be the foreign key object (ForeignKeyRef)
|
|
2977
|
+
* - if this is a path prefix, it will be the path prefix object (SourceObjectWrapper)
|
|
2978
|
+
*/
|
|
2979
|
+
nodeObject: any;
|
|
2980
|
+
/**
|
|
2981
|
+
* the table that this node belongs to (the table that the previous node points to)
|
|
2982
|
+
*/
|
|
2983
|
+
table: Table;
|
|
2984
|
+
/**
|
|
2985
|
+
* whether this node is a filter
|
|
2986
|
+
*/
|
|
2987
|
+
isFilter: boolean;
|
|
2988
|
+
/**
|
|
2989
|
+
* whether the filter has been processed
|
|
2990
|
+
* - if true, the `parsedFilterNode` will be set to the parsed filter
|
|
2991
|
+
* - if false, the `parsedFilterNode` will be undefined
|
|
2992
|
+
*/
|
|
2993
|
+
isFilterProcessed: boolean;
|
|
2994
|
+
/**
|
|
2995
|
+
* whether this node is a foreign key
|
|
2996
|
+
*/
|
|
2997
|
+
isForeignKey: boolean;
|
|
2998
|
+
/**
|
|
2999
|
+
* whether the foreign key is inbound or outbound
|
|
3000
|
+
*/
|
|
3001
|
+
isInbound: boolean;
|
|
3002
|
+
/**
|
|
3003
|
+
* whether this node is a path prefix
|
|
3004
|
+
*/
|
|
3005
|
+
isPathPrefix: boolean;
|
|
3006
|
+
/**
|
|
3007
|
+
* the source key for the path prefix
|
|
3008
|
+
*/
|
|
3009
|
+
pathPrefixSourcekey?: string;
|
|
3010
|
+
/**
|
|
3011
|
+
* whether this node is an alternative join
|
|
3012
|
+
*/
|
|
3013
|
+
isAlternativeJoin: boolean;
|
|
3014
|
+
/**
|
|
3015
|
+
* the alias for this node
|
|
3016
|
+
*/
|
|
3017
|
+
alias?: string;
|
|
3018
|
+
/**
|
|
3019
|
+
* the parsed filter node
|
|
3020
|
+
*/
|
|
3021
|
+
private parsedFilterNode?;
|
|
3022
|
+
constructor(nodeObject: any,
|
|
3023
|
+
/**
|
|
3024
|
+
* the table that this node belongs to (the table that the previous node points to)
|
|
3025
|
+
*/
|
|
3026
|
+
table: Table, isFilter: boolean, isForeignKey: boolean, isInbound: boolean, isPathPrefix: boolean, pathPrefixSourcekey: string | undefined, alias: string | undefined,
|
|
3027
|
+
/**
|
|
3028
|
+
* whether this node is an alternative join
|
|
3029
|
+
*/
|
|
3030
|
+
isAlternativeJoin: boolean,
|
|
3031
|
+
/**
|
|
3032
|
+
* if set to true, the filter will not be processed
|
|
3033
|
+
* this is used by Table.sourceDefinitions to skip processing filters since we still don't have the main tuple
|
|
3034
|
+
*/
|
|
3035
|
+
skipProcessingFilters?: boolean,
|
|
3036
|
+
/**
|
|
3037
|
+
* the main tuple that this node is associated with
|
|
3038
|
+
* this is used to process the filter if this is a filter node
|
|
3039
|
+
*/
|
|
3040
|
+
mainTuple?: Tuple);
|
|
3041
|
+
/**
|
|
3042
|
+
* Return the string representation of this node
|
|
3043
|
+
* @param reverse - whether we should reverse the order (applicable to fk)
|
|
3044
|
+
* @param isLeft - whether we want to use left outer join (applicable to fk)
|
|
3045
|
+
* @param outAlias - output alias
|
|
3046
|
+
* @param isReverseRightJoin - whether this is a reverse right join
|
|
3047
|
+
* @returns string representation
|
|
3048
|
+
*/
|
|
3049
|
+
toString(reverse?: boolean, isLeft?: boolean, outAlias?: string, isReverseRightJoin?: boolean): string;
|
|
3050
|
+
/**
|
|
3051
|
+
* Process the filter for this node
|
|
3052
|
+
* @param mainTuple - the main tuple to extract key values from
|
|
3053
|
+
*/
|
|
3054
|
+
processFilter(mainTuple?: Tuple): void;
|
|
3055
|
+
}
|
|
3056
|
+
|
|
3057
|
+
/**
|
|
3058
|
+
* Represents a column-directive
|
|
3059
|
+
*/
|
|
3060
|
+
declare class SourceObjectWrapper {
|
|
3061
|
+
/**
|
|
3062
|
+
* the source object
|
|
3063
|
+
*/
|
|
3064
|
+
sourceObject: Record<string, unknown>;
|
|
3065
|
+
/**
|
|
3066
|
+
* the column that this source object refers to
|
|
3067
|
+
* undefined if it's a virtual column
|
|
3068
|
+
*/
|
|
3069
|
+
column?: Column_2;
|
|
3070
|
+
/**
|
|
3071
|
+
* whether the source object has a prefix or not
|
|
3072
|
+
*/
|
|
3073
|
+
hasPrefix: boolean;
|
|
3074
|
+
/**
|
|
3075
|
+
* whether the source object has a foreign key path or not
|
|
3076
|
+
*/
|
|
3077
|
+
hasPath: boolean;
|
|
3078
|
+
/**
|
|
3079
|
+
* the length of the foreign key path
|
|
3080
|
+
* this is the number of foreign key nodes in the path
|
|
3081
|
+
*/
|
|
3082
|
+
foreignKeyPathLength: number;
|
|
3083
|
+
/**
|
|
3084
|
+
* whether the source object has an inbound foreign key path or not
|
|
3085
|
+
*/
|
|
3086
|
+
hasInbound: boolean;
|
|
3087
|
+
/**
|
|
3088
|
+
* whether the source object has an aggregate function or not
|
|
3089
|
+
*/
|
|
3090
|
+
hasAggregate: boolean;
|
|
3091
|
+
/**
|
|
3092
|
+
* whether any of the source object nodes is filtered or not
|
|
3093
|
+
*/
|
|
3094
|
+
isFiltered: boolean;
|
|
3095
|
+
filterProps?: FilterPropsType;
|
|
3096
|
+
/**
|
|
3097
|
+
* whether this is an entity mode or not
|
|
3098
|
+
*/
|
|
3099
|
+
isEntityMode: boolean;
|
|
3100
|
+
/**
|
|
3101
|
+
* whether this represents a unique row or not
|
|
3102
|
+
*/
|
|
3103
|
+
isUnique: boolean;
|
|
3104
|
+
/**
|
|
3105
|
+
* whether this is unique and filtered
|
|
3106
|
+
*/
|
|
3107
|
+
isUniqueFiltered: boolean;
|
|
3108
|
+
/**
|
|
3109
|
+
* returns true if all foreign keys are outbound and all the columns involved are not null.
|
|
3110
|
+
*/
|
|
3111
|
+
isAllOutboundNotNullPerModel: boolean;
|
|
3112
|
+
/**
|
|
3113
|
+
*
|
|
3114
|
+
*/
|
|
3115
|
+
isAllOutboundNotNull: boolean;
|
|
3116
|
+
lastForeignKeyNode?: SourceObjectNode;
|
|
3117
|
+
firstForeignKeyNode?: SourceObjectNode;
|
|
3118
|
+
name: string;
|
|
3119
|
+
isHash: boolean;
|
|
3120
|
+
sourceObjectNodes: SourceObjectNode[];
|
|
3121
|
+
isInputIframe: boolean;
|
|
3122
|
+
inputIframeProps?: InputIframePropsType;
|
|
3123
|
+
/**
|
|
3124
|
+
* used for facets
|
|
3125
|
+
* TODO is there a better way to manage this?
|
|
3126
|
+
*/
|
|
3127
|
+
entityChoiceFilterTuples?: Tuple[];
|
|
3128
|
+
/**
|
|
3129
|
+
* @param sourceObject the column directive object
|
|
3130
|
+
* @param table the root (starting) table
|
|
3131
|
+
* @param isFacet whether this is a facet or not
|
|
3132
|
+
* @param sources already generated source (only useful for source-def generation)
|
|
3133
|
+
* @param mainTuple the main tuple that is used for filters
|
|
3134
|
+
* @param skipProcessingFilters whether we should skip processing filters or not
|
|
3135
|
+
*/
|
|
3136
|
+
constructor(sourceObject: Record<string, unknown>, table?: Table, isFacet?: boolean, sources?: unknown, mainTuple?: Tuple, skipProcessingFilters?: boolean);
|
|
3137
|
+
/**
|
|
3138
|
+
* return a new sourceObjectWrapper that is created by merging the given sourceObject and existing object.
|
|
3139
|
+
*
|
|
3140
|
+
* Useful when we have an object with sourcekey and want to find the actual definition. You can then call
|
|
3141
|
+
* clone on the source-def and pass the object.
|
|
3142
|
+
*
|
|
3143
|
+
* const myCol = {"sourcekey": "some_key"};
|
|
3144
|
+
* const sd = table.sourceDefinitions.getSource(myCol.sourcekey);
|
|
3145
|
+
* if (sd) {
|
|
3146
|
+
* const wrapper = sd.clone(myCol, table);
|
|
3147
|
+
* }
|
|
3148
|
+
*
|
|
3149
|
+
* - attributes in sourceObject will override the similar ones in the current object.
|
|
3150
|
+
* - "source" of sourceObject will be ignored. so "sourcekey" always has priority over "source".
|
|
3151
|
+
* - mainTuple should be passed in detailed context so we can use it for filters.
|
|
3152
|
+
*
|
|
3153
|
+
* @param sourceObject the source object
|
|
3154
|
+
* @param table the table that these sources belong to.
|
|
3155
|
+
* @param isFacet whether this is for a facet or not
|
|
3156
|
+
*/
|
|
3157
|
+
clone(sourceObject: Record<string, unknown>, table: Table, isFacet?: boolean, mainTuple?: Tuple): SourceObjectWrapper;
|
|
3158
|
+
/**
|
|
3159
|
+
* Parse the given sourceobject and create the attributes
|
|
3160
|
+
* @param table
|
|
3161
|
+
* @param isFacet -- validation is differrent if it's a facet
|
|
3162
|
+
* @param sources already generated source (only useful for source-def generation)
|
|
3163
|
+
* @param mainTuple the main tuple that is used for filters
|
|
3164
|
+
* @param skipProcessingFilters whether we should skip processing filters or not
|
|
3165
|
+
* @returns
|
|
3166
|
+
*/
|
|
3167
|
+
private _process;
|
|
3168
|
+
/**
|
|
3169
|
+
* Return the string representation of this foreignkey path
|
|
3170
|
+
* returned format:
|
|
3171
|
+
* if not isLeft and outAlias is not passed: ()=()/.../()=()
|
|
3172
|
+
* if isLeft: left()=()/.../left()=()
|
|
3173
|
+
* if outAlias defined: ()=()/.../outAlias:=()/()
|
|
3174
|
+
* used in:
|
|
3175
|
+
* - export default
|
|
3176
|
+
* - column.getAggregate
|
|
3177
|
+
* - reference.read
|
|
3178
|
+
* @param reverse whether we want the reverse path
|
|
3179
|
+
* @param isLeft use left join
|
|
3180
|
+
* @param outAlias the alias that should be added to the output
|
|
3181
|
+
*/
|
|
3182
|
+
toString(reverse?: boolean, isLeft?: boolean, outAlias?: string, isReverseRightJoin?: boolean): string;
|
|
3183
|
+
/**
|
|
3184
|
+
* Turn this into a raw source path without any path prefix
|
|
3185
|
+
* NOTE the returned array is not a complete path as it
|
|
3186
|
+
* doesn't include the last column
|
|
3187
|
+
* currently used in two places:
|
|
3188
|
+
* - generating hashname for a sourcedef that uses path prefix
|
|
3189
|
+
* - generating the reverse path for a related entitty
|
|
3190
|
+
* @param reverse
|
|
3191
|
+
* @param outAlias alias that will be added to the last fk
|
|
3192
|
+
* regardless of reversing or not
|
|
3193
|
+
*/
|
|
3194
|
+
getRawSourcePath(reverse?: boolean, outAlias?: string): any[];
|
|
3195
|
+
/**
|
|
3196
|
+
* Return the reverse path as facet with the value of shortestkey
|
|
3197
|
+
* currently used in two places:
|
|
3198
|
+
* - column.refernece
|
|
3199
|
+
* - reference.generateRelatedReference
|
|
3200
|
+
* both are for generating the reverse related entity path
|
|
3201
|
+
* @param tuple
|
|
3202
|
+
* @param rootTable
|
|
3203
|
+
* @param outAlias
|
|
3204
|
+
*/
|
|
3205
|
+
getReverseAsFacet(tuple: Tuple, rootTable: Table, outAlias?: string): any;
|
|
3206
|
+
/**
|
|
3207
|
+
* if sourceObject has the required input_iframe properties, will attach `inputIframeProps` and `isInputIframe`
|
|
3208
|
+
* to the sourceObject.
|
|
3209
|
+
* The returned value of this function summarizes whether processing was successful or not.
|
|
3210
|
+
*
|
|
3211
|
+
* var res = processInputIframe(reference, tuple, usedColumnMapping);
|
|
3212
|
+
* if (res.error) {
|
|
3213
|
+
* console.log(res.message);
|
|
3214
|
+
* } else {
|
|
3215
|
+
* // success
|
|
3216
|
+
* }
|
|
3217
|
+
*
|
|
3218
|
+
* @param reference the reference object of the parent
|
|
3219
|
+
* @param usedIframeInputMappings an object capturing columns used in other mappings. used to avoid overlapping
|
|
3220
|
+
* @param tuple the tuple object
|
|
3221
|
+
*/
|
|
3222
|
+
processInputIframe(reference: Reference, usedIframeInputMappings: any, tuple?: Tuple): {
|
|
3223
|
+
success?: boolean;
|
|
3224
|
+
error?: boolean;
|
|
3225
|
+
message?: string;
|
|
3226
|
+
columns?: ReferenceColumn[];
|
|
3227
|
+
};
|
|
3228
|
+
/**
|
|
3229
|
+
* @param mainTuple
|
|
3230
|
+
* @param dontThrowError if set to true, will not throw an error if the filters are not valid
|
|
3231
|
+
*/
|
|
3232
|
+
processFilterNodes(mainTuple?: Tuple, dontThrowError?: boolean): {
|
|
3233
|
+
success: boolean;
|
|
3234
|
+
error?: boolean;
|
|
3235
|
+
message?: string;
|
|
3236
|
+
};
|
|
3237
|
+
}
|
|
3238
|
+
|
|
3239
|
+
export declare const systemColumnsHeuristicsMode: typeof ConfigService.setSystemColumnsHeuristicsMode;
|
|
3240
|
+
|
|
3241
|
+
export declare class TimedOutError extends ERMrestError {
|
|
3242
|
+
constructor(status: string, message: string);
|
|
3243
|
+
}
|
|
3244
|
+
|
|
3245
|
+
/**
|
|
3246
|
+
* Constructs a new Tuple. In database jargon, a tuple is a row in a
|
|
3247
|
+
* relation. This object represents a row returned by a query to ERMrest.
|
|
3248
|
+
*
|
|
3249
|
+
* Usage:
|
|
3250
|
+
* Clients _do not_ directly access this constructor.
|
|
3251
|
+
* See {@link Page#tuples}.
|
|
3252
|
+
*/
|
|
3253
|
+
declare class Tuple {
|
|
3254
|
+
private _pageRef;
|
|
3255
|
+
private _page;
|
|
3256
|
+
private _data;
|
|
3257
|
+
private _linkedData;
|
|
3258
|
+
private _linkedDataRIDs;
|
|
3259
|
+
private _rightsSummary;
|
|
3260
|
+
private _associationRightsSummary;
|
|
3261
|
+
_oldData?: Record<string, any>;
|
|
3262
|
+
private _ref?;
|
|
3263
|
+
private _canUpdate?;
|
|
3264
|
+
private _canUpdateReason?;
|
|
3265
|
+
private _canDelete?;
|
|
3266
|
+
private _canUnlink?;
|
|
3267
|
+
private _values?;
|
|
3268
|
+
private _isHTML?;
|
|
3269
|
+
private _canUpdateValues?;
|
|
3270
|
+
private _displayname?;
|
|
3271
|
+
private _rowName?;
|
|
3272
|
+
private _uniqueId?;
|
|
3273
|
+
private _templateVariables?;
|
|
3274
|
+
private _selfTemplateVariable?;
|
|
3275
|
+
constructor(pageReference: Reference, page: Page, data?: Record<string, any>, linkedData?: Record<string, any>, linkedDataRIDs?: Record<string, any>, rightsSummary?: Record<string, any>, associationRightsSummary?: Record<string, any>);
|
|
3276
|
+
/**
|
|
3277
|
+
* This is the reference of the Tuple
|
|
3278
|
+
*/
|
|
3279
|
+
get reference(): Reference;
|
|
3280
|
+
/**
|
|
3281
|
+
* This is the page of the Tuple
|
|
3282
|
+
*/
|
|
3283
|
+
get page(): Page;
|
|
3284
|
+
/**
|
|
3285
|
+
* Foreign key data.
|
|
3286
|
+
* During the read we get extra information about the foreign keys,
|
|
3287
|
+
* client could use these extra information for different purposes.
|
|
3288
|
+
* One of these usecases is domain_filter_pattern which they can
|
|
3289
|
+
* include foreignkey data in the pattern language.
|
|
3290
|
+
*/
|
|
3291
|
+
get linkedData(): Record<string, any>;
|
|
3292
|
+
/**
|
|
3293
|
+
* Foreign key data RID names.
|
|
3294
|
+
* Map of `column.name` keys with the `column.RID` as the value so RIDs
|
|
3295
|
+
* can be used in cases that require safe strings
|
|
3296
|
+
*/
|
|
3297
|
+
get linkedDataRIDs(): Record<string, any>;
|
|
3298
|
+
/**
|
|
3299
|
+
* Used for getting the current set of data for the reference.
|
|
3300
|
+
* This stores the original data in the _oldData object to preserve
|
|
3301
|
+
* it before any changes are made and those values can be properly
|
|
3302
|
+
* used in update requests.
|
|
3303
|
+
*
|
|
3304
|
+
* Notably, if a key value is changed, the old value needs to be kept
|
|
3305
|
+
* track of so that the column projections for the uri can be properly created
|
|
3306
|
+
* and both the old and new value for the modified key are submitted together
|
|
3307
|
+
* for proper updating.
|
|
3308
|
+
*/
|
|
3309
|
+
get data(): Record<string, any>;
|
|
3310
|
+
checkPermissions(permission: string, colName?: string, isAssoc?: boolean): boolean;
|
|
3311
|
+
/**
|
|
3312
|
+
* Indicates whether the client can update this tuple. Reporting a `true`
|
|
3313
|
+
* value DOES NOT guarantee the user right since some policies may be
|
|
3314
|
+
* undecidable until query execution.
|
|
3315
|
+
*
|
|
3316
|
+
* Usage:
|
|
3317
|
+
* ```
|
|
3318
|
+
* if (tuple.canUpdate) {
|
|
3319
|
+
* console.log(tuple.displayname, "may be updated by this client");
|
|
3320
|
+
* }
|
|
3321
|
+
* else {
|
|
3322
|
+
* console.log(tuple.displayname, "cannot be updated by this client");
|
|
3323
|
+
* }
|
|
3324
|
+
* ```
|
|
3325
|
+
*/
|
|
3326
|
+
get canUpdate(): boolean;
|
|
3327
|
+
/**
|
|
3328
|
+
* Indicates the reason as to why a user cannot update this tuple.
|
|
3329
|
+
*/
|
|
3330
|
+
get canUpdateReason(): string | undefined;
|
|
3331
|
+
/**
|
|
3332
|
+
* Indicates whether the client can delete this tuple. Reporting a `true`
|
|
3333
|
+
* value DOES NOT guarantee the user right since some policies may be
|
|
3334
|
+
* undecidable until query execution.
|
|
3335
|
+
*
|
|
3336
|
+
* Usage:
|
|
3337
|
+
* ```
|
|
3338
|
+
* if (tuple.canDelete) {
|
|
3339
|
+
* console.log(tuple.displayname, "may be deleted by this client");
|
|
3340
|
+
* }
|
|
3341
|
+
* else {
|
|
3342
|
+
* console.log(tuple.displayname, "cannot be deleted by this client");
|
|
3343
|
+
* }
|
|
3344
|
+
* ```
|
|
3345
|
+
*/
|
|
3346
|
+
get canDelete(): boolean;
|
|
3347
|
+
get canUnlink(): boolean;
|
|
3348
|
+
/**
|
|
3349
|
+
* The array of formatted/raw values of this tuple on basis of context "edit".
|
|
3350
|
+
* The ordering of the values in the array matches the ordering of the columns
|
|
3351
|
+
* in the reference (see {@link ERMrest.Reference#columns}).
|
|
3352
|
+
*
|
|
3353
|
+
* Usage (iterating over all values in the tuple):
|
|
3354
|
+
* ```
|
|
3355
|
+
* for (var i=0; len=reference.columns.length; i<len; i++) {
|
|
3356
|
+
* console.log(tuple.displayname, "has a", ref.columns[i].displayname,
|
|
3357
|
+
* "with value", tuple.values[i]);
|
|
3358
|
+
* }
|
|
3359
|
+
* ```
|
|
3360
|
+
*
|
|
3361
|
+
* Usage (getting a specific value by column position):
|
|
3362
|
+
* ```
|
|
3363
|
+
* var column = reference.columns[8]; // the 8th column in this refernece
|
|
3364
|
+
* console.log(tuple.displayname, "has a", column.displayname,
|
|
3365
|
+
* "with value", tuple.values[column.position]);
|
|
3366
|
+
* ```
|
|
3367
|
+
*/
|
|
3368
|
+
get values(): string[];
|
|
3369
|
+
/**
|
|
3370
|
+
* The array of boolean values of this tuple speicifying the value is HTML or not. The ordering of the
|
|
3371
|
+
* values in the array matches the ordering of the columns in the
|
|
3372
|
+
* reference (see {@link ERMrest.Reference#columns}).
|
|
3373
|
+
*
|
|
3374
|
+
* Usage (iterating over all values in the tuple):
|
|
3375
|
+
* ```
|
|
3376
|
+
* for (var i=0; len=reference.columns.length; i<len; i++) {
|
|
3377
|
+
* console.log(tuple.displayname, tuple.isHTML[i] ? " has an HTML value" : " does not has an HTML value");
|
|
3378
|
+
* }
|
|
3379
|
+
* ```
|
|
3380
|
+
*/
|
|
3381
|
+
get isHTML(): boolean[];
|
|
3382
|
+
/**
|
|
3383
|
+
* currently only populated in entry context
|
|
3384
|
+
*/
|
|
3385
|
+
get canUpdateValues(): boolean[];
|
|
3386
|
+
/**
|
|
3387
|
+
* The _display name_ of this tuple. For example, if this tuple is a
|
|
3388
|
+
* row from a table, then the display name is defined by the
|
|
3389
|
+
* row_markdown_pattern annotation for the _row_name/title_ context
|
|
3390
|
+
* or by the heuristics (title, name, id(text), SHORTESTKEY Concatenation using ':')
|
|
3391
|
+
*
|
|
3392
|
+
* Usage:
|
|
3393
|
+
* ```
|
|
3394
|
+
* console.log("This tuple has a displayable name of ", tuple.displayname.value);
|
|
3395
|
+
* ```
|
|
3396
|
+
*/
|
|
3397
|
+
get displayname(): DisplayName;
|
|
3398
|
+
/**
|
|
3399
|
+
* The row name_ of this tuple. For example, if this tuple is a
|
|
3400
|
+
* row from a table, then the display name is defined by the
|
|
3401
|
+
* row_markdown_pattern annotation for the _row_name_ context
|
|
3402
|
+
* or by the heuristics (title, name, id(text), SHORTESTKEY Concatenation using ':')
|
|
3403
|
+
*
|
|
3404
|
+
* Usage:
|
|
3405
|
+
* ```
|
|
3406
|
+
* console.log("This tuple has a displayable name of ", tuple.rowName.value);
|
|
3407
|
+
* ```
|
|
3408
|
+
*/
|
|
3409
|
+
get rowName(): DisplayName;
|
|
3410
|
+
/**
|
|
3411
|
+
* The unique identifier for this tuple composed of the values for each
|
|
3412
|
+
* of the shortest key columns concatenated together by an '_'
|
|
3413
|
+
*/
|
|
3414
|
+
get uniqueId(): string;
|
|
3415
|
+
/**
|
|
3416
|
+
* An object of what is available in templating environment for this tuple
|
|
3417
|
+
* it has the following attributes:
|
|
3418
|
+
* - values
|
|
3419
|
+
* - rowName
|
|
3420
|
+
* - uri
|
|
3421
|
+
*/
|
|
3422
|
+
get templateVariables(): any;
|
|
3423
|
+
/**
|
|
3424
|
+
* Should be used for populating $self for this tuple in templating environments
|
|
3425
|
+
* It will have,
|
|
3426
|
+
* - rowName
|
|
3427
|
+
* - uri
|
|
3428
|
+
*/
|
|
3429
|
+
get selfTemplateVariable(): any;
|
|
3430
|
+
/**
|
|
3431
|
+
* If the Tuple is derived from an association related table,
|
|
3432
|
+
* this function will return a reference to the corresponding
|
|
3433
|
+
* entity of this tuple's association table.
|
|
3434
|
+
*
|
|
3435
|
+
* For example, assume
|
|
3436
|
+
* Table1(K1,C1) <- AssocitaitonTable(FK1, FK2) -> Table2(K2,C2)
|
|
3437
|
+
* and current tuple is from Table2 with k2 = "2".
|
|
3438
|
+
* With origFKRData = {"k1": "1"} this function will return a reference
|
|
3439
|
+
* to AssocitaitonTable with FK1 = "1"" and FK2 = "2".
|
|
3440
|
+
*/
|
|
3441
|
+
getAssociationRef(origTableData: Record<string, any>): Reference | null;
|
|
3442
|
+
/**
|
|
3443
|
+
* @desc
|
|
3444
|
+
* This function takes the current Tuple (this) and creates a shallow copy of it while de-referencing
|
|
3445
|
+
* the _data attribute. This way _data can be modified in chaise without changing the originating Tuple
|
|
3446
|
+
* @returns a shallow copy of _this_ tuple with it's _data de-referenced
|
|
3447
|
+
*/
|
|
3448
|
+
copy(): Tuple;
|
|
3449
|
+
}
|
|
3450
|
+
|
|
3451
|
+
export declare class UnauthorizedError extends ERMrestError {
|
|
3452
|
+
constructor(status: string, message: string);
|
|
3453
|
+
}
|
|
3454
|
+
|
|
3455
|
+
export declare class UnsupportedFilters extends ERMrestError {
|
|
3456
|
+
constructor(discardedFacets: any, partialyDiscardedFacets: any);
|
|
3457
|
+
}
|
|
3458
|
+
|
|
3459
|
+
export { Upload }
|
|
3460
|
+
|
|
3461
|
+
export { validateJSONLD }
|
|
3462
|
+
|
|
3463
|
+
export { _validateMustacheTemplate }
|
|
3464
|
+
|
|
3465
|
+
/**
|
|
3466
|
+
* A pseudo-column without any actual source definition behind it.
|
|
3467
|
+
* This constructor assumes that the sourceObject has markdown_name and display.markdown_pattern.
|
|
3468
|
+
*
|
|
3469
|
+
* The name is currently generated by the visible columns logic. It will use the
|
|
3470
|
+
* "$<markdown_name>" pattern and if a column with this name already exists in the table,
|
|
3471
|
+
* it will append "-<integer>" to it.
|
|
3472
|
+
*/
|
|
3473
|
+
declare class VirtualColumn extends ReferenceColumn {
|
|
3474
|
+
isPseudo: boolean;
|
|
3475
|
+
isVirtualColumn: boolean;
|
|
3476
|
+
constructor(reference: Reference, sourceObjectWrapper: SourceObjectWrapper, name: string, mainTuple?: Tuple);
|
|
3477
|
+
}
|
|
3478
|
+
|
|
3479
|
+
declare type VisibleColumn = ReferenceColumn | PseudoColumn | VirtualColumn | ForeignKeyPseudoColumn | InboundForeignKeyPseudoColumn | ForeignKeyPseudoColumn | AssetPseudoColumn;
|
|
3480
|
+
|
|
3481
|
+
export { }
|