ic-mops 0.8.7 → 0.8.8

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 {upgrade} from './commands/upgrade.js';
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
- // upgrade
181
+ // self update
182
182
  program
183
183
  .command('self-update')
184
- .description('Upgrade mops CLI to the latest version')
184
+ .description('Update mops CLI to the latest version')
185
185
  .option('--detached')
186
186
  .action(async (options) => {
187
- upgrade(options);
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 upgrade({detached = false} = {}) {
4
- console.log('Upgrading mops CLI...');
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;
@@ -54,6 +60,7 @@ type PackagePublication =
54
60
  };
55
61
  type PackageName__1 = text;
56
62
  type PackageName = text;
63
+ type PackageId = text;
57
64
  type PackageDetails =
58
65
  record {
59
66
  config: PackageConfigV2__1;
@@ -116,6 +123,8 @@ service : {
116
123
  PackageName__1;
117
124
  Version;
118
125
  }) query;
126
+ getDownloadTrendByPackageId: (PackageId) -> (vec Snapshot) query;
127
+ getDownloadTrendByPackageName: (PackageName__1) -> (vec Snapshot) query;
119
128
  getFileIds: (PackageName__1, Ver) -> (Result_5) query;
120
129
  getHighestVersion: (PackageName__1) -> (Result_4) query;
121
130
  getMostDownloadedPackages: () -> (vec PackageDetails) query;
@@ -52,6 +52,7 @@ export interface PackageDetails {
52
52
  'config' : PackageConfigV2__1,
53
53
  'publication' : PackagePublication,
54
54
  }
55
+ export type PackageId = string;
55
56
  export type PackageName = string;
56
57
  export type PackageName__1 = string;
57
58
  export interface PackagePublication {
@@ -74,6 +75,11 @@ export type Result_4 = { 'ok' : Ver } |
74
75
  export type Result_5 = { 'ok' : Array<FileId> } |
75
76
  { 'err' : Err };
76
77
  export interface Script { 'value' : string, 'name' : string }
78
+ export interface Snapshot {
79
+ 'startTime' : Time,
80
+ 'endTime' : Time,
81
+ 'downloads' : bigint,
82
+ }
77
83
  export type StorageId = Principal;
78
84
  export interface StorageStats {
79
85
  'fileCount' : bigint,
@@ -91,6 +97,11 @@ export interface _SERVICE {
91
97
  [string],
92
98
  Array<[PackageName__1, Version]>
93
99
  >,
100
+ 'getDownloadTrendByPackageId' : ActorMethod<[PackageId], Array<Snapshot>>,
101
+ 'getDownloadTrendByPackageName' : ActorMethod<
102
+ [PackageName__1],
103
+ Array<Snapshot>
104
+ >,
94
105
  'getFileIds' : ActorMethod<[PackageName__1, Ver], Result_5>,
95
106
  'getHighestVersion' : ActorMethod<[PackageName__1], Result_4>,
96
107
  'getMostDownloadedPackages' : ActorMethod<[], Array<PackageDetails>>,
@@ -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,7 +41,6 @@ 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,
@@ -84,6 +90,16 @@ export const idlFactory = ({ IDL }) => {
84
90
  [IDL.Vec(IDL.Tuple(PackageName__1, Version))],
85
91
  ['query'],
86
92
  ),
93
+ 'getDownloadTrendByPackageId' : IDL.Func(
94
+ [PackageId],
95
+ [IDL.Vec(Snapshot)],
96
+ ['query'],
97
+ ),
98
+ 'getDownloadTrendByPackageName' : IDL.Func(
99
+ [PackageName__1],
100
+ [IDL.Vec(Snapshot)],
101
+ ['query'],
102
+ ),
87
103
  'getFileIds' : IDL.Func([PackageName__1, Ver], [Result_5], ['query']),
88
104
  'getHighestVersion' : IDL.Func([PackageName__1], [Result_4], ['query']),
89
105
  'getMostDownloadedPackages' : IDL.Func(
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:8000',
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ic-mops",
3
- "version": "0.8.7",
3
+ "version": "0.8.8",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mops": "cli.js"