@sasjs/api 0.23.1 → 0.25.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/README.md +10 -0
- package/build/browser.js +695 -101
- package/build/cjs/appstream/bundle.js +124 -0
- package/build/cjs/appstream/identity.js +69 -0
- package/build/cjs/appstream/service.js +226 -0
- package/build/cjs/appstream/store.js +69 -0
- package/build/cjs/appstream/web.js +248 -0
- package/build/cjs/corpus/deploy.js +112 -29
- package/build/cjs/corpus/runner.js +30 -18
- package/build/cjs/drive/deploy.js +20 -4
- package/build/cjs/drive/service.js +2 -2
- package/build/cjs/host/dispatch.js +38 -9
- package/build/cjs/index.js +25 -4
- package/build/cjs/routes/generated.js +2 -8
- package/build/cjs/routes/overlay.js +2 -2
- package/build/esm/appstream/bundle.d.ts +46 -0
- package/build/esm/appstream/bundle.d.ts.map +1 -0
- package/build/esm/appstream/bundle.js +118 -0
- package/build/esm/appstream/identity.d.ts +27 -0
- package/build/esm/appstream/identity.d.ts.map +1 -0
- package/build/esm/appstream/identity.js +63 -0
- package/build/esm/appstream/service.d.ts +96 -0
- package/build/esm/appstream/service.d.ts.map +1 -0
- package/build/esm/appstream/service.js +218 -0
- package/build/esm/appstream/store.d.ts +6 -0
- package/build/esm/appstream/store.d.ts.map +1 -0
- package/build/esm/appstream/store.js +65 -0
- package/build/esm/appstream/web.d.ts +74 -0
- package/build/esm/appstream/web.d.ts.map +1 -0
- package/build/esm/appstream/web.js +241 -0
- package/build/esm/corpus/deploy.d.ts +5 -5
- package/build/esm/corpus/deploy.d.ts.map +1 -1
- package/build/esm/corpus/deploy.js +112 -29
- package/build/esm/corpus/runner.d.ts.map +1 -1
- package/build/esm/corpus/runner.js +14 -2
- package/build/esm/drive/deploy.d.ts +41 -2
- package/build/esm/drive/deploy.d.ts.map +1 -1
- package/build/esm/drive/deploy.js +20 -4
- package/build/esm/drive/service.d.ts +2 -1
- package/build/esm/drive/service.d.ts.map +1 -1
- package/build/esm/drive/service.js +2 -2
- package/build/esm/host/dispatch.d.ts +5 -4
- package/build/esm/host/dispatch.d.ts.map +1 -1
- package/build/esm/host/dispatch.js +38 -9
- package/build/esm/index.d.ts +9 -3
- package/build/esm/index.d.ts.map +1 -1
- package/build/esm/index.js +5 -1
- package/build/esm/routes/generated.d.ts.map +1 -1
- package/build/esm/routes/generated.js +2 -8
- package/build/esm/routes/overlay.js +2 -2
- package/package.json +5 -4
- package/build/cjs/drive/registry.js +0 -38
- package/build/esm/drive/registry.d.ts +0 -52
- package/build/esm/drive/registry.d.ts.map +0 -1
- package/build/esm/drive/registry.js +0 -33
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sasjs/api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.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",
|
|
@@ -38,11 +38,12 @@
|
|
|
38
38
|
"test": "jest --coverage",
|
|
39
39
|
"coverage:comment": "node scripts/coverage-comment.mjs",
|
|
40
40
|
"test:watch": "jest --watch",
|
|
41
|
-
"lint": "prettier --check \"{src,spec,scripts}/**/*.{ts,mjs,md}\" \"*.{json,md}\"",
|
|
42
|
-
"lint:fix": "prettier --write \"{src,spec,scripts}/**/*.{ts,mjs,md}\" \"*.{json,md}\"",
|
|
41
|
+
"lint": "prettier --check \"{src,spec,scripts}/**/*.{ts,mjs,cjs,md}\" \"*.{json,md}\"",
|
|
42
|
+
"lint:fix": "prettier --write \"{src,spec,scripts}/**/*.{ts,mjs,cjs,md}\" \"*.{json,md}\"",
|
|
43
43
|
"sync:routes": "node scripts/sync-routes.mjs",
|
|
44
44
|
"check:routes": "node scripts/sync-routes.mjs --check",
|
|
45
|
-
"audit:gate": "node scripts/audit.mjs"
|
|
45
|
+
"audit:gate": "node scripts/audit.mjs",
|
|
46
|
+
"check:appstream": "node scripts/appstream-browser-check.cjs"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
49
|
"@semantic-release/commit-analyzer": "13.0.1",
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MemoryAppStreamRegistry = exports.unpublishAppStream = void 0;
|
|
4
|
-
const types_js_1 = require("../types.js");
|
|
5
|
-
/**
|
|
6
|
-
* `DELETE /SASjsApi/drive/deploy`.
|
|
7
|
-
*
|
|
8
|
-
* The document requires both body values, so both are checked - a caller that
|
|
9
|
-
* names a stream but not the folder has not said what to remove. Only the folder
|
|
10
|
-
* reaches the registry, because that is what identifies the app.
|
|
11
|
-
*
|
|
12
|
-
* The checks are here rather than in the transport because this is the one
|
|
13
|
-
* implementation of the operation: a host calling it directly gets the same
|
|
14
|
-
* refusals in the same order, and with the same messages the document states.
|
|
15
|
-
*/
|
|
16
|
-
const unpublishAppStream = async (registry, body) => {
|
|
17
|
-
if (!body?.streamServiceName)
|
|
18
|
-
throw new types_js_1.ApiError(400, '"streamServiceName" is required');
|
|
19
|
-
if (!body.appLoc)
|
|
20
|
-
throw new types_js_1.ApiError(400, '"appLoc" is required');
|
|
21
|
-
if (!(await registry.unpublish(body.appLoc)))
|
|
22
|
-
throw new types_js_1.ApiError(404, 'No app is published at that folder.');
|
|
23
|
-
return { status: 'success' };
|
|
24
|
-
};
|
|
25
|
-
exports.unpublishAppStream = unpublishAppStream;
|
|
26
|
-
/**
|
|
27
|
-
* The registry the corpus and the package's own tests read: one published app,
|
|
28
|
-
* identified by its folder alone.
|
|
29
|
-
*/
|
|
30
|
-
class MemoryAppStreamRegistry {
|
|
31
|
-
constructor(folders = ['/Public/myApp']) {
|
|
32
|
-
this.folders = new Set(folders);
|
|
33
|
-
}
|
|
34
|
-
async unpublish(appLoc) {
|
|
35
|
-
return this.folders.delete(appLoc);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
exports.MemoryAppStreamRegistry = MemoryAppStreamRegistry;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The app streams a host has published, as the API needs to unpublish one.
|
|
3
|
-
*
|
|
4
|
-
* A published stream is the host's own record - a directory convention, a
|
|
5
|
-
* registry table, whatever it uses to know that `/Public/myApp` is served at
|
|
6
|
-
* `/Public/myApp/index.html`. The package cannot invent it, so the route takes
|
|
7
|
-
* this port and answers 501 without it, the same way the session routes do.
|
|
8
|
-
*/
|
|
9
|
-
export interface AppStreamRegistry {
|
|
10
|
-
/**
|
|
11
|
-
* Removes the app published at `appLoc`.
|
|
12
|
-
*
|
|
13
|
-
* **The folder is the identity.** An app is one thing to deploy and one thing
|
|
14
|
-
* to delete, and what it is called is a label on it: two apps can share a
|
|
15
|
-
* folder only as a special case, and they are still one thing to load or
|
|
16
|
-
* remove. So the lookup is by folder, and a name that no longer matches the
|
|
17
|
-
* one recorded does not turn a correct deletion into a `404`.
|
|
18
|
-
*
|
|
19
|
-
* `false` when nothing is published at that folder, which the route reports as
|
|
20
|
-
* a 404 - a delete that silently succeeded on a folder nobody deployed would
|
|
21
|
-
* hide a caller's typo.
|
|
22
|
-
*/
|
|
23
|
-
unpublish(appLoc: string): Promise<boolean>;
|
|
24
|
-
}
|
|
25
|
-
export interface UnpublishBody {
|
|
26
|
-
streamServiceName?: string;
|
|
27
|
-
appLoc?: string;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* `DELETE /SASjsApi/drive/deploy`.
|
|
31
|
-
*
|
|
32
|
-
* The document requires both body values, so both are checked - a caller that
|
|
33
|
-
* names a stream but not the folder has not said what to remove. Only the folder
|
|
34
|
-
* reaches the registry, because that is what identifies the app.
|
|
35
|
-
*
|
|
36
|
-
* The checks are here rather than in the transport because this is the one
|
|
37
|
-
* implementation of the operation: a host calling it directly gets the same
|
|
38
|
-
* refusals in the same order, and with the same messages the document states.
|
|
39
|
-
*/
|
|
40
|
-
export declare const unpublishAppStream: (registry: AppStreamRegistry, body: UnpublishBody | undefined) => Promise<{
|
|
41
|
-
status: "success";
|
|
42
|
-
}>;
|
|
43
|
-
/**
|
|
44
|
-
* The registry the corpus and the package's own tests read: one published app,
|
|
45
|
-
* identified by its folder alone.
|
|
46
|
-
*/
|
|
47
|
-
export declare class MemoryAppStreamRegistry implements AppStreamRegistry {
|
|
48
|
-
private readonly folders;
|
|
49
|
-
constructor(folders?: string[]);
|
|
50
|
-
unpublish(appLoc: string): Promise<boolean>;
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/drive/registry.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CAC5C;AAED,MAAM,WAAW,aAAa;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,GAC7B,UAAU,iBAAiB,EAC3B,MAAM,aAAa,GAAG,SAAS,KAC9B,OAAO,CAAC;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,CAU/B,CAAA;AAED;;;GAGG;AACH,qBAAa,uBAAwB,YAAW,iBAAiB;IAC/D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAa;gBAEzB,OAAO,GAAE,MAAM,EAAsB;IAI3C,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAGlD"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ApiError } from '../types.js';
|
|
2
|
-
/**
|
|
3
|
-
* `DELETE /SASjsApi/drive/deploy`.
|
|
4
|
-
*
|
|
5
|
-
* The document requires both body values, so both are checked - a caller that
|
|
6
|
-
* names a stream but not the folder has not said what to remove. Only the folder
|
|
7
|
-
* reaches the registry, because that is what identifies the app.
|
|
8
|
-
*
|
|
9
|
-
* The checks are here rather than in the transport because this is the one
|
|
10
|
-
* implementation of the operation: a host calling it directly gets the same
|
|
11
|
-
* refusals in the same order, and with the same messages the document states.
|
|
12
|
-
*/
|
|
13
|
-
export const unpublishAppStream = async (registry, body) => {
|
|
14
|
-
if (!body?.streamServiceName)
|
|
15
|
-
throw new ApiError(400, '"streamServiceName" is required');
|
|
16
|
-
if (!body.appLoc)
|
|
17
|
-
throw new ApiError(400, '"appLoc" is required');
|
|
18
|
-
if (!(await registry.unpublish(body.appLoc)))
|
|
19
|
-
throw new ApiError(404, 'No app is published at that folder.');
|
|
20
|
-
return { status: 'success' };
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* The registry the corpus and the package's own tests read: one published app,
|
|
24
|
-
* identified by its folder alone.
|
|
25
|
-
*/
|
|
26
|
-
export class MemoryAppStreamRegistry {
|
|
27
|
-
constructor(folders = ['/Public/myApp']) {
|
|
28
|
-
this.folders = new Set(folders);
|
|
29
|
-
}
|
|
30
|
-
async unpublish(appLoc) {
|
|
31
|
-
return this.folders.delete(appLoc);
|
|
32
|
-
}
|
|
33
|
-
}
|