ic-mops 0.8.7 → 0.8.9
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.js
CHANGED
|
@@ -16,7 +16,7 @@ import {add} from './commands/add.js';
|
|
|
16
16
|
import {cacheSize, cleanCache} from './cache.js';
|
|
17
17
|
import {test} from './commands/test.js';
|
|
18
18
|
import {template} from './commands/template.js';
|
|
19
|
-
import {
|
|
19
|
+
import {selfUpdate} from './commands/self-update.js';
|
|
20
20
|
|
|
21
21
|
program.name('mops');
|
|
22
22
|
|
|
@@ -178,13 +178,13 @@ program
|
|
|
178
178
|
await template(options);
|
|
179
179
|
});
|
|
180
180
|
|
|
181
|
-
//
|
|
181
|
+
// self update
|
|
182
182
|
program
|
|
183
183
|
.command('self-update')
|
|
184
|
-
.description('
|
|
184
|
+
.description('Update mops CLI to the latest version')
|
|
185
185
|
.option('--detached')
|
|
186
186
|
.action(async (options) => {
|
|
187
|
-
|
|
187
|
+
selfUpdate(options);
|
|
188
188
|
});
|
|
189
189
|
|
|
190
190
|
program.parse();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import child_process from 'child_process';
|
|
2
2
|
|
|
3
|
-
export function
|
|
4
|
-
console.log('
|
|
3
|
+
export function selfUpdate({detached = false} = {}) {
|
|
4
|
+
console.log('Updating mops CLI...');
|
|
5
5
|
child_process.execSync('npm i ic-mops -g', {stdio: 'inherit', detached});
|
|
6
6
|
}
|
|
@@ -9,6 +9,12 @@ type StorageStats =
|
|
|
9
9
|
memorySize: nat;
|
|
10
10
|
};
|
|
11
11
|
type StorageId = principal;
|
|
12
|
+
type Snapshot =
|
|
13
|
+
record {
|
|
14
|
+
downloads: nat;
|
|
15
|
+
endTime: Time;
|
|
16
|
+
startTime: Time;
|
|
17
|
+
};
|
|
12
18
|
type Script =
|
|
13
19
|
record {
|
|
14
20
|
name: text;
|
|
@@ -46,6 +52,24 @@ type Result =
|
|
|
46
52
|
};
|
|
47
53
|
type PublishingId = text;
|
|
48
54
|
type PublishingErr = text;
|
|
55
|
+
type PackageSummary__1 =
|
|
56
|
+
record {
|
|
57
|
+
config: PackageConfigV2__1;
|
|
58
|
+
downloadsInLast30Days: nat;
|
|
59
|
+
downloadsInLast7Days: nat;
|
|
60
|
+
downloadsTotal: nat;
|
|
61
|
+
owner: principal;
|
|
62
|
+
publication: PackagePublication;
|
|
63
|
+
};
|
|
64
|
+
type PackageSummary =
|
|
65
|
+
record {
|
|
66
|
+
config: PackageConfigV2__1;
|
|
67
|
+
downloadsInLast30Days: nat;
|
|
68
|
+
downloadsInLast7Days: nat;
|
|
69
|
+
downloadsTotal: nat;
|
|
70
|
+
owner: principal;
|
|
71
|
+
publication: PackagePublication;
|
|
72
|
+
};
|
|
49
73
|
type PackagePublication =
|
|
50
74
|
record {
|
|
51
75
|
storage: principal;
|
|
@@ -54,14 +78,19 @@ type PackagePublication =
|
|
|
54
78
|
};
|
|
55
79
|
type PackageName__1 = text;
|
|
56
80
|
type PackageName = text;
|
|
81
|
+
type PackageId = text;
|
|
57
82
|
type PackageDetails =
|
|
58
83
|
record {
|
|
59
84
|
config: PackageConfigV2__1;
|
|
85
|
+
dependents: vec PackageSummary__1;
|
|
86
|
+
deps: vec PackageSummary__1;
|
|
87
|
+
devDeps: vec PackageSummary__1;
|
|
60
88
|
downloadsInLast30Days: nat;
|
|
61
89
|
downloadsInLast7Days: nat;
|
|
62
90
|
downloadsTotal: nat;
|
|
63
91
|
owner: principal;
|
|
64
92
|
publication: PackagePublication;
|
|
93
|
+
versionHistory: vec PackageSummary__1;
|
|
65
94
|
};
|
|
66
95
|
type PackageConfigV2__1 =
|
|
67
96
|
record {
|
|
@@ -116,12 +145,14 @@ service : {
|
|
|
116
145
|
PackageName__1;
|
|
117
146
|
Version;
|
|
118
147
|
}) query;
|
|
148
|
+
getDownloadTrendByPackageId: (PackageId) -> (vec Snapshot) query;
|
|
149
|
+
getDownloadTrendByPackageName: (PackageName__1) -> (vec Snapshot) query;
|
|
119
150
|
getFileIds: (PackageName__1, Ver) -> (Result_5) query;
|
|
120
151
|
getHighestVersion: (PackageName__1) -> (Result_4) query;
|
|
121
|
-
getMostDownloadedPackages: () -> (vec
|
|
122
|
-
getMostDownloadedPackagesIn7Days: () -> (vec
|
|
152
|
+
getMostDownloadedPackages: () -> (vec PackageSummary) query;
|
|
153
|
+
getMostDownloadedPackagesIn7Days: () -> (vec PackageSummary) query;
|
|
123
154
|
getPackageDetails: (PackageName__1, Ver) -> (Result_3) query;
|
|
124
|
-
getRecentlyUpdatedPackages: () -> (vec
|
|
155
|
+
getRecentlyUpdatedPackages: () -> (vec PackageSummary) query;
|
|
125
156
|
getStoragesStats: () -> (vec record {
|
|
126
157
|
StorageId;
|
|
127
158
|
StorageStats;
|
|
@@ -129,7 +160,7 @@ service : {
|
|
|
129
160
|
getTotalDownloads: () -> (nat) query;
|
|
130
161
|
getTotalPackages: () -> (nat) query;
|
|
131
162
|
notifyInstall: (PackageName__1, Ver) -> () oneway;
|
|
132
|
-
search: (Text) -> (vec
|
|
163
|
+
search: (Text) -> (vec PackageSummary) query;
|
|
133
164
|
startFileUpload: (PublishingId, Text, nat, blob) -> (Result_2);
|
|
134
165
|
startPublish: (PackageConfigV2) -> (Result_1);
|
|
135
166
|
uploadFileChunk: (PublishingId, FileId, nat, blob) -> (Result);
|
|
@@ -46,12 +46,17 @@ export interface PackageConfigV2__1 {
|
|
|
46
46
|
}
|
|
47
47
|
export interface PackageDetails {
|
|
48
48
|
'owner' : Principal,
|
|
49
|
+
'deps' : Array<PackageSummary__1>,
|
|
49
50
|
'downloadsTotal' : bigint,
|
|
50
51
|
'downloadsInLast30Days' : bigint,
|
|
52
|
+
'versionHistory' : Array<PackageSummary__1>,
|
|
53
|
+
'dependents' : Array<PackageSummary__1>,
|
|
54
|
+
'devDeps' : Array<PackageSummary__1>,
|
|
51
55
|
'downloadsInLast7Days' : bigint,
|
|
52
56
|
'config' : PackageConfigV2__1,
|
|
53
57
|
'publication' : PackagePublication,
|
|
54
58
|
}
|
|
59
|
+
export type PackageId = string;
|
|
55
60
|
export type PackageName = string;
|
|
56
61
|
export type PackageName__1 = string;
|
|
57
62
|
export interface PackagePublication {
|
|
@@ -59,6 +64,22 @@ export interface PackagePublication {
|
|
|
59
64
|
'time' : Time,
|
|
60
65
|
'user' : Principal,
|
|
61
66
|
}
|
|
67
|
+
export interface PackageSummary {
|
|
68
|
+
'owner' : Principal,
|
|
69
|
+
'downloadsTotal' : bigint,
|
|
70
|
+
'downloadsInLast30Days' : bigint,
|
|
71
|
+
'downloadsInLast7Days' : bigint,
|
|
72
|
+
'config' : PackageConfigV2__1,
|
|
73
|
+
'publication' : PackagePublication,
|
|
74
|
+
}
|
|
75
|
+
export interface PackageSummary__1 {
|
|
76
|
+
'owner' : Principal,
|
|
77
|
+
'downloadsTotal' : bigint,
|
|
78
|
+
'downloadsInLast30Days' : bigint,
|
|
79
|
+
'downloadsInLast7Days' : bigint,
|
|
80
|
+
'config' : PackageConfigV2__1,
|
|
81
|
+
'publication' : PackagePublication,
|
|
82
|
+
}
|
|
62
83
|
export type PublishingErr = string;
|
|
63
84
|
export type PublishingId = string;
|
|
64
85
|
export type Result = { 'ok' : null } |
|
|
@@ -74,6 +95,11 @@ export type Result_4 = { 'ok' : Ver } |
|
|
|
74
95
|
export type Result_5 = { 'ok' : Array<FileId> } |
|
|
75
96
|
{ 'err' : Err };
|
|
76
97
|
export interface Script { 'value' : string, 'name' : string }
|
|
98
|
+
export interface Snapshot {
|
|
99
|
+
'startTime' : Time,
|
|
100
|
+
'endTime' : Time,
|
|
101
|
+
'downloads' : bigint,
|
|
102
|
+
}
|
|
77
103
|
export type StorageId = Principal;
|
|
78
104
|
export interface StorageStats {
|
|
79
105
|
'fileCount' : bigint,
|
|
@@ -91,17 +117,22 @@ export interface _SERVICE {
|
|
|
91
117
|
[string],
|
|
92
118
|
Array<[PackageName__1, Version]>
|
|
93
119
|
>,
|
|
120
|
+
'getDownloadTrendByPackageId' : ActorMethod<[PackageId], Array<Snapshot>>,
|
|
121
|
+
'getDownloadTrendByPackageName' : ActorMethod<
|
|
122
|
+
[PackageName__1],
|
|
123
|
+
Array<Snapshot>
|
|
124
|
+
>,
|
|
94
125
|
'getFileIds' : ActorMethod<[PackageName__1, Ver], Result_5>,
|
|
95
126
|
'getHighestVersion' : ActorMethod<[PackageName__1], Result_4>,
|
|
96
|
-
'getMostDownloadedPackages' : ActorMethod<[], Array<
|
|
97
|
-
'getMostDownloadedPackagesIn7Days' : ActorMethod<[], Array<
|
|
127
|
+
'getMostDownloadedPackages' : ActorMethod<[], Array<PackageSummary>>,
|
|
128
|
+
'getMostDownloadedPackagesIn7Days' : ActorMethod<[], Array<PackageSummary>>,
|
|
98
129
|
'getPackageDetails' : ActorMethod<[PackageName__1, Ver], Result_3>,
|
|
99
|
-
'getRecentlyUpdatedPackages' : ActorMethod<[], Array<
|
|
130
|
+
'getRecentlyUpdatedPackages' : ActorMethod<[], Array<PackageSummary>>,
|
|
100
131
|
'getStoragesStats' : ActorMethod<[], Array<[StorageId, StorageStats]>>,
|
|
101
132
|
'getTotalDownloads' : ActorMethod<[], bigint>,
|
|
102
133
|
'getTotalPackages' : ActorMethod<[], bigint>,
|
|
103
134
|
'notifyInstall' : ActorMethod<[PackageName__1, Ver], undefined>,
|
|
104
|
-
'search' : ActorMethod<[Text], Array<
|
|
135
|
+
'search' : ActorMethod<[Text], Array<PackageSummary>>,
|
|
105
136
|
'startFileUpload' : ActorMethod<
|
|
106
137
|
[PublishingId, Text, bigint, Uint8Array | number[]],
|
|
107
138
|
Result_2
|
|
@@ -5,6 +5,13 @@ export const idlFactory = ({ IDL }) => {
|
|
|
5
5
|
const Text = IDL.Text;
|
|
6
6
|
const PackageName__1 = IDL.Text;
|
|
7
7
|
const Version = IDL.Text;
|
|
8
|
+
const PackageId = IDL.Text;
|
|
9
|
+
const Time = IDL.Int;
|
|
10
|
+
const Snapshot = IDL.Record({
|
|
11
|
+
'startTime' : Time,
|
|
12
|
+
'endTime' : Time,
|
|
13
|
+
'downloads' : IDL.Nat,
|
|
14
|
+
});
|
|
8
15
|
const Ver = IDL.Text;
|
|
9
16
|
const FileId = IDL.Text;
|
|
10
17
|
const Result_5 = IDL.Variant({ 'ok' : IDL.Vec(FileId), 'err' : Err });
|
|
@@ -34,16 +41,35 @@ export const idlFactory = ({ IDL }) => {
|
|
|
34
41
|
'license' : IDL.Text,
|
|
35
42
|
'readme' : IDL.Text,
|
|
36
43
|
});
|
|
37
|
-
const Time = IDL.Int;
|
|
38
44
|
const PackagePublication = IDL.Record({
|
|
39
45
|
'storage' : IDL.Principal,
|
|
40
46
|
'time' : Time,
|
|
41
47
|
'user' : IDL.Principal,
|
|
42
48
|
});
|
|
49
|
+
const PackageSummary = IDL.Record({
|
|
50
|
+
'owner' : IDL.Principal,
|
|
51
|
+
'downloadsTotal' : IDL.Nat,
|
|
52
|
+
'downloadsInLast30Days' : IDL.Nat,
|
|
53
|
+
'downloadsInLast7Days' : IDL.Nat,
|
|
54
|
+
'config' : PackageConfigV2__1,
|
|
55
|
+
'publication' : PackagePublication,
|
|
56
|
+
});
|
|
57
|
+
const PackageSummary__1 = IDL.Record({
|
|
58
|
+
'owner' : IDL.Principal,
|
|
59
|
+
'downloadsTotal' : IDL.Nat,
|
|
60
|
+
'downloadsInLast30Days' : IDL.Nat,
|
|
61
|
+
'downloadsInLast7Days' : IDL.Nat,
|
|
62
|
+
'config' : PackageConfigV2__1,
|
|
63
|
+
'publication' : PackagePublication,
|
|
64
|
+
});
|
|
43
65
|
const PackageDetails = IDL.Record({
|
|
44
66
|
'owner' : IDL.Principal,
|
|
67
|
+
'deps' : IDL.Vec(PackageSummary__1),
|
|
45
68
|
'downloadsTotal' : IDL.Nat,
|
|
46
69
|
'downloadsInLast30Days' : IDL.Nat,
|
|
70
|
+
'versionHistory' : IDL.Vec(PackageSummary__1),
|
|
71
|
+
'dependents' : IDL.Vec(PackageSummary__1),
|
|
72
|
+
'devDeps' : IDL.Vec(PackageSummary__1),
|
|
47
73
|
'downloadsInLast7Days' : IDL.Nat,
|
|
48
74
|
'config' : PackageConfigV2__1,
|
|
49
75
|
'publication' : PackagePublication,
|
|
@@ -84,16 +110,26 @@ export const idlFactory = ({ IDL }) => {
|
|
|
84
110
|
[IDL.Vec(IDL.Tuple(PackageName__1, Version))],
|
|
85
111
|
['query'],
|
|
86
112
|
),
|
|
113
|
+
'getDownloadTrendByPackageId' : IDL.Func(
|
|
114
|
+
[PackageId],
|
|
115
|
+
[IDL.Vec(Snapshot)],
|
|
116
|
+
['query'],
|
|
117
|
+
),
|
|
118
|
+
'getDownloadTrendByPackageName' : IDL.Func(
|
|
119
|
+
[PackageName__1],
|
|
120
|
+
[IDL.Vec(Snapshot)],
|
|
121
|
+
['query'],
|
|
122
|
+
),
|
|
87
123
|
'getFileIds' : IDL.Func([PackageName__1, Ver], [Result_5], ['query']),
|
|
88
124
|
'getHighestVersion' : IDL.Func([PackageName__1], [Result_4], ['query']),
|
|
89
125
|
'getMostDownloadedPackages' : IDL.Func(
|
|
90
126
|
[],
|
|
91
|
-
[IDL.Vec(
|
|
127
|
+
[IDL.Vec(PackageSummary)],
|
|
92
128
|
['query'],
|
|
93
129
|
),
|
|
94
130
|
'getMostDownloadedPackagesIn7Days' : IDL.Func(
|
|
95
131
|
[],
|
|
96
|
-
[IDL.Vec(
|
|
132
|
+
[IDL.Vec(PackageSummary)],
|
|
97
133
|
['query'],
|
|
98
134
|
),
|
|
99
135
|
'getPackageDetails' : IDL.Func(
|
|
@@ -103,7 +139,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
103
139
|
),
|
|
104
140
|
'getRecentlyUpdatedPackages' : IDL.Func(
|
|
105
141
|
[],
|
|
106
|
-
[IDL.Vec(
|
|
142
|
+
[IDL.Vec(PackageSummary)],
|
|
107
143
|
['query'],
|
|
108
144
|
),
|
|
109
145
|
'getStoragesStats' : IDL.Func(
|
|
@@ -114,7 +150,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
114
150
|
'getTotalDownloads' : IDL.Func([], [IDL.Nat], ['query']),
|
|
115
151
|
'getTotalPackages' : IDL.Func([], [IDL.Nat], ['query']),
|
|
116
152
|
'notifyInstall' : IDL.Func([PackageName__1, Ver], [], ['oneway']),
|
|
117
|
-
'search' : IDL.Func([Text], [IDL.Vec(
|
|
153
|
+
'search' : IDL.Func([Text], [IDL.Vec(PackageSummary)], ['query']),
|
|
118
154
|
'startFileUpload' : IDL.Func(
|
|
119
155
|
[PublishingId, Text, IDL.Nat, IDL.Vec(IDL.Nat8)],
|
|
120
156
|
[Result_2],
|
package/mops.js
CHANGED
|
@@ -33,10 +33,17 @@ export function getNetwork() {
|
|
|
33
33
|
let ids = JSON.parse(fs.readFileSync(new URL('../.dfx/local/canister_ids.json', import.meta.url)).toString());
|
|
34
34
|
return {
|
|
35
35
|
network,
|
|
36
|
-
host: 'http://127.0.0.1:
|
|
36
|
+
host: 'http://127.0.0.1:4943',
|
|
37
37
|
canisterId: ids.main.local,
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
+
else if (network === 'staging') {
|
|
41
|
+
return {
|
|
42
|
+
network,
|
|
43
|
+
host: 'https://ic0.app',
|
|
44
|
+
canisterId: '2d2zu-vaaaa-aaaak-qb6pq-cai',
|
|
45
|
+
};
|
|
46
|
+
}
|
|
40
47
|
else if (network === 'ic') {
|
|
41
48
|
return {
|
|
42
49
|
network,
|
package/package.json
CHANGED