@sasjs/api 0.37.0 → 0.39.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/build/browser.js +1 -1
- package/build/cjs/code/index.js +15 -2
- package/build/cjs/code/service.js +3 -3
- package/build/esm/code/index.d.ts +12 -0
- package/build/esm/code/index.d.ts.map +1 -1
- package/build/esm/code/index.js +12 -0
- package/build/esm/code/service.d.ts +8 -1
- package/build/esm/code/service.d.ts.map +1 -1
- package/build/esm/code/service.js +3 -3
- package/package.json +2 -2
package/build/browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @sasjs/api 0.
|
|
1
|
+
/* @sasjs/api 0.39.0 - the SASjs Server API, for a service worker. https://github.com/sasjs/api */
|
|
2
2
|
"use strict";
|
|
3
3
|
var SASjsApi = (() => {
|
|
4
4
|
var __defProp = Object.defineProperty;
|
package/build/cjs/code/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createCodeService = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* The code service, on its own entry point.
|
|
6
4
|
*
|
|
@@ -8,5 +6,20 @@ exports.createCodeService = void 0;
|
|
|
8
6
|
* `.sasjslint`), so it cannot be bundled for a service worker: the package root
|
|
9
7
|
* stays free of it and a host that wants these routes imports `@sasjs/api/code`.
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.LintConfig = exports.createCodeService = void 0;
|
|
11
11
|
var service_js_1 = require("./service.js");
|
|
12
12
|
Object.defineProperty(exports, "createCodeService", { enumerable: true, get: function () { return service_js_1.createCodeService; } });
|
|
13
|
+
/**
|
|
14
|
+
* The configuration class the service hands the linter.
|
|
15
|
+
*
|
|
16
|
+
* A host that resolves rules from its own storage parses a `.sasjslint` and has
|
|
17
|
+
* to build the configuration the routes expect. Exporting the class here lets
|
|
18
|
+
* it build that with the linter this package bundles, instead of adding
|
|
19
|
+
* `@sasjs/lint` to its own dependencies and carrying a second copy to keep in
|
|
20
|
+
* step. What keeps the two in step is this package's exact dependency pin, not
|
|
21
|
+
* the export: a host that installs the linter itself still resolves whatever
|
|
22
|
+
* its own tree gives it.
|
|
23
|
+
*/
|
|
24
|
+
var lint_1 = require("@sasjs/lint");
|
|
25
|
+
Object.defineProperty(exports, "LintConfig", { enumerable: true, get: function () { return lint_1.LintConfig; } });
|
|
@@ -42,15 +42,15 @@ const createCodeService = (options = {}) => {
|
|
|
42
42
|
if (!caller)
|
|
43
43
|
throw new types_js_1.ApiError(401, 'Unauthorized');
|
|
44
44
|
};
|
|
45
|
-
const configFor = (filePath) => options.lintConfig ? options.lintConfig(filePath) : undefined;
|
|
45
|
+
const configFor = async (filePath) => options.lintConfig ? await options.lintConfig(filePath) : undefined;
|
|
46
46
|
return {
|
|
47
47
|
async lint(caller, body) {
|
|
48
48
|
requireCaller(caller);
|
|
49
|
-
return (0, lint_1.lintText)(codeOf(body), configFor(body.filePath));
|
|
49
|
+
return (0, lint_1.lintText)(codeOf(body), await configFor(body.filePath));
|
|
50
50
|
},
|
|
51
51
|
async format(caller, body) {
|
|
52
52
|
requireCaller(caller);
|
|
53
|
-
return (0, lint_1.formatText)(codeOf(body), configFor(body.filePath));
|
|
53
|
+
return (0, lint_1.formatText)(codeOf(body), await configFor(body.filePath));
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
};
|
|
@@ -7,4 +7,16 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export { createCodeService } from './service.js';
|
|
9
9
|
export type { CodeRequest, CodeService, CodeServiceOptions } from './service.js';
|
|
10
|
+
/**
|
|
11
|
+
* The configuration class the service hands the linter.
|
|
12
|
+
*
|
|
13
|
+
* A host that resolves rules from its own storage parses a `.sasjslint` and has
|
|
14
|
+
* to build the configuration the routes expect. Exporting the class here lets
|
|
15
|
+
* it build that with the linter this package bundles, instead of adding
|
|
16
|
+
* `@sasjs/lint` to its own dependencies and carrying a second copy to keep in
|
|
17
|
+
* step. What keeps the two in step is this package's exact dependency pin, not
|
|
18
|
+
* the export: a host that installs the linter itself still resolves whatever
|
|
19
|
+
* its own tree gives it.
|
|
20
|
+
*/
|
|
21
|
+
export { LintConfig } from '@sasjs/lint';
|
|
10
22
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/code/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/code/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAChD,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAEhF;;;;;;;;;;GAUG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA"}
|
package/build/esm/code/index.js
CHANGED
|
@@ -6,3 +6,15 @@
|
|
|
6
6
|
* stays free of it and a host that wants these routes imports `@sasjs/api/code`.
|
|
7
7
|
*/
|
|
8
8
|
export { createCodeService } from './service.js';
|
|
9
|
+
/**
|
|
10
|
+
* The configuration class the service hands the linter.
|
|
11
|
+
*
|
|
12
|
+
* A host that resolves rules from its own storage parses a `.sasjslint` and has
|
|
13
|
+
* to build the configuration the routes expect. Exporting the class here lets
|
|
14
|
+
* it build that with the linter this package bundles, instead of adding
|
|
15
|
+
* `@sasjs/lint` to its own dependencies and carrying a second copy to keep in
|
|
16
|
+
* step. What keeps the two in step is this package's exact dependency pin, not
|
|
17
|
+
* the export: a host that installs the linter itself still resolves whatever
|
|
18
|
+
* its own tree gives it.
|
|
19
|
+
*/
|
|
20
|
+
export { LintConfig } from '@sasjs/lint';
|
|
@@ -13,8 +13,15 @@ export interface CodeServiceOptions {
|
|
|
13
13
|
* A host resolves the nearest `.sasjslint` at or above `filePath`, so each
|
|
14
14
|
* folder can carry its own rules; without one the linter's defaults apply,
|
|
15
15
|
* which is what an untitled buffer lints against.
|
|
16
|
+
*
|
|
17
|
+
* It may answer with a promise. A host whose rules are files in a store it
|
|
18
|
+
* reads asynchronously - the browser host over its drive - holds no
|
|
19
|
+
* synchronous copy to hand back, and reading the rules per request is the
|
|
20
|
+
* point of the option rather than an overhead to cache around. A host with
|
|
21
|
+
* the configuration already in hand returns it directly, which the routes
|
|
22
|
+
* await either way.
|
|
16
23
|
*/
|
|
17
|
-
lintConfig?: (filePath?: string) => LintConfig | undefined
|
|
24
|
+
lintConfig?: (filePath?: string) => LintConfig | undefined | Promise<LintConfig | undefined>;
|
|
18
25
|
}
|
|
19
26
|
export interface CodeService {
|
|
20
27
|
/** The diagnostics for a buffer. Nothing is written and nothing is executed. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/code/service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAGzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAEnD,uFAAuF;AACvF,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,kFAAkF;IAClF,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/code/service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAGzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAEnD,uFAAuF;AACvF,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,kFAAkF;IAClF,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,EAAE,CACX,QAAQ,CAAC,EAAE,MAAM,KACd,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAA;CAC9D;AAED,MAAM,WAAW,WAAW;IAC1B,gFAAgF;IAChF,IAAI,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAAA;IAC3E,4BAA4B;IAC5B,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;CACxE;AAmBD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,iBAAiB,GAC5B,UAAS,kBAAuB,KAC/B,WAqBF,CAAA"}
|
|
@@ -39,15 +39,15 @@ export const createCodeService = (options = {}) => {
|
|
|
39
39
|
if (!caller)
|
|
40
40
|
throw new ApiError(401, 'Unauthorized');
|
|
41
41
|
};
|
|
42
|
-
const configFor = (filePath) => options.lintConfig ? options.lintConfig(filePath) : undefined;
|
|
42
|
+
const configFor = async (filePath) => options.lintConfig ? await options.lintConfig(filePath) : undefined;
|
|
43
43
|
return {
|
|
44
44
|
async lint(caller, body) {
|
|
45
45
|
requireCaller(caller);
|
|
46
|
-
return lintText(codeOf(body), configFor(body.filePath));
|
|
46
|
+
return lintText(codeOf(body), await configFor(body.filePath));
|
|
47
47
|
},
|
|
48
48
|
async format(caller, body) {
|
|
49
49
|
requireCaller(caller);
|
|
50
|
-
return formatText(codeOf(body), configFor(body.filePath));
|
|
50
|
+
return formatText(codeOf(body), await configFor(body.filePath));
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sasjs/api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.0",
|
|
4
4
|
"description": "The SASjs Server API, described once - a generated route table, the services behind it, and the conformance corpus both hosts run",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "SASjs",
|
|
@@ -75,6 +75,6 @@
|
|
|
75
75
|
"minimatch": "11.0.4"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@sasjs/lint": "
|
|
78
|
+
"@sasjs/lint": "5.4.0"
|
|
79
79
|
}
|
|
80
80
|
}
|