directus-template-cli 0.4.3 → 0.5.0-beta.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/dist/commands/apply.d.ts +22 -1
- package/dist/commands/apply.js +245 -106
- package/dist/commands/extract.d.ts +12 -0
- package/dist/commands/extract.js +81 -16
- package/dist/lib/extract/extract-access.d.ts +1 -0
- package/dist/lib/extract/extract-access.js +25 -0
- package/dist/lib/extract/extract-assets.d.ts +257 -25
- package/dist/lib/extract/extract-extensions.d.ts +4 -0
- package/dist/lib/extract/extract-extensions.js +22 -0
- package/dist/lib/extract/extract-permissions.d.ts +3 -0
- package/dist/lib/extract/extract-permissions.js +11 -4
- package/dist/lib/extract/extract-policies.d.ts +4 -0
- package/dist/lib/extract/extract-policies.js +28 -0
- package/dist/lib/extract/extract-presets.js +1 -1
- package/dist/lib/extract/index.js +6 -0
- package/dist/lib/load/index.d.ts +13 -1
- package/dist/lib/load/index.js +38 -20
- package/dist/lib/load/load-access.d.ts +1 -0
- package/dist/lib/load/load-access.js +62 -0
- package/dist/lib/load/load-collections.js +4 -4
- package/dist/lib/load/load-dashboards.js +31 -8
- package/dist/lib/load/load-data.js +29 -39
- package/dist/lib/load/load-extensions.d.ts +1 -0
- package/dist/lib/load/load-extensions.js +70 -0
- package/dist/lib/load/load-files.d.ts +1 -2
- package/dist/lib/load/load-files.js +54 -23
- package/dist/lib/load/load-flows.js +19 -7
- package/dist/lib/load/load-folders.js +33 -9
- package/dist/lib/load/load-permissions.js +16 -9
- package/dist/lib/load/load-policies.d.ts +1 -0
- package/dist/lib/load/load-policies.js +37 -0
- package/dist/lib/load/load-presets.js +25 -8
- package/dist/lib/load/load-relations.js +16 -5
- package/dist/lib/load/load-roles.js +47 -14
- package/dist/lib/load/load-settings.js +7 -4
- package/dist/lib/load/load-translations.js +24 -5
- package/dist/lib/load/load-users.js +19 -3
- package/dist/lib/sdk.d.ts +1 -1
- package/dist/lib/sdk.js +10 -3
- package/dist/lib/types/extension.d.ts +42 -0
- package/dist/lib/types/extension.js +2 -0
- package/dist/lib/utils/auth.js +8 -2
- package/dist/lib/utils/catch-error.d.ts +6 -0
- package/dist/lib/utils/catch-error.js +35 -0
- package/dist/lib/utils/check-template.js +1 -16
- package/dist/lib/utils/chunk-array.d.ts +1 -0
- package/dist/lib/utils/chunk-array.js +7 -0
- package/dist/lib/utils/get-role-ids.d.ts +3 -53
- package/dist/lib/utils/get-role-ids.js +4 -2
- package/dist/lib/utils/get-template.d.ts +8 -0
- package/dist/lib/utils/get-template.js +58 -0
- package/dist/lib/utils/logger.d.ts +12 -0
- package/dist/lib/utils/logger.js +55 -0
- package/oclif.manifest.json +192 -5
- package/package.json +4 -5
- package/dist/lib/load/load-schema.d.ts +0 -14
- package/dist/lib/load/load-schema.js +0 -95
- package/dist/lib/utils/log-error.d.ts +0 -14
- package/dist/lib/utils/log-error.js +0 -25
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function getAssetList(): Promise<import("@directus/sdk
|
|
1
|
+
export declare function getAssetList(): Promise<import("@directus/sdk").Merge<import("@directus/sdk").MapFlatFields<{
|
|
2
2
|
id: string;
|
|
3
3
|
storage: string;
|
|
4
4
|
filename_disk: string;
|
|
@@ -8,7 +8,7 @@ export declare function getAssetList(): Promise<import("@directus/sdk/dist/types
|
|
|
8
8
|
folder: string | {
|
|
9
9
|
id: string;
|
|
10
10
|
name: string;
|
|
11
|
-
parent: any;
|
|
11
|
+
parent: string | any;
|
|
12
12
|
};
|
|
13
13
|
uploaded_by: string | {
|
|
14
14
|
id: string;
|
|
@@ -20,7 +20,7 @@ export declare function getAssetList(): Promise<import("@directus/sdk/dist/types
|
|
|
20
20
|
title: string;
|
|
21
21
|
description: string;
|
|
22
22
|
tags: string[];
|
|
23
|
-
avatar: any;
|
|
23
|
+
avatar: string | any;
|
|
24
24
|
language: string;
|
|
25
25
|
theme: string;
|
|
26
26
|
tfa_secret: string;
|
|
@@ -30,10 +30,31 @@ export declare function getAssetList(): Promise<import("@directus/sdk/dist/types
|
|
|
30
30
|
name: string;
|
|
31
31
|
icon: string;
|
|
32
32
|
description: string;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
parent: string | any;
|
|
34
|
+
children: string[] | any[];
|
|
35
|
+
policies: string[] | {
|
|
36
|
+
id: string;
|
|
37
|
+
name: string;
|
|
38
|
+
icon: string;
|
|
39
|
+
description: string;
|
|
40
|
+
ip_access: string;
|
|
41
|
+
enforce_tfa: boolean;
|
|
42
|
+
admin_access: boolean;
|
|
43
|
+
app_access: boolean;
|
|
44
|
+
permissions: number[] | {
|
|
45
|
+
id: number;
|
|
46
|
+
policy: string | any;
|
|
47
|
+
collection: string;
|
|
48
|
+
action: string;
|
|
49
|
+
permissions: Record<string, any>;
|
|
50
|
+
validation: Record<string, any>;
|
|
51
|
+
presets: Record<string, any>;
|
|
52
|
+
fields: string[];
|
|
53
|
+
}[];
|
|
54
|
+
users: string[] | any[];
|
|
55
|
+
roles: string[] | any[];
|
|
56
|
+
}[];
|
|
57
|
+
users: string[] | any[];
|
|
37
58
|
};
|
|
38
59
|
token: string;
|
|
39
60
|
last_access: "datetime";
|
|
@@ -42,6 +63,33 @@ export declare function getAssetList(): Promise<import("@directus/sdk/dist/types
|
|
|
42
63
|
external_identifier: string;
|
|
43
64
|
auth_data: Record<string, any>;
|
|
44
65
|
email_notifications: boolean;
|
|
66
|
+
appearance: string;
|
|
67
|
+
theme_dark: string;
|
|
68
|
+
theme_light: string;
|
|
69
|
+
theme_light_overrides: Record<string, unknown>;
|
|
70
|
+
theme_dark_overrides: Record<string, unknown>;
|
|
71
|
+
policies: string[] | {
|
|
72
|
+
id: string;
|
|
73
|
+
name: string;
|
|
74
|
+
icon: string;
|
|
75
|
+
description: string;
|
|
76
|
+
ip_access: string;
|
|
77
|
+
enforce_tfa: boolean;
|
|
78
|
+
admin_access: boolean;
|
|
79
|
+
app_access: boolean;
|
|
80
|
+
permissions: number[] | {
|
|
81
|
+
id: number;
|
|
82
|
+
policy: string | any;
|
|
83
|
+
collection: string;
|
|
84
|
+
action: string;
|
|
85
|
+
permissions: Record<string, any>;
|
|
86
|
+
validation: Record<string, any>;
|
|
87
|
+
presets: Record<string, any>;
|
|
88
|
+
fields: string[];
|
|
89
|
+
}[];
|
|
90
|
+
users: string[] | any[];
|
|
91
|
+
roles: string[] | any[];
|
|
92
|
+
}[];
|
|
45
93
|
};
|
|
46
94
|
uploaded_on: "datetime";
|
|
47
95
|
modified_by: string | {
|
|
@@ -54,7 +102,7 @@ export declare function getAssetList(): Promise<import("@directus/sdk/dist/types
|
|
|
54
102
|
title: string;
|
|
55
103
|
description: string;
|
|
56
104
|
tags: string[];
|
|
57
|
-
avatar: any;
|
|
105
|
+
avatar: string | any;
|
|
58
106
|
language: string;
|
|
59
107
|
theme: string;
|
|
60
108
|
tfa_secret: string;
|
|
@@ -64,10 +112,31 @@ export declare function getAssetList(): Promise<import("@directus/sdk/dist/types
|
|
|
64
112
|
name: string;
|
|
65
113
|
icon: string;
|
|
66
114
|
description: string;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
115
|
+
parent: string | any;
|
|
116
|
+
children: string[] | any[];
|
|
117
|
+
policies: string[] | {
|
|
118
|
+
id: string;
|
|
119
|
+
name: string;
|
|
120
|
+
icon: string;
|
|
121
|
+
description: string;
|
|
122
|
+
ip_access: string;
|
|
123
|
+
enforce_tfa: boolean;
|
|
124
|
+
admin_access: boolean;
|
|
125
|
+
app_access: boolean;
|
|
126
|
+
permissions: number[] | {
|
|
127
|
+
id: number;
|
|
128
|
+
policy: string | any;
|
|
129
|
+
collection: string;
|
|
130
|
+
action: string;
|
|
131
|
+
permissions: Record<string, any>;
|
|
132
|
+
validation: Record<string, any>;
|
|
133
|
+
presets: Record<string, any>;
|
|
134
|
+
fields: string[];
|
|
135
|
+
}[];
|
|
136
|
+
users: string[] | any[];
|
|
137
|
+
roles: string[] | any[];
|
|
138
|
+
}[];
|
|
139
|
+
users: string[] | any[];
|
|
71
140
|
};
|
|
72
141
|
token: string;
|
|
73
142
|
last_access: "datetime";
|
|
@@ -76,6 +145,33 @@ export declare function getAssetList(): Promise<import("@directus/sdk/dist/types
|
|
|
76
145
|
external_identifier: string;
|
|
77
146
|
auth_data: Record<string, any>;
|
|
78
147
|
email_notifications: boolean;
|
|
148
|
+
appearance: string;
|
|
149
|
+
theme_dark: string;
|
|
150
|
+
theme_light: string;
|
|
151
|
+
theme_light_overrides: Record<string, unknown>;
|
|
152
|
+
theme_dark_overrides: Record<string, unknown>;
|
|
153
|
+
policies: string[] | {
|
|
154
|
+
id: string;
|
|
155
|
+
name: string;
|
|
156
|
+
icon: string;
|
|
157
|
+
description: string;
|
|
158
|
+
ip_access: string;
|
|
159
|
+
enforce_tfa: boolean;
|
|
160
|
+
admin_access: boolean;
|
|
161
|
+
app_access: boolean;
|
|
162
|
+
permissions: number[] | {
|
|
163
|
+
id: number;
|
|
164
|
+
policy: string | any;
|
|
165
|
+
collection: string;
|
|
166
|
+
action: string;
|
|
167
|
+
permissions: Record<string, any>;
|
|
168
|
+
validation: Record<string, any>;
|
|
169
|
+
presets: Record<string, any>;
|
|
170
|
+
fields: string[];
|
|
171
|
+
}[];
|
|
172
|
+
users: string[] | any[];
|
|
173
|
+
roles: string[] | any[];
|
|
174
|
+
}[];
|
|
79
175
|
};
|
|
80
176
|
modified_on: "datetime";
|
|
81
177
|
charset: string;
|
|
@@ -88,7 +184,27 @@ export declare function getAssetList(): Promise<import("@directus/sdk/dist/types
|
|
|
88
184
|
location: string;
|
|
89
185
|
tags: string[];
|
|
90
186
|
metadata: Record<string, any>;
|
|
91
|
-
|
|
187
|
+
focal_point_x: number;
|
|
188
|
+
focal_point_y: number;
|
|
189
|
+
}, "embed" | "type" | "location" | "description" | "id" | "duration" | "title" | "tags" | "storage" | "filename_disk" | "filename_download" | "folder" | "uploaded_by" | "uploaded_on" | "modified_by" | "modified_on" | "charset" | "filesize" | "width" | "height" | "metadata" | "focal_point_x" | "focal_point_y", {
|
|
190
|
+
"year(uploaded_on)": "uploaded_on_year";
|
|
191
|
+
"year(modified_on)": "modified_on_year";
|
|
192
|
+
"month(uploaded_on)": "uploaded_on_month";
|
|
193
|
+
"month(modified_on)": "modified_on_month";
|
|
194
|
+
"week(uploaded_on)": "uploaded_on_week";
|
|
195
|
+
"week(modified_on)": "modified_on_week";
|
|
196
|
+
"day(uploaded_on)": "uploaded_on_day";
|
|
197
|
+
"day(modified_on)": "modified_on_day";
|
|
198
|
+
"weekday(uploaded_on)": "uploaded_on_weekday";
|
|
199
|
+
"weekday(modified_on)": "modified_on_weekday";
|
|
200
|
+
"hour(uploaded_on)": "uploaded_on_hour";
|
|
201
|
+
"hour(modified_on)": "modified_on_hour";
|
|
202
|
+
"minute(uploaded_on)": "uploaded_on_minute";
|
|
203
|
+
"minute(modified_on)": "modified_on_minute";
|
|
204
|
+
"second(uploaded_on)": "uploaded_on_second";
|
|
205
|
+
"second(modified_on)": "modified_on_second";
|
|
206
|
+
"count(tags)": "tags_count";
|
|
207
|
+
}>, {}, import("@directus/sdk").MapFlatFields<{
|
|
92
208
|
id: string;
|
|
93
209
|
storage: string;
|
|
94
210
|
filename_disk: string;
|
|
@@ -98,7 +214,7 @@ export declare function getAssetList(): Promise<import("@directus/sdk/dist/types
|
|
|
98
214
|
folder: string | {
|
|
99
215
|
id: string;
|
|
100
216
|
name: string;
|
|
101
|
-
parent: any;
|
|
217
|
+
parent: string | any;
|
|
102
218
|
};
|
|
103
219
|
uploaded_by: string | {
|
|
104
220
|
id: string;
|
|
@@ -110,7 +226,7 @@ export declare function getAssetList(): Promise<import("@directus/sdk/dist/types
|
|
|
110
226
|
title: string;
|
|
111
227
|
description: string;
|
|
112
228
|
tags: string[];
|
|
113
|
-
avatar: any;
|
|
229
|
+
avatar: string | any;
|
|
114
230
|
language: string;
|
|
115
231
|
theme: string;
|
|
116
232
|
tfa_secret: string;
|
|
@@ -120,10 +236,31 @@ export declare function getAssetList(): Promise<import("@directus/sdk/dist/types
|
|
|
120
236
|
name: string;
|
|
121
237
|
icon: string;
|
|
122
238
|
description: string;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
239
|
+
parent: string | any;
|
|
240
|
+
children: string[] | any[];
|
|
241
|
+
policies: string[] | {
|
|
242
|
+
id: string;
|
|
243
|
+
name: string;
|
|
244
|
+
icon: string;
|
|
245
|
+
description: string;
|
|
246
|
+
ip_access: string;
|
|
247
|
+
enforce_tfa: boolean;
|
|
248
|
+
admin_access: boolean;
|
|
249
|
+
app_access: boolean;
|
|
250
|
+
permissions: number[] | {
|
|
251
|
+
id: number;
|
|
252
|
+
policy: string | any;
|
|
253
|
+
collection: string;
|
|
254
|
+
action: string;
|
|
255
|
+
permissions: Record<string, any>;
|
|
256
|
+
validation: Record<string, any>;
|
|
257
|
+
presets: Record<string, any>;
|
|
258
|
+
fields: string[];
|
|
259
|
+
}[];
|
|
260
|
+
users: string[] | any[];
|
|
261
|
+
roles: string[] | any[];
|
|
262
|
+
}[];
|
|
263
|
+
users: string[] | any[];
|
|
127
264
|
};
|
|
128
265
|
token: string;
|
|
129
266
|
last_access: "datetime";
|
|
@@ -132,6 +269,33 @@ export declare function getAssetList(): Promise<import("@directus/sdk/dist/types
|
|
|
132
269
|
external_identifier: string;
|
|
133
270
|
auth_data: Record<string, any>;
|
|
134
271
|
email_notifications: boolean;
|
|
272
|
+
appearance: string;
|
|
273
|
+
theme_dark: string;
|
|
274
|
+
theme_light: string;
|
|
275
|
+
theme_light_overrides: Record<string, unknown>;
|
|
276
|
+
theme_dark_overrides: Record<string, unknown>;
|
|
277
|
+
policies: string[] | {
|
|
278
|
+
id: string;
|
|
279
|
+
name: string;
|
|
280
|
+
icon: string;
|
|
281
|
+
description: string;
|
|
282
|
+
ip_access: string;
|
|
283
|
+
enforce_tfa: boolean;
|
|
284
|
+
admin_access: boolean;
|
|
285
|
+
app_access: boolean;
|
|
286
|
+
permissions: number[] | {
|
|
287
|
+
id: number;
|
|
288
|
+
policy: string | any;
|
|
289
|
+
collection: string;
|
|
290
|
+
action: string;
|
|
291
|
+
permissions: Record<string, any>;
|
|
292
|
+
validation: Record<string, any>;
|
|
293
|
+
presets: Record<string, any>;
|
|
294
|
+
fields: string[];
|
|
295
|
+
}[];
|
|
296
|
+
users: string[] | any[];
|
|
297
|
+
roles: string[] | any[];
|
|
298
|
+
}[];
|
|
135
299
|
};
|
|
136
300
|
uploaded_on: "datetime";
|
|
137
301
|
modified_by: string | {
|
|
@@ -144,7 +308,7 @@ export declare function getAssetList(): Promise<import("@directus/sdk/dist/types
|
|
|
144
308
|
title: string;
|
|
145
309
|
description: string;
|
|
146
310
|
tags: string[];
|
|
147
|
-
avatar: any;
|
|
311
|
+
avatar: string | any;
|
|
148
312
|
language: string;
|
|
149
313
|
theme: string;
|
|
150
314
|
tfa_secret: string;
|
|
@@ -154,10 +318,31 @@ export declare function getAssetList(): Promise<import("@directus/sdk/dist/types
|
|
|
154
318
|
name: string;
|
|
155
319
|
icon: string;
|
|
156
320
|
description: string;
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
321
|
+
parent: string | any;
|
|
322
|
+
children: string[] | any[];
|
|
323
|
+
policies: string[] | {
|
|
324
|
+
id: string;
|
|
325
|
+
name: string;
|
|
326
|
+
icon: string;
|
|
327
|
+
description: string;
|
|
328
|
+
ip_access: string;
|
|
329
|
+
enforce_tfa: boolean;
|
|
330
|
+
admin_access: boolean;
|
|
331
|
+
app_access: boolean;
|
|
332
|
+
permissions: number[] | {
|
|
333
|
+
id: number;
|
|
334
|
+
policy: string | any;
|
|
335
|
+
collection: string;
|
|
336
|
+
action: string;
|
|
337
|
+
permissions: Record<string, any>;
|
|
338
|
+
validation: Record<string, any>;
|
|
339
|
+
presets: Record<string, any>;
|
|
340
|
+
fields: string[];
|
|
341
|
+
}[];
|
|
342
|
+
users: string[] | any[];
|
|
343
|
+
roles: string[] | any[];
|
|
344
|
+
}[];
|
|
345
|
+
users: string[] | any[];
|
|
161
346
|
};
|
|
162
347
|
token: string;
|
|
163
348
|
last_access: "datetime";
|
|
@@ -166,6 +351,33 @@ export declare function getAssetList(): Promise<import("@directus/sdk/dist/types
|
|
|
166
351
|
external_identifier: string;
|
|
167
352
|
auth_data: Record<string, any>;
|
|
168
353
|
email_notifications: boolean;
|
|
354
|
+
appearance: string;
|
|
355
|
+
theme_dark: string;
|
|
356
|
+
theme_light: string;
|
|
357
|
+
theme_light_overrides: Record<string, unknown>;
|
|
358
|
+
theme_dark_overrides: Record<string, unknown>;
|
|
359
|
+
policies: string[] | {
|
|
360
|
+
id: string;
|
|
361
|
+
name: string;
|
|
362
|
+
icon: string;
|
|
363
|
+
description: string;
|
|
364
|
+
ip_access: string;
|
|
365
|
+
enforce_tfa: boolean;
|
|
366
|
+
admin_access: boolean;
|
|
367
|
+
app_access: boolean;
|
|
368
|
+
permissions: number[] | {
|
|
369
|
+
id: number;
|
|
370
|
+
policy: string | any;
|
|
371
|
+
collection: string;
|
|
372
|
+
action: string;
|
|
373
|
+
permissions: Record<string, any>;
|
|
374
|
+
validation: Record<string, any>;
|
|
375
|
+
presets: Record<string, any>;
|
|
376
|
+
fields: string[];
|
|
377
|
+
}[];
|
|
378
|
+
users: string[] | any[];
|
|
379
|
+
roles: string[] | any[];
|
|
380
|
+
}[];
|
|
169
381
|
};
|
|
170
382
|
modified_on: "datetime";
|
|
171
383
|
charset: string;
|
|
@@ -178,6 +390,26 @@ export declare function getAssetList(): Promise<import("@directus/sdk/dist/types
|
|
|
178
390
|
location: string;
|
|
179
391
|
tags: string[];
|
|
180
392
|
metadata: Record<string, any>;
|
|
181
|
-
|
|
393
|
+
focal_point_x: number;
|
|
394
|
+
focal_point_y: number;
|
|
395
|
+
}, "embed" | "type" | "location" | "description" | "id" | "duration" | "title" | "tags" | "storage" | "filename_disk" | "filename_download" | "folder" | "uploaded_by" | "uploaded_on" | "modified_by" | "modified_on" | "charset" | "filesize" | "width" | "height" | "metadata" | "focal_point_x" | "focal_point_y", {
|
|
396
|
+
"year(uploaded_on)": "uploaded_on_year";
|
|
397
|
+
"year(modified_on)": "modified_on_year";
|
|
398
|
+
"month(uploaded_on)": "uploaded_on_month";
|
|
399
|
+
"month(modified_on)": "modified_on_month";
|
|
400
|
+
"week(uploaded_on)": "uploaded_on_week";
|
|
401
|
+
"week(modified_on)": "modified_on_week";
|
|
402
|
+
"day(uploaded_on)": "uploaded_on_day";
|
|
403
|
+
"day(modified_on)": "modified_on_day";
|
|
404
|
+
"weekday(uploaded_on)": "uploaded_on_weekday";
|
|
405
|
+
"weekday(modified_on)": "modified_on_weekday";
|
|
406
|
+
"hour(uploaded_on)": "uploaded_on_hour";
|
|
407
|
+
"hour(modified_on)": "modified_on_hour";
|
|
408
|
+
"minute(uploaded_on)": "uploaded_on_minute";
|
|
409
|
+
"minute(modified_on)": "modified_on_minute";
|
|
410
|
+
"second(uploaded_on)": "uploaded_on_second";
|
|
411
|
+
"second(modified_on)": "modified_on_second";
|
|
412
|
+
"count(tags)": "tags_count";
|
|
413
|
+
}>, {}>[]>;
|
|
182
414
|
export declare function downloadFile(file: any, dir: string): Promise<void>;
|
|
183
415
|
export declare function downloadAllFiles(dir: string): Promise<void>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const sdk_1 = require("@directus/sdk");
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
6
|
+
const sdk_2 = require("../sdk");
|
|
7
|
+
const write_to_file_1 = tslib_1.__importDefault(require("../utils/write-to-file"));
|
|
8
|
+
/**
|
|
9
|
+
* Extract extensions from the API
|
|
10
|
+
*/
|
|
11
|
+
async function extractExtensions(dir) {
|
|
12
|
+
try {
|
|
13
|
+
const response = await sdk_2.api.client.request((0, sdk_1.readExtensions)());
|
|
14
|
+
await (0, write_to_file_1.default)('extensions', response, dir);
|
|
15
|
+
core_1.ux.log('Extracted extensions');
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
core_1.ux.warn('Error extracting extensions:');
|
|
19
|
+
core_1.ux.warn(error.message);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.default = extractExtensions;
|
|
@@ -5,15 +5,22 @@ const sdk_1 = require("@directus/sdk");
|
|
|
5
5
|
const core_1 = require("@oclif/core");
|
|
6
6
|
const sdk_2 = require("../sdk");
|
|
7
7
|
const write_to_file_1 = tslib_1.__importDefault(require("../utils/write-to-file"));
|
|
8
|
+
/**
|
|
9
|
+
* Extract Permissions from the API
|
|
10
|
+
*/
|
|
8
11
|
async function extractPermissions(dir) {
|
|
9
12
|
try {
|
|
10
|
-
|
|
13
|
+
let response = await sdk_2.api.client.request((0, sdk_1.readPermissions)({
|
|
11
14
|
limit: -1,
|
|
12
15
|
}));
|
|
13
16
|
// Delete the id field from the permissions so we don't have to reset the autoincrement on the db
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
// Permissions API returns some items without a linked Policy, and are not stored in the DB
|
|
18
|
+
response = response
|
|
19
|
+
.filter(i => i.policy !== null)
|
|
20
|
+
.map(i => {
|
|
21
|
+
delete i.id;
|
|
22
|
+
return i;
|
|
23
|
+
});
|
|
17
24
|
await (0, write_to_file_1.default)('permissions', response, dir);
|
|
18
25
|
core_1.ux.log('Extracted permissions');
|
|
19
26
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const sdk_1 = require("@directus/sdk");
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
6
|
+
const sdk_2 = require("../sdk");
|
|
7
|
+
const write_to_file_1 = tslib_1.__importDefault(require("../utils/write-to-file"));
|
|
8
|
+
/**
|
|
9
|
+
* Extract policies from the API
|
|
10
|
+
*/
|
|
11
|
+
async function extractPolicies(dir) {
|
|
12
|
+
try {
|
|
13
|
+
const response = await sdk_2.api.client.request((0, sdk_1.readPolicies)({ limit: -1 }));
|
|
14
|
+
// Delete the id field from the permissions so we don't have to reset the autoincrement on the db
|
|
15
|
+
for (const policies of response) {
|
|
16
|
+
delete policies.users; // Alias Field
|
|
17
|
+
delete policies.roles; // Alias Field
|
|
18
|
+
delete policies.permissions; // Alias Field
|
|
19
|
+
}
|
|
20
|
+
await (0, write_to_file_1.default)('policies', response, dir);
|
|
21
|
+
core_1.ux.log('Extracted policies');
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
core_1.ux.warn('Error extracting policies:');
|
|
25
|
+
core_1.ux.warn(error.message);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.default = extractPolicies;
|
|
@@ -18,7 +18,7 @@ async function extractPresets(dir) {
|
|
|
18
18
|
limit: -1,
|
|
19
19
|
}));
|
|
20
20
|
// Remove the id field from the presets so we don't have to reset the autoincrement on the db
|
|
21
|
-
const presets = response.map(
|
|
21
|
+
const presets = response.map(preset => {
|
|
22
22
|
delete preset.id;
|
|
23
23
|
return preset;
|
|
24
24
|
});
|
|
@@ -3,15 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
5
|
const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
|
|
6
|
+
const extract_access_1 = tslib_1.__importDefault(require("./extract-access"));
|
|
6
7
|
const extract_assets_1 = require("./extract-assets");
|
|
7
8
|
const extract_collections_1 = tslib_1.__importDefault(require("./extract-collections"));
|
|
8
9
|
const extract_content_1 = require("./extract-content");
|
|
9
10
|
const extract_dashboards_1 = require("./extract-dashboards");
|
|
11
|
+
const extract_extensions_1 = tslib_1.__importDefault(require("./extract-extensions"));
|
|
10
12
|
const extract_fields_1 = tslib_1.__importDefault(require("./extract-fields"));
|
|
11
13
|
const extract_files_1 = tslib_1.__importDefault(require("./extract-files"));
|
|
12
14
|
const extract_flows_1 = require("./extract-flows");
|
|
13
15
|
const extract_folders_1 = tslib_1.__importDefault(require("./extract-folders"));
|
|
14
16
|
const extract_permissions_1 = tslib_1.__importDefault(require("./extract-permissions"));
|
|
17
|
+
const extract_policies_1 = tslib_1.__importDefault(require("./extract-policies"));
|
|
15
18
|
const extract_presets_1 = tslib_1.__importDefault(require("./extract-presets"));
|
|
16
19
|
const extract_relations_1 = tslib_1.__importDefault(require("./extract-relations"));
|
|
17
20
|
const extract_roles_1 = tslib_1.__importDefault(require("./extract-roles"));
|
|
@@ -36,6 +39,8 @@ async function extract(dir) {
|
|
|
36
39
|
await (0, extract_users_1.default)(destination);
|
|
37
40
|
await (0, extract_roles_1.default)(destination);
|
|
38
41
|
await (0, extract_permissions_1.default)(destination);
|
|
42
|
+
await (0, extract_policies_1.default)(destination);
|
|
43
|
+
await (0, extract_access_1.default)(destination);
|
|
39
44
|
await (0, extract_presets_1.default)(destination);
|
|
40
45
|
await (0, extract_translations_1.default)(destination);
|
|
41
46
|
await (0, extract_flows_1.extractFlows)(destination);
|
|
@@ -43,6 +48,7 @@ async function extract(dir) {
|
|
|
43
48
|
await (0, extract_dashboards_1.extractDashboards)(destination);
|
|
44
49
|
await (0, extract_dashboards_1.extractPanels)(destination);
|
|
45
50
|
await (0, extract_settings_1.default)(destination);
|
|
51
|
+
await (0, extract_extensions_1.default)(destination);
|
|
46
52
|
await (0, extract_content_1.extractContent)(destination);
|
|
47
53
|
await (0, extract_assets_1.downloadAllFiles)(destination);
|
|
48
54
|
return {};
|
package/dist/lib/load/index.d.ts
CHANGED
|
@@ -1 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
interface ApplyFlags {
|
|
2
|
+
content: boolean;
|
|
3
|
+
dashboards: boolean;
|
|
4
|
+
extensions: boolean;
|
|
5
|
+
files: boolean;
|
|
6
|
+
flows: boolean;
|
|
7
|
+
permissions: boolean;
|
|
8
|
+
schema: boolean;
|
|
9
|
+
settings: boolean;
|
|
10
|
+
users: boolean;
|
|
11
|
+
}
|
|
12
|
+
export default function apply(dir: string, flags: ApplyFlags): Promise<{}>;
|
|
13
|
+
export {};
|
package/dist/lib/load/index.js
CHANGED
|
@@ -3,44 +3,62 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
5
|
const check_template_1 = tslib_1.__importDefault(require("../utils/check-template"));
|
|
6
|
+
const load_access_1 = tslib_1.__importDefault(require("./load-access"));
|
|
6
7
|
const load_collections_1 = tslib_1.__importDefault(require("./load-collections"));
|
|
7
8
|
const load_dashboards_1 = tslib_1.__importDefault(require("./load-dashboards"));
|
|
8
9
|
const load_data_1 = tslib_1.__importDefault(require("./load-data"));
|
|
10
|
+
const load_extensions_1 = tslib_1.__importDefault(require("./load-extensions"));
|
|
9
11
|
const load_files_1 = tslib_1.__importDefault(require("./load-files"));
|
|
10
12
|
const load_flows_1 = tslib_1.__importDefault(require("./load-flows"));
|
|
11
13
|
const load_folders_1 = tslib_1.__importDefault(require("./load-folders"));
|
|
12
14
|
const load_permissions_1 = tslib_1.__importDefault(require("./load-permissions"));
|
|
15
|
+
const load_policies_1 = tslib_1.__importDefault(require("./load-policies"));
|
|
13
16
|
const load_presets_1 = tslib_1.__importDefault(require("./load-presets"));
|
|
14
17
|
const load_relations_1 = tslib_1.__importDefault(require("./load-relations"));
|
|
15
18
|
const load_roles_1 = tslib_1.__importDefault(require("./load-roles"));
|
|
16
|
-
// import loadSchema from './load-schema'
|
|
17
19
|
const load_settings_1 = tslib_1.__importDefault(require("./load-settings"));
|
|
18
20
|
const load_translations_1 = tslib_1.__importDefault(require("./load-translations"));
|
|
19
21
|
const load_users_1 = tslib_1.__importDefault(require("./load-users"));
|
|
20
|
-
async function apply(dir) {
|
|
21
|
-
// Get the source directory for the actual files
|
|
22
|
+
async function apply(dir, flags) {
|
|
22
23
|
const source = dir + '/src';
|
|
23
24
|
const isTemplateOk = await (0, check_template_1.default)(source);
|
|
24
25
|
if (!isTemplateOk) {
|
|
25
26
|
core_1.ux.error('The template is missing the collections, fields, or relations files. Older templates are not supported in v0.4 of directus-template-cli. Try using v0.3 to load older templates npx directus-template-cli@0.3 apply or extract the template using latest version before applying. Exiting...');
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
28
|
+
if (flags.schema) {
|
|
29
|
+
await (0, load_collections_1.default)(source);
|
|
30
|
+
await (0, load_relations_1.default)(source);
|
|
31
|
+
}
|
|
32
|
+
if (flags.permissions) {
|
|
33
|
+
await (0, load_roles_1.default)(source);
|
|
34
|
+
await (0, load_policies_1.default)(source);
|
|
35
|
+
await (0, load_access_1.default)(source);
|
|
36
|
+
await (0, load_permissions_1.default)(source);
|
|
37
|
+
}
|
|
38
|
+
if (flags.users) {
|
|
39
|
+
await (0, load_users_1.default)(source);
|
|
40
|
+
}
|
|
41
|
+
if (flags.files) {
|
|
42
|
+
await (0, load_folders_1.default)(source);
|
|
43
|
+
await (0, load_files_1.default)(source);
|
|
44
|
+
}
|
|
45
|
+
if (flags.content) {
|
|
46
|
+
await (0, load_data_1.default)(source);
|
|
47
|
+
}
|
|
48
|
+
if (flags.dashboards) {
|
|
49
|
+
await (0, load_dashboards_1.default)(source);
|
|
50
|
+
}
|
|
51
|
+
if (flags.flows) {
|
|
52
|
+
await (0, load_flows_1.default)(source);
|
|
53
|
+
}
|
|
54
|
+
if (flags.settings) {
|
|
55
|
+
await (0, load_settings_1.default)(source);
|
|
56
|
+
await (0, load_translations_1.default)(source);
|
|
57
|
+
await (0, load_presets_1.default)(source);
|
|
58
|
+
}
|
|
59
|
+
if (flags.extensions) {
|
|
60
|
+
await (0, load_extensions_1.default)(source);
|
|
61
|
+
}
|
|
44
62
|
return {};
|
|
45
63
|
}
|
|
46
64
|
exports.default = apply;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function loadAccess(dir: string): Promise<void>;
|