@jpmorganchase/mosaic-workflows 0.1.0-beta.7 → 0.1.0-beta.70

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.
@@ -1,35 +1,31 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const path_1 = __importDefault(require("path"));
7
- const fs_1 = __importDefault(require("fs"));
8
- const uuid_1 = require("uuid");
9
- const mosaic_source_git_repo_1 = require("@jpmorganchase/mosaic-source-git-repo");
10
- const mdx_1 = __importDefault(require("@jpmorganchase/mosaic-serialisers/dist/mdx"));
11
- let repoInstance = null;
12
- async function createPullRequest(sourceOptions, { apiEndpoint, commitMessage, titlePrefix }, filePath, { user, markdown }) {
1
+ import path from 'path';
2
+ import fs from 'fs';
3
+ import { v4 as uuidv4 } from 'uuid';
4
+ import { Repo } from '@jpmorganchase/mosaic-source-git-repo';
5
+ import { mdx } from '@jpmorganchase/mosaic-serialisers';
6
+ async function createPullRequest(sendWorkflowProgressMessage, sourceOptions, { apiEndpoint, commitMessage, titlePrefix }, filePath, { user, markdown }) {
13
7
  const { credentials, remote, branch: sourceBranch, repo: repoUrl, subfolder, prefixDir } = sourceOptions;
14
8
  if (!repoUrl || !markdown) {
15
9
  // indicate to the plugin runner that no save happened
16
10
  return false;
17
11
  }
18
- if (!repoInstance) {
19
- repoInstance = new mosaic_source_git_repo_1.Repo(credentials, remote, sourceBranch, repoUrl);
20
- await repoInstance.init();
21
- }
22
- const branchName = `${user.sid.toLowerCase()}-${(0, uuid_1.v4)()}`;
12
+ let repoInstance = new Repo(credentials, remote, sourceBranch, repoUrl);
13
+ await repoInstance.init();
14
+ sendWorkflowProgressMessage('Bitbucket clone complete', 'IN_PROGRESS');
15
+ const branchName = `${user.sid.toLowerCase()}-${uuidv4()}`;
23
16
  await repoInstance.createWorktree(user.sid.toLowerCase(), branchName);
17
+ sendWorkflowProgressMessage('Created git worktree', 'IN_PROGRESS');
24
18
  /**
25
19
  * strip out the namespace from the file path.
26
20
  * We are interested in the file on disk not in the VFS
27
21
  */
28
- const pathOnDisk = path_1.default.posix.join(repoInstance.dir, subfolder, filePath.replace(new RegExp(`${prefixDir}/`), ''));
29
- const rawPage = await fs_1.default.promises.readFile(pathOnDisk);
30
- const { content, ...metadata } = await mdx_1.default.deserialise(pathOnDisk, rawPage);
22
+ const pathOnDisk = path.posix.join(repoInstance.dir, subfolder, filePath.replace(new RegExp(`${prefixDir}/`), ''));
23
+ const rawPage = await fs.promises.readFile(pathOnDisk);
24
+ const { content, ...metadata } = await mdx.deserialise(pathOnDisk, rawPage);
31
25
  const updatedPage = { ...metadata, content: markdown };
32
- await fs_1.default.promises.writeFile(pathOnDisk, await mdx_1.default.serialise(pathOnDisk, updatedPage));
26
+ sendWorkflowProgressMessage('Updated page content', 'IN_PROGRESS');
27
+ await fs.promises.writeFile(pathOnDisk, await mdx.serialise(pathOnDisk, updatedPage));
28
+ sendWorkflowProgressMessage('Saved page', 'IN_PROGRESS');
33
29
  const bitBucketRequest = JSON.stringify({
34
30
  title: `${titlePrefix} - Content update - ${filePath}`,
35
31
  fromRef: {
@@ -54,7 +50,11 @@ async function createPullRequest(sourceOptions, { apiEndpoint, commitMessage, ti
54
50
  }
55
51
  });
56
52
  const endpoint = `${apiEndpoint}/projects/${repoInstance.projectName}/repos/${repoInstance.repoName}/pull-requests`;
57
- return repoInstance.createPullRequest(user, branchName, filePath, endpoint, bitBucketRequest, commitMessage(filePath));
53
+ sendWorkflowProgressMessage('Creating Pull Request', 'IN_PROGRESS');
54
+ const result = await repoInstance.createPullRequest(user, branchName, filePath, endpoint, bitBucketRequest, commitMessage(filePath));
55
+ sendWorkflowProgressMessage(result, 'COMPLETE');
56
+ repoInstance = null;
57
+ return result;
58
58
  }
59
59
  const workflow = {
60
60
  name: 'save',
@@ -65,5 +65,5 @@ const workflow = {
65
65
  },
66
66
  action: createPullRequest
67
67
  };
68
- exports.default = workflow;
69
- //# sourceMappingURL=BitBucketPullRequestWorkflow.js.map
68
+ export default workflow;
69
+ //# sourceMappingURL=BitbucketPullRequestWorkflow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BitbucketPullRequestWorkflow.js","sourceRoot":"","sources":["../src/BitbucketPullRequestWorkflow.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,IAAI,EAAwB,MAAM,uCAAuC,CAAC;AACnF,OAAO,EAAE,GAAG,EAAE,MAAM,mCAAmC,CAAC;AAcxD,KAAK,UAAU,iBAAiB,CAC9B,2BAAsD,EACtD,aAAmC,EACnC,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAuC,EAChF,QAAgB,EAChB,EAAE,IAAI,EAAE,QAAQ,EAAoC;IAEpD,MAAM,EACJ,WAAW,EACX,MAAM,EACN,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,OAAO,EACb,SAAS,EACT,SAAS,EACV,GAAG,aAAa,CAAC;IAElB,IAAI,CAAC,OAAO,IAAI,CAAC,QAAQ,EAAE;QACzB,sDAAsD;QACtD,OAAO,KAAK,CAAC;KACd;IAED,IAAI,YAAY,GAAgB,IAAI,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;IACrF,MAAM,YAAY,CAAC,IAAI,EAAE,CAAC;IAC1B,2BAA2B,CAAC,0BAA0B,EAAE,aAAa,CAAC,CAAC;IAEvE,MAAM,UAAU,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,MAAM,EAAE,EAAE,CAAC;IAC3D,MAAM,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,E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AC,QAAQ,EAAE;gBAChC,IAAI,EAAE,IAAI;gBACV,OAAO,EAAE;oBACP,GAAG,EAAE,GAAG,YAAY,CAAC,WAAW,EAAE;iBACnC;aACF;SACF;KACF,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,GAAG,WAAW,aAAa,YAAY,CAAC,WAAW,UAAU,YAAY,CAAC,QAAQ,gBAAgB,CAAC;IACpH,2BAA2B,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAC;IACpE,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,iBAAiB,CACjD,IAAI,EACJ,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,aAAa,CAAC,QAAQ,CAAC,CACxB,CAAC;IAEF,2BAA2B,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAEhD,YAAY,GAAG,IAAI,CAAC;IACpB,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,QAAQ,GAAmB;IAC/B,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE;QACP,WAAW,EAAE,aAAa;QAC1B,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,EAAE;QAChD,aAAa,EAAE,CAAC,QAAgB,EAAE,EAAE,CAAC,yBAAyB,QAAQ,aAAa;KACpF;IACD,MAAM,EAAE,iBAAiB;CAC1B,CAAC;AAEF,eAAe,QAAQ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import BitBucketPullRequestWorkflow from './BitBucketPullRequestWorkflow';
2
- export { BitBucketPullRequestWorkflow };
1
+ import BitbucketPullRequestWorkflow from './BitbucketPullRequestWorkflow.js';
2
+ export { BitbucketPullRequestWorkflow };
package/dist/index.js CHANGED
@@ -1,9 +1,3 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.BitBucketPullRequestWorkflow = void 0;
7
- const BitBucketPullRequestWorkflow_1 = __importDefault(require("./BitBucketPullRequestWorkflow"));
8
- exports.BitBucketPullRequestWorkflow = BitBucketPullRequestWorkflow_1.default;
1
+ import BitbucketPullRequestWorkflow from './BitbucketPullRequestWorkflow.js';
2
+ export { BitbucketPullRequestWorkflow };
9
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,kGAA0E;AAEjE,uCAFF,sCAA4B,CAEE"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,MAAM,mCAAmC,CAAC;AAE7E,OAAO,EAAE,4BAA4B,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,31 +1,42 @@
1
1
  {
2
2
  "name": "@jpmorganchase/mosaic-workflows",
3
- "version": "0.1.0-beta.7",
4
- "author": "",
3
+ "version": "0.1.0-beta.70",
5
4
  "description": "Mosaic workflows for core file system",
6
5
  "license": "Apache-2.0",
6
+ "author": "",
7
7
  "main": "./dist/index.js",
8
+ "type": "module",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "node": "./dist/index.js",
14
+ "default": "./dist/index.js"
15
+ }
16
+ },
8
17
  "engines": {
9
- "node": ">= 12.0.0"
18
+ "node": ">=16.10.0 || >=18.0.0"
10
19
  },
11
20
  "files": [
12
21
  "dist"
13
22
  ],
14
23
  "scripts": {
15
24
  "build": "tsc",
16
- "clean": "rm -fr dist"
25
+ "clean": "rm -fr dist",
26
+ "lint": "eslint --ignore-pattern \"**/__tests__/**\""
17
27
  },
18
28
  "repository": {
19
29
  "type": "git",
20
- "url": "git@github.com:jpmorganchase/mosaic.git"
30
+ "url": "git@github.com:jpmorganchase/mosaic.git",
31
+ "directory": "packages/workflows"
21
32
  },
22
33
  "devDependencies": {
23
34
  "@types/uuid": "^8.3.4"
24
35
  },
25
36
  "dependencies": {
26
- "@jpmorganchase/mosaic-serialisers": "^0.1.0-beta.7",
27
- "@jpmorganchase/mosaic-source-git-repo": "^0.1.0-beta.7",
28
- "@jpmorganchase/mosaic-types": "^0.1.0-beta.7",
37
+ "@jpmorganchase/mosaic-serialisers": "^0.1.0-beta.70",
38
+ "@jpmorganchase/mosaic-source-git-repo": "^0.1.0-beta.70",
39
+ "@jpmorganchase/mosaic-types": "^0.1.0-beta.70",
29
40
  "uuid": "^7.0.3"
30
41
  }
31
42
  }
package/CHANGELOG.md DELETED
@@ -1,21 +0,0 @@
1
- # @jpmorganchase/mosaic-workflows
2
-
3
- ## 0.1.0-beta.7
4
-
5
- ### Minor Changes
6
-
7
- - 46adaec: Initial release of theme and client side search
8
-
9
- We are iterating towards deploying our site code.
10
-
11
- This release includes
12
-
13
- - initial work for client-side search support
14
- - Mosaic theme.
15
-
16
- ### Patch Changes
17
-
18
- - Updated dependencies [46adaec]
19
- - @jpmorganchase/mosaic-serialisers@0.1.0-beta.7
20
- - @jpmorganchase/mosaic-source-git-repo@0.1.0-beta.7
21
- - @jpmorganchase/mosaic-types@0.1.0-beta.7
@@ -1 +0,0 @@
1
- {"version":3,"file":"BitBucketPullRequestWorkflow.js","sourceRoot":"","sources":["../src/BitBucketPullRequestWorkflow.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AACxB,4CAAoB;AACpB,+BAAoC;AACpC,kFAAmF;AACnF,qFAAwE;AAcxE,IAAI,YAAY,GAAgB,IAAI,CAAC;AAErC,KAAK,UAAU,iBAAiB,CAC9B,aAAmC,EACnC,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAuC,EAChF,QAAgB,EAChB,EAAE,IAAI,EAAE,QAAQ,EAAoC;IAEpD,MAAM,EACJ,WAAW,EACX,MAAM,EACN,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,OAAO,EACb,SAAS,EACT,SAAS,EACV,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