ic-mops 0.32.2 → 0.34.0-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 (46) hide show
  1. package/.npmrc +1 -0
  2. package/cli.ts +10 -5
  3. package/commands/add.ts +15 -2
  4. package/commands/install-all.ts +15 -2
  5. package/commands/install.ts +27 -52
  6. package/commands/remove.ts +12 -1
  7. package/commands/search.ts +1 -2
  8. package/commands/sync.ts +34 -27
  9. package/commands/test/test.ts +7 -1
  10. package/commands/update.ts +10 -1
  11. package/declarations/main/main.did +40 -0
  12. package/declarations/main/main.did.d.ts +26 -0
  13. package/declarations/main/main.did.js +35 -0
  14. package/dist/cli.js +10 -5
  15. package/dist/commands/add.d.ts +7 -4
  16. package/dist/commands/add.js +7 -2
  17. package/dist/commands/install-all.d.ts +7 -4
  18. package/dist/commands/install-all.js +9 -2
  19. package/dist/commands/install.js +23 -46
  20. package/dist/commands/remove.d.ts +8 -5
  21. package/dist/commands/remove.js +3 -1
  22. package/dist/commands/search.js +1 -2
  23. package/dist/commands/sync.d.ts +5 -1
  24. package/dist/commands/sync.js +23 -21
  25. package/dist/commands/test/test.js +7 -1
  26. package/dist/commands/update.d.ts +7 -1
  27. package/dist/commands/update.js +3 -1
  28. package/dist/declarations/main/main.did +40 -0
  29. package/dist/declarations/main/main.did.d.ts +26 -0
  30. package/dist/declarations/main/main.did.js +35 -0
  31. package/dist/helpers/download-package-files.d.ts +12 -0
  32. package/dist/helpers/download-package-files.js +62 -0
  33. package/dist/helpers/resolve-version.d.ts +1 -0
  34. package/dist/helpers/resolve-version.js +11 -0
  35. package/dist/integrity.d.ts +5 -0
  36. package/dist/integrity.js +155 -0
  37. package/dist/mops.d.ts +2 -0
  38. package/dist/mops.js +2 -0
  39. package/dist/package.json +2 -1
  40. package/dist/vessel.js +2 -2
  41. package/helpers/download-package-files.ts +78 -0
  42. package/helpers/resolve-version.ts +12 -0
  43. package/integrity.ts +188 -0
  44. package/mops.ts +4 -1
  45. package/package.json +2 -1
  46. package/vessel.ts +2 -2
package/dist/cli.js CHANGED
@@ -43,6 +43,7 @@ program
43
43
  .description('Install the package and save it to mops.toml')
44
44
  .option('--dev')
45
45
  .option('--verbose')
46
+ .addOption(new Option('--lockfile <lockfile>', 'Lockfile action').choices(['save', 'ignore']))
46
47
  .action(async (pkg, options) => {
47
48
  if (!checkConfigFile()) {
48
49
  process.exit(1);
@@ -57,6 +58,7 @@ program
57
58
  .option('--dev', 'Remove from dev-dependencies instead of dependencies')
58
59
  .option('--verbose', 'Show more information')
59
60
  .option('--dry-run', 'Do not actually remove anything')
61
+ .addOption(new Option('--lockfile <lockfile>', 'Lockfile action').choices(['save', 'ignore']))
60
62
  .action(async (pkg, options) => {
61
63
  if (!checkConfigFile()) {
62
64
  process.exit(1);
@@ -69,6 +71,7 @@ program
69
71
  .alias('i')
70
72
  .description('Install all dependencies specified in mops.toml')
71
73
  .option('--verbose')
74
+ .addOption(new Option('--lockfile <lockfile>', 'Lockfile action').choices(['save', 'check', 'ignore']))
72
75
  .action(async (pkg, options) => {
73
76
  if (!checkConfigFile()) {
74
77
  process.exit(1);
@@ -136,7 +139,7 @@ program
136
139
  if (!checkConfigFile()) {
137
140
  process.exit(1);
138
141
  }
139
- await installAll({ silent: true });
142
+ await installAll({ silent: true, lockfile: 'ignore' });
140
143
  let sourcesArr = await sources(options);
141
144
  console.log(sourcesArr.join('\n'));
142
145
  });
@@ -286,8 +289,9 @@ program
286
289
  program
287
290
  .command('sync')
288
291
  .description('Add missing packages and remove unused packages')
289
- .action(async () => {
290
- await sync();
292
+ .addOption(new Option('--lockfile <lockfile>', 'Lockfile action').choices(['save', 'ignore']))
293
+ .action(async (options) => {
294
+ await sync(options);
291
295
  });
292
296
  // outdated
293
297
  program
@@ -300,8 +304,9 @@ program
300
304
  program
301
305
  .command('update [pkg]')
302
306
  .description('Update dependencies specified in mops.toml')
303
- .action(async (pkg) => {
304
- await update(pkg);
307
+ .addOption(new Option('--lockfile <lockfile>', 'Lockfile action').choices(['save', 'ignore']))
308
+ .action(async (pkg, options) => {
309
+ await update(pkg, options);
305
310
  });
306
311
  // transfer-ownership
307
312
  program
@@ -1,4 +1,7 @@
1
- export declare function add(name: string, { verbose, dev }?: {
2
- verbose?: boolean | undefined;
3
- dev?: boolean | undefined;
4
- }): Promise<void>;
1
+ type AddOptions = {
2
+ verbose?: boolean;
3
+ dev?: boolean;
4
+ lockfile?: 'save' | 'ignore';
5
+ };
6
+ export declare function add(name: string, { verbose, dev, lockfile }?: AddOptions): Promise<void>;
7
+ export {};
@@ -5,7 +5,8 @@ import { checkConfigFile, getGithubCommit, getHighestVersion, parseGithubURL, re
5
5
  import { installFromGithub } from '../vessel.js';
6
6
  import { install } from './install.js';
7
7
  import { notifyInstalls } from '../notify-installs.js';
8
- export async function add(name, { verbose = false, dev = false } = {}) {
8
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
9
+ export async function add(name, { verbose = false, dev = false, lockfile } = {}) {
9
10
  if (!checkConfigFile()) {
10
11
  return;
11
12
  }
@@ -88,7 +89,11 @@ export async function add(name, { verbose = false, dev = false } = {}) {
88
89
  throw Error(`Invalid config file: [${depsProp}] not found`);
89
90
  }
90
91
  writeConfig(config);
91
- await notifyInstalls(Object.keys(installedPackages));
92
+ // logUpdate('Checking integrity...');
93
+ await Promise.all([
94
+ notifyInstalls(Object.keys(installedPackages)),
95
+ // checkIntegrity(lockfile),
96
+ ]);
92
97
  logUpdate.clear();
93
98
  console.log(chalk.green('Package installed ') + `${pkgDetails.name} = "${pkgDetails.repo || pkgDetails.path || pkgDetails.version}"`);
94
99
  }
@@ -1,4 +1,7 @@
1
- export declare function installAll({ verbose, silent }?: {
2
- verbose?: boolean | undefined;
3
- silent?: boolean | undefined;
4
- }): Promise<void>;
1
+ type InstallAllOptions = {
2
+ verbose?: boolean;
3
+ silent?: boolean;
4
+ lockfile?: 'save' | 'check' | 'ignore';
5
+ };
6
+ export declare function installAll({ verbose, silent, lockfile }?: InstallAllOptions): Promise<void>;
7
+ export {};
@@ -4,7 +4,8 @@ import { checkConfigFile, readConfig } from '../mops.js';
4
4
  import { install } from './install.js';
5
5
  import { installFromGithub } from '../vessel.js';
6
6
  import { notifyInstalls } from '../notify-installs.js';
7
- export async function installAll({ verbose = false, silent = false } = {}) {
7
+ import { checkIntegrity } from '../integrity.js';
8
+ export async function installAll({ verbose = false, silent = false, lockfile } = {}) {
8
9
  if (!checkConfigFile()) {
9
10
  return;
10
11
  }
@@ -25,7 +26,13 @@ export async function installAll({ verbose = false, silent = false } = {}) {
25
26
  installedPackages = { ...installedPackages, ...res };
26
27
  }
27
28
  }
28
- await notifyInstalls(Object.keys(installedPackages));
29
+ if (!silent && lockfile !== 'ignore') {
30
+ logUpdate('Checking integrity...');
31
+ }
32
+ await Promise.all([
33
+ notifyInstalls(Object.keys(installedPackages)),
34
+ checkIntegrity(lockfile),
35
+ ]);
29
36
  if (!silent) {
30
37
  logUpdate.clear();
31
38
  console.log(chalk.green('All packages installed'));
@@ -2,10 +2,11 @@ import path from 'node:path';
2
2
  import fs from 'node:fs';
3
3
  import logUpdate from 'log-update';
4
4
  import chalk from 'chalk';
5
- import { checkConfigFile, formatDir, getHighestVersion, mainActor, progressBar, readConfig, storageActor } from '../mops.js';
5
+ import { checkConfigFile, formatDir, getHighestVersion, progressBar, readConfig, storageActor } from '../mops.js';
6
6
  import { parallel } from '../parallel.js';
7
7
  import { installFromGithub } from '../vessel.js';
8
8
  import { addCache, copyCache, isCached } from '../cache.js';
9
+ import { downloadFile, getPackageFilesInfo } from '../helpers/download-package-files.js';
9
10
  export async function install(pkg, version = '', { verbose = false, silent = false, dep = false } = {}) {
10
11
  if (!checkConfigFile()) {
11
12
  return false;
@@ -27,7 +28,6 @@ export async function install(pkg, version = '', { verbose = false, silent = fal
27
28
  version = versionRes.ok;
28
29
  }
29
30
  let dir = formatDir(pkg, version);
30
- let actor = await mainActor();
31
31
  let alreadyInstalled = false;
32
32
  // already installed
33
33
  if (fs.existsSync(dir)) {
@@ -41,53 +41,30 @@ export async function install(pkg, version = '', { verbose = false, silent = fal
41
41
  }
42
42
  // download
43
43
  else {
44
- let [packageDetailsRes, filesIdsRes] = await Promise.all([
45
- actor.getPackageDetails(pkg, version),
46
- actor.getFileIds(pkg, version),
47
- ]);
48
- if ('err' in packageDetailsRes) {
49
- console.log(chalk.red('Error: ') + packageDetailsRes.err);
50
- return false;
51
- }
52
- let packageDetails = packageDetailsRes.ok;
53
- if ('err' in filesIdsRes) {
54
- console.log(chalk.red('Error: ') + filesIdsRes.err);
55
- return false;
56
- }
57
- let filesIds = filesIdsRes.ok;
58
- total = filesIds.length + 2;
59
- let storage = await storageActor(packageDetails.publication.storage);
60
- // download files
61
- let filesData = new Map;
62
44
  let threads = 16;
63
45
  // GitHub Actions fails with "fetch failed" if there are multiple concurrent actions
64
46
  if (process.env.GITHUB_ENV) {
65
47
  threads = 4;
66
48
  }
67
- await parallel(threads, filesIds, async (fileId) => {
68
- let fileMetaRes = await storage.getFileMeta(fileId);
69
- if ('err' in fileMetaRes) {
70
- console.log(chalk.red('ERR: ') + fileMetaRes.err);
71
- return;
49
+ try {
50
+ let { storageId, fileIds } = await getPackageFilesInfo(pkg, version);
51
+ total = fileIds.length + 2;
52
+ let filesData = new Map;
53
+ let storage = await storageActor(storageId);
54
+ await parallel(threads, fileIds, async (fileId) => {
55
+ let { path, data } = await downloadFile(storage, fileId);
56
+ filesData.set(path, data);
57
+ progress();
58
+ });
59
+ // write files to disk
60
+ for (let [filePath, data] of filesData.entries()) {
61
+ fs.mkdirSync(path.join(dir, path.dirname(filePath)), { recursive: true });
62
+ fs.writeFileSync(path.join(dir, filePath), Buffer.from(data));
72
63
  }
73
- let fileMeta = fileMetaRes.ok;
74
- let buffer = Buffer.from([]);
75
- for (let i = 0n; i < fileMeta.chunkCount; i++) {
76
- let chunkRes = await storage.downloadChunk(fileId, i);
77
- if ('err' in chunkRes) {
78
- console.log(chalk.red('ERR: ') + chunkRes.err);
79
- return;
80
- }
81
- let chunk = chunkRes.ok;
82
- buffer = Buffer.concat([buffer, Buffer.from(chunk)]);
83
- }
84
- filesData.set(fileMeta.path, buffer);
85
- progress();
86
- });
87
- // write files to disk
88
- for (let [filePath, buffer] of filesData.entries()) {
89
- fs.mkdirSync(path.join(dir, path.dirname(filePath)), { recursive: true });
90
- fs.writeFileSync(path.join(dir, filePath), buffer);
64
+ }
65
+ catch (err) {
66
+ console.error(chalk.red('Error: ') + err);
67
+ return false;
91
68
  }
92
69
  // add to cache
93
70
  await addCache(`${pkg}@${version}`, dir);
@@ -118,8 +95,8 @@ export async function install(pkg, version = '', { verbose = false, silent = fal
118
95
  if (!alreadyInstalled) {
119
96
  installedDeps = { ...installedDeps, [pkg]: version };
120
97
  }
121
- if (ok) {
122
- return installedDeps;
98
+ if (!ok) {
99
+ return false;
123
100
  }
124
- return false;
101
+ return installedDeps;
125
102
  }
@@ -1,5 +1,8 @@
1
- export declare function remove(name: string, { dev, verbose, dryRun }?: {
2
- dev?: boolean | undefined;
3
- verbose?: boolean | undefined;
4
- dryRun?: boolean | undefined;
5
- }): Promise<void>;
1
+ type RemoveOptions = {
2
+ verbose?: boolean;
3
+ dev?: boolean;
4
+ dryRun?: boolean;
5
+ lockfile?: 'save' | 'ignore';
6
+ };
7
+ export declare function remove(name: string, { dev, verbose, dryRun, lockfile }?: RemoveOptions): Promise<void>;
8
+ export {};
@@ -2,7 +2,8 @@ import fs from 'node:fs';
2
2
  import { deleteSync } from 'del';
3
3
  import chalk from 'chalk';
4
4
  import { formatDir, formatGithubDir, checkConfigFile, readConfig, writeConfig } from '../mops.js';
5
- export async function remove(name, { dev = false, verbose = false, dryRun = false } = {}) {
5
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
6
+ export async function remove(name, { dev = false, verbose = false, dryRun = false, lockfile } = {}) {
6
7
  if (!checkConfigFile()) {
7
8
  return;
8
9
  }
@@ -79,5 +80,6 @@ export async function remove(name, { dev = false, verbose = false, dryRun = fals
79
80
  delete config['dev-dependencies'][name];
80
81
  }
81
82
  dryRun || writeConfig(config);
83
+ // await checkIntegrity(lockfile);
82
84
  console.log(chalk.green('Package removed ') + `${name} = "${version}"`);
83
85
  }
@@ -3,8 +3,7 @@ import chalk from 'chalk';
3
3
  import { mainActor } from '../mops.js';
4
4
  export async function search(text) {
5
5
  let actor = await mainActor();
6
- let res = await actor.search(text, [], []);
7
- let packages = res[0];
6
+ let [packages, _pageCount] = await actor.search(text, [], []);
8
7
  if (!packages.length) {
9
8
  console.log('Packages not found');
10
9
  return;
@@ -1 +1,5 @@
1
- export declare function sync(): Promise<void>;
1
+ type SyncOptions = {
2
+ lockfile?: 'save' | 'ignore';
3
+ };
4
+ export declare function sync({ lockfile }?: SyncOptions): Promise<void>;
5
+ export {};
@@ -5,6 +5,29 @@ import chalk from 'chalk';
5
5
  import { checkConfigFile, getRootDir, readConfig } from '../mops.js';
6
6
  import { add } from './add.js';
7
7
  import { remove } from './remove.js';
8
+ import { checkIntegrity } from '../integrity.js';
9
+ export async function sync({ lockfile } = {}) {
10
+ if (!checkConfigFile()) {
11
+ return;
12
+ }
13
+ let missing = await getMissingPackages();
14
+ let unused = await getUnusedPackages();
15
+ missing.length && console.log(`${chalk.yellow('Missing packages:')} ${missing.join(', ')}`);
16
+ unused.length && console.log(`${chalk.yellow('Unused packages:')} ${unused.join(', ')}`);
17
+ let config = readConfig();
18
+ let deps = new Set(Object.keys(config.dependencies || {}));
19
+ let devDeps = new Set(Object.keys(config['dev-dependencies'] || {}));
20
+ // add missing packages
21
+ for (let pkg of missing) {
22
+ await add(pkg, { lockfile: 'ignore' });
23
+ }
24
+ // remove unused packages
25
+ for (let pkg of unused) {
26
+ let dev = devDeps.has(pkg) && !deps.has(pkg);
27
+ await remove(pkg, { dev, lockfile: 'ignore' });
28
+ }
29
+ await checkIntegrity(lockfile);
30
+ }
8
31
  let ignore = [
9
32
  '**/node_modules/**',
10
33
  '**/.vessel/**',
@@ -63,24 +86,3 @@ async function getUnusedPackages() {
63
86
  }
64
87
  return [...allDeps];
65
88
  }
66
- export async function sync() {
67
- if (!checkConfigFile()) {
68
- return;
69
- }
70
- let missing = await getMissingPackages();
71
- let unused = await getUnusedPackages();
72
- missing.length && console.log(`${chalk.yellow('Missing packages:')} ${missing.join(', ')}`);
73
- unused.length && console.log(`${chalk.yellow('Unused packages:')} ${unused.join(', ')}`);
74
- let config = readConfig();
75
- let deps = new Set(Object.keys(config.dependencies || {}));
76
- let devDeps = new Set(Object.keys(config['dev-dependencies'] || {}));
77
- // add missing packages
78
- for (let pkg of missing) {
79
- await add(pkg);
80
- }
81
- // remove unused packages
82
- for (let pkg of unused) {
83
- let dev = devDeps.has(pkg) && !deps.has(pkg);
84
- await remove(pkg, { dev });
85
- }
86
- }
@@ -123,7 +123,13 @@ export async function testWithReporter(reporter, filter = '', mode = 'interprete
123
123
  return;
124
124
  }
125
125
  // run
126
- let proc = spawn('wasmtime', ['--max-wasm-stack=2000000', wasmFile]);
126
+ let proc = spawn('wasmtime', [
127
+ '--max-wasm-stack=2000000',
128
+ '--enable-cranelift-nan-canonicalization',
129
+ '--wasm-features',
130
+ 'multi-memory,bulk-memory',
131
+ wasmFile,
132
+ ]);
127
133
  await pipeMMF(proc, mmf);
128
134
  }).finally(() => {
129
135
  fs.rmSync(wasmFile, { force: true });
@@ -1 +1,7 @@
1
- export declare function update(pkg?: string): Promise<void>;
1
+ type UpdateOptions = {
2
+ verbose?: boolean;
3
+ dev?: boolean;
4
+ lockfile?: 'save' | 'ignore';
5
+ };
6
+ export declare function update(pkg?: string, { lockfile }?: UpdateOptions): Promise<void>;
7
+ export {};
@@ -2,7 +2,8 @@ import chalk from 'chalk';
2
2
  import { checkConfigFile, getGithubCommit, parseGithubURL, readConfig } from '../mops.js';
3
3
  import { add } from './add.js';
4
4
  import { getAvailableUpdates } from './available-updates.js';
5
- export async function update(pkg) {
5
+ import { checkIntegrity } from '../integrity.js';
6
+ export async function update(pkg, { lockfile } = {}) {
6
7
  if (!checkConfigFile()) {
7
8
  return;
8
9
  }
@@ -42,4 +43,5 @@ export async function update(pkg) {
42
43
  await add(`${dep[0]}@${dep[2]}`, { dev });
43
44
  }
44
45
  }
46
+ await checkIntegrity(lockfile);
45
47
  }
@@ -73,6 +73,14 @@ type Script =
73
73
  name: text;
74
74
  value: text;
75
75
  };
76
+ type Result_8 =
77
+ variant {
78
+ err: Err;
79
+ ok: vec record {
80
+ FileId;
81
+ blob;
82
+ };
83
+ };
76
84
  type Result_7 =
77
85
  variant {
78
86
  err: Err;
@@ -145,6 +153,7 @@ type PackageSummary__1 =
145
153
  owner: principal;
146
154
  ownerInfo: User;
147
155
  publication: PackagePublication;
156
+ quality: PackageQuality;
148
157
  };
149
158
  type PackageSummaryWithChanges__1 =
150
159
  record {
@@ -156,6 +165,7 @@ type PackageSummaryWithChanges__1 =
156
165
  owner: principal;
157
166
  ownerInfo: User;
158
167
  publication: PackagePublication;
168
+ quality: PackageQuality;
159
169
  };
160
170
  type PackageSummaryWithChanges =
161
171
  record {
@@ -167,6 +177,7 @@ type PackageSummaryWithChanges =
167
177
  owner: principal;
168
178
  ownerInfo: User;
169
179
  publication: PackagePublication;
180
+ quality: PackageQuality;
170
181
  };
171
182
  type PackageSummary =
172
183
  record {
@@ -177,6 +188,18 @@ type PackageSummary =
177
188
  owner: principal;
178
189
  ownerInfo: User;
179
190
  publication: PackagePublication;
191
+ quality: PackageQuality;
192
+ };
193
+ type PackageQuality =
194
+ record {
195
+ depsStatus: DepsStatus;
196
+ hasDescription: bool;
197
+ hasDocumentation: bool;
198
+ hasKeywords: bool;
199
+ hasLicense: bool;
200
+ hasReleaseNotes: bool;
201
+ hasRepository: bool;
202
+ hasTests: bool;
180
203
  };
181
204
  type PackagePublication =
182
205
  record {
@@ -207,6 +230,7 @@ type PackageDetails =
207
230
  owner: principal;
208
231
  ownerInfo: User;
209
232
  publication: PackagePublication;
233
+ quality: PackageQuality;
210
234
  testStats: TestStats__1;
211
235
  versionHistory: vec PackageSummaryWithChanges__1;
212
236
  };
@@ -281,6 +305,12 @@ type DownloadsSnapshot =
281
305
  endTime: Time;
282
306
  startTime: Time;
283
307
  };
308
+ type DepsStatus =
309
+ variant {
310
+ allLatest;
311
+ tooOld;
312
+ updatesAvailable;
313
+ };
284
314
  type DependencyV2 =
285
315
  record {
286
316
  name: PackageName__1;
@@ -296,6 +326,7 @@ type DepChange =
296
326
  service : {
297
327
  backup: () -> ();
298
328
  claimAirdrop: (principal) -> (text);
329
+ computeHashesForExistingFiles: () -> ();
299
330
  diff: (text, text) -> (PackageChanges__1) query;
300
331
  finishPublish: (PublishingId) -> (Result);
301
332
  getAirdropAmount: () -> (nat) query;
@@ -311,6 +342,15 @@ service : {
311
342
  (vec DownloadsSnapshot__1) query;
312
343
  getDownloadTrendByPackageName: (PackageName) ->
313
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
+ });
314
354
  getFileIds: (PackageName, PackageVersion) -> (Result_7) query;
315
355
  getHighestSemverBatch:
316
356
  (vec record {
@@ -11,6 +11,9 @@ export interface DependencyV2 {
11
11
  'repo' : string,
12
12
  'version' : string,
13
13
  }
14
+ export type DepsStatus = { 'allLatest' : null } |
15
+ { 'tooOld' : null } |
16
+ { 'updatesAvailable' : null };
14
17
  export interface DownloadsSnapshot {
15
18
  'startTime' : Time,
16
19
  'endTime' : Time,
@@ -76,6 +79,7 @@ export interface PackageDetails {
76
79
  'ownerInfo' : User,
77
80
  'owner' : Principal,
78
81
  'deps' : Array<PackageSummary__1>,
82
+ 'quality' : PackageQuality,
79
83
  'testStats' : TestStats__1,
80
84
  'downloadsTotal' : bigint,
81
85
  'downloadsInLast30Days' : bigint,
@@ -101,9 +105,20 @@ export interface PackagePublication {
101
105
  'time' : Time,
102
106
  'user' : Principal,
103
107
  }
108
+ export interface PackageQuality {
109
+ 'depsStatus' : DepsStatus,
110
+ 'hasDescription' : boolean,
111
+ 'hasKeywords' : boolean,
112
+ 'hasLicense' : boolean,
113
+ 'hasDocumentation' : boolean,
114
+ 'hasTests' : boolean,
115
+ 'hasRepository' : boolean,
116
+ 'hasReleaseNotes' : boolean,
117
+ }
104
118
  export interface PackageSummary {
105
119
  'ownerInfo' : User,
106
120
  'owner' : Principal,
121
+ 'quality' : PackageQuality,
107
122
  'downloadsTotal' : bigint,
108
123
  'downloadsInLast30Days' : bigint,
109
124
  'downloadsInLast7Days' : bigint,
@@ -113,6 +128,7 @@ export interface PackageSummary {
113
128
  export interface PackageSummaryWithChanges {
114
129
  'ownerInfo' : User,
115
130
  'owner' : Principal,
131
+ 'quality' : PackageQuality,
116
132
  'downloadsTotal' : bigint,
117
133
  'downloadsInLast30Days' : bigint,
118
134
  'downloadsInLast7Days' : bigint,
@@ -123,6 +139,7 @@ export interface PackageSummaryWithChanges {
123
139
  export interface PackageSummaryWithChanges__1 {
124
140
  'ownerInfo' : User,
125
141
  'owner' : Principal,
142
+ 'quality' : PackageQuality,
126
143
  'downloadsTotal' : bigint,
127
144
  'downloadsInLast30Days' : bigint,
128
145
  'downloadsInLast7Days' : bigint,
@@ -133,6 +150,7 @@ export interface PackageSummaryWithChanges__1 {
133
150
  export interface PackageSummary__1 {
134
151
  'ownerInfo' : User,
135
152
  'owner' : Principal,
153
+ 'quality' : PackageQuality,
136
154
  'downloadsTotal' : bigint,
137
155
  'downloadsInLast30Days' : bigint,
138
156
  'downloadsInLast7Days' : bigint,
@@ -173,6 +191,8 @@ export type Result_6 = { 'ok' : Array<[PackageName, PackageVersion]> } |
173
191
  { 'err' : Err };
174
192
  export type Result_7 = { 'ok' : Array<FileId> } |
175
193
  { 'err' : Err };
194
+ export type Result_8 = { 'ok' : Array<[FileId, Uint8Array | number[]]> } |
195
+ { 'err' : Err };
176
196
  export interface Script { 'value' : string, 'name' : string }
177
197
  export type SemverPart = { 'major' : null } |
178
198
  { 'minor' : null } |
@@ -233,6 +253,7 @@ export interface User__1 {
233
253
  export interface _SERVICE {
234
254
  'backup' : ActorMethod<[], undefined>,
235
255
  'claimAirdrop' : ActorMethod<[Principal], string>,
256
+ 'computeHashesForExistingFiles' : ActorMethod<[], undefined>,
236
257
  'diff' : ActorMethod<[string, string], PackageChanges__1>,
237
258
  'finishPublish' : ActorMethod<[PublishingId], Result>,
238
259
  'getAirdropAmount' : ActorMethod<[], bigint>,
@@ -251,6 +272,11 @@ export interface _SERVICE {
251
272
  [PackageName],
252
273
  Array<DownloadsSnapshot__1>
253
274
  >,
275
+ 'getFileHashes' : ActorMethod<[PackageName, PackageVersion], Result_8>,
276
+ 'getFileHashesByPackageIds' : ActorMethod<
277
+ [Array<PackageId>],
278
+ Array<[PackageId, Array<[FileId, Uint8Array | number[]]>]>
279
+ >,
254
280
  'getFileIds' : ActorMethod<[PackageName, PackageVersion], Result_7>,
255
281
  'getHighestSemverBatch' : ActorMethod<
256
282
  [Array<[PackageName, PackageVersion, SemverPart]>],
@@ -28,6 +28,10 @@ export const idlFactory = ({ IDL }) => {
28
28
  'downloads' : IDL.Nat,
29
29
  });
30
30
  const FileId = IDL.Text;
31
+ const Result_8 = IDL.Variant({
32
+ 'ok' : IDL.Vec(IDL.Tuple(FileId, IDL.Vec(IDL.Nat8))),
33
+ 'err' : Err,
34
+ });
31
35
  const Result_7 = IDL.Variant({ 'ok' : IDL.Vec(FileId), 'err' : Err });
32
36
  const SemverPart = IDL.Variant({
33
37
  'major' : IDL.Null,
@@ -51,6 +55,21 @@ export const idlFactory = ({ IDL }) => {
51
55
  'githubVerified' : IDL.Bool,
52
56
  'github' : IDL.Text,
53
57
  });
58
+ const DepsStatus = IDL.Variant({
59
+ 'allLatest' : IDL.Null,
60
+ 'tooOld' : IDL.Null,
61
+ 'updatesAvailable' : IDL.Null,
62
+ });
63
+ const PackageQuality = IDL.Record({
64
+ 'depsStatus' : DepsStatus,
65
+ 'hasDescription' : IDL.Bool,
66
+ 'hasKeywords' : IDL.Bool,
67
+ 'hasLicense' : IDL.Bool,
68
+ 'hasDocumentation' : IDL.Bool,
69
+ 'hasTests' : IDL.Bool,
70
+ 'hasRepository' : IDL.Bool,
71
+ 'hasReleaseNotes' : IDL.Bool,
72
+ });
54
73
  const Script = IDL.Record({ 'value' : IDL.Text, 'name' : IDL.Text });
55
74
  const PackageName__1 = IDL.Text;
56
75
  const DependencyV2 = IDL.Record({
@@ -84,6 +103,7 @@ export const idlFactory = ({ IDL }) => {
84
103
  const PackageSummary = IDL.Record({
85
104
  'ownerInfo' : User,
86
105
  'owner' : IDL.Principal,
106
+ 'quality' : PackageQuality,
87
107
  'downloadsTotal' : IDL.Nat,
88
108
  'downloadsInLast30Days' : IDL.Nat,
89
109
  'downloadsInLast7Days' : IDL.Nat,
@@ -93,6 +113,7 @@ export const idlFactory = ({ IDL }) => {
93
113
  const PackageSummary__1 = IDL.Record({
94
114
  'ownerInfo' : User,
95
115
  'owner' : IDL.Principal,
116
+ 'quality' : PackageQuality,
96
117
  'downloadsTotal' : IDL.Nat,
97
118
  'downloadsInLast30Days' : IDL.Nat,
98
119
  'downloadsInLast7Days' : IDL.Nat,
@@ -121,6 +142,7 @@ export const idlFactory = ({ IDL }) => {
121
142
  const PackageSummaryWithChanges__1 = IDL.Record({
122
143
  'ownerInfo' : User,
123
144
  'owner' : IDL.Principal,
145
+ 'quality' : PackageQuality,
124
146
  'downloadsTotal' : IDL.Nat,
125
147
  'downloadsInLast30Days' : IDL.Nat,
126
148
  'downloadsInLast7Days' : IDL.Nat,
@@ -132,6 +154,7 @@ export const idlFactory = ({ IDL }) => {
132
154
  'ownerInfo' : User,
133
155
  'owner' : IDL.Principal,
134
156
  'deps' : IDL.Vec(PackageSummary__1),
157
+ 'quality' : PackageQuality,
135
158
  'testStats' : TestStats__1,
136
159
  'downloadsTotal' : IDL.Nat,
137
160
  'downloadsInLast30Days' : IDL.Nat,
@@ -149,6 +172,7 @@ export const idlFactory = ({ IDL }) => {
149
172
  const PackageSummaryWithChanges = IDL.Record({
150
173
  'ownerInfo' : User,
151
174
  'owner' : IDL.Principal,
175
+ 'quality' : PackageQuality,
152
176
  'downloadsTotal' : IDL.Nat,
153
177
  'downloadsInLast30Days' : IDL.Nat,
154
178
  'downloadsInLast7Days' : IDL.Nat,
@@ -235,6 +259,7 @@ export const idlFactory = ({ IDL }) => {
235
259
  return IDL.Service({
236
260
  'backup' : IDL.Func([], [], []),
237
261
  'claimAirdrop' : IDL.Func([IDL.Principal], [IDL.Text], []),
262
+ 'computeHashesForExistingFiles' : IDL.Func([], [], []),
238
263
  'diff' : IDL.Func([IDL.Text, IDL.Text], [PackageChanges__1], ['query']),
239
264
  'finishPublish' : IDL.Func([PublishingId], [Result], []),
240
265
  'getAirdropAmount' : IDL.Func([], [IDL.Nat], ['query']),
@@ -256,6 +281,16 @@ export const idlFactory = ({ IDL }) => {
256
281
  [IDL.Vec(DownloadsSnapshot__1)],
257
282
  ['query'],
258
283
  ),
284
+ 'getFileHashes' : IDL.Func([PackageName, PackageVersion], [Result_8], []),
285
+ 'getFileHashesByPackageIds' : IDL.Func(
286
+ [IDL.Vec(PackageId)],
287
+ [
288
+ IDL.Vec(
289
+ IDL.Tuple(PackageId, IDL.Vec(IDL.Tuple(FileId, IDL.Vec(IDL.Nat8))))
290
+ ),
291
+ ],
292
+ [],
293
+ ),
259
294
  'getFileIds' : IDL.Func(
260
295
  [PackageName, PackageVersion],
261
296
  [Result_7],