@grafserv/persisted 0.0.0-alpha.11 → 0.0.0-alpha.13
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/CHANGELOG.md +34 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +53 -16
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +11 -0
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +6 -0
- package/dist/version.js.map +1 -0
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @grafserv/persisted
|
|
2
2
|
|
|
3
|
+
## 0.0.0-alpha.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#407](https://github.com/benjie/postgraphile-private/pull/407)
|
|
8
|
+
[`9281a2d88`](https://github.com/benjie/postgraphile-private/commit/9281a2d889ab1e72a3f6f9777779f31a6588d478)
|
|
9
|
+
Thanks [@benjie](https://github.com/benjie)! - Exported `version` no longer
|
|
10
|
+
uses `require('../package.json')` hack, instead the version number is written
|
|
11
|
+
to a source file at versioning time. Packages now export `version`.
|
|
12
|
+
|
|
13
|
+
- [#408](https://github.com/benjie/postgraphile-private/pull/408)
|
|
14
|
+
[`799007532`](https://github.com/benjie/postgraphile-private/commit/79900753258f5fae8c64160281dfd4f3c68d7b11)
|
|
15
|
+
Thanks [@benjie](https://github.com/benjie)! - No longer polls the persisted
|
|
16
|
+
queries folder every 5 seconds unless you configure it to do so. New watch
|
|
17
|
+
mode _untested_.
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
[[`9281a2d88`](https://github.com/benjie/postgraphile-private/commit/9281a2d889ab1e72a3f6f9777779f31a6588d478),
|
|
20
|
+
[`675b7abb9`](https://github.com/benjie/postgraphile-private/commit/675b7abb93e11d955930b9026fb0b65a56ecc999),
|
|
21
|
+
[`c5050dd28`](https://github.com/benjie/postgraphile-private/commit/c5050dd286bd6d9fa4a5d9cfbf87ba609cb148dd),
|
|
22
|
+
[`0d1782869`](https://github.com/benjie/postgraphile-private/commit/0d1782869adc76f5bbcecfdcbb85a258c468ca37)]:
|
|
23
|
+
- grafast@0.0.1-alpha.12
|
|
24
|
+
- graphile-config@0.0.1-alpha.6
|
|
25
|
+
- grafserv@0.0.1-alpha.12
|
|
26
|
+
|
|
27
|
+
## 0.0.0-alpha.12
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies
|
|
32
|
+
[[`644938276`](https://github.com/benjie/postgraphile-private/commit/644938276ebd48c5486ba9736a525fcc66d7d714)]:
|
|
33
|
+
- graphile-config@0.0.1-alpha.5
|
|
34
|
+
- grafast@0.0.1-alpha.11
|
|
35
|
+
- grafserv@0.0.1-alpha.11
|
|
36
|
+
|
|
3
37
|
## 0.0.0-alpha.11
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,YAAY,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,YAAY,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAGhE,QAAA,MAAM,eAAe,EAAE,cAAc,CAAC,MA8CrC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const grafast_1 = require("grafast");
|
|
5
5
|
const promises_1 = tslib_1.__importDefault(require("node:fs/promises"));
|
|
6
|
-
const
|
|
6
|
+
const version_js_1 = require("./version.js");
|
|
7
7
|
const PersistedPlugin = {
|
|
8
8
|
name: "PersistedPlugin",
|
|
9
9
|
description: "Enables persisted operations in Grafserv",
|
|
10
|
-
version,
|
|
10
|
+
version: version_js_1.version,
|
|
11
11
|
grafserv: {
|
|
12
12
|
hooks: {
|
|
13
13
|
processGraphQLRequestBody(info, event) {
|
|
@@ -61,15 +61,28 @@ function defaultHashFromPayload(payload) {
|
|
|
61
61
|
function persistedOperationGetterForCache(cache) {
|
|
62
62
|
return (key) => cache[key];
|
|
63
63
|
}
|
|
64
|
-
function makeGetterForDirectory(directory) {
|
|
64
|
+
function makeGetterForDirectory(directory, scanInterval = -1) {
|
|
65
|
+
// TODO: implement AbortController integration for timer, etc.
|
|
66
|
+
const abortController = new AbortController();
|
|
67
|
+
const { signal } = abortController;
|
|
65
68
|
// NOTE: We periodically scan the folder to see what files it contains so
|
|
66
69
|
// that we can reject requests to non-existent files to avoid DOS attacks
|
|
67
70
|
// having us make lots of requests to the filesystem.
|
|
68
71
|
let files = null;
|
|
72
|
+
/** is scanDirectory active? */
|
|
73
|
+
let scanning = false;
|
|
74
|
+
/** Should we scan the directory again once the current scanDirectory is complete? */
|
|
75
|
+
let scanAgain = false;
|
|
69
76
|
/**
|
|
70
77
|
* This function must never reject.
|
|
71
78
|
*/
|
|
72
79
|
async function scanDirectory() {
|
|
80
|
+
if (scanning) {
|
|
81
|
+
scanAgain = true;
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
scanning = true;
|
|
85
|
+
scanAgain = false;
|
|
73
86
|
try {
|
|
74
87
|
const allFiles = await promises_1.default.readdir(directory);
|
|
75
88
|
files = allFiles.filter((name) => name.endsWith(".graphql"));
|
|
@@ -79,16 +92,37 @@ function makeGetterForDirectory(directory) {
|
|
|
79
92
|
console.error(e);
|
|
80
93
|
}
|
|
81
94
|
finally {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
95
|
+
scanning = false;
|
|
96
|
+
if (scanInterval === "watch") {
|
|
97
|
+
if (scanAgain) {
|
|
98
|
+
scanDirectory();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else if (typeof scanInterval === "number" && scanInterval >= 0) {
|
|
102
|
+
// We don't know how long the scanning takes, so rather than setting an
|
|
103
|
+
// interval, we wait for a scan to complete before kicking off the next
|
|
104
|
+
// one.
|
|
105
|
+
setTimeout(scanDirectory, scanInterval);
|
|
106
|
+
}
|
|
89
107
|
}
|
|
90
108
|
}
|
|
91
109
|
scanDirectory();
|
|
110
|
+
if (scanInterval === "watch") {
|
|
111
|
+
(async () => {
|
|
112
|
+
try {
|
|
113
|
+
const watcher = promises_1.default.watch(directory, { signal, recursive: false });
|
|
114
|
+
for await (const _event of watcher) {
|
|
115
|
+
scanDirectory();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
catch (err) {
|
|
119
|
+
if (err.name === "AbortError")
|
|
120
|
+
return;
|
|
121
|
+
console.error(`Error occurred whilst watching the persisted operations directory. Folder is no longer being watched. Recommend you restart your server (and file an issue explaining what happened).`);
|
|
122
|
+
console.error(err);
|
|
123
|
+
}
|
|
124
|
+
})();
|
|
125
|
+
}
|
|
92
126
|
const operationFromHash = new Map();
|
|
93
127
|
function getOperationFromHash(hash) {
|
|
94
128
|
if (!/^[a-zA-Z0-9_-]+$/.test(hash)) {
|
|
@@ -111,17 +145,18 @@ function makeGetterForDirectory(directory) {
|
|
|
111
145
|
}
|
|
112
146
|
return operation;
|
|
113
147
|
}
|
|
114
|
-
return getOperationFromHash;
|
|
148
|
+
return { getter: getOperationFromHash, abortController };
|
|
115
149
|
}
|
|
116
150
|
const directoryGetterByDirectory = new Map();
|
|
117
151
|
/**
|
|
118
152
|
* Given a directory, get or make the persisted operations getter.
|
|
119
153
|
*/
|
|
120
|
-
function getterForDirectory(directory) {
|
|
121
|
-
|
|
154
|
+
function getterForDirectory(directory, scanInterval) {
|
|
155
|
+
const key = `${scanInterval}|${directory}`;
|
|
156
|
+
let getter = directoryGetterByDirectory.get(key);
|
|
122
157
|
if (!getter) {
|
|
123
|
-
getter = makeGetterForDirectory(directory);
|
|
124
|
-
directoryGetterByDirectory.set(
|
|
158
|
+
getter = makeGetterForDirectory(directory, scanInterval);
|
|
159
|
+
directoryGetterByDirectory.set(key, getter);
|
|
125
160
|
}
|
|
126
161
|
return getter;
|
|
127
162
|
}
|
|
@@ -146,7 +181,9 @@ function getterFromOptionsCore(options) {
|
|
|
146
181
|
return persistedOperationGetterForCache(options.persistedOperations);
|
|
147
182
|
}
|
|
148
183
|
else if (options.persistedOperationsDirectory) {
|
|
149
|
-
|
|
184
|
+
// TODO: do something with abortController? abortController.abort()
|
|
185
|
+
const { getter, abortController: _abortController } = getterForDirectory(options.persistedOperationsDirectory, options.persistedOperationsDirectoryScanInterval);
|
|
186
|
+
return getter;
|
|
150
187
|
}
|
|
151
188
|
else {
|
|
152
189
|
throw new Error("Server misconfiguration issue: persisted operations (operation allowlist) is in place, but the server has not been told how to fetch the allowed operations. Please provide one of the persisted operations configuration options.");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,qCAAoC;AAMpC,wEAAmC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,qCAAoC;AAMpC,wEAAmC;AAGnC,6CAAuC;AAEvC,MAAM,eAAe,GAA0B;IAC7C,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,0CAA0C;IACvD,OAAO,EAAP,oBAAO;IAEP,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,yBAAyB,CAAC,IAAI,EAAE,KAAK;gBACnC,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;gBACvB,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC;gBAC7C,IAA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AAI,yBAAyB,IAAI,OAAO,OAAO,EAAE,KAAK,KAAK,QAAQ,EAAE;gBACnE,OAAO,OAAO,CAAC,KAAK,CAAC;aACtB;YAED,MAAM,IAAI,KAAK,CACb,qEAAqE,CACtE,CAAC;SACH;QACD,MAAM,MAAM,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;KACrB;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,KAAK,CAAC,gDAAgD,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;QAE5E,2EAA2E;QAC3E,6BAA6B;QAC7B,OAAO,IAAI,CAAC;KACb;AACH,CAAC"}
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -28,6 +28,17 @@ declare global {
|
|
|
28
28
|
* mitigate denial of service attacks asking for non-existent hashes.
|
|
29
29
|
*/
|
|
30
30
|
persistedOperationsDirectory?: string;
|
|
31
|
+
/**
|
|
32
|
+
* How many milliseconds should we leave it between scans of the persisted
|
|
33
|
+
* operations folder, checking for new files?
|
|
34
|
+
*
|
|
35
|
+
* Set this to the string "watch" to use `fs.watch` to monitor for changes. [EXPERIMENTAL].
|
|
36
|
+
*
|
|
37
|
+
* Set to `-1` to disable.
|
|
38
|
+
*
|
|
39
|
+
* Default: -1
|
|
40
|
+
*/
|
|
41
|
+
persistedOperationsDirectoryScanInterval?: number | "watch";
|
|
31
42
|
/**
|
|
32
43
|
* An optional string-string key-value object defining the persisted
|
|
33
44
|
* operations, where the keys are the hashes, and the values are the
|
package/dist/interfaces.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EACV,iBAAiB,EACjB,8BAA8B,EAC/B,MAAM,UAAU,CAAC;AAGlB;;;GAGG;A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E5D;;;;eAIG;YACH,mBAAmB,CAAC,EAAE;gBAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;aAAE,CAAC;YAEjD;;;;;eAKG;YACH,yBAAyB,CAAC,EAAE,wBAAwB,CAAC;YAErD;;;;;;;;;;;;;;;;;;;eAmBG;YACH,yBAAyB,CAAC,EACtB,OAAO,GACP,CAAC,CAAC,KAAK,EAAE,8BAA8B,KAAK,OAAO,CAAC,CAAC;SAC1D;KACF;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,mBAAmB,CAAC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,yDAAyD;AAC5C,QAAA,OAAO,GAAG,gBAAgB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafserv/persisted",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.13",
|
|
4
4
|
"description": "Persisted operations support for Grafserv",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"node": ">=16.10"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"grafast": "^0.0.1-alpha.
|
|
49
|
-
"grafserv": "^0.0.1-alpha.
|
|
50
|
-
"graphile-config": "^0.0.1-alpha.
|
|
48
|
+
"grafast": "^0.0.1-alpha.12",
|
|
49
|
+
"grafserv": "^0.0.1-alpha.12",
|
|
50
|
+
"graphile-config": "^0.0.1-alpha.6",
|
|
51
51
|
"graphql": "^16.1.0-experimental-stream-defer.6"
|
|
52
52
|
},
|
|
53
53
|
"peerDependenciesMeta": {
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"grafast": "^0.0.1-alpha.
|
|
60
|
-
"grafserv": "^0.0.1-alpha.
|
|
61
|
-
"graphile-config": "^0.0.1-alpha.
|
|
59
|
+
"grafast": "^0.0.1-alpha.12",
|
|
60
|
+
"grafserv": "^0.0.1-alpha.12",
|
|
61
|
+
"graphile-config": "^0.0.1-alpha.6",
|
|
62
62
|
"jest": "^28.1.3",
|
|
63
63
|
"jest-serializer-graphql-schema": "^5.0.0-alpha.2",
|
|
64
64
|
"ts-node": "^10.9.1",
|