ic-mops 0.34.4 → 0.36.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.
Files changed (54) hide show
  1. package/cli.ts +11 -45
  2. package/commands/add.ts +7 -5
  3. package/commands/bench-replica.ts +99 -0
  4. package/commands/bench.ts +57 -90
  5. package/commands/install-all.ts +4 -4
  6. package/commands/remove.ts +4 -4
  7. package/commands/sync.ts +5 -5
  8. package/commands/update.ts +3 -3
  9. package/declarations/main/main.did +67 -78
  10. package/declarations/main/main.did.d.ts +72 -83
  11. package/declarations/main/main.did.js +12 -23
  12. package/dist/bin/mops.d.ts +2 -0
  13. package/dist/bin/mops.js +2 -0
  14. package/dist/cli.js +11 -44
  15. package/dist/commands/add.d.ts +2 -2
  16. package/dist/commands/add.js +6 -3
  17. package/dist/commands/bench-replica.d.ts +32 -0
  18. package/dist/commands/bench-replica.js +87 -0
  19. package/dist/commands/bench.d.ts +9 -8
  20. package/dist/commands/bench.js +44 -76
  21. package/dist/commands/install-all.d.ts +2 -2
  22. package/dist/commands/install-all.js +3 -3
  23. package/dist/commands/remove.d.ts +2 -2
  24. package/dist/commands/remove.js +3 -2
  25. package/dist/commands/sync.d.ts +2 -2
  26. package/dist/commands/sync.js +4 -4
  27. package/dist/commands/toolchain/moc.d.ts +4 -0
  28. package/dist/commands/toolchain/moc.js +36 -0
  29. package/dist/commands/toolchain/mocv.d.ts +1 -0
  30. package/dist/commands/toolchain/mocv.js +272 -0
  31. package/dist/commands/toolchain/toolchain-utils.d.ts +3 -0
  32. package/dist/commands/toolchain/toolchain-utils.js +56 -0
  33. package/dist/commands/toolchain/wasmtime.d.ts +4 -0
  34. package/dist/commands/toolchain/wasmtime.js +23 -0
  35. package/dist/commands/update.d.ts +2 -2
  36. package/dist/commands/update.js +2 -2
  37. package/dist/declarations/main/main.did +67 -78
  38. package/dist/declarations/main/main.did.d.ts +72 -83
  39. package/dist/declarations/main/main.did.js +12 -23
  40. package/dist/integrity.d.ts +2 -2
  41. package/dist/integrity.js +4 -4
  42. package/dist/moc-wrapper.d.ts +2 -0
  43. package/dist/moc-wrapper.js +8 -0
  44. package/dist/out/cli.d.ts +2 -0
  45. package/dist/out/cli.js +115242 -0
  46. package/dist/package.json +12 -4
  47. package/dist/templates/cli.d.ts +2 -0
  48. package/dist/templates/cli.js +3660 -0
  49. package/integrity.ts +5 -5
  50. package/package.json +12 -4
  51. package/dist/helpers/download-package-files.d.ts +0 -12
  52. package/dist/helpers/download-package-files.js +0 -62
  53. package/dist/helpers/resolve-version.d.ts +0 -1
  54. package/dist/helpers/resolve-version.js +0 -11
@@ -111,7 +111,7 @@ type Result_3 =
111
111
  };
112
112
  type Result_2 =
113
113
  variant {
114
- err: PublishingErr;
114
+ err: Err;
115
115
  ok: PublishingId;
116
116
  };
117
117
  type Result_1 =
@@ -141,7 +141,6 @@ type Request =
141
141
  url: text;
142
142
  };
143
143
  type PublishingId = text;
144
- type PublishingErr = text;
145
144
  type PageCount = nat;
146
145
  type PackageVersion = text;
147
146
  type PackageSummary__1 =
@@ -272,13 +271,6 @@ type PackageConfigV2 =
272
271
  scripts: vec Script;
273
272
  version: text;
274
273
  };
275
- type PackageChanges__1 =
276
- record {
277
- deps: vec DepChange;
278
- devDeps: vec DepChange;
279
- notes: text;
280
- tests: TestsChanges;
281
- };
282
274
  type PackageChanges =
283
275
  record {
284
276
  deps: vec DepChange;
@@ -286,6 +278,71 @@ type PackageChanges =
286
278
  notes: text;
287
279
  tests: TestsChanges;
288
280
  };
281
+ type Main =
282
+ service {
283
+ backup: () -> ();
284
+ computeHashesForExistingFiles: () -> ();
285
+ finishPublish: (PublishingId) -> (Result);
286
+ getApiVersion: () -> (Text) query;
287
+ getBackupCanisterId: () -> (principal) query;
288
+ getDefaultPackages: (text) ->
289
+ (vec record {
290
+ PackageName;
291
+ PackageVersion;
292
+ }) query;
293
+ getDownloadTrendByPackageId: (PackageId) ->
294
+ (vec DownloadsSnapshot__1) query;
295
+ getDownloadTrendByPackageName: (PackageName) ->
296
+ (vec DownloadsSnapshot__1) query;
297
+ getFileHashes: (PackageName, PackageVersion) -> (Result_8);
298
+ getFileHashesByPackageIds: (vec PackageId) ->
299
+ (vec record {
300
+ PackageId;
301
+ vec record {
302
+ FileId;
303
+ blob;
304
+ };
305
+ });
306
+ getFileIds: (PackageName, PackageVersion) -> (Result_7) query;
307
+ getHighestSemverBatch:
308
+ (vec record {
309
+ PackageName;
310
+ PackageVersion;
311
+ SemverPart;
312
+ }) -> (Result_6) query;
313
+ getHighestVersion: (PackageName) -> (Result_5) query;
314
+ getMostDownloadedPackages: () -> (vec PackageSummary) query;
315
+ getMostDownloadedPackagesIn7Days: () -> (vec PackageSummary) query;
316
+ getNewPackages: () -> (vec PackageSummary) query;
317
+ getPackageDetails: (PackageName, PackageVersion) -> (Result_4) query;
318
+ getPackagesByCategory: () -> (vec record {
319
+ text;
320
+ vec PackageSummary;
321
+ }) query;
322
+ getRecentlyUpdatedPackages: () -> (vec PackageSummaryWithChanges) query;
323
+ getStoragesStats: () -> (vec record {
324
+ StorageId;
325
+ StorageStats;
326
+ }) query;
327
+ getTotalDownloads: () -> (nat) query;
328
+ getTotalPackages: () -> (nat) query;
329
+ getUser: (principal) -> (opt User__1) query;
330
+ http_request: (Request) -> (Response) query;
331
+ notifyInstall: (PackageName, PackageVersion) -> () oneway;
332
+ notifyInstalls: (vec record {
333
+ PackageName;
334
+ PackageVersion;
335
+ }) -> () oneway;
336
+ restore: (nat, nat) -> ();
337
+ search: (Text, opt nat, opt nat) -> (vec PackageSummary, PageCount) query;
338
+ setUserProp: (text, text) -> (Result_1);
339
+ startFileUpload: (PublishingId, Text, nat, blob) -> (Result_3);
340
+ startPublish: (PackageConfigV2) -> (Result_2);
341
+ transferOwnership: (PackageName, principal) -> (Result_1);
342
+ uploadFileChunk: (PublishingId, FileId, nat, blob) -> (Result);
343
+ uploadNotes: (PublishingId, text) -> (Result);
344
+ uploadTestStats: (PublishingId, TestStats) -> (Result);
345
+ };
289
346
  type Header =
290
347
  record {
291
348
  text;
@@ -323,72 +380,4 @@ type DepChange =
323
380
  newVersion: text;
324
381
  oldVersion: text;
325
382
  };
326
- service : {
327
- backup: () -> ();
328
- claimAirdrop: (principal) -> (text);
329
- computeHashesForExistingFiles: () -> ();
330
- diff: (text, text) -> (PackageChanges__1) query;
331
- finishPublish: (PublishingId) -> (Result);
332
- getAirdropAmount: () -> (nat) query;
333
- getAirdropAmountAll: () -> (nat) query;
334
- getApiVersion: () -> (Text) query;
335
- getBackupCanisterId: () -> (principal) query;
336
- getDefaultPackages: (text) ->
337
- (vec record {
338
- PackageName;
339
- PackageVersion;
340
- }) query;
341
- getDownloadTrendByPackageId: (PackageId) ->
342
- (vec DownloadsSnapshot__1) query;
343
- getDownloadTrendByPackageName: (PackageName) ->
344
- (vec DownloadsSnapshot__1) query;
345
- getFileHashes: (PackageName, PackageVersion) -> (Result_8);
346
- getFileHashesByPackageIds: (vec PackageId) ->
347
- (vec record {
348
- PackageId;
349
- vec record {
350
- FileId;
351
- blob;
352
- };
353
- });
354
- getFileIds: (PackageName, PackageVersion) -> (Result_7) query;
355
- getHighestSemverBatch:
356
- (vec record {
357
- PackageName;
358
- PackageVersion;
359
- SemverPart;
360
- }) -> (Result_6) query;
361
- getHighestVersion: (PackageName) -> (Result_5) query;
362
- getMostDownloadedPackages: () -> (vec PackageSummary) query;
363
- getMostDownloadedPackagesIn7Days: () -> (vec PackageSummary) query;
364
- getNewPackages: () -> (vec PackageSummary) query;
365
- getPackageDetails: (PackageName, PackageVersion) -> (Result_4) query;
366
- getPackagesByCategory: () -> (vec record {
367
- text;
368
- vec PackageSummary;
369
- }) query;
370
- getRecentlyUpdatedPackages: () -> (vec PackageSummaryWithChanges) query;
371
- getStoragesStats: () -> (vec record {
372
- StorageId;
373
- StorageStats;
374
- }) query;
375
- getTotalDownloads: () -> (nat) query;
376
- getTotalPackages: () -> (nat) query;
377
- getUser: (principal) -> (opt User__1) query;
378
- http_request: (Request) -> (Response) query;
379
- notifyInstall: (PackageName, PackageVersion) -> () oneway;
380
- notifyInstalls: (vec record {
381
- PackageName;
382
- PackageVersion;
383
- }) -> () oneway;
384
- restore: (nat, nat) -> ();
385
- search: (Text, opt nat, opt nat) -> (vec PackageSummary, PageCount) query;
386
- setUserProp: (text, text) -> (Result_1);
387
- startFileUpload: (PublishingId, Text, nat, blob) -> (Result_3);
388
- startPublish: (PackageConfigV2) -> (Result_2);
389
- takeAirdropSnapshot: () -> () oneway;
390
- transferOwnership: (PackageName, principal) -> (Result_1);
391
- uploadFileChunk: (PublishingId, FileId, nat, blob) -> (Result);
392
- uploadNotes: (PublishingId, text) -> (Result);
393
- uploadTestStats: (PublishingId, TestStats) -> (Result);
394
- }
383
+ service : () -> Main
@@ -27,13 +27,77 @@ export interface DownloadsSnapshot__1 {
27
27
  export type Err = string;
28
28
  export type FileId = string;
29
29
  export type Header = [string, string];
30
- export interface PackageChanges {
31
- 'tests' : TestsChanges,
32
- 'deps' : Array<DepChange>,
33
- 'notes' : string,
34
- 'devDeps' : Array<DepChange>,
30
+ export interface Main {
31
+ 'backup' : ActorMethod<[], undefined>,
32
+ 'computeHashesForExistingFiles' : ActorMethod<[], undefined>,
33
+ 'finishPublish' : ActorMethod<[PublishingId], Result>,
34
+ 'getApiVersion' : ActorMethod<[], Text>,
35
+ 'getBackupCanisterId' : ActorMethod<[], Principal>,
36
+ 'getDefaultPackages' : ActorMethod<
37
+ [string],
38
+ Array<[PackageName, PackageVersion]>
39
+ >,
40
+ 'getDownloadTrendByPackageId' : ActorMethod<
41
+ [PackageId],
42
+ Array<DownloadsSnapshot__1>
43
+ >,
44
+ 'getDownloadTrendByPackageName' : ActorMethod<
45
+ [PackageName],
46
+ Array<DownloadsSnapshot__1>
47
+ >,
48
+ 'getFileHashes' : ActorMethod<[PackageName, PackageVersion], Result_8>,
49
+ 'getFileHashesByPackageIds' : ActorMethod<
50
+ [Array<PackageId>],
51
+ Array<[PackageId, Array<[FileId, Uint8Array | number[]]>]>
52
+ >,
53
+ 'getFileIds' : ActorMethod<[PackageName, PackageVersion], Result_7>,
54
+ 'getHighestSemverBatch' : ActorMethod<
55
+ [Array<[PackageName, PackageVersion, SemverPart]>],
56
+ Result_6
57
+ >,
58
+ 'getHighestVersion' : ActorMethod<[PackageName], Result_5>,
59
+ 'getMostDownloadedPackages' : ActorMethod<[], Array<PackageSummary>>,
60
+ 'getMostDownloadedPackagesIn7Days' : ActorMethod<[], Array<PackageSummary>>,
61
+ 'getNewPackages' : ActorMethod<[], Array<PackageSummary>>,
62
+ 'getPackageDetails' : ActorMethod<[PackageName, PackageVersion], Result_4>,
63
+ 'getPackagesByCategory' : ActorMethod<
64
+ [],
65
+ Array<[string, Array<PackageSummary>]>
66
+ >,
67
+ 'getRecentlyUpdatedPackages' : ActorMethod<
68
+ [],
69
+ Array<PackageSummaryWithChanges>
70
+ >,
71
+ 'getStoragesStats' : ActorMethod<[], Array<[StorageId, StorageStats]>>,
72
+ 'getTotalDownloads' : ActorMethod<[], bigint>,
73
+ 'getTotalPackages' : ActorMethod<[], bigint>,
74
+ 'getUser' : ActorMethod<[Principal], [] | [User__1]>,
75
+ 'http_request' : ActorMethod<[Request], Response>,
76
+ 'notifyInstall' : ActorMethod<[PackageName, PackageVersion], undefined>,
77
+ 'notifyInstalls' : ActorMethod<
78
+ [Array<[PackageName, PackageVersion]>],
79
+ undefined
80
+ >,
81
+ 'restore' : ActorMethod<[bigint, bigint], undefined>,
82
+ 'search' : ActorMethod<
83
+ [Text, [] | [bigint], [] | [bigint]],
84
+ [Array<PackageSummary>, PageCount]
85
+ >,
86
+ 'setUserProp' : ActorMethod<[string, string], Result_1>,
87
+ 'startFileUpload' : ActorMethod<
88
+ [PublishingId, Text, bigint, Uint8Array | number[]],
89
+ Result_3
90
+ >,
91
+ 'startPublish' : ActorMethod<[PackageConfigV2], Result_2>,
92
+ 'transferOwnership' : ActorMethod<[PackageName, Principal], Result_1>,
93
+ 'uploadFileChunk' : ActorMethod<
94
+ [PublishingId, FileId, bigint, Uint8Array | number[]],
95
+ Result
96
+ >,
97
+ 'uploadNotes' : ActorMethod<[PublishingId, string], Result>,
98
+ 'uploadTestStats' : ActorMethod<[PublishingId, TestStats], Result>,
35
99
  }
36
- export interface PackageChanges__1 {
100
+ export interface PackageChanges {
37
101
  'tests' : TestsChanges,
38
102
  'deps' : Array<DepChange>,
39
103
  'notes' : string,
@@ -159,7 +223,6 @@ export interface PackageSummary__1 {
159
223
  }
160
224
  export type PackageVersion = string;
161
225
  export type PageCount = bigint;
162
- export type PublishingErr = string;
163
226
  export type PublishingId = string;
164
227
  export interface Request {
165
228
  'url' : string,
@@ -180,7 +243,7 @@ export type Result = { 'ok' : null } |
180
243
  export type Result_1 = { 'ok' : null } |
181
244
  { 'err' : string };
182
245
  export type Result_2 = { 'ok' : PublishingId } |
183
- { 'err' : PublishingErr };
246
+ { 'err' : Err };
184
247
  export type Result_3 = { 'ok' : FileId } |
185
248
  { 'err' : Err };
186
249
  export type Result_4 = { 'ok' : PackageDetails } |
@@ -250,78 +313,4 @@ export interface User__1 {
250
313
  'githubVerified' : boolean,
251
314
  'github' : string,
252
315
  }
253
- export interface _SERVICE {
254
- 'backup' : ActorMethod<[], undefined>,
255
- 'claimAirdrop' : ActorMethod<[Principal], string>,
256
- 'computeHashesForExistingFiles' : ActorMethod<[], undefined>,
257
- 'diff' : ActorMethod<[string, string], PackageChanges__1>,
258
- 'finishPublish' : ActorMethod<[PublishingId], Result>,
259
- 'getAirdropAmount' : ActorMethod<[], bigint>,
260
- 'getAirdropAmountAll' : ActorMethod<[], bigint>,
261
- 'getApiVersion' : ActorMethod<[], Text>,
262
- 'getBackupCanisterId' : ActorMethod<[], Principal>,
263
- 'getDefaultPackages' : ActorMethod<
264
- [string],
265
- Array<[PackageName, PackageVersion]>
266
- >,
267
- 'getDownloadTrendByPackageId' : ActorMethod<
268
- [PackageId],
269
- Array<DownloadsSnapshot__1>
270
- >,
271
- 'getDownloadTrendByPackageName' : ActorMethod<
272
- [PackageName],
273
- Array<DownloadsSnapshot__1>
274
- >,
275
- 'getFileHashes' : ActorMethod<[PackageName, PackageVersion], Result_8>,
276
- 'getFileHashesByPackageIds' : ActorMethod<
277
- [Array<PackageId>],
278
- Array<[PackageId, Array<[FileId, Uint8Array | number[]]>]>
279
- >,
280
- 'getFileIds' : ActorMethod<[PackageName, PackageVersion], Result_7>,
281
- 'getHighestSemverBatch' : ActorMethod<
282
- [Array<[PackageName, PackageVersion, SemverPart]>],
283
- Result_6
284
- >,
285
- 'getHighestVersion' : ActorMethod<[PackageName], Result_5>,
286
- 'getMostDownloadedPackages' : ActorMethod<[], Array<PackageSummary>>,
287
- 'getMostDownloadedPackagesIn7Days' : ActorMethod<[], Array<PackageSummary>>,
288
- 'getNewPackages' : ActorMethod<[], Array<PackageSummary>>,
289
- 'getPackageDetails' : ActorMethod<[PackageName, PackageVersion], Result_4>,
290
- 'getPackagesByCategory' : ActorMethod<
291
- [],
292
- Array<[string, Array<PackageSummary>]>
293
- >,
294
- 'getRecentlyUpdatedPackages' : ActorMethod<
295
- [],
296
- Array<PackageSummaryWithChanges>
297
- >,
298
- 'getStoragesStats' : ActorMethod<[], Array<[StorageId, StorageStats]>>,
299
- 'getTotalDownloads' : ActorMethod<[], bigint>,
300
- 'getTotalPackages' : ActorMethod<[], bigint>,
301
- 'getUser' : ActorMethod<[Principal], [] | [User__1]>,
302
- 'http_request' : ActorMethod<[Request], Response>,
303
- 'notifyInstall' : ActorMethod<[PackageName, PackageVersion], undefined>,
304
- 'notifyInstalls' : ActorMethod<
305
- [Array<[PackageName, PackageVersion]>],
306
- undefined
307
- >,
308
- 'restore' : ActorMethod<[bigint, bigint], undefined>,
309
- 'search' : ActorMethod<
310
- [Text, [] | [bigint], [] | [bigint]],
311
- [Array<PackageSummary>, PageCount]
312
- >,
313
- 'setUserProp' : ActorMethod<[string, string], Result_1>,
314
- 'startFileUpload' : ActorMethod<
315
- [PublishingId, Text, bigint, Uint8Array | number[]],
316
- Result_3
317
- >,
318
- 'startPublish' : ActorMethod<[PackageConfigV2], Result_2>,
319
- 'takeAirdropSnapshot' : ActorMethod<[], undefined>,
320
- 'transferOwnership' : ActorMethod<[PackageName, Principal], Result_1>,
321
- 'uploadFileChunk' : ActorMethod<
322
- [PublishingId, FileId, bigint, Uint8Array | number[]],
323
- Result
324
- >,
325
- 'uploadNotes' : ActorMethod<[PublishingId, string], Result>,
326
- 'uploadTestStats' : ActorMethod<[PublishingId, TestStats], Result>,
327
- }
316
+ export interface _SERVICE extends Main {}
@@ -1,19 +1,4 @@
1
1
  export const idlFactory = ({ IDL }) => {
2
- const TestsChanges = IDL.Record({
3
- 'addedNames' : IDL.Vec(IDL.Text),
4
- 'removedNames' : IDL.Vec(IDL.Text),
5
- });
6
- const DepChange = IDL.Record({
7
- 'oldVersion' : IDL.Text,
8
- 'name' : IDL.Text,
9
- 'newVersion' : IDL.Text,
10
- });
11
- const PackageChanges__1 = IDL.Record({
12
- 'tests' : TestsChanges,
13
- 'deps' : IDL.Vec(DepChange),
14
- 'notes' : IDL.Text,
15
- 'devDeps' : IDL.Vec(DepChange),
16
- });
17
2
  const PublishingId = IDL.Text;
18
3
  const Err = IDL.Text;
19
4
  const Result = IDL.Variant({ 'ok' : IDL.Null, 'err' : Err });
@@ -133,6 +118,15 @@ export const idlFactory = ({ IDL }) => {
133
118
  'sourceFiles' : IDL.Nat,
134
119
  'sourceSize' : IDL.Nat,
135
120
  });
121
+ const TestsChanges = IDL.Record({
122
+ 'addedNames' : IDL.Vec(IDL.Text),
123
+ 'removedNames' : IDL.Vec(IDL.Text),
124
+ });
125
+ const DepChange = IDL.Record({
126
+ 'oldVersion' : IDL.Text,
127
+ 'name' : IDL.Text,
128
+ 'newVersion' : IDL.Text,
129
+ });
136
130
  const PackageChanges = IDL.Record({
137
131
  'tests' : TestsChanges,
138
132
  'deps' : IDL.Vec(DepChange),
@@ -250,20 +244,15 @@ export const idlFactory = ({ IDL }) => {
250
244
  'license' : IDL.Text,
251
245
  'readme' : IDL.Text,
252
246
  });
253
- const PublishingErr = IDL.Text;
254
- const Result_2 = IDL.Variant({ 'ok' : PublishingId, 'err' : PublishingErr });
247
+ const Result_2 = IDL.Variant({ 'ok' : PublishingId, 'err' : Err });
255
248
  const TestStats = IDL.Record({
256
249
  'passedNames' : IDL.Vec(IDL.Text),
257
250
  'passed' : IDL.Nat,
258
251
  });
259
- return IDL.Service({
252
+ const Main = IDL.Service({
260
253
  'backup' : IDL.Func([], [], []),
261
- 'claimAirdrop' : IDL.Func([IDL.Principal], [IDL.Text], []),
262
254
  'computeHashesForExistingFiles' : IDL.Func([], [], []),
263
- 'diff' : IDL.Func([IDL.Text, IDL.Text], [PackageChanges__1], ['query']),
264
255
  'finishPublish' : IDL.Func([PublishingId], [Result], []),
265
- 'getAirdropAmount' : IDL.Func([], [IDL.Nat], ['query']),
266
- 'getAirdropAmountAll' : IDL.Func([], [IDL.Nat], ['query']),
267
256
  'getApiVersion' : IDL.Func([], [Text], ['query']),
268
257
  'getBackupCanisterId' : IDL.Func([], [IDL.Principal], ['query']),
269
258
  'getDefaultPackages' : IDL.Func(
@@ -356,7 +345,6 @@ export const idlFactory = ({ IDL }) => {
356
345
  [],
357
346
  ),
358
347
  'startPublish' : IDL.Func([PackageConfigV2], [Result_2], []),
359
- 'takeAirdropSnapshot' : IDL.Func([], [], ['oneway']),
360
348
  'transferOwnership' : IDL.Func(
361
349
  [PackageName, IDL.Principal],
362
350
  [Result_1],
@@ -370,5 +358,6 @@ export const idlFactory = ({ IDL }) => {
370
358
  'uploadNotes' : IDL.Func([PublishingId, IDL.Text], [Result], []),
371
359
  'uploadTestStats' : IDL.Func([PublishingId, TestStats], [Result], []),
372
360
  });
361
+ return Main;
373
362
  };
374
363
  export const init = ({ IDL }) => { return []; };
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import '../cli.js';
package/dist/cli.js CHANGED
@@ -2,14 +2,12 @@
2
2
  import fs from 'node:fs';
3
3
  import { program, Argument, Option } from 'commander';
4
4
  import chalk from 'chalk';
5
- import { Principal } from '@dfinity/principal';
6
5
  import { init } from './commands/init.js';
7
6
  import { publish } from './commands/publish.js';
8
7
  import { importPem } from './commands/import-identity.js';
9
8
  import { sources } from './commands/sources.js';
10
- import { checkApiCompatibility, setNetwork, apiVersion, checkConfigFile, getNetworkFile, getIdentity } from './mops.js';
9
+ import { checkApiCompatibility, setNetwork, apiVersion, checkConfigFile, getNetworkFile } from './mops.js';
11
10
  import { getNetwork } from './api/network.js';
12
- import { mainActor } from './api/actors.js';
13
11
  import { whoami } from './commands/whoami.js';
14
12
  import { installAll } from './commands/install-all.js';
15
13
  import { search } from './commands/search.js';
@@ -48,7 +46,7 @@ program
48
46
  .description('Install the package and save it to mops.toml')
49
47
  .option('--dev')
50
48
  .option('--verbose')
51
- .addOption(new Option('--lockfile <lockfile>', 'Lockfile action').choices(['save', 'ignore']))
49
+ .addOption(new Option('--lock <action>', 'Lockfile action').choices(['update', 'ignore']))
52
50
  .action(async (pkg, options) => {
53
51
  if (!checkConfigFile()) {
54
52
  process.exit(1);
@@ -63,7 +61,7 @@ program
63
61
  .option('--dev', 'Remove from dev-dependencies instead of dependencies')
64
62
  .option('--verbose', 'Show more information')
65
63
  .option('--dry-run', 'Do not actually remove anything')
66
- .addOption(new Option('--lockfile <lockfile>', 'Lockfile action').choices(['save', 'ignore']))
64
+ .addOption(new Option('--lock <action>', 'Lockfile action').choices(['update', 'ignore']))
67
65
  .action(async (pkg, options) => {
68
66
  if (!checkConfigFile()) {
69
67
  process.exit(1);
@@ -76,7 +74,7 @@ program
76
74
  .alias('i')
77
75
  .description('Install all dependencies specified in mops.toml')
78
76
  .option('--verbose')
79
- .addOption(new Option('--lockfile <lockfile>', 'Lockfile action').choices(['save', 'check', 'ignore']))
77
+ .addOption(new Option('--lock <action>', 'Lockfile action').choices(['check', 'update', 'ignore']))
80
78
  .action(async (pkg, options) => {
81
79
  if (!checkConfigFile()) {
82
80
  process.exit(1);
@@ -144,7 +142,7 @@ program
144
142
  if (!checkConfigFile()) {
145
143
  process.exit(1);
146
144
  }
147
- await installAll({ silent: true, lockfile: 'ignore' });
145
+ await installAll({ silent: true, lock: 'ignore' });
148
146
  let sourcesArr = await sources(options);
149
147
  console.log(sourcesArr.join('\n'));
150
148
  });
@@ -185,20 +183,21 @@ program
185
183
  .addOption(new Option('--mode <mode>', 'Test mode').choices(['interpreter', 'wasi']).default('interpreter'))
186
184
  .option('-w, --watch', 'Enable watch mode')
187
185
  .action(async (filter, options) => {
188
- await installAll({ silent: true, lockfile: 'ignore' });
186
+ await installAll({ silent: true, lock: 'ignore' });
189
187
  await test(filter, options);
190
188
  });
191
189
  // bench
192
190
  program
193
191
  .command('bench [filter]')
194
192
  .description('Run benchmarks')
193
+ .addOption(new Option('--replica <replica>', 'Which replica to use to run benchmarks').choices(['dfx', 'pocket-ic']).default('dfx'))
194
+ .addOption(new Option('--gc <gc>', 'Garbage collector').choices(['copying', 'compacting', 'generational', 'incremental']).default('copying'))
195
195
  .addOption(new Option('--save', 'Save benchmark results to .bench/<filename>.json'))
196
196
  .addOption(new Option('--compare', 'Run benchmark and compare results with .bench/<filename>.json'))
197
- .addOption(new Option('--gc <gc>', 'Garbage collector').choices(['copying', 'compacting', 'generational', 'incremental']).default('incremental'))
198
197
  // .addOption(new Option('--force-gc', 'Force GC'))
199
198
  .addOption(new Option('--verbose', 'Show more information'))
200
199
  .action(async (filter, options) => {
201
- await installAll({ silent: true, lockfile: 'ignore' });
200
+ await installAll({ silent: true, lock: 'ignore' });
202
201
  await bench(filter, options);
203
202
  });
204
203
  // template
@@ -254,38 +253,6 @@ program
254
253
  await setUserProp(prop, value);
255
254
  }
256
255
  });
257
- // temp: airdrop
258
- program
259
- .command('airdrop <check|claim> [canister]')
260
- .action(async (sub, canister) => {
261
- let identity = await getIdentity();
262
- let main = await mainActor(identity);
263
- if (sub === 'check') {
264
- let amount = await main.getAirdropAmount();
265
- if (amount === 0n) {
266
- console.log('No airdrop available');
267
- return;
268
- }
269
- console.log(`You can claim ${Number(amount) / 1000000000000} TCycles`);
270
- }
271
- else if (sub === 'claim') {
272
- let principal;
273
- try {
274
- principal = Principal.fromText(canister);
275
- }
276
- catch (err) {
277
- console.log('Invalid canister id');
278
- console.log(err);
279
- return;
280
- }
281
- console.log('Sending cycles to the canister ' + canister);
282
- let res = await main.claimAirdrop(principal);
283
- console.log(res);
284
- }
285
- else {
286
- console.log('Unknown sub command. Available sub commands: check, claim');
287
- }
288
- });
289
256
  // bump
290
257
  program
291
258
  .command('bump [major|minor|patch]')
@@ -297,7 +264,7 @@ program
297
264
  program
298
265
  .command('sync')
299
266
  .description('Add missing packages and remove unused packages')
300
- .addOption(new Option('--lockfile <lockfile>', 'Lockfile action').choices(['save', 'ignore']))
267
+ .addOption(new Option('--lock <action>', 'Lockfile action').choices(['update', 'ignore']))
301
268
  .action(async (options) => {
302
269
  await sync(options);
303
270
  });
@@ -312,7 +279,7 @@ program
312
279
  program
313
280
  .command('update [pkg]')
314
281
  .description('Update dependencies specified in mops.toml')
315
- .addOption(new Option('--lockfile <lockfile>', 'Lockfile action').choices(['save', 'ignore']))
282
+ .addOption(new Option('--lock <action>', 'Lockfile action').choices(['update', 'ignore']))
316
283
  .action(async (pkg, options) => {
317
284
  await update(pkg, options);
318
285
  });
@@ -1,7 +1,7 @@
1
1
  type AddOptions = {
2
2
  verbose?: boolean;
3
3
  dev?: boolean;
4
- lockfile?: 'save' | 'ignore';
4
+ lock?: 'update' | 'ignore';
5
5
  };
6
- export declare function add(name: string, { verbose, dev, lockfile }?: AddOptions, asName?: string): Promise<void>;
6
+ export declare function add(name: string, { verbose, dev, lock }?: AddOptions, asName?: string): Promise<void>;
7
7
  export {};
@@ -6,8 +6,9 @@ import { getHighestVersion } from '../api/getHighestVersion.js';
6
6
  import { installFromGithub } from '../vessel.js';
7
7
  import { install } from './install.js';
8
8
  import { notifyInstalls } from '../notify-installs.js';
9
+ import { checkIntegrity } from '../integrity.js';
9
10
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
10
- export async function add(name, { verbose = false, dev = false, lockfile } = {}, asName) {
11
+ export async function add(name, { verbose = false, dev = false, lock } = {}, asName) {
11
12
  if (!checkConfigFile()) {
12
13
  return;
13
14
  }
@@ -90,10 +91,12 @@ export async function add(name, { verbose = false, dev = false, lockfile } = {},
90
91
  throw Error(`Invalid config file: [${depsProp}] not found`);
91
92
  }
92
93
  writeConfig(config);
93
- // logUpdate('Checking integrity...');
94
+ if (lock !== 'ignore') {
95
+ logUpdate('Checking integrity...');
96
+ }
94
97
  await Promise.all([
95
98
  notifyInstalls(Object.keys(installedPackages)),
96
- // checkIntegrity(lockfile),
99
+ checkIntegrity(lock),
97
100
  ]);
98
101
  logUpdate.clear();
99
102
  console.log(chalk.green('Package installed ') + `${pkgDetails.name} = "${pkgDetails.repo || pkgDetails.path || pkgDetails.version}"`);
@@ -0,0 +1,32 @@
1
+ import { PocketIc } from '@hadronous/pic';
2
+ export declare class BenchReplica {
3
+ type: 'dfx' | 'pocket-ic';
4
+ verbose: boolean;
5
+ canisters: Record<string, {
6
+ cwd: string;
7
+ canisterId: string;
8
+ actor: any;
9
+ }>;
10
+ pocketIc?: PocketIc;
11
+ constructor(type: 'dfx' | 'pocket-ic', verbose?: boolean);
12
+ start(): Promise<void>;
13
+ stop(): Promise<void>;
14
+ deploy(name: string, wasm: string, cwd?: string): Promise<void>;
15
+ getActor(name: string): unknown;
16
+ getCanisterId(name: string): string;
17
+ dfxJson(canisterName: string): {
18
+ version: number;
19
+ canisters: Record<string, any>;
20
+ defaults: {
21
+ build: {
22
+ packtool: string;
23
+ };
24
+ };
25
+ networks: {
26
+ local: {
27
+ type: string;
28
+ bind: string;
29
+ };
30
+ };
31
+ };
32
+ }