@jumoo/usync 18.2.1 → 18.3.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.
- package/dist/api/index.d.ts +2 -2
- package/dist/api/index.js +1 -1
- package/dist/api/sdk.gen.d.ts +2 -1
- package/dist/api/sdk.gen.js +5 -0
- package/dist/api/types.gen.d.ts +37 -0
- package/dist/components/usync-content-preview.d.ts +27 -0
- package/dist/components/usync-content-preview.js +532 -0
- package/dist/components/usync-content-type-preview.d.ts +25 -0
- package/dist/components/usync-content-type-preview.js +530 -0
- package/dist/components/usync-data-type-preview.d.ts +21 -0
- package/dist/components/usync-data-type-preview.js +295 -0
- package/dist/components/usync-results-view.js +13 -5
- package/dist/dialogs/details-modal-element.d.ts +15 -0
- package/dist/dialogs/details-modal-element.js +217 -7
- package/dist/dialogs/details-modal-token.d.ts +10 -1
- package/dist/exports.d.ts +1 -0
- package/dist/exports.js +1 -0
- package/dist/lang/files/da-dk.d.ts +37 -0
- package/dist/lang/files/da-dk.js +37 -0
- package/dist/lang/files/de-de.d.ts +37 -0
- package/dist/lang/files/de-de.js +37 -0
- package/dist/lang/files/en-us.d.ts +50 -0
- package/dist/lang/files/en-us.js +50 -0
- package/dist/lang/files/es-es.d.ts +37 -0
- package/dist/lang/files/es-es.js +37 -0
- package/dist/lang/files/fr-fr.d.ts +37 -0
- package/dist/lang/files/fr-fr.js +37 -0
- package/dist/lang/files/nl-nl.d.ts +37 -0
- package/dist/lang/files/nl-nl.js +37 -0
- package/dist/manifests.js +2 -0
- package/dist/preview/index.d.ts +1 -0
- package/dist/preview/index.js +1 -0
- package/dist/preview/manifest.d.ts +2 -0
- package/dist/preview/manifest.js +22 -0
- package/dist/preview/types.d.ts +72 -0
- package/dist/preview/types.js +2 -0
- package/dist/repository/SyncAction.respositoy.d.ts +13 -0
- package/dist/repository/SyncAction.respositoy.js +6 -0
- package/dist/repository/sources/SyncAction.source.d.ts +10 -0
- package/dist/repository/sources/SyncAction.source.js +6 -1
- package/dist/utils/preview/content-type-diff.d.ts +18 -0
- package/dist/utils/preview/content-type-diff.js +72 -0
- package/dist/utils/preview/content-type-layout.d.ts +39 -0
- package/dist/utils/preview/content-type-layout.js +100 -0
- package/package.json +1 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { ManifestElement } from '@umbraco-cms/backoffice/extension-api';
|
|
2
|
+
import type { DataTypeResponseModel, DocumentResponseModel, DocumentTypeResponseModel, MediaResponseModel, MediaTypeResponseModel, MemberTypeResponseModel } from '@umbraco-cms/backoffice/external/backend-api';
|
|
3
|
+
import type { SyncItemPreviewResponse } from '../api';
|
|
4
|
+
/**
|
|
5
|
+
* An element that shows the preview of an import for one or more entity types.
|
|
6
|
+
*/
|
|
7
|
+
export interface uSyncItemPreviewElement extends HTMLElement {
|
|
8
|
+
preview?: SyncItemPreviewResponse;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Shows the preview for items of the given entity types in the details dialog.
|
|
12
|
+
*
|
|
13
|
+
* The entity types match the `EntityType` of the server side preview mapper,
|
|
14
|
+
* and `preview.preview` is the model that mapper built.
|
|
15
|
+
*/
|
|
16
|
+
export interface ManifestuSyncItemPreview extends ManifestElement<uSyncItemPreviewElement> {
|
|
17
|
+
type: 'usync-item-preview';
|
|
18
|
+
forEntityTypes: Array<string>;
|
|
19
|
+
}
|
|
20
|
+
declare global {
|
|
21
|
+
interface UmbExtensionManifestMap {
|
|
22
|
+
ManifestuSyncItemPreview: ManifestuSyncItemPreview;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** the model a preview mapper built, as the type the element expects. */
|
|
26
|
+
export declare const getPreviewModel: <T>(preview?: SyncItemPreviewResponse) => T | undefined;
|
|
27
|
+
export type uSyncPreviewContentTypeModel = DocumentTypeResponseModel | MediaTypeResponseModel | MemberTypeResponseModel;
|
|
28
|
+
/** preview model for a data type (entity type data-type) */
|
|
29
|
+
export interface SyncDataTypePreview {
|
|
30
|
+
current?: DataTypeResponseModel | null;
|
|
31
|
+
incoming?: DataTypeResponseModel | null;
|
|
32
|
+
}
|
|
33
|
+
/** what the preview needs to lay out the properties of an item */
|
|
34
|
+
export interface SyncPropertiesPreview<TTypeModel> {
|
|
35
|
+
/** the content types either side is composed of (as they are in the site) */
|
|
36
|
+
compositions: Array<TTypeModel>;
|
|
37
|
+
/** the data types used by the properties on either side */
|
|
38
|
+
dataTypes: Array<DataTypeResponseModel>;
|
|
39
|
+
/** keys of the data types that aren't in the site yet */
|
|
40
|
+
newDataTypes: Array<string>;
|
|
41
|
+
/** keys of the compositions that aren't in the site yet */
|
|
42
|
+
newCompositions: Array<string>;
|
|
43
|
+
}
|
|
44
|
+
/** preview model for a document, media or member type */
|
|
45
|
+
export interface SyncContentTypePreview<TTypeModel extends uSyncPreviewContentTypeModel = uSyncPreviewContentTypeModel> extends SyncPropertiesPreview<TTypeModel> {
|
|
46
|
+
current?: TTypeModel | null;
|
|
47
|
+
incoming?: TTypeModel | null;
|
|
48
|
+
}
|
|
49
|
+
export interface SyncContentPreviewCulture {
|
|
50
|
+
culture: string;
|
|
51
|
+
published: boolean;
|
|
52
|
+
}
|
|
53
|
+
/** the settings of a content or media item that aren't property values */
|
|
54
|
+
export interface SyncContentPreviewInfo {
|
|
55
|
+
/** name of the parent item (null when the item is at the root) */
|
|
56
|
+
parent?: string | null;
|
|
57
|
+
sortOrder: number;
|
|
58
|
+
trashed: boolean;
|
|
59
|
+
/** alias of the template (content only) */
|
|
60
|
+
template?: string | null;
|
|
61
|
+
/** published state for each culture (an empty culture for invariant content) */
|
|
62
|
+
published: Array<SyncContentPreviewCulture>;
|
|
63
|
+
}
|
|
64
|
+
/** preview model for a document or media item */
|
|
65
|
+
export interface SyncContentPreview<TModel extends DocumentResponseModel | MediaResponseModel = DocumentResponseModel | MediaResponseModel, TTypeModel extends DocumentTypeResponseModel | MediaTypeResponseModel = DocumentTypeResponseModel | MediaTypeResponseModel> extends SyncPropertiesPreview<TTypeModel> {
|
|
66
|
+
current?: TModel | null;
|
|
67
|
+
incoming?: TModel | null;
|
|
68
|
+
currentInfo?: SyncContentPreviewInfo | null;
|
|
69
|
+
incomingInfo?: SyncContentPreviewInfo | null;
|
|
70
|
+
/** the document (or media) type of the item, as it is in the site */
|
|
71
|
+
contentType?: TTypeModel | null;
|
|
72
|
+
}
|
|
@@ -118,4 +118,17 @@ export declare class uSyncActionRepository extends UmbControllerBase {
|
|
|
118
118
|
request?: Request;
|
|
119
119
|
response?: Response;
|
|
120
120
|
}>>;
|
|
121
|
+
/**
|
|
122
|
+
* gets the current and incoming versions of an item, when its handler supports previews.
|
|
123
|
+
*/
|
|
124
|
+
getPreview(handler: string, key: string): Promise<import("@umbraco-cms/backoffice/resources").UmbApiResponse<({
|
|
125
|
+
data: import("@jumoo/uSync").SyncItemPreviewResponse;
|
|
126
|
+
error: undefined;
|
|
127
|
+
} | {
|
|
128
|
+
data: undefined;
|
|
129
|
+
error: unknown;
|
|
130
|
+
}) & {
|
|
131
|
+
request?: Request;
|
|
132
|
+
response?: Response;
|
|
133
|
+
}>>;
|
|
121
134
|
}
|
|
@@ -121,5 +121,11 @@ export class uSyncActionRepository extends UmbControllerBase {
|
|
|
121
121
|
async getSyncFileInfo() {
|
|
122
122
|
return await __classPrivateFieldGet(this, _uSyncActionRepository_actionDataSource, "f").getSyncFileInfo();
|
|
123
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* gets the current and incoming versions of an item, when its handler supports previews.
|
|
126
|
+
*/
|
|
127
|
+
async getPreview(handler, key) {
|
|
128
|
+
return await __classPrivateFieldGet(this, _uSyncActionRepository_actionDataSource, "f").getPreview(handler, key);
|
|
129
|
+
}
|
|
124
130
|
}
|
|
125
131
|
_uSyncActionRepository_actionDataSource = new WeakMap(), _uSyncActionRepository_settingsDataSource = new WeakMap(), _uSyncActionRepository_migrartionDataSource = new WeakMap();
|
|
@@ -54,4 +54,14 @@ export declare class uSyncActionDataSource implements SyncActionDataSource {
|
|
|
54
54
|
request?: Request;
|
|
55
55
|
response?: Response;
|
|
56
56
|
}>>;
|
|
57
|
+
getPreview(handler: string, key: string): Promise<import("@umbraco-cms/backoffice/resources").UmbApiResponse<({
|
|
58
|
+
data: import("@jumoo/uSync").SyncItemPreviewResponse;
|
|
59
|
+
error: undefined;
|
|
60
|
+
} | {
|
|
61
|
+
data: undefined;
|
|
62
|
+
error: unknown;
|
|
63
|
+
}) & {
|
|
64
|
+
request?: Request;
|
|
65
|
+
response?: Response;
|
|
66
|
+
}>>;
|
|
57
67
|
}
|
|
@@ -11,7 +11,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
11
11
|
};
|
|
12
12
|
var _uSyncActionDataSource_host;
|
|
13
13
|
import { tryExecute } from '@umbraco-cms/backoffice/resources';
|
|
14
|
-
import { getActionsBySet, getRunning, getStatus, getSyncFileInfo, postDownload, postImport, postPerform, postProcessUpload, } from '@jumoo/uSync';
|
|
14
|
+
import { getActionsBySet, getPreview, getRunning, getStatus, getSyncFileInfo, postDownload, postImport, postPerform, postProcessUpload, } from '@jumoo/uSync';
|
|
15
15
|
export class uSyncActionDataSource {
|
|
16
16
|
constructor(host) {
|
|
17
17
|
_uSyncActionDataSource_host.set(this, void 0);
|
|
@@ -53,5 +53,10 @@ export class uSyncActionDataSource {
|
|
|
53
53
|
body: view,
|
|
54
54
|
}));
|
|
55
55
|
}
|
|
56
|
+
async getPreview(handler, key) {
|
|
57
|
+
return await tryExecute(__classPrivateFieldGet(this, _uSyncActionDataSource_host, "f"), getPreview({
|
|
58
|
+
query: { handler, key },
|
|
59
|
+
}), { disableNotifications: true });
|
|
60
|
+
}
|
|
56
61
|
}
|
|
57
62
|
_uSyncActionDataSource_host = new WeakMap();
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type USyncPreviewContentType } from './content-type-layout.js';
|
|
2
|
+
export type USyncPreviewStatus = 'added' | 'removed' | 'changed';
|
|
3
|
+
export interface USyncPreviewItemChange {
|
|
4
|
+
status: USyncPreviewStatus;
|
|
5
|
+
/** the fields that differ (for a changed item) */
|
|
6
|
+
fields: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface USyncContentTypeDiff {
|
|
9
|
+
/** top level fields (name, icon, compositions...) that differ */
|
|
10
|
+
fields: Set<string>;
|
|
11
|
+
properties: Map<string, USyncPreviewItemChange>;
|
|
12
|
+
containers: Map<string, USyncPreviewItemChange>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* compare two versions of a content type by key. Items only in the current
|
|
16
|
+
* version are being removed, items only in the incoming version are being added.
|
|
17
|
+
*/
|
|
18
|
+
export declare function diffContentTypes(current: USyncPreviewContentType | undefined, incoming: USyncPreviewContentType | undefined): USyncContentTypeDiff;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { deepEqual } from '../diff/deep-equal.js';
|
|
2
|
+
import { compositionIds, } from './content-type-layout.js';
|
|
3
|
+
const TYPE_FIELDS = [
|
|
4
|
+
'alias',
|
|
5
|
+
'name',
|
|
6
|
+
'description',
|
|
7
|
+
'icon',
|
|
8
|
+
'allowedAsRoot',
|
|
9
|
+
'variesByCulture',
|
|
10
|
+
'variesBySegment',
|
|
11
|
+
'isElement',
|
|
12
|
+
'collection',
|
|
13
|
+
];
|
|
14
|
+
const PROPERTY_FIELDS = [
|
|
15
|
+
'alias',
|
|
16
|
+
'name',
|
|
17
|
+
'description',
|
|
18
|
+
'dataType',
|
|
19
|
+
'container',
|
|
20
|
+
'sortOrder',
|
|
21
|
+
'variesByCulture',
|
|
22
|
+
'variesBySegment',
|
|
23
|
+
'validation',
|
|
24
|
+
'appearance',
|
|
25
|
+
];
|
|
26
|
+
const CONTAINER_FIELDS = ['name', 'type', 'parent', 'sortOrder'];
|
|
27
|
+
/**
|
|
28
|
+
* compare two versions of a content type by key. Items only in the current
|
|
29
|
+
* version are being removed, items only in the incoming version are being added.
|
|
30
|
+
*/
|
|
31
|
+
export function diffContentTypes(current, incoming) {
|
|
32
|
+
const fields = new Set();
|
|
33
|
+
if (current && incoming) {
|
|
34
|
+
for (const field of TYPE_FIELDS) {
|
|
35
|
+
if (!deepEqual(current[field], incoming[field]))
|
|
36
|
+
fields.add(field);
|
|
37
|
+
}
|
|
38
|
+
if (!deepEqual([...compositionIds(current)].sort(), [...compositionIds(incoming)].sort())) {
|
|
39
|
+
fields.add('compositions');
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
fields,
|
|
44
|
+
properties: diffById(current?.properties, incoming?.properties, PROPERTY_FIELDS),
|
|
45
|
+
containers: diffById(current?.containers, incoming?.containers, CONTAINER_FIELDS),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function diffById(current, incoming, fields) {
|
|
49
|
+
const changes = new Map();
|
|
50
|
+
// a whole type being added or removed is shown by its headline, don't mark every item.
|
|
51
|
+
if (!current || !incoming)
|
|
52
|
+
return changes;
|
|
53
|
+
const before = new Map(current.map((item) => [item.id, item]));
|
|
54
|
+
const after = new Map(incoming.map((item) => [item.id, item]));
|
|
55
|
+
for (const [id, item] of before) {
|
|
56
|
+
const other = after.get(id);
|
|
57
|
+
if (!other) {
|
|
58
|
+
changes.set(id, { status: 'removed', fields: [] });
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
const changed = fields
|
|
62
|
+
.filter((field) => !deepEqual(item[field], other[field]))
|
|
63
|
+
.map(String);
|
|
64
|
+
if (changed.length > 0)
|
|
65
|
+
changes.set(id, { status: 'changed', fields: changed });
|
|
66
|
+
}
|
|
67
|
+
for (const id of after.keys()) {
|
|
68
|
+
if (!before.has(id))
|
|
69
|
+
changes.set(id, { status: 'added', fields: [] });
|
|
70
|
+
}
|
|
71
|
+
return changes;
|
|
72
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { DocumentTypeResponseModel, MediaTypeResponseModel, MemberTypeResponseModel } from '@umbraco-cms/backoffice/external/backend-api';
|
|
2
|
+
/**
|
|
3
|
+
* the shape document, media and member types share - enough to lay out
|
|
4
|
+
* the editor view and compare two versions.
|
|
5
|
+
*/
|
|
6
|
+
export type USyncPreviewContentType = DocumentTypeResponseModel | MediaTypeResponseModel | MemberTypeResponseModel;
|
|
7
|
+
export type USyncPreviewProperty = USyncPreviewContentType['properties'][number];
|
|
8
|
+
export type USyncPreviewContainer = USyncPreviewContentType['containers'][number];
|
|
9
|
+
export interface USyncLayoutProperty {
|
|
10
|
+
property: USyncPreviewProperty;
|
|
11
|
+
/** name of the composition this property comes from (undefined when it's the type's own) */
|
|
12
|
+
inheritedFrom?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface USyncLayoutGroup {
|
|
15
|
+
name: string;
|
|
16
|
+
/** ids of every container merged into this group (own + compositions) */
|
|
17
|
+
ids: string[];
|
|
18
|
+
inherited: boolean;
|
|
19
|
+
sortOrder: number;
|
|
20
|
+
properties: USyncLayoutProperty[];
|
|
21
|
+
}
|
|
22
|
+
export interface USyncLayoutTab {
|
|
23
|
+
name: string;
|
|
24
|
+
ids: string[];
|
|
25
|
+
inherited: boolean;
|
|
26
|
+
sortOrder: number;
|
|
27
|
+
/** properties placed directly on the tab, outside any group */
|
|
28
|
+
properties: USyncLayoutProperty[];
|
|
29
|
+
groups: USyncLayoutGroup[];
|
|
30
|
+
}
|
|
31
|
+
/** name used for the tab that holds groups which aren't inside a tab */
|
|
32
|
+
export declare const USYNC_GENERIC_TAB = "";
|
|
33
|
+
/** the ids of the types this one is composed of (or inherits from). */
|
|
34
|
+
export declare function compositionIds(type: USyncPreviewContentType): string[];
|
|
35
|
+
/**
|
|
36
|
+
* build the tabs and groups an editor would see, merging in the containers
|
|
37
|
+
* and properties from compositions the way the backoffice does (by name).
|
|
38
|
+
*/
|
|
39
|
+
export declare function buildContentTypeLayout(type: USyncPreviewContentType, compositions: Map<string, USyncPreviewContentType>): USyncLayoutTab[];
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/** name used for the tab that holds groups which aren't inside a tab */
|
|
2
|
+
export const USYNC_GENERIC_TAB = '';
|
|
3
|
+
/** the ids of the types this one is composed of (or inherits from). */
|
|
4
|
+
export function compositionIds(type) {
|
|
5
|
+
return type.compositions.map((composition) => {
|
|
6
|
+
if ('documentType' in composition)
|
|
7
|
+
return composition.documentType.id;
|
|
8
|
+
if ('mediaType' in composition)
|
|
9
|
+
return composition.mediaType.id;
|
|
10
|
+
return composition.memberType.id;
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* build the tabs and groups an editor would see, merging in the containers
|
|
15
|
+
* and properties from compositions the way the backoffice does (by name).
|
|
16
|
+
*/
|
|
17
|
+
export function buildContentTypeLayout(type, compositions) {
|
|
18
|
+
const tabs = new Map();
|
|
19
|
+
const tabFor = (name, id, sortOrder, inherited) => {
|
|
20
|
+
let tab = tabs.get(name);
|
|
21
|
+
if (!tab) {
|
|
22
|
+
tab = { name, ids: [], inherited, sortOrder, properties: [], groups: [] };
|
|
23
|
+
tabs.set(name, tab);
|
|
24
|
+
}
|
|
25
|
+
if (id)
|
|
26
|
+
tab.ids.push(id);
|
|
27
|
+
tab.inherited && (tab.inherited = inherited);
|
|
28
|
+
return tab;
|
|
29
|
+
};
|
|
30
|
+
const groupFor = (tab, name, id, sortOrder, inherited) => {
|
|
31
|
+
let group = tab.groups.find((g) => g.name === name);
|
|
32
|
+
if (!group) {
|
|
33
|
+
group = { name, ids: [], inherited, sortOrder, properties: [] };
|
|
34
|
+
tab.groups.push(group);
|
|
35
|
+
}
|
|
36
|
+
group.ids.push(id);
|
|
37
|
+
group.inherited && (group.inherited = inherited);
|
|
38
|
+
return group;
|
|
39
|
+
};
|
|
40
|
+
for (const source of contributors(type, compositions)) {
|
|
41
|
+
const inherited = source !== type;
|
|
42
|
+
const containers = new Map(source.containers.map((c) => [c.id, c]));
|
|
43
|
+
// where each container (and so each property) lands in the merged layout.
|
|
44
|
+
const placed = new Map();
|
|
45
|
+
for (const container of [...source.containers].sort(bySortOrder)) {
|
|
46
|
+
if (container.type === 'Tab') {
|
|
47
|
+
placed.set(container.id, tabFor(container.name ?? '', container.id, container.sortOrder, inherited));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
for (const container of [...source.containers].sort(bySortOrder)) {
|
|
51
|
+
if (container.type !== 'Group')
|
|
52
|
+
continue;
|
|
53
|
+
const parent = container.parent ? containers.get(container.parent.id) : undefined;
|
|
54
|
+
const tab = parent
|
|
55
|
+
? tabFor(parent.name ?? '', undefined, parent.sortOrder, inherited)
|
|
56
|
+
: tabFor(USYNC_GENERIC_TAB, undefined, -1, inherited);
|
|
57
|
+
placed.set(container.id, groupFor(tab, container.name ?? '', container.id, container.sortOrder, inherited));
|
|
58
|
+
}
|
|
59
|
+
for (const property of [...source.properties].sort(bySortOrder)) {
|
|
60
|
+
const target = property.container ? placed.get(property.container.id) : undefined;
|
|
61
|
+
const entry = { property, inheritedFrom: inherited ? source.name : undefined };
|
|
62
|
+
if (target) {
|
|
63
|
+
target.properties.push(entry);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
tabFor(USYNC_GENERIC_TAB, undefined, -1, inherited).properties.push(entry);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const result = [...tabs.values()].sort(bySortOrder);
|
|
71
|
+
for (const tab of result) {
|
|
72
|
+
tab.groups.sort(bySortOrder);
|
|
73
|
+
tab.properties.sort((a, b) => a.property.sortOrder - b.property.sortOrder);
|
|
74
|
+
for (const group of tab.groups) {
|
|
75
|
+
group.properties.sort((a, b) => a.property.sortOrder - b.property.sortOrder);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return result.filter((tab) => tab.properties.length > 0 || tab.groups.length > 0);
|
|
79
|
+
}
|
|
80
|
+
/** the type itself first, then everything it is composed of (depth first, no repeats). */
|
|
81
|
+
function contributors(type, compositions) {
|
|
82
|
+
const seen = new Set();
|
|
83
|
+
const out = [];
|
|
84
|
+
const visit = (current) => {
|
|
85
|
+
if (seen.has(current.id))
|
|
86
|
+
return;
|
|
87
|
+
seen.add(current.id);
|
|
88
|
+
out.push(current);
|
|
89
|
+
for (const id of compositionIds(current)) {
|
|
90
|
+
const composition = compositions.get(id);
|
|
91
|
+
if (composition)
|
|
92
|
+
visit(composition);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
visit(type);
|
|
96
|
+
return out;
|
|
97
|
+
}
|
|
98
|
+
function bySortOrder(a, b) {
|
|
99
|
+
return a.sortOrder - b.sortOrder;
|
|
100
|
+
}
|