ic-mops 0.39.2 → 0.40.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/.eslintrc.json +0 -0
- package/.gitignore +1 -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/cache.ts +3 -3
- package/cli.ts +3 -2
- 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 -9
- package/commands/remove.ts +8 -8
- package/commands/search.ts +2 -2
- package/commands/sources.ts +0 -0
- package/commands/sync.ts +8 -8
- package/commands/template.ts +2 -2
- 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/actors.d.ts +0 -0
- package/dist/api/actors.js +0 -0
- package/dist/api/downloadPackageFiles.d.ts +1 -1
- package/dist/api/downloadPackageFiles.js +4 -0
- package/dist/api/getHighestVersion.d.ts +0 -0
- package/dist/api/getHighestVersion.js +0 -0
- package/dist/api/index.d.ts +0 -0
- package/dist/api/index.js +0 -0
- package/dist/api/network.d.ts +0 -0
- package/dist/api/network.js +0 -0
- package/dist/api/resolveVersion.d.ts +0 -0
- package/dist/api/resolveVersion.js +0 -0
- package/dist/bin/moc-wrapper.sh +3 -0
- package/dist/bin/mops.d.ts +0 -0
- package/dist/bin/mops.js +0 -0
- package/dist/bundle-package-json.d.ts +1 -0
- package/dist/bundle-package-json.js +11 -0
- package/dist/cache.d.ts +0 -0
- package/dist/cache.js +0 -0
- package/dist/cli.d.ts +0 -0
- package/dist/cli.js +1 -0
- package/dist/commands/add.d.ts +0 -0
- package/dist/commands/add.js +0 -0
- package/dist/commands/available-updates.d.ts +0 -0
- package/dist/commands/available-updates.js +0 -0
- 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/bump.d.ts +0 -0
- package/dist/commands/bump.js +0 -0
- package/dist/commands/docs.d.ts +0 -0
- package/dist/commands/docs.js +0 -0
- package/dist/commands/import-identity.d.ts +0 -0
- package/dist/commands/import-identity.js +0 -0
- package/dist/commands/init.d.ts +0 -0
- package/dist/commands/init.js +1 -1
- package/dist/commands/install-all.d.ts +0 -0
- package/dist/commands/install-all.js +0 -0
- package/dist/commands/install-local.d.ts +0 -0
- package/dist/commands/install-local.js +0 -0
- package/dist/commands/install.d.ts +0 -0
- package/dist/commands/install.js +0 -0
- package/dist/commands/outdated.d.ts +0 -0
- package/dist/commands/outdated.js +0 -0
- package/dist/commands/publish.d.ts +1 -0
- package/dist/commands/publish.js +24 -1
- package/dist/commands/remove.d.ts +0 -0
- package/dist/commands/remove.js +0 -0
- package/dist/commands/search.d.ts +0 -0
- package/dist/commands/search.js +0 -0
- package/dist/commands/self-update.d.ts +0 -0
- package/dist/commands/self-update.js +0 -0
- package/dist/commands/self.d.ts +3 -0
- package/dist/commands/self.js +62 -0
- package/dist/commands/sources.d.ts +0 -0
- package/dist/commands/sources.js +0 -0
- package/dist/commands/sync.d.ts +0 -0
- package/dist/commands/sync.js +0 -0
- package/dist/commands/template.d.ts +0 -0
- package/dist/commands/template.js +0 -0
- package/dist/commands/test/mmf1.d.ts +0 -0
- package/dist/commands/test/mmf1.js +1 -1
- package/dist/commands/test/reporters/compact-reporter.d.ts +0 -0
- package/dist/commands/test/reporters/compact-reporter.js +0 -0
- package/dist/commands/test/reporters/files-reporter.d.ts +0 -0
- package/dist/commands/test/reporters/files-reporter.js +0 -0
- package/dist/commands/test/reporters/reporter.d.ts +0 -0
- package/dist/commands/test/reporters/reporter.js +0 -0
- package/dist/commands/test/reporters/silent-reporter.d.ts +0 -0
- package/dist/commands/test/reporters/silent-reporter.js +0 -0
- package/dist/commands/test/reporters/verbose-reporter.d.ts +0 -0
- package/dist/commands/test/reporters/verbose-reporter.js +0 -0
- package/dist/commands/test/test.d.ts +0 -0
- package/dist/commands/test/test.js +2 -2
- package/dist/commands/test/utils.d.ts +0 -0
- package/dist/commands/test/utils.js +0 -0
- package/dist/commands/toolchain/index.d.ts +0 -0
- package/dist/commands/toolchain/index.js +0 -0
- package/dist/commands/toolchain/moc.d.ts +0 -0
- package/dist/commands/toolchain/moc.js +0 -0
- 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/toolchain/wasmtime.d.ts +0 -0
- package/dist/commands/toolchain/wasmtime.js +0 -0
- package/dist/commands/transfer-ownership.d.ts +0 -0
- package/dist/commands/transfer-ownership.js +1 -1
- package/dist/commands/update.d.ts +0 -0
- package/dist/commands/update.js +0 -0
- package/dist/commands/user.d.ts +0 -0
- package/dist/commands/user.js +0 -0
- package/dist/commands/whoami.d.ts +0 -0
- package/dist/commands/whoami.js +0 -0
- package/dist/declarations/bench/bench.did +0 -0
- package/dist/declarations/bench/bench.did.d.ts +3 -0
- package/dist/declarations/bench/bench.did.js +0 -0
- package/dist/declarations/bench/index.d.ts +0 -0
- package/dist/declarations/bench/index.js +0 -0
- package/dist/declarations/main/index.d.ts +0 -0
- package/dist/declarations/main/index.js +0 -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/helpers/get-dfx-version.d.ts +0 -0
- package/dist/helpers/get-dfx-version.js +0 -0
- package/dist/helpers/get-moc-path.d.ts +0 -0
- package/dist/helpers/get-moc-path.js +0 -0
- package/dist/helpers/get-moc-version.d.ts +0 -0
- package/dist/helpers/get-moc-version.js +0 -0
- package/dist/integrity.d.ts +0 -0
- package/dist/integrity.js +0 -0
- package/dist/mops.d.ts +0 -0
- package/dist/mops.js +1 -1
- package/dist/notify-installs.d.ts +0 -0
- package/dist/notify-installs.js +0 -0
- package/dist/package.json +1 -1
- package/dist/parallel.d.ts +0 -0
- package/dist/parallel.js +0 -0
- package/dist/pem.d.ts +0 -0
- package/dist/pem.js +0 -0
- package/dist/release-cli.d.ts +1 -0
- package/dist/release-cli.js +35 -0
- package/dist/remove-scripts.d.ts +1 -0
- package/dist/remove-scripts.js +5 -0
- package/dist/resolve-packages.d.ts +0 -0
- package/dist/resolve-packages.js +0 -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/types.d.ts +0 -0
- package/dist/types.js +0 -0
- package/dist/vessel.d.ts +0 -0
- package/dist/vessel.js +1 -1
- package/global.d.ts +0 -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 +17 -17
- package/notify-installs.ts +2 -2
- package/package.json +1 -1
- package/parallel.ts +1 -1
- package/pem.ts +5 -5
- 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/types.ts +25 -25
- package/vessel.ts +16 -16
- package/dist/commands/replica.d.ts +0 -36
- package/dist/commands/replica.js +0 -103
|
@@ -11,7 +11,7 @@ import * as moc from './moc.js';
|
|
|
11
11
|
import * as pocketIc from './pocket-ic.js';
|
|
12
12
|
import * as wasmtime from './wasmtime.js';
|
|
13
13
|
|
|
14
|
-
function getToolUtils(tool: Tool) {
|
|
14
|
+
function getToolUtils(tool : Tool) {
|
|
15
15
|
if (tool === 'moc') {
|
|
16
16
|
return moc;
|
|
17
17
|
}
|
|
@@ -136,7 +136,7 @@ async function init({reset = false, silent = false} = {}) {
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
async function download(tool: Tool, version: string, {silent = false, verbose = false} = {}) {
|
|
139
|
+
async function download(tool : Tool, version : string, {silent = false, verbose = false} = {}) {
|
|
140
140
|
let toolUtils = getToolUtils(tool);
|
|
141
141
|
let logUpdate = createLogUpdate(process.stdout, {showCursor: true});
|
|
142
142
|
|
|
@@ -161,7 +161,7 @@ async function installAll({silent = false, verbose = false} = {}) {
|
|
|
161
161
|
|
|
162
162
|
let logUpdate = createLogUpdate(process.stdout, {showCursor: true});
|
|
163
163
|
|
|
164
|
-
let log = (...args: string[]) => {
|
|
164
|
+
let log = (...args : string[]) => {
|
|
165
165
|
if (silent) {
|
|
166
166
|
return;
|
|
167
167
|
}
|
|
@@ -191,21 +191,21 @@ async function installAll({silent = false, verbose = false} = {}) {
|
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
async function promptVersion(tool: Tool): Promise<string> {
|
|
194
|
+
async function promptVersion(tool : Tool) : Promise<string> {
|
|
195
195
|
let config = readConfig();
|
|
196
196
|
config.toolchain = config.toolchain || {};
|
|
197
197
|
let current = config.toolchain[tool];
|
|
198
198
|
|
|
199
199
|
let toolUtils = getToolUtils(tool);
|
|
200
200
|
let releases = await toolUtils.getReleases();
|
|
201
|
-
let versions = releases.map((item: {tag_name: any;}) => item.tag_name);
|
|
201
|
+
let versions = releases.map((item : {tag_name : any;}) => item.tag_name);
|
|
202
202
|
let currentIndex = versions.indexOf(current);
|
|
203
203
|
|
|
204
204
|
let res = await prompts({
|
|
205
205
|
type: 'select',
|
|
206
206
|
name: 'version',
|
|
207
207
|
message: `Select ${tool} version`,
|
|
208
|
-
choices: releases.map((release: {published_at: string | number | Date; tag_name: string;}, i: any) => {
|
|
208
|
+
choices: releases.map((release : {published_at : string | number | Date; tag_name : string;}, i : any) => {
|
|
209
209
|
let date = new Date(release.published_at).toLocaleDateString(undefined, {year: 'numeric', month: 'short', day: 'numeric'});
|
|
210
210
|
return {
|
|
211
211
|
title: release.tag_name + chalk.gray(` ${date}${currentIndex === i ? chalk.italic(' (current)') : ''}`),
|
|
@@ -219,7 +219,7 @@ async function promptVersion(tool: Tool): Promise<string> {
|
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
// download binary and set version in mops.toml
|
|
222
|
-
async function use(tool: Tool, version?: string) {
|
|
222
|
+
async function use(tool : Tool, version ?: string) {
|
|
223
223
|
if (tool === 'moc') {
|
|
224
224
|
await ensureToolchainInited();
|
|
225
225
|
}
|
|
@@ -252,7 +252,7 @@ async function use(tool: Tool, version?: string) {
|
|
|
252
252
|
}
|
|
253
253
|
|
|
254
254
|
// download latest binary and set version in mops.toml
|
|
255
|
-
async function update(tool?: Tool) {
|
|
255
|
+
async function update(tool ?: Tool) {
|
|
256
256
|
if (tool === 'moc') {
|
|
257
257
|
await ensureToolchainInited();
|
|
258
258
|
}
|
|
@@ -287,7 +287,7 @@ async function update(tool?: Tool) {
|
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
// return current version from mops.toml
|
|
290
|
-
async function bin(tool: Tool, {fallback = false} = {}): Promise<string> {
|
|
290
|
+
async function bin(tool : Tool, {fallback = false} = {}) : Promise<string> {
|
|
291
291
|
let hasConfig = getClosestConfigFile();
|
|
292
292
|
|
|
293
293
|
// fallback to dfx moc
|
|
@@ -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, 'moc'));
|
|
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 (process.platform == 'win32') {
|
|
26
26
|
console.error('Windows is not supported. Please use WSL');
|
|
27
27
|
process.exit(1);
|
|
@@ -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
|
package/dist/api/actors.d.ts
CHANGED
|
File without changes
|
package/dist/api/actors.js
CHANGED
|
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;
|
|
File without changes
|
|
File without changes
|
package/dist/api/index.d.ts
CHANGED
|
File without changes
|
package/dist/api/index.js
CHANGED
|
File without changes
|
package/dist/api/network.d.ts
CHANGED
|
File without changes
|
package/dist/api/network.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/bin/mops.d.ts
CHANGED
|
File without changes
|
package/dist/bin/mops.js
CHANGED
|
File without changes
|
|
@@ -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, ' '));
|
package/dist/cache.d.ts
CHANGED
|
File without changes
|
package/dist/cache.js
CHANGED
|
File without changes
|
package/dist/cli.d.ts
CHANGED
|
File without changes
|
package/dist/cli.js
CHANGED
|
@@ -101,6 +101,7 @@ program
|
|
|
101
101
|
.description('Publish package to the mops registry')
|
|
102
102
|
.option('--no-docs', 'Do not generate docs')
|
|
103
103
|
.option('--no-test', 'Do not run tests')
|
|
104
|
+
.option('--no-bench', 'Do not run benchmarks')
|
|
104
105
|
.action(async (options) => {
|
|
105
106
|
if (!checkConfigFile()) {
|
|
106
107
|
process.exit(1);
|
package/dist/commands/add.d.ts
CHANGED
|
File without changes
|
package/dist/commands/add.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|