@contenthero/cli 0.3.13 → 0.3.15
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/README.md +4 -2
- package/dist/commands/account.d.ts +8 -3
- package/dist/commands/account.d.ts.map +1 -1
- package/dist/commands/account.js +42 -11
- package/dist/commands/account.js.map +1 -1
- package/dist/commands/audio.d.ts.map +1 -1
- package/dist/commands/audio.js +1 -2
- package/dist/commands/audio.js.map +1 -1
- package/dist/commands/auth.js +6 -6
- package/dist/commands/brandkit.d.ts.map +1 -1
- package/dist/commands/brandkit.js +10 -3
- package/dist/commands/brandkit.js.map +1 -1
- package/dist/commands/content.d.ts.map +1 -1
- package/dist/commands/content.js +109 -21
- package/dist/commands/content.js.map +1 -1
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +1 -2
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/generation.d.ts.map +1 -1
- package/dist/commands/generation.js +1 -2
- package/dist/commands/generation.js.map +1 -1
- package/dist/commands/identity.d.ts.map +1 -1
- package/dist/commands/identity.js +2 -1
- package/dist/commands/identity.js.map +1 -1
- package/dist/commands/media.d.ts +2 -1
- package/dist/commands/media.d.ts.map +1 -1
- package/dist/commands/media.js +31 -9
- package/dist/commands/media.js.map +1 -1
- package/dist/commands/project.d.ts.map +1 -1
- package/dist/commands/project.js +2 -36
- package/dist/commands/project.js.map +1 -1
- package/dist/commands/schema.d.ts +12 -5
- package/dist/commands/schema.d.ts.map +1 -1
- package/dist/commands/schema.js +119 -27
- package/dist/commands/schema.js.map +1 -1
- package/dist/commands/transcribe.d.ts.map +1 -1
- package/dist/commands/transcribe.js +2 -1
- package/dist/commands/transcribe.js.map +1 -1
- package/dist/commands/upscale.d.ts.map +1 -1
- package/dist/commands/upscale.js +1 -2
- package/dist/commands/upscale.js.map +1 -1
- package/dist/errors.d.ts +5 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +12 -1
- package/dist/errors.js.map +1 -1
- package/dist/generation.d.ts +2 -0
- package/dist/generation.d.ts.map +1 -1
- package/dist/generation.js +10 -3
- package/dist/generation.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/output.d.ts +3 -0
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +6 -0
- package/dist/output.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +0 -2
- package/dist/program.js.map +1 -1
- package/package.json +2 -2
- package/dist/commands/platform.d.ts +0 -11
- package/dist/commands/platform.d.ts.map +0 -1
- package/dist/commands/platform.js +0 -61
- package/dist/commands/platform.js.map +0 -1
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `contenthero platform` - the catalog of what a post can target.
|
|
3
|
-
* platform list platforms you can publish to + formats
|
|
4
|
-
* platform get <platform> [--format f] one platform's full post shape
|
|
5
|
-
*
|
|
6
|
-
* The source of truth for which platforms/formats exist and the exact fields a
|
|
7
|
-
* post requires per format; use it instead of hardcoding when scripting a post.
|
|
8
|
-
*/
|
|
9
|
-
import { makeClient } from '../context.js';
|
|
10
|
-
import { emit, keyValues, table } from '../output.js';
|
|
11
|
-
export function registerPlatform(program) {
|
|
12
|
-
const platform = program
|
|
13
|
-
.command('platform')
|
|
14
|
-
.description('Discover the platforms you can publish to and what a post requires');
|
|
15
|
-
platform
|
|
16
|
-
.command('list')
|
|
17
|
-
.description('List the platforms you can publish to (formats + connected flag)')
|
|
18
|
-
.action(async (_opts, command) => {
|
|
19
|
-
const { client, ctx } = makeClient(command);
|
|
20
|
-
const platforms = await client.listPlatforms();
|
|
21
|
-
emit(platforms, ctx, (rows) => table(['PLATFORM', 'NAME', 'FORMATS', 'CONNECTED'], rows.map((p) => [
|
|
22
|
-
p.platform,
|
|
23
|
-
p.name,
|
|
24
|
-
p.formats.map((f) => f.value).join(', '),
|
|
25
|
-
p.connected ? 'yes' : 'no',
|
|
26
|
-
])));
|
|
27
|
-
});
|
|
28
|
-
platform
|
|
29
|
-
.command('get')
|
|
30
|
-
.description("Get one platform's full publishing shape (the fields a post requires)")
|
|
31
|
-
.argument('<platform>', 'platform id (from `platform list`)')
|
|
32
|
-
.option('--format <format>', 'narrow to one format (e.g. reel, short, story, thread)')
|
|
33
|
-
.action(async (platformId, opts, command) => {
|
|
34
|
-
const { client, ctx } = makeClient(command);
|
|
35
|
-
const p = await client.getPlatform(platformId, { format: opts.format });
|
|
36
|
-
emit(p, ctx, (schema) => {
|
|
37
|
-
const fieldRows = schema.formats.map((fmt) => [fmt, Object.keys(schema.fieldTemplatesByFormat[fmt] ?? {}).join(', ') || '(none)']);
|
|
38
|
-
const enumRows = Object.entries(schema.enums).map(([k, vals]) => [
|
|
39
|
-
k,
|
|
40
|
-
vals
|
|
41
|
-
.map((v) => v && typeof v === 'object' && 'id' in v
|
|
42
|
-
? String(v.id)
|
|
43
|
-
: String(v))
|
|
44
|
-
.join(', '),
|
|
45
|
-
]);
|
|
46
|
-
const limitRows = schema.characterLimits
|
|
47
|
-
? Object.entries(schema.characterLimits).map(([k, n]) => [k, String(n)])
|
|
48
|
-
: [];
|
|
49
|
-
return keyValues([
|
|
50
|
-
['Platform', schema.platform],
|
|
51
|
-
['Name', schema.name],
|
|
52
|
-
['Formats', schema.formats.join(', ')],
|
|
53
|
-
['Posting modes', schema.postingModes.join(', ')],
|
|
54
|
-
...fieldRows.map(([fmt, fields]) => [`Fields (${fmt})`, fields]),
|
|
55
|
-
...enumRows.map(([k, vals]) => [`Options (${k})`, vals]),
|
|
56
|
-
...limitRows.map(([k, n]) => [`Limit (${k})`, n]),
|
|
57
|
-
]);
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=platform.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../../src/commands/platform.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,UAAU,E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