@edifice.io/aiwiki-nest-client 0.2.1 → 0.2.2

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/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
- var c = Object.defineProperty;
2
- var l = (r, e, t) => e in r ? c(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var g = (r, e, t) => (l(r, typeof e != "symbol" ? e + "" : e, t), t);
1
+ var g = Object.defineProperty;
2
+ var l = (r, e, t) => e in r ? g(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var c = (r, e, t) => (l(r, typeof e != "symbol" ? e + "" : e, t), t);
4
4
  import { Injectable as u, Logger as w } from "@nestjs/common";
5
5
  import { firstValueFrom as i } from "rxjs";
6
- var h = Object.getOwnPropertyDescriptor, b = (r, e, t, n) => {
7
- for (var s = n > 1 ? void 0 : n ? h(e, t) : e, o = r.length - 1, d; o >= 0; o--)
8
- (d = r[o]) && (s = d(s) || s);
9
- return s;
6
+ var h = Object.getOwnPropertyDescriptor, b = (r, e, t, s) => {
7
+ for (var n = s > 1 ? void 0 : s ? h(e, t) : e, o = r.length - 1, d; o >= 0; o--)
8
+ (d = r[o]) && (n = d(n) || n);
9
+ return n;
10
10
  };
11
11
  let a = class {
12
12
  constructor(r) {
13
- g(this, "logger", new w(a.name));
13
+ c(this, "logger", new w(a.name));
14
14
  this.natsClient = r, this.logger.log("Creating events service AiwikiNatsServiceClient");
15
15
  }
16
16
  /**
@@ -19,10 +19,22 @@ let a = class {
19
19
  async checkFile(r) {
20
20
  const e = "ia.wiki.transform.check";
21
21
  this.logger.debug({ messageAddress: e }, "Sending request to NATS subject");
22
- const t = Date.now(), n = await i(this.natsClient.send(e, r)), s = Date.now() - t;
23
- if (this.logger.debug({ brokerAddress: e, duration: s }, "[nats][mttr]"), !n)
22
+ const t = Date.now(), s = await i(this.natsClient.send(e, r)), n = Date.now() - t;
23
+ if (this.logger.debug({ brokerAddress: e, duration: n }, "[nats][mttr]"), !s)
24
24
  throw this.logger.warn({ messageAddress: e }, "No reply received for subject"), new Error("No reply received");
25
- return n;
25
+ return s;
26
+ }
27
+ /**
28
+ * Starts the generation of a teaching sequence for a teacher : a first page presenting the sequence, then one page
29
+ * per lesson. The pages are sent back like the ones of a wiki.
30
+ */
31
+ async createSequence(r) {
32
+ const e = "ia.wiki.sequence.create";
33
+ this.logger.debug({ messageAddress: e }, "Sending request to NATS subject");
34
+ const t = Date.now(), s = await i(this.natsClient.send(e, r)), n = Date.now() - t;
35
+ if (this.logger.debug({ brokerAddress: e, duration: n }, "[nats][mttr]"), !s)
36
+ throw this.logger.warn({ messageAddress: e }, "No reply received for subject"), new Error("No reply received");
37
+ return s;
26
38
  }
27
39
  /**
28
40
  * Starts the generation of a wiki from a description of its subject.
@@ -30,10 +42,10 @@ let a = class {
30
42
  async createWiki(r) {
31
43
  const e = "ia.wiki.create";
32
44
  this.logger.debug({ messageAddress: e }, "Sending request to NATS subject");
33
- const t = Date.now(), n = await i(this.natsClient.send(e, r)), s = Date.now() - t;
34
- if (this.logger.debug({ brokerAddress: e, duration: s }, "[nats][mttr]"), !n)
45
+ const t = Date.now(), s = await i(this.natsClient.send(e, r)), n = Date.now() - t;
46
+ if (this.logger.debug({ brokerAddress: e, duration: n }, "[nats][mttr]"), !s)
35
47
  throw this.logger.warn({ messageAddress: e }, "No reply received for subject"), new Error("No reply received");
36
- return n;
48
+ return s;
37
49
  }
38
50
  /**
39
51
  * Starts the generation of a wiki from a PDF. The PDF is checked first : the job is refused, with a reason, when it
@@ -42,10 +54,10 @@ let a = class {
42
54
  async transformWiki(r) {
43
55
  const e = "ia.wiki.transform";
44
56
  this.logger.debug({ messageAddress: e }, "Sending request to NATS subject");
45
- const t = Date.now(), n = await i(this.natsClient.send(e, r)), s = Date.now() - t;
46
- if (this.logger.debug({ brokerAddress: e, duration: s }, "[nats][mttr]"), !n)
57
+ const t = Date.now(), s = await i(this.natsClient.send(e, r)), n = Date.now() - t;
58
+ if (this.logger.debug({ brokerAddress: e, duration: n }, "[nats][mttr]"), !s)
47
59
  throw this.logger.warn({ messageAddress: e }, "No reply received for subject"), new Error("No reply received");
48
- return n;
60
+ return s;
49
61
  }
50
62
  /**
51
63
  * Receives the content of one generated page of a wiki.
@@ -53,10 +65,10 @@ let a = class {
53
65
  async updateWikiContent(r, e) {
54
66
  const t = "ia.wiki." + e + ".content.updated";
55
67
  this.logger.debug({ messageAddress: t }, "Sending request to NATS subject");
56
- const n = Date.now(), s = await i(this.natsClient.send(t, r)), o = Date.now() - n;
57
- if (this.logger.debug({ brokerAddress: t, duration: o }, "[nats][mttr]"), !s)
68
+ const s = Date.now(), n = await i(this.natsClient.send(t, r)), o = Date.now() - s;
69
+ if (this.logger.debug({ brokerAddress: t, duration: o }, "[nats][mttr]"), !n)
58
70
  throw this.logger.warn({ messageAddress: t }, "No reply received for subject"), new Error("No reply received");
59
- return s;
71
+ return n;
60
72
  }
61
73
  /**
62
74
  * Receives the structure of a generated wiki : its pages, without their content.
@@ -64,10 +76,10 @@ let a = class {
64
76
  async updateWikiStructure(r, e) {
65
77
  const t = "ia.wiki." + e + ".structure.updated";
66
78
  this.logger.debug({ messageAddress: t }, "Sending request to NATS subject");
67
- const n = Date.now(), s = await i(this.natsClient.send(t, r)), o = Date.now() - n;
68
- if (this.logger.debug({ brokerAddress: t, duration: o }, "[nats][mttr]"), !s)
79
+ const s = Date.now(), n = await i(this.natsClient.send(t, r)), o = Date.now() - s;
80
+ if (this.logger.debug({ brokerAddress: t, duration: o }, "[nats][mttr]"), !n)
69
81
  throw this.logger.warn({ messageAddress: t }, "No reply received for subject"), new Error("No reply received");
70
- return s;
82
+ return n;
71
83
  }
72
84
  };
73
85
  a = b([
@@ -1 +1 @@
1
- (function(t,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("@nestjs/common"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@nestjs/common","rxjs"],n):(t=typeof globalThis<"u"?globalThis:t||self,n((t["@edifice"]=t["@edifice"]||{},t["@edifice"]["io/aiwiki-nest-client"]={}),t.NestjsCommon,t.rxjs))})(this,function(t,n,d){"use strict";var w=Object.defineProperty;var f=(t,n,d)=>n in t?w(t,n,{enumerable:!0,configurable:!0,writable:!0,value:d}):t[n]=d;var g=(t,n,d)=>(f(t,typeof n!="symbol"?n+"":n,d),d);var u=Object.getOwnPropertyDescriptor,l=(c,o,e,r)=>{for(var s=r>1?void 0:r?u(o,e):o,i=c.length-1,a;i>=0;i--)(a=c[i])&&(s=a(s)||s);return s};t.AiwikiNatsServiceClient=class{constructor(o){g(this,"logger",new n.Logger(t.AiwikiNatsServiceClient.name));this.natsClient=o,this.logger.log("Creating events service AiwikiNatsServiceClient")}async checkFile(o){const e="ia.wiki.transform.check";this.logger.debug({messageAddress:e},"Sending request to NATS subject");const r=Date.now(),s=await d.firstValueFrom(this.natsClient.send(e,o)),i=Date.now()-r;if(this.logger.debug({brokerAddress:e,duration:i},"[nats][mttr]"),!s)throw this.logger.warn({messageAddress:e},"No reply received for subject"),new Error("No reply received");return s}async createWiki(o){const e="ia.wiki.create";this.logger.debug({messageAddress:e},"Sending request to NATS subject");const r=Date.now(),s=await d.firstValueFrom(this.natsClient.send(e,o)),i=Date.now()-r;if(this.logger.debug({brokerAddress:e,duration:i},"[nats][mttr]"),!s)throw this.logger.warn({messageAddress:e},"No reply received for subject"),new Error("No reply received");return s}async transformWiki(o){const e="ia.wiki.transform";this.logger.debug({messageAddress:e},"Sending request to NATS subject");const r=Date.now(),s=await d.firstValueFrom(this.natsClient.send(e,o)),i=Date.now()-r;if(this.logger.debug({brokerAddress:e,duration:i},"[nats][mttr]"),!s)throw this.logger.warn({messageAddress:e},"No reply received for subject"),new Error("No reply received");return s}async updateWikiContent(o,e){const r="ia.wiki."+e+".content.updated";this.logger.debug({messageAddress:r},"Sending request to NATS subject");const s=Date.now(),i=await d.firstValueFrom(this.natsClient.send(r,o)),a=Date.now()-s;if(this.logger.debug({brokerAddress:r,duration:a},"[nats][mttr]"),!i)throw this.logger.warn({messageAddress:r},"No reply received for subject"),new Error("No reply received");return i}async updateWikiStructure(o,e){const r="ia.wiki."+e+".structure.updated";this.logger.debug({messageAddress:r},"Sending request to NATS subject");const s=Date.now(),i=await d.firstValueFrom(this.natsClient.send(r,o)),a=Date.now()-s;if(this.logger.debug({brokerAddress:r,duration:a},"[nats][mttr]"),!i)throw this.logger.warn({messageAddress:r},"No reply received for subject"),new Error("No reply received");return i}},t.AiwikiNatsServiceClient=l([n.Injectable()],t.AiwikiNatsServiceClient),Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
1
+ (function(s,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@nestjs/common"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@nestjs/common","rxjs"],o):(s=typeof globalThis<"u"?globalThis:s||self,o((s["@edifice"]=s["@edifice"]||{},s["@edifice"]["io/aiwiki-nest-client"]={}),s.NestjsCommon,s.rxjs))})(this,function(s,o,d){"use strict";var w=Object.defineProperty;var f=(s,o,d)=>o in s?w(s,o,{enumerable:!0,configurable:!0,writable:!0,value:d}):s[o]=d;var g=(s,o,d)=>(f(s,typeof o!="symbol"?o+"":o,d),d);var u=Object.getOwnPropertyDescriptor,l=(c,n,e,t)=>{for(var r=t>1?void 0:t?u(n,e):n,i=c.length-1,a;i>=0;i--)(a=c[i])&&(r=a(r)||r);return r};s.AiwikiNatsServiceClient=class{constructor(n){g(this,"logger",new o.Logger(s.AiwikiNatsServiceClient.name));this.natsClient=n,this.logger.log("Creating events service AiwikiNatsServiceClient")}async checkFile(n){const e="ia.wiki.transform.check";this.logger.debug({messageAddress:e},"Sending request to NATS subject");const t=Date.now(),r=await d.firstValueFrom(this.natsClient.send(e,n)),i=Date.now()-t;if(this.logger.debug({brokerAddress:e,duration:i},"[nats][mttr]"),!r)throw this.logger.warn({messageAddress:e},"No reply received for subject"),new Error("No reply received");return r}async createSequence(n){const e="ia.wiki.sequence.create";this.logger.debug({messageAddress:e},"Sending request to NATS subject");const t=Date.now(),r=await d.firstValueFrom(this.natsClient.send(e,n)),i=Date.now()-t;if(this.logger.debug({brokerAddress:e,duration:i},"[nats][mttr]"),!r)throw this.logger.warn({messageAddress:e},"No reply received for subject"),new Error("No reply received");return r}async createWiki(n){const e="ia.wiki.create";this.logger.debug({messageAddress:e},"Sending request to NATS subject");const t=Date.now(),r=await d.firstValueFrom(this.natsClient.send(e,n)),i=Date.now()-t;if(this.logger.debug({brokerAddress:e,duration:i},"[nats][mttr]"),!r)throw this.logger.warn({messageAddress:e},"No reply received for subject"),new Error("No reply received");return r}async transformWiki(n){const e="ia.wiki.transform";this.logger.debug({messageAddress:e},"Sending request to NATS subject");const t=Date.now(),r=await d.firstValueFrom(this.natsClient.send(e,n)),i=Date.now()-t;if(this.logger.debug({brokerAddress:e,duration:i},"[nats][mttr]"),!r)throw this.logger.warn({messageAddress:e},"No reply received for subject"),new Error("No reply received");return r}async updateWikiContent(n,e){const t="ia.wiki."+e+".content.updated";this.logger.debug({messageAddress:t},"Sending request to NATS subject");const r=Date.now(),i=await d.firstValueFrom(this.natsClient.send(t,n)),a=Date.now()-r;if(this.logger.debug({brokerAddress:t,duration:a},"[nats][mttr]"),!i)throw this.logger.warn({messageAddress:t},"No reply received for subject"),new Error("No reply received");return i}async updateWikiStructure(n,e){const t="ia.wiki."+e+".structure.updated";this.logger.debug({messageAddress:t},"Sending request to NATS subject");const r=Date.now(),i=await d.firstValueFrom(this.natsClient.send(t,n)),a=Date.now()-r;if(this.logger.debug({brokerAddress:t,duration:a},"[nats][mttr]"),!i)throw this.logger.warn({messageAddress:t},"No reply received for subject"),new Error("No reply received");return i}},s.AiwikiNatsServiceClient=l([o.Injectable()],s.AiwikiNatsServiceClient),Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
@@ -1,5 +1,5 @@
1
1
  import { ClientProxy } from '@nestjs/microservices';
2
- import { ContentRequest, ContentTransformRequest, CourseHierarchy, CourseResponse, FileCheckRequest, FileCheckResponse, JobAccepted, MessageReceived } from '@edifice.io/aiwiki-nest-api';
2
+ import { ContentRequest, ContentTransformRequest, CourseHierarchy, CourseResponse, FileCheckRequest, FileCheckResponse, JobAccepted, MessageReceived, SequenceRequest } from '@edifice.io/aiwiki-nest-api';
3
3
  export declare class AiwikiNatsServiceClient {
4
4
  private readonly natsClient;
5
5
  private readonly logger;
@@ -8,6 +8,11 @@ export declare class AiwikiNatsServiceClient {
8
8
  * Tells whether a PDF can be turned into a wiki, before any generation.
9
9
  */
10
10
  checkFile(request: FileCheckRequest): Promise<FileCheckResponse>;
11
+ /**
12
+ * Starts the generation of a teaching sequence for a teacher : a first page presenting the sequence, then one page
13
+ * per lesson. The pages are sent back like the ones of a wiki.
14
+ */
15
+ createSequence(request: SequenceRequest): Promise<JobAccepted>;
11
16
  /**
12
17
  * Starts the generation of a wiki from a description of its subject.
13
18
  */
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/nats/client.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAElE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAE3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAElE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAEpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAGnE,qBACa,uBAAuB;IAItB,OAAO,CAAC,QAAQ,CAAC,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AAC,QAAQ,CAAC,UAAU;IAFvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4C;gBAEtC,UAAU,EAAE,WAAW;IAMpD;;OAEG;IACG,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAgBtE;;;OAGG;IACG,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC;IAgBpE;;OAEG;IACG,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC;IAgB/D;;;OAGG;IACG,aAAa,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,WAAW,CAAC;IAgB3E;;OAEG;IACG,iBAAiB,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAgBxF;;OAEG;IACG,mBAAmB,CAAC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;CAgB5F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/aiwiki-nest-client",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Clients to interact with aiwiki-nats-service",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -28,7 +28,7 @@
28
28
  "dist"
29
29
  ],
30
30
  "dependencies": {
31
- "@edifice.io/aiwiki-nest-api": "0.2.1"
31
+ "@edifice.io/aiwiki-nest-api": "0.2.2"
32
32
  },
33
33
  "devDependencies": {
34
34
  "husky": "9.0.11",