wuffle 0.58.0 → 0.59.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.
Files changed (63) hide show
  1. package/bin/run.js +48 -38
  2. package/bin/wuffle +1 -1
  3. package/index.js +1 -1
  4. package/lib/apps/auth-routes/AuthRoutes.js +10 -20
  5. package/lib/apps/auth-routes/index.js +2 -2
  6. package/lib/apps/automatic-dev-flow.js +5 -5
  7. package/lib/apps/background-sync/BackgroundSync.js +9 -17
  8. package/lib/apps/background-sync/index.js +2 -2
  9. package/lib/apps/board-api-routes/board-api-filters.js +10 -28
  10. package/lib/apps/board-api-routes/board-api-routes.js +17 -27
  11. package/lib/apps/board-api-routes/index.js +2 -2
  12. package/lib/apps/board-routes.js +21 -10
  13. package/lib/apps/dump-store/local/DumpStoreLocal.js +8 -12
  14. package/lib/apps/dump-store/local/index.js +2 -2
  15. package/lib/apps/dump-store/s3/DumpStoreS3.js +6 -8
  16. package/lib/apps/dump-store/s3/S3.js +4 -5
  17. package/lib/apps/dump-store/s3/index.js +2 -2
  18. package/lib/apps/events-sync.js +7 -9
  19. package/lib/apps/github-app/GithubApp.js +7 -9
  20. package/lib/apps/github-app/index.js +2 -2
  21. package/lib/apps/github-checks/GithubChecks.js +7 -10
  22. package/lib/apps/github-checks/index.js +2 -2
  23. package/lib/apps/github-client/GithubClient.js +16 -17
  24. package/lib/apps/github-client/index.js +2 -2
  25. package/lib/apps/github-comments/GithubComments.js +8 -17
  26. package/lib/apps/github-comments/index.js +2 -2
  27. package/lib/apps/github-issues/GithubIssues.js +4 -9
  28. package/lib/apps/github-issues/index.js +2 -2
  29. package/lib/apps/github-reviews/GithubReviews.js +8 -14
  30. package/lib/apps/github-reviews/index.js +2 -2
  31. package/lib/apps/github-statuses/GithubStatuses.js +8 -14
  32. package/lib/apps/github-statuses/index.js +2 -2
  33. package/lib/apps/log-events.js +7 -9
  34. package/lib/apps/reindex-store.js +10 -18
  35. package/lib/apps/route-compression.js +3 -5
  36. package/lib/apps/route-https.js +3 -5
  37. package/lib/apps/search/Search.js +8 -20
  38. package/lib/apps/search/index.js +2 -2
  39. package/lib/apps/security-context/SecurityContext.js +3 -5
  40. package/lib/apps/security-context/index.js +2 -2
  41. package/lib/apps/user-access/TreeCache.js +1 -3
  42. package/lib/apps/user-access/UserAccess.js +11 -8
  43. package/lib/apps/user-access/index.js +2 -2
  44. package/lib/apps/webhook-events/WebhookEvents.js +4 -6
  45. package/lib/apps/webhook-events/index.js +2 -2
  46. package/lib/columns.js +7 -4
  47. package/lib/events.js +2 -9
  48. package/lib/filters.js +11 -31
  49. package/lib/index.js +38 -40
  50. package/lib/links.js +17 -12
  51. package/lib/load-config.js +8 -4
  52. package/lib/middleware/index.js +7 -9
  53. package/lib/probot/CustomProbot.js +8 -11
  54. package/lib/probot/apps/setup.js +9 -16
  55. package/lib/probot/index.js +1 -1
  56. package/lib/store.js +10 -22
  57. package/lib/util/cache.js +4 -11
  58. package/lib/util/index.js +37 -37
  59. package/lib/util/links.js +3 -7
  60. package/lib/util/meta.js +24 -7
  61. package/lib/util/search.js +3 -8
  62. package/package.json +15 -8
  63. package/public/bundle.js.map +1 -1
package/bin/run.js CHANGED
@@ -1,52 +1,55 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- require('dotenv').config();
3
+ import dotenv from 'dotenv';
4
4
 
5
- const { CustomProbot } = require('../lib/probot');
5
+ dotenv.config();
6
6
 
7
- const IS_PROD = CustomProbot.isProduction();
7
+ import * as CustomProbot from '../lib/probot/index.js';
8
8
 
9
- const IS_SETUP = !IS_PROD && !CustomProbot.isSetup();
9
+ import fs from 'node:fs';
10
+ import path from 'node:path';
10
11
 
11
- const fs = require('fs');
12
- const path = require('path');
12
+ import { getLog } from 'probot/lib/helpers/get-log.js';
13
13
 
14
- const { getLog } = require('probot/lib/helpers/get-log');
14
+ import {
15
+ getPackageVersion,
16
+ relativePath
17
+ } from '../lib/util/index.js';
15
18
 
16
- const log = getLog().child({
17
- name: 'wuffle:run'
18
- });
19
+ import Columns from '../lib/columns.js';
19
20
 
20
- const Columns = require('../lib/columns');
21
+ const version = getPackageVersion();
21
22
 
22
- const { version } = require('../package');
23
+ const IS_PROD = CustomProbot.isProduction();
23
24
 
24
- // shim
25
+ const IS_SETUP = !IS_PROD && !CustomProbot.isSetup();
25
26
 
26
- if (typeof Array.prototype.flat !== 'function') {
27
- Array.prototype.flat = function() {
28
- return [].concat(...this);
29
- };
30
- }
27
+ const log = getLog().child({
28
+ name: 'wuffle:run'
29
+ });
31
30
 
32
31
  async function validate() {
33
32
 
34
33
  log.info('Validating configuration');
35
34
 
36
- const problems = [
37
- !IS_PROD ? warning('Not running in production mode') : null,
38
- checkEnv('APP_ID', IS_PROD),
39
- checkEnv('BASE_URL', IS_PROD),
40
- checkEnv('GITHUB_CLIENT_ID', IS_PROD),
41
- checkEnv('GITHUB_CLIENT_SECRET', IS_PROD),
42
- checkEnv([ 'PRIVATE_KEY', 'PRIVATE_KEY_PATH' ], IS_PROD),
43
- checkEnv('SESSION_SECRET', IS_PROD),
44
- checkEnv('WEBHOOK_SECRET', IS_PROD),
45
- checkDumpConfig(),
46
- checkConfig(),
47
- checkBoardAssets(),
48
- checkBaseUrl()
49
- ].flat().filter(problem => problem);
35
+ const problems = await Promise.all(
36
+ [
37
+ !IS_PROD ? warning('Not running in production mode') : null,
38
+ checkEnv('APP_ID', IS_PROD),
39
+ checkEnv('BASE_URL', IS_PROD),
40
+ checkEnv('GITHUB_CLIENT_ID', IS_PROD),
41
+ checkEnv('GITHUB_CLIENT_SECRET', IS_PROD),
42
+ checkEnv([ 'PRIVATE_KEY', 'PRIVATE_KEY_PATH' ], IS_PROD),
43
+ checkEnv('SESSION_SECRET', IS_PROD),
44
+ checkEnv('WEBHOOK_SECRET', IS_PROD),
45
+ checkDumpConfig(),
46
+ checkConfig(),
47
+ checkBoardAssets(),
48
+ checkBaseUrl()
49
+ ]
50
+ ).then(
51
+ results => results.flat().filter(problem => problem)
52
+ );
50
53
 
51
54
  function isFatal(problem) {
52
55
  return problem.type === 'ERROR';
@@ -110,12 +113,12 @@ async function validate() {
110
113
  function checkBoardAssets() {
111
114
  const problem = IS_PROD ? error : warning;
112
115
 
113
- if (!fs.existsSync(path.join(__dirname, '../public/index.html'))) {
116
+ if (!fs.existsSync(projectPath('../public/index.html'))) {
114
117
  return problem('board assets not found, please compile them via npm run build');
115
118
  }
116
119
  }
117
120
 
118
- function checkConfig() {
121
+ async function checkConfig() {
119
122
 
120
123
  const problem = IS_PROD ? error : warning;
121
124
 
@@ -133,8 +136,11 @@ async function validate() {
133
136
  const configPath = path.resolve('wuffle.config.js');
134
137
 
135
138
  try {
136
- config = require(configPath);
139
+ config = await import(configPath);
140
+
141
+ config = config.default || config;
137
142
  } catch (err) {
143
+ console.error(err);
138
144
  return problem('Board not configured via env.BOARD_CONFIG or wuffle.config.js');
139
145
  }
140
146
  }
@@ -210,7 +216,7 @@ async function performSetup() {
210
216
  const configPath = path.resolve('wuffle.config.js');
211
217
 
212
218
  if (!process.env.BOARD_CONFIG && !fs.existsSync(configPath)) {
213
- fs.copyFileSync(path.join(__dirname, '../wuffle.config.example.js'), configPath);
219
+ fs.copyFileSync(projectPath('../wuffle.config.example.js'), configPath);
214
220
 
215
221
  log.info('Created board config: wuffle.config.js');
216
222
  }
@@ -218,7 +224,7 @@ async function performSetup() {
218
224
  const manifestPath = path.resolve('app.yml');
219
225
 
220
226
  if (!fs.existsSync(manifestPath)) {
221
- fs.copyFileSync(path.join(__dirname, '../app.yml'), manifestPath);
227
+ fs.copyFileSync(projectPath('../app.yml'), manifestPath);
222
228
 
223
229
  log.info('Created GitHub App manifest: app.yml');
224
230
  }
@@ -240,7 +246,7 @@ async function performSetup() {
240
246
 
241
247
  async function start() {
242
248
 
243
- const app = require('../');
249
+ const { default: app } = await import('../index.js');
244
250
 
245
251
  const {
246
252
  expressApp
@@ -276,6 +282,10 @@ async function run() {
276
282
  await open();
277
283
  }
278
284
 
285
+ function projectPath(file) {
286
+ return relativePath(file, import.meta.url);
287
+ }
288
+
279
289
  run().catch(err => {
280
290
  log.error(err);
281
291
 
package/bin/wuffle CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- require('./run');
3
+ import './run.js';
package/index.js CHANGED
@@ -1 +1 @@
1
- module.exports = require('./lib');
1
+ export { default } from './lib/index.js';
@@ -1,19 +1,12 @@
1
- const { URLSearchParams } = require('url');
2
-
3
- const fetch = require('node-fetch').default;
4
-
5
- const {
6
- withSession
7
- } = require('../../middleware');
8
-
9
- const {
10
- randomString
11
- } = require('../../util');
1
+ import { URLSearchParams } from 'url';
2
+ import fetch from 'node-fetch';
3
+ import { withSession } from '../../middleware/index.js';
4
+ import { randomString } from '../../util/index.js';
12
5
 
13
6
  /**
14
- * @typedef {import('../../types').Session} WuffleSession
7
+ * @typedef {import('../../types.js').Session} WuffleSession
15
8
  * @typedef {import('express').Request} Request
16
- * @typedef {import('../../types').GitHubUser} GitHubUser
9
+ * @typedef {import('../../types.js').GitHubUser} GitHubUser
17
10
  */
18
11
 
19
12
  /**
@@ -25,11 +18,11 @@ const {
25
18
  *
26
19
  * @constructor
27
20
  *
28
- * @param {import('../../types').Logger} logger
29
- * @param {import('../../types').Router} router
30
- * @param {import('../security-context/SecurityContext')} securityContext
21
+ * @param {import('../../types.js').Logger} logger
22
+ * @param {import('../../types.js').Router} router
23
+ * @param {import('../security-context/SecurityContext.js').default} securityContext
31
24
  */
32
- function AuthRoutes(logger, router, securityContext) {
25
+ export default function AuthRoutes(logger, router, securityContext) {
33
26
 
34
27
  const middlewares = [
35
28
  withSession
@@ -254,9 +247,6 @@ function AuthRoutes(logger, router, securityContext) {
254
247
  }
255
248
 
256
249
 
257
- module.exports = AuthRoutes;
258
-
259
-
260
250
  // helpers ///////////////////////
261
251
 
262
252
  function getBaseUrl() {
@@ -1,6 +1,6 @@
1
- const AuthRoutes = require('./AuthRoutes');
1
+ import AuthRoutes from './AuthRoutes.js';
2
2
 
3
- module.exports = {
3
+ export default {
4
4
  __init__: [ 'authRoutes' ],
5
5
  authRoutes: [ 'type', AuthRoutes ]
6
6
  };
@@ -12,11 +12,11 @@ const CHANGES_REQUESTED = 'changes_requested';
12
12
  *
13
13
  * @constructor
14
14
  *
15
- * @param {import('./webhook-events/WebhookEvents')} webhookEvents
16
- * @param {import('./github-issues/GithubIssues')} githubIssues
17
- * @param {import('../columns')} columns
15
+ * @param {import('./webhook-events/WebhookEvents.js').default} webhookEvents
16
+ * @param {import('./github-issues/GithubIssues.js').default} githubIssues
17
+ * @param {import('../columns.js').default} columns
18
18
  */
19
- module.exports = function(webhookEvents, githubIssues, columns) {
19
+ export default function(webhookEvents, githubIssues, columns) {
20
20
 
21
21
  webhookEvents.on([
22
22
  'issues.closed',
@@ -177,7 +177,7 @@ module.exports = function(webhookEvents, githubIssues, columns) {
177
177
  );
178
178
  });
179
179
 
180
- };
180
+ }
181
181
 
182
182
 
183
183
  // helpers //////////////////////
@@ -1,11 +1,5 @@
1
- const {
2
- filterIssueOrPull,
3
- filterRepository
4
- } = require('../../filters');
5
-
6
- const {
7
- issueIdent
8
- } = require('../../util');
1
+ import { filterIssueOrPull, filterRepository } from '../../filters.js';
2
+ import { issueIdent } from '../../util/index.js';
9
3
 
10
4
  function isInternalError(error) {
11
5
  return 'status' in error && error.status === 500;
@@ -17,14 +11,14 @@ function isInternalError(error) {
17
11
  *
18
12
  * @constructor
19
13
  *
20
- * @param {import('../../types').Logger} logger
14
+ * @param {import('../../types.js').Logger} logger
21
15
  * @param {Object} config
22
- * @param {import('../../store')} store
23
- * @param {import('../github-client/GithubClient')} githubClient
24
- * @param {import('../github-app/GithubApp')} githubApp
25
- * @param {import('../../events')} events
16
+ * @param {import('../../store.js').default} store
17
+ * @param {import('../github-client/GithubClient.js').default} githubClient
18
+ * @param {import('../github-app/GithubApp.js').default} githubApp
19
+ * @param {import('../../events.js').default} events
26
20
  */
27
- function BackgroundSync(logger, config, store, githubClient, githubApp, events) {
21
+ export default function BackgroundSync(logger, config, store, githubClient, githubApp, events) {
28
22
 
29
23
  // 30 days
30
24
  const syncClosedLookback = (
@@ -529,6 +523,4 @@ We automatically synchronize all repositories you granted us access to via the G
529
523
  }
530
524
  });
531
525
 
532
- }
533
-
534
- module.exports = BackgroundSync;
526
+ }
@@ -1,6 +1,6 @@
1
- const BackgroundSync = require('./BackgroundSync');
1
+ import BackgroundSync from './BackgroundSync.js';
2
2
 
3
- module.exports = {
3
+ export default {
4
4
  __init__: [ 'backgroundSync' ],
5
5
  backgroundSync: [ 'type', BackgroundSync ]
6
6
  };
@@ -1,4 +1,4 @@
1
- function filterIssueOrPull(issueOrPull) {
1
+ export function filterIssueOrPull(issueOrPull) {
2
2
 
3
3
  if (issueOrPull.pull_request) {
4
4
  return filterPull(issueOrPull);
@@ -7,8 +7,6 @@ function filterIssueOrPull(issueOrPull) {
7
7
  }
8
8
  }
9
9
 
10
- module.exports.filterIssueOrPull = filterIssueOrPull;
11
-
12
10
 
13
11
  function filterCheckRun(checkRun) {
14
12
  const {
@@ -44,7 +42,7 @@ function filterStatus(status) {
44
42
  }
45
43
 
46
44
 
47
- function filterRepository(repository) {
45
+ export function filterRepository(repository) {
48
46
 
49
47
  const {
50
48
  name,
@@ -59,10 +57,8 @@ function filterRepository(repository) {
59
57
  };
60
58
  }
61
59
 
62
- module.exports.filterRepository = filterRepository;
63
-
64
60
 
65
- function filterUser(user) {
61
+ export function filterUser(user) {
66
62
 
67
63
  const {
68
64
  login,
@@ -77,10 +73,8 @@ function filterUser(user) {
77
73
  };
78
74
  }
79
75
 
80
- module.exports.filterUser = filterUser;
81
-
82
76
 
83
- function filterComment(comment) {
77
+ export function filterComment(comment) {
84
78
 
85
79
  const {
86
80
  user,
@@ -93,10 +87,8 @@ function filterComment(comment) {
93
87
  };
94
88
  }
95
89
 
96
- module.exports.filterComment = filterComment;
97
90
 
98
-
99
- function filterLabel(githubLabel) {
91
+ export function filterLabel(githubLabel) {
100
92
 
101
93
  const {
102
94
  name,
@@ -111,8 +103,6 @@ function filterLabel(githubLabel) {
111
103
  };
112
104
  }
113
105
 
114
- module.exports.filterLabel = filterLabel;
115
-
116
106
  function filterLink(link) {
117
107
  const {
118
108
  type,
@@ -127,7 +117,7 @@ function filterLink(link) {
127
117
  };
128
118
  }
129
119
 
130
- function filterMilestone(githubMilestone) {
120
+ export function filterMilestone(githubMilestone) {
131
121
 
132
122
  const {
133
123
  number,
@@ -142,10 +132,8 @@ function filterMilestone(githubMilestone) {
142
132
  };
143
133
  }
144
134
 
145
- module.exports.filterMilestone = filterMilestone;
146
135
 
147
-
148
- function filterReview(review) {
136
+ export function filterReview(review) {
149
137
 
150
138
  const {
151
139
  state,
@@ -160,10 +148,8 @@ function filterReview(review) {
160
148
  };
161
149
  }
162
150
 
163
- module.exports.filterReview = filterReview;
164
-
165
151
 
166
- function filterPull(pullRequest) {
152
+ export function filterPull(pullRequest) {
167
153
 
168
154
  const {
169
155
  id,
@@ -216,10 +202,8 @@ function filterPull(pullRequest) {
216
202
  };
217
203
  }
218
204
 
219
- module.exports.filterPull = filterPull;
220
-
221
205
 
222
- function filterIssue(issue) {
206
+ export function filterIssue(issue) {
223
207
 
224
208
  const {
225
209
  id,
@@ -261,6 +245,4 @@ function filterIssue(issue) {
261
245
  column
262
246
  };
263
247
 
264
- }
265
-
266
- module.exports.filterIssue = filterIssue;
248
+ }
@@ -1,40 +1,30 @@
1
- const bodyParser = require('body-parser').text();
2
-
3
- const {
4
- withSession
5
- } = require('../../middleware');
6
-
7
- const {
8
- repoAndOwner
9
- } = require('../../util');
10
-
11
-
12
- const {
13
- filterIssueOrPull: _filterIssueOrPull
14
- } = require('./board-api-filters');
1
+ import bodyParser from 'body-parser';
15
2
 
3
+ import { withSession } from '../../middleware/index.js';
4
+ import { repoAndOwner } from '../../util/index.js';
5
+ import { filterIssueOrPull as _filterIssueOrPull } from './board-api-filters.js';
16
6
 
17
7
  /**
18
8
  * This component provides the board API routes.
19
9
  *
20
10
  * @param {Object} config
21
- * @param {import('../../store')} store
22
- * @param {import('../../types').Router} router
23
- * @param {import('../../types').Logger} logger
24
- * @param {import('../github-client/GithubClient')} githubClient
25
- * @param {import('../auth-routes/AuthRoutes')} authRoutes
26
- * @param {import('../user-access/UserAccess')} userAccess
27
- * @param {import('../github-issues/GithubIssues')} githubIssues
28
- * @param {import('../search/Search')} search
29
- * @param {import('../../columns')} columns
11
+ * @param {import('../../store.js').default} store
12
+ * @param {import('../../types.js').Router} router
13
+ * @param {import('../../types.js').Logger} logger
14
+ * @param {import('../github-client/GithubClient.js').default} githubClient
15
+ * @param {import('../auth-routes/AuthRoutes.js').default} authRoutes
16
+ * @param {import('../user-access/UserAccess.js').default} userAccess
17
+ * @param {import('../github-issues/GithubIssues.js').default} githubIssues
18
+ * @param {import('../search/Search.js').default} search
19
+ * @param {import('../../columns.js').default} columns
30
20
  */
31
- module.exports = async (
21
+ export default async function BoardApiRoutes(
32
22
  config, store,
33
23
  router, logger,
34
24
  githubClient, authRoutes,
35
25
  userAccess, githubIssues,
36
26
  search, columns
37
- ) => {
27
+ ) {
38
28
 
39
29
  const log = logger.child({
40
30
  name: 'wuffle:board-api-routes'
@@ -241,7 +231,7 @@ module.exports = async (
241
231
  });
242
232
 
243
233
 
244
- router.post('/wuffle/board/issues/move', ...middlewares, bodyParser, async (req, res) => {
234
+ router.post('/wuffle/board/issues/move', ...middlewares, bodyParser.text(), async (req, res) => {
245
235
 
246
236
  const user = authRoutes.getGitHubUser(req);
247
237
 
@@ -302,4 +292,4 @@ module.exports = async (
302
292
 
303
293
  });
304
294
 
305
- };
295
+ }
@@ -1,5 +1,5 @@
1
- const boardApiRoutes = require('./board-api-routes');
1
+ import boardApiRoutes from './board-api-routes.js';
2
2
 
3
- module.exports = {
3
+ export default {
4
4
  __init__: [ boardApiRoutes ]
5
5
  };
@@ -1,8 +1,9 @@
1
- const express = require('express');
1
+ import express from 'express';
2
2
 
3
- const fs = require('fs');
3
+ import fs from 'node:fs';
4
4
 
5
- const path = require('path');
5
+ import { relativePath } from '../util/index.js';
6
+ import { fileURLToPath } from 'node:url';
6
7
 
7
8
 
8
9
  /**
@@ -10,9 +11,9 @@ const path = require('path');
10
11
  *
11
12
  * @param {import('express').Router} router
12
13
  */
13
- module.exports = async (config, router) => {
14
+ export default async function BoardRoutes(config, router) {
14
15
 
15
- const staticDirectory = path.join(__dirname, '..', '..', 'public');
16
+ const staticDirectory = relativePath('../../public/', import.meta.url);
16
17
 
17
18
  router.get('/', (req, res, next) => {
18
19
  res.redirect('/board');
@@ -44,7 +45,7 @@ module.exports = async (config, router) => {
44
45
  return indexPage;
45
46
  }
46
47
 
47
- indexPage = fs.readFileSync(path.join(staticDirectory, 'index.html'), 'utf8');
48
+ indexPage = fs.readFileSync(relativePath('index.html', staticDirectory), 'utf8');
48
49
 
49
50
  indexPage = indexPage.replace(
50
51
  '<title>Wuffle Board</title>',
@@ -67,15 +68,25 @@ module.exports = async (config, router) => {
67
68
  res.type('html').status(200).send(getIndexPage());
68
69
  });
69
70
 
71
+ const robotsPath = fileURLToPath(
72
+ relativePath('robots.txt', staticDirectory)
73
+ );
74
+
70
75
  router.get('/robots.txt', (req, res, next) => {
71
- res.sendFile(path.join(staticDirectory, 'robots.txt'));
76
+ res.sendFile(robotsPath);
72
77
  });
73
78
 
79
+ const serviceWorkerPath = fileURLToPath(
80
+ relativePath('service-worker.js', staticDirectory)
81
+ );
82
+
74
83
  router.get('/service-worker.js', (req, res, next) => {
75
- res.sendFile(path.join(staticDirectory, 'service-worker.js'));
84
+ res.sendFile(serviceWorkerPath);
76
85
  });
77
86
 
78
87
  // static resources
79
88
 
80
- router.use('/board', express.static(staticDirectory));
81
- };
89
+ const staticDirectoryPath = fileURLToPath(staticDirectory);
90
+
91
+ router.use('/board', express.static(staticDirectoryPath));
92
+ }
@@ -1,7 +1,6 @@
1
- const fs = require('fs').promises;
2
- const path = require('path');
3
-
4
- const { mkdirp } = require('mkdirp');
1
+ import { promises as fs } from 'node:fs';
2
+ import path from 'node:path';
3
+ import { mkdirp } from 'mkdirp';
5
4
 
6
5
 
7
6
  /**
@@ -10,11 +9,11 @@ const { mkdirp } = require('mkdirp');
10
9
  *
11
10
  * @constructor
12
11
  *
13
- * @param {import('../../../types').Logger} logger
14
- * @param {import('../../../store')} store
15
- * @param {import('../../../events')} events
12
+ * @param {import('../../../types.js').Logger} logger
13
+ * @param {import('../../../store.js').default} store
14
+ * @param {import('../../../events.js').default} events
16
15
  */
17
- function DumpStoreLocal(logger, store, events) {
16
+ export default function DumpStoreLocal(logger, store, events) {
18
17
 
19
18
  const log = logger.child({
20
19
  name: 'wuffle:dump-store-local'
@@ -110,7 +109,4 @@ function DumpStoreLocal(logger, store, events) {
110
109
 
111
110
  this.restoreStore = restoreStore;
112
111
  this.dumpStore = dumpStore;
113
-
114
- }
115
-
116
- module.exports = DumpStoreLocal;
112
+ }
@@ -1,6 +1,6 @@
1
- const DumpStore = require('./DumpStoreLocal');
1
+ import DumpStore from './DumpStoreLocal.js';
2
2
 
3
- module.exports = {
3
+ export default {
4
4
  __init__: [ 'dumpStore' ],
5
5
  dumpStore: [ 'type', DumpStore ]
6
6
  };
@@ -1,4 +1,4 @@
1
- const S3 = require('./S3');
1
+ import S3 from './S3.js';
2
2
 
3
3
 
4
4
  /**
@@ -7,11 +7,11 @@ const S3 = require('./S3');
7
7
  *
8
8
  * @constructor
9
9
  *
10
- * @param {import('../../../types').Logger} logger
11
- * @param {import('../../../store')} store
12
- * @param {import('../../../events')} events
10
+ * @param {import('../../../types.js').Logger} logger
11
+ * @param {import('../../../store.js').default} store
12
+ * @param {import('../../../events.js').default} events
13
13
  */
14
- function DumpStoreS3(logger, store, events) {
14
+ export default function DumpStoreS3(logger, store, events) {
15
15
 
16
16
  const log = logger.child({
17
17
  name: 'wuffle:dump-store-s3'
@@ -87,6 +87,4 @@ function DumpStoreS3(logger, store, events) {
87
87
 
88
88
  this.restoreStore = restoreStore;
89
89
  this.dumpStore = dumpStore;
90
- }
91
-
92
- module.exports = DumpStoreS3;
90
+ }
@@ -1,10 +1,11 @@
1
- const {
1
+ import {
2
2
  S3Client,
3
3
  PutObjectCommand,
4
4
  GetObjectCommand
5
- } = require('@aws-sdk/client-s3');
5
+ } from '@aws-sdk/client-s3';
6
6
 
7
- function S3() {
7
+
8
+ export default function S3() {
8
9
 
9
10
  const {
10
11
  AWS_ACCESS_KEY_ID: accessKeyId,
@@ -50,8 +51,6 @@ function S3() {
50
51
  this.params = Object.freeze(params);
51
52
  }
52
53
 
53
- module.exports = S3;
54
-
55
54
 
56
55
  // helpers /////////////////
57
56
 
@@ -1,6 +1,6 @@
1
- const DumpStore = require('./DumpStoreS3');
1
+ import DumpStore from './DumpStoreS3.js';
2
2
 
3
- module.exports = {
3
+ export default {
4
4
  __init__: [ 'dumpStore' ],
5
5
  dumpStore: [ 'type', DumpStore ]
6
6
  };