@applica-software-guru/persona-sdk 0.1.27 → 0.1.29

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/bundle.es.js CHANGED
@@ -1,11 +1,11 @@
1
1
  var d = Object.defineProperty;
2
2
  var g = (o, t, s) => t in o ? d(o, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : o[t] = s;
3
- var c = (o, t, s) => g(o, typeof t != "symbol" ? t + "" : t, s);
3
+ var u = (o, t, s) => g(o, typeof t != "symbol" ? t + "" : t, s);
4
4
  class p extends Error {
5
5
  constructor(s, e) {
6
6
  super(`API Error: ${s} - ${e}`);
7
- c(this, "statusCode");
8
- c(this, "body");
7
+ u(this, "statusCode");
8
+ u(this, "body");
9
9
  this.statusCode = s, this.body = e;
10
10
  }
11
11
  }
@@ -20,10 +20,10 @@ class y {
20
20
  return this.apiKey;
21
21
  }
22
22
  }
23
- class u {
23
+ class c {
24
24
  constructor(t, s) {
25
- c(this, "baseUrl");
26
- c(this, "authProvider");
25
+ u(this, "baseUrl");
26
+ u(this, "authProvider");
27
27
  this.baseUrl = t, this.authProvider = typeof s == "string" ? new y(s) : s;
28
28
  }
29
29
  getBaseUrl() {
@@ -44,8 +44,8 @@ class u {
44
44
  }
45
45
  buildUrl(t, s) {
46
46
  const e = new URL(this.baseUrl + t);
47
- return s && Object.entries(s).forEach(([r, i]) => {
48
- i != null && e.searchParams.set(r, String(i));
47
+ return s && Object.entries(s).forEach(([r, n]) => {
48
+ n != null && e.searchParams.set(r, String(n));
49
49
  }), e.toString();
50
50
  }
51
51
  async handleResponse(t) {
@@ -98,15 +98,15 @@ class u {
98
98
  }
99
99
  }
100
100
  }
101
- class m extends u {
101
+ class m extends c {
102
102
  constructor(s, e, r) {
103
103
  super(s, e);
104
- c(this, "billingBaseUrl");
104
+ u(this, "billingBaseUrl");
105
105
  this.billingBaseUrl = (r || s).replace(/\/$/, "");
106
106
  }
107
107
  async list(s, e, r) {
108
- const { page: i, size: n } = this.normalizePageParams(e, r), a = { page: i, size: n };
109
- return s && (a.keyword = s), this.httpGet("/projects", a);
108
+ const { page: n, size: a } = this.normalizePageParams(e, r), i = { page: n, size: a };
109
+ return s && (i.keyword = s), this.httpGet("/projects", i);
110
110
  }
111
111
  async get(s) {
112
112
  return this.httpGet("/projects/" + s);
@@ -139,28 +139,28 @@ class m extends u {
139
139
  return this.billingRequest("/projects/" + s + "/subscription/actions/set-infinite-credits", "POST", e);
140
140
  }
141
141
  async billingRequest(s, e, r) {
142
- const i = new Headers();
143
- i.set("Content-Type", "application/json"), this.getAuthProvider().applyHeaders(i);
144
- const n = await fetch(this.billingBaseUrl + s, {
142
+ const n = new Headers();
143
+ n.set("Content-Type", "application/json"), this.getAuthProvider().applyHeaders(n);
144
+ const a = await fetch(this.billingBaseUrl + s, {
145
145
  method: e,
146
- headers: i,
146
+ headers: n,
147
147
  body: r ? JSON.stringify(r) : void 0
148
148
  });
149
- if (!n.ok) {
150
- const l = await n.text();
151
- throw new p(n.status, l);
149
+ if (!a.ok) {
150
+ const l = await a.text();
151
+ throw new p(a.status, l);
152
152
  }
153
- const a = await n.text();
154
- return a ? JSON.parse(a) : void 0;
153
+ const i = await a.text();
154
+ return i ? JSON.parse(i) : void 0;
155
155
  }
156
156
  }
157
- class P extends u {
157
+ class w extends c {
158
158
  constructor(t, s) {
159
159
  super(t, s);
160
160
  }
161
161
  async list(t, s, e, r) {
162
- const { page: i, size: n } = this.normalizePageParams(s, e), a = { page: i, size: n, ...r };
163
- return t && (a.keyword = t), this.httpGet("/agents", a);
162
+ const { page: n, size: a } = this.normalizePageParams(s, e), i = { page: n, size: a, ...r };
163
+ return t && (i.keyword = t), this.httpGet("/agents", i);
164
164
  }
165
165
  async get(t) {
166
166
  return this.httpGet("/agents/" + t);
@@ -194,15 +194,15 @@ class P extends u {
194
194
  return this.httpGet("/agents/architect");
195
195
  }
196
196
  }
197
- class w extends u {
197
+ class P extends c {
198
198
  constructor(s, e, r) {
199
199
  super(s, e);
200
- c(this, "knowledgeBaseId");
200
+ u(this, "knowledgeBaseId");
201
201
  this.knowledgeBaseId = r;
202
202
  }
203
203
  async list(s, e, r) {
204
- const { page: i, size: n } = this.normalizePageParams(e, r), a = { page: i, size: n };
205
- return s && (a.keyword = s), this.httpGet("/knowledge-bases/" + this.knowledgeBaseId + "/documents", a);
204
+ const { page: n, size: a } = this.normalizePageParams(e, r), i = { page: n, size: a };
205
+ return s && (i.keyword = s), this.httpGet("/knowledge-bases/" + this.knowledgeBaseId + "/documents", i);
206
206
  }
207
207
  async upload(s) {
208
208
  return this.httpPost("/knowledge-bases/" + this.knowledgeBaseId + "/documents", s);
@@ -217,13 +217,13 @@ class w extends u {
217
217
  await this.httpDelete("/knowledge-bases/" + this.knowledgeBaseId + "/documents/" + s);
218
218
  }
219
219
  }
220
- class b extends u {
220
+ class b extends c {
221
221
  constructor(t, s) {
222
222
  super(t, s);
223
223
  }
224
224
  async list(t, s, e, r) {
225
- const { page: i, size: n } = this.normalizePageParams(s, e), a = { page: i, size: n, ...r };
226
- return t && (a.keyword = t), this.httpGet("/knowledge-bases", a);
225
+ const { page: n, size: a } = this.normalizePageParams(s, e), i = { page: n, size: a, ...r };
226
+ return t && (i.keyword = t), this.httpGet("/knowledge-bases", i);
227
227
  }
228
228
  async get(t) {
229
229
  return this.httpGet("/knowledge-bases/" + t);
@@ -238,19 +238,19 @@ class b extends u {
238
238
  await this.httpDelete("/knowledge-bases/" + t);
239
239
  }
240
240
  documents(t) {
241
- return new w(this.getBaseUrl(), this.getAuthProvider(), t);
241
+ return new P(this.getBaseUrl(), this.getAuthProvider(), t);
242
242
  }
243
243
  async searchChunks(t, s) {
244
244
  return this.httpPost("/knowledge-bases/" + t + "/search", s);
245
245
  }
246
246
  }
247
- class v extends u {
247
+ class v extends c {
248
248
  constructor(t, s) {
249
249
  super(t, s);
250
250
  }
251
251
  async list(t, s, e) {
252
- const { page: r, size: i } = this.normalizePageParams(s, e), n = { page: r, size: i };
253
- return this.httpGet("/workflows/" + t + "/executions", n);
252
+ const { page: r, size: n } = this.normalizePageParams(s, e), a = { page: r, size: n };
253
+ return this.httpGet("/workflows/" + t + "/executions", a);
254
254
  }
255
255
  async get(t, s) {
256
256
  return this.httpGet("/workflows/" + t + "/executions/" + s);
@@ -262,13 +262,13 @@ class v extends u {
262
262
  return this.httpPost("/workflows/" + t + "/executions/queue", s);
263
263
  }
264
264
  }
265
- class f extends u {
265
+ class f extends c {
266
266
  constructor(t, s) {
267
267
  super(t, s);
268
268
  }
269
269
  async list(t, s, e, r) {
270
- const { page: i, size: n } = this.normalizePageParams(s, e), a = { page: i, size: n, ...r };
271
- return t && (a.keyword = t), this.httpGet("/workflows", a);
270
+ const { page: n, size: a } = this.normalizePageParams(s, e), i = { page: n, size: a, ...r };
271
+ return t && (i.keyword = t), this.httpGet("/workflows", i);
272
272
  }
273
273
  async create(t) {
274
274
  return this.httpPost("/workflows", t);
@@ -295,7 +295,7 @@ class f extends u {
295
295
  return this.httpPost("/workflows/" + t + "/revisions/" + s + "/rollback", {});
296
296
  }
297
297
  }
298
- class G extends u {
298
+ class G extends c {
299
299
  constructor(t, s) {
300
300
  super(t, s);
301
301
  }
@@ -303,8 +303,8 @@ class G extends u {
303
303
  return this.httpPost("/credentials/" + t + "/authorize", s);
304
304
  }
305
305
  async handleOAuth2Callback(t, s, e, r) {
306
- const i = { code: s, state: e };
307
- return r && (i.scope = r), this.httpGet("/credentials/" + t + "/oauth2/callback", i);
306
+ const n = { code: s, state: e };
307
+ return r && (n.scope = r), this.httpGet("/credentials/" + t + "/oauth2/callback", n);
308
308
  }
309
309
  async list() {
310
310
  return this.httpGet("/credentials");
@@ -319,13 +319,13 @@ class G extends u {
319
319
  await this.httpDelete("/credentials/all/" + t);
320
320
  }
321
321
  }
322
- class k extends u {
322
+ class k extends c {
323
323
  constructor(t, s) {
324
324
  super(t, s);
325
325
  }
326
326
  async list(t, s, e, r) {
327
- const { page: i, size: n } = this.normalizePageParams(s, e), a = { page: i, size: n, ...r };
328
- return t && (a.keyword = t), this.httpGet("/features/templates", a);
327
+ const { page: n, size: a } = this.normalizePageParams(s, e), i = { page: n, size: a, ...r };
328
+ return t && (i.keyword = t), this.httpGet("/features/templates", i);
329
329
  }
330
330
  async get(t) {
331
331
  return this.httpGet("/features/templates/" + t);
@@ -349,21 +349,21 @@ class k extends u {
349
349
  }
350
350
  class z {
351
351
  constructor(t, s) {
352
- c(this, "baseUrl");
353
- c(this, "auth");
352
+ u(this, "baseUrl");
353
+ u(this, "auth");
354
354
  this.baseUrl = t, this.auth = s;
355
355
  }
356
356
  templates() {
357
357
  return new k(this.baseUrl, this.auth);
358
358
  }
359
359
  }
360
- class x extends u {
360
+ class x extends c {
361
361
  constructor(t, s) {
362
362
  super(t, s);
363
363
  }
364
364
  async list(t, s, e) {
365
- const { page: r, size: i } = this.normalizePageParams(s, e), n = { page: r, size: i };
366
- return this.httpGet("/triggers/" + t + "/executions", n);
365
+ const { page: r, size: n } = this.normalizePageParams(s, e), a = { page: r, size: n };
366
+ return this.httpGet("/triggers/" + t + "/executions", a);
367
367
  }
368
368
  async execute(t, s) {
369
369
  return this.httpPost("/triggers/" + t + "/executions", s);
@@ -375,13 +375,13 @@ class x extends u {
375
375
  await this.httpDelete("/triggers/executions/" + t);
376
376
  }
377
377
  }
378
- class U extends u {
378
+ class U extends c {
379
379
  constructor(t, s) {
380
380
  super(t, s);
381
381
  }
382
382
  async list(t, s, e, r) {
383
- const { page: i, size: n } = this.normalizePageParams(s, e), a = { page: i, size: n, ...r };
384
- return t && (a.keyword = t), this.httpGet("/triggers", a);
383
+ const { page: n, size: a } = this.normalizePageParams(s, e), i = { page: n, size: a, ...r };
384
+ return t && (i.keyword = t), this.httpGet("/triggers", i);
385
385
  }
386
386
  async create(t) {
387
387
  return this.httpPost("/triggers", t);
@@ -399,13 +399,13 @@ class U extends u {
399
399
  return new x(this.getBaseUrl(), this.getAuthProvider());
400
400
  }
401
401
  }
402
- class S extends u {
402
+ class S extends c {
403
403
  constructor(t, s) {
404
404
  super(t, s);
405
405
  }
406
406
  async list(t, s, e, r) {
407
- const { page: i, size: n } = this.normalizePageParams(s, e), a = { page: i, size: n, ...r };
408
- return t && (a.keyword = t), this.httpGet("/service-prices", a);
407
+ const { page: n, size: a } = this.normalizePageParams(s, e), i = { page: n, size: a, ...r };
408
+ return t && (i.keyword = t), this.httpGet("/service-prices", i);
409
409
  }
410
410
  async get(t) {
411
411
  return this.httpGet("/service-prices/" + t);
@@ -420,12 +420,33 @@ class S extends u {
420
420
  await this.httpDelete("/service-prices/" + t);
421
421
  }
422
422
  }
423
- class T extends u {
423
+ class T extends c {
424
424
  constructor(t, s) {
425
425
  super(t, s);
426
426
  }
427
- async list(t, s, e, r, i, n) {
428
- const { page: a, size: l } = this.normalizePageParams(i, n), h = { page: a, size: l };
427
+ async list(t, s, e, r) {
428
+ const { page: n, size: a } = this.normalizePageParams(s, e), i = { page: n, size: a, ...r };
429
+ return t && (i.keyword = t), this.httpGet("/known-models", i);
430
+ }
431
+ async get(t) {
432
+ return this.httpGet("/known-models/" + t);
433
+ }
434
+ async create(t) {
435
+ return this.httpPost("/known-models", t);
436
+ }
437
+ async update(t, s) {
438
+ return this.httpPut("/known-models/" + t, s);
439
+ }
440
+ async remove(t) {
441
+ await this.httpDelete("/known-models/" + t);
442
+ }
443
+ }
444
+ class A extends c {
445
+ constructor(t, s) {
446
+ super(t, s);
447
+ }
448
+ async list(t, s, e, r, n, a) {
449
+ const { page: i, size: l } = this.normalizePageParams(n, a), h = { page: i, size: l };
429
450
  return t && (h.keyword = t), s && (h.status = s), e && (h.agentId = e), r && (h.userId = r), this.httpGet("/sessions", h);
430
451
  }
431
452
  async get(t) {
@@ -438,8 +459,8 @@ class T extends u {
438
459
  return this.httpPost("/sessions/" + t + "/messages", s);
439
460
  }
440
461
  async findMessages(t, s, e) {
441
- const { page: r, size: i } = this.normalizePageParams(s, e), n = { page: r, size: i };
442
- return this.httpGet("/sessions/" + t + "/messages", n);
462
+ const { page: r, size: n } = this.normalizePageParams(s, e), a = { page: r, size: n };
463
+ return this.httpGet("/sessions/" + t + "/messages", a);
443
464
  }
444
465
  async remove(t) {
445
466
  await this.httpDelete("/sessions/" + t);
@@ -448,13 +469,13 @@ class T extends u {
448
469
  return this.httpPut("/sessions/" + t + "/name", { name: s });
449
470
  }
450
471
  }
451
- class A extends u {
472
+ class B extends c {
452
473
  constructor(t, s) {
453
474
  super(t, s);
454
475
  }
455
476
  async list(t, s, e, r) {
456
- const { page: i, size: n } = this.normalizePageParams(s, e), a = { page: i, size: n };
457
- return t && (a.keyword = t), r && (a.status = r), this.httpGet("/missions", a);
477
+ const { page: n, size: a } = this.normalizePageParams(s, e), i = { page: n, size: a };
478
+ return t && (i.keyword = t), r && (i.status = r), this.httpGet("/missions", i);
458
479
  }
459
480
  async get(t) {
460
481
  return this.httpGet("/missions/" + t);
@@ -490,10 +511,10 @@ class A extends u {
490
511
  return this.httpPost("/missions/" + t + "/continue");
491
512
  }
492
513
  }
493
- class B {
514
+ class O {
494
515
  constructor(t, s) {
495
- c(this, "baseUrl");
496
- c(this, "authProvider");
516
+ u(this, "baseUrl");
517
+ u(this, "authProvider");
497
518
  this.baseUrl = (t || "https://persona.applica.guru/billing").replace(/\/$/, ""), this.authProvider = s ?? null;
498
519
  }
499
520
  buildHeaders() {
@@ -507,11 +528,11 @@ class B {
507
528
  body: e ? JSON.stringify(e) : void 0
508
529
  });
509
530
  if (!r.ok) {
510
- const n = await r.text();
511
- throw new p(r.status, n);
531
+ const a = await r.text();
532
+ throw new p(r.status, a);
512
533
  }
513
- const i = await r.text();
514
- return i ? JSON.parse(i) : void 0;
534
+ const n = await r.text();
535
+ return n ? JSON.parse(n) : void 0;
515
536
  }
516
537
  async createCustomer(t) {
517
538
  return this.request("/customers", "POST", t);
@@ -556,8 +577,8 @@ class B {
556
577
  return this.request("/customers/" + t + "/subscription/credits", "POST", { credits: s });
557
578
  }
558
579
  async useCredits(t, s, e, r) {
559
- const i = { credits: s, services: e };
560
- return r && (i.referenceId = r), this.request("/customers/" + t + "/subscription/credits", "DELETE", i);
580
+ const n = { credits: s, services: e };
581
+ return r && (n.referenceId = r), this.request("/customers/" + t + "/subscription/credits", "DELETE", n);
561
582
  }
562
583
  async getCredits(t) {
563
584
  try {
@@ -576,14 +597,14 @@ class B {
576
597
  async listInvoices(t, s, e) {
577
598
  const r = [];
578
599
  s && r.push("date_from=" + s), e && r.push("date_to=" + e);
579
- const i = r.length > 0 ? "?" + r.join("&") : "";
580
- return this.request("/customers/" + t + "/invoices" + i, "GET");
600
+ const n = r.length > 0 ? "?" + r.join("&") : "";
601
+ return this.request("/customers/" + t + "/invoices" + n, "GET");
581
602
  }
582
603
  async cancelSubscription(t) {
583
604
  return this.request("/customers/" + t + "/subscription/actions/cancel", "POST", {});
584
605
  }
585
606
  }
586
- class O extends u {
607
+ class j extends c {
587
608
  constructor(t, s) {
588
609
  super(t, s);
589
610
  }
@@ -645,18 +666,18 @@ class O extends u {
645
666
  return this.httpGet("/values/trigger-destination-types");
646
667
  }
647
668
  }
648
- class q {
669
+ class C {
649
670
  constructor(t, s, e) {
650
- c(this, "baseUrl");
651
- c(this, "workflowsBaseUrl");
652
- c(this, "billingBaseUrl");
671
+ u(this, "baseUrl");
672
+ u(this, "workflowsBaseUrl");
673
+ u(this, "billingBaseUrl");
653
674
  this.baseUrl = t, this.workflowsBaseUrl = s, this.billingBaseUrl = e || "https://persona.applica.guru/billing";
654
675
  }
655
676
  projects(t) {
656
677
  return new m(this.baseUrl, t, this.billingBaseUrl);
657
678
  }
658
679
  agents(t) {
659
- return new P(this.baseUrl, t);
680
+ return new w(this.baseUrl, t);
660
681
  }
661
682
  knowledgeBases(t) {
662
683
  return new b(this.baseUrl, t);
@@ -676,20 +697,23 @@ class q {
676
697
  servicePrices(t) {
677
698
  return new S(this.baseUrl, t);
678
699
  }
679
- sessions(t) {
700
+ knownModels(t) {
680
701
  return new T(this.baseUrl, t);
681
702
  }
682
- missions(t) {
703
+ sessions(t) {
683
704
  return new A(this.baseUrl, t);
684
705
  }
706
+ missions(t) {
707
+ return new B(this.baseUrl, t);
708
+ }
685
709
  billing(t) {
686
- return new B(this.billingBaseUrl, t);
710
+ return new O(this.billingBaseUrl, t);
687
711
  }
688
712
  values(t) {
689
- return new O(this.baseUrl, t);
713
+ return new j(this.baseUrl, t);
690
714
  }
691
715
  }
692
- class C {
716
+ class E {
693
717
  constructor(t) {
694
718
  this.token = t;
695
719
  }
@@ -701,24 +725,25 @@ class C {
701
725
  }
702
726
  }
703
727
  export {
704
- P as AgentsApi,
728
+ w as AgentsApi,
705
729
  p as ApiException,
706
730
  y as ApiKeyAuthenticationProvider,
707
- C as BearerTokenAuthenticationProvider,
708
- B as BillingClient,
731
+ E as BearerTokenAuthenticationProvider,
732
+ O as BillingClient,
709
733
  G as CredentialsApi,
710
734
  k as FeatureTemplatesApi,
711
735
  z as FeaturesApi,
712
- w as KnowledgeBaseDocumentsApi,
736
+ P as KnowledgeBaseDocumentsApi,
713
737
  b as KnowledgeBasesApi,
714
- A as MissionsApi,
715
- q as PersonaSdk,
738
+ T as KnownModelsApi,
739
+ B as MissionsApi,
740
+ C as PersonaSdk,
716
741
  m as ProjectsApi,
717
742
  S as ServicePricesApi,
718
- T as SessionsApi,
743
+ A as SessionsApi,
719
744
  x as TriggerExecutionsApi,
720
745
  U as TriggersApi,
721
- O as ValuesApi,
746
+ j as ValuesApi,
722
747
  v as WorkflowExecutionsApi,
723
748
  f as WorkflowsApi
724
749
  };