@static-suite/static-suite-data-server 2.0.4 → 2.0.12

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.
@@ -0,0 +1,35 @@
1
+ # Publish to npm whenever a tag is pushed
2
+ name: Publish to NPM
3
+
4
+ on:
5
+ push:
6
+ tags: v*
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ node-version: [26]
15
+ permissions:
16
+ contents: read
17
+ id-token: write
18
+ steps:
19
+ - name: Check out repository
20
+ uses: actions/checkout@v7
21
+
22
+ - name: Set up Node ${{ matrix.node-version }}
23
+ uses: actions/setup-node@v7
24
+ with:
25
+ node-version: ${{ matrix.node-version }}
26
+ registry-url: 'https://registry.npmjs.org'
27
+
28
+ - name: Install dependencies
29
+ run: yarn install --frozen-lockfile
30
+
31
+ - name: Run tests
32
+ run: yarn test
33
+
34
+ - name: Publish to NPM
35
+ run: npm publish --access public
@@ -0,0 +1,46 @@
1
+ # Update dependencies, commit them and create a new tag
2
+ name: Update dependencies
3
+
4
+ on:
5
+ schedule:
6
+ - cron: '30 6 * * *' # every day at 06:30 UTC
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: write
11
+
12
+ jobs:
13
+ update:
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ matrix:
17
+ node-version: [26]
18
+ steps:
19
+ - name: Check out repository
20
+ uses: actions/checkout@v7
21
+
22
+ - name: Set up Node ${{ matrix.node-version }}
23
+ uses: actions/setup-node@v7
24
+ with:
25
+ node-version: ${{ matrix.node-version }}
26
+
27
+ - name: Install dependencies
28
+ run: yarn install --frozen-lockfile
29
+
30
+ - name: Update dependencies
31
+ run: yarn upgrade
32
+
33
+ - name: Commit files
34
+ run: |
35
+ if [ -z "$(git status --porcelain)" ]; then
36
+ echo "No changes detected, nothing to commit."
37
+ exit 0
38
+ fi
39
+
40
+ echo "Changes detected, committing them."
41
+ git config user.name "github-actions[bot]"
42
+ git config user.email "{user.id}+{user.login}[bot]@users.noreply.github.com"
43
+ git add -A
44
+ git commit -m "chore: update dependencies"
45
+ npm version patch -m "chore: version %s"
46
+ git push
package/.husky/pre-commit CHANGED
@@ -1 +1,2 @@
1
1
  yarn build
2
+ yarn test --ci --silent
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A flexible, fast and developer friendly Data Server for [Static Suite](https://www.drupal.org/project/static_suite).
4
4
 
5
- - flexible: it honors the structure of Static Suite's data directory, non imposing any opinionated structure. Every directory and its contents can be retrieved as simple arrays, and therefore queried using common [array functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) like `filter()`, `find()`, `forEach()`, etc.
5
+ - flexible: it honors the structure of Static Suite's data directory, not imposing any opinionated structure. Every directory and its contents can be retrieved as simple arrays, and therefore queried using common [array functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) like `filter()`, `find()`, `forEach()`, etc.
6
6
  - fast: on a cold start, ~20k json files are usually loaded in ~2 seconds. Queries take ~1 ms, depending on their complexity. Once queries are cached, it executes ~150k queries per second.
7
7
  - developer friendly: when run in `dev` mode, changes made to queries or hooks (more on this later) are automatically reloaded. Queries are easy to create (they are just a function) and debug using a HTTP endpoint.
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  A flexible, fast and developer friendly Data Server for [Static Suite](https://www.drupal.org/project/static_suite).
4
4
 
5
- - flexible: it honors the structure of Static Suite's data directory, non imposing any opinionated structure. Every directory and its contents can be retrieved as simple arrays, and therefore queried using common [array functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) like `filter()`, `find()`, `forEach()`, etc.
5
+ - flexible: it honors the structure of Static Suite's data directory, not imposing any opinionated structure. Every directory and its contents can be retrieved as simple arrays, and therefore queried using common [array functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) like `filter()`, `find()`, `forEach()`, etc.
6
6
  - fast: on a cold start, ~20k json files are usually loaded in ~2 seconds. Queries take ~1 ms, depending on their complexity. Once queries are cached, it executes ~150k queries per second.
7
7
  - developer friendly: when run in `dev` mode, changes made to queries or hooks (more on this later) are automatically reloaded. Queries are easy to create (they are just a function) and debug using a HTTP endpoint.
8
8
 
@@ -1 +1 @@
1
- {"version":3,"file":"dump.d.ts","sourceRoot":"","sources":["../../../src/http/routes/dump.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAK5C,QAAA,MAAM,SAAS,GAAI,KAAK,OAAO,EAAE,KAAK,QAAQ,KAAG,IAShD,CAAC;AAmBF,QAAA,MAAM,eAAe,GAAU,KAAK,OAAO,EAAE,KAAK,QAAQ,KAAG,OAAO,CAAC,IAAI,CAExE,CAAC;AAEF,QAAA,MAAM,QAAQ,GAAU,KAAK,OAAO,EAAE,KAAK,QAAQ,KAAG,OAAO,CAAC,IAAI,CAEjE,CAAC;AASF,QAAA,MAAM,gBAAgB,GAAI,KAAK,OAAO,EAAE,KAAK,QAAQ,KAAG,IAIvD,CAAC;AAEF,QAAA,MAAM,iBAAiB,GAAI,KAAK,OAAO,EAAE,KAAK,QAAQ,KAAG,IAQxD,CAAC;AAEF,OAAO,EACL,SAAS,EACT,eAAe,EACf,QAAQ,EACR,gBAAgB,EAChB,iBAAiB,GAClB,CAAC"}
1
+ {"version":3,"file":"dump.d.ts","sourceRoot":"","sources":["../../../src/http/routes/dump.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAK5C,QAAA,MAAM,SAAS,GAAI,KAAK,OAAO,EAAE,KAAK,QAAQ,KAAG,IAShD,CAAC;AAeF,QAAA,MAAM,eAAe,GAAU,KAAK,OAAO,EAAE,KAAK,QAAQ,KAAG,OAAO,CAAC,IAAI,CAExE,CAAC;AAEF,QAAA,MAAM,QAAQ,GAAU,KAAK,OAAO,EAAE,KAAK,QAAQ,KAAG,OAAO,CAAC,IAAI,CAEjE,CAAC;AASF,QAAA,MAAM,gBAAgB,GAAI,KAAK,OAAO,EAAE,KAAK,QAAQ,KAAG,IAIvD,CAAC;AAEF,QAAA,MAAM,iBAAiB,GAAI,KAAK,OAAO,EAAE,KAAK,QAAQ,KAAG,IAQxD,CAAC;AAEF,OAAO,EACL,SAAS,EACT,eAAe,EACf,QAAQ,EACR,gBAAgB,EAChB,iBAAiB,GAClB,CAAC"}
@@ -22,10 +22,6 @@ exports.dumpIndex = dumpIndex;
22
22
  const dumpAction = async (req, res, incremental) => {
23
23
  const dump = await dump_1.dumpManager.dump({ incremental });
24
24
  const dumpAsJson = (0, object_1.jsonify)(dump);
25
- const args = req.query;
26
- if (args?.noDiff !== undefined) {
27
- delete dumpAsJson.diff;
28
- }
29
25
  res.status(200);
30
26
  res.set({ 'Content-Type': 'application/json' });
31
27
  res.send(dumpAsJson);
@@ -1,4 +1,3 @@
1
- import { Diff } from '../diff/diff.types';
2
1
  /**
3
2
  * Service that dumps resolved data (with resolved includes) into a dump directory.
4
3
  */
@@ -63,10 +62,6 @@ export type Dump = {
63
62
  oldPublicUrl: string | null;
64
63
  newPublicUrl: null;
65
64
  }>;
66
- /**
67
- * The diff used to generate this dump.
68
- */
69
- diff: Diff;
70
65
  };
71
66
  export type DumpMetadata = {
72
67
  current: string;
@@ -1 +1 @@
1
- {"version":3,"file":"dump.types.d.ts","sourceRoot":"","sources":["../../../../src/lib/store/dump/dump.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE;QAAE,WAAW,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExD;;;;;;;OAOG;IACH,KAAK,CAAC,QAAQ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EnB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,OAAO,EAAE,GAAG,CACV,MAAM,EACN;QAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAC7D,CAAC;IAEF;;;;;OAKG;IACH,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,YAAY,EAAE,IAAI,CAAA;KAAE,CAAC,CAAC;CAC3E,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,IAAI,EAAE,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACpB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"dumpManager.d.ts","sourceRoot":"","sources":["../../../../src/lib/store/dump/dumpManager.ts"],"names":[],"mappings":"AASA,OAAO,EAAQ,WAAW,EAAE,MAAM,cAAc,CAAC;AAqKjD,eAAO,MAAM,WAAW,EAAE,WA+EzB,CAAC"}
1
+ {"version":3,"file":"dumpManager.d.ts","sourceRoot":"","sources":["../../../../src/lib/store/dump/dumpManager.ts"],"names":[],"mappings":"AASA,OAAO,EAAQ,WAAW,EAAE,MAAM,cAAc,CAAC;AAqKjD,eAAO,MAAM,WAAW,EAAE,WA8EzB,CAAC"}
@@ -154,7 +154,6 @@ exports.dumpManager = {
154
154
  toUniqueId: diff.toUniqueId,
155
155
  updated: new Map(),
156
156
  deleted: new Map(),
157
- diff,
158
157
  };
159
158
  if (config_1.config.dumpDir) {
160
159
  const filesDumpDir = `${config_1.config.dumpDir}/files`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@static-suite/static-suite-data-server",
3
- "version": "2.0.4",
3
+ "version": "2.0.12",
4
4
  "description": "A flexible, fast and developer friendly Data Server for Static Suite",
5
5
  "main": "./dist/lib/index.js",
6
6
  "typings": "./dist/lib/index.d.ts",
@@ -38,7 +38,7 @@
38
38
  "lint": "eslint .",
39
39
  "docs": "yarn typedoc --out docs src/lib/",
40
40
  "prettier-format": "prettier --config .prettierrc 'src/**/*.ts' --write",
41
- "test": "jest --watch",
41
+ "test": "jest",
42
42
  "copy-http-files-to-src": "node ./scripts/copy-http-files-to-src.mjs",
43
43
  "copy-http-files-to-dist": "mkdir -p ./dist/http/ && cp -r ./src/http/public/ ./dist/http/ && cp -r ./src/http/views/ ./dist/http/ && cp README.md ./dist/http/",
44
44
  "prepare": "husky"
@@ -85,4 +85,4 @@
85
85
  ]
86
86
  },
87
87
  "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
88
- }
88
+ }
@@ -22,10 +22,6 @@ const dumpAction = async (
22
22
  ): Promise<void> => {
23
23
  const dump = await dumpManager.dump({ incremental });
24
24
  const dumpAsJson: any = jsonify(dump);
25
- const args: any = req.query;
26
- if (args?.noDiff !== undefined) {
27
- delete dumpAsJson.diff;
28
- }
29
25
 
30
26
  res.status(200);
31
27
  res.set({ 'Content-Type': 'application/json' });
@@ -1,5 +1,3 @@
1
- import { Diff } from '../diff/diff.types';
2
-
3
1
  /**
4
2
  * Service that dumps resolved data (with resolved includes) into a dump directory.
5
3
  */
@@ -65,11 +63,6 @@ export type Dump = {
65
63
  * deleted. We keep the same structure for both updated and deleted items.
66
64
  */
67
65
  deleted: Map<string, { oldPublicUrl: string | null; newPublicUrl: null }>;
68
-
69
- /**
70
- * The diff used to generate this dump.
71
- */
72
- diff: Diff;
73
66
  };
74
67
 
75
68
  export type DumpMetadata = {
@@ -186,7 +186,6 @@ export const dumpManager: DumpManager = {
186
186
  toUniqueId: diff.toUniqueId,
187
187
  updated: new Map(),
188
188
  deleted: new Map(),
189
- diff,
190
189
  };
191
190
 
192
191
  if (config.dumpDir) {