ic-mops 0.39.2 → 0.41.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/.DS_Store +0 -0
- package/.eslintrc.json +0 -0
- package/.gitignore +1 -0
- package/.npmrc +2 -1
- package/CHANGELOG.md +8 -0
- package/DEVELOPMENT.md +25 -0
- package/README.md +0 -0
- package/api/actors.ts +2 -2
- package/api/downloadPackageFiles.ts +9 -6
- package/api/getHighestVersion.ts +1 -1
- package/api/index.ts +0 -0
- package/api/network.ts +1 -1
- package/api/resolveVersion.ts +1 -1
- package/bundle/bench/bench-canister.mo +87 -0
- package/bundle/bench/user-bench.mo +14 -0
- package/bundle/bin/moc-wrapper.sh +3 -0
- package/bundle/bin/mops.js +3 -0
- package/bundle/cli.js +88 -0
- package/bundle/cli.tgz +0 -0
- package/bundle/declarations/bench/bench.did +26 -0
- package/bundle/declarations/bench/bench.did.d.ts +29 -0
- package/bundle/declarations/bench/bench.did.js +26 -0
- package/bundle/declarations/bench/index.d.ts +50 -0
- package/bundle/declarations/bench/index.js +41 -0
- package/bundle/declarations/main/index.d.ts +50 -0
- package/bundle/declarations/main/index.js +41 -0
- package/bundle/declarations/main/main.did +426 -0
- package/bundle/declarations/main/main.did.d.ts +352 -0
- package/bundle/declarations/main/main.did.js +404 -0
- package/bundle/declarations/storage/index.d.ts +50 -0
- package/bundle/declarations/storage/index.js +30 -0
- package/bundle/declarations/storage/storage.did +46 -0
- package/bundle/declarations/storage/storage.did.d.ts +37 -0
- package/bundle/declarations/storage/storage.did.js +38 -0
- package/bundle/package.json +31 -0
- package/bundle/templates/README.md +13 -0
- package/bundle/templates/licenses/Apache-2.0 +202 -0
- package/bundle/templates/licenses/Apache-2.0-NOTICE +13 -0
- package/bundle/templates/licenses/MIT +21 -0
- package/bundle/templates/mops-publish.yml +17 -0
- package/bundle/templates/mops-test.yml +22 -0
- package/bundle/templates/src/lib.mo +15 -0
- package/bundle/templates/test/lib.test.mo +4 -0
- package/bundle-package-json.ts +14 -0
- package/cache.ts +3 -3
- package/cli.ts +25 -21
- package/commands/add.ts +6 -6
- package/commands/available-updates.ts +2 -2
- package/commands/bench/bench-canister.mo +0 -0
- package/commands/bench/user-bench.mo +0 -0
- package/commands/bench-replica.ts +10 -10
- package/commands/bench.ts +96 -56
- package/commands/bump.ts +2 -2
- package/commands/docs.ts +1 -1
- package/commands/import-identity.ts +2 -2
- package/commands/init.ts +9 -9
- package/commands/install-all.ts +4 -4
- package/commands/install-local.ts +1 -1
- package/commands/install.ts +2 -2
- package/commands/outdated.ts +0 -0
- package/commands/publish.ts +34 -35
- package/commands/remove.ts +8 -8
- package/commands/search.ts +2 -2
- package/commands/self.ts +75 -0
- package/commands/sources.ts +0 -0
- package/commands/sync.ts +8 -8
- package/commands/template.ts +11 -12
- package/commands/test/mmf1.ts +18 -18
- package/commands/test/reporters/compact-reporter.ts +5 -5
- package/commands/test/reporters/files-reporter.ts +3 -3
- package/commands/test/reporters/reporter.ts +3 -3
- package/commands/test/reporters/silent-reporter.ts +4 -4
- package/commands/test/reporters/verbose-reporter.ts +3 -3
- package/commands/test/test.ts +10 -10
- package/commands/test/utils.ts +1 -1
- package/commands/toolchain/index.ts +9 -9
- package/commands/toolchain/moc.ts +2 -2
- package/commands/toolchain/pocket-ic.ts +6 -31
- package/commands/toolchain/toolchain-utils.ts +11 -11
- package/commands/toolchain/wasmtime.ts +2 -2
- package/commands/transfer-ownership.ts +2 -2
- package/commands/update.ts +4 -4
- package/commands/user.ts +2 -2
- package/commands/whoami.ts +0 -0
- package/declarations/bench/bench.did.d.ts +3 -0
- package/declarations/main/main.did +27 -1
- package/declarations/main/main.did.d.ts +26 -1
- package/declarations/main/main.did.js +27 -1
- package/declarations/storage/index.d.ts +0 -0
- package/declarations/storage/index.js +0 -0
- package/declarations/storage/storage.did +0 -0
- package/declarations/storage/storage.did.d.ts +0 -0
- package/declarations/storage/storage.did.js +0 -0
- package/dist/api/downloadPackageFiles.d.ts +1 -1
- package/dist/api/downloadPackageFiles.js +4 -0
- package/dist/bin/moc-wrapper.sh +3 -0
- package/dist/bin/mops.d.ts +1 -1
- package/dist/bin/mops.js +2 -1
- package/dist/bundle-package-json.d.ts +1 -0
- package/dist/bundle-package-json.js +11 -0
- package/dist/check-requirements.d.ts +3 -0
- package/dist/check-requirements.js +39 -0
- package/dist/cli.js +19 -18
- package/dist/commands/bench/bench-canister.mo +0 -0
- package/dist/commands/bench/user-bench.mo +0 -0
- package/dist/commands/bench-replica.d.ts +3 -1
- package/dist/commands/bench-replica.js +2 -2
- package/dist/commands/bench.d.ts +5 -2
- package/dist/commands/bench.js +66 -29
- package/dist/commands/init.js +1 -1
- package/dist/commands/publish.d.ts +1 -0
- package/dist/commands/publish.js +25 -25
- package/dist/commands/self.d.ts +3 -0
- package/dist/commands/self.js +62 -0
- package/dist/commands/template.js +9 -10
- package/dist/commands/test/mmf1.js +1 -1
- package/dist/commands/test/test.js +2 -2
- package/dist/commands/toolchain/pocket-ic.d.ts +1 -5
- package/dist/commands/toolchain/pocket-ic.js +4 -27
- package/dist/commands/toolchain/toolchain-utils.d.ts +1 -1
- package/dist/commands/toolchain/toolchain-utils.js +7 -7
- package/dist/commands/transfer-ownership.js +1 -1
- package/dist/declarations/bench/bench.did.d.ts +3 -0
- package/dist/declarations/main/main.did +27 -1
- package/dist/declarations/main/main.did.d.ts +26 -1
- package/dist/declarations/main/main.did.js +27 -1
- package/dist/declarations/storage/index.d.ts +0 -0
- package/dist/declarations/storage/index.js +0 -0
- package/dist/declarations/storage/storage.did +0 -0
- package/dist/declarations/storage/storage.did.d.ts +0 -0
- package/dist/declarations/storage/storage.did.js +0 -0
- package/dist/helpers/find-changelog-entry.d.ts +1 -0
- package/dist/helpers/find-changelog-entry.js +24 -0
- package/dist/mops.d.ts +1 -0
- package/dist/mops.js +5 -1
- package/dist/package.json +20 -26
- package/dist/release-cli.d.ts +1 -0
- package/dist/release-cli.js +37 -0
- package/dist/remove-scripts.d.ts +1 -0
- package/dist/remove-scripts.js +5 -0
- package/dist/templates/README.md +0 -0
- package/dist/templates/licenses/Apache-2.0 +0 -0
- package/dist/templates/licenses/Apache-2.0-NOTICE +0 -0
- package/dist/templates/licenses/MIT +0 -0
- package/dist/templates/mops-publish.yml +0 -0
- package/dist/templates/mops-test.yml +0 -0
- package/dist/templates/src/lib.mo +0 -0
- package/dist/templates/test/lib.test.mo +0 -0
- package/dist/templates.d.ts +1 -0
- package/dist/templates.js +4 -0
- package/dist/vessel.js +1 -1
- package/global.d.ts +0 -0
- package/helpers/find-changelog-entry.ts +27 -0
- package/helpers/get-dfx-version.ts +1 -1
- package/helpers/get-moc-path.ts +1 -1
- package/helpers/get-moc-version.ts +1 -1
- package/integrity.ts +16 -16
- package/mops.ts +22 -17
- package/notify-installs.ts +2 -2
- package/package.json +28 -19
- package/parallel.ts +1 -1
- package/pem.ts +5 -5
- package/release-cli.ts +62 -0
- package/remove-scripts.ts +6 -0
- package/resolve-packages.ts +9 -9
- package/templates/README.md +0 -0
- package/templates/licenses/Apache-2.0 +0 -0
- package/templates/licenses/Apache-2.0-NOTICE +0 -0
- package/templates/licenses/MIT +0 -0
- package/templates/mops-publish.yml +0 -0
- package/templates/mops-test.yml +0 -0
- package/templates/src/lib.mo +0 -0
- package/templates/test/lib.test.mo +0 -0
- package/templates.ts +5 -0
- package/tsconfig.json +1 -1
- package/types.ts +25 -25
- package/vessel.ts +16 -16
- package/commands/self-update.ts +0 -6
- package/dist/commands/replica.d.ts +0 -36
- package/dist/commands/replica.js +0 -103
- package/dist/commands/self-update.d.ts +0 -3
- package/dist/commands/self-update.js +0 -5
- /package/bin/{mops.ts → mops.js} +0 -0
|
@@ -9,37 +9,19 @@ let cacheDir = path.join(globalCacheDir, 'pocket-ic');
|
|
|
9
9
|
export let repo = 'dfinity/pocketic';
|
|
10
10
|
|
|
11
11
|
export let getLatestReleaseTag = async () => {
|
|
12
|
-
return
|
|
13
|
-
// return toolchainUtils.getLatestReleaseTag(repo);
|
|
12
|
+
return toolchainUtils.getLatestReleaseTag(repo);
|
|
14
13
|
};
|
|
15
14
|
|
|
16
15
|
export let getReleases = async () => {
|
|
17
|
-
|
|
18
|
-
return [
|
|
19
|
-
{
|
|
20
|
-
tag_name: '2.0.1',
|
|
21
|
-
published_at: new Date('2023-11-23'),
|
|
22
|
-
draft: false,
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
tag_name: '2.0.0',
|
|
26
|
-
published_at: new Date('2023-11-21'),
|
|
27
|
-
draft: false,
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
tag_name: '1.0.0',
|
|
31
|
-
published_at: new Date('2023-10-12'),
|
|
32
|
-
draft: false,
|
|
33
|
-
},
|
|
34
|
-
];
|
|
16
|
+
return toolchainUtils.getReleases(repo);
|
|
35
17
|
};
|
|
36
18
|
|
|
37
|
-
export let isCached = (version: string) => {
|
|
19
|
+
export let isCached = (version : string) => {
|
|
38
20
|
let dir = path.join(cacheDir, version);
|
|
39
21
|
return fs.existsSync(dir) && fs.existsSync(path.join(dir, 'pocket-ic'));
|
|
40
22
|
};
|
|
41
23
|
|
|
42
|
-
export let download = async (version: string, {silent = false, verbose = false} = {}) => {
|
|
24
|
+
export let download = async (version : string, {silent = false, verbose = false} = {}) => {
|
|
43
25
|
if (!version) {
|
|
44
26
|
console.error('version is not defined');
|
|
45
27
|
process.exit(1);
|
|
@@ -53,18 +35,11 @@ export let download = async (version: string, {silent = false, verbose = false}
|
|
|
53
35
|
|
|
54
36
|
let platfrom = process.platform == 'darwin' ? 'darwin' : 'linux';
|
|
55
37
|
let arch = 'x86_64';
|
|
56
|
-
|
|
57
|
-
let hashes: Record<string, string> = {
|
|
58
|
-
'2.0.1': '69e1408347723dbaa7a6cd2faa9b65c42abbe861',
|
|
59
|
-
'2.0.0': '29ec86dc9f9ca4691d4d4386c8b2aa41e14d9d16',
|
|
60
|
-
'1.0.0': '307d5847c1d2fe1f5e19181c7d0fcec23f4658b3',
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
let url = `https://download.dfinity.systems/ic/${hashes[version]}/openssl-static-binaries/${arch}-${platfrom}/pocket-ic.gz`;
|
|
38
|
+
let url = `https://github.com/dfinity/pocketic/releases/download/${version}/pocket-ic-${arch}-${platfrom}.gz`;
|
|
64
39
|
|
|
65
40
|
if (verbose && !silent) {
|
|
66
41
|
console.log(`Downloading ${url}`);
|
|
67
42
|
}
|
|
68
43
|
|
|
69
|
-
await toolchainUtils.downloadAndExtract(url, path.join(cacheDir, version));
|
|
44
|
+
await toolchainUtils.downloadAndExtract(url, path.join(cacheDir, version), 'pocket-ic');
|
|
70
45
|
};
|
|
@@ -10,7 +10,7 @@ import tar from 'tar';
|
|
|
10
10
|
|
|
11
11
|
import {getRootDir} from '../../mops.js';
|
|
12
12
|
|
|
13
|
-
export let downloadAndExtract = async (url: string,
|
|
13
|
+
export let downloadAndExtract = async (url : string, destDir : string, destFileName : string = '') => {
|
|
14
14
|
let res = await fetch(url);
|
|
15
15
|
|
|
16
16
|
if (res.status !== 200) {
|
|
@@ -27,7 +27,7 @@ export let downloadAndExtract = async (url: string, dest: string) => {
|
|
|
27
27
|
fs.mkdirSync(tmpDir, {recursive: true});
|
|
28
28
|
fs.writeFileSync(archive, buffer);
|
|
29
29
|
|
|
30
|
-
fs.mkdirSync(
|
|
30
|
+
fs.mkdirSync(destDir, {recursive: true});
|
|
31
31
|
|
|
32
32
|
if (archive.endsWith('.xz')) {
|
|
33
33
|
let decompressTarxz = await import('decomp-tarxz');
|
|
@@ -36,16 +36,16 @@ export let downloadAndExtract = async (url: string, dest: string) => {
|
|
|
36
36
|
}).catch(() => {
|
|
37
37
|
deleteSync([tmpDir]);
|
|
38
38
|
});
|
|
39
|
-
fs.cpSync(path.join(tmpDir, path.parse(archive).name.replace('.tar', '')),
|
|
39
|
+
fs.cpSync(path.join(tmpDir, path.parse(archive).name.replace('.tar', '')), destDir, {recursive: true});
|
|
40
40
|
}
|
|
41
41
|
else if (archive.endsWith('tar.gz')) {
|
|
42
42
|
await tar.extract({
|
|
43
43
|
file: archive,
|
|
44
|
-
cwd:
|
|
44
|
+
cwd: destDir,
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
else if (archive.endsWith('.gz')) {
|
|
48
|
-
let destFile = path.join(
|
|
48
|
+
let destFile = path.join(destDir, destFileName || path.parse(archive).name);
|
|
49
49
|
fs.writeFileSync(destFile, unzipSync(buffer));
|
|
50
50
|
chmodSync(destFile, 0o700);
|
|
51
51
|
}
|
|
@@ -53,9 +53,9 @@ export let downloadAndExtract = async (url: string, dest: string) => {
|
|
|
53
53
|
deleteSync([tmpDir], {force: true});
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
export let getLatestReleaseTag = async (repo: string): Promise<string> => {
|
|
56
|
+
export let getLatestReleaseTag = async (repo : string) : Promise<string> => {
|
|
57
57
|
let releases = await getReleases(repo);
|
|
58
|
-
let release = releases.find((release: any) => !release.prerelease && !release.draft);
|
|
58
|
+
let release = releases.find((release : any) => !release.prerelease && !release.draft);
|
|
59
59
|
if (!release?.tag_name) {
|
|
60
60
|
console.error(`Failed to fetch latest release tag for ${repo}`);
|
|
61
61
|
process.exit(1);
|
|
@@ -63,19 +63,19 @@ export let getLatestReleaseTag = async (repo: string): Promise<string> => {
|
|
|
63
63
|
return release.tag_name.replace(/^v/, '');
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
export let getReleases = async (repo: string) => {
|
|
66
|
+
export let getReleases = async (repo : string) => {
|
|
67
67
|
let octokit = new Octokit;
|
|
68
68
|
let res = await octokit.request(`GET /repos/${repo}/releases`, {
|
|
69
69
|
per_page: 10,
|
|
70
70
|
headers: {
|
|
71
|
-
'X-GitHub-Api-Version': '2022-11-28'
|
|
72
|
-
}
|
|
71
|
+
'X-GitHub-Api-Version': '2022-11-28',
|
|
72
|
+
},
|
|
73
73
|
});
|
|
74
74
|
if (res.status !== 200) {
|
|
75
75
|
console.log('Releases fetch error');
|
|
76
76
|
process.exit(1);
|
|
77
77
|
}
|
|
78
|
-
return res.data.map((release: any) => {
|
|
78
|
+
return res.data.map((release : any) => {
|
|
79
79
|
return {
|
|
80
80
|
...release,
|
|
81
81
|
tag_name: release.tag_name.replace(/^v/, ''),
|
|
@@ -16,12 +16,12 @@ export let getReleases = async () => {
|
|
|
16
16
|
return toolchainUtils.getReleases(repo);
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
export let isCached = (version: string) => {
|
|
19
|
+
export let isCached = (version : string) => {
|
|
20
20
|
let dir = path.join(cacheDir, version);
|
|
21
21
|
return fs.existsSync(dir) && fs.existsSync(path.join(dir, 'wasmtime'));
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
export let download = async (version: string, {silent = false, verbose = false} = {}) => {
|
|
24
|
+
export let download = async (version : string, {silent = false, verbose = false} = {}) => {
|
|
25
25
|
if (!version) {
|
|
26
26
|
console.error('version is not defined');
|
|
27
27
|
process.exit(1);
|
|
@@ -4,7 +4,7 @@ import {mainActor} from '../api/actors.js';
|
|
|
4
4
|
import {Principal} from '@dfinity/principal';
|
|
5
5
|
import prompts from 'prompts';
|
|
6
6
|
|
|
7
|
-
export async function transferOwnership(toPrincipal: string) {
|
|
7
|
+
export async function transferOwnership(toPrincipal : string) {
|
|
8
8
|
if (!checkConfigFile()) {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
@@ -16,7 +16,7 @@ export async function transferOwnership(toPrincipal: string) {
|
|
|
16
16
|
onCancel() {
|
|
17
17
|
console.log('aborted');
|
|
18
18
|
process.exit(0);
|
|
19
|
-
}
|
|
19
|
+
},
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
console.log(chalk.red('Warning: ') + 'This action cannot be undone!');
|
package/commands/update.ts
CHANGED
|
@@ -5,12 +5,12 @@ import {getAvailableUpdates} from './available-updates.js';
|
|
|
5
5
|
import {checkIntegrity} from '../integrity.js';
|
|
6
6
|
|
|
7
7
|
type UpdateOptions = {
|
|
8
|
-
verbose?: boolean;
|
|
9
|
-
dev?: boolean;
|
|
10
|
-
lock?: 'update' | 'ignore';
|
|
8
|
+
verbose ?: boolean;
|
|
9
|
+
dev ?: boolean;
|
|
10
|
+
lock ?: 'update' | 'ignore';
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
export async function update(pkg?: string, {lock}: UpdateOptions = {}) {
|
|
13
|
+
export async function update(pkg ?: string, {lock} : UpdateOptions = {}) {
|
|
14
14
|
if (!checkConfigFile()) {
|
|
15
15
|
return;
|
|
16
16
|
}
|
package/commands/user.ts
CHANGED
|
@@ -2,7 +2,7 @@ import chalk from 'chalk';
|
|
|
2
2
|
import {getIdentity} from '../mops.js';
|
|
3
3
|
import {mainActor} from '../api/actors.js';
|
|
4
4
|
|
|
5
|
-
export async function getUserProp(prop: string) {
|
|
5
|
+
export async function getUserProp(prop : string) {
|
|
6
6
|
let actor = await mainActor();
|
|
7
7
|
let identity = await getIdentity();
|
|
8
8
|
if (!identity) {
|
|
@@ -14,7 +14,7 @@ export async function getUserProp(prop: string) {
|
|
|
14
14
|
console.log(res[0]?.[prop] || '');
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export async function setUserProp(prop: string, value: string) {
|
|
17
|
+
export async function setUserProp(prop : string, value : string) {
|
|
18
18
|
let identity = await getIdentity();
|
|
19
19
|
let actor = await mainActor(identity);
|
|
20
20
|
|
package/commands/whoami.ts
CHANGED
|
File without changes
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Principal } from '@dfinity/principal';
|
|
2
2
|
import type { ActorMethod } from '@dfinity/agent';
|
|
3
|
+
import type { IDL } from '@dfinity/candid';
|
|
3
4
|
|
|
4
5
|
export interface BenchResult {
|
|
5
6
|
'instructions' : bigint,
|
|
@@ -24,3 +25,5 @@ export interface anon_class_10_1 {
|
|
|
24
25
|
'runCellUpdateAwait' : ActorMethod<[bigint, bigint], BenchResult>,
|
|
25
26
|
}
|
|
26
27
|
export interface _SERVICE extends anon_class_10_1 {}
|
|
28
|
+
export declare const idlFactory: IDL.InterfaceFactory;
|
|
29
|
+
export declare const init: ({ IDL }: { IDL: IDL }) => IDL.Type[];
|
|
@@ -216,6 +216,7 @@ type PackageFileStatsPublic =
|
|
|
216
216
|
};
|
|
217
217
|
type PackageDetails =
|
|
218
218
|
record {
|
|
219
|
+
benchmarks: Benchmarks__1;
|
|
219
220
|
changes: PackageChanges;
|
|
220
221
|
config: PackageConfigV2__1;
|
|
221
222
|
dependents: vec PackageSummary__1;
|
|
@@ -273,9 +274,11 @@ type PackageConfigV2 =
|
|
|
273
274
|
};
|
|
274
275
|
type PackageChanges =
|
|
275
276
|
record {
|
|
277
|
+
curBenchmarks: Benchmarks__1;
|
|
276
278
|
deps: vec DepChange;
|
|
277
279
|
devDeps: vec DepChange;
|
|
278
280
|
notes: text;
|
|
281
|
+
prevBenchmarks: Benchmarks__1;
|
|
279
282
|
tests: TestsChanges;
|
|
280
283
|
};
|
|
281
284
|
type Main =
|
|
@@ -303,6 +306,7 @@ type Main =
|
|
|
303
306
|
blob;
|
|
304
307
|
};
|
|
305
308
|
});
|
|
309
|
+
getFileHashesQuery: (PackageName, PackageVersion) -> (Result_8) query;
|
|
306
310
|
getFileIds: (PackageName, PackageVersion) -> (Result_7) query;
|
|
307
311
|
getHighestSemverBatch:
|
|
308
312
|
(vec record {
|
|
@@ -333,13 +337,14 @@ type Main =
|
|
|
333
337
|
PackageName;
|
|
334
338
|
PackageVersion;
|
|
335
339
|
}) -> () oneway;
|
|
336
|
-
restore: (nat
|
|
340
|
+
restore: (nat) -> ();
|
|
337
341
|
search: (Text, opt nat, opt nat) -> (vec PackageSummary, PageCount) query;
|
|
338
342
|
setUserProp: (text, text) -> (Result_1);
|
|
339
343
|
startFileUpload: (PublishingId, Text, nat, blob) -> (Result_3);
|
|
340
344
|
startPublish: (PackageConfigV2) -> (Result_2);
|
|
341
345
|
transferOwnership: (PackageName, principal) -> (Result_1);
|
|
342
346
|
transformRequest: (HttpTransformArg) -> (HttpResponse) query;
|
|
347
|
+
uploadBenchmarks: (PublishingId, Benchmarks) -> (Result);
|
|
343
348
|
uploadFileChunk: (PublishingId, FileId, nat, blob) -> (Result);
|
|
344
349
|
uploadNotes: (PublishingId, text) -> (Result);
|
|
345
350
|
uploadTestStats: (PublishingId, TestStats) -> (Result);
|
|
@@ -397,4 +402,25 @@ type DepChange =
|
|
|
397
402
|
newVersion: text;
|
|
398
403
|
oldVersion: text;
|
|
399
404
|
};
|
|
405
|
+
type Benchmarks__1 = vec Benchmark;
|
|
406
|
+
type Benchmarks = vec Benchmark;
|
|
407
|
+
type BenchmarkMetric = text;
|
|
408
|
+
type Benchmark =
|
|
409
|
+
record {
|
|
410
|
+
cols: vec text;
|
|
411
|
+
compiler: text;
|
|
412
|
+
compilerVersion: text;
|
|
413
|
+
description: text;
|
|
414
|
+
file: text;
|
|
415
|
+
forceGC: bool;
|
|
416
|
+
gc: text;
|
|
417
|
+
metrics: vec record {
|
|
418
|
+
BenchmarkMetric;
|
|
419
|
+
vec vec int;
|
|
420
|
+
};
|
|
421
|
+
name: text;
|
|
422
|
+
replica: text;
|
|
423
|
+
replicaVersion: text;
|
|
424
|
+
rows: vec text;
|
|
425
|
+
};
|
|
400
426
|
service : () -> Main
|
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import type { Principal } from '@dfinity/principal';
|
|
2
2
|
import type { ActorMethod } from '@dfinity/agent';
|
|
3
|
+
import type { IDL } from '@dfinity/candid';
|
|
3
4
|
|
|
5
|
+
export interface Benchmark {
|
|
6
|
+
'gc' : string,
|
|
7
|
+
'metrics' : Array<[BenchmarkMetric, Array<Array<bigint>>]>,
|
|
8
|
+
'cols' : Array<string>,
|
|
9
|
+
'file' : string,
|
|
10
|
+
'name' : string,
|
|
11
|
+
'rows' : Array<string>,
|
|
12
|
+
'description' : string,
|
|
13
|
+
'compilerVersion' : string,
|
|
14
|
+
'compiler' : string,
|
|
15
|
+
'replica' : string,
|
|
16
|
+
'replicaVersion' : string,
|
|
17
|
+
'forceGC' : boolean,
|
|
18
|
+
}
|
|
19
|
+
export type BenchmarkMetric = string;
|
|
20
|
+
export type Benchmarks = Array<Benchmark>;
|
|
21
|
+
export type Benchmarks__1 = Array<Benchmark>;
|
|
4
22
|
export interface DepChange {
|
|
5
23
|
'oldVersion' : string,
|
|
6
24
|
'name' : string,
|
|
@@ -60,6 +78,7 @@ export interface Main {
|
|
|
60
78
|
[Array<PackageId>],
|
|
61
79
|
Array<[PackageId, Array<[FileId, Uint8Array | number[]]>]>
|
|
62
80
|
>,
|
|
81
|
+
'getFileHashesQuery' : ActorMethod<[PackageName, PackageVersion], Result_8>,
|
|
63
82
|
'getFileIds' : ActorMethod<[PackageName, PackageVersion], Result_7>,
|
|
64
83
|
'getHighestSemverBatch' : ActorMethod<
|
|
65
84
|
[Array<[PackageName, PackageVersion, SemverPart]>],
|
|
@@ -88,7 +107,7 @@ export interface Main {
|
|
|
88
107
|
[Array<[PackageName, PackageVersion]>],
|
|
89
108
|
undefined
|
|
90
109
|
>,
|
|
91
|
-
'restore' : ActorMethod<[bigint
|
|
110
|
+
'restore' : ActorMethod<[bigint], undefined>,
|
|
92
111
|
'search' : ActorMethod<
|
|
93
112
|
[Text, [] | [bigint], [] | [bigint]],
|
|
94
113
|
[Array<PackageSummary>, PageCount]
|
|
@@ -101,6 +120,7 @@ export interface Main {
|
|
|
101
120
|
'startPublish' : ActorMethod<[PackageConfigV2], Result_2>,
|
|
102
121
|
'transferOwnership' : ActorMethod<[PackageName, Principal], Result_1>,
|
|
103
122
|
'transformRequest' : ActorMethod<[HttpTransformArg], HttpResponse>,
|
|
123
|
+
'uploadBenchmarks' : ActorMethod<[PublishingId, Benchmarks], Result>,
|
|
104
124
|
'uploadFileChunk' : ActorMethod<
|
|
105
125
|
[PublishingId, FileId, bigint, Uint8Array | number[]],
|
|
106
126
|
Result
|
|
@@ -111,6 +131,8 @@ export interface Main {
|
|
|
111
131
|
export interface PackageChanges {
|
|
112
132
|
'tests' : TestsChanges,
|
|
113
133
|
'deps' : Array<DepChange>,
|
|
134
|
+
'curBenchmarks' : Benchmarks__1,
|
|
135
|
+
'prevBenchmarks' : Benchmarks__1,
|
|
114
136
|
'notes' : string,
|
|
115
137
|
'devDeps' : Array<DepChange>,
|
|
116
138
|
}
|
|
@@ -151,6 +173,7 @@ export interface PackageConfigV2__1 {
|
|
|
151
173
|
'readme' : string,
|
|
152
174
|
}
|
|
153
175
|
export interface PackageDetails {
|
|
176
|
+
'benchmarks' : Benchmarks__1,
|
|
154
177
|
'ownerInfo' : User,
|
|
155
178
|
'owner' : Principal,
|
|
156
179
|
'deps' : Array<PackageSummary__1>,
|
|
@@ -325,3 +348,5 @@ export interface User__1 {
|
|
|
325
348
|
'github' : string,
|
|
326
349
|
}
|
|
327
350
|
export interface _SERVICE extends Main {}
|
|
351
|
+
export declare const idlFactory: IDL.InterfaceFactory;
|
|
352
|
+
export declare const init: ({ IDL }: { IDL: IDL }) => IDL.Type[];
|
|
@@ -95,6 +95,22 @@ export const idlFactory = ({ IDL }) => {
|
|
|
95
95
|
'config' : PackageConfigV2__1,
|
|
96
96
|
'publication' : PackagePublication,
|
|
97
97
|
});
|
|
98
|
+
const BenchmarkMetric = IDL.Text;
|
|
99
|
+
const Benchmark = IDL.Record({
|
|
100
|
+
'gc' : IDL.Text,
|
|
101
|
+
'metrics' : IDL.Vec(IDL.Tuple(BenchmarkMetric, IDL.Vec(IDL.Vec(IDL.Int)))),
|
|
102
|
+
'cols' : IDL.Vec(IDL.Text),
|
|
103
|
+
'file' : IDL.Text,
|
|
104
|
+
'name' : IDL.Text,
|
|
105
|
+
'rows' : IDL.Vec(IDL.Text),
|
|
106
|
+
'description' : IDL.Text,
|
|
107
|
+
'compilerVersion' : IDL.Text,
|
|
108
|
+
'compiler' : IDL.Text,
|
|
109
|
+
'replica' : IDL.Text,
|
|
110
|
+
'replicaVersion' : IDL.Text,
|
|
111
|
+
'forceGC' : IDL.Bool,
|
|
112
|
+
});
|
|
113
|
+
const Benchmarks__1 = IDL.Vec(Benchmark);
|
|
98
114
|
const PackageSummary__1 = IDL.Record({
|
|
99
115
|
'ownerInfo' : User,
|
|
100
116
|
'owner' : IDL.Principal,
|
|
@@ -130,6 +146,8 @@ export const idlFactory = ({ IDL }) => {
|
|
|
130
146
|
const PackageChanges = IDL.Record({
|
|
131
147
|
'tests' : TestsChanges,
|
|
132
148
|
'deps' : IDL.Vec(DepChange),
|
|
149
|
+
'curBenchmarks' : Benchmarks__1,
|
|
150
|
+
'prevBenchmarks' : Benchmarks__1,
|
|
133
151
|
'notes' : IDL.Text,
|
|
134
152
|
'devDeps' : IDL.Vec(DepChange),
|
|
135
153
|
});
|
|
@@ -145,6 +163,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
145
163
|
'publication' : PackagePublication,
|
|
146
164
|
});
|
|
147
165
|
const PackageDetails = IDL.Record({
|
|
166
|
+
'benchmarks' : Benchmarks__1,
|
|
148
167
|
'ownerInfo' : User,
|
|
149
168
|
'owner' : IDL.Principal,
|
|
150
169
|
'deps' : IDL.Vec(PackageSummary__1),
|
|
@@ -255,6 +274,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
255
274
|
'context' : IDL.Vec(IDL.Nat8),
|
|
256
275
|
'response' : HttpResponse,
|
|
257
276
|
});
|
|
277
|
+
const Benchmarks = IDL.Vec(Benchmark);
|
|
258
278
|
const TestStats = IDL.Record({
|
|
259
279
|
'passedNames' : IDL.Vec(IDL.Text),
|
|
260
280
|
'passed' : IDL.Nat,
|
|
@@ -290,6 +310,11 @@ export const idlFactory = ({ IDL }) => {
|
|
|
290
310
|
],
|
|
291
311
|
[],
|
|
292
312
|
),
|
|
313
|
+
'getFileHashesQuery' : IDL.Func(
|
|
314
|
+
[PackageName, PackageVersion],
|
|
315
|
+
[Result_8],
|
|
316
|
+
['query'],
|
|
317
|
+
),
|
|
293
318
|
'getFileIds' : IDL.Func(
|
|
294
319
|
[PackageName, PackageVersion],
|
|
295
320
|
[Result_7],
|
|
@@ -342,7 +367,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
342
367
|
[],
|
|
343
368
|
['oneway'],
|
|
344
369
|
),
|
|
345
|
-
'restore' : IDL.Func([IDL.Nat
|
|
370
|
+
'restore' : IDL.Func([IDL.Nat], [], []),
|
|
346
371
|
'search' : IDL.Func(
|
|
347
372
|
[Text, IDL.Opt(IDL.Nat), IDL.Opt(IDL.Nat)],
|
|
348
373
|
[IDL.Vec(PackageSummary), PageCount],
|
|
@@ -365,6 +390,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
365
390
|
[HttpResponse],
|
|
366
391
|
['query'],
|
|
367
392
|
),
|
|
393
|
+
'uploadBenchmarks' : IDL.Func([PublishingId, Benchmarks], [Result], []),
|
|
368
394
|
'uploadFileChunk' : IDL.Func(
|
|
369
395
|
[PublishingId, FileId, IDL.Nat, IDL.Vec(IDL.Nat8)],
|
|
370
396
|
[Result],
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -6,7 +6,7 @@ export declare function getPackageFilesInfo(pkg: string, version: string): Promi
|
|
|
6
6
|
fileIds: string[];
|
|
7
7
|
}>;
|
|
8
8
|
export declare function getFileIds(pkg: string, version: string): Promise<string[]>;
|
|
9
|
-
export declare function downloadFile(storage: Storage, fileId: string): Promise<{
|
|
9
|
+
export declare function downloadFile(storage: Storage | string, fileId: string): Promise<{
|
|
10
10
|
path: string;
|
|
11
11
|
data: Array<number>;
|
|
12
12
|
}>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Principal } from '@dfinity/principal';
|
|
1
2
|
import { mainActor, storageActor } from './actors.js';
|
|
2
3
|
import { resolveVersion } from './resolveVersion.js';
|
|
3
4
|
import { parallel } from '../parallel.js';
|
|
@@ -41,6 +42,9 @@ export async function getFileIds(pkg, version) {
|
|
|
41
42
|
}
|
|
42
43
|
// download single file
|
|
43
44
|
export async function downloadFile(storage, fileId) {
|
|
45
|
+
if (typeof storage === 'string') {
|
|
46
|
+
storage = await storageActor(Principal.fromText(storage));
|
|
47
|
+
}
|
|
44
48
|
let fileMetaRes = await storage.getFileMeta(fileId);
|
|
45
49
|
if ('err' in fileMetaRes) {
|
|
46
50
|
throw fileMetaRes.err;
|
package/dist/bin/mops.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
export {};
|
package/dist/bin/mops.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
let packageJson = JSON.parse(readFileSync('./bundle/package.json', 'utf8'));
|
|
3
|
+
delete packageJson.scripts;
|
|
4
|
+
delete packageJson.devDependencies;
|
|
5
|
+
delete packageJson.overrides;
|
|
6
|
+
packageJson.dependencies = {
|
|
7
|
+
'dhall-to-json-cli': packageJson.dependencies['dhall-to-json-cli'],
|
|
8
|
+
'decomp-tarxz': packageJson.dependencies['decomp-tarxz'],
|
|
9
|
+
'buffer': packageJson.dependencies['buffer'],
|
|
10
|
+
};
|
|
11
|
+
writeFileSync('./bundle/package.json', JSON.stringify(packageJson, null, ' '));
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { getDependencyType, readConfig } from './mops.js';
|
|
3
|
+
import { resolvePackages } from './resolve-packages.js';
|
|
4
|
+
import { SemVer } from 'semver';
|
|
5
|
+
import chalk from 'chalk';
|
|
6
|
+
export async function checkRequirements({ verbose = false } = {}) {
|
|
7
|
+
let config = readConfig();
|
|
8
|
+
if (!config.toolchain?.moc) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
let installedMoc = new SemVer(config.toolchain.moc);
|
|
12
|
+
let highestRequiredMoc = new SemVer('0.0.0');
|
|
13
|
+
let highestRequiredMocPkgId = '';
|
|
14
|
+
let resolvedPackages = await resolvePackages();
|
|
15
|
+
for (let [name, version] of Object.entries(resolvedPackages)) {
|
|
16
|
+
if (getDependencyType(version) === 'mops') {
|
|
17
|
+
let pkgId = `${name}@${version}`;
|
|
18
|
+
let depConfig = readConfig(path.join('.mops', pkgId, 'mops.toml'));
|
|
19
|
+
let moc = depConfig.requirements?.moc;
|
|
20
|
+
if (moc) {
|
|
21
|
+
let requiredMoc = new SemVer(moc);
|
|
22
|
+
if (highestRequiredMoc.compare(requiredMoc) < 0) {
|
|
23
|
+
highestRequiredMoc = requiredMoc;
|
|
24
|
+
highestRequiredMocPkgId = pkgId;
|
|
25
|
+
}
|
|
26
|
+
verbose && _check(pkgId, installedMoc, requiredMoc);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
verbose || _check(highestRequiredMocPkgId, installedMoc, highestRequiredMoc);
|
|
31
|
+
}
|
|
32
|
+
function _check(pkgId, installedMoc, requiredMoc) {
|
|
33
|
+
let comp = installedMoc.compare(requiredMoc);
|
|
34
|
+
if (comp < 0) {
|
|
35
|
+
console.log(chalk.yellow(`moc version does not meet the requirements of ${pkgId}`));
|
|
36
|
+
console.log(chalk.yellow(` Required: >= ${requiredMoc.format()}`));
|
|
37
|
+
console.log(chalk.yellow(` Installed: ${installedMoc.format()}`));
|
|
38
|
+
}
|
|
39
|
+
}
|
package/dist/cli.js
CHANGED
|
@@ -5,7 +5,7 @@ import { init } from './commands/init.js';
|
|
|
5
5
|
import { publish } from './commands/publish.js';
|
|
6
6
|
import { importPem } from './commands/import-identity.js';
|
|
7
7
|
import { sources } from './commands/sources.js';
|
|
8
|
-
import { checkApiCompatibility, setNetwork, apiVersion, checkConfigFile, getNetworkFile } from './mops.js';
|
|
8
|
+
import { checkApiCompatibility, setNetwork, apiVersion, checkConfigFile, getNetworkFile, version } from './mops.js';
|
|
9
9
|
import { getNetwork } from './api/network.js';
|
|
10
10
|
import { whoami } from './commands/whoami.js';
|
|
11
11
|
import { installAll } from './commands/install-all.js';
|
|
@@ -14,7 +14,6 @@ import { add } from './commands/add.js';
|
|
|
14
14
|
import { cacheSize, cleanCache } from './cache.js';
|
|
15
15
|
import { test } from './commands/test/test.js';
|
|
16
16
|
import { template } from './commands/template.js';
|
|
17
|
-
import { selfUpdate } from './commands/self-update.js';
|
|
18
17
|
import { remove } from './commands/remove.js';
|
|
19
18
|
import { getUserProp, setUserProp } from './commands/user.js';
|
|
20
19
|
import { bump } from './commands/bump.js';
|
|
@@ -24,6 +23,7 @@ import { update } from './commands/update.js';
|
|
|
24
23
|
import { bench } from './commands/bench.js';
|
|
25
24
|
import { transferOwnership } from './commands/transfer-ownership.js';
|
|
26
25
|
import { toolchain } from './commands/toolchain/index.js';
|
|
26
|
+
import * as self from './commands/self.js';
|
|
27
27
|
let networkFile = getNetworkFile();
|
|
28
28
|
if (fs.existsSync(networkFile)) {
|
|
29
29
|
globalThis.MOPS_NETWORK = fs.readFileSync(networkFile).toString() || 'ic';
|
|
@@ -31,8 +31,7 @@ if (fs.existsSync(networkFile)) {
|
|
|
31
31
|
let program = new Command();
|
|
32
32
|
program.name('mops');
|
|
33
33
|
// --version
|
|
34
|
-
|
|
35
|
-
program.version(`CLI ${packageJson.version}\nAPI ${apiVersion}`, '-v --version');
|
|
34
|
+
program.version(`CLI ${version()}\nAPI ${apiVersion}`, '-v --version');
|
|
36
35
|
// init
|
|
37
36
|
program
|
|
38
37
|
.command('init')
|
|
@@ -101,6 +100,7 @@ program
|
|
|
101
100
|
.description('Publish package to the mops registry')
|
|
102
101
|
.option('--no-docs', 'Do not generate docs')
|
|
103
102
|
.option('--no-test', 'Do not run tests')
|
|
103
|
+
.option('--no-bench', 'Do not run benchmarks')
|
|
104
104
|
.action(async (options) => {
|
|
105
105
|
if (!checkConfigFile()) {
|
|
106
106
|
process.exit(1);
|
|
@@ -224,20 +224,6 @@ program
|
|
|
224
224
|
// }
|
|
225
225
|
// await docs();
|
|
226
226
|
// });
|
|
227
|
-
// self update
|
|
228
|
-
program
|
|
229
|
-
.command('self-update')
|
|
230
|
-
.description('Update mops CLI to the latest version')
|
|
231
|
-
.option('--detached')
|
|
232
|
-
.option('--force')
|
|
233
|
-
.action(async (options) => {
|
|
234
|
-
if (options.force) {
|
|
235
|
-
selfUpdate(options);
|
|
236
|
-
}
|
|
237
|
-
else {
|
|
238
|
-
console.log('Please run \'npm i -g ic-mops\'');
|
|
239
|
-
}
|
|
240
|
-
});
|
|
241
227
|
// user
|
|
242
228
|
program
|
|
243
229
|
.command('user')
|
|
@@ -339,4 +325,19 @@ toolchainCommand
|
|
|
339
325
|
console.log(bin);
|
|
340
326
|
});
|
|
341
327
|
program.addCommand(toolchainCommand);
|
|
328
|
+
// self
|
|
329
|
+
const selfCommand = new Command('self').description('Mops CLI management');
|
|
330
|
+
selfCommand
|
|
331
|
+
.command('update')
|
|
332
|
+
.description('Update mops CLI to the latest version')
|
|
333
|
+
.action(async () => {
|
|
334
|
+
await self.update();
|
|
335
|
+
});
|
|
336
|
+
selfCommand
|
|
337
|
+
.command('uninstall')
|
|
338
|
+
.description('Uninstall mops CLI')
|
|
339
|
+
.action(async () => {
|
|
340
|
+
await self.uninstall();
|
|
341
|
+
});
|
|
342
|
+
program.addCommand(selfCommand);
|
|
342
343
|
program.parse();
|
|
File without changes
|
|
File without changes
|
|
@@ -9,7 +9,9 @@ export declare class BenchReplica {
|
|
|
9
9
|
}>;
|
|
10
10
|
pocketIc?: PocketIc;
|
|
11
11
|
constructor(type: 'dfx' | 'pocket-ic', verbose?: boolean);
|
|
12
|
-
start(
|
|
12
|
+
start({ silent }?: {
|
|
13
|
+
silent?: boolean | undefined;
|
|
14
|
+
}): Promise<void>;
|
|
13
15
|
stop(): Promise<void>;
|
|
14
16
|
deploy(name: string, wasm: string, cwd?: string): Promise<void>;
|
|
15
17
|
getActor(name: string): unknown;
|
|
@@ -13,8 +13,8 @@ export class BenchReplica {
|
|
|
13
13
|
this.type = type;
|
|
14
14
|
this.verbose = verbose;
|
|
15
15
|
}
|
|
16
|
-
async start() {
|
|
17
|
-
console.log(`Starting ${this.type} replica...`);
|
|
16
|
+
async start({ silent = false } = {}) {
|
|
17
|
+
silent || console.log(`Starting ${this.type} replica...`);
|
|
18
18
|
if (this.type == 'dfx') {
|
|
19
19
|
await this.stop();
|
|
20
20
|
let dir = path.join(getRootDir(), '.mops/.bench');
|