ic-mops 2.2.0 → 2.2.1
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/CHANGELOG.md +3 -0
- package/bundle/bench/bench-canister.mo +130 -0
- package/bundle/bench/user-bench.mo +10 -0
- package/bundle/bin/moc-wrapper.sh +40 -0
- package/bundle/bin/mops.js +3 -0
- package/bundle/cli.js +1569 -0
- package/bundle/cli.tgz +0 -0
- package/bundle/declarations/bench/bench.did +30 -0
- package/bundle/declarations/bench/bench.did.d.ts +33 -0
- package/bundle/declarations/bench/bench.did.js +30 -0
- package/bundle/declarations/bench/index.d.ts +50 -0
- package/bundle/declarations/bench/index.js +40 -0
- package/bundle/declarations/main/index.d.ts +50 -0
- package/bundle/declarations/main/index.js +40 -0
- package/bundle/declarations/main/main.did +428 -0
- package/bundle/declarations/main/main.did.d.ts +348 -0
- package/bundle/declarations/main/main.did.js +406 -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 +40 -0
- package/bundle/declarations/storage/storage.did.js +38 -0
- package/bundle/default-stylesheet.css +415 -0
- package/bundle/package.json +36 -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 +24 -0
- package/bundle/templates/src/lib.mo +15 -0
- package/bundle/templates/test/lib.test.mo +4 -0
- package/bundle/wasm_bg.wasm +0 -0
- package/bundle/xhr-sync-worker.js +51 -0
- package/commands/toolchain/index.ts +4 -0
- package/dist/commands/toolchain/index.js +3 -0
- package/dist/mops.js +0 -4
- package/dist/package.json +6 -7
- package/dist/tests/toolchain.test.js +11 -0
- package/dist/wasm/pkg/bundler/package.json +20 -0
- package/dist/wasm/pkg/bundler/wasm.d.ts +3 -0
- package/dist/wasm/pkg/bundler/wasm.js +5 -0
- package/dist/wasm/pkg/bundler/wasm_bg.js +93 -0
- package/dist/wasm/pkg/bundler/wasm_bg.wasm +0 -0
- package/dist/wasm/pkg/bundler/wasm_bg.wasm.d.ts +8 -0
- package/dist/wasm/pkg/nodejs/wasm_bg.wasm +0 -0
- package/dist/wasm/pkg/web/wasm_bg.wasm +0 -0
- package/mops.ts +0 -6
- package/package.json +8 -9
- package/tests/build/success/.dfx/local/canister_ids.json +17 -0
- package/tests/build/success/.dfx/local/canisters/bar/bar.did +3 -0
- package/tests/build/success/.dfx/local/canisters/bar/bar.most +4 -0
- package/tests/build/success/.dfx/local/canisters/bar/bar.wasm +0 -0
- package/tests/build/success/.dfx/local/canisters/bar/constructor.did +3 -0
- package/tests/build/success/.dfx/local/canisters/bar/index.js +42 -0
- package/tests/build/success/.dfx/local/canisters/bar/init_args.txt +1 -0
- package/tests/build/success/.dfx/local/canisters/bar/service.did +3 -0
- package/tests/build/success/.dfx/local/canisters/bar/service.did.d.ts +7 -0
- package/tests/build/success/.dfx/local/canisters/bar/service.did.js +4 -0
- package/tests/build/success/.dfx/local/canisters/foo/constructor.did +3 -0
- package/tests/build/success/.dfx/local/canisters/foo/foo.did +3 -0
- package/tests/build/success/.dfx/local/canisters/foo/foo.most +4 -0
- package/tests/build/success/.dfx/local/canisters/foo/foo.wasm +0 -0
- package/tests/build/success/.dfx/local/canisters/foo/index.js +42 -0
- package/tests/build/success/.dfx/local/canisters/foo/init_args.txt +1 -0
- package/tests/build/success/.dfx/local/canisters/foo/service.did +3 -0
- package/tests/build/success/.dfx/local/canisters/foo/service.did.d.ts +7 -0
- package/tests/build/success/.dfx/local/canisters/foo/service.did.js +4 -0
- package/tests/build/success/.dfx/local/lsp/ucwa4-rx777-77774-qaada-cai.did +3 -0
- package/tests/build/success/.dfx/local/lsp/ulvla-h7777-77774-qaacq-cai.did +3 -0
- package/tests/build/success/.dfx/local/network-id +4 -0
- package/tests/toolchain-local-subpath/bin/moc +2 -0
- package/tests/toolchain-local-subpath/mops.toml +2 -0
- package/tests/toolchain.test.ts +13 -0
- package/wasm/Cargo.lock +54 -101
- package/wasm/pkg/bundler/package.json +20 -0
- package/wasm/pkg/bundler/wasm.d.ts +3 -0
- package/wasm/pkg/bundler/wasm.js +5 -0
- package/wasm/pkg/bundler/wasm_bg.js +93 -0
- package/wasm/pkg/bundler/wasm_bg.wasm +0 -0
- package/wasm/pkg/bundler/wasm_bg.wasm.d.ts +8 -0
- package/wasm/pkg/nodejs/wasm_bg.wasm +0 -0
- package/wasm/pkg/web/wasm_bg.wasm +0 -0
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
export const idlFactory = ({ IDL }) => {
|
|
2
|
+
const PackageName = IDL.Text;
|
|
3
|
+
const Result_3 = IDL.Variant({ 'ok' : IDL.Null, 'err' : IDL.Text });
|
|
4
|
+
const PublishingId = IDL.Text;
|
|
5
|
+
const Err = IDL.Text;
|
|
6
|
+
const Result = IDL.Variant({ 'ok' : IDL.Null, 'err' : Err });
|
|
7
|
+
const Text = IDL.Text;
|
|
8
|
+
const PackageVersion = IDL.Text;
|
|
9
|
+
const PackageId = IDL.Text;
|
|
10
|
+
const Time = IDL.Int;
|
|
11
|
+
const DownloadsSnapshot = IDL.Record({
|
|
12
|
+
'startTime' : Time,
|
|
13
|
+
'endTime' : Time,
|
|
14
|
+
'downloads' : IDL.Nat,
|
|
15
|
+
});
|
|
16
|
+
const FileId = IDL.Text;
|
|
17
|
+
const Result_8 = IDL.Variant({
|
|
18
|
+
'ok' : IDL.Vec(IDL.Tuple(FileId, IDL.Vec(IDL.Nat8))),
|
|
19
|
+
'err' : Err,
|
|
20
|
+
});
|
|
21
|
+
const Result_7 = IDL.Variant({ 'ok' : IDL.Vec(FileId), 'err' : Err });
|
|
22
|
+
const SemverPart = IDL.Variant({
|
|
23
|
+
'major' : IDL.Null,
|
|
24
|
+
'minor' : IDL.Null,
|
|
25
|
+
'patch' : IDL.Null,
|
|
26
|
+
});
|
|
27
|
+
const Result_6 = IDL.Variant({
|
|
28
|
+
'ok' : IDL.Vec(IDL.Tuple(PackageName, PackageVersion)),
|
|
29
|
+
'err' : Err,
|
|
30
|
+
});
|
|
31
|
+
const Result_5 = IDL.Variant({ 'ok' : PackageVersion, 'err' : Err });
|
|
32
|
+
const User = IDL.Record({
|
|
33
|
+
'id' : IDL.Principal,
|
|
34
|
+
'emailVerified' : IDL.Bool,
|
|
35
|
+
'twitter' : IDL.Text,
|
|
36
|
+
'displayName' : IDL.Text,
|
|
37
|
+
'name' : IDL.Text,
|
|
38
|
+
'site' : IDL.Text,
|
|
39
|
+
'email' : IDL.Text,
|
|
40
|
+
'twitterVerified' : IDL.Bool,
|
|
41
|
+
'githubVerified' : IDL.Bool,
|
|
42
|
+
'github' : IDL.Text,
|
|
43
|
+
});
|
|
44
|
+
const DepsStatus = IDL.Variant({
|
|
45
|
+
'allLatest' : IDL.Null,
|
|
46
|
+
'tooOld' : IDL.Null,
|
|
47
|
+
'updatesAvailable' : IDL.Null,
|
|
48
|
+
});
|
|
49
|
+
const PackageQuality = IDL.Record({
|
|
50
|
+
'depsStatus' : DepsStatus,
|
|
51
|
+
'docsCoverage' : IDL.Float64,
|
|
52
|
+
'hasDescription' : IDL.Bool,
|
|
53
|
+
'hasKeywords' : IDL.Bool,
|
|
54
|
+
'hasLicense' : IDL.Bool,
|
|
55
|
+
'hasDocumentation' : IDL.Bool,
|
|
56
|
+
'hasTests' : IDL.Bool,
|
|
57
|
+
'hasRepository' : IDL.Bool,
|
|
58
|
+
'hasReleaseNotes' : IDL.Bool,
|
|
59
|
+
});
|
|
60
|
+
const Script = IDL.Record({ 'value' : IDL.Text, 'name' : IDL.Text });
|
|
61
|
+
const DependencyV2 = IDL.Record({
|
|
62
|
+
'name' : PackageName,
|
|
63
|
+
'repo' : IDL.Text,
|
|
64
|
+
'version' : IDL.Text,
|
|
65
|
+
});
|
|
66
|
+
const Requirement = IDL.Record({ 'value' : IDL.Text, 'name' : IDL.Text });
|
|
67
|
+
const PackageConfigV3 = IDL.Record({
|
|
68
|
+
'dfx' : IDL.Text,
|
|
69
|
+
'moc' : IDL.Text,
|
|
70
|
+
'scripts' : IDL.Vec(Script),
|
|
71
|
+
'baseDir' : IDL.Text,
|
|
72
|
+
'documentation' : IDL.Text,
|
|
73
|
+
'name' : PackageName,
|
|
74
|
+
'homepage' : IDL.Text,
|
|
75
|
+
'description' : IDL.Text,
|
|
76
|
+
'version' : IDL.Text,
|
|
77
|
+
'keywords' : IDL.Vec(IDL.Text),
|
|
78
|
+
'donation' : IDL.Text,
|
|
79
|
+
'devDependencies' : IDL.Vec(DependencyV2),
|
|
80
|
+
'repository' : IDL.Text,
|
|
81
|
+
'dependencies' : IDL.Vec(DependencyV2),
|
|
82
|
+
'requirements' : IDL.Vec(Requirement),
|
|
83
|
+
'license' : IDL.Text,
|
|
84
|
+
'readme' : IDL.Text,
|
|
85
|
+
});
|
|
86
|
+
const PackagePublication = IDL.Record({
|
|
87
|
+
'storage' : IDL.Principal,
|
|
88
|
+
'time' : Time,
|
|
89
|
+
'user' : IDL.Principal,
|
|
90
|
+
});
|
|
91
|
+
const PackageSummary = IDL.Record({
|
|
92
|
+
'ownerInfo' : User,
|
|
93
|
+
'owners' : IDL.Vec(User),
|
|
94
|
+
'maintainers' : IDL.Vec(User),
|
|
95
|
+
'owner' : IDL.Principal,
|
|
96
|
+
'depAlias' : IDL.Text,
|
|
97
|
+
'quality' : PackageQuality,
|
|
98
|
+
'publisher' : User,
|
|
99
|
+
'highestVersion' : PackageVersion,
|
|
100
|
+
'downloadsTotal' : IDL.Nat,
|
|
101
|
+
'downloadsInLast30Days' : IDL.Nat,
|
|
102
|
+
'downloadsInLast7Days' : IDL.Nat,
|
|
103
|
+
'config' : PackageConfigV3,
|
|
104
|
+
'publication' : PackagePublication,
|
|
105
|
+
});
|
|
106
|
+
const BenchmarkMetric = IDL.Text;
|
|
107
|
+
const Benchmark = IDL.Record({
|
|
108
|
+
'gc' : IDL.Text,
|
|
109
|
+
'metrics' : IDL.Vec(IDL.Tuple(BenchmarkMetric, IDL.Vec(IDL.Vec(IDL.Int)))),
|
|
110
|
+
'cols' : IDL.Vec(IDL.Text),
|
|
111
|
+
'file' : IDL.Text,
|
|
112
|
+
'name' : IDL.Text,
|
|
113
|
+
'rows' : IDL.Vec(IDL.Text),
|
|
114
|
+
'description' : IDL.Text,
|
|
115
|
+
'compilerVersion' : IDL.Text,
|
|
116
|
+
'compiler' : IDL.Text,
|
|
117
|
+
'replica' : IDL.Text,
|
|
118
|
+
'replicaVersion' : IDL.Text,
|
|
119
|
+
'forceGC' : IDL.Bool,
|
|
120
|
+
});
|
|
121
|
+
const Benchmarks = IDL.Vec(Benchmark);
|
|
122
|
+
const TestStats = IDL.Record({
|
|
123
|
+
'passedNames' : IDL.Vec(IDL.Text),
|
|
124
|
+
'passed' : IDL.Nat,
|
|
125
|
+
});
|
|
126
|
+
const PackageFileStatsPublic = IDL.Record({
|
|
127
|
+
'sourceFiles' : IDL.Nat,
|
|
128
|
+
'sourceSize' : IDL.Nat,
|
|
129
|
+
});
|
|
130
|
+
const TestsChanges = IDL.Record({
|
|
131
|
+
'addedNames' : IDL.Vec(IDL.Text),
|
|
132
|
+
'removedNames' : IDL.Vec(IDL.Text),
|
|
133
|
+
});
|
|
134
|
+
const DepChange = IDL.Record({
|
|
135
|
+
'oldVersion' : IDL.Text,
|
|
136
|
+
'name' : IDL.Text,
|
|
137
|
+
'newVersion' : IDL.Text,
|
|
138
|
+
});
|
|
139
|
+
const PackageChanges = IDL.Record({
|
|
140
|
+
'tests' : TestsChanges,
|
|
141
|
+
'deps' : IDL.Vec(DepChange),
|
|
142
|
+
'curBenchmarks' : Benchmarks,
|
|
143
|
+
'prevDocsCoverage' : IDL.Float64,
|
|
144
|
+
'prevBenchmarks' : Benchmarks,
|
|
145
|
+
'notes' : IDL.Text,
|
|
146
|
+
'curDocsCoverage' : IDL.Float64,
|
|
147
|
+
'devDeps' : IDL.Vec(DepChange),
|
|
148
|
+
});
|
|
149
|
+
const PackageSummaryWithChanges = IDL.Record({
|
|
150
|
+
'ownerInfo' : User,
|
|
151
|
+
'owners' : IDL.Vec(User),
|
|
152
|
+
'maintainers' : IDL.Vec(User),
|
|
153
|
+
'owner' : IDL.Principal,
|
|
154
|
+
'depAlias' : IDL.Text,
|
|
155
|
+
'quality' : PackageQuality,
|
|
156
|
+
'publisher' : User,
|
|
157
|
+
'highestVersion' : PackageVersion,
|
|
158
|
+
'downloadsTotal' : IDL.Nat,
|
|
159
|
+
'downloadsInLast30Days' : IDL.Nat,
|
|
160
|
+
'downloadsInLast7Days' : IDL.Nat,
|
|
161
|
+
'config' : PackageConfigV3,
|
|
162
|
+
'changes' : PackageChanges,
|
|
163
|
+
'publication' : PackagePublication,
|
|
164
|
+
});
|
|
165
|
+
const PackageDetails = IDL.Record({
|
|
166
|
+
'benchmarks' : Benchmarks,
|
|
167
|
+
'ownerInfo' : User,
|
|
168
|
+
'owners' : IDL.Vec(User),
|
|
169
|
+
'maintainers' : IDL.Vec(User),
|
|
170
|
+
'owner' : IDL.Principal,
|
|
171
|
+
'depAlias' : IDL.Text,
|
|
172
|
+
'deps' : IDL.Vec(PackageSummary),
|
|
173
|
+
'quality' : PackageQuality,
|
|
174
|
+
'publisher' : User,
|
|
175
|
+
'testStats' : TestStats,
|
|
176
|
+
'docsCoverage' : IDL.Float64,
|
|
177
|
+
'highestVersion' : PackageVersion,
|
|
178
|
+
'downloadsTotal' : IDL.Nat,
|
|
179
|
+
'downloadsInLast30Days' : IDL.Nat,
|
|
180
|
+
'dependentsCount' : IDL.Nat,
|
|
181
|
+
'downloadTrend' : IDL.Vec(DownloadsSnapshot),
|
|
182
|
+
'fileStats' : PackageFileStatsPublic,
|
|
183
|
+
'versionHistory' : IDL.Vec(PackageSummaryWithChanges),
|
|
184
|
+
'dependents' : IDL.Vec(PackageSummary),
|
|
185
|
+
'devDeps' : IDL.Vec(PackageSummary),
|
|
186
|
+
'downloadsInLast7Days' : IDL.Nat,
|
|
187
|
+
'config' : PackageConfigV3,
|
|
188
|
+
'changes' : PackageChanges,
|
|
189
|
+
'versions' : IDL.Vec(PackageVersion),
|
|
190
|
+
'publication' : PackagePublication,
|
|
191
|
+
});
|
|
192
|
+
const Result_4 = IDL.Variant({ 'ok' : PackageDetails, 'err' : Err });
|
|
193
|
+
const StorageId = IDL.Principal;
|
|
194
|
+
const StorageStats = IDL.Record({
|
|
195
|
+
'fileCount' : IDL.Nat,
|
|
196
|
+
'cyclesBalance' : IDL.Nat,
|
|
197
|
+
'memorySize' : IDL.Nat,
|
|
198
|
+
});
|
|
199
|
+
const Header = IDL.Tuple(IDL.Text, IDL.Text);
|
|
200
|
+
const Request = IDL.Record({
|
|
201
|
+
'url' : IDL.Text,
|
|
202
|
+
'method' : IDL.Text,
|
|
203
|
+
'body' : IDL.Vec(IDL.Nat8),
|
|
204
|
+
'headers' : IDL.Vec(Header),
|
|
205
|
+
'certificate_version' : IDL.Opt(IDL.Nat16),
|
|
206
|
+
});
|
|
207
|
+
const StreamingToken = IDL.Vec(IDL.Nat8);
|
|
208
|
+
const StreamingCallbackResponse = IDL.Record({
|
|
209
|
+
'token' : IDL.Opt(StreamingToken),
|
|
210
|
+
'body' : IDL.Vec(IDL.Nat8),
|
|
211
|
+
});
|
|
212
|
+
const StreamingCallback = IDL.Func(
|
|
213
|
+
[StreamingToken],
|
|
214
|
+
[IDL.Opt(StreamingCallbackResponse)],
|
|
215
|
+
['query'],
|
|
216
|
+
);
|
|
217
|
+
const StreamingStrategy = IDL.Variant({
|
|
218
|
+
'Callback' : IDL.Record({
|
|
219
|
+
'token' : StreamingToken,
|
|
220
|
+
'callback' : StreamingCallback,
|
|
221
|
+
}),
|
|
222
|
+
});
|
|
223
|
+
const Response = IDL.Record({
|
|
224
|
+
'body' : IDL.Vec(IDL.Nat8),
|
|
225
|
+
'headers' : IDL.Vec(Header),
|
|
226
|
+
'upgrade' : IDL.Opt(IDL.Bool),
|
|
227
|
+
'streaming_strategy' : IDL.Opt(StreamingStrategy),
|
|
228
|
+
'status_code' : IDL.Nat16,
|
|
229
|
+
});
|
|
230
|
+
const PageCount = IDL.Nat;
|
|
231
|
+
const Result_2 = IDL.Variant({ 'ok' : FileId, 'err' : Err });
|
|
232
|
+
const PackageConfigV3_Publishing = IDL.Record({
|
|
233
|
+
'dfx' : IDL.Text,
|
|
234
|
+
'moc' : IDL.Text,
|
|
235
|
+
'scripts' : IDL.Vec(Script),
|
|
236
|
+
'baseDir' : IDL.Text,
|
|
237
|
+
'documentation' : IDL.Text,
|
|
238
|
+
'name' : PackageName,
|
|
239
|
+
'homepage' : IDL.Text,
|
|
240
|
+
'description' : IDL.Text,
|
|
241
|
+
'version' : IDL.Text,
|
|
242
|
+
'keywords' : IDL.Vec(IDL.Text),
|
|
243
|
+
'donation' : IDL.Text,
|
|
244
|
+
'devDependencies' : IDL.Vec(DependencyV2),
|
|
245
|
+
'repository' : IDL.Text,
|
|
246
|
+
'dependencies' : IDL.Vec(DependencyV2),
|
|
247
|
+
'requirements' : IDL.Opt(IDL.Vec(Requirement)),
|
|
248
|
+
'license' : IDL.Text,
|
|
249
|
+
'readme' : IDL.Text,
|
|
250
|
+
});
|
|
251
|
+
const Result_1 = IDL.Variant({ 'ok' : PublishingId, 'err' : Err });
|
|
252
|
+
const HttpHeader = IDL.Record({ 'value' : IDL.Text, 'name' : IDL.Text });
|
|
253
|
+
const HttpRequestResult = IDL.Record({
|
|
254
|
+
'status' : IDL.Nat,
|
|
255
|
+
'body' : IDL.Vec(IDL.Nat8),
|
|
256
|
+
'headers' : IDL.Vec(HttpHeader),
|
|
257
|
+
});
|
|
258
|
+
const TransformArg = IDL.Record({
|
|
259
|
+
'context' : IDL.Vec(IDL.Nat8),
|
|
260
|
+
'response' : HttpRequestResult,
|
|
261
|
+
});
|
|
262
|
+
const Main = IDL.Service({
|
|
263
|
+
'addMaintainer' : IDL.Func([PackageName, IDL.Principal], [Result_3], []),
|
|
264
|
+
'addOwner' : IDL.Func([PackageName, IDL.Principal], [Result_3], []),
|
|
265
|
+
'backup' : IDL.Func([], [], []),
|
|
266
|
+
'computeHashesForExistingFiles' : IDL.Func([], [], []),
|
|
267
|
+
'finishPublish' : IDL.Func([PublishingId], [Result], []),
|
|
268
|
+
'getApiVersion' : IDL.Func([], [Text], ['query']),
|
|
269
|
+
'getBackupCanisterId' : IDL.Func([], [IDL.Principal], ['query']),
|
|
270
|
+
'getDefaultPackages' : IDL.Func(
|
|
271
|
+
[IDL.Text],
|
|
272
|
+
[IDL.Vec(IDL.Tuple(PackageName, PackageVersion))],
|
|
273
|
+
['query'],
|
|
274
|
+
),
|
|
275
|
+
'getDownloadTrendByPackageId' : IDL.Func(
|
|
276
|
+
[PackageId],
|
|
277
|
+
[IDL.Vec(DownloadsSnapshot)],
|
|
278
|
+
['query'],
|
|
279
|
+
),
|
|
280
|
+
'getDownloadTrendByPackageName' : IDL.Func(
|
|
281
|
+
[PackageName],
|
|
282
|
+
[IDL.Vec(DownloadsSnapshot)],
|
|
283
|
+
['query'],
|
|
284
|
+
),
|
|
285
|
+
'getFileHashes' : IDL.Func([PackageName, PackageVersion], [Result_8], []),
|
|
286
|
+
'getFileHashesByPackageIds' : IDL.Func(
|
|
287
|
+
[IDL.Vec(PackageId)],
|
|
288
|
+
[
|
|
289
|
+
IDL.Vec(
|
|
290
|
+
IDL.Tuple(PackageId, IDL.Vec(IDL.Tuple(FileId, IDL.Vec(IDL.Nat8))))
|
|
291
|
+
),
|
|
292
|
+
],
|
|
293
|
+
[],
|
|
294
|
+
),
|
|
295
|
+
'getFileHashesQuery' : IDL.Func(
|
|
296
|
+
[PackageName, PackageVersion],
|
|
297
|
+
[Result_8],
|
|
298
|
+
['query'],
|
|
299
|
+
),
|
|
300
|
+
'getFileIds' : IDL.Func(
|
|
301
|
+
[PackageName, PackageVersion],
|
|
302
|
+
[Result_7],
|
|
303
|
+
['query'],
|
|
304
|
+
),
|
|
305
|
+
'getHighestSemverBatch' : IDL.Func(
|
|
306
|
+
[IDL.Vec(IDL.Tuple(PackageName, PackageVersion, SemverPart))],
|
|
307
|
+
[Result_6],
|
|
308
|
+
['query'],
|
|
309
|
+
),
|
|
310
|
+
'getHighestVersion' : IDL.Func([PackageName], [Result_5], ['query']),
|
|
311
|
+
'getMostDownloadedPackages' : IDL.Func(
|
|
312
|
+
[],
|
|
313
|
+
[IDL.Vec(PackageSummary)],
|
|
314
|
+
['query'],
|
|
315
|
+
),
|
|
316
|
+
'getMostDownloadedPackagesIn7Days' : IDL.Func(
|
|
317
|
+
[],
|
|
318
|
+
[IDL.Vec(PackageSummary)],
|
|
319
|
+
['query'],
|
|
320
|
+
),
|
|
321
|
+
'getNewPackages' : IDL.Func([], [IDL.Vec(PackageSummary)], ['query']),
|
|
322
|
+
'getPackageDependents' : IDL.Func(
|
|
323
|
+
[PackageName, IDL.Nat, IDL.Nat],
|
|
324
|
+
[IDL.Vec(PackageSummary), IDL.Nat],
|
|
325
|
+
['query'],
|
|
326
|
+
),
|
|
327
|
+
'getPackageDetails' : IDL.Func(
|
|
328
|
+
[PackageName, PackageVersion],
|
|
329
|
+
[Result_4],
|
|
330
|
+
['query'],
|
|
331
|
+
),
|
|
332
|
+
'getPackageMaintainers' : IDL.Func(
|
|
333
|
+
[PackageName],
|
|
334
|
+
[IDL.Vec(IDL.Principal)],
|
|
335
|
+
['query'],
|
|
336
|
+
),
|
|
337
|
+
'getPackageOwners' : IDL.Func(
|
|
338
|
+
[PackageName],
|
|
339
|
+
[IDL.Vec(IDL.Principal)],
|
|
340
|
+
['query'],
|
|
341
|
+
),
|
|
342
|
+
'getPackageVersionHistory' : IDL.Func(
|
|
343
|
+
[PackageName],
|
|
344
|
+
[IDL.Vec(PackageSummaryWithChanges)],
|
|
345
|
+
['query'],
|
|
346
|
+
),
|
|
347
|
+
'getPackagesByCategory' : IDL.Func(
|
|
348
|
+
[],
|
|
349
|
+
[IDL.Vec(IDL.Tuple(IDL.Text, IDL.Vec(PackageSummary)))],
|
|
350
|
+
['query'],
|
|
351
|
+
),
|
|
352
|
+
'getRecentlyUpdatedPackages' : IDL.Func(
|
|
353
|
+
[],
|
|
354
|
+
[IDL.Vec(PackageSummaryWithChanges)],
|
|
355
|
+
['query'],
|
|
356
|
+
),
|
|
357
|
+
'getStoragesStats' : IDL.Func(
|
|
358
|
+
[],
|
|
359
|
+
[IDL.Vec(IDL.Tuple(StorageId, StorageStats))],
|
|
360
|
+
['query'],
|
|
361
|
+
),
|
|
362
|
+
'getTotalDownloads' : IDL.Func([], [IDL.Nat], ['query']),
|
|
363
|
+
'getTotalPackages' : IDL.Func([], [IDL.Nat], ['query']),
|
|
364
|
+
'getUser' : IDL.Func([IDL.Principal], [IDL.Opt(User)], ['query']),
|
|
365
|
+
'http_request' : IDL.Func([Request], [Response], ['query']),
|
|
366
|
+
'notifyInstall' : IDL.Func([PackageName, PackageVersion], [], ['oneway']),
|
|
367
|
+
'notifyInstalls' : IDL.Func(
|
|
368
|
+
[IDL.Vec(IDL.Tuple(PackageName, PackageVersion))],
|
|
369
|
+
[],
|
|
370
|
+
['oneway'],
|
|
371
|
+
),
|
|
372
|
+
'removeMaintainer' : IDL.Func([PackageName, IDL.Principal], [Result_3], []),
|
|
373
|
+
'removeOwner' : IDL.Func([PackageName, IDL.Principal], [Result_3], []),
|
|
374
|
+
'restore' : IDL.Func([IDL.Nat], [], []),
|
|
375
|
+
'search' : IDL.Func(
|
|
376
|
+
[Text, IDL.Opt(IDL.Nat), IDL.Opt(IDL.Nat)],
|
|
377
|
+
[IDL.Vec(PackageSummary), PageCount],
|
|
378
|
+
['query'],
|
|
379
|
+
),
|
|
380
|
+
'setStorageControllers' : IDL.Func([], [], []),
|
|
381
|
+
'setUserProp' : IDL.Func([IDL.Text, IDL.Text], [Result_3], []),
|
|
382
|
+
'startFileUpload' : IDL.Func(
|
|
383
|
+
[PublishingId, Text, IDL.Nat, IDL.Vec(IDL.Nat8)],
|
|
384
|
+
[Result_2],
|
|
385
|
+
[],
|
|
386
|
+
),
|
|
387
|
+
'startPublish' : IDL.Func([PackageConfigV3_Publishing], [Result_1], []),
|
|
388
|
+
'takeSnapshotsIfNeeded' : IDL.Func([], [], []),
|
|
389
|
+
'transformRequest' : IDL.Func(
|
|
390
|
+
[TransformArg],
|
|
391
|
+
[HttpRequestResult],
|
|
392
|
+
['query'],
|
|
393
|
+
),
|
|
394
|
+
'uploadBenchmarks' : IDL.Func([PublishingId, Benchmarks], [Result], []),
|
|
395
|
+
'uploadDocsCoverage' : IDL.Func([PublishingId, IDL.Float64], [Result], []),
|
|
396
|
+
'uploadFileChunk' : IDL.Func(
|
|
397
|
+
[PublishingId, FileId, IDL.Nat, IDL.Vec(IDL.Nat8)],
|
|
398
|
+
[Result],
|
|
399
|
+
[],
|
|
400
|
+
),
|
|
401
|
+
'uploadNotes' : IDL.Func([PublishingId, IDL.Text], [Result], []),
|
|
402
|
+
'uploadTestStats' : IDL.Func([PublishingId, TestStats], [Result], []),
|
|
403
|
+
});
|
|
404
|
+
return Main;
|
|
405
|
+
};
|
|
406
|
+
export const init = ({ IDL }) => { return []; };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ActorSubclass,
|
|
3
|
+
HttpAgentOptions,
|
|
4
|
+
ActorConfig,
|
|
5
|
+
Agent,
|
|
6
|
+
} from "@icp-sdk/core/agent";
|
|
7
|
+
import type { Principal } from "@icp-sdk/core/principal";
|
|
8
|
+
import type { IDL } from "@icp-sdk/core/candid";
|
|
9
|
+
|
|
10
|
+
import { _SERVICE } from './storage.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 storage: ActorSubclass<_SERVICE>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Actor, HttpAgent } from "@icp-sdk/core/agent";
|
|
2
|
+
|
|
3
|
+
// Imports and re-exports candid interface
|
|
4
|
+
import { idlFactory } from './storage.did.js';
|
|
5
|
+
export { idlFactory } from './storage.did.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param {string | import("@icp-sdk/core/principal").Principal} canisterId Canister ID of Agent
|
|
10
|
+
* @param {{agentOptions?: import("@icp-sdk/core/agent").HttpAgentOptions; actorOptions?: import("@icp-sdk/core/agent").ActorConfig}} [options]
|
|
11
|
+
* @return {import("@icp-sdk/core/agent").ActorSubclass<import("./storage.did.js")._SERVICE>}
|
|
12
|
+
*/
|
|
13
|
+
export const createActor = (canisterId, options) => {
|
|
14
|
+
const agent = new HttpAgent({ ...options?.agentOptions });
|
|
15
|
+
|
|
16
|
+
// Fetch root key for certificate validation during development
|
|
17
|
+
if(process.env.NODE_ENV !== "production") {
|
|
18
|
+
agent.fetchRootKey().catch(err=>{
|
|
19
|
+
console.warn("Unable to fetch root key. Check to ensure that your local replica is running");
|
|
20
|
+
console.error(err);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Creates an actor with using the candid interface and the HttpAgent
|
|
25
|
+
return Actor.createActor(idlFactory, {
|
|
26
|
+
agent,
|
|
27
|
+
canisterId,
|
|
28
|
+
...options?.actorOptions,
|
|
29
|
+
});
|
|
30
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
type StorageStats =
|
|
2
|
+
record {
|
|
3
|
+
cyclesBalance: nat;
|
|
4
|
+
fileCount: nat;
|
|
5
|
+
memorySize: nat;
|
|
6
|
+
};
|
|
7
|
+
type Storage =
|
|
8
|
+
service {
|
|
9
|
+
acceptCycles: () -> ();
|
|
10
|
+
deleteFile: (FileId) -> ();
|
|
11
|
+
downloadChunk: (FileId, nat) -> (Result_2) query;
|
|
12
|
+
finishUpload: (FileId) -> ();
|
|
13
|
+
getFileIdsRange: (nat, nat) -> (vec FileId) query;
|
|
14
|
+
getFileMeta: (FileId) -> (Result_1) query;
|
|
15
|
+
getStats: () -> (StorageStats) query;
|
|
16
|
+
startUpload: (FileMeta) -> (Result);
|
|
17
|
+
updateFileOwners: (FileId, vec principal) -> ();
|
|
18
|
+
uploadChunk: (FileId, nat, Chunk) -> ();
|
|
19
|
+
};
|
|
20
|
+
type Result_2 =
|
|
21
|
+
variant {
|
|
22
|
+
err: Err;
|
|
23
|
+
ok: Chunk;
|
|
24
|
+
};
|
|
25
|
+
type Result_1 =
|
|
26
|
+
variant {
|
|
27
|
+
err: Err;
|
|
28
|
+
ok: FileMeta;
|
|
29
|
+
};
|
|
30
|
+
type Result =
|
|
31
|
+
variant {
|
|
32
|
+
err: Err;
|
|
33
|
+
ok;
|
|
34
|
+
};
|
|
35
|
+
type FileMeta =
|
|
36
|
+
record {
|
|
37
|
+
chunkCount: nat;
|
|
38
|
+
id: FileId__1;
|
|
39
|
+
owners: vec principal;
|
|
40
|
+
path: text;
|
|
41
|
+
};
|
|
42
|
+
type FileId__1 = text;
|
|
43
|
+
type FileId = text;
|
|
44
|
+
type Err = text;
|
|
45
|
+
type Chunk = blob;
|
|
46
|
+
service : () -> Storage
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Principal } from '@icp-sdk/core/principal';
|
|
2
|
+
import type { ActorMethod } from '@icp-sdk/core/agent';
|
|
3
|
+
import type { IDL } from '@icp-sdk/core/candid';
|
|
4
|
+
|
|
5
|
+
export type Chunk = Array<number>;
|
|
6
|
+
export type Err = string;
|
|
7
|
+
export type FileId = string;
|
|
8
|
+
export type FileId__1 = string;
|
|
9
|
+
export interface FileMeta {
|
|
10
|
+
'id' : FileId__1,
|
|
11
|
+
'owners' : Array<Principal>,
|
|
12
|
+
'path' : string,
|
|
13
|
+
'chunkCount' : bigint,
|
|
14
|
+
}
|
|
15
|
+
export type Result = { 'ok' : null } |
|
|
16
|
+
{ 'err' : Err };
|
|
17
|
+
export type Result_1 = { 'ok' : FileMeta } |
|
|
18
|
+
{ 'err' : Err };
|
|
19
|
+
export type Result_2 = { 'ok' : Chunk } |
|
|
20
|
+
{ 'err' : Err };
|
|
21
|
+
export interface Storage {
|
|
22
|
+
'acceptCycles' : ActorMethod<[], undefined>,
|
|
23
|
+
'deleteFile' : ActorMethod<[FileId], undefined>,
|
|
24
|
+
'downloadChunk' : ActorMethod<[FileId, bigint], Result_2>,
|
|
25
|
+
'finishUpload' : ActorMethod<[FileId], undefined>,
|
|
26
|
+
'getFileIdsRange' : ActorMethod<[bigint, bigint], Array<FileId>>,
|
|
27
|
+
'getFileMeta' : ActorMethod<[FileId], Result_1>,
|
|
28
|
+
'getStats' : ActorMethod<[], StorageStats>,
|
|
29
|
+
'startUpload' : ActorMethod<[FileMeta], Result>,
|
|
30
|
+
'updateFileOwners' : ActorMethod<[FileId, Array<Principal>], undefined>,
|
|
31
|
+
'uploadChunk' : ActorMethod<[FileId, bigint, Chunk], undefined>,
|
|
32
|
+
}
|
|
33
|
+
export interface StorageStats {
|
|
34
|
+
'fileCount' : bigint,
|
|
35
|
+
'cyclesBalance' : bigint,
|
|
36
|
+
'memorySize' : bigint,
|
|
37
|
+
}
|
|
38
|
+
export interface _SERVICE extends Storage {}
|
|
39
|
+
export declare const idlFactory: IDL.InterfaceFactory;
|
|
40
|
+
export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[];
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export const idlFactory = ({ IDL }) => {
|
|
2
|
+
const FileId = IDL.Text;
|
|
3
|
+
const Chunk = IDL.Vec(IDL.Nat8);
|
|
4
|
+
const Err = IDL.Text;
|
|
5
|
+
const Result_2 = IDL.Variant({ 'ok' : Chunk, 'err' : Err });
|
|
6
|
+
const FileId__1 = IDL.Text;
|
|
7
|
+
const FileMeta = IDL.Record({
|
|
8
|
+
'id' : FileId__1,
|
|
9
|
+
'owners' : IDL.Vec(IDL.Principal),
|
|
10
|
+
'path' : IDL.Text,
|
|
11
|
+
'chunkCount' : IDL.Nat,
|
|
12
|
+
});
|
|
13
|
+
const Result_1 = IDL.Variant({ 'ok' : FileMeta, 'err' : Err });
|
|
14
|
+
const StorageStats = IDL.Record({
|
|
15
|
+
'fileCount' : IDL.Nat,
|
|
16
|
+
'cyclesBalance' : IDL.Nat,
|
|
17
|
+
'memorySize' : IDL.Nat,
|
|
18
|
+
});
|
|
19
|
+
const Result = IDL.Variant({ 'ok' : IDL.Null, 'err' : Err });
|
|
20
|
+
const Storage = IDL.Service({
|
|
21
|
+
'acceptCycles' : IDL.Func([], [], []),
|
|
22
|
+
'deleteFile' : IDL.Func([FileId], [], []),
|
|
23
|
+
'downloadChunk' : IDL.Func([FileId, IDL.Nat], [Result_2], ['query']),
|
|
24
|
+
'finishUpload' : IDL.Func([FileId], [], []),
|
|
25
|
+
'getFileIdsRange' : IDL.Func(
|
|
26
|
+
[IDL.Nat, IDL.Nat],
|
|
27
|
+
[IDL.Vec(FileId)],
|
|
28
|
+
['query'],
|
|
29
|
+
),
|
|
30
|
+
'getFileMeta' : IDL.Func([FileId], [Result_1], ['query']),
|
|
31
|
+
'getStats' : IDL.Func([], [StorageStats], ['query']),
|
|
32
|
+
'startUpload' : IDL.Func([FileMeta], [Result], []),
|
|
33
|
+
'updateFileOwners' : IDL.Func([FileId, IDL.Vec(IDL.Principal)], [], []),
|
|
34
|
+
'uploadChunk' : IDL.Func([FileId, IDL.Nat, Chunk], [], []),
|
|
35
|
+
});
|
|
36
|
+
return Storage;
|
|
37
|
+
};
|
|
38
|
+
export const init = ({ IDL }) => { return []; };
|