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
@@ -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 []; };
@@ -1,5 +1,5 @@
1
- export declare function checkIntegrity(lock?: 'save' | 'check' | 'ignore'): Promise<void>;
1
+ export declare function checkIntegrity(lock?: 'check' | 'update' | 'ignore'): Promise<void>;
2
2
  export declare function getLocalFileHash(fileId: string): string;
3
3
  export declare function checkRemote(): Promise<void>;
4
- export declare function saveLockFile(): Promise<void>;
4
+ export declare function updateLockFile(): Promise<void>;
5
5
  export declare function checkLockFile(force?: boolean): Promise<void>;
package/dist/integrity.js CHANGED
@@ -8,13 +8,13 @@ import { resolvePackages } from './resolve-packages.js';
8
8
  export async function checkIntegrity(lock) {
9
9
  let force = !!lock;
10
10
  if (!lock && !process.env['CI'] && fs.existsSync(path.join(getRootDir(), 'mops.lock'))) {
11
- lock = 'save';
11
+ lock = 'update';
12
12
  }
13
13
  if (!lock) {
14
14
  lock = process.env['CI'] ? 'check' : 'ignore';
15
15
  }
16
- if (lock === 'save') {
17
- await saveLockFile();
16
+ if (lock === 'update') {
17
+ await updateLockFile();
18
18
  await checkLockFile(force);
19
19
  }
20
20
  else if (lock === 'check') {
@@ -64,7 +64,7 @@ export async function checkRemote() {
64
64
  }
65
65
  }
66
66
  }
67
- export async function saveLockFile() {
67
+ export async function updateLockFile() {
68
68
  let rootDir = getRootDir();
69
69
  let lockFile = path.join(rootDir, 'mops.lock');
70
70
  // if lock file exists and mops.toml hasn't changed, don't update it
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env tsx
2
+ export {};
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env tsx
2
+ import { execSync } from 'child_process';
3
+ try {
4
+ execSync('/home/zen/.cache/mocv/versions/current/moc ' + process.argv.slice(2).join(' '), { cwd: process.cwd(), stdio: 'inherit' });
5
+ }
6
+ catch (err) {
7
+ process.exit(err.code || 1);
8
+ }
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};