@jpmorganchase/mosaic-workflows 0.1.0-beta.9 → 0.1.0-beta.90

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,CAAC;QAC1B,sDAAsD;QACtD,OAAO,KAAK,CAAC;IACf,CAAC;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,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AAG,YAAY,CAAC,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"}
@@ -0,0 +1,19 @@
1
+ import { GitRepoSourceOptions } from '@jpmorganchase/mosaic-source-git-repo';
2
+ import type { SendSourceWorkflowMessage, SourceWorkflow } from '@jpmorganchase/mosaic-types';
3
+ interface GitHubPullRequestWorkflowData {
4
+ user: {
5
+ id: string;
6
+ name: string;
7
+ email: string;
8
+ };
9
+ markdown: string;
10
+ }
11
+ interface GitHubPullRequestWorkflowOptions {
12
+ apiEndpoint: string;
13
+ commitMessage: (filePath: string) => string;
14
+ titlePrefix: string;
15
+ proxyEndpoint?: string;
16
+ }
17
+ export declare function createPullRequest(sendWorkflowProgressMessage: SendSourceWorkflowMessage, sourceOptions: GitRepoSourceOptions, { apiEndpoint, commitMessage, titlePrefix, proxyEndpoint }: GitHubPullRequestWorkflowOptions, filePath: string, { user, markdown }: GitHubPullRequestWorkflowData): Promise<any>;
18
+ declare const workflow: SourceWorkflow;
19
+ export default workflow;
@@ -0,0 +1,116 @@
1
+ import { Octokit } from '@octokit/core';
2
+ import path from 'node:path';
3
+ import fs from 'node:fs';
4
+ import { v4 as uuidv4 } from 'uuid';
5
+ import { Repo } from '@jpmorganchase/mosaic-source-git-repo';
6
+ import { mdx } from '@jpmorganchase/mosaic-serialisers';
7
+ import { ProxyAgent, fetch as undiciFetch } from 'undici';
8
+ function getErrorMessage(error) {
9
+ if (error instanceof Error)
10
+ return error.message;
11
+ return String(error);
12
+ }
13
+ export async function createPullRequest(sendWorkflowProgressMessage, sourceOptions, { apiEndpoint, commitMessage, titlePrefix, proxyEndpoint }, filePath, { user, markdown }) {
14
+ const { credentials, remote, branch: sourceBranch, repo: repoUrl, subfolder, prefixDir } = sourceOptions;
15
+ if (!repoUrl || !markdown) {
16
+ return false;
17
+ }
18
+ let repoInstance = new Repo(credentials, remote, sourceBranch, repoUrl);
19
+ await repoInstance.init();
20
+ const userId = user.id.toLowerCase();
21
+ sendWorkflowProgressMessage('GitHub clone complete', 'IN_PROGRESS');
22
+ const branchName = `${userId}-${uuidv4()}`;
23
+ await repoInstance.createWorktree(userId, branchName);
24
+ sendWorkflowProgressMessage('Created git worktree', 'IN_PROGRESS');
25
+ /**
26
+ * strip out the namespace from the file path.
27
+ * We are interested in the file on disk not in the VFS
28
+ */
29
+ const pathOnDisk = path.posix.join(repoInstance.dir, subfolder, filePath.replace(new RegExp(`${prefixDir}/`), ''));
30
+ const rawPage = await fs.promises.readFile(pathOnDisk);
31
+ const { content, ...metadata } = await mdx.deserialise(pathOnDisk, rawPage);
32
+ const updatedPage = { ...metadata, content: markdown };
33
+ sendWorkflowProgressMessage('Updated page content', 'IN_PROGRESS');
34
+ await fs.promises.writeFile(pathOnDisk, await mdx.serialise(pathOnDisk, updatedPage));
35
+ sendWorkflowProgressMessage('Saved page', 'IN_PROGRESS');
36
+ /** create a new fetcher with proxy agent configured if required. */
37
+ const fetcher = proxyEndpoint
38
+ ? (url, opts) => {
39
+ return undiciFetch(url, {
40
+ ...opts,
41
+ dispatcher: new ProxyAgent({
42
+ uri: proxyEndpoint,
43
+ keepAliveTimeout: 10,
44
+ keepAliveMaxTimeout: 10
45
+ })
46
+ });
47
+ }
48
+ : undiciFetch;
49
+ const token = credentials.split(':')[1];
50
+ // get a new client
51
+ const githubClient = new Octokit({
52
+ auth: token,
53
+ request: {
54
+ fetch: fetcher,
55
+ timeout: 5000
56
+ }
57
+ });
58
+ sendWorkflowProgressMessage('Creating Pull Request', 'IN_PROGRESS');
59
+ let prResult = null;
60
+ try {
61
+ await repoInstance.configureGitUser(user.name, user.email);
62
+ await repoInstance.addChanges();
63
+ await repoInstance.commitChanges(user.name, user.email, commitMessage(filePath));
64
+ await repoInstance.pushBranch(branchName);
65
+ const result = await githubClient.request(`POST ${apiEndpoint}`, {
66
+ owner: repoInstance.projectName,
67
+ repo: repoInstance.repoName,
68
+ title: `${titlePrefix} - Content update - ${filePath}`,
69
+ body: commitMessage(filePath),
70
+ head: branchName,
71
+ base: sourceBranch,
72
+ headers: {
73
+ 'X-GitHub-Api-Version': '2022-11-28'
74
+ }
75
+ });
76
+ /**
77
+ * https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#create-a-pull-request
78
+ * Status 201 = created
79
+ */
80
+ if (result.status === 201) {
81
+ prResult = result.data.url;
82
+ }
83
+ else {
84
+ throw new Error(`${result.data.status} - ${result.data.message}`);
85
+ }
86
+ }
87
+ catch (e) {
88
+ console.group('[Mosaic] Pull Request Error');
89
+ console.log('fullPath', filePath);
90
+ console.log('Head', branchName);
91
+ console.log('Base', sourceBranch);
92
+ console.error(e);
93
+ console.groupEnd();
94
+ prResult = {
95
+ error: `Error creating Pull Request: ${getErrorMessage(e)} `,
96
+ source: `${repoInstance.name}`
97
+ };
98
+ }
99
+ finally {
100
+ await repoInstance.removeWorktree(userId);
101
+ repoInstance = null;
102
+ }
103
+ sendWorkflowProgressMessage(prResult, 'COMPLETE');
104
+ return prResult;
105
+ }
106
+ const workflow = {
107
+ name: 'save',
108
+ options: {
109
+ titlePrefix: 'Mosaic Docs',
110
+ apiEndpoint: 'https://api.github.com/repos/{owner}/{repo}/pulls',
111
+ commitMessage: (filePath) => `docs: updated content ${filePath} (UIE-7026)`
112
+ },
113
+ action: createPullRequest
114
+ };
115
+ export default workflow;
116
+ //# sourceMappingURL=GitHubPullRequestWorkflow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GitHubPullRequestWorkflow.js","sourceRoot":"","sources":["../src/GitHubPullRequestWorkflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,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;AAExD,OAAO,EAAE,UAAU,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,QAAQ,CAAC;AAE1D,SAAS,eAAe,CAAC,KAAc;IACrC,IAAI,KAAK,YAAY,KAAK;QAAE,OAAO,KAAK,CAAC,OAAO,CAAC;IACjD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAcD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,2BAAsD,EACtD,aAAmC,EACnC,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAoC,EAC5F,QAAgB,EAChB,EAAE,IAAI,EAAE,QAAQ,EAAiC;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,EAAE,UAAU,CAAC,CAAC;IAClD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,QAAQ,GAAmB;IAC/B,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE;QACP,WAAW,EAAE,aAAa;QAC1B,WAAW,EAAE,mDAAmD;QAChE,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,17 @@
1
- import BitBucketPullRequestWorkflow from './BitBucketPullRequestWorkflow';
2
- export { BitBucketPullRequestWorkflow };
1
+ import type { SourceWorkflow } from '@jpmorganchase/mosaic-types';
2
+ import BitbucketPullRequestWorkflow from './BitbucketPullRequestWorkflow.js';
3
+ import GitHubPullRequestWorkflow from './GitHubPullRequestWorkflow.js';
4
+ export { BitbucketPullRequestWorkflow, GitHubPullRequestWorkflow };
5
+ /**
6
+ * Helper function to apply additional or overwrite existing workflow options
7
+ * @param workflow the workflow to modify
8
+ * @param options the new/updated options
9
+ * @returns Workflow with options updated
10
+ *
11
+ * @example
12
+ * import { GitHubPullRequestWorkflow, applyWorkflowOptions } from "@jpmorganchase/mosaic-workflows";
13
+ *
14
+ * applyWorkflowOptions( GitHubPullRequestWorkflow, {proxyEndpoint: 'http://your.proxy.com'})
15
+ *
16
+ */
17
+ export declare const applyWorkflowOptions: (workflow: SourceWorkflow, options: Record<string, unknown>) => SourceWorkflow;
package/dist/index.js CHANGED
@@ -1,9 +1,23 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
1
+ import BitbucketPullRequestWorkflow from './BitbucketPullRequestWorkflow.js';
2
+ import GitHubPullRequestWorkflow from './GitHubPullRequestWorkflow.js';
3
+ export { BitbucketPullRequestWorkflow, GitHubPullRequestWorkflow };
4
+ /**
5
+ * Helper function to apply additional or overwrite existing workflow options
6
+ * @param workflow the workflow to modify
7
+ * @param options the new/updated options
8
+ * @returns Workflow with options updated
9
+ *
10
+ * @example
11
+ * import { GitHubPullRequestWorkflow, applyWorkflowOptions } from "@jpmorganchase/mosaic-workflows";
12
+ *
13
+ * applyWorkflowOptions( GitHubPullRequestWorkflow, {proxyEndpoint: 'http://your.proxy.com'})
14
+ *
15
+ */
16
+ export const applyWorkflowOptions = (workflow, options) => {
17
+ const { options: workflowBaseOptions, ...restWorkflow } = workflow;
18
+ return {
19
+ ...restWorkflow,
20
+ options: { ...workflowBaseOptions, ...options }
21
+ };
4
22
  };
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;
9
23
  //# 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":"AACA,OAAO,4BAA4B,MAAM,mCAAmC,CAAC;AAC7E,OAAO,yBAAyB,MAAM,gCAAgC,CAAC;AAEvE,OAAO,EAAE,4BAA4B,EAAE,yBAAyB,EAAE,CAAC;AAEnE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,QAAwB,EACxB,OAAgC,EAChB,EAAE;IAClB,MAAM,EAAE,OAAO,EAAE,mBAAmB,EAAE,GAAG,YAAY,EAAE,GAAG,QAAQ,CAAC;IAEnE,OAAO;QACL,GAAG,YAAY;QACf,OAAO,EAAE,EAAE,GAAG,mBAAmB,EAAE,GAAG,OAAO,EAAE;KAChD,CAAC;AACJ,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,31 +1,44 @@
1
1
  {
2
2
  "name": "@jpmorganchase/mosaic-workflows",
3
- "version": "0.1.0-beta.9",
4
- "author": "",
3
+ "version": "0.1.0-beta.90",
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": ">=18.0.0 || >=20.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.9",
27
- "@jpmorganchase/mosaic-source-git-repo": "^0.1.0-beta.9",
28
- "@jpmorganchase/mosaic-types": "^0.1.0-beta.9",
37
+ "@jpmorganchase/mosaic-serialisers": "^0.1.0-beta.90",
38
+ "@jpmorganchase/mosaic-source-git-repo": "^0.1.0-beta.90",
39
+ "@jpmorganchase/mosaic-types": "^0.1.0-beta.90",
40
+ "@octokit/core": "^6.1.2",
41
+ "undici": "^6.21.1",
29
42
  "uuid": "^7.0.3"
30
43
  }
31
44
  }
package/CHANGELOG.md DELETED
@@ -1,49 +0,0 @@
1
- # @jpmorganchase/mosaic-workflows
2
-
3
- ## 0.1.0-beta.9
4
-
5
- ### Minor Changes
6
-
7
- - c3fee89: initial components package
8
-
9
- - added JSDOM testing
10
-
11
- ### Patch Changes
12
-
13
- - Updated dependencies [c3fee89]
14
- - @jpmorganchase/mosaic-serialisers@0.1.0-beta.9
15
- - @jpmorganchase/mosaic-source-git-repo@0.1.0-beta.9
16
- - @jpmorganchase/mosaic-types@0.1.0-beta.9
17
-
18
- ## 0.1.0-beta.8
19
-
20
- ### Minor Changes
21
-
22
- - 2dca0b1: initial release of Mosaic store package
23
-
24
- ### Patch Changes
25
-
26
- - Updated dependencies [2dca0b1]
27
- - @jpmorganchase/mosaic-serialisers@0.1.0-beta.8
28
- - @jpmorganchase/mosaic-source-git-repo@0.1.0-beta.8
29
- - @jpmorganchase/mosaic-types@0.1.0-beta.8
30
-
31
- ## 0.1.0-beta.7
32
-
33
- ### Minor Changes
34
-
35
- - f82c397: Initial release of theme and client side search
36
-
37
- We are iterating towards deploying our site code.
38
-
39
- This release includes
40
-
41
- - initial work for client-side search support
42
- - Mosaic theme.
43
-
44
- ### Patch Changes
45
-
46
- - Updated dependencies [f82c397]
47
- - @jpmorganchase/mosaic-serialisers@0.1.0-beta.7
48
- - @jpmorganchase/mosaic-source-git-repo@0.1.0-beta.7
49
- - @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,E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