@cedarjs/api-server 1.0.0-canary.12503 → 1.0.0-canary.12504
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/bin.js +20 -3
- package/dist/buildManager.js +2 -2
- package/dist/plugins/lambdaLoader.js +2 -2
- package/dist/utils.d.ts +6 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +58 -0
- package/dist/watch.js +22 -2
- package/package.json +9 -11
package/dist/bin.js
CHANGED
|
@@ -313,17 +313,34 @@ var init_awsLambdaFastify = __esm({
|
|
|
313
313
|
}
|
|
314
314
|
});
|
|
315
315
|
|
|
316
|
+
// src/utils.ts
|
|
317
|
+
function escape(string) {
|
|
318
|
+
const htmlEscapes = {
|
|
319
|
+
"&": "&",
|
|
320
|
+
"<": "<",
|
|
321
|
+
">": ">",
|
|
322
|
+
'"': """,
|
|
323
|
+
"'": "'"
|
|
324
|
+
};
|
|
325
|
+
return string.replace(/[&<>"']/g, (char) => htmlEscapes[char]);
|
|
326
|
+
}
|
|
327
|
+
var init_utils2 = __esm({
|
|
328
|
+
"src/utils.ts"() {
|
|
329
|
+
"use strict";
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
|
|
316
333
|
// src/plugins/lambdaLoader.ts
|
|
317
|
-
var import_path2, import_ansis, import_fast_glob,
|
|
334
|
+
var import_path2, import_ansis, import_fast_glob, import_project_config3, LAMBDA_FUNCTIONS, setLambdaFunctions, loadFunctionsFromDist, findApiDistFunctions, lambdaRequestHandler;
|
|
318
335
|
var init_lambdaLoader = __esm({
|
|
319
336
|
"src/plugins/lambdaLoader.ts"() {
|
|
320
337
|
"use strict";
|
|
321
338
|
import_path2 = __toESM(require("path"));
|
|
322
339
|
import_ansis = __toESM(require("ansis"));
|
|
323
340
|
import_fast_glob = __toESM(require("fast-glob"));
|
|
324
|
-
import_lodash = require("lodash");
|
|
325
341
|
import_project_config3 = require("@cedarjs/project-config");
|
|
326
342
|
init_awsLambdaFastify();
|
|
343
|
+
init_utils2();
|
|
327
344
|
LAMBDA_FUNCTIONS = {};
|
|
328
345
|
setLambdaFunctions = async (foundFunctions) => {
|
|
329
346
|
const tsImport = Date.now();
|
|
@@ -403,7 +420,7 @@ var init_lambdaLoader = __esm({
|
|
|
403
420
|
};
|
|
404
421
|
reply.send(devError);
|
|
405
422
|
} else {
|
|
406
|
-
reply.send(
|
|
423
|
+
reply.send(escape(errorMessage));
|
|
407
424
|
}
|
|
408
425
|
return;
|
|
409
426
|
}
|
package/dist/buildManager.js
CHANGED
|
@@ -21,7 +21,7 @@ __export(buildManager_exports, {
|
|
|
21
21
|
BuildManager: () => BuildManager
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(buildManager_exports);
|
|
24
|
-
var
|
|
24
|
+
var import_utils = require("./utils.js");
|
|
25
25
|
class BuildManager {
|
|
26
26
|
shouldRebuild;
|
|
27
27
|
shouldClean;
|
|
@@ -31,7 +31,7 @@ class BuildManager {
|
|
|
31
31
|
this.shouldRebuild = true;
|
|
32
32
|
this.shouldClean = false;
|
|
33
33
|
this.buildFn = buildFn;
|
|
34
|
-
this.debouncedBuild = (0,
|
|
34
|
+
this.debouncedBuild = (0, import_utils.debounce)(
|
|
35
35
|
async (options) => {
|
|
36
36
|
try {
|
|
37
37
|
await this.buildFn({
|
|
@@ -37,9 +37,9 @@ module.exports = __toCommonJS(lambdaLoader_exports);
|
|
|
37
37
|
var import_path = __toESM(require("path"));
|
|
38
38
|
var import_ansis = __toESM(require("ansis"));
|
|
39
39
|
var import_fast_glob = __toESM(require("fast-glob"));
|
|
40
|
-
var import_lodash = require("lodash");
|
|
41
40
|
var import_project_config = require("@cedarjs/project-config");
|
|
42
41
|
var import_awsLambdaFastify = require("../requestHandlers/awsLambdaFastify.js");
|
|
42
|
+
var import_utils = require("../utils.js");
|
|
43
43
|
const LAMBDA_FUNCTIONS = {};
|
|
44
44
|
const setLambdaFunctions = async (foundFunctions) => {
|
|
45
45
|
const tsImport = Date.now();
|
|
@@ -119,7 +119,7 @@ const lambdaRequestHandler = async (req, reply) => {
|
|
|
119
119
|
};
|
|
120
120
|
reply.send(devError);
|
|
121
121
|
} else {
|
|
122
|
-
reply.send((0,
|
|
122
|
+
reply.send((0, import_utils.escape)(errorMessage));
|
|
123
123
|
}
|
|
124
124
|
return;
|
|
125
125
|
}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function debounce<T extends (...args: any[]) => any>(func: T, wait: number): T & {
|
|
2
|
+
cancel: () => void;
|
|
3
|
+
};
|
|
4
|
+
/** Escapes HTML characters to prevent XSS attacks */
|
|
5
|
+
export declare function escape(string: string): string;
|
|
6
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACxD,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,MAAM,GACX,CAAC,GAAG;IAAE,MAAM,EAAE,MAAM,IAAI,CAAA;CAAE,CAsB5B;AAED,qDAAqD;AACrD,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAU7C"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var utils_exports = {};
|
|
20
|
+
__export(utils_exports, {
|
|
21
|
+
debounce: () => debounce,
|
|
22
|
+
escape: () => escape
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(utils_exports);
|
|
25
|
+
function debounce(func, wait) {
|
|
26
|
+
let timeoutId = null;
|
|
27
|
+
const debounced = (...args) => {
|
|
28
|
+
if (timeoutId !== null) {
|
|
29
|
+
clearTimeout(timeoutId);
|
|
30
|
+
}
|
|
31
|
+
timeoutId = setTimeout(() => {
|
|
32
|
+
timeoutId = null;
|
|
33
|
+
func(...args);
|
|
34
|
+
}, wait);
|
|
35
|
+
};
|
|
36
|
+
debounced.cancel = () => {
|
|
37
|
+
if (timeoutId !== null) {
|
|
38
|
+
clearTimeout(timeoutId);
|
|
39
|
+
timeoutId = null;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
return debounced;
|
|
43
|
+
}
|
|
44
|
+
function escape(string) {
|
|
45
|
+
const htmlEscapes = {
|
|
46
|
+
"&": "&",
|
|
47
|
+
"<": "<",
|
|
48
|
+
">": ">",
|
|
49
|
+
'"': """,
|
|
50
|
+
"'": "'"
|
|
51
|
+
};
|
|
52
|
+
return string.replace(/[&<>"']/g, (char) => htmlEscapes[char]);
|
|
53
|
+
}
|
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
debounce,
|
|
57
|
+
escape
|
|
58
|
+
});
|
package/dist/watch.js
CHANGED
|
@@ -32,8 +32,28 @@ var import_api = require("@cedarjs/internal/dist/build/api");
|
|
|
32
32
|
var import_validateSchema = require("@cedarjs/internal/dist/validateSchema");
|
|
33
33
|
var import_project_config2 = require("@cedarjs/project-config");
|
|
34
34
|
|
|
35
|
+
// src/utils.ts
|
|
36
|
+
function debounce(func, wait) {
|
|
37
|
+
let timeoutId = null;
|
|
38
|
+
const debounced = (...args) => {
|
|
39
|
+
if (timeoutId !== null) {
|
|
40
|
+
clearTimeout(timeoutId);
|
|
41
|
+
}
|
|
42
|
+
timeoutId = setTimeout(() => {
|
|
43
|
+
timeoutId = null;
|
|
44
|
+
func(...args);
|
|
45
|
+
}, wait);
|
|
46
|
+
};
|
|
47
|
+
debounced.cancel = () => {
|
|
48
|
+
if (timeoutId !== null) {
|
|
49
|
+
clearTimeout(timeoutId);
|
|
50
|
+
timeoutId = null;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
return debounced;
|
|
54
|
+
}
|
|
55
|
+
|
|
35
56
|
// src/buildManager.ts
|
|
36
|
-
var import_lodash = require("lodash");
|
|
37
57
|
var BuildManager = class {
|
|
38
58
|
shouldRebuild;
|
|
39
59
|
shouldClean;
|
|
@@ -43,7 +63,7 @@ var BuildManager = class {
|
|
|
43
63
|
this.shouldRebuild = true;
|
|
44
64
|
this.shouldClean = false;
|
|
45
65
|
this.buildFn = buildFn;
|
|
46
|
-
this.debouncedBuild =
|
|
66
|
+
this.debouncedBuild = debounce(
|
|
47
67
|
async (options) => {
|
|
48
68
|
try {
|
|
49
69
|
await this.buildFn({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/api-server",
|
|
3
|
-
"version": "1.0.0-canary.
|
|
3
|
+
"version": "1.0.0-canary.12504+3c58ee9fb",
|
|
4
4
|
"description": "CedarJS's HTTP server for Serverless Functions",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"test:watch": "vitest watch"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@cedarjs/context": "1.0.0-canary.
|
|
33
|
-
"@cedarjs/fastify-web": "1.0.0-canary.
|
|
34
|
-
"@cedarjs/internal": "1.0.0-canary.
|
|
35
|
-
"@cedarjs/project-config": "1.0.0-canary.
|
|
36
|
-
"@cedarjs/web-server": "1.0.0-canary.
|
|
32
|
+
"@cedarjs/context": "1.0.0-canary.12504",
|
|
33
|
+
"@cedarjs/fastify-web": "1.0.0-canary.12504",
|
|
34
|
+
"@cedarjs/internal": "1.0.0-canary.12504",
|
|
35
|
+
"@cedarjs/project-config": "1.0.0-canary.12504",
|
|
36
|
+
"@cedarjs/web-server": "1.0.0-canary.12504",
|
|
37
37
|
"@fastify/multipart": "9.0.3",
|
|
38
38
|
"@fastify/url-data": "6.0.3",
|
|
39
39
|
"ansis": "4.1.0",
|
|
@@ -43,7 +43,6 @@
|
|
|
43
43
|
"fast-json-parse": "1.0.3",
|
|
44
44
|
"fastify": "5.4.0",
|
|
45
45
|
"fastify-raw-body": "5.0.0",
|
|
46
|
-
"lodash": "4.17.21",
|
|
47
46
|
"pretty-bytes": "5.6.0",
|
|
48
47
|
"pretty-ms": "7.0.1",
|
|
49
48
|
"qs": "6.13.0",
|
|
@@ -51,9 +50,8 @@
|
|
|
51
50
|
"yargs": "17.7.2"
|
|
52
51
|
},
|
|
53
52
|
"devDependencies": {
|
|
54
|
-
"@cedarjs/framework-tools": "1.0.0-canary.
|
|
53
|
+
"@cedarjs/framework-tools": "1.0.0-canary.12504",
|
|
55
54
|
"@types/aws-lambda": "8.10.152",
|
|
56
|
-
"@types/lodash": "4.17.20",
|
|
57
55
|
"@types/qs": "6.9.16",
|
|
58
56
|
"@types/split2": "4.2.3",
|
|
59
57
|
"@types/yargs": "17.0.33",
|
|
@@ -64,12 +62,12 @@
|
|
|
64
62
|
"vitest": "3.2.4"
|
|
65
63
|
},
|
|
66
64
|
"peerDependencies": {
|
|
67
|
-
"@cedarjs/graphql-server": "1.0.0-canary.
|
|
65
|
+
"@cedarjs/graphql-server": "1.0.0-canary.12504"
|
|
68
66
|
},
|
|
69
67
|
"peerDependenciesMeta": {
|
|
70
68
|
"@cedarjs/graphql-server": {
|
|
71
69
|
"optional": true
|
|
72
70
|
}
|
|
73
71
|
},
|
|
74
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "3c58ee9fbc4386d92fbe4b058c1cebdd76bce92b"
|
|
75
73
|
}
|