ic-mops 0.34.4 → 0.35.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.
- package/cli.ts +9 -44
- package/commands/add.ts +7 -5
- package/commands/install-all.ts +4 -4
- package/commands/remove.ts +4 -4
- package/commands/sync.ts +5 -5
- package/commands/update.ts +3 -3
- package/declarations/main/main.did +67 -78
- package/declarations/main/main.did.d.ts +72 -83
- package/declarations/main/main.did.js +12 -23
- package/dist/bin/mops.d.ts +2 -0
- package/dist/bin/mops.js +2 -0
- package/dist/cli.js +9 -43
- package/dist/commands/add.d.ts +2 -2
- package/dist/commands/add.js +6 -3
- package/dist/commands/install-all.d.ts +2 -2
- package/dist/commands/install-all.js +3 -3
- package/dist/commands/remove.d.ts +2 -2
- package/dist/commands/remove.js +3 -2
- package/dist/commands/sync.d.ts +2 -2
- package/dist/commands/sync.js +4 -4
- package/dist/commands/toolchain/moc.d.ts +4 -0
- package/dist/commands/toolchain/moc.js +36 -0
- package/dist/commands/toolchain/mocv.d.ts +1 -0
- package/dist/commands/toolchain/mocv.js +272 -0
- package/dist/commands/toolchain/toolchain-utils.d.ts +3 -0
- package/dist/commands/toolchain/toolchain-utils.js +56 -0
- package/dist/commands/toolchain/wasmtime.d.ts +4 -0
- package/dist/commands/toolchain/wasmtime.js +23 -0
- package/dist/commands/update.d.ts +2 -2
- package/dist/commands/update.js +2 -2
- package/dist/declarations/main/main.did +67 -78
- package/dist/declarations/main/main.did.d.ts +72 -83
- package/dist/declarations/main/main.did.js +12 -23
- package/dist/integrity.d.ts +2 -2
- package/dist/integrity.js +4 -4
- package/dist/moc-wrapper.d.ts +2 -0
- package/dist/moc-wrapper.js +8 -0
- package/dist/out/cli.d.ts +2 -0
- package/dist/out/cli.js +115242 -0
- package/dist/package.json +1 -1
- package/dist/templates/cli.d.ts +2 -0
- package/dist/templates/cli.js +3660 -0
- package/integrity.ts +5 -5
- package/package.json +1 -1
- package/dist/helpers/download-package-files.d.ts +0 -12
- package/dist/helpers/download-package-files.js +0 -62
- package/dist/helpers/resolve-version.d.ts +0 -1
- package/dist/helpers/resolve-version.js +0 -11
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
import decompress from 'decompress';
|
|
4
|
+
import decompressTarxz from 'decomp-tarxz';
|
|
5
|
+
import { deleteSync } from 'del';
|
|
6
|
+
import { Octokit } from 'octokit';
|
|
7
|
+
import tar from 'tar';
|
|
8
|
+
import { getRootDir } from '../../mops.js';
|
|
9
|
+
export let downloadGithubRelease = async (url, dest) => {
|
|
10
|
+
let res = await fetch(url);
|
|
11
|
+
if (res.status !== 200) {
|
|
12
|
+
console.error(`ERROR ${res.status} ${url}`);
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
let arrayBuffer = await res.arrayBuffer();
|
|
16
|
+
let buffer = Buffer.from(arrayBuffer);
|
|
17
|
+
let tmpDir = path.join(getRootDir(), '.mops', '_tmp');
|
|
18
|
+
let archive = path.join(tmpDir, path.basename(url));
|
|
19
|
+
fs.mkdirSync(tmpDir, { recursive: true });
|
|
20
|
+
fs.writeFileSync(archive, buffer);
|
|
21
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
22
|
+
if (archive.endsWith('.xz')) {
|
|
23
|
+
await decompress(archive, dest, {
|
|
24
|
+
strip: 1,
|
|
25
|
+
plugins: [decompressTarxz()],
|
|
26
|
+
}).catch(() => {
|
|
27
|
+
deleteSync([tmpDir]);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
await tar.extract({
|
|
32
|
+
file: archive,
|
|
33
|
+
cwd: dest,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
deleteSync([tmpDir], { force: true });
|
|
37
|
+
};
|
|
38
|
+
export let getLatestReleaseTag = async (repo) => {
|
|
39
|
+
let releases = await getReleases(repo);
|
|
40
|
+
let release = releases.find((release) => !release.prerelease && !release.draft);
|
|
41
|
+
return release?.tag_name;
|
|
42
|
+
};
|
|
43
|
+
export let getReleases = async (repo) => {
|
|
44
|
+
let octokit = new Octokit;
|
|
45
|
+
let res = await octokit.request(`GET /repos/${repo}/releases`, {
|
|
46
|
+
per_page: 10,
|
|
47
|
+
headers: {
|
|
48
|
+
'X-GitHub-Api-Version': '2022-11-28'
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
if (res.status !== 200) {
|
|
52
|
+
console.log('Releases fetch error');
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
return res.data;
|
|
56
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
import { globalCacheDir } from '../../mops.js';
|
|
4
|
+
import { downloadGithubRelease } from './toolchain-utils.js';
|
|
5
|
+
let cacheDir = path.join(globalCacheDir, 'wasmtime');
|
|
6
|
+
export let isCached = (version) => {
|
|
7
|
+
let dir = path.join(cacheDir, version);
|
|
8
|
+
return fs.existsSync(dir) && fs.existsSync(path.join(dir, 'wasmtime'));
|
|
9
|
+
};
|
|
10
|
+
export let download = async (version, { silent = false } = {}) => {
|
|
11
|
+
if (!version) {
|
|
12
|
+
console.error('version is not defined');
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
if (isCached(version)) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
let platfrom = process.platform == 'darwin' ? 'macos' : 'linux';
|
|
19
|
+
let arch = process.arch.startsWith('arm') ? 'aarch64' : 'x86_64';
|
|
20
|
+
let url = `https://github.com/bytecodealliance/wasmtime/releases/download/v${version}/wasmtime-v${version}-${arch}-${platfrom}.tar.xz`;
|
|
21
|
+
silent || console.log(`Downloading ${url}`);
|
|
22
|
+
await downloadGithubRelease(url, path.join(cacheDir, version));
|
|
23
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
type UpdateOptions = {
|
|
2
2
|
verbose?: boolean;
|
|
3
3
|
dev?: boolean;
|
|
4
|
-
|
|
4
|
+
lock?: 'update' | 'ignore';
|
|
5
5
|
};
|
|
6
|
-
export declare function update(pkg?: string, {
|
|
6
|
+
export declare function update(pkg?: string, { lock }?: UpdateOptions): Promise<void>;
|
|
7
7
|
export {};
|
package/dist/commands/update.js
CHANGED
|
@@ -3,7 +3,7 @@ import { checkConfigFile, getGithubCommit, parseGithubURL, readConfig } from '..
|
|
|
3
3
|
import { add } from './add.js';
|
|
4
4
|
import { getAvailableUpdates } from './available-updates.js';
|
|
5
5
|
import { checkIntegrity } from '../integrity.js';
|
|
6
|
-
export async function update(pkg, {
|
|
6
|
+
export async function update(pkg, { lock } = {}) {
|
|
7
7
|
if (!checkConfigFile()) {
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
@@ -43,5 +43,5 @@ export async function update(pkg, { lockfile } = {}) {
|
|
|
43
43
|
await add(`${dep[0]}@${dep[2]}`, { dev });
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
await checkIntegrity(
|
|
46
|
+
await checkIntegrity(lock);
|
|
47
47
|
}
|
|
@@ -111,7 +111,7 @@ type Result_3 =
|
|
|
111
111
|
};
|
|
112
112
|
type Result_2 =
|
|
113
113
|
variant {
|
|
114
|
-
err:
|
|
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
|
|
31
|
-
'
|
|
32
|
-
'
|
|
33
|
-
'
|
|
34
|
-
'
|
|
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
|
|
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' :
|
|
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
|
|
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
|
-
|
|
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 []; };
|
package/dist/integrity.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare function checkIntegrity(lock?: '
|
|
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
|
|
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 = '
|
|
11
|
+
lock = 'update';
|
|
12
12
|
}
|
|
13
13
|
if (!lock) {
|
|
14
14
|
lock = process.env['CI'] ? 'check' : 'ignore';
|
|
15
15
|
}
|
|
16
|
-
if (lock === '
|
|
17
|
-
await
|
|
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
|
|
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
|