faces-cli 1.7.5 → 1.7.6
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/face/get.js +2 -0
- package/dist/commands/face/list.js +2 -0
- package/dist/commands/face/lock.d.ts +14 -0
- package/dist/commands/face/lock.js +34 -0
- package/dist/commands/face/unlock.d.ts +14 -0
- package/dist/commands/face/unlock.js +34 -0
- package/oclif.manifest.json +832 -708
- package/package.json +1 -1
|
@@ -39,6 +39,8 @@ export default class FaceGet extends BaseCommand {
|
|
|
39
39
|
this.log(`name: ${f.name}`);
|
|
40
40
|
this.log(`owned_by: ${f.owned_by}`);
|
|
41
41
|
this.log(`created: ${new Date(f.created * 1000).toISOString().slice(0, 10)}`);
|
|
42
|
+
if (f.read_only)
|
|
43
|
+
this.log('read only');
|
|
42
44
|
if (f.formula) {
|
|
43
45
|
this.log(`formula: ${f.formula}`);
|
|
44
46
|
this.log(`type: composite`);
|
|
@@ -102,6 +102,8 @@ export default class FaceList extends BaseCommand {
|
|
|
102
102
|
}
|
|
103
103
|
if (f.published)
|
|
104
104
|
suffix += ' [public · requires @model]';
|
|
105
|
+
if (f.read_only)
|
|
106
|
+
suffix += ' [read only]';
|
|
105
107
|
this.log(`${handle(f).padEnd(handleWidth)} ${f.name.padEnd(nameWidth)}${suffix}`);
|
|
106
108
|
}
|
|
107
109
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base.js';
|
|
2
|
+
export default class FaceLock extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
};
|
|
10
|
+
static args: {
|
|
11
|
+
face_id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<unknown>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base.js';
|
|
3
|
+
import { FacesAPIError } from '../../client.js';
|
|
4
|
+
export default class FaceLock extends BaseCommand {
|
|
5
|
+
static description = 'Lock a face (read-only). A locked face still reads and chats normally, but it — and everything it owns (documents, threads, voiceprint) — cannot be changed until unlocked.';
|
|
6
|
+
static examples = ['<%= config.bin %> <%= command.id %> socrates'];
|
|
7
|
+
static flags = {
|
|
8
|
+
...BaseCommand.baseFlags,
|
|
9
|
+
};
|
|
10
|
+
static args = {
|
|
11
|
+
face_id: Args.string({ description: 'Face alias', required: true }),
|
|
12
|
+
};
|
|
13
|
+
async run() {
|
|
14
|
+
const { args, flags } = await this.parse(FaceLock);
|
|
15
|
+
const client = this.makeClient(flags);
|
|
16
|
+
let data;
|
|
17
|
+
try {
|
|
18
|
+
data = await client.patch(`/v1/faces/${args.face_id}/lock`, { body: { read_only: true } });
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
if (err instanceof FacesAPIError)
|
|
22
|
+
this.error(`Error (${err.statusCode}): ${err.message}`);
|
|
23
|
+
throw err;
|
|
24
|
+
}
|
|
25
|
+
if (!this.jsonEnabled()) {
|
|
26
|
+
const res = data;
|
|
27
|
+
this.log(`Locked '${res.alias ?? args.face_id}' — read only.`);
|
|
28
|
+
const affected = res.affected ?? [];
|
|
29
|
+
if (affected.length > 0)
|
|
30
|
+
this.log(`Affected: ${affected.join(', ')}`);
|
|
31
|
+
}
|
|
32
|
+
return data;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base.js';
|
|
2
|
+
export default class FaceUnlock extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
};
|
|
10
|
+
static args: {
|
|
11
|
+
face_id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<unknown>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base.js';
|
|
3
|
+
import { FacesAPIError } from '../../client.js';
|
|
4
|
+
export default class FaceUnlock extends BaseCommand {
|
|
5
|
+
static description = 'Unlock a face (make it writable again). Thaws the face and everything it owns (documents, threads, voiceprint).';
|
|
6
|
+
static examples = ['<%= config.bin %> <%= command.id %> socrates'];
|
|
7
|
+
static flags = {
|
|
8
|
+
...BaseCommand.baseFlags,
|
|
9
|
+
};
|
|
10
|
+
static args = {
|
|
11
|
+
face_id: Args.string({ description: 'Face alias', required: true }),
|
|
12
|
+
};
|
|
13
|
+
async run() {
|
|
14
|
+
const { args, flags } = await this.parse(FaceUnlock);
|
|
15
|
+
const client = this.makeClient(flags);
|
|
16
|
+
let data;
|
|
17
|
+
try {
|
|
18
|
+
data = await client.patch(`/v1/faces/${args.face_id}/lock`, { body: { read_only: false } });
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
if (err instanceof FacesAPIError)
|
|
22
|
+
this.error(`Error (${err.statusCode}): ${err.message}`);
|
|
23
|
+
throw err;
|
|
24
|
+
}
|
|
25
|
+
if (!this.jsonEnabled()) {
|
|
26
|
+
const res = data;
|
|
27
|
+
this.log(`Unlocked '${res.alias ?? args.face_id}' — writable.`);
|
|
28
|
+
const affected = res.affected ?? [];
|
|
29
|
+
if (affected.length > 0)
|
|
30
|
+
this.log(`Affected: ${affected.join(', ')}`);
|
|
31
|
+
}
|
|
32
|
+
return data;
|
|
33
|
+
}
|
|
34
|
+
}
|