@isrd-isi-edu/ermrestjs 2.8.0 → 2.9.1
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/js/core.js +18 -14
- package/js/hatrac.js +2 -2
- package/package.json +2 -2
- package/src/models/reference/reference.ts +2 -2
- package/src/models/reference-column/foreign-key-pseudo-column.ts +10 -1
- package/src/models/reference-column/key-pseudo-column.ts +5 -1
- package/src/models/reference-column/reference-column.ts +10 -1
- package/src/utils/type-utils.ts +7 -0
- package/vite.config.mts +8 -3
package/js/core.js
CHANGED
|
@@ -21,7 +21,7 @@ import HTTPService from '@isrd-isi-edu/ermrestjs/src/services/http';
|
|
|
21
21
|
import $log from '@isrd-isi-edu/ermrestjs/src/services/logger';
|
|
22
22
|
|
|
23
23
|
// utils
|
|
24
|
-
import { isObjectAndNotNull, isEmptyArray, isStringAndNotEmpty, isValidColorRGBHex } from '@isrd-isi-edu/ermrestjs/src/utils/type-utils';
|
|
24
|
+
import { isObjectAndNotNull, isEmptyArray, isStringAndNotEmpty, isValidColorRGBHex, isValidVisibleCellHeight } from '@isrd-isi-edu/ermrestjs/src/utils/type-utils';
|
|
25
25
|
import { fixedEncodeURIComponent, escapeHTML, updateObject } from '@isrd-isi-edu/ermrestjs/src/utils/value-utils';
|
|
26
26
|
import {
|
|
27
27
|
_annotations,
|
|
@@ -3570,6 +3570,8 @@ import {
|
|
|
3570
3570
|
}
|
|
3571
3571
|
}
|
|
3572
3572
|
|
|
3573
|
+
const visibleCellHeight = _getHierarchicalDisplayAnnotationValue(this, context, "visible_cell_height", false);
|
|
3574
|
+
|
|
3573
3575
|
this._display[context] = {
|
|
3574
3576
|
"hideColumnHeader": annotation.hide_column_header || false, // only hide if the annotation value is true
|
|
3575
3577
|
"isPreformat": hasPreformat,
|
|
@@ -3582,7 +3584,8 @@ import {
|
|
|
3582
3584
|
"columnOrder": columnOrder,
|
|
3583
3585
|
"comment": _processModelComment(comment, commentRenderMarkdown, columnCommentDisplayMode),
|
|
3584
3586
|
"commentRenderMarkdown": commentRenderMarkdown,
|
|
3585
|
-
"commentDisplayMode": columnCommentDisplayMode
|
|
3587
|
+
"commentDisplayMode": columnCommentDisplayMode,
|
|
3588
|
+
"visibleCellHeight": isValidVisibleCellHeight(visibleCellHeight) ? visibleCellHeight : undefined
|
|
3586
3589
|
};
|
|
3587
3590
|
}
|
|
3588
3591
|
return this._display[context];
|
|
@@ -4078,10 +4081,8 @@ import {
|
|
|
4078
4081
|
|
|
4079
4082
|
columnOrder = _processColumnOrderList(annotation.column_order, this.table);
|
|
4080
4083
|
showKeyLink = annotation.show_key_link;
|
|
4081
|
-
if (typeof
|
|
4082
|
-
showKeyLink = _getHierarchicalDisplayAnnotationValue(
|
|
4083
|
-
self, context, "show_key_link"
|
|
4084
|
-
);
|
|
4084
|
+
if (typeof showKeyLink !== "boolean") {
|
|
4085
|
+
showKeyLink = _getHierarchicalDisplayAnnotationValue(self, context, "show_key_link", false);
|
|
4085
4086
|
|
|
4086
4087
|
// default:
|
|
4087
4088
|
// compact/select: false
|
|
@@ -4108,24 +4109,27 @@ import {
|
|
|
4108
4109
|
comment = annotComment;
|
|
4109
4110
|
}
|
|
4110
4111
|
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
if (isObjectAndNotNull(
|
|
4114
|
-
if (_isValidModelCommentDisplay(
|
|
4115
|
-
commentDisplay =
|
|
4112
|
+
const commentProps = _getHierarchicalDisplayAnnotationValue(this, context, "comment_display", false);
|
|
4113
|
+
let commentDisplay = _commentDisplayModes.tooltip, commentRenderMarkdown;
|
|
4114
|
+
if (isObjectAndNotNull(commentProps)) {
|
|
4115
|
+
if (_isValidModelCommentDisplay(commentProps.column_comment_display)) {
|
|
4116
|
+
commentDisplay = commentProps.column_comment_display;
|
|
4116
4117
|
}
|
|
4117
|
-
if (typeof
|
|
4118
|
-
commentRenderMarkdown =
|
|
4118
|
+
if (typeof commentProps.comment_render_markdown === 'boolean') {
|
|
4119
|
+
commentRenderMarkdown = commentProps.comment_render_markdown;
|
|
4119
4120
|
}
|
|
4120
4121
|
}
|
|
4121
4122
|
|
|
4123
|
+
const visibleCellHeight = _getHierarchicalDisplayAnnotationValue(this, context, "visible_cell_height", false);
|
|
4124
|
+
|
|
4122
4125
|
this._display[context] = {
|
|
4123
4126
|
"columnOrder": columnOrder,
|
|
4124
4127
|
"isMarkdownPattern": (typeof annotation.markdown_pattern === 'string'),
|
|
4125
4128
|
"templateEngine": annotation.template_engine,
|
|
4126
4129
|
"markdownPattern": annotation.markdown_pattern,
|
|
4127
4130
|
"showKeyLink": showKeyLink,
|
|
4128
|
-
"comment": _processModelComment(comment, commentRenderMarkdown, commentDisplay)
|
|
4131
|
+
"comment": _processModelComment(comment, commentRenderMarkdown, commentDisplay),
|
|
4132
|
+
"visibleCellHeight": isValidVisibleCellHeight(visibleCellHeight) ? visibleCellHeight : undefined
|
|
4129
4133
|
};
|
|
4130
4134
|
}
|
|
4131
4135
|
|
package/js/hatrac.js
CHANGED
|
@@ -171,8 +171,8 @@ export function Upload(file, otherInfo) {
|
|
|
171
171
|
if (!this.file) throw new Error('No file provided while creating hatrac file object');
|
|
172
172
|
|
|
173
173
|
this.storedFilename = file.name; // the name that will be used for content-disposition and filename column
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
/* In Node (unit tests) the caller provides `file.buffer`; the browser path reads via FileReader.
|
|
175
|
+
We avoid importing `fs` here so the browser bundle has no Node built-ins to stub. */
|
|
176
176
|
|
|
177
177
|
this.column = otherInfo.column;
|
|
178
178
|
if (!this.column) throw new Error('No column provided while creating hatrac file object');
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@isrd-isi-edu/ermrestjs",
|
|
3
3
|
"description": "ERMrest client library in JavaScript",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.9.1",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">= 20.0.0",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"spark-md5": "^3.0.0",
|
|
68
68
|
"terser": "^5.44.1",
|
|
69
69
|
"typescript": "~5.9.3",
|
|
70
|
-
"vite": "^
|
|
70
|
+
"vite": "^8.0.16",
|
|
71
71
|
"vite-plugin-compression2": "^2.5.3"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
@@ -1688,7 +1688,7 @@ export class Reference {
|
|
|
1688
1688
|
/**
|
|
1689
1689
|
* Returns true if
|
|
1690
1690
|
* - ermrest supports tcrs, and
|
|
1691
|
-
* - table
|
|
1691
|
+
* - table or any of the columns of the table have dynamic acls, and
|
|
1692
1692
|
* - table has RID column, and
|
|
1693
1693
|
* - table is not marked non-updatable by annotation
|
|
1694
1694
|
*/
|
|
@@ -1698,7 +1698,7 @@ export class Reference {
|
|
|
1698
1698
|
this._canUseTCRS =
|
|
1699
1699
|
this.table.schema.catalog.features[rightKey] === true &&
|
|
1700
1700
|
// eslint-disable-next-line eqeqeq
|
|
1701
|
-
this.table.rights[_ERMrestACLs.UPDATE] == null &&
|
|
1701
|
+
(this.table.rights[_ERMrestACLs.UPDATE] == null || this.table.columns.all().some((col) => col.rights[_ERMrestACLs.UPDATE] == null)) &&
|
|
1702
1702
|
this.table.columns.has('RID') &&
|
|
1703
1703
|
this.canUpdate;
|
|
1704
1704
|
}
|
|
@@ -10,7 +10,12 @@ import { Tuple } from '@isrd-isi-edu/ermrestjs/src/models/reference';
|
|
|
10
10
|
import $log from '@isrd-isi-edu/ermrestjs/src/services/logger';
|
|
11
11
|
|
|
12
12
|
// utils
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
isObjectAndNotNull,
|
|
15
|
+
isStringAndNotEmpty,
|
|
16
|
+
isObjectAndKeyExists,
|
|
17
|
+
isValidVisibleCellHeight,
|
|
18
|
+
} from '@isrd-isi-edu/ermrestjs/src/utils/type-utils';
|
|
14
19
|
import { fixedEncodeURIComponent } from '@isrd-isi-edu/ermrestjs/src/utils/value-utils';
|
|
15
20
|
import { renderMarkdown } from '@isrd-isi-edu/ermrestjs/src/utils/markdown-utils';
|
|
16
21
|
import { _annotations, _foreignKeyInputModes } from '@isrd-isi-edu/ermrestjs/src/utils/constants';
|
|
@@ -580,6 +585,10 @@ export class ForeignKeyPseudoColumn extends ReferenceColumn {
|
|
|
580
585
|
sourceDisplay.hideColumnHeader = this.sourceObject.hide_column_header;
|
|
581
586
|
}
|
|
582
587
|
|
|
588
|
+
if (this.sourceObject && isValidVisibleCellHeight(this.sourceObject.visible_cell_height)) {
|
|
589
|
+
sourceDisplay.visibleCellHeight = this.sourceObject.visible_cell_height;
|
|
590
|
+
}
|
|
591
|
+
|
|
583
592
|
Object.assign(res, fkDisplay, sourceDisplay);
|
|
584
593
|
this._display_cached = res;
|
|
585
594
|
}
|
|
@@ -7,7 +7,7 @@ import { Reference, Tuple } from '@isrd-isi-edu/ermrestjs/src/models/reference';
|
|
|
7
7
|
|
|
8
8
|
// utils
|
|
9
9
|
import { renderMarkdown } from '@isrd-isi-edu/ermrestjs/src/utils/markdown-utils';
|
|
10
|
-
import { isStringAndNotEmpty } from '@isrd-isi-edu/ermrestjs/src/utils/type-utils';
|
|
10
|
+
import { isValidVisibleCellHeight, isStringAndNotEmpty } from '@isrd-isi-edu/ermrestjs/src/utils/type-utils';
|
|
11
11
|
import { buildSelfTemplateVariables } from '@isrd-isi-edu/ermrestjs/src/utils/template-utils';
|
|
12
12
|
|
|
13
13
|
// legacy
|
|
@@ -227,6 +227,10 @@ export class KeyPseudoColumn extends ReferenceColumn {
|
|
|
227
227
|
sourceDisplay.hideColumnHeader = this.sourceObject.hide_column_header;
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
+
if (this.sourceObject && isValidVisibleCellHeight(this.sourceObject.visible_cell_height)) {
|
|
231
|
+
sourceDisplay.visibleCellHeight = this.sourceObject.visible_cell_height;
|
|
232
|
+
}
|
|
233
|
+
|
|
230
234
|
Object.assign(res, keyDisplay, sourceDisplay);
|
|
231
235
|
this._display_cached = res;
|
|
232
236
|
}
|
|
@@ -12,7 +12,12 @@ import $log from '@isrd-isi-edu/ermrestjs/src/services/logger';
|
|
|
12
12
|
|
|
13
13
|
// utils
|
|
14
14
|
import { renderMarkdown } from '@isrd-isi-edu/ermrestjs/src/utils/markdown-utils';
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
isValidVisibleCellHeight,
|
|
17
|
+
isObjectAndKeyExists,
|
|
18
|
+
isObjectAndNotNull,
|
|
19
|
+
isStringAndNotEmpty,
|
|
20
|
+
} from '@isrd-isi-edu/ermrestjs/src/utils/type-utils';
|
|
16
21
|
import { _annotations, _contexts } from '@isrd-isi-edu/ermrestjs/src/utils/constants';
|
|
17
22
|
import { buildSelfTemplateVariables } from '@isrd-isi-edu/ermrestjs/src/utils/template-utils';
|
|
18
23
|
import ActiveListCondition from '@isrd-isi-edu/ermrestjs/src/models/active-list-condition';
|
|
@@ -385,6 +390,10 @@ export class ReferenceColumn {
|
|
|
385
390
|
sourceDisplay.hideColumnHeader = this.sourceObject.hide_column_header;
|
|
386
391
|
}
|
|
387
392
|
|
|
393
|
+
if (this.sourceObject && isValidVisibleCellHeight(this.sourceObject.visible_cell_height)) {
|
|
394
|
+
sourceDisplay.visibleCellHeight = this.sourceObject.visible_cell_height;
|
|
395
|
+
}
|
|
396
|
+
|
|
388
397
|
// Using assign to avoid changing the original colDisplay
|
|
389
398
|
Object.assign(res, colDisplay, sourceDisplay);
|
|
390
399
|
this._display_cached = res;
|
package/src/utils/type-utils.ts
CHANGED
|
@@ -87,3 +87,10 @@ export function verify(test: any, message: string) {
|
|
|
87
87
|
throw new InvalidInputError(message);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* check if the value is a valid visible cell height (i.e. a positive number or false)
|
|
93
|
+
*/
|
|
94
|
+
export function isValidVisibleCellHeight(value: unknown) {
|
|
95
|
+
return (typeof value === 'number' && value > 0) || value === false;
|
|
96
|
+
}
|
package/vite.config.mts
CHANGED
|
@@ -24,7 +24,7 @@ export default defineConfig(async (): Promise<UserConfig> => {
|
|
|
24
24
|
// dev related plugins
|
|
25
25
|
if (isDev) {
|
|
26
26
|
// visualize the bundle size
|
|
27
|
-
const { visualizer } = await import('rollup-plugin-visualizer');
|
|
27
|
+
const { visualizer } = await import(/* @vite-ignore */ 'rollup-plugin-visualizer');
|
|
28
28
|
plugins.push(
|
|
29
29
|
visualizer({
|
|
30
30
|
filename: resolve(__dirname, 'dist', 'stats.html'),
|
|
@@ -61,14 +61,12 @@ export default defineConfig(async (): Promise<UserConfig> => {
|
|
|
61
61
|
name: 'ERMrest',
|
|
62
62
|
format: 'umd',
|
|
63
63
|
entryFileNames: 'ermrest.js',
|
|
64
|
-
inlineDynamicImports: true,
|
|
65
64
|
},
|
|
66
65
|
// the following is the main build that chaise uses:
|
|
67
66
|
{
|
|
68
67
|
name: 'ERMrest',
|
|
69
68
|
format: 'umd',
|
|
70
69
|
entryFileNames: 'ermrest.min.js',
|
|
71
|
-
inlineDynamicImports: true,
|
|
72
70
|
},
|
|
73
71
|
],
|
|
74
72
|
},
|
|
@@ -84,6 +82,13 @@ export default defineConfig(async (): Promise<UserConfig> => {
|
|
|
84
82
|
resolve: {
|
|
85
83
|
alias: {
|
|
86
84
|
'@isrd-isi-edu/ermrestjs': resolve(__dirname),
|
|
85
|
+
/**
|
|
86
|
+
* markdown-it imports the deprecated Node `punycode` builtin. In a browser
|
|
87
|
+
* build that gets externalized to a stub and logs a warning. markdown-it only
|
|
88
|
+
* calls it inside try/catch for hostname normalization, so an empty shim is
|
|
89
|
+
* safe (ASCII URLs unaffected) and silences the warning.
|
|
90
|
+
*/
|
|
91
|
+
punycode: resolve(__dirname, 'vendor/punycode-shim.js'),
|
|
87
92
|
},
|
|
88
93
|
},
|
|
89
94
|
plugins,
|