@easysociable/cli 0.1.30 → 0.1.31
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/easysociable.js
CHANGED
|
@@ -35858,15 +35858,14 @@ Waiting for approval\u2026
|
|
|
35858
35858
|
return page.templates;
|
|
35859
35859
|
}));
|
|
35860
35860
|
jsonOption(templates.command("get").requiredOption("--id <id>")).action(withClient(async (client, opts) => client.getTemplate(String(opts.id))));
|
|
35861
|
-
jsonOption(templates.command("source").option("--id <pageId>").option("--family <familyId>")
|
|
35861
|
+
jsonOption(templates.command("source").option("--id <pageId>").option("--family <familyId>")).action(withClient(async (client, opts) => {
|
|
35862
35862
|
let id = opts.id ? String(opts.id) : "";
|
|
35863
35863
|
if (!id && opts.family) {
|
|
35864
35864
|
const { variants } = await client.getTemplateFamily(String(opts.family));
|
|
35865
|
-
|
|
35866
|
-
|
|
35867
|
-
id = variant.pageId;
|
|
35865
|
+
if (!variants[0]) throw new Error(`Family ${opts.family} has no published page`);
|
|
35866
|
+
id = variants[0].pageId;
|
|
35868
35867
|
}
|
|
35869
|
-
if (!id) throw new Error("Pass --id <pageId> or --family <familyId>
|
|
35868
|
+
if (!id) throw new Error("Pass --id <pageId> or --family <familyId>");
|
|
35870
35869
|
const draft = await client.getDraft(id);
|
|
35871
35870
|
return { id: draft.id, name: draft.name, familyId: draft.familyId, canvas: draft.authoringSource?.canvas, studioJson: draft.authoringSource?.json };
|
|
35872
35871
|
}));
|