ic-mops 0.40.0 → 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/.npmrc +2 -1
- package/CHANGELOG.md +8 -0
- package/DEVELOPMENT.md +25 -0
- 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/cli.ts +22 -19
- package/commands/add.ts +0 -0
- package/commands/install-all.ts +0 -0
- package/commands/publish.ts +1 -27
- package/commands/self.ts +75 -0
- package/commands/template.ts +9 -10
- package/commands/toolchain/index.ts +0 -0
- package/dist/api/actors.d.ts +0 -0
- package/dist/api/actors.js +0 -0
- package/dist/api/downloadPackageFiles.d.ts +0 -0
- package/dist/api/downloadPackageFiles.js +0 -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/mops.d.ts +1 -1
- package/dist/bin/mops.js +2 -1
- package/dist/bundle-package-json.d.ts +0 -0
- package/dist/bundle-package-json.js +0 -0
- package/dist/cache.d.ts +0 -0
- package/dist/cache.js +0 -0
- package/dist/check-requirements.d.ts +3 -0
- package/dist/check-requirements.js +39 -0
- package/dist/cli.d.ts +0 -0
- package/dist/cli.js +18 -18
- 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-replica.d.ts +0 -0
- package/dist/commands/bench-replica.js +0 -0
- package/dist/commands/bench.d.ts +0 -0
- package/dist/commands/bench.js +0 -0
- 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 +0 -0
- 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 +0 -0
- package/dist/commands/publish.js +1 -24
- 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.js +1 -1
- 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 +9 -10
- package/dist/commands/test/mmf1.d.ts +0 -0
- package/dist/commands/test/mmf1.js +0 -0
- 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 +0 -0
- 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 +0 -0
- package/dist/commands/toolchain/pocket-ic.js +0 -0
- package/dist/commands/toolchain/toolchain-utils.d.ts +0 -0
- package/dist/commands/toolchain/toolchain-utils.js +0 -0
- 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 +0 -0
- 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 +0 -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 +0 -0
- package/dist/declarations/main/main.did.d.ts +0 -0
- package/dist/declarations/main/main.did.js +0 -0
- package/dist/helpers/find-changelog-entry.d.ts +0 -0
- package/dist/helpers/find-changelog-entry.js +0 -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 +1 -0
- package/dist/mops.js +4 -0
- package/dist/notify-installs.d.ts +0 -0
- package/dist/notify-installs.js +0 -0
- package/dist/package.json +20 -26
- 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 +0 -0
- package/dist/release-cli.js +9 -7
- package/dist/resolve-packages.d.ts +0 -0
- package/dist/resolve-packages.js +0 -0
- package/dist/templates.d.ts +1 -0
- package/dist/templates.js +4 -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 +0 -0
- package/helpers/find-changelog-entry.ts +27 -0
- package/mops.ts +5 -0
- package/package.json +28 -19
- package/release-cli.ts +62 -0
- package/remove-scripts.ts +6 -0
- package/templates.ts +5 -0
- package/tsconfig.json +1 -1
- package/types.ts +0 -0
- package/commands/self-update.ts +0 -6
- 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
package/bundle/cli.tgz
ADDED
|
Binary file
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
type anon_class_10_1 =
|
|
2
|
+
service {
|
|
3
|
+
getSchema: () -> (BenchSchema) query;
|
|
4
|
+
getStats: () -> (BenchResult) query;
|
|
5
|
+
init: () -> (BenchSchema);
|
|
6
|
+
runCellQuery: (nat, nat) -> (BenchResult) query;
|
|
7
|
+
runCellUpdate: (nat, nat) -> (BenchResult);
|
|
8
|
+
runCellUpdateAwait: (nat, nat) -> (BenchResult);
|
|
9
|
+
};
|
|
10
|
+
type BenchSchema =
|
|
11
|
+
record {
|
|
12
|
+
cols: vec text;
|
|
13
|
+
description: text;
|
|
14
|
+
name: text;
|
|
15
|
+
rows: vec text;
|
|
16
|
+
};
|
|
17
|
+
type BenchResult =
|
|
18
|
+
record {
|
|
19
|
+
instructions: int;
|
|
20
|
+
rts_collector_instructions: int;
|
|
21
|
+
rts_heap_size: int;
|
|
22
|
+
rts_memory_size: int;
|
|
23
|
+
rts_mutator_instructions: int;
|
|
24
|
+
rts_total_allocation: int;
|
|
25
|
+
};
|
|
26
|
+
service : () -> anon_class_10_1
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Principal } from '@dfinity/principal';
|
|
2
|
+
import type { ActorMethod } from '@dfinity/agent';
|
|
3
|
+
import type { IDL } from '@dfinity/candid';
|
|
4
|
+
|
|
5
|
+
export interface BenchResult {
|
|
6
|
+
'instructions' : bigint,
|
|
7
|
+
'rts_memory_size' : bigint,
|
|
8
|
+
'rts_total_allocation' : bigint,
|
|
9
|
+
'rts_collector_instructions' : bigint,
|
|
10
|
+
'rts_mutator_instructions' : bigint,
|
|
11
|
+
'rts_heap_size' : bigint,
|
|
12
|
+
}
|
|
13
|
+
export interface BenchSchema {
|
|
14
|
+
'cols' : Array<string>,
|
|
15
|
+
'name' : string,
|
|
16
|
+
'rows' : Array<string>,
|
|
17
|
+
'description' : string,
|
|
18
|
+
}
|
|
19
|
+
export interface anon_class_10_1 {
|
|
20
|
+
'getSchema' : ActorMethod<[], BenchSchema>,
|
|
21
|
+
'getStats' : ActorMethod<[], BenchResult>,
|
|
22
|
+
'init' : ActorMethod<[], BenchSchema>,
|
|
23
|
+
'runCellQuery' : ActorMethod<[bigint, bigint], BenchResult>,
|
|
24
|
+
'runCellUpdate' : ActorMethod<[bigint, bigint], BenchResult>,
|
|
25
|
+
'runCellUpdateAwait' : ActorMethod<[bigint, bigint], BenchResult>,
|
|
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[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const idlFactory = ({ IDL }) => {
|
|
2
|
+
const BenchSchema = IDL.Record({
|
|
3
|
+
'cols' : IDL.Vec(IDL.Text),
|
|
4
|
+
'name' : IDL.Text,
|
|
5
|
+
'rows' : IDL.Vec(IDL.Text),
|
|
6
|
+
'description' : IDL.Text,
|
|
7
|
+
});
|
|
8
|
+
const BenchResult = IDL.Record({
|
|
9
|
+
'instructions' : IDL.Int,
|
|
10
|
+
'rts_memory_size' : IDL.Int,
|
|
11
|
+
'rts_total_allocation' : IDL.Int,
|
|
12
|
+
'rts_collector_instructions' : IDL.Int,
|
|
13
|
+
'rts_mutator_instructions' : IDL.Int,
|
|
14
|
+
'rts_heap_size' : IDL.Int,
|
|
15
|
+
});
|
|
16
|
+
const anon_class_10_1 = IDL.Service({
|
|
17
|
+
'getSchema' : IDL.Func([], [BenchSchema], ['query']),
|
|
18
|
+
'getStats' : IDL.Func([], [BenchResult], ['query']),
|
|
19
|
+
'init' : IDL.Func([], [BenchSchema], []),
|
|
20
|
+
'runCellQuery' : IDL.Func([IDL.Nat, IDL.Nat], [BenchResult], ['query']),
|
|
21
|
+
'runCellUpdate' : IDL.Func([IDL.Nat, IDL.Nat], [BenchResult], []),
|
|
22
|
+
'runCellUpdateAwait' : IDL.Func([IDL.Nat, IDL.Nat], [BenchResult], []),
|
|
23
|
+
});
|
|
24
|
+
return anon_class_10_1;
|
|
25
|
+
};
|
|
26
|
+
export const init = ({ IDL }) => { return []; };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ActorSubclass,
|
|
3
|
+
HttpAgentOptions,
|
|
4
|
+
ActorConfig,
|
|
5
|
+
Agent,
|
|
6
|
+
} from "@dfinity/agent";
|
|
7
|
+
import type { Principal } from "@dfinity/principal";
|
|
8
|
+
import type { IDL } from "@dfinity/candid";
|
|
9
|
+
|
|
10
|
+
import { _SERVICE } from './bench.did';
|
|
11
|
+
|
|
12
|
+
export declare const idlFactory: IDL.InterfaceFactory;
|
|
13
|
+
export declare const canisterId: string;
|
|
14
|
+
|
|
15
|
+
export declare interface CreateActorOptions {
|
|
16
|
+
/**
|
|
17
|
+
* @see {@link Agent}
|
|
18
|
+
*/
|
|
19
|
+
agent?: Agent;
|
|
20
|
+
/**
|
|
21
|
+
* @see {@link HttpAgentOptions}
|
|
22
|
+
*/
|
|
23
|
+
agentOptions?: HttpAgentOptions;
|
|
24
|
+
/**
|
|
25
|
+
* @see {@link ActorConfig}
|
|
26
|
+
*/
|
|
27
|
+
actorOptions?: ActorConfig;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Intializes an {@link ActorSubclass}, configured with the provided SERVICE interface of a canister.
|
|
32
|
+
* @constructs {@link ActorSubClass}
|
|
33
|
+
* @param {string | Principal} canisterId - ID of the canister the {@link Actor} will talk to
|
|
34
|
+
* @param {CreateActorOptions} options - see {@link CreateActorOptions}
|
|
35
|
+
* @param {CreateActorOptions["agent"]} options.agent - a pre-configured agent you'd like to use. Supercedes agentOptions
|
|
36
|
+
* @param {CreateActorOptions["agentOptions"]} options.agentOptions - options to set up a new agent
|
|
37
|
+
* @see {@link HttpAgentOptions}
|
|
38
|
+
* @param {CreateActorOptions["actorOptions"]} options.actorOptions - options for the Actor
|
|
39
|
+
* @see {@link ActorConfig}
|
|
40
|
+
*/
|
|
41
|
+
export declare const createActor: (
|
|
42
|
+
canisterId: string | Principal,
|
|
43
|
+
options?: CreateActorOptions
|
|
44
|
+
) => ActorSubclass<_SERVICE>;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Intialized Actor using default settings, ready to talk to a canister using its candid interface
|
|
48
|
+
* @constructs {@link ActorSubClass}
|
|
49
|
+
*/
|
|
50
|
+
export declare const bench: ActorSubclass<_SERVICE>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Actor, HttpAgent } from "@dfinity/agent";
|
|
2
|
+
|
|
3
|
+
// Imports and re-exports candid interface
|
|
4
|
+
import { idlFactory } from "./bench.did.js";
|
|
5
|
+
export { idlFactory } from "./bench.did.js";
|
|
6
|
+
|
|
7
|
+
/* CANISTER_ID is replaced by webpack based on node environment
|
|
8
|
+
* Note: canister environment variable will be standardized as
|
|
9
|
+
* process.env.CANISTER_ID_<CANISTER_NAME_UPPERCASE>
|
|
10
|
+
* beginning in dfx 0.15.0
|
|
11
|
+
*/
|
|
12
|
+
export const canisterId =
|
|
13
|
+
process.env.CANISTER_ID_BENCH ||
|
|
14
|
+
process.env.BENCH_CANISTER_ID;
|
|
15
|
+
|
|
16
|
+
export const createActor = (canisterId, options = {}) => {
|
|
17
|
+
const agent = options.agent || new HttpAgent({ ...options.agentOptions });
|
|
18
|
+
|
|
19
|
+
if (options.agent && options.agentOptions) {
|
|
20
|
+
console.warn(
|
|
21
|
+
"Detected both agent and agentOptions passed to createActor. Ignoring agentOptions and proceeding with the provided agent."
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Fetch root key for certificate validation during development
|
|
26
|
+
if (process.env.DFX_NETWORK !== "ic") {
|
|
27
|
+
agent.fetchRootKey().catch((err) => {
|
|
28
|
+
console.warn(
|
|
29
|
+
"Unable to fetch root key. Check to ensure that your local replica is running"
|
|
30
|
+
);
|
|
31
|
+
console.error(err);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Creates an actor with using the candid interface and the HttpAgent
|
|
36
|
+
return Actor.createActor(idlFactory, {
|
|
37
|
+
agent,
|
|
38
|
+
canisterId,
|
|
39
|
+
...options.actorOptions,
|
|
40
|
+
});
|
|
41
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ActorSubclass,
|
|
3
|
+
HttpAgentOptions,
|
|
4
|
+
ActorConfig,
|
|
5
|
+
Agent,
|
|
6
|
+
} from "@dfinity/agent";
|
|
7
|
+
import type { Principal } from "@dfinity/principal";
|
|
8
|
+
import type { IDL } from "@dfinity/candid";
|
|
9
|
+
|
|
10
|
+
import { _SERVICE } from './main.did';
|
|
11
|
+
|
|
12
|
+
export declare const idlFactory: IDL.InterfaceFactory;
|
|
13
|
+
export declare const canisterId: string;
|
|
14
|
+
|
|
15
|
+
export declare interface CreateActorOptions {
|
|
16
|
+
/**
|
|
17
|
+
* @see {@link Agent}
|
|
18
|
+
*/
|
|
19
|
+
agent?: Agent;
|
|
20
|
+
/**
|
|
21
|
+
* @see {@link HttpAgentOptions}
|
|
22
|
+
*/
|
|
23
|
+
agentOptions?: HttpAgentOptions;
|
|
24
|
+
/**
|
|
25
|
+
* @see {@link ActorConfig}
|
|
26
|
+
*/
|
|
27
|
+
actorOptions?: ActorConfig;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Intializes an {@link ActorSubclass}, configured with the provided SERVICE interface of a canister.
|
|
32
|
+
* @constructs {@link ActorSubClass}
|
|
33
|
+
* @param {string | Principal} canisterId - ID of the canister the {@link Actor} will talk to
|
|
34
|
+
* @param {CreateActorOptions} options - see {@link CreateActorOptions}
|
|
35
|
+
* @param {CreateActorOptions["agent"]} options.agent - a pre-configured agent you'd like to use. Supercedes agentOptions
|
|
36
|
+
* @param {CreateActorOptions["agentOptions"]} options.agentOptions - options to set up a new agent
|
|
37
|
+
* @see {@link HttpAgentOptions}
|
|
38
|
+
* @param {CreateActorOptions["actorOptions"]} options.actorOptions - options for the Actor
|
|
39
|
+
* @see {@link ActorConfig}
|
|
40
|
+
*/
|
|
41
|
+
export declare const createActor: (
|
|
42
|
+
canisterId: string | Principal,
|
|
43
|
+
options?: CreateActorOptions
|
|
44
|
+
) => ActorSubclass<_SERVICE>;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Intialized Actor using default settings, ready to talk to a canister using its candid interface
|
|
48
|
+
* @constructs {@link ActorSubClass}
|
|
49
|
+
*/
|
|
50
|
+
export declare const main: ActorSubclass<_SERVICE>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Actor, HttpAgent } from "@dfinity/agent";
|
|
2
|
+
|
|
3
|
+
// Imports and re-exports candid interface
|
|
4
|
+
import { idlFactory } from "./main.did.js";
|
|
5
|
+
export { idlFactory } from "./main.did.js";
|
|
6
|
+
|
|
7
|
+
/* CANISTER_ID is replaced by webpack based on node environment
|
|
8
|
+
* Note: canister environment variable will be standardized as
|
|
9
|
+
* process.env.CANISTER_ID_<CANISTER_NAME_UPPERCASE>
|
|
10
|
+
* beginning in dfx 0.15.0
|
|
11
|
+
*/
|
|
12
|
+
export const canisterId =
|
|
13
|
+
process.env.CANISTER_ID_MAIN ||
|
|
14
|
+
process.env.MAIN_CANISTER_ID;
|
|
15
|
+
|
|
16
|
+
export const createActor = (canisterId, options = {}) => {
|
|
17
|
+
const agent = options.agent || new HttpAgent({ ...options.agentOptions });
|
|
18
|
+
|
|
19
|
+
if (options.agent && options.agentOptions) {
|
|
20
|
+
console.warn(
|
|
21
|
+
"Detected both agent and agentOptions passed to createActor. Ignoring agentOptions and proceeding with the provided agent."
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Fetch root key for certificate validation during development
|
|
26
|
+
if (process.env.DFX_NETWORK !== "ic") {
|
|
27
|
+
agent.fetchRootKey().catch((err) => {
|
|
28
|
+
console.warn(
|
|
29
|
+
"Unable to fetch root key. Check to ensure that your local replica is running"
|
|
30
|
+
);
|
|
31
|
+
console.error(err);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Creates an actor with using the candid interface and the HttpAgent
|
|
36
|
+
return Actor.createActor(idlFactory, {
|
|
37
|
+
agent,
|
|
38
|
+
canisterId,
|
|
39
|
+
...options.actorOptions,
|
|
40
|
+
});
|
|
41
|
+
};
|
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
type User__1 =
|
|
2
|
+
record {
|
|
3
|
+
displayName: text;
|
|
4
|
+
email: text;
|
|
5
|
+
emailVerified: bool;
|
|
6
|
+
github: text;
|
|
7
|
+
githubVerified: bool;
|
|
8
|
+
id: principal;
|
|
9
|
+
name: text;
|
|
10
|
+
site: text;
|
|
11
|
+
twitter: text;
|
|
12
|
+
twitterVerified: bool;
|
|
13
|
+
};
|
|
14
|
+
type User =
|
|
15
|
+
record {
|
|
16
|
+
displayName: text;
|
|
17
|
+
email: text;
|
|
18
|
+
emailVerified: bool;
|
|
19
|
+
github: text;
|
|
20
|
+
githubVerified: bool;
|
|
21
|
+
id: principal;
|
|
22
|
+
name: text;
|
|
23
|
+
site: text;
|
|
24
|
+
twitter: text;
|
|
25
|
+
twitterVerified: bool;
|
|
26
|
+
};
|
|
27
|
+
type Time = int;
|
|
28
|
+
type Text = text;
|
|
29
|
+
type TestsChanges =
|
|
30
|
+
record {
|
|
31
|
+
addedNames: vec text;
|
|
32
|
+
removedNames: vec text;
|
|
33
|
+
};
|
|
34
|
+
type TestStats__1 =
|
|
35
|
+
record {
|
|
36
|
+
passed: nat;
|
|
37
|
+
passedNames: vec text;
|
|
38
|
+
};
|
|
39
|
+
type TestStats =
|
|
40
|
+
record {
|
|
41
|
+
passed: nat;
|
|
42
|
+
passedNames: vec text;
|
|
43
|
+
};
|
|
44
|
+
type StreamingToken = blob;
|
|
45
|
+
type StreamingStrategy = variant {
|
|
46
|
+
Callback:
|
|
47
|
+
record {
|
|
48
|
+
callback: StreamingCallback;
|
|
49
|
+
token: StreamingToken;
|
|
50
|
+
};};
|
|
51
|
+
type StreamingCallbackResponse =
|
|
52
|
+
record {
|
|
53
|
+
body: blob;
|
|
54
|
+
token: opt StreamingToken;
|
|
55
|
+
};
|
|
56
|
+
type StreamingCallback = func (StreamingToken) ->
|
|
57
|
+
(opt StreamingCallbackResponse) query;
|
|
58
|
+
type StorageStats =
|
|
59
|
+
record {
|
|
60
|
+
cyclesBalance: nat;
|
|
61
|
+
fileCount: nat;
|
|
62
|
+
memorySize: nat;
|
|
63
|
+
};
|
|
64
|
+
type StorageId = principal;
|
|
65
|
+
type SemverPart =
|
|
66
|
+
variant {
|
|
67
|
+
major;
|
|
68
|
+
minor;
|
|
69
|
+
patch;
|
|
70
|
+
};
|
|
71
|
+
type Script =
|
|
72
|
+
record {
|
|
73
|
+
name: text;
|
|
74
|
+
value: text;
|
|
75
|
+
};
|
|
76
|
+
type Result_8 =
|
|
77
|
+
variant {
|
|
78
|
+
err: Err;
|
|
79
|
+
ok: vec record {
|
|
80
|
+
FileId;
|
|
81
|
+
blob;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
type Result_7 =
|
|
85
|
+
variant {
|
|
86
|
+
err: Err;
|
|
87
|
+
ok: vec FileId;
|
|
88
|
+
};
|
|
89
|
+
type Result_6 =
|
|
90
|
+
variant {
|
|
91
|
+
err: Err;
|
|
92
|
+
ok: vec record {
|
|
93
|
+
PackageName;
|
|
94
|
+
PackageVersion;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
type Result_5 =
|
|
98
|
+
variant {
|
|
99
|
+
err: Err;
|
|
100
|
+
ok: PackageVersion;
|
|
101
|
+
};
|
|
102
|
+
type Result_4 =
|
|
103
|
+
variant {
|
|
104
|
+
err: Err;
|
|
105
|
+
ok: PackageDetails;
|
|
106
|
+
};
|
|
107
|
+
type Result_3 =
|
|
108
|
+
variant {
|
|
109
|
+
err: Err;
|
|
110
|
+
ok: FileId;
|
|
111
|
+
};
|
|
112
|
+
type Result_2 =
|
|
113
|
+
variant {
|
|
114
|
+
err: Err;
|
|
115
|
+
ok: PublishingId;
|
|
116
|
+
};
|
|
117
|
+
type Result_1 =
|
|
118
|
+
variant {
|
|
119
|
+
err: text;
|
|
120
|
+
ok;
|
|
121
|
+
};
|
|
122
|
+
type Result =
|
|
123
|
+
variant {
|
|
124
|
+
err: Err;
|
|
125
|
+
ok;
|
|
126
|
+
};
|
|
127
|
+
type Response =
|
|
128
|
+
record {
|
|
129
|
+
body: blob;
|
|
130
|
+
headers: vec Header;
|
|
131
|
+
status_code: nat16;
|
|
132
|
+
streaming_strategy: opt StreamingStrategy;
|
|
133
|
+
upgrade: opt bool;
|
|
134
|
+
};
|
|
135
|
+
type Request =
|
|
136
|
+
record {
|
|
137
|
+
body: blob;
|
|
138
|
+
certificate_version: opt nat16;
|
|
139
|
+
headers: vec Header;
|
|
140
|
+
method: text;
|
|
141
|
+
url: text;
|
|
142
|
+
};
|
|
143
|
+
type PublishingId = text;
|
|
144
|
+
type PageCount = nat;
|
|
145
|
+
type PackageVersion = text;
|
|
146
|
+
type PackageSummary__1 =
|
|
147
|
+
record {
|
|
148
|
+
config: PackageConfigV2__1;
|
|
149
|
+
downloadsInLast30Days: nat;
|
|
150
|
+
downloadsInLast7Days: nat;
|
|
151
|
+
downloadsTotal: nat;
|
|
152
|
+
owner: principal;
|
|
153
|
+
ownerInfo: User;
|
|
154
|
+
publication: PackagePublication;
|
|
155
|
+
quality: PackageQuality;
|
|
156
|
+
};
|
|
157
|
+
type PackageSummaryWithChanges__1 =
|
|
158
|
+
record {
|
|
159
|
+
changes: PackageChanges;
|
|
160
|
+
config: PackageConfigV2__1;
|
|
161
|
+
downloadsInLast30Days: nat;
|
|
162
|
+
downloadsInLast7Days: nat;
|
|
163
|
+
downloadsTotal: nat;
|
|
164
|
+
owner: principal;
|
|
165
|
+
ownerInfo: User;
|
|
166
|
+
publication: PackagePublication;
|
|
167
|
+
quality: PackageQuality;
|
|
168
|
+
};
|
|
169
|
+
type PackageSummaryWithChanges =
|
|
170
|
+
record {
|
|
171
|
+
changes: PackageChanges;
|
|
172
|
+
config: PackageConfigV2__1;
|
|
173
|
+
downloadsInLast30Days: nat;
|
|
174
|
+
downloadsInLast7Days: nat;
|
|
175
|
+
downloadsTotal: nat;
|
|
176
|
+
owner: principal;
|
|
177
|
+
ownerInfo: User;
|
|
178
|
+
publication: PackagePublication;
|
|
179
|
+
quality: PackageQuality;
|
|
180
|
+
};
|
|
181
|
+
type PackageSummary =
|
|
182
|
+
record {
|
|
183
|
+
config: PackageConfigV2__1;
|
|
184
|
+
downloadsInLast30Days: nat;
|
|
185
|
+
downloadsInLast7Days: nat;
|
|
186
|
+
downloadsTotal: nat;
|
|
187
|
+
owner: principal;
|
|
188
|
+
ownerInfo: User;
|
|
189
|
+
publication: PackagePublication;
|
|
190
|
+
quality: PackageQuality;
|
|
191
|
+
};
|
|
192
|
+
type PackageQuality =
|
|
193
|
+
record {
|
|
194
|
+
depsStatus: DepsStatus;
|
|
195
|
+
hasDescription: bool;
|
|
196
|
+
hasDocumentation: bool;
|
|
197
|
+
hasKeywords: bool;
|
|
198
|
+
hasLicense: bool;
|
|
199
|
+
hasReleaseNotes: bool;
|
|
200
|
+
hasRepository: bool;
|
|
201
|
+
hasTests: bool;
|
|
202
|
+
};
|
|
203
|
+
type PackagePublication =
|
|
204
|
+
record {
|
|
205
|
+
storage: principal;
|
|
206
|
+
time: Time;
|
|
207
|
+
user: principal;
|
|
208
|
+
};
|
|
209
|
+
type PackageName__1 = text;
|
|
210
|
+
type PackageName = text;
|
|
211
|
+
type PackageId = text;
|
|
212
|
+
type PackageFileStatsPublic =
|
|
213
|
+
record {
|
|
214
|
+
sourceFiles: nat;
|
|
215
|
+
sourceSize: nat;
|
|
216
|
+
};
|
|
217
|
+
type PackageDetails =
|
|
218
|
+
record {
|
|
219
|
+
benchmarks: Benchmarks__1;
|
|
220
|
+
changes: PackageChanges;
|
|
221
|
+
config: PackageConfigV2__1;
|
|
222
|
+
dependents: vec PackageSummary__1;
|
|
223
|
+
deps: vec PackageSummary__1;
|
|
224
|
+
devDeps: vec PackageSummary__1;
|
|
225
|
+
downloadTrend: vec DownloadsSnapshot;
|
|
226
|
+
downloadsInLast30Days: nat;
|
|
227
|
+
downloadsInLast7Days: nat;
|
|
228
|
+
downloadsTotal: nat;
|
|
229
|
+
fileStats: PackageFileStatsPublic;
|
|
230
|
+
owner: principal;
|
|
231
|
+
ownerInfo: User;
|
|
232
|
+
publication: PackagePublication;
|
|
233
|
+
quality: PackageQuality;
|
|
234
|
+
testStats: TestStats__1;
|
|
235
|
+
versionHistory: vec PackageSummaryWithChanges__1;
|
|
236
|
+
};
|
|
237
|
+
type PackageConfigV2__1 =
|
|
238
|
+
record {
|
|
239
|
+
baseDir: text;
|
|
240
|
+
dependencies: vec DependencyV2;
|
|
241
|
+
description: text;
|
|
242
|
+
devDependencies: vec DependencyV2;
|
|
243
|
+
dfx: text;
|
|
244
|
+
documentation: text;
|
|
245
|
+
donation: text;
|
|
246
|
+
homepage: text;
|
|
247
|
+
keywords: vec text;
|
|
248
|
+
license: text;
|
|
249
|
+
moc: text;
|
|
250
|
+
name: PackageName__1;
|
|
251
|
+
readme: text;
|
|
252
|
+
repository: text;
|
|
253
|
+
scripts: vec Script;
|
|
254
|
+
version: text;
|
|
255
|
+
};
|
|
256
|
+
type PackageConfigV2 =
|
|
257
|
+
record {
|
|
258
|
+
baseDir: text;
|
|
259
|
+
dependencies: vec DependencyV2;
|
|
260
|
+
description: text;
|
|
261
|
+
devDependencies: vec DependencyV2;
|
|
262
|
+
dfx: text;
|
|
263
|
+
documentation: text;
|
|
264
|
+
donation: text;
|
|
265
|
+
homepage: text;
|
|
266
|
+
keywords: vec text;
|
|
267
|
+
license: text;
|
|
268
|
+
moc: text;
|
|
269
|
+
name: PackageName__1;
|
|
270
|
+
readme: text;
|
|
271
|
+
repository: text;
|
|
272
|
+
scripts: vec Script;
|
|
273
|
+
version: text;
|
|
274
|
+
};
|
|
275
|
+
type PackageChanges =
|
|
276
|
+
record {
|
|
277
|
+
curBenchmarks: Benchmarks__1;
|
|
278
|
+
deps: vec DepChange;
|
|
279
|
+
devDeps: vec DepChange;
|
|
280
|
+
notes: text;
|
|
281
|
+
prevBenchmarks: Benchmarks__1;
|
|
282
|
+
tests: TestsChanges;
|
|
283
|
+
};
|
|
284
|
+
type Main =
|
|
285
|
+
service {
|
|
286
|
+
backup: () -> ();
|
|
287
|
+
computeHashesForExistingFiles: () -> ();
|
|
288
|
+
finishPublish: (PublishingId) -> (Result);
|
|
289
|
+
getApiVersion: () -> (Text) query;
|
|
290
|
+
getBackupCanisterId: () -> (principal) query;
|
|
291
|
+
getDefaultPackages: (text) ->
|
|
292
|
+
(vec record {
|
|
293
|
+
PackageName;
|
|
294
|
+
PackageVersion;
|
|
295
|
+
}) query;
|
|
296
|
+
getDownloadTrendByPackageId: (PackageId) ->
|
|
297
|
+
(vec DownloadsSnapshot__1) query;
|
|
298
|
+
getDownloadTrendByPackageName: (PackageName) ->
|
|
299
|
+
(vec DownloadsSnapshot__1) query;
|
|
300
|
+
getFileHashes: (PackageName, PackageVersion) -> (Result_8);
|
|
301
|
+
getFileHashesByPackageIds: (vec PackageId) ->
|
|
302
|
+
(vec record {
|
|
303
|
+
PackageId;
|
|
304
|
+
vec record {
|
|
305
|
+
FileId;
|
|
306
|
+
blob;
|
|
307
|
+
};
|
|
308
|
+
});
|
|
309
|
+
getFileHashesQuery: (PackageName, PackageVersion) -> (Result_8) query;
|
|
310
|
+
getFileIds: (PackageName, PackageVersion) -> (Result_7) query;
|
|
311
|
+
getHighestSemverBatch:
|
|
312
|
+
(vec record {
|
|
313
|
+
PackageName;
|
|
314
|
+
PackageVersion;
|
|
315
|
+
SemverPart;
|
|
316
|
+
}) -> (Result_6) query;
|
|
317
|
+
getHighestVersion: (PackageName) -> (Result_5) query;
|
|
318
|
+
getMostDownloadedPackages: () -> (vec PackageSummary) query;
|
|
319
|
+
getMostDownloadedPackagesIn7Days: () -> (vec PackageSummary) query;
|
|
320
|
+
getNewPackages: () -> (vec PackageSummary) query;
|
|
321
|
+
getPackageDetails: (PackageName, PackageVersion) -> (Result_4) query;
|
|
322
|
+
getPackagesByCategory: () -> (vec record {
|
|
323
|
+
text;
|
|
324
|
+
vec PackageSummary;
|
|
325
|
+
}) query;
|
|
326
|
+
getRecentlyUpdatedPackages: () -> (vec PackageSummaryWithChanges) query;
|
|
327
|
+
getStoragesStats: () -> (vec record {
|
|
328
|
+
StorageId;
|
|
329
|
+
StorageStats;
|
|
330
|
+
}) query;
|
|
331
|
+
getTotalDownloads: () -> (nat) query;
|
|
332
|
+
getTotalPackages: () -> (nat) query;
|
|
333
|
+
getUser: (principal) -> (opt User__1) query;
|
|
334
|
+
http_request: (Request) -> (Response) query;
|
|
335
|
+
notifyInstall: (PackageName, PackageVersion) -> () oneway;
|
|
336
|
+
notifyInstalls: (vec record {
|
|
337
|
+
PackageName;
|
|
338
|
+
PackageVersion;
|
|
339
|
+
}) -> () oneway;
|
|
340
|
+
restore: (nat) -> ();
|
|
341
|
+
search: (Text, opt nat, opt nat) -> (vec PackageSummary, PageCount) query;
|
|
342
|
+
setUserProp: (text, text) -> (Result_1);
|
|
343
|
+
startFileUpload: (PublishingId, Text, nat, blob) -> (Result_3);
|
|
344
|
+
startPublish: (PackageConfigV2) -> (Result_2);
|
|
345
|
+
transferOwnership: (PackageName, principal) -> (Result_1);
|
|
346
|
+
transformRequest: (HttpTransformArg) -> (HttpResponse) query;
|
|
347
|
+
uploadBenchmarks: (PublishingId, Benchmarks) -> (Result);
|
|
348
|
+
uploadFileChunk: (PublishingId, FileId, nat, blob) -> (Result);
|
|
349
|
+
uploadNotes: (PublishingId, text) -> (Result);
|
|
350
|
+
uploadTestStats: (PublishingId, TestStats) -> (Result);
|
|
351
|
+
};
|
|
352
|
+
type HttpTransformArg =
|
|
353
|
+
record {
|
|
354
|
+
context: blob;
|
|
355
|
+
response: HttpResponse;
|
|
356
|
+
};
|
|
357
|
+
type HttpResponse =
|
|
358
|
+
record {
|
|
359
|
+
body: blob;
|
|
360
|
+
headers: vec HttpHeader;
|
|
361
|
+
status: nat;
|
|
362
|
+
};
|
|
363
|
+
type HttpHeader =
|
|
364
|
+
record {
|
|
365
|
+
name: text;
|
|
366
|
+
value: text;
|
|
367
|
+
};
|
|
368
|
+
type Header =
|
|
369
|
+
record {
|
|
370
|
+
text;
|
|
371
|
+
text;
|
|
372
|
+
};
|
|
373
|
+
type FileId = text;
|
|
374
|
+
type Err = text;
|
|
375
|
+
type DownloadsSnapshot__1 =
|
|
376
|
+
record {
|
|
377
|
+
downloads: nat;
|
|
378
|
+
endTime: Time;
|
|
379
|
+
startTime: Time;
|
|
380
|
+
};
|
|
381
|
+
type DownloadsSnapshot =
|
|
382
|
+
record {
|
|
383
|
+
downloads: nat;
|
|
384
|
+
endTime: Time;
|
|
385
|
+
startTime: Time;
|
|
386
|
+
};
|
|
387
|
+
type DepsStatus =
|
|
388
|
+
variant {
|
|
389
|
+
allLatest;
|
|
390
|
+
tooOld;
|
|
391
|
+
updatesAvailable;
|
|
392
|
+
};
|
|
393
|
+
type DependencyV2 =
|
|
394
|
+
record {
|
|
395
|
+
name: PackageName__1;
|
|
396
|
+
repo: text;
|
|
397
|
+
version: text;
|
|
398
|
+
};
|
|
399
|
+
type DepChange =
|
|
400
|
+
record {
|
|
401
|
+
name: text;
|
|
402
|
+
newVersion: text;
|
|
403
|
+
oldVersion: text;
|
|
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
|
+
};
|
|
426
|
+
service : () -> Main
|