Skip to content

Commit 02b5f29

Browse files
authored
Package Updates (#150)
1 parent 5668a83 commit 02b5f29

35 files changed

+3521
-3668
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1+
## 1.19.0 - 2023-03-22
2+
- Package updates
3+
- Extract jest configuration out of `package.json` and into `jest.config.js`.
4+
- Add typings for `ResponseMetadata` and `MetadataField` for query response.
5+
- Replace `[[Reference]]` syntax in docs with `{@link Reference}`.
6+
- Export additional types so they're not hidden from implementors.
7+
18
## 1.18.8 - 2023-03-02
2-
- Issue 47202: Options to reduce payload of getContainers.api response
9+
- [Issue 47202](https://www.labkey.org/home/Developer/issues/issues-details.view?issueId=47202): Options to reduce payload of getContainers.api response
310
- two new properties: includeWorkbookChildren and includeStandardProperties
411

512
## 1.18.7 - 2023-02-28

jest.config.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
globals: {
3+
LABKEY: {
4+
contextPath: '',
5+
defaultHeaders: {
6+
'X-LABKEY-CSRF': 'TEST_CSRF_TOKEN'
7+
}
8+
}
9+
},
10+
moduleFileExtensions: ['ts', 'js'],
11+
testEnvironment: 'jsdom',
12+
testResultsProcessor: 'jest-teamcity-reporter',
13+
testRegex: '(\\.(spec))\\.(ts)$',
14+
transform: {
15+
'^.+\\.ts$': [
16+
'ts-jest',
17+
{
18+
// This increases test perf by a considerable margin
19+
isolatedModules: true,
20+
}
21+
],
22+
},
23+
};

package-lock.json

Lines changed: 3203 additions & 3426 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@labkey/api",
3-
"version": "1.18.8",
3+
"version": "1.19.0",
44
"description": "JavaScript client API for LabKey Server",
55
"scripts": {
66
"build": "npm run build:dist && npm run build:docs",
@@ -39,40 +39,22 @@
3939
"registry": "https://labkey.jfrog.io/artifactory/api/npm/libs-client"
4040
},
4141
"devDependencies": {
42-
"@babel/core": "7.18.2",
42+
"@babel/core": "7.21.0",
4343
"@labkey/eslint-config-base": "0.0.12",
44-
"@types/jest": "27.5.1",
45-
"@types/sinon": "10.0.11",
44+
"@types/jest": "29.4.0",
45+
"@types/sinon": "10.0.13",
4646
"cross-env": "7.0.3",
47-
"gh-pages": "4.0.0",
48-
"jest": "28.1.0",
49-
"jest-environment-jsdom": "28.1.0",
47+
"gh-pages": "5.0.0",
48+
"jest": "29.5.0",
49+
"jest-environment-jsdom": "29.5.0",
5050
"jest-teamcity-reporter": "0.9.0",
51-
"rimraf": "3.0.2",
52-
"sinon": "14.0.0",
53-
"ts-jest": "28.0.3",
54-
"ts-loader": "9.3.0",
55-
"typedoc": "0.22.17",
56-
"typescript": "4.7.2",
57-
"webpack": "5.72.1",
58-
"webpack-cli": "4.9.2"
59-
},
60-
"jest": {
61-
"globals": {
62-
"LABKEY": {
63-
"contextPath": "",
64-
"defaultHeaders": {
65-
"X-LABKEY-CSRF": "TEST_CSRF_TOKEN"
66-
}
67-
}
68-
},
69-
"moduleFileExtensions": [
70-
"ts",
71-
"js"
72-
],
73-
"preset": "ts-jest",
74-
"testEnvironment": "jsdom",
75-
"testResultsProcessor": "jest-teamcity-reporter",
76-
"testRegex": "(\\.(spec))\\.(ts)$"
51+
"rimraf": "4.3.1",
52+
"sinon": "15.0.1",
53+
"ts-jest": "29.0.5",
54+
"ts-loader": "9.4.2",
55+
"typedoc": "0.23.26",
56+
"typescript": "4.9.5",
57+
"webpack": "5.76.2",
58+
"webpack-cli": "5.0.1"
7759
}
7860
}

src/labkey/ActionURL.spec.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,13 @@ describe('ActionURL', () => {
7575
validatePath('/home/project-begin.view', '', '/home', 'project', 'begin');
7676
validatePath('/home/with/folder/project-begin.view', '', '/home/with/folder', 'project', 'begin');
7777
validatePath('/%E2%98%83/%E2%9D%86/%E2%A8%8Drosty-%F0%9D%95%8Anow.view', '', '/☃/❆', '⨍rosty', '𝕊now');
78-
validatePath('/home%2C%2B%2B%3B%40%26%3D%24%23%2Cfolder/project-begin.view', '', '/home,++;@&=$#,folder', 'project', 'begin');
78+
validatePath(
79+
'/home%2C%2B%2B%3B%40%26%3D%24%23%2Cfolder/project-begin.view',
80+
'',
81+
'/home,++;@&=$#,folder',
82+
'project',
83+
'begin'
84+
);
7985
validatePath(
8086
'/my%20folder/my%20path/pipeline-status-action.view?rowId=123',
8187
'',
@@ -111,10 +117,22 @@ describe('ActionURL', () => {
111117
'pipeline-status',
112118
'action'
113119
);
114-
contextPath ='/my, CommaContext';
120+
contextPath = '/my, CommaContext';
115121
getServerContext().contextPath = contextPath;
116-
validatePath(`${contextPath}/1%2C%202/pro%2C%20ject-be%2C%20%2Cgin.view`, contextPath, '/1, 2', 'pro, ject', 'be, ,gin');
117-
validatePath(`${contextPath}/1%2C%202%2C%203/project-begin.view`, contextPath, '/1, 2, 3', 'project', 'begin');
122+
validatePath(
123+
`${contextPath}/1%2C%202/pro%2C%20ject-be%2C%20%2Cgin.view`,
124+
contextPath,
125+
'/1, 2',
126+
'pro, ject',
127+
'be, ,gin'
128+
);
129+
validatePath(
130+
`${contextPath}/1%2C%202%2C%203/project-begin.view`,
131+
contextPath,
132+
'/1, 2, 3',
133+
'project',
134+
'begin'
135+
);
118136

119137
// old style URL
120138
validatePath(`${contextPath}/project/home/begin.view`, contextPath, '/home', 'project', 'begin');

src/labkey/ActionURL.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -280,22 +280,21 @@ export interface ActionPath {
280280
* @param path to be decoded.
281281
* @return A new copy of the given path with all encoded characters decoded
282282
*/
283-
function fullyDecodeURIPath(path: string): string
284-
{
283+
function fullyDecodeURIPath(path: string): string {
285284
return decodeURI(path)
286-
.replace(/%2C/g, ",")
287-
.replace(/%2B/g, "+")
288-
.replace(/%3B/g, ";")
289-
.replace(/%40/g, "@")
290-
.replace(/%26/g, "&")
291-
.replace(/%3D/g, "=")
292-
.replace(/%24/g, "$")
293-
.replace(/%23/g, "#");
285+
.replace(/%2C/g, ',')
286+
.replace(/%2B/g, '+')
287+
.replace(/%3B/g, ';')
288+
.replace(/%40/g, '@')
289+
.replace(/%26/g, '&')
290+
.replace(/%3D/g, '=')
291+
.replace(/%24/g, '$')
292+
.replace(/%23/g, '#');
294293
}
295294

296295
/**
297296
* Parses a location pathname of a LabKey URL into its constituent parts (e.g. controller, action, etc).
298-
* Defaults to the current location's pathname and context path. The parsed parts of the [[ActionPath]] are
297+
* Defaults to the current location's pathname and context path. The parsed parts of the {@link ActionPath} are
299298
* URI decoded.
300299
* #### Example
301300
*
@@ -323,7 +322,7 @@ function fullyDecodeURIPath(path: string): string
323322
* @param pathname A pathname to parse. Defaults to value of window.location.pathname.
324323
* **Note:** This function does not parse full URLs. It expects only the value that would be part of the "pathname"
325324
* on window.location. See https://html.spec.whatwg.org/multipage/history.html#dom-location-pathname.
326-
* @param contextPath A context path to parse. Defaults to value returned by [[getContextPath]].
325+
* @param contextPath A context path to parse. Defaults to value returned by {@link getContextPath}.
327326
*/
328327
export function getPathFromLocation(pathname?: string, contextPath?: string): ActionPath {
329328
const ctxPath = contextPath ?? getContextPath();
@@ -377,7 +376,7 @@ export function getReturnUrl(): string {
377376
}
378377

379378
/**
380-
* Turn the parameter object into a query string (e.g. {x:'fred'} -> "x=fred").
379+
* Turn the parameter object into a query string (e.g. `{x:'fred'} -> "x=fred"`).
381380
* The returned query string is not prepended by a question mark ('?').
382381
*
383382
* @param parameters An object with properties corresponding to GET parameters to append to the URL.

src/labkey/Ajax.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export interface RequestOptions {
114114

115115
/**
116116
* The url used for the XMLHttpRequest. If you are making a request to the LabKey Server instance
117-
* see [[ActionURL.buildURL]] for helpful URL construction.
117+
* see {@link buildURL} for helpful URL construction.
118118
*/
119119
url: string;
120120
}

src/labkey/App.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
type OnInitCallback<CTX> = (target: string, ctx: CTX) => void;
1+
export type OnInitCallback<CTX> = (target: string, ctx: CTX) => void;
22

33
interface AppRegistryItem<CTX = any> {
44
appName: string;
@@ -57,7 +57,7 @@ export function init(LABKEY: any) {
5757
}
5858

5959
/**
60-
* Load/initialize applications that are registered via [[registerApp]].
60+
* Load/initialize applications that are registered via {@link registerApp}.
6161
* @param appName
6262
* @param appTarget
6363
* @param appContext
@@ -88,7 +88,7 @@ export function loadApp<CTX = any>(appName: string, appTarget: string, appContex
8888
}
8989

9090
/**
91-
* Registers an app by "appName". When the app is requested to be loaded (via [[loadApp]]) the onInit()
91+
* Registers an app by "appName". When the app is requested to be loaded (via {@link loadApp}) the onInit()
9292
* callback will be invoked to initialize the app.
9393
* @param appName The unique name for this app type.
9494
* @param onInit Callback that will be invoked when the app is loaded.

src/labkey/Assay.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function applyArguments(args: IArguments, options: GetAssaysOptions, parameter?:
8080
* LABKEY.Assay.getAll({success: successHandler, failure: errorHandler});
8181
* ```
8282
* @param options
83-
* @see [[AssayDesign]]
83+
* @see {@link AssayDesign}
8484
*/
8585
export function getAll(options: GetAssaysOptions): XMLHttpRequest {
8686
return getAssays(applyArguments(arguments, options));
@@ -170,7 +170,7 @@ export interface GetByIdOptions extends GetAssaysOptions {
170170
/**
171171
* Gets an assay by its ID.
172172
* @param options
173-
* @see [[AssayDesign]]
173+
* @see {@link AssayDesign}
174174
*/
175175
export function getById(options: GetByIdOptions): XMLHttpRequest {
176176
return getAssays(applyArguments(arguments, options, 'id'));
@@ -184,7 +184,7 @@ export interface GetByNameOptions extends GetAssaysOptions {
184184
/**
185185
* Gets an assay by name.
186186
* @param options
187-
* @see [[AssayDesign]]
187+
* @see {@link AssayDesign}
188188
*/
189189
export function getByName(options: GetByNameOptions): XMLHttpRequest {
190190
return getAssays(applyArguments(arguments, options, 'name'));
@@ -198,7 +198,7 @@ export interface GetByTypeOptions extends GetAssaysOptions {
198198
/**
199199
* Gets an assay by type.
200200
* @param options
201-
* @see [[AssayDesign]]
201+
* @see {@link AssayDesign}
202202
*/
203203
export function getByType(options: GetByTypeOptions): XMLHttpRequest {
204204
return getAssays(applyArguments(arguments, options, 'type'));
@@ -214,7 +214,7 @@ export interface GetNAbRunsOptions extends RequestCallbackOptions {
214214
* If not supplied, the current container's path will be used.
215215
*/
216216
containerPath?: string;
217-
/** Array of objects created by {@link LABKEY.Filter.create}. */
217+
/** Array of objects created by {@link create}. */
218218
filterArray?: IFilter[];
219219
/** Whether the parameters used in the neutralization curve fitting calculation
220220
* should be included in the response.*/

src/labkey/Domain.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ export function getDomainDetails(config: GetDomainDetailsOptions): XMLHttpReques
318318
export interface GetDomainOptions extends BaseGetDomainOptions, RequestCallbackOptions<DomainDesign> {}
319319

320320
/**
321-
* Gets a domain design. This is a deprecated. Use [[getDomainDetails]] instead.
321+
* Gets a domain design. This is a deprecated. Use {@link getDomainDetails} instead.
322322
* @deprecated
323323
*/
324324
export function get(config: GetDomainOptions): XMLHttpRequest {

0 commit comments

Comments
 (0)