ic-mops 0.26.5 → 0.27.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/bun.lockb ADDED
Binary file
package/cli-local.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bun
2
+
3
+ import './cli.js';
@@ -5,6 +5,9 @@ import logUpdate from 'log-update';
5
5
  import {globbySync} from 'globby';
6
6
  import {minimatch} from 'minimatch';
7
7
  import prompts from 'prompts';
8
+ import {fromMarkdown} from 'mdast-util-from-markdown';
9
+ import {toMarkdown} from 'mdast-util-to-markdown';
10
+
8
11
  import {checkConfigFile, getRootDir, mainActor, progressBar, readConfig} from '../mops.js';
9
12
  import {parallel} from '../parallel.js';
10
13
  import {docs} from './docs.js';
@@ -227,6 +230,10 @@ export async function publish(options: {docs?: boolean, test?: boolean} = {}) {
227
230
  }
228
231
  }
229
232
 
233
+ // parse changelog
234
+ console.log('Parsing CHANGELOG.md...');
235
+ let changelog = parseChangelog(config.package.version);
236
+
230
237
  // test
231
238
  let reporter = new SilentReporter;
232
239
  if (options.test) {
@@ -265,6 +272,11 @@ export async function publish(options: {docs?: boolean, test?: boolean} = {}) {
265
272
  });
266
273
  }
267
274
 
275
+ // upload changelog
276
+ if (changelog) {
277
+ await actor.uploadNotes(puiblishingId, changelog);
278
+ }
279
+
268
280
  // upload files
269
281
  await parallel(8, files, async (file: string) => {
270
282
  progress();
@@ -308,4 +320,60 @@ export async function publish(options: {docs?: boolean, test?: boolean} = {}) {
308
320
  }
309
321
 
310
322
  console.log(chalk.green('Published ') + `${config.package.name}@${config.package.version}`);
323
+ }
324
+
325
+ function parseChangelog(version: string): string {
326
+ let rootDir = getRootDir();
327
+ let changelogFile = '';
328
+
329
+ let files = ['CHANGELOG.md', 'Changelog.md', 'changelog.md'];
330
+
331
+ for (let file of files) {
332
+ if (fs.existsSync(path.join(rootDir, file))) {
333
+ changelogFile = path.join(rootDir, file);
334
+ break;
335
+ }
336
+ }
337
+ if (!changelogFile) {
338
+ console.log(chalk.yellow('CHANGELOG.md not found'));
339
+ return '';
340
+ }
341
+
342
+ let str = fs.readFileSync(changelogFile, 'utf-8');
343
+ let changelog = findChangelogEntry(str, version);
344
+
345
+ if (changelog) {
346
+ console.log('Changelog:');
347
+ console.log(chalk.gray(changelog));
348
+ }
349
+ else {
350
+ console.log(chalk.yellow('No changelog entry found'));
351
+ }
352
+
353
+ return changelog || '';
354
+ }
355
+
356
+ function findChangelogEntry(changelog: string, version: string): string {
357
+ let tree = fromMarkdown(changelog);
358
+ let found = false;
359
+ let nodes = [];
360
+
361
+ for (let node of tree.children) {
362
+ if (found) {
363
+ if (node.type === 'heading') {
364
+ break;
365
+ }
366
+ else {
367
+ nodes.push(node);
368
+ }
369
+ }
370
+ else if (node.type === 'heading' && toMarkdown(node).match(new RegExp(`\\b${version}\\b`))) {
371
+ found = true;
372
+ }
373
+ }
374
+
375
+ return toMarkdown({
376
+ type: 'root',
377
+ children: nodes,
378
+ });
311
379
  }
@@ -26,6 +26,11 @@ type User =
26
26
  };
27
27
  type Time = int;
28
28
  type Text = text;
29
+ type TestsChanges =
30
+ record {
31
+ addedNames: vec text;
32
+ removedNames: vec text;
33
+ };
29
34
  type TestStats__1 =
30
35
  record {
31
36
  passed: nat;
@@ -111,6 +116,28 @@ type PackageSummary__1 =
111
116
  ownerInfo: User;
112
117
  publication: PackagePublication;
113
118
  };
119
+ type PackageSummaryWithChanges__1 =
120
+ record {
121
+ changes: PackageChanges;
122
+ config: PackageConfigV2__1;
123
+ downloadsInLast30Days: nat;
124
+ downloadsInLast7Days: nat;
125
+ downloadsTotal: nat;
126
+ owner: principal;
127
+ ownerInfo: User;
128
+ publication: PackagePublication;
129
+ };
130
+ type PackageSummaryWithChanges =
131
+ record {
132
+ changes: PackageChanges;
133
+ config: PackageConfigV2__1;
134
+ downloadsInLast30Days: nat;
135
+ downloadsInLast7Days: nat;
136
+ downloadsTotal: nat;
137
+ owner: principal;
138
+ ownerInfo: User;
139
+ publication: PackagePublication;
140
+ };
114
141
  type PackageSummary =
115
142
  record {
116
143
  config: PackageConfigV2__1;
@@ -137,6 +164,7 @@ type PackageFileStatsPublic =
137
164
  };
138
165
  type PackageDetails =
139
166
  record {
167
+ changes: PackageChanges;
140
168
  config: PackageConfigV2__1;
141
169
  dependents: vec PackageSummary__1;
142
170
  deps: vec PackageSummary__1;
@@ -150,7 +178,7 @@ type PackageDetails =
150
178
  ownerInfo: User;
151
179
  publication: PackagePublication;
152
180
  testStats: TestStats__1;
153
- versionHistory: vec PackageSummary__1;
181
+ versionHistory: vec PackageSummaryWithChanges__1;
154
182
  };
155
183
  type PackageConfigV2__1 =
156
184
  record {
@@ -190,6 +218,20 @@ type PackageConfigV2 =
190
218
  scripts: vec Script;
191
219
  version: text;
192
220
  };
221
+ type PackageChanges__1 =
222
+ record {
223
+ deps: vec DepChange;
224
+ devDeps: vec DepChange;
225
+ notes: text;
226
+ tests: TestsChanges;
227
+ };
228
+ type PackageChanges =
229
+ record {
230
+ deps: vec DepChange;
231
+ devDeps: vec DepChange;
232
+ notes: text;
233
+ tests: TestsChanges;
234
+ };
193
235
  type FileId = text;
194
236
  type Err = text;
195
237
  type DownloadsSnapshot__1 =
@@ -210,9 +252,16 @@ type DependencyV2 =
210
252
  repo: text;
211
253
  version: text;
212
254
  };
255
+ type DepChange =
256
+ record {
257
+ name: text;
258
+ newVersion: text;
259
+ oldVersion: text;
260
+ };
213
261
  service : {
214
262
  backup: () -> ();
215
263
  claimAirdrop: (principal) -> (text);
264
+ diff: (text, text) -> (PackageChanges__1) query;
216
265
  finishPublish: (PublishingId) -> (Result);
217
266
  getAirdropAmount: () -> (nat) query;
218
267
  getAirdropAmountAll: () -> (nat) query;
@@ -243,7 +292,7 @@ service : {
243
292
  text;
244
293
  vec PackageSummary;
245
294
  }) query;
246
- getRecentlyUpdatedPackages: () -> (vec PackageSummary) query;
295
+ getRecentlyUpdatedPackages: () -> (vec PackageSummaryWithChanges) query;
247
296
  getStoragesStats: () -> (vec record {
248
297
  StorageId;
249
298
  StorageStats;
@@ -259,5 +308,6 @@ service : {
259
308
  startPublish: (PackageConfigV2) -> (Result_1);
260
309
  takeAirdropSnapshot: () -> () oneway;
261
310
  uploadFileChunk: (PublishingId, FileId, nat, blob) -> (Result);
311
+ uploadNotes: (PublishingId, text) -> (Result);
262
312
  uploadTestStats: (PublishingId, TestStats) -> (Result);
263
313
  }
@@ -1,6 +1,11 @@
1
1
  import type { Principal } from '@dfinity/principal';
2
2
  import type { ActorMethod } from '@dfinity/agent';
3
3
 
4
+ export interface DepChange {
5
+ 'oldVersion' : string,
6
+ 'name' : string,
7
+ 'newVersion' : string,
8
+ }
4
9
  export interface DependencyV2 {
5
10
  'name' : PackageName,
6
11
  'repo' : string,
@@ -18,6 +23,18 @@ export interface DownloadsSnapshot__1 {
18
23
  }
19
24
  export type Err = string;
20
25
  export type FileId = string;
26
+ export interface PackageChanges {
27
+ 'tests' : TestsChanges,
28
+ 'deps' : Array<DepChange>,
29
+ 'notes' : string,
30
+ 'devDeps' : Array<DepChange>,
31
+ }
32
+ export interface PackageChanges__1 {
33
+ 'tests' : TestsChanges,
34
+ 'deps' : Array<DepChange>,
35
+ 'notes' : string,
36
+ 'devDeps' : Array<DepChange>,
37
+ }
21
38
  export interface PackageConfigV2 {
22
39
  'dfx' : string,
23
40
  'moc' : string,
@@ -63,11 +80,12 @@ export interface PackageDetails {
63
80
  'downloadsInLast30Days' : bigint,
64
81
  'downloadTrend' : Array<DownloadsSnapshot>,
65
82
  'fileStats' : PackageFileStatsPublic,
66
- 'versionHistory' : Array<PackageSummary__1>,
83
+ 'versionHistory' : Array<PackageSummaryWithChanges__1>,
67
84
  'dependents' : Array<PackageSummary__1>,
68
85
  'devDeps' : Array<PackageSummary__1>,
69
86
  'downloadsInLast7Days' : bigint,
70
87
  'config' : PackageConfigV2__1,
88
+ 'changes' : PackageChanges,
71
89
  'publication' : PackagePublication,
72
90
  }
73
91
  export interface PackageFileStatsPublic {
@@ -91,6 +109,26 @@ export interface PackageSummary {
91
109
  'config' : PackageConfigV2__1,
92
110
  'publication' : PackagePublication,
93
111
  }
112
+ export interface PackageSummaryWithChanges {
113
+ 'ownerInfo' : User,
114
+ 'owner' : Principal,
115
+ 'downloadsTotal' : bigint,
116
+ 'downloadsInLast30Days' : bigint,
117
+ 'downloadsInLast7Days' : bigint,
118
+ 'config' : PackageConfigV2__1,
119
+ 'changes' : PackageChanges,
120
+ 'publication' : PackagePublication,
121
+ }
122
+ export interface PackageSummaryWithChanges__1 {
123
+ 'ownerInfo' : User,
124
+ 'owner' : Principal,
125
+ 'downloadsTotal' : bigint,
126
+ 'downloadsInLast30Days' : bigint,
127
+ 'downloadsInLast7Days' : bigint,
128
+ 'config' : PackageConfigV2__1,
129
+ 'changes' : PackageChanges,
130
+ 'publication' : PackagePublication,
131
+ }
94
132
  export interface PackageSummary__1 {
95
133
  'ownerInfo' : User,
96
134
  'owner' : Principal,
@@ -135,6 +173,10 @@ export interface TestStats__1 {
135
173
  'passedNames' : Array<string>,
136
174
  'passed' : bigint,
137
175
  }
176
+ export interface TestsChanges {
177
+ 'addedNames' : Array<string>,
178
+ 'removedNames' : Array<string>,
179
+ }
138
180
  export type Text = string;
139
181
  export type Time = bigint;
140
182
  export interface User {
@@ -164,6 +206,7 @@ export interface User__1 {
164
206
  export interface _SERVICE {
165
207
  'backup' : ActorMethod<[], undefined>,
166
208
  'claimAirdrop' : ActorMethod<[Principal], string>,
209
+ 'diff' : ActorMethod<[string, string], PackageChanges__1>,
167
210
  'finishPublish' : ActorMethod<[PublishingId], Result>,
168
211
  'getAirdropAmount' : ActorMethod<[], bigint>,
169
212
  'getAirdropAmountAll' : ActorMethod<[], bigint>,
@@ -195,7 +238,10 @@ export interface _SERVICE {
195
238
  [],
196
239
  Array<[string, Array<PackageSummary>]>
197
240
  >,
198
- 'getRecentlyUpdatedPackages' : ActorMethod<[], Array<PackageSummary>>,
241
+ 'getRecentlyUpdatedPackages' : ActorMethod<
242
+ [],
243
+ Array<PackageSummaryWithChanges>
244
+ >,
199
245
  'getStoragesStats' : ActorMethod<[], Array<[StorageId, StorageStats]>>,
200
246
  'getTotalDownloads' : ActorMethod<[], bigint>,
201
247
  'getTotalPackages' : ActorMethod<[], bigint>,
@@ -217,5 +263,6 @@ export interface _SERVICE {
217
263
  [PublishingId, FileId, bigint, Uint8Array | number[]],
218
264
  Result
219
265
  >,
266
+ 'uploadNotes' : ActorMethod<[PublishingId, string], Result>,
220
267
  'uploadTestStats' : ActorMethod<[PublishingId, TestStats], Result>,
221
268
  }
@@ -1,4 +1,19 @@
1
1
  export const idlFactory = ({ IDL }) => {
2
+ const TestsChanges = IDL.Record({
3
+ 'addedNames' : IDL.Vec(IDL.Text),
4
+ 'removedNames' : IDL.Vec(IDL.Text),
5
+ });
6
+ const DepChange = IDL.Record({
7
+ 'oldVersion' : IDL.Text,
8
+ 'name' : IDL.Text,
9
+ 'newVersion' : IDL.Text,
10
+ });
11
+ const PackageChanges__1 = IDL.Record({
12
+ 'tests' : TestsChanges,
13
+ 'deps' : IDL.Vec(DepChange),
14
+ 'notes' : IDL.Text,
15
+ 'devDeps' : IDL.Vec(DepChange),
16
+ });
2
17
  const PublishingId = IDL.Text;
3
18
  const Err = IDL.Text;
4
19
  const Result = IDL.Variant({ 'ok' : IDL.Null, 'err' : Err });
@@ -97,6 +112,22 @@ export const idlFactory = ({ IDL }) => {
97
112
  'sourceFiles' : IDL.Nat,
98
113
  'sourceSize' : IDL.Nat,
99
114
  });
115
+ const PackageChanges = IDL.Record({
116
+ 'tests' : TestsChanges,
117
+ 'deps' : IDL.Vec(DepChange),
118
+ 'notes' : IDL.Text,
119
+ 'devDeps' : IDL.Vec(DepChange),
120
+ });
121
+ const PackageSummaryWithChanges__1 = IDL.Record({
122
+ 'ownerInfo' : User,
123
+ 'owner' : IDL.Principal,
124
+ 'downloadsTotal' : IDL.Nat,
125
+ 'downloadsInLast30Days' : IDL.Nat,
126
+ 'downloadsInLast7Days' : IDL.Nat,
127
+ 'config' : PackageConfigV2__1,
128
+ 'changes' : PackageChanges,
129
+ 'publication' : PackagePublication,
130
+ });
100
131
  const PackageDetails = IDL.Record({
101
132
  'ownerInfo' : User,
102
133
  'owner' : IDL.Principal,
@@ -106,14 +137,25 @@ export const idlFactory = ({ IDL }) => {
106
137
  'downloadsInLast30Days' : IDL.Nat,
107
138
  'downloadTrend' : IDL.Vec(DownloadsSnapshot),
108
139
  'fileStats' : PackageFileStatsPublic,
109
- 'versionHistory' : IDL.Vec(PackageSummary__1),
140
+ 'versionHistory' : IDL.Vec(PackageSummaryWithChanges__1),
110
141
  'dependents' : IDL.Vec(PackageSummary__1),
111
142
  'devDeps' : IDL.Vec(PackageSummary__1),
112
143
  'downloadsInLast7Days' : IDL.Nat,
113
144
  'config' : PackageConfigV2__1,
145
+ 'changes' : PackageChanges,
114
146
  'publication' : PackagePublication,
115
147
  });
116
148
  const Result_4 = IDL.Variant({ 'ok' : PackageDetails, 'err' : Err });
149
+ const PackageSummaryWithChanges = IDL.Record({
150
+ 'ownerInfo' : User,
151
+ 'owner' : IDL.Principal,
152
+ 'downloadsTotal' : IDL.Nat,
153
+ 'downloadsInLast30Days' : IDL.Nat,
154
+ 'downloadsInLast7Days' : IDL.Nat,
155
+ 'config' : PackageConfigV2__1,
156
+ 'changes' : PackageChanges,
157
+ 'publication' : PackagePublication,
158
+ });
117
159
  const StorageId = IDL.Principal;
118
160
  const StorageStats = IDL.Record({
119
161
  'fileCount' : IDL.Nat,
@@ -162,6 +204,7 @@ export const idlFactory = ({ IDL }) => {
162
204
  return IDL.Service({
163
205
  'backup' : IDL.Func([], [], []),
164
206
  'claimAirdrop' : IDL.Func([IDL.Principal], [IDL.Text], []),
207
+ 'diff' : IDL.Func([IDL.Text, IDL.Text], [PackageChanges__1], ['query']),
165
208
  'finishPublish' : IDL.Func([PublishingId], [Result], []),
166
209
  'getAirdropAmount' : IDL.Func([], [IDL.Nat], ['query']),
167
210
  'getAirdropAmountAll' : IDL.Func([], [IDL.Nat], ['query']),
@@ -216,7 +259,7 @@ export const idlFactory = ({ IDL }) => {
216
259
  ),
217
260
  'getRecentlyUpdatedPackages' : IDL.Func(
218
261
  [],
219
- [IDL.Vec(PackageSummary)],
262
+ [IDL.Vec(PackageSummaryWithChanges)],
220
263
  ['query'],
221
264
  ),
222
265
  'getStoragesStats' : IDL.Func(
@@ -251,6 +294,7 @@ export const idlFactory = ({ IDL }) => {
251
294
  [Result],
252
295
  [],
253
296
  ),
297
+ 'uploadNotes' : IDL.Func([PublishingId, IDL.Text], [Result], []),
254
298
  'uploadTestStats' : IDL.Func([PublishingId, TestStats], [Result], []),
255
299
  });
256
300
  };
@@ -5,6 +5,8 @@ import logUpdate from 'log-update';
5
5
  import { globbySync } from 'globby';
6
6
  import { minimatch } from 'minimatch';
7
7
  import prompts from 'prompts';
8
+ import { fromMarkdown } from 'mdast-util-from-markdown';
9
+ import { toMarkdown } from 'mdast-util-to-markdown';
8
10
  import { checkConfigFile, getRootDir, mainActor, progressBar, readConfig } from '../mops.js';
9
11
  import { parallel } from '../parallel.js';
10
12
  import { docs } from './docs.js';
@@ -203,6 +205,9 @@ export async function publish(options = {}) {
203
205
  process.exit(1);
204
206
  }
205
207
  }
208
+ // parse changelog
209
+ console.log('Parsing CHANGELOG.md...');
210
+ let changelog = parseChangelog(config.package.version);
206
211
  // test
207
212
  let reporter = new SilentReporter;
208
213
  if (options.test) {
@@ -236,6 +241,10 @@ export async function publish(options = {}) {
236
241
  passedNames: reporter.passedNamesFlat,
237
242
  });
238
243
  }
244
+ // upload changelog
245
+ if (changelog) {
246
+ await actor.uploadNotes(puiblishingId, changelog);
247
+ }
239
248
  // upload files
240
249
  await parallel(8, files, async (file) => {
241
250
  progress();
@@ -273,3 +282,50 @@ export async function publish(options = {}) {
273
282
  }
274
283
  console.log(chalk.green('Published ') + `${config.package.name}@${config.package.version}`);
275
284
  }
285
+ function parseChangelog(version) {
286
+ let rootDir = getRootDir();
287
+ let changelogFile = '';
288
+ let files = ['CHANGELOG.md', 'Changelog.md', 'changelog.md'];
289
+ for (let file of files) {
290
+ if (fs.existsSync(path.join(rootDir, file))) {
291
+ changelogFile = path.join(rootDir, file);
292
+ break;
293
+ }
294
+ }
295
+ if (!changelogFile) {
296
+ console.log(chalk.yellow('CHANGELOG.md not found'));
297
+ return '';
298
+ }
299
+ let str = fs.readFileSync(changelogFile, 'utf-8');
300
+ let changelog = findChangelogEntry(str, version);
301
+ if (changelog) {
302
+ console.log('Changelog:');
303
+ console.log(chalk.gray(changelog));
304
+ }
305
+ else {
306
+ console.log(chalk.yellow('No changelog entry found'));
307
+ }
308
+ return changelog || '';
309
+ }
310
+ function findChangelogEntry(changelog, version) {
311
+ let tree = fromMarkdown(changelog);
312
+ let found = false;
313
+ let nodes = [];
314
+ for (let node of tree.children) {
315
+ if (found) {
316
+ if (node.type === 'heading') {
317
+ break;
318
+ }
319
+ else {
320
+ nodes.push(node);
321
+ }
322
+ }
323
+ else if (node.type === 'heading' && toMarkdown(node).match(new RegExp(`\\b${version}\\b`))) {
324
+ found = true;
325
+ }
326
+ }
327
+ return toMarkdown({
328
+ type: 'root',
329
+ children: nodes,
330
+ });
331
+ }
@@ -26,6 +26,11 @@ type User =
26
26
  };
27
27
  type Time = int;
28
28
  type Text = text;
29
+ type TestsChanges =
30
+ record {
31
+ addedNames: vec text;
32
+ removedNames: vec text;
33
+ };
29
34
  type TestStats__1 =
30
35
  record {
31
36
  passed: nat;
@@ -111,6 +116,28 @@ type PackageSummary__1 =
111
116
  ownerInfo: User;
112
117
  publication: PackagePublication;
113
118
  };
119
+ type PackageSummaryWithChanges__1 =
120
+ record {
121
+ changes: PackageChanges;
122
+ config: PackageConfigV2__1;
123
+ downloadsInLast30Days: nat;
124
+ downloadsInLast7Days: nat;
125
+ downloadsTotal: nat;
126
+ owner: principal;
127
+ ownerInfo: User;
128
+ publication: PackagePublication;
129
+ };
130
+ type PackageSummaryWithChanges =
131
+ record {
132
+ changes: PackageChanges;
133
+ config: PackageConfigV2__1;
134
+ downloadsInLast30Days: nat;
135
+ downloadsInLast7Days: nat;
136
+ downloadsTotal: nat;
137
+ owner: principal;
138
+ ownerInfo: User;
139
+ publication: PackagePublication;
140
+ };
114
141
  type PackageSummary =
115
142
  record {
116
143
  config: PackageConfigV2__1;
@@ -137,6 +164,7 @@ type PackageFileStatsPublic =
137
164
  };
138
165
  type PackageDetails =
139
166
  record {
167
+ changes: PackageChanges;
140
168
  config: PackageConfigV2__1;
141
169
  dependents: vec PackageSummary__1;
142
170
  deps: vec PackageSummary__1;
@@ -150,7 +178,7 @@ type PackageDetails =
150
178
  ownerInfo: User;
151
179
  publication: PackagePublication;
152
180
  testStats: TestStats__1;
153
- versionHistory: vec PackageSummary__1;
181
+ versionHistory: vec PackageSummaryWithChanges__1;
154
182
  };
155
183
  type PackageConfigV2__1 =
156
184
  record {
@@ -190,6 +218,20 @@ type PackageConfigV2 =
190
218
  scripts: vec Script;
191
219
  version: text;
192
220
  };
221
+ type PackageChanges__1 =
222
+ record {
223
+ deps: vec DepChange;
224
+ devDeps: vec DepChange;
225
+ notes: text;
226
+ tests: TestsChanges;
227
+ };
228
+ type PackageChanges =
229
+ record {
230
+ deps: vec DepChange;
231
+ devDeps: vec DepChange;
232
+ notes: text;
233
+ tests: TestsChanges;
234
+ };
193
235
  type FileId = text;
194
236
  type Err = text;
195
237
  type DownloadsSnapshot__1 =
@@ -210,9 +252,16 @@ type DependencyV2 =
210
252
  repo: text;
211
253
  version: text;
212
254
  };
255
+ type DepChange =
256
+ record {
257
+ name: text;
258
+ newVersion: text;
259
+ oldVersion: text;
260
+ };
213
261
  service : {
214
262
  backup: () -> ();
215
263
  claimAirdrop: (principal) -> (text);
264
+ diff: (text, text) -> (PackageChanges__1) query;
216
265
  finishPublish: (PublishingId) -> (Result);
217
266
  getAirdropAmount: () -> (nat) query;
218
267
  getAirdropAmountAll: () -> (nat) query;
@@ -243,7 +292,7 @@ service : {
243
292
  text;
244
293
  vec PackageSummary;
245
294
  }) query;
246
- getRecentlyUpdatedPackages: () -> (vec PackageSummary) query;
295
+ getRecentlyUpdatedPackages: () -> (vec PackageSummaryWithChanges) query;
247
296
  getStoragesStats: () -> (vec record {
248
297
  StorageId;
249
298
  StorageStats;
@@ -259,5 +308,6 @@ service : {
259
308
  startPublish: (PackageConfigV2) -> (Result_1);
260
309
  takeAirdropSnapshot: () -> () oneway;
261
310
  uploadFileChunk: (PublishingId, FileId, nat, blob) -> (Result);
311
+ uploadNotes: (PublishingId, text) -> (Result);
262
312
  uploadTestStats: (PublishingId, TestStats) -> (Result);
263
313
  }
@@ -1,6 +1,11 @@
1
1
  import type { Principal } from '@dfinity/principal';
2
2
  import type { ActorMethod } from '@dfinity/agent';
3
3
 
4
+ export interface DepChange {
5
+ 'oldVersion' : string,
6
+ 'name' : string,
7
+ 'newVersion' : string,
8
+ }
4
9
  export interface DependencyV2 {
5
10
  'name' : PackageName,
6
11
  'repo' : string,
@@ -18,6 +23,18 @@ export interface DownloadsSnapshot__1 {
18
23
  }
19
24
  export type Err = string;
20
25
  export type FileId = string;
26
+ export interface PackageChanges {
27
+ 'tests' : TestsChanges,
28
+ 'deps' : Array<DepChange>,
29
+ 'notes' : string,
30
+ 'devDeps' : Array<DepChange>,
31
+ }
32
+ export interface PackageChanges__1 {
33
+ 'tests' : TestsChanges,
34
+ 'deps' : Array<DepChange>,
35
+ 'notes' : string,
36
+ 'devDeps' : Array<DepChange>,
37
+ }
21
38
  export interface PackageConfigV2 {
22
39
  'dfx' : string,
23
40
  'moc' : string,
@@ -63,11 +80,12 @@ export interface PackageDetails {
63
80
  'downloadsInLast30Days' : bigint,
64
81
  'downloadTrend' : Array<DownloadsSnapshot>,
65
82
  'fileStats' : PackageFileStatsPublic,
66
- 'versionHistory' : Array<PackageSummary__1>,
83
+ 'versionHistory' : Array<PackageSummaryWithChanges__1>,
67
84
  'dependents' : Array<PackageSummary__1>,
68
85
  'devDeps' : Array<PackageSummary__1>,
69
86
  'downloadsInLast7Days' : bigint,
70
87
  'config' : PackageConfigV2__1,
88
+ 'changes' : PackageChanges,
71
89
  'publication' : PackagePublication,
72
90
  }
73
91
  export interface PackageFileStatsPublic {
@@ -91,6 +109,26 @@ export interface PackageSummary {
91
109
  'config' : PackageConfigV2__1,
92
110
  'publication' : PackagePublication,
93
111
  }
112
+ export interface PackageSummaryWithChanges {
113
+ 'ownerInfo' : User,
114
+ 'owner' : Principal,
115
+ 'downloadsTotal' : bigint,
116
+ 'downloadsInLast30Days' : bigint,
117
+ 'downloadsInLast7Days' : bigint,
118
+ 'config' : PackageConfigV2__1,
119
+ 'changes' : PackageChanges,
120
+ 'publication' : PackagePublication,
121
+ }
122
+ export interface PackageSummaryWithChanges__1 {
123
+ 'ownerInfo' : User,
124
+ 'owner' : Principal,
125
+ 'downloadsTotal' : bigint,
126
+ 'downloadsInLast30Days' : bigint,
127
+ 'downloadsInLast7Days' : bigint,
128
+ 'config' : PackageConfigV2__1,
129
+ 'changes' : PackageChanges,
130
+ 'publication' : PackagePublication,
131
+ }
94
132
  export interface PackageSummary__1 {
95
133
  'ownerInfo' : User,
96
134
  'owner' : Principal,
@@ -135,6 +173,10 @@ export interface TestStats__1 {
135
173
  'passedNames' : Array<string>,
136
174
  'passed' : bigint,
137
175
  }
176
+ export interface TestsChanges {
177
+ 'addedNames' : Array<string>,
178
+ 'removedNames' : Array<string>,
179
+ }
138
180
  export type Text = string;
139
181
  export type Time = bigint;
140
182
  export interface User {
@@ -164,6 +206,7 @@ export interface User__1 {
164
206
  export interface _SERVICE {
165
207
  'backup' : ActorMethod<[], undefined>,
166
208
  'claimAirdrop' : ActorMethod<[Principal], string>,
209
+ 'diff' : ActorMethod<[string, string], PackageChanges__1>,
167
210
  'finishPublish' : ActorMethod<[PublishingId], Result>,
168
211
  'getAirdropAmount' : ActorMethod<[], bigint>,
169
212
  'getAirdropAmountAll' : ActorMethod<[], bigint>,
@@ -195,7 +238,10 @@ export interface _SERVICE {
195
238
  [],
196
239
  Array<[string, Array<PackageSummary>]>
197
240
  >,
198
- 'getRecentlyUpdatedPackages' : ActorMethod<[], Array<PackageSummary>>,
241
+ 'getRecentlyUpdatedPackages' : ActorMethod<
242
+ [],
243
+ Array<PackageSummaryWithChanges>
244
+ >,
199
245
  'getStoragesStats' : ActorMethod<[], Array<[StorageId, StorageStats]>>,
200
246
  'getTotalDownloads' : ActorMethod<[], bigint>,
201
247
  'getTotalPackages' : ActorMethod<[], bigint>,
@@ -217,5 +263,6 @@ export interface _SERVICE {
217
263
  [PublishingId, FileId, bigint, Uint8Array | number[]],
218
264
  Result
219
265
  >,
266
+ 'uploadNotes' : ActorMethod<[PublishingId, string], Result>,
220
267
  'uploadTestStats' : ActorMethod<[PublishingId, TestStats], Result>,
221
268
  }
@@ -1,4 +1,19 @@
1
1
  export const idlFactory = ({ IDL }) => {
2
+ const TestsChanges = IDL.Record({
3
+ 'addedNames' : IDL.Vec(IDL.Text),
4
+ 'removedNames' : IDL.Vec(IDL.Text),
5
+ });
6
+ const DepChange = IDL.Record({
7
+ 'oldVersion' : IDL.Text,
8
+ 'name' : IDL.Text,
9
+ 'newVersion' : IDL.Text,
10
+ });
11
+ const PackageChanges__1 = IDL.Record({
12
+ 'tests' : TestsChanges,
13
+ 'deps' : IDL.Vec(DepChange),
14
+ 'notes' : IDL.Text,
15
+ 'devDeps' : IDL.Vec(DepChange),
16
+ });
2
17
  const PublishingId = IDL.Text;
3
18
  const Err = IDL.Text;
4
19
  const Result = IDL.Variant({ 'ok' : IDL.Null, 'err' : Err });
@@ -97,6 +112,22 @@ export const idlFactory = ({ IDL }) => {
97
112
  'sourceFiles' : IDL.Nat,
98
113
  'sourceSize' : IDL.Nat,
99
114
  });
115
+ const PackageChanges = IDL.Record({
116
+ 'tests' : TestsChanges,
117
+ 'deps' : IDL.Vec(DepChange),
118
+ 'notes' : IDL.Text,
119
+ 'devDeps' : IDL.Vec(DepChange),
120
+ });
121
+ const PackageSummaryWithChanges__1 = IDL.Record({
122
+ 'ownerInfo' : User,
123
+ 'owner' : IDL.Principal,
124
+ 'downloadsTotal' : IDL.Nat,
125
+ 'downloadsInLast30Days' : IDL.Nat,
126
+ 'downloadsInLast7Days' : IDL.Nat,
127
+ 'config' : PackageConfigV2__1,
128
+ 'changes' : PackageChanges,
129
+ 'publication' : PackagePublication,
130
+ });
100
131
  const PackageDetails = IDL.Record({
101
132
  'ownerInfo' : User,
102
133
  'owner' : IDL.Principal,
@@ -106,14 +137,25 @@ export const idlFactory = ({ IDL }) => {
106
137
  'downloadsInLast30Days' : IDL.Nat,
107
138
  'downloadTrend' : IDL.Vec(DownloadsSnapshot),
108
139
  'fileStats' : PackageFileStatsPublic,
109
- 'versionHistory' : IDL.Vec(PackageSummary__1),
140
+ 'versionHistory' : IDL.Vec(PackageSummaryWithChanges__1),
110
141
  'dependents' : IDL.Vec(PackageSummary__1),
111
142
  'devDeps' : IDL.Vec(PackageSummary__1),
112
143
  'downloadsInLast7Days' : IDL.Nat,
113
144
  'config' : PackageConfigV2__1,
145
+ 'changes' : PackageChanges,
114
146
  'publication' : PackagePublication,
115
147
  });
116
148
  const Result_4 = IDL.Variant({ 'ok' : PackageDetails, 'err' : Err });
149
+ const PackageSummaryWithChanges = IDL.Record({
150
+ 'ownerInfo' : User,
151
+ 'owner' : IDL.Principal,
152
+ 'downloadsTotal' : IDL.Nat,
153
+ 'downloadsInLast30Days' : IDL.Nat,
154
+ 'downloadsInLast7Days' : IDL.Nat,
155
+ 'config' : PackageConfigV2__1,
156
+ 'changes' : PackageChanges,
157
+ 'publication' : PackagePublication,
158
+ });
117
159
  const StorageId = IDL.Principal;
118
160
  const StorageStats = IDL.Record({
119
161
  'fileCount' : IDL.Nat,
@@ -162,6 +204,7 @@ export const idlFactory = ({ IDL }) => {
162
204
  return IDL.Service({
163
205
  'backup' : IDL.Func([], [], []),
164
206
  'claimAirdrop' : IDL.Func([IDL.Principal], [IDL.Text], []),
207
+ 'diff' : IDL.Func([IDL.Text, IDL.Text], [PackageChanges__1], ['query']),
165
208
  'finishPublish' : IDL.Func([PublishingId], [Result], []),
166
209
  'getAirdropAmount' : IDL.Func([], [IDL.Nat], ['query']),
167
210
  'getAirdropAmountAll' : IDL.Func([], [IDL.Nat], ['query']),
@@ -216,7 +259,7 @@ export const idlFactory = ({ IDL }) => {
216
259
  ),
217
260
  'getRecentlyUpdatedPackages' : IDL.Func(
218
261
  [],
219
- [IDL.Vec(PackageSummary)],
262
+ [IDL.Vec(PackageSummaryWithChanges)],
220
263
  ['query'],
221
264
  ),
222
265
  'getStoragesStats' : IDL.Func(
@@ -251,6 +294,7 @@ export const idlFactory = ({ IDL }) => {
251
294
  [Result],
252
295
  [],
253
296
  ),
297
+ 'uploadNotes' : IDL.Func([PublishingId, IDL.Text], [Result], []),
254
298
  'uploadTestStats' : IDL.Func([PublishingId, TestStats], [Result], []),
255
299
  });
256
300
  };
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ic-mops",
3
- "version": "0.26.5",
3
+ "version": "0.27.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mops": "dist/cli.js"
@@ -55,6 +55,8 @@
55
55
  "globby": "^13.2.2",
56
56
  "got": "13.0.0",
57
57
  "log-update": "^5.0.1",
58
+ "mdast-util-from-markdown": "^2.0.0",
59
+ "mdast-util-to-markdown": "^2.1.0",
58
60
  "minimatch": "^9.0.3",
59
61
  "ncp": "^2.0.0",
60
62
  "node-fetch": "^3.3.2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ic-mops",
3
- "version": "0.26.5",
3
+ "version": "0.27.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mops": "dist/cli.js"
@@ -55,6 +55,8 @@
55
55
  "globby": "^13.2.2",
56
56
  "got": "13.0.0",
57
57
  "log-update": "^5.0.1",
58
+ "mdast-util-from-markdown": "^2.0.0",
59
+ "mdast-util-to-markdown": "^2.1.0",
58
60
  "minimatch": "^9.0.3",
59
61
  "ncp": "^2.0.0",
60
62
  "node-fetch": "^3.3.2",