@miso.ai/server-sdk 0.6.0 → 0.6.2-beta.0
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/cli/ids-diff.js +57 -0
- package/cli/ids.js +6 -4
- package/package.json +2 -2
- package/src/version.js +1 -1
package/cli/ids-diff.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import split2 from 'split2';
|
|
2
|
+
import { stream } from '@miso.ai/server-commons';
|
|
3
|
+
import { MisoClient } from '../src/index.js';
|
|
4
|
+
|
|
5
|
+
function build(yargs) {
|
|
6
|
+
return yargs
|
|
7
|
+
.option('output', {
|
|
8
|
+
alias: ['out', 'o'],
|
|
9
|
+
describe: 'Output mode',
|
|
10
|
+
choices: ['default', 'plus', 'minus'],
|
|
11
|
+
conflicts: ['plus', 'minus'],
|
|
12
|
+
})
|
|
13
|
+
.option('plus', {
|
|
14
|
+
alias: ['p'],
|
|
15
|
+
describe: 'Only show plus records (those are present in input and absent in Dojo)',
|
|
16
|
+
type: 'boolean',
|
|
17
|
+
conflicts: ['output', 'minus'],
|
|
18
|
+
})
|
|
19
|
+
.option('minus', {
|
|
20
|
+
alias: ['m'],
|
|
21
|
+
describe: 'Only show minus records (those are absent in input and present in Dojo)',
|
|
22
|
+
type: 'boolean',
|
|
23
|
+
conflicts: ['output', 'plus'],
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const run = type => async ({
|
|
28
|
+
key,
|
|
29
|
+
server,
|
|
30
|
+
output,
|
|
31
|
+
plus,
|
|
32
|
+
minus,
|
|
33
|
+
}) => {
|
|
34
|
+
output = output || (plus ? 'plus' : minus ? 'minus' : undefined);
|
|
35
|
+
|
|
36
|
+
const client = new MisoClient({ key, server });
|
|
37
|
+
const misoIds = await client.ids(type);
|
|
38
|
+
|
|
39
|
+
const diffStream = new stream.DiffStream(misoIds, { output });
|
|
40
|
+
const outputStream = new stream.OutputStream({ objectMode: false });
|
|
41
|
+
|
|
42
|
+
await stream.pipeline(
|
|
43
|
+
process.stdin,
|
|
44
|
+
split2(),
|
|
45
|
+
diffStream,
|
|
46
|
+
outputStream,
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default function(type) {
|
|
51
|
+
return {
|
|
52
|
+
command: 'diff',
|
|
53
|
+
description: false,
|
|
54
|
+
builder: build,
|
|
55
|
+
handler: run(type),
|
|
56
|
+
};
|
|
57
|
+
}
|
package/cli/ids.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Readable } from 'stream';
|
|
2
2
|
import { stream } from '@miso.ai/server-commons';
|
|
3
3
|
import { MisoClient } from '../src/index.js';
|
|
4
|
+
import diff from './ids-diff.js';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
return yargs
|
|
7
|
-
|
|
6
|
+
const build = type => yargs => {
|
|
7
|
+
return yargs
|
|
8
|
+
.command(diff(type));
|
|
9
|
+
};
|
|
8
10
|
|
|
9
11
|
const run = type => async ({
|
|
10
12
|
key,
|
|
@@ -26,7 +28,7 @@ export default function(type) {
|
|
|
26
28
|
return {
|
|
27
29
|
command: 'ids',
|
|
28
30
|
description: false,
|
|
29
|
-
builder: build,
|
|
31
|
+
builder: build(type),
|
|
30
32
|
handler: run(type),
|
|
31
33
|
};
|
|
32
34
|
}
|
package/package.json
CHANGED
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
"simonpai <simon.pai@askmiso.com>"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@miso.ai/server-commons": "0.6.0",
|
|
19
|
+
"@miso.ai/server-commons": "0.6.2-beta.0",
|
|
20
20
|
"axios": "^0.27.2",
|
|
21
21
|
"dotenv": "^16.0.1",
|
|
22
22
|
"split2": "^4.1.0",
|
|
23
23
|
"yargs": "^17.5.1"
|
|
24
24
|
},
|
|
25
|
-
"version": "0.6.0"
|
|
25
|
+
"version": "0.6.2-beta.0"
|
|
26
26
|
}
|
package/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '0.6.0';
|
|
1
|
+
export default '0.6.2-beta.0';
|