ic-mops 1.11.0 → 1.12.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/CHANGELOG.md +9 -0
- package/api/actors.ts +2 -2
- package/api/downloadPackageFiles.ts +1 -1
- package/bun.lock +234 -198
- package/bundle/bench/bench-canister.mo +101 -109
- package/bundle/bench/user-bench.mo +6 -10
- package/bundle/cli.js +960 -889
- package/bundle/cli.tgz +0 -0
- package/bundle/declarations/bench/bench.did +3 -3
- package/bundle/declarations/bench/bench.did.d.ts +3 -3
- package/bundle/declarations/bench/index.d.ts +3 -3
- package/bundle/declarations/bench/index.js +1 -1
- package/bundle/declarations/main/index.d.ts +3 -3
- package/bundle/declarations/main/index.js +1 -1
- package/bundle/declarations/main/main.did +78 -121
- package/bundle/declarations/main/main.did.d.ts +48 -98
- package/bundle/declarations/main/main.did.js +53 -107
- package/bundle/declarations/storage/index.d.ts +3 -3
- package/bundle/declarations/storage/index.js +4 -4
- package/bundle/declarations/storage/storage.did.d.ts +3 -3
- package/bundle/package.json +1 -1
- package/bundle/templates/src/lib.mo +13 -13
- package/bundle/templates/test/lib.test.mo +2 -2
- package/commands/add.ts +1 -1
- package/commands/available-updates.ts +20 -7
- package/commands/bench-replica.ts +21 -9
- package/commands/maintainer.ts +1 -1
- package/commands/outdated.ts +8 -1
- package/commands/owner.ts +1 -1
- package/commands/replica.ts +31 -18
- package/commands/test/test.ts +37 -97
- package/commands/test/utils.ts +75 -1
- package/commands/update.ts +19 -2
- package/declarations/bench/bench.did.d.ts +3 -3
- package/declarations/bench/index.d.ts +3 -3
- package/declarations/bench/index.js +1 -1
- package/declarations/main/index.d.ts +3 -3
- package/declarations/main/index.js +1 -1
- package/declarations/main/main.did.d.ts +3 -3
- package/declarations/storage/index.d.ts +3 -3
- package/declarations/storage/index.js +4 -4
- package/declarations/storage/storage.did.d.ts +3 -3
- package/dist/api/actors.d.ts +2 -2
- package/dist/api/actors.js +1 -1
- package/dist/api/downloadPackageFiles.d.ts +1 -1
- package/dist/api/downloadPackageFiles.js +1 -1
- package/dist/commands/add.js +1 -1
- package/dist/commands/available-updates.js +19 -7
- package/dist/commands/bench-replica.d.ts +3 -2
- package/dist/commands/bench-replica.js +17 -6
- package/dist/commands/maintainer.js +1 -1
- package/dist/commands/outdated.js +7 -1
- package/dist/commands/owner.js +1 -1
- package/dist/commands/replica.d.ts +4 -3
- package/dist/commands/replica.js +25 -13
- package/dist/commands/test/test.js +29 -81
- package/dist/commands/test/utils.d.ts +6 -0
- package/dist/commands/test/utils.js +61 -0
- package/dist/commands/update.js +16 -2
- package/dist/declarations/bench/bench.did.d.ts +3 -3
- package/dist/declarations/bench/index.d.ts +3 -3
- package/dist/declarations/bench/index.js +1 -1
- package/dist/declarations/main/index.d.ts +3 -3
- package/dist/declarations/main/index.js +1 -1
- package/dist/declarations/main/main.did.d.ts +3 -3
- package/dist/declarations/storage/index.d.ts +3 -3
- package/dist/declarations/storage/index.js +4 -4
- package/dist/declarations/storage/storage.did.d.ts +3 -3
- package/dist/helpers/get-dep-name.d.ts +1 -0
- package/dist/helpers/get-dep-name.js +3 -0
- package/dist/mops.d.ts +1 -1
- package/dist/package.json +5 -15
- package/dist/pem.d.ts +2 -2
- package/dist/pem.js +2 -2
- package/helpers/get-dep-name.ts +4 -0
- package/mops.ts +1 -1
- package/package.json +5 -15
- package/pem.ts +2 -2
- package/tsconfig.json +2 -2
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export const idlFactory = ({ IDL }) => {
|
|
2
|
-
const
|
|
2
|
+
const PackageName = IDL.Text;
|
|
3
3
|
const Result_3 = IDL.Variant({ 'ok' : IDL.Null, 'err' : IDL.Text });
|
|
4
4
|
const PublishingId = IDL.Text;
|
|
5
5
|
const Err = IDL.Text;
|
|
6
6
|
const Result = IDL.Variant({ 'ok' : IDL.Null, 'err' : Err });
|
|
7
7
|
const Text = IDL.Text;
|
|
8
|
-
const
|
|
8
|
+
const PackageVersion = IDL.Text;
|
|
9
9
|
const PackageId = IDL.Text;
|
|
10
10
|
const Time = IDL.Int;
|
|
11
|
-
const
|
|
11
|
+
const DownloadsSnapshot = IDL.Record({
|
|
12
12
|
'startTime' : Time,
|
|
13
13
|
'endTime' : Time,
|
|
14
14
|
'downloads' : IDL.Nat,
|
|
@@ -25,10 +25,10 @@ export const idlFactory = ({ IDL }) => {
|
|
|
25
25
|
'patch' : IDL.Null,
|
|
26
26
|
});
|
|
27
27
|
const Result_6 = IDL.Variant({
|
|
28
|
-
'ok' : IDL.Vec(IDL.Tuple(
|
|
28
|
+
'ok' : IDL.Vec(IDL.Tuple(PackageName, PackageVersion)),
|
|
29
29
|
'err' : Err,
|
|
30
30
|
});
|
|
31
|
-
const Result_5 = IDL.Variant({ 'ok' :
|
|
31
|
+
const Result_5 = IDL.Variant({ 'ok' : PackageVersion, 'err' : Err });
|
|
32
32
|
const User = IDL.Record({
|
|
33
33
|
'id' : IDL.Principal,
|
|
34
34
|
'emailVerified' : IDL.Bool,
|
|
@@ -57,9 +57,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
57
57
|
'hasRepository' : IDL.Bool,
|
|
58
58
|
'hasReleaseNotes' : IDL.Bool,
|
|
59
59
|
});
|
|
60
|
-
const PackageVersion = IDL.Text;
|
|
61
60
|
const Script = IDL.Record({ 'value' : IDL.Text, 'name' : IDL.Text });
|
|
62
|
-
const PackageName = IDL.Text;
|
|
63
61
|
const DependencyV2 = IDL.Record({
|
|
64
62
|
'name' : PackageName,
|
|
65
63
|
'repo' : IDL.Text,
|
|
@@ -120,31 +118,11 @@ export const idlFactory = ({ IDL }) => {
|
|
|
120
118
|
'replicaVersion' : IDL.Text,
|
|
121
119
|
'forceGC' : IDL.Bool,
|
|
122
120
|
});
|
|
123
|
-
const
|
|
124
|
-
const
|
|
125
|
-
'ownerInfo' : User,
|
|
126
|
-
'owners' : IDL.Vec(User),
|
|
127
|
-
'maintainers' : IDL.Vec(User),
|
|
128
|
-
'owner' : IDL.Principal,
|
|
129
|
-
'depAlias' : IDL.Text,
|
|
130
|
-
'quality' : PackageQuality,
|
|
131
|
-
'publisher' : User,
|
|
132
|
-
'highestVersion' : PackageVersion,
|
|
133
|
-
'downloadsTotal' : IDL.Nat,
|
|
134
|
-
'downloadsInLast30Days' : IDL.Nat,
|
|
135
|
-
'downloadsInLast7Days' : IDL.Nat,
|
|
136
|
-
'config' : PackageConfigV3,
|
|
137
|
-
'publication' : PackagePublication,
|
|
138
|
-
});
|
|
139
|
-
const TestStats__1 = IDL.Record({
|
|
121
|
+
const Benchmarks = IDL.Vec(Benchmark);
|
|
122
|
+
const TestStats = IDL.Record({
|
|
140
123
|
'passedNames' : IDL.Vec(IDL.Text),
|
|
141
124
|
'passed' : IDL.Nat,
|
|
142
125
|
});
|
|
143
|
-
const DownloadsSnapshot = IDL.Record({
|
|
144
|
-
'startTime' : Time,
|
|
145
|
-
'endTime' : Time,
|
|
146
|
-
'downloads' : IDL.Nat,
|
|
147
|
-
});
|
|
148
126
|
const PackageFileStatsPublic = IDL.Record({
|
|
149
127
|
'sourceFiles' : IDL.Nat,
|
|
150
128
|
'sourceSize' : IDL.Nat,
|
|
@@ -161,14 +139,14 @@ export const idlFactory = ({ IDL }) => {
|
|
|
161
139
|
const PackageChanges = IDL.Record({
|
|
162
140
|
'tests' : TestsChanges,
|
|
163
141
|
'deps' : IDL.Vec(DepChange),
|
|
164
|
-
'curBenchmarks' :
|
|
142
|
+
'curBenchmarks' : Benchmarks,
|
|
165
143
|
'prevDocsCoverage' : IDL.Float64,
|
|
166
|
-
'prevBenchmarks' :
|
|
144
|
+
'prevBenchmarks' : Benchmarks,
|
|
167
145
|
'notes' : IDL.Text,
|
|
168
146
|
'curDocsCoverage' : IDL.Float64,
|
|
169
147
|
'devDeps' : IDL.Vec(DepChange),
|
|
170
148
|
});
|
|
171
|
-
const
|
|
149
|
+
const PackageSummaryWithChanges = IDL.Record({
|
|
172
150
|
'ownerInfo' : User,
|
|
173
151
|
'owners' : IDL.Vec(User),
|
|
174
152
|
'maintainers' : IDL.Vec(User),
|
|
@@ -185,65 +163,39 @@ export const idlFactory = ({ IDL }) => {
|
|
|
185
163
|
'publication' : PackagePublication,
|
|
186
164
|
});
|
|
187
165
|
const PackageDetails = IDL.Record({
|
|
188
|
-
'benchmarks' :
|
|
166
|
+
'benchmarks' : Benchmarks,
|
|
189
167
|
'ownerInfo' : User,
|
|
190
168
|
'owners' : IDL.Vec(User),
|
|
191
169
|
'maintainers' : IDL.Vec(User),
|
|
192
170
|
'owner' : IDL.Principal,
|
|
193
171
|
'depAlias' : IDL.Text,
|
|
194
|
-
'deps' : IDL.Vec(
|
|
172
|
+
'deps' : IDL.Vec(PackageSummary),
|
|
195
173
|
'quality' : PackageQuality,
|
|
196
174
|
'publisher' : User,
|
|
197
|
-
'testStats' :
|
|
175
|
+
'testStats' : TestStats,
|
|
198
176
|
'docsCoverage' : IDL.Float64,
|
|
199
177
|
'highestVersion' : PackageVersion,
|
|
200
178
|
'downloadsTotal' : IDL.Nat,
|
|
201
179
|
'downloadsInLast30Days' : IDL.Nat,
|
|
180
|
+
'dependentsCount' : IDL.Nat,
|
|
202
181
|
'downloadTrend' : IDL.Vec(DownloadsSnapshot),
|
|
203
182
|
'fileStats' : PackageFileStatsPublic,
|
|
204
|
-
'versionHistory' : IDL.Vec(
|
|
205
|
-
'dependents' : IDL.Vec(
|
|
206
|
-
'devDeps' : IDL.Vec(
|
|
183
|
+
'versionHistory' : IDL.Vec(PackageSummaryWithChanges),
|
|
184
|
+
'dependents' : IDL.Vec(PackageSummary),
|
|
185
|
+
'devDeps' : IDL.Vec(PackageSummary),
|
|
207
186
|
'downloadsInLast7Days' : IDL.Nat,
|
|
208
187
|
'config' : PackageConfigV3,
|
|
209
188
|
'changes' : PackageChanges,
|
|
189
|
+
'versions' : IDL.Vec(PackageVersion),
|
|
210
190
|
'publication' : PackagePublication,
|
|
211
191
|
});
|
|
212
192
|
const Result_4 = IDL.Variant({ 'ok' : PackageDetails, 'err' : Err });
|
|
213
|
-
const PackageSummaryWithChanges = IDL.Record({
|
|
214
|
-
'ownerInfo' : User,
|
|
215
|
-
'owners' : IDL.Vec(User),
|
|
216
|
-
'maintainers' : IDL.Vec(User),
|
|
217
|
-
'owner' : IDL.Principal,
|
|
218
|
-
'depAlias' : IDL.Text,
|
|
219
|
-
'quality' : PackageQuality,
|
|
220
|
-
'publisher' : User,
|
|
221
|
-
'highestVersion' : PackageVersion,
|
|
222
|
-
'downloadsTotal' : IDL.Nat,
|
|
223
|
-
'downloadsInLast30Days' : IDL.Nat,
|
|
224
|
-
'downloadsInLast7Days' : IDL.Nat,
|
|
225
|
-
'config' : PackageConfigV3,
|
|
226
|
-
'changes' : PackageChanges,
|
|
227
|
-
'publication' : PackagePublication,
|
|
228
|
-
});
|
|
229
193
|
const StorageId = IDL.Principal;
|
|
230
194
|
const StorageStats = IDL.Record({
|
|
231
195
|
'fileCount' : IDL.Nat,
|
|
232
196
|
'cyclesBalance' : IDL.Nat,
|
|
233
197
|
'memorySize' : IDL.Nat,
|
|
234
198
|
});
|
|
235
|
-
const User__1 = IDL.Record({
|
|
236
|
-
'id' : IDL.Principal,
|
|
237
|
-
'emailVerified' : IDL.Bool,
|
|
238
|
-
'twitter' : IDL.Text,
|
|
239
|
-
'displayName' : IDL.Text,
|
|
240
|
-
'name' : IDL.Text,
|
|
241
|
-
'site' : IDL.Text,
|
|
242
|
-
'email' : IDL.Text,
|
|
243
|
-
'twitterVerified' : IDL.Bool,
|
|
244
|
-
'githubVerified' : IDL.Bool,
|
|
245
|
-
'github' : IDL.Text,
|
|
246
|
-
});
|
|
247
199
|
const Header = IDL.Tuple(IDL.Text, IDL.Text);
|
|
248
200
|
const Request = IDL.Record({
|
|
249
201
|
'url' : IDL.Text,
|
|
@@ -298,23 +250,18 @@ export const idlFactory = ({ IDL }) => {
|
|
|
298
250
|
});
|
|
299
251
|
const Result_1 = IDL.Variant({ 'ok' : PublishingId, 'err' : Err });
|
|
300
252
|
const HttpHeader = IDL.Record({ 'value' : IDL.Text, 'name' : IDL.Text });
|
|
301
|
-
const
|
|
253
|
+
const HttpRequestResult = IDL.Record({
|
|
302
254
|
'status' : IDL.Nat,
|
|
303
255
|
'body' : IDL.Vec(IDL.Nat8),
|
|
304
256
|
'headers' : IDL.Vec(HttpHeader),
|
|
305
257
|
});
|
|
306
|
-
const
|
|
258
|
+
const TransformArg = IDL.Record({
|
|
307
259
|
'context' : IDL.Vec(IDL.Nat8),
|
|
308
|
-
'response' :
|
|
309
|
-
});
|
|
310
|
-
const Benchmarks = IDL.Vec(Benchmark);
|
|
311
|
-
const TestStats = IDL.Record({
|
|
312
|
-
'passedNames' : IDL.Vec(IDL.Text),
|
|
313
|
-
'passed' : IDL.Nat,
|
|
260
|
+
'response' : HttpRequestResult,
|
|
314
261
|
});
|
|
315
262
|
const Main = IDL.Service({
|
|
316
|
-
'addMaintainer' : IDL.Func([
|
|
317
|
-
'addOwner' : IDL.Func([
|
|
263
|
+
'addMaintainer' : IDL.Func([PackageName, IDL.Principal], [Result_3], []),
|
|
264
|
+
'addOwner' : IDL.Func([PackageName, IDL.Principal], [Result_3], []),
|
|
318
265
|
'backup' : IDL.Func([], [], []),
|
|
319
266
|
'computeHashesForExistingFiles' : IDL.Func([], [], []),
|
|
320
267
|
'finishPublish' : IDL.Func([PublishingId], [Result], []),
|
|
@@ -322,24 +269,20 @@ export const idlFactory = ({ IDL }) => {
|
|
|
322
269
|
'getBackupCanisterId' : IDL.Func([], [IDL.Principal], ['query']),
|
|
323
270
|
'getDefaultPackages' : IDL.Func(
|
|
324
271
|
[IDL.Text],
|
|
325
|
-
[IDL.Vec(IDL.Tuple(
|
|
272
|
+
[IDL.Vec(IDL.Tuple(PackageName, PackageVersion))],
|
|
326
273
|
['query'],
|
|
327
274
|
),
|
|
328
275
|
'getDownloadTrendByPackageId' : IDL.Func(
|
|
329
276
|
[PackageId],
|
|
330
|
-
[IDL.Vec(
|
|
277
|
+
[IDL.Vec(DownloadsSnapshot)],
|
|
331
278
|
['query'],
|
|
332
279
|
),
|
|
333
280
|
'getDownloadTrendByPackageName' : IDL.Func(
|
|
334
|
-
[
|
|
335
|
-
[IDL.Vec(
|
|
281
|
+
[PackageName],
|
|
282
|
+
[IDL.Vec(DownloadsSnapshot)],
|
|
336
283
|
['query'],
|
|
337
284
|
),
|
|
338
|
-
'getFileHashes' : IDL.Func(
|
|
339
|
-
[PackageName__1, PackageVersion__1],
|
|
340
|
-
[Result_8],
|
|
341
|
-
[],
|
|
342
|
-
),
|
|
285
|
+
'getFileHashes' : IDL.Func([PackageName, PackageVersion], [Result_8], []),
|
|
343
286
|
'getFileHashesByPackageIds' : IDL.Func(
|
|
344
287
|
[IDL.Vec(PackageId)],
|
|
345
288
|
[
|
|
@@ -350,21 +293,21 @@ export const idlFactory = ({ IDL }) => {
|
|
|
350
293
|
[],
|
|
351
294
|
),
|
|
352
295
|
'getFileHashesQuery' : IDL.Func(
|
|
353
|
-
[
|
|
296
|
+
[PackageName, PackageVersion],
|
|
354
297
|
[Result_8],
|
|
355
298
|
['query'],
|
|
356
299
|
),
|
|
357
300
|
'getFileIds' : IDL.Func(
|
|
358
|
-
[
|
|
301
|
+
[PackageName, PackageVersion],
|
|
359
302
|
[Result_7],
|
|
360
303
|
['query'],
|
|
361
304
|
),
|
|
362
305
|
'getHighestSemverBatch' : IDL.Func(
|
|
363
|
-
[IDL.Vec(IDL.Tuple(
|
|
306
|
+
[IDL.Vec(IDL.Tuple(PackageName, PackageVersion, SemverPart))],
|
|
364
307
|
[Result_6],
|
|
365
308
|
['query'],
|
|
366
309
|
),
|
|
367
|
-
'getHighestVersion' : IDL.Func([
|
|
310
|
+
'getHighestVersion' : IDL.Func([PackageName], [Result_5], ['query']),
|
|
368
311
|
'getMostDownloadedPackages' : IDL.Func(
|
|
369
312
|
[],
|
|
370
313
|
[IDL.Vec(PackageSummary)],
|
|
@@ -376,21 +319,31 @@ export const idlFactory = ({ IDL }) => {
|
|
|
376
319
|
['query'],
|
|
377
320
|
),
|
|
378
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
|
+
),
|
|
379
327
|
'getPackageDetails' : IDL.Func(
|
|
380
|
-
[
|
|
328
|
+
[PackageName, PackageVersion],
|
|
381
329
|
[Result_4],
|
|
382
330
|
['query'],
|
|
383
331
|
),
|
|
384
332
|
'getPackageMaintainers' : IDL.Func(
|
|
385
|
-
[
|
|
333
|
+
[PackageName],
|
|
386
334
|
[IDL.Vec(IDL.Principal)],
|
|
387
335
|
['query'],
|
|
388
336
|
),
|
|
389
337
|
'getPackageOwners' : IDL.Func(
|
|
390
|
-
[
|
|
338
|
+
[PackageName],
|
|
391
339
|
[IDL.Vec(IDL.Principal)],
|
|
392
340
|
['query'],
|
|
393
341
|
),
|
|
342
|
+
'getPackageVersionHistory' : IDL.Func(
|
|
343
|
+
[PackageName],
|
|
344
|
+
[IDL.Vec(PackageSummaryWithChanges)],
|
|
345
|
+
['query'],
|
|
346
|
+
),
|
|
394
347
|
'getPackagesByCategory' : IDL.Func(
|
|
395
348
|
[],
|
|
396
349
|
[IDL.Vec(IDL.Tuple(IDL.Text, IDL.Vec(PackageSummary)))],
|
|
@@ -408,24 +361,16 @@ export const idlFactory = ({ IDL }) => {
|
|
|
408
361
|
),
|
|
409
362
|
'getTotalDownloads' : IDL.Func([], [IDL.Nat], ['query']),
|
|
410
363
|
'getTotalPackages' : IDL.Func([], [IDL.Nat], ['query']),
|
|
411
|
-
'getUser' : IDL.Func([IDL.Principal], [IDL.Opt(
|
|
364
|
+
'getUser' : IDL.Func([IDL.Principal], [IDL.Opt(User)], ['query']),
|
|
412
365
|
'http_request' : IDL.Func([Request], [Response], ['query']),
|
|
413
|
-
'notifyInstall' : IDL.Func(
|
|
414
|
-
[PackageName__1, PackageVersion__1],
|
|
415
|
-
[],
|
|
416
|
-
['oneway'],
|
|
417
|
-
),
|
|
366
|
+
'notifyInstall' : IDL.Func([PackageName, PackageVersion], [], ['oneway']),
|
|
418
367
|
'notifyInstalls' : IDL.Func(
|
|
419
|
-
[IDL.Vec(IDL.Tuple(
|
|
368
|
+
[IDL.Vec(IDL.Tuple(PackageName, PackageVersion))],
|
|
420
369
|
[],
|
|
421
370
|
['oneway'],
|
|
422
371
|
),
|
|
423
|
-
'removeMaintainer' : IDL.Func(
|
|
424
|
-
|
|
425
|
-
[Result_3],
|
|
426
|
-
[],
|
|
427
|
-
),
|
|
428
|
-
'removeOwner' : IDL.Func([PackageName__1, IDL.Principal], [Result_3], []),
|
|
372
|
+
'removeMaintainer' : IDL.Func([PackageName, IDL.Principal], [Result_3], []),
|
|
373
|
+
'removeOwner' : IDL.Func([PackageName, IDL.Principal], [Result_3], []),
|
|
429
374
|
'restore' : IDL.Func([IDL.Nat], [], []),
|
|
430
375
|
'search' : IDL.Func(
|
|
431
376
|
[Text, IDL.Opt(IDL.Nat), IDL.Opt(IDL.Nat)],
|
|
@@ -440,9 +385,10 @@ export const idlFactory = ({ IDL }) => {
|
|
|
440
385
|
[],
|
|
441
386
|
),
|
|
442
387
|
'startPublish' : IDL.Func([PackageConfigV3_Publishing], [Result_1], []),
|
|
388
|
+
'takeSnapshotsIfNeeded' : IDL.Func([], [], []),
|
|
443
389
|
'transformRequest' : IDL.Func(
|
|
444
|
-
[
|
|
445
|
-
[
|
|
390
|
+
[TransformArg],
|
|
391
|
+
[HttpRequestResult],
|
|
446
392
|
['query'],
|
|
447
393
|
),
|
|
448
394
|
'uploadBenchmarks' : IDL.Func([PublishingId, Benchmarks], [Result], []),
|
|
@@ -3,9 +3,9 @@ import type {
|
|
|
3
3
|
HttpAgentOptions,
|
|
4
4
|
ActorConfig,
|
|
5
5
|
Agent,
|
|
6
|
-
} from "@
|
|
7
|
-
import type { Principal } from "@
|
|
8
|
-
import type { IDL } from "@
|
|
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
9
|
|
|
10
10
|
import { _SERVICE } from './storage.did';
|
|
11
11
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Actor, HttpAgent } from "@
|
|
1
|
+
import { Actor, HttpAgent } from "@icp-sdk/core/agent";
|
|
2
2
|
|
|
3
3
|
// Imports and re-exports candid interface
|
|
4
4
|
import { idlFactory } from './storage.did.js';
|
|
@@ -6,9 +6,9 @@ export { idlFactory } from './storage.did.js';
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
9
|
-
* @param {string | import("@
|
|
10
|
-
* @param {{agentOptions?: import("@
|
|
11
|
-
* @return {import("@
|
|
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
12
|
*/
|
|
13
13
|
export const createActor = (canisterId, options) => {
|
|
14
14
|
const agent = new HttpAgent({ ...options?.agentOptions });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Principal } from '@
|
|
2
|
-
import type { ActorMethod } from '@
|
|
3
|
-
import type { IDL } from '@
|
|
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
4
|
|
|
5
5
|
export type Chunk = Array<number>;
|
|
6
6
|
export type Err = string;
|
package/bundle/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
module {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
// This comment will not be included in the documentation
|
|
3
|
+
// Use triple slash for documentation
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
5
|
+
/// Add two natural numbers
|
|
6
|
+
///
|
|
7
|
+
/// Example:
|
|
8
|
+
/// ```motoko
|
|
9
|
+
/// assert add(1, 2) == 3;
|
|
10
|
+
/// assert add(7, 3) == 10;
|
|
11
|
+
/// ```
|
|
12
|
+
public func add(x : Nat, y : Nat) : Nat {
|
|
13
|
+
return x + y;
|
|
14
|
+
};
|
|
15
|
+
};
|
package/commands/add.ts
CHANGED
|
@@ -2,7 +2,8 @@ import process from 'node:process';
|
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import {mainActor} from '../api/actors.js';
|
|
4
4
|
import {Config} from '../types.js';
|
|
5
|
-
import {getDepName} from '../helpers/get-dep-name.js';
|
|
5
|
+
import {getDepName, getDepPinnedVersion} from '../helpers/get-dep-name.js';
|
|
6
|
+
import {SemverPart} from '../declarations/main/main.did.js';
|
|
6
7
|
|
|
7
8
|
// [pkg, oldVersion, newVersion]
|
|
8
9
|
export async function getAvailableUpdates(config : Config, pkg ?: string) : Promise<Array<[string, string, string]>> {
|
|
@@ -11,12 +12,16 @@ export async function getAvailableUpdates(config : Config, pkg ?: string) : Prom
|
|
|
11
12
|
let allDeps = [...deps, ...devDeps].filter((dep) => dep.version);
|
|
12
13
|
let depsToUpdate = pkg ? allDeps.filter((dep) => dep.name === pkg) : allDeps;
|
|
13
14
|
|
|
14
|
-
// skip pinned dependencies
|
|
15
|
-
depsToUpdate = depsToUpdate.filter((dep) => getDepName(dep.name) === dep.name);
|
|
15
|
+
// skip hard pinned dependencies (e.g. "base@X.Y.Z")
|
|
16
|
+
depsToUpdate = depsToUpdate.filter((dep) => getDepName(dep.name) === dep.name || getDepPinnedVersion(dep.name).split('.').length !== 3);
|
|
16
17
|
|
|
17
|
-
let getCurrentVersion = (pkg : string) => {
|
|
18
|
+
let getCurrentVersion = (pkg : string, updateVersion : string) => {
|
|
18
19
|
for (let dep of allDeps) {
|
|
19
|
-
if (dep.name === pkg && dep.version) {
|
|
20
|
+
if (getDepName(dep.name) === pkg && dep.version) {
|
|
21
|
+
let pinnedVersion = getDepPinnedVersion(dep.name);
|
|
22
|
+
if (pinnedVersion && !updateVersion.startsWith(pinnedVersion)) {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
20
25
|
return dep.version;
|
|
21
26
|
}
|
|
22
27
|
}
|
|
@@ -24,12 +29,20 @@ export async function getAvailableUpdates(config : Config, pkg ?: string) : Prom
|
|
|
24
29
|
};
|
|
25
30
|
|
|
26
31
|
let actor = await mainActor();
|
|
27
|
-
let res = await actor.getHighestSemverBatch(depsToUpdate.map((dep) =>
|
|
32
|
+
let res = await actor.getHighestSemverBatch(depsToUpdate.map((dep) => {
|
|
33
|
+
let semverPart : SemverPart = {major: null};
|
|
34
|
+
let name = getDepName(dep.name);
|
|
35
|
+
let pinnedVersion = getDepPinnedVersion(dep.name);
|
|
36
|
+
if (pinnedVersion) {
|
|
37
|
+
semverPart = pinnedVersion.split('.').length === 1 ? {minor: null} : {patch: null};
|
|
38
|
+
}
|
|
39
|
+
return [name, dep.version || '', semverPart];
|
|
40
|
+
}));
|
|
28
41
|
|
|
29
42
|
if ('err' in res) {
|
|
30
43
|
console.log(chalk.red('Error:'), res.err);
|
|
31
44
|
process.exit(1);
|
|
32
45
|
}
|
|
33
46
|
|
|
34
|
-
return res.ok.filter((dep) => dep[1] !== getCurrentVersion(dep[0])).map((dep) => [dep[0], getCurrentVersion(dep[0]), dep[1]]);
|
|
47
|
+
return res.ok.filter((dep) => dep[1] !== getCurrentVersion(dep[0], dep[1])).map((dep) => [dep[0], getCurrentVersion(dep[0], dep[1]), dep[1]]);
|
|
35
48
|
}
|
|
@@ -4,6 +4,7 @@ import path from 'node:path';
|
|
|
4
4
|
import fs from 'node:fs';
|
|
5
5
|
import {execaCommand} from 'execa';
|
|
6
6
|
import {PocketIc, PocketIcServer} from 'pic-ic';
|
|
7
|
+
import {PocketIc as PocketIcMops, PocketIcServer as PocketIcServerMops} from 'pic-js-mops';
|
|
7
8
|
import {getRootDir, readConfig} from '../mops.js';
|
|
8
9
|
import {createActor, idlFactory} from '../declarations/bench/index.js';
|
|
9
10
|
import {toolchain} from './toolchain/index.js';
|
|
@@ -13,8 +14,8 @@ export class BenchReplica {
|
|
|
13
14
|
type : 'dfx' | 'pocket-ic' | 'dfx-pocket-ic';
|
|
14
15
|
verbose = false;
|
|
15
16
|
canisters : Record<string, {cwd : string; canisterId : string; actor : any;}> = {};
|
|
16
|
-
pocketIcServer ?: PocketIcServer;
|
|
17
|
-
pocketIc ?: PocketIc;
|
|
17
|
+
pocketIcServer ?: PocketIcServer | PocketIcServerMops;
|
|
18
|
+
pocketIc ?: PocketIc | PocketIcMops;
|
|
18
19
|
|
|
19
20
|
constructor(type : 'dfx' | 'pocket-ic' | 'dfx-pocket-ic', verbose = false) {
|
|
20
21
|
this.type = type;
|
|
@@ -35,14 +36,24 @@ export class BenchReplica {
|
|
|
35
36
|
else {
|
|
36
37
|
let pocketIcBin = await toolchain.bin('pocket-ic');
|
|
37
38
|
let config = readConfig();
|
|
38
|
-
if (config.toolchain?.['pocket-ic'] !== '4.0.0') {
|
|
39
|
-
console.error('Current Mops CLI only supports pocket-ic 4.0.0');
|
|
39
|
+
if (config.toolchain?.['pocket-ic'] !== '4.0.0' && !config.toolchain?.['pocket-ic']?.startsWith('9.')) {
|
|
40
|
+
console.error('Current Mops CLI only supports pocket-ic 9.x.x and 4.0.0');
|
|
40
41
|
process.exit(1);
|
|
41
42
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
// pocket-ic 9.x.x
|
|
44
|
+
if (config.toolchain?.['pocket-ic']?.startsWith('9.')) {
|
|
45
|
+
this.pocketIcServer = await PocketIcServerMops.start({
|
|
46
|
+
binPath: pocketIcBin,
|
|
47
|
+
});
|
|
48
|
+
this.pocketIc = await PocketIcMops.create(this.pocketIcServer.getUrl());
|
|
49
|
+
}
|
|
50
|
+
// pocket-ic 4.0.0
|
|
51
|
+
else {
|
|
52
|
+
this.pocketIcServer = await PocketIcServer.start({
|
|
53
|
+
binPath: pocketIcBin,
|
|
54
|
+
});
|
|
55
|
+
this.pocketIc = await PocketIc.create(this.pocketIcServer.getUrl());
|
|
56
|
+
}
|
|
46
57
|
}
|
|
47
58
|
}
|
|
48
59
|
|
|
@@ -69,7 +80,8 @@ export class BenchReplica {
|
|
|
69
80
|
this.canisters[name] = {cwd, canisterId, actor};
|
|
70
81
|
}
|
|
71
82
|
else if (this.pocketIc) {
|
|
72
|
-
|
|
83
|
+
type PocketIcSetupCanister = PocketIcMops['setupCanister'] & PocketIc['setupCanister'];
|
|
84
|
+
let {canisterId, actor} = await (this.pocketIc.setupCanister as PocketIcSetupCanister)({idlFactory, wasm});
|
|
73
85
|
this.canisters[name] = {
|
|
74
86
|
cwd,
|
|
75
87
|
canisterId: canisterId.toText(),
|
package/commands/maintainer.ts
CHANGED
|
@@ -2,7 +2,7 @@ import process from 'node:process';
|
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import {checkConfigFile, getIdentity, readConfig} from '../mops.js';
|
|
4
4
|
import {mainActor} from '../api/actors.js';
|
|
5
|
-
import {Principal} from '@
|
|
5
|
+
import {Principal} from '@icp-sdk/core/principal';
|
|
6
6
|
import prompts from 'prompts';
|
|
7
7
|
|
|
8
8
|
export async function printMaintainers() {
|
package/commands/outdated.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import {checkConfigFile, readConfig} from '../mops.js';
|
|
3
3
|
import {getAvailableUpdates} from './available-updates.js';
|
|
4
|
+
import {getDepName, getDepPinnedVersion} from '../helpers/get-dep-name.js';
|
|
4
5
|
|
|
5
6
|
export async function outdated() {
|
|
6
7
|
if (!checkConfigFile()) {
|
|
@@ -15,8 +16,14 @@ export async function outdated() {
|
|
|
15
16
|
}
|
|
16
17
|
else {
|
|
17
18
|
console.log('Available updates:');
|
|
19
|
+
let allDeps = [...Object.keys(config.dependencies || {}), ...Object.keys(config['dev-dependencies'] || {})];
|
|
18
20
|
for (let dep of available) {
|
|
19
|
-
|
|
21
|
+
let name = allDeps.find((d) => {
|
|
22
|
+
let pinnedVersion = getDepPinnedVersion(d);
|
|
23
|
+
return getDepName(d) === dep[0] && (!pinnedVersion || dep[1].startsWith(pinnedVersion));
|
|
24
|
+
}) || dep[0];
|
|
25
|
+
|
|
26
|
+
console.log(`${name} ${chalk.yellow(dep[1])} -> ${chalk.green(dep[2])}`);
|
|
20
27
|
}
|
|
21
28
|
}
|
|
22
29
|
}
|
package/commands/owner.ts
CHANGED
|
@@ -2,7 +2,7 @@ import process from 'node:process';
|
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import {checkConfigFile, getIdentity, readConfig} from '../mops.js';
|
|
4
4
|
import {mainActor} from '../api/actors.js';
|
|
5
|
-
import {Principal} from '@
|
|
5
|
+
import {Principal} from '@icp-sdk/core/principal';
|
|
6
6
|
import prompts from 'prompts';
|
|
7
7
|
|
|
8
8
|
export async function printOwners() {
|