-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
210 lines (188 loc) · 4.29 KB
/
index.ts
File metadata and controls
210 lines (188 loc) · 4.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
import { ContentstackClient } from '@contentstack/cli-utilities';
// eslint-disable-next-line @typescript-eslint/no-redeclare
export interface AuthOptions {
contentstackClient: any;
}
export interface ContentStackManagementClient {
contentstackClient: object;
}
export interface PrintOptions {
color?: string;
}
export interface InquirePayload {
type: string;
name: string;
message: string;
choices?: Array<any>;
transformer?: Function;
}
export interface User {
email: string;
authtoken: string;
}
export interface Region {
name: string;
cma: string;
cda: string;
uiHost: string;
}
export type Modules =
| 'stack'
| 'locales'
| 'environments'
| 'content-types'
| 'global-fields'
| 'extensions'
| 'taxonomies'
| 'entries'
| 'assets'
| 'webhooks'
| 'workflows'
| 'custom-roles'
| 'labels'
| 'marketplace-apps'
| 'personalize';
export interface ModuleQueryConfig {
supportedFields: string[];
supportedOperators: string[];
defaultLimit: number;
includeGlobalFieldSchema?: boolean;
includePublishDetails?: boolean;
includeDimension?: boolean;
}
export interface DependencyAnalysisConfig {
enabled: boolean;
fields?: string[];
extractors?: string[];
}
export interface ModuleDefinition {
dirName: string;
fileName: string;
apiEndpoint: string;
queryable: boolean;
dependencies: Modules[];
queryConfig?: ModuleQueryConfig;
dependencyAnalysis?: DependencyAnalysisConfig;
limit?: number;
batchLimit?: number;
}
export interface DependencyExtractor {
fieldType: string;
extract: (data: any) => string[];
targetModule: Modules;
}
export interface ExportOptions {
query?: any;
alias?: string;
directory?: string;
branch?: string;
skipReferences?: boolean;
skipDependencies?: boolean;
securedAssets?: boolean;
includeGlobalFieldSchema?: boolean;
includePublishDetails?: boolean;
includeDimension?: boolean;
contentTypes?: string[];
uids?: string[];
configPath?: string;
fetchConcurrency?: number;
writeConcurrency?: number;
batchSize?: number;
[key: string]: any;
}
export interface DefaultConfig {
// Basic settings
contentVersion: number;
host: string;
// Export settings
exportDir?: string;
stackApiKey?: string;
managementToken?: string;
region?: Region;
branchName?: string;
securedAssets?: boolean;
// Query settings
query?: string;
queryInput?: string;
skipReferences?: boolean;
skipDependencies?: boolean;
isQueryBasedExport?: boolean;
// Module configuration
modules: {
general: Modules[];
queryable: Modules[];
dependent: Modules[];
content: Modules[];
// Export order
exportOrder: Modules[];
// Module definitions
definitions?: Record<Modules, ModuleDefinition>;
};
// Query-specific settings
queryConfig: {
maxRecursionDepth?: number;
batchSize?: number;
metadataFileName?: string;
validation: {
maxQueryDepth?: number;
maxArraySize?: number;
allowedDateFormats?: string[];
};
};
// Dependency extraction rules
dependencyExtractors?: Record<string, DependencyExtractor>;
// Performance settings
fetchConcurrency: number;
writeConcurrency: number;
// Optional settings
developerHubBaseUrl?: string;
branches?: Array<{ uid: string; source: string }>;
branchEnabled?: boolean;
branchDir?: string;
apis: {
stacks: string;
locales: string;
environments: string;
content_types: string;
global_fields: string;
extensions: string;
taxonomies: string;
entries: string;
assets: string;
};
externalConfigPath?: string;
maxCTReferenceDepth: number;
}
export interface QueryExportConfig extends DefaultConfig {
query: string;
skipReferences: boolean;
skipDependencies: boolean;
stackApiKey: string;
managementToken?: string;
branchName: string;
securedAssets: boolean;
logsPath: string;
dataPath: string;
exportDelayMs?: number;
batchDelayMs?: number;
assetBatchSize?: number;
assetBatchDelayMs?: number;
}
export interface QueryMetadata {
query: any;
flags: {
skipReferences: boolean;
skipDependencies: boolean;
};
timestamp: string;
cliVersion: string;
exportedModules: string[];
contentTypes: Array<{
uid: string;
title: string;
}>;
summary: {
totalContentTypes: number;
totalModules: number;
};
}