@forge/migrations 0.5.1-next.0-experimental-c6147b1 → 0.5.1
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 +9 -2
- package/out/migration/index.d.ts +3 -2
- package/out/migration/index.d.ts.map +1 -1
- package/out/migration/migration-adaptor.d.ts +2 -1
- package/out/migration/migration-adaptor.d.ts.map +1 -1
- package/out/migration/migration.js +65 -67
- package/out/migration/query-api.js +6 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
# @forge/migrations
|
|
2
2
|
|
|
3
|
-
## 0.5.1
|
|
3
|
+
## 0.5.1
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
+
- 54f19cb: Add ContainerType
|
|
7
8
|
- 2cd49c2: Add \_\_requestAtlassian methods
|
|
8
9
|
- Updated dependencies [2cd49c2]
|
|
9
|
-
- @forge/api@3.7.0
|
|
10
|
+
- @forge/api@3.7.0
|
|
11
|
+
|
|
12
|
+
## 0.5.1-next.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 54f19cb: Add ContainerType
|
|
10
17
|
|
|
11
18
|
## 0.5.1-next.0
|
|
12
19
|
|
package/out/migration/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Migration } from './migration';
|
|
2
|
+
import { ContainerType } from './migration-adaptor';
|
|
2
3
|
import { DefaultQueryBuilder } from './query-api';
|
|
3
4
|
export declare const getMigrationInstance: (adapter: Migration) => {
|
|
4
5
|
getMappingById: (transferId: string, namespace: string, keys: Array<string>) => Promise<import("./migration-adaptor").MappingResponse>;
|
|
@@ -6,7 +7,7 @@ export declare const getMigrationInstance: (adapter: Migration) => {
|
|
|
6
7
|
getAppDataList: (transferId: string) => Promise<import("./migration-adaptor").AppDataListResponse>;
|
|
7
8
|
getAppDataPayload: (s3Key: string) => Promise<import("@forge/api").APIResponse>;
|
|
8
9
|
getMappings: (transferId: string, namespace: string) => DefaultQueryBuilder;
|
|
9
|
-
getContainers: (transferId: string, containerType:
|
|
10
|
+
getContainers: (transferId: string, containerType: ContainerType) => DefaultQueryBuilder;
|
|
10
11
|
};
|
|
11
12
|
export declare const migration: {
|
|
12
13
|
getMappingById: (transferId: string, namespace: string, keys: Array<string>) => Promise<import("./migration-adaptor").MappingResponse>;
|
|
@@ -14,6 +15,6 @@ export declare const migration: {
|
|
|
14
15
|
getAppDataList: (transferId: string) => Promise<import("./migration-adaptor").AppDataListResponse>;
|
|
15
16
|
getAppDataPayload: (s3Key: string) => Promise<import("@forge/api").APIResponse>;
|
|
16
17
|
getMappings: (transferId: string, namespace: string) => DefaultQueryBuilder;
|
|
17
|
-
getContainers: (transferId: string, containerType:
|
|
18
|
+
getContainers: (transferId: string, containerType: ContainerType) => DefaultQueryBuilder;
|
|
18
19
|
};
|
|
19
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migration/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,eAAO,MAAM,oBAAoB,YAAa,SAAS;iCAEtB,MAAM,aAAa,MAAM,QAAQ,MAAM,MAAM,CAAC;mCAE5C,MAAM,aAAa,MAAM;iCAC3B,MAAM;+BACR,MAAM;8BACP,MAAM,aAAa,MAAM;gCAEvB,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migration/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,eAAO,MAAM,oBAAoB,YAAa,SAAS;iCAEtB,MAAM,aAAa,MAAM,QAAQ,MAAM,MAAM,CAAC;mCAE5C,MAAM,aAAa,MAAM;iCAC3B,MAAM;+BACR,MAAM;8BACP,MAAM,aAAa,MAAM;gCAEvB,MAAM,iBAAiB,aAAa;CAGnE,CAAC;AAEF,eAAO,MAAM,SAAS;iCACS,MAAM,aAAa,MAAM,QAAQ,MAAM,MAAM,CAAC;mCAE5C,MAAM,aAAa,MAAM;iCAE3B,MAAM;+BACR,MAAM;8BACP,MAAM,aAAa,MAAM;gCAEvB,MAAM,iBAAiB,aAAa;CAEjE,CAAC"}
|
|
@@ -31,10 +31,11 @@ export interface PaginationContainerResponse {
|
|
|
31
31
|
containers: Array<object>;
|
|
32
32
|
meta: PaginationResponseMeta;
|
|
33
33
|
}
|
|
34
|
+
export declare type ContainerType = 'ConfluenceSpace' | 'JiraProject' | 'Site';
|
|
34
35
|
export interface ListOptions {
|
|
35
36
|
transferId: string;
|
|
36
37
|
namespace?: string;
|
|
37
|
-
containerType?:
|
|
38
|
+
containerType?: ContainerType;
|
|
38
39
|
cursor?: string;
|
|
39
40
|
}
|
|
40
41
|
export interface Result {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-adaptor.d.ts","sourceRoot":"","sources":["../../src/migration/migration-adaptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,WAAW,gBAAgB;IAC/B,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IACrG,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACjE,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;I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CACf;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC;IACrC,OAAO,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;IAChC,MAAM,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACvC"}
|
|
@@ -3,75 +3,73 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Migration = void 0;
|
|
4
4
|
const utils_1 = require("./utils");
|
|
5
5
|
class Migration {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
basePath = '/app/migration/forge/v1';
|
|
7
|
+
getMappingById = async (transferId, namespace, keys) => {
|
|
8
|
+
const result = await (0, utils_1.invokePOSTApi)(`${this.basePath}/mapping/${transferId}/find?namespace=${namespace}`, keys);
|
|
9
|
+
return (0, utils_1.getResponseBody)(result);
|
|
10
|
+
};
|
|
11
|
+
getAppDataList = async (transferId) => {
|
|
12
|
+
const result = await (0, utils_1.invokeGETApi)(`${this.basePath}/data/${transferId}/all`);
|
|
13
|
+
return (0, utils_1.getResponseBody)(result);
|
|
14
|
+
};
|
|
15
|
+
getAppDataPayload = async (key) => {
|
|
16
|
+
return (0, utils_1.invokeGETApi)(`${this.basePath}/data/${key}/payload`);
|
|
17
|
+
};
|
|
18
|
+
messageProcessed = async (transferId, messageId) => {
|
|
19
|
+
const request = {
|
|
20
|
+
status: 'SUCCESS',
|
|
21
|
+
messageIds: [messageId]
|
|
11
22
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
23
|
+
const result = await (0, utils_1.invokePOSTApi)(`${this.basePath}/message/${transferId}/status`, request);
|
|
24
|
+
return (0, utils_1.getResponseBody)(result);
|
|
25
|
+
};
|
|
26
|
+
getMappings = async (transferId, namespace, lastEntity, pageSize) => {
|
|
27
|
+
let queryParams = `namespace=${namespace}`;
|
|
28
|
+
if (pageSize != undefined) {
|
|
29
|
+
queryParams = queryParams + `&pageSize=${pageSize}`;
|
|
30
|
+
}
|
|
31
|
+
if (lastEntity != undefined) {
|
|
32
|
+
queryParams = queryParams + `&lastEntity=${lastEntity}`;
|
|
33
|
+
}
|
|
34
|
+
const result = await (0, utils_1.invokeGETApi)(`${this.basePath}/mapping/${transferId}/page?${queryParams}`);
|
|
35
|
+
const mappingResponse = await (0, utils_1.getResponseBody)(result);
|
|
36
|
+
let results = [];
|
|
37
|
+
if (mappingResponse.items != null) {
|
|
38
|
+
results = Object.entries(mappingResponse.items).map((item) => {
|
|
39
|
+
return { key: item[0], value: item[1] };
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
results: results,
|
|
44
|
+
nextCursor: mappingResponse.meta.lastEntity != null ? mappingResponse.meta.lastEntity : undefined
|
|
15
45
|
};
|
|
16
|
-
|
|
17
|
-
|
|
46
|
+
};
|
|
47
|
+
getContainers = async (transferId, containerType, lastEntity, pageSize) => {
|
|
48
|
+
let queryParams = `containerType=${containerType}`;
|
|
49
|
+
if (pageSize != undefined) {
|
|
50
|
+
queryParams = queryParams + `&pageSize=${pageSize}`;
|
|
51
|
+
}
|
|
52
|
+
if (lastEntity != undefined) {
|
|
53
|
+
queryParams = queryParams + `&lastEntity=${lastEntity}`;
|
|
54
|
+
}
|
|
55
|
+
const result = await (0, utils_1.invokeGETApi)(`${this.basePath}/container/${transferId}/page?${queryParams}`);
|
|
56
|
+
const containerResponse = await (0, utils_1.getResponseBody)(result);
|
|
57
|
+
let results = [];
|
|
58
|
+
if (containerResponse.containers != null) {
|
|
59
|
+
results = Object.entries(containerResponse.containers).map((item) => {
|
|
60
|
+
return { key: item[0], value: item[1] };
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
results: results,
|
|
65
|
+
nextCursor: containerResponse.meta.lastEntity != null ? containerResponse.meta.lastEntity : undefined
|
|
18
66
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
this.getMappings = async (transferId, namespace, lastEntity, pageSize) => {
|
|
28
|
-
let queryParams = `namespace=${namespace}`;
|
|
29
|
-
if (pageSize != undefined) {
|
|
30
|
-
queryParams = queryParams + `&pageSize=${pageSize}`;
|
|
31
|
-
}
|
|
32
|
-
if (lastEntity != undefined) {
|
|
33
|
-
queryParams = queryParams + `&lastEntity=${lastEntity}`;
|
|
34
|
-
}
|
|
35
|
-
const result = await (0, utils_1.invokeGETApi)(`${this.basePath}/mapping/${transferId}/page?${queryParams}`);
|
|
36
|
-
const mappingResponse = await (0, utils_1.getResponseBody)(result);
|
|
37
|
-
let results = [];
|
|
38
|
-
if (mappingResponse.items != null) {
|
|
39
|
-
results = Object.entries(mappingResponse.items).map((item) => {
|
|
40
|
-
return { key: item[0], value: item[1] };
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
return {
|
|
44
|
-
results: results,
|
|
45
|
-
nextCursor: mappingResponse.meta.lastEntity != null ? mappingResponse.meta.lastEntity : undefined
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
this.getContainers = async (transferId, containerType, lastEntity, pageSize) => {
|
|
49
|
-
let queryParams = `containerType=${containerType}`;
|
|
50
|
-
if (pageSize != undefined) {
|
|
51
|
-
queryParams = queryParams + `&pageSize=${pageSize}`;
|
|
52
|
-
}
|
|
53
|
-
if (lastEntity != undefined) {
|
|
54
|
-
queryParams = queryParams + `&lastEntity=${lastEntity}`;
|
|
55
|
-
}
|
|
56
|
-
const result = await (0, utils_1.invokeGETApi)(`${this.basePath}/container/${transferId}/page?${queryParams}`);
|
|
57
|
-
const containerResponse = await (0, utils_1.getResponseBody)(result);
|
|
58
|
-
let results = [];
|
|
59
|
-
if (containerResponse.containers != null) {
|
|
60
|
-
results = Object.entries(containerResponse.containers).map((item) => {
|
|
61
|
-
return { key: item[0], value: item[1] };
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
return {
|
|
65
|
-
results: results,
|
|
66
|
-
nextCursor: containerResponse.meta.lastEntity != null ? containerResponse.meta.lastEntity : undefined
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
this.list = async (options, pageSize) => {
|
|
70
|
-
if (options.namespace != undefined)
|
|
71
|
-
return this.getMappings(options.transferId, options.namespace, options.cursor, pageSize);
|
|
72
|
-
else
|
|
73
|
-
return this.getContainers(options.transferId, options.containerType, options.cursor, pageSize);
|
|
74
|
-
};
|
|
75
|
-
}
|
|
67
|
+
};
|
|
68
|
+
list = async (options, pageSize) => {
|
|
69
|
+
if (options.namespace != undefined)
|
|
70
|
+
return this.getMappings(options.transferId, options.namespace, options.cursor, pageSize);
|
|
71
|
+
else
|
|
72
|
+
return this.getContainers(options.transferId, options.containerType, options.cursor, pageSize);
|
|
73
|
+
};
|
|
76
74
|
}
|
|
77
75
|
exports.Migration = Migration;
|
|
@@ -2,12 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DefaultQueryBuilder = void 0;
|
|
4
4
|
class DefaultQueryBuilder {
|
|
5
|
+
migration;
|
|
6
|
+
queryOptions;
|
|
5
7
|
constructor(migration, queryOptions) {
|
|
6
8
|
this.migration = migration;
|
|
7
9
|
this.queryOptions = queryOptions;
|
|
8
10
|
}
|
|
9
11
|
cursor(cursor) {
|
|
10
|
-
return new DefaultQueryBuilder(this.migration,
|
|
12
|
+
return new DefaultQueryBuilder(this.migration, {
|
|
13
|
+
...this.queryOptions,
|
|
14
|
+
cursor
|
|
15
|
+
});
|
|
11
16
|
}
|
|
12
17
|
async getOne() {
|
|
13
18
|
const listResults = await this.migration.list(this.queryOptions, 1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/migrations",
|
|
3
|
-
"version": "0.5.1
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "App migration methods for Forge app",
|
|
5
5
|
"main": "out/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -18,6 +18,6 @@
|
|
|
18
18
|
"node-fetch": "2.7.0"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@forge/api": "3.7.0
|
|
21
|
+
"@forge/api": "3.7.0"
|
|
22
22
|
}
|
|
23
23
|
}
|