@static-suite/static-suite-data-server 0.0.9 → 0.0.10
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/dist/http/routes/index.d.ts.map +1 -1
- package/dist/http/routes/index.js +4 -0
- package/dist/http/routes/indexUUID.d.ts +4 -0
- package/dist/http/routes/indexUUID.d.ts.map +1 -0
- package/dist/http/routes/indexUUID.js +31 -0
- package/dist/http/routes/indexUrl.d.ts +4 -0
- package/dist/http/routes/indexUrl.d.ts.map +1 -0
- package/dist/http/routes/indexUrl.js +28 -0
- package/package.json +1 -1
- package/src/http/routes/index.ts +4 -0
- package/src/http/routes/indexUUID.ts +31 -0
- package/src/http/routes/indexUrl.ts +28 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/http/routes/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/http/routes/index.ts"],"names":[],"mappings":"AAkCA,QAAA,MAAM,MAAM,4CAAW,CAAC;AAgCxB,eAAe,MAAM,CAAC"}
|
|
@@ -10,6 +10,8 @@ const docs_1 = require("./docs");
|
|
|
10
10
|
const task_1 = require("./task");
|
|
11
11
|
const dump_1 = require("./dump");
|
|
12
12
|
const dependency_1 = require("./dependency");
|
|
13
|
+
const indexUrl_1 = require("./indexUrl");
|
|
14
|
+
const indexUUID_1 = require("./indexUUID");
|
|
13
15
|
const routes = (0, express_1.Router)();
|
|
14
16
|
routes.get('/', home_1.home);
|
|
15
17
|
routes.get('/docs', docs_1.docs);
|
|
@@ -38,4 +40,6 @@ routes.get('/dependency/invalidated/filepaths', dependency_1.dependencyInvalidat
|
|
|
38
40
|
routes.get('/dependency/tag/parents', dependency_1.dependencyTagParents);
|
|
39
41
|
routes.get('/dependency', dependency_1.dependencyIndex);
|
|
40
42
|
routes.get(['/data/*', '/data'], data_1.data);
|
|
43
|
+
routes.get(['/index/url/*', '/index/url'], indexUrl_1.indexUrl);
|
|
44
|
+
routes.get(['/index/uuid/*', '/index/uuid'], indexUUID_1.indexUUID);
|
|
41
45
|
exports.default = routes;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexUUID.d.ts","sourceRoot":"","sources":["../../../src/http/routes/indexUUID.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAM5C,QAAA,MAAM,SAAS,QAAS,OAAO,OAAO,QAAQ,KAAG,IAsBhD,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.indexUUID = void 0;
|
|
4
|
+
const store_1 = require("../../lib/store");
|
|
5
|
+
const logger_1 = require("../../lib/utils/logger");
|
|
6
|
+
const dataDir_1 = require("../../lib/store/dataDir");
|
|
7
|
+
// Url format /index/uuid/fr/4c7a791d-f994-4a0a-81c5-b0cdf759f8b5
|
|
8
|
+
const indexUUID = (req, res) => {
|
|
9
|
+
dataDir_1.dataDirManager.update();
|
|
10
|
+
const storeKey = req.params[0].split('/');
|
|
11
|
+
const storeFile = storeKey[1]
|
|
12
|
+
? store_1.store.index.uuid.get(storeKey[0])?.get(storeKey[1])
|
|
13
|
+
: undefined;
|
|
14
|
+
if (storeFile === undefined) {
|
|
15
|
+
res.status(404);
|
|
16
|
+
res.set({
|
|
17
|
+
'Content-Type': 'text/plain',
|
|
18
|
+
});
|
|
19
|
+
res.send('not found');
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
// Render a single file.
|
|
23
|
+
logger_1.logger.debug(`Rendering file "${req.params[0]}", type ${typeof storeFile}`);
|
|
24
|
+
res.status(200);
|
|
25
|
+
res.set({
|
|
26
|
+
'Content-Type': 'application/json',
|
|
27
|
+
});
|
|
28
|
+
res.send(storeFile);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
exports.indexUUID = indexUUID;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexUrl.d.ts","sourceRoot":"","sources":["../../../src/http/routes/indexUrl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAK5C,QAAA,MAAM,QAAQ,QAAS,OAAO,OAAO,QAAQ,KAAG,IAoB/C,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.indexUrl = void 0;
|
|
4
|
+
const store_1 = require("../../lib/store");
|
|
5
|
+
const logger_1 = require("../../lib/utils/logger");
|
|
6
|
+
const dataDir_1 = require("../../lib/store/dataDir");
|
|
7
|
+
const indexUrl = (req, res) => {
|
|
8
|
+
dataDir_1.dataDirManager.update();
|
|
9
|
+
const storeKey = req.params[0] === 'index' ? '' : req.params[0];
|
|
10
|
+
const storeFile = store_1.store.index.url.get(`/${storeKey}`);
|
|
11
|
+
if (storeFile === undefined) {
|
|
12
|
+
res.status(404);
|
|
13
|
+
res.set({
|
|
14
|
+
'Content-Type': 'text/plain',
|
|
15
|
+
});
|
|
16
|
+
res.send('not found');
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
// Render a single file.
|
|
20
|
+
logger_1.logger.debug(`Rendering file "/${storeKey}", type ${typeof storeFile}`);
|
|
21
|
+
res.status(200);
|
|
22
|
+
res.set({
|
|
23
|
+
'Content-Type': 'application/json',
|
|
24
|
+
});
|
|
25
|
+
res.send(storeFile);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
exports.indexUrl = indexUrl;
|
package/package.json
CHANGED
package/src/http/routes/index.ts
CHANGED
|
@@ -29,6 +29,8 @@ import {
|
|
|
29
29
|
dependencyTreeRoute,
|
|
30
30
|
dependencyTagParents,
|
|
31
31
|
} from './dependency';
|
|
32
|
+
import { indexUrl } from './indexUrl';
|
|
33
|
+
import { indexUUID } from './indexUUID';
|
|
32
34
|
|
|
33
35
|
const routes = Router();
|
|
34
36
|
|
|
@@ -59,5 +61,7 @@ routes.get('/dependency/invalidated/filepaths', dependencyInvalidatedFilepaths);
|
|
|
59
61
|
routes.get('/dependency/tag/parents', dependencyTagParents);
|
|
60
62
|
routes.get('/dependency', dependencyIndex);
|
|
61
63
|
routes.get(['/data/*', '/data'], data);
|
|
64
|
+
routes.get(['/index/url/*', '/index/url'], indexUrl);
|
|
65
|
+
routes.get(['/index/uuid/*', '/index/uuid'], indexUUID);
|
|
62
66
|
|
|
63
67
|
export default routes;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Request, Response } from 'express';
|
|
2
|
+
import { store } from '../../lib/store';
|
|
3
|
+
import { logger } from '../../lib/utils/logger';
|
|
4
|
+
import { dataDirManager } from '../../lib/store/dataDir';
|
|
5
|
+
|
|
6
|
+
// Url format /index/uuid/fr/4c7a791d-f994-4a0a-81c5-b0cdf759f8b5
|
|
7
|
+
const indexUUID = (req: Request, res: Response): void => {
|
|
8
|
+
dataDirManager.update();
|
|
9
|
+
const storeKey = req.params[0].split('/');
|
|
10
|
+
|
|
11
|
+
const storeFile = storeKey[1]
|
|
12
|
+
? store.index.uuid.get(storeKey[0])?.get(storeKey[1])
|
|
13
|
+
: undefined;
|
|
14
|
+
if (storeFile === undefined) {
|
|
15
|
+
res.status(404);
|
|
16
|
+
res.set({
|
|
17
|
+
'Content-Type': 'text/plain',
|
|
18
|
+
});
|
|
19
|
+
res.send('not found');
|
|
20
|
+
} else {
|
|
21
|
+
// Render a single file.
|
|
22
|
+
logger.debug(`Rendering file "${req.params[0]}", type ${typeof storeFile}`);
|
|
23
|
+
res.status(200);
|
|
24
|
+
res.set({
|
|
25
|
+
'Content-Type': 'application/json',
|
|
26
|
+
});
|
|
27
|
+
res.send(storeFile);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { indexUUID };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Request, Response } from 'express';
|
|
2
|
+
import { store } from '../../lib/store';
|
|
3
|
+
import { logger } from '../../lib/utils/logger';
|
|
4
|
+
import { dataDirManager } from '../../lib/store/dataDir';
|
|
5
|
+
|
|
6
|
+
const indexUrl = (req: Request, res: Response): void => {
|
|
7
|
+
dataDirManager.update();
|
|
8
|
+
const storeKey = req.params[0] === 'index' ? '' : req.params[0];
|
|
9
|
+
const storeFile = store.index.url.get(`/${storeKey}`);
|
|
10
|
+
|
|
11
|
+
if (storeFile === undefined) {
|
|
12
|
+
res.status(404);
|
|
13
|
+
res.set({
|
|
14
|
+
'Content-Type': 'text/plain',
|
|
15
|
+
});
|
|
16
|
+
res.send('not found');
|
|
17
|
+
} else {
|
|
18
|
+
// Render a single file.
|
|
19
|
+
logger.debug(`Rendering file "/${storeKey}", type ${typeof storeFile}`);
|
|
20
|
+
res.status(200);
|
|
21
|
+
res.set({
|
|
22
|
+
'Content-Type': 'application/json',
|
|
23
|
+
});
|
|
24
|
+
res.send(storeFile);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { indexUrl };
|