@forge/migrations 3.1.1-next.1 → 3.2.0-next.2
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 +6 -0
- package/README.md +22 -0
- package/out/index.d.ts +1 -1
- package/out/index.d.ts.map +1 -1
- package/out/migration/index.d.ts +3 -1
- package/out/migration/index.d.ts.map +1 -1
- package/out/migration/index.js +2 -0
- package/out/migration/migration-adaptor.d.ts +8 -0
- package/out/migration/migration-adaptor.d.ts.map +1 -1
- package/out/migration/migration.d.ts +2 -1
- package/out/migration/migration.d.ts.map +1 -1
- package/out/migration/migration.js +10 -0
- package/out/migration/ndjson-reader.d.ts +6 -0
- package/out/migration/ndjson-reader.d.ts.map +1 -0
- package/out/migration/ndjson-reader.js +30 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @forge/migrations
|
|
2
2
|
|
|
3
|
+
## 3.2.0-next.2
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8d110da: Added `migration.getConfluenceMacroIndexIterator(transferId, { rowIndex })`, which iterates the Confluence macro index NDJSON file one parsed row at a time, beginning on the given row.
|
|
8
|
+
|
|
3
9
|
## 3.1.1-next.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -52,6 +52,28 @@ Returns a signed download URL for the transfer's Confluence macro index. The app
|
|
|
52
52
|
getConfluenceMacroIndexUrl: (transferId: string) => Promise<ConfluenceMacroIndexUrlResponse>;
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
+
### Iterate Confluence macro index rows
|
|
56
|
+
|
|
57
|
+
Downloads the transfer's Confluence macro index (an NDJSON file) and returns an iterator that yields one parsed row per call to `next()`, beginning on `rowIndex` (default `0`).
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
getConfluenceMacroIndexIterator: (
|
|
61
|
+
transferId: string,
|
|
62
|
+
options?: { rowIndex?: number }
|
|
63
|
+
) => AsyncIterableIterator<{ macroname: string; contentIds: string[] }>;
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Keep track of the index of the row you are processing so that you can resume from it if processing is interrupted:
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
let rowIndex = 0; // e.g. restored from where you last left off
|
|
70
|
+
|
|
71
|
+
for await (const row of migration.getConfluenceMacroIndexIterator(transferId, { rowIndex })) {
|
|
72
|
+
console.log(rowIndex, row.macroname, row.contentIds.length);
|
|
73
|
+
rowIndex++;
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
55
77
|
### Retrieve Containers
|
|
56
78
|
|
|
57
79
|
Returns a set of containers with a specified `containerType`.
|
package/out/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { migration, MigrationAPIError } from './migration';
|
|
2
2
|
export { migration, MigrationAPIError };
|
|
3
|
-
export type { ConfluenceMacroIndexUrlResponse } from './migration/migration-adaptor';
|
|
3
|
+
export type { ConfluenceMacroIndexRow, ConfluenceMacroIndexRowsOptions, ConfluenceMacroIndexUrlResponse } from './migration/migration-adaptor';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/out/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;AACxC,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;AACxC,YAAY,EACV,uBAAuB,EACvB,+BAA+B,EAC/B,+BAA+B,EAChC,MAAM,+BAA+B,CAAC"}
|
package/out/migration/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Migration } from './migration';
|
|
2
|
-
import { AppDataIteratorOptions, AppDataPageOptions, ContainerType } from './migration-adaptor';
|
|
2
|
+
import { AppDataIteratorOptions, AppDataPageOptions, ConfluenceMacroIndexRowsOptions, ContainerType } from './migration-adaptor';
|
|
3
3
|
import { DefaultQueryBuilder } from './query-api';
|
|
4
4
|
export declare const getMigrationInstance: (adapter: Migration) => {
|
|
5
5
|
getMappingById: (transferId: string, namespace: string, keys: Array<string>) => Promise<import("./migration-adaptor").MappingResponse>;
|
|
@@ -11,6 +11,7 @@ export declare const getMigrationInstance: (adapter: Migration) => {
|
|
|
11
11
|
getAppDataIterator: (transferId: string, options?: AppDataIteratorOptions) => AsyncIterableIterator<import("./migration-adaptor").FileMetadata>;
|
|
12
12
|
getAppDataPayload: (s3Key: string) => Promise<import("packages/forge-api/out").Response>;
|
|
13
13
|
getConfluenceMacroIndexUrl: (transferId: string) => Promise<import("./migration-adaptor").ConfluenceMacroIndexUrlResponse>;
|
|
14
|
+
getConfluenceMacroIndexIterator: (transferId: string, options?: ConfluenceMacroIndexRowsOptions) => AsyncIterableIterator<import("./migration-adaptor").ConfluenceMacroIndexRow>;
|
|
14
15
|
getMappings: (transferId: string, namespace: string) => DefaultQueryBuilder;
|
|
15
16
|
getContainers: (transferId: string, containerType: ContainerType) => DefaultQueryBuilder;
|
|
16
17
|
};
|
|
@@ -24,6 +25,7 @@ export declare const migration: {
|
|
|
24
25
|
getAppDataIterator: (transferId: string, options?: AppDataIteratorOptions) => AsyncIterableIterator<import("./migration-adaptor").FileMetadata>;
|
|
25
26
|
getAppDataPayload: (s3Key: string) => Promise<import("packages/forge-api/out").Response>;
|
|
26
27
|
getConfluenceMacroIndexUrl: (transferId: string) => Promise<import("./migration-adaptor").ConfluenceMacroIndexUrlResponse>;
|
|
28
|
+
getConfluenceMacroIndexIterator: (transferId: string, options?: ConfluenceMacroIndexRowsOptions) => AsyncIterableIterator<import("./migration-adaptor").ConfluenceMacroIndexRow>;
|
|
27
29
|
getMappings: (transferId: string, namespace: string) => DefaultQueryBuilder;
|
|
28
30
|
getContainers: (transferId: string, containerType: ContainerType) => DefaultQueryBuilder;
|
|
29
31
|
};
|
|
@@ -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,
|
|
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,EACL,sBAAsB,EACtB,kBAAkB,EAClB,+BAA+B,EAC/B,aAAa,EACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,eAAO,MAAM,oBAAoB,GAAI,SAAS,SAAS;iCAEtB,MAAM,aAAa,MAAM,QAAQ,KAAK,CAAC,MAAM,CAAC;mCAE5C,MAAM,aAAa,MAAM;gCAC5B,MAAM,aAAa,MAAM;yBAChC,MAAM,cAAc,MAAM;iCAClB,MAAM;iCACN,MAAM,YAAY,kBAAkB;qCAChC,MAAM,YAAY,sBAAsB;+BAE9C,MAAM;6CACQ,MAAM;kDACD,MAAM,YAAY,+BAA+B;8BAErE,MAAM,aAAa,MAAM;gCAEvB,MAAM,iBAAiB,aAAa;CAGnE,CAAC;AAEF,eAAO,MAAM,SAAS;iCACS,MAAM,aAAa,MAAM,QAAQ,KAAK,CAAC,MAAM,CAAC;mCAE5C,MAAM,aAAa,MAAM;gCAE5B,MAAM,aAAa,MAAM;yBAEhC,MAAM,cAAc,MAAM;iCAElB,MAAM;iCACN,MAAM,YAAY,kBAAkB;qCAEhC,MAAM,YAAY,sBAAsB;+BAE9C,MAAM;6CACQ,MAAM;kDAED,MAAM,YAAY,+BAA+B;8BAErE,MAAM,aAAa,MAAM;gCAEvB,MAAM,iBAAiB,aAAa;CAEjE,CAAC;AAEF,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,UAAU,CAAC"}
|
package/out/migration/index.js
CHANGED
|
@@ -14,6 +14,7 @@ const getMigrationInstance = (adapter) => {
|
|
|
14
14
|
getAppDataIterator: (transferId, options) => adapter.getAppDataIterator(transferId, options),
|
|
15
15
|
getAppDataPayload: (s3Key) => adapter.getAppDataPayload(s3Key),
|
|
16
16
|
getConfluenceMacroIndexUrl: (transferId) => adapter.getConfluenceMacroIndexUrl(transferId),
|
|
17
|
+
getConfluenceMacroIndexIterator: (transferId, options) => adapter.getConfluenceMacroIndexIterator(transferId, options),
|
|
17
18
|
getMappings: (transferId, namespace) => new query_api_1.DefaultQueryBuilder(adapter, { transferId: transferId, namespace: namespace }),
|
|
18
19
|
getContainers: (transferId, containerType) => new query_api_1.DefaultQueryBuilder(adapter, { transferId: transferId, containerType: containerType })
|
|
19
20
|
};
|
|
@@ -29,6 +30,7 @@ exports.migration = {
|
|
|
29
30
|
getAppDataIterator: (transferId, options) => (0, exports.getMigrationInstance)(new migration_1.Migration()).getAppDataIterator(transferId, options),
|
|
30
31
|
getAppDataPayload: (s3Key) => (0, exports.getMigrationInstance)(new migration_1.Migration()).getAppDataPayload(s3Key),
|
|
31
32
|
getConfluenceMacroIndexUrl: (transferId) => (0, exports.getMigrationInstance)(new migration_1.Migration()).getConfluenceMacroIndexUrl(transferId),
|
|
33
|
+
getConfluenceMacroIndexIterator: (transferId, options) => (0, exports.getMigrationInstance)(new migration_1.Migration()).getConfluenceMacroIndexIterator(transferId, options),
|
|
32
34
|
getMappings: (transferId, namespace) => (0, exports.getMigrationInstance)(new migration_1.Migration()).getMappings(transferId, namespace),
|
|
33
35
|
getContainers: (transferId, containerType) => (0, exports.getMigrationInstance)(new migration_1.Migration()).getContainers(transferId, containerType)
|
|
34
36
|
};
|
|
@@ -6,6 +6,7 @@ export interface MigrationAdapter {
|
|
|
6
6
|
getAppDataIterator(transferId: string, options?: AppDataIteratorOptions): AsyncIterableIterator<FileMetadata>;
|
|
7
7
|
getAppDataPayload(s3Key: string): Promise<APIResponse>;
|
|
8
8
|
getConfluenceMacroIndexUrl(transferId: string): Promise<ConfluenceMacroIndexUrlResponse>;
|
|
9
|
+
getConfluenceMacroIndexIterator(transferId: string, options?: ConfluenceMacroIndexRowsOptions): AsyncIterableIterator<ConfluenceMacroIndexRow>;
|
|
9
10
|
messageProcessed(transferId: string, messageId: string): Promise<void>;
|
|
10
11
|
messageFailed(transferId: string, messageId: string): Promise<void>;
|
|
11
12
|
addLog(transferId: string, logMessage: string): Promise<void>;
|
|
@@ -40,6 +41,13 @@ export interface AppDataPayloadResponse {
|
|
|
40
41
|
export interface ConfluenceMacroIndexUrlResponse {
|
|
41
42
|
url: string;
|
|
42
43
|
}
|
|
44
|
+
export interface ConfluenceMacroIndexRow {
|
|
45
|
+
macroname: string;
|
|
46
|
+
contentIds: string[];
|
|
47
|
+
}
|
|
48
|
+
export interface ConfluenceMacroIndexRowsOptions {
|
|
49
|
+
rowIndex?: number;
|
|
50
|
+
}
|
|
43
51
|
export interface PaginationMappingResponse {
|
|
44
52
|
meta: PaginationResponseMeta;
|
|
45
53
|
items: Map<string, string>;
|
|
@@ -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,UA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;AAED,MAAM,WAAW,2BAA2B;IAC1C,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,IAAI,EAAE,sBAAsB,CAAC;CAC9B;AAED,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,aAAa,GAAG,MAAM,CAAC;AAEvE,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,MAAM;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;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,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,CAAC;IACnC,OAAO,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;IAChC,MAAM,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACvC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppDataIteratorOptions, AppDataListResponse, AppDataPageOptions, ConfluenceMacroIndexUrlResponse, FileMetadata, FileMetadataPageResponse, MappingResponse, MigrationAdapter, ListOptions, ListResults } from './migration-adaptor';
|
|
1
|
+
import { AppDataIteratorOptions, AppDataListResponse, AppDataPageOptions, ConfluenceMacroIndexRow, ConfluenceMacroIndexRowsOptions, ConfluenceMacroIndexUrlResponse, FileMetadata, FileMetadataPageResponse, MappingResponse, MigrationAdapter, ListOptions, ListResults } from './migration-adaptor';
|
|
2
2
|
import { APIResponse } from '@forge/api';
|
|
3
3
|
export declare class Migration implements MigrationAdapter {
|
|
4
4
|
private readonly basePath;
|
|
@@ -8,6 +8,7 @@ export declare class Migration implements MigrationAdapter {
|
|
|
8
8
|
getAppDataIterator(transferId: string, { pageSize }?: AppDataIteratorOptions): AsyncIterableIterator<FileMetadata>;
|
|
9
9
|
getAppDataPayload: (key: string) => Promise<APIResponse>;
|
|
10
10
|
getConfluenceMacroIndexUrl: (transferId: string) => Promise<ConfluenceMacroIndexUrlResponse>;
|
|
11
|
+
getConfluenceMacroIndexIterator(transferId: string, { rowIndex }?: ConfluenceMacroIndexRowsOptions): AsyncIterableIterator<ConfluenceMacroIndexRow>;
|
|
11
12
|
messageProcessed: (transferId: string, messageId: string) => Promise<void>;
|
|
12
13
|
messageFailed: (transferId: string, messageId: string) => Promise<void>;
|
|
13
14
|
addLog: (transferId: string, logMessage: string) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../src/migration/migration.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,kBAAkB,EAClB,+BAA+B,EAC/B,YAAY,EACZ,wBAAwB,EACxB,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,WAAW,EAIZ,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../src/migration/migration.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,+BAA+B,EAC/B,+BAA+B,EAC/B,YAAY,EACZ,wBAAwB,EACxB,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,WAAW,EAIZ,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAMzC,qBAAa,SAAU,YAAW,gBAAgB;IAChD,OAAO,C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M,KAAG,OAAO,CAAC,WAAW,CAAC,CAI1E;CACH"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Migration = void 0;
|
|
4
|
+
const errors_1 = require("./errors");
|
|
5
|
+
const ndjson_reader_1 = require("./ndjson-reader");
|
|
4
6
|
const utils_1 = require("./utils");
|
|
5
7
|
class Migration {
|
|
6
8
|
basePath = '/app/migration/forge/v1';
|
|
@@ -42,6 +44,14 @@ class Migration {
|
|
|
42
44
|
const result = await (0, utils_1.invokePOSTApi)(`${this.basePath}/confluenceMacroIndex/${transferId}`, null);
|
|
43
45
|
return (0, utils_1.getResponseBody)(result);
|
|
44
46
|
};
|
|
47
|
+
async *getConfluenceMacroIndexIterator(transferId, { rowIndex = 0 } = {}) {
|
|
48
|
+
(0, ndjson_reader_1.assertValidStartRow)(rowIndex);
|
|
49
|
+
const response = await (0, utils_1.invokeGETApi)(`${this.basePath}/confluenceMacroIndex/download/${transferId}`);
|
|
50
|
+
if (response.status !== 200) {
|
|
51
|
+
throw errors_1.APIError.forStatus(response.status, response.statusText);
|
|
52
|
+
}
|
|
53
|
+
yield* (0, ndjson_reader_1.readNdjson)(await response.text(), { startRow: rowIndex });
|
|
54
|
+
}
|
|
45
55
|
messageProcessed = async (transferId, messageId) => {
|
|
46
56
|
const request = {
|
|
47
57
|
status: 'SUCCESS',
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface NdjsonReadOptions {
|
|
2
|
+
startRow?: number;
|
|
3
|
+
}
|
|
4
|
+
export declare function assertValidStartRow(startRow: number): void;
|
|
5
|
+
export declare function readNdjson<T = unknown>(body: string, { startRow }?: NdjsonReadOptions): Generator<T, void, undefined>;
|
|
6
|
+
//# sourceMappingURL=ndjson-reader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ndjson-reader.d.ts","sourceRoot":"","sources":["../../src/migration/ndjson-reader.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAK1D;AAMD,wBAAiB,UAAU,CAAC,CAAC,GAAG,OAAO,EACrC,IAAI,EAAE,MAAM,EACZ,EAAE,QAAY,EAAE,GAAE,iBAAsB,GACvC,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,CAmB/B"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assertValidStartRow = assertValidStartRow;
|
|
4
|
+
exports.readNdjson = readNdjson;
|
|
5
|
+
const errors_1 = require("./errors");
|
|
6
|
+
function assertValidStartRow(startRow) {
|
|
7
|
+
if (!Number.isInteger(startRow) || startRow < 0) {
|
|
8
|
+
throw errors_1.APIError.forUnexpected('rowIndex must be a non-negative integer');
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function* readNdjson(body, { startRow = 0 } = {}) {
|
|
12
|
+
assertValidStartRow(startRow);
|
|
13
|
+
let row = 0;
|
|
14
|
+
for (const line of body.split('\n')) {
|
|
15
|
+
if (line.trim() === '') {
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
if (row++ < startRow) {
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
let parsed;
|
|
22
|
+
try {
|
|
23
|
+
parsed = JSON.parse(line);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
throw errors_1.APIError.forUnexpected(`Row ${row - 1} was not valid JSON: ${line}`);
|
|
27
|
+
}
|
|
28
|
+
yield parsed;
|
|
29
|
+
}
|
|
30
|
+
}
|