@epam/statgpt-shared-toolkit 0.1.0-rc.2 → 0.1.0-rc.3

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/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u={CHAT:"/api/chat"},g="CUSTOM_PERIOD",o={decimal:"0.0",decimalSymbol:",",digitGroupingSymbol:" "},T="application/json",l="Content-Type",E="Api-Key",d="X-CONVERSATION-ID",S={BAD_REQUEST:400,UNAUTHORIZED:401,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_ALLOWED:405,CONFLICT:409,TOO_MANY_REQUESTS:429,INTERNAL_SERVER_ERROR:500,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504};var O=(e=>(e.MONTH="month",e.DAY="day",e))(O||{}),A=(e=>(e.UK="uk",e.EN="en",e))(A||{}),R=(e=>(e.IN="in",e.BETWEEN="between",e))(R||{});function C(e,t){const n=e.split("/")[0],r=t.split("/").pop();return`${n}/${r}`}const N=e=>(e==null?void 0:e.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,"").replace(/-/g," "))||"";function D(e,t){return`${e==null?void 0:e[0]}/${t}/${e==null?void 0:e[1]}`}const I=(e,t)=>(Math.round(e*10**t)/10**t).toString(),s=(e,t)=>{const n=(t==null?void 0:t.decimal)||o.decimal,r=(t==null?void 0:t.decimalSymbol)||o.decimalSymbol,i=(t==null?void 0:t.digitGroupingSymbol)??o.digitGroupingSymbol,c=Number(e);if(c==null||Number.isNaN(c)||e===null||e==="")return"";const _=n.replace("0.",""),a=`${n==="0"?Math.trunc(c):I(c,_.length)} `.split(".");return a[0]=a[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,`$1${i}`),`${a.join(r)}`},y=e=>isNaN(Date.parse(e))?null:new Date(e),H=(e,t,n)=>{const r={[l]:(t==null?void 0:t.contentType)||T};return t!=null&&t.jwt?r.Authorization=`Bearer ${t.jwt}`:e&&(r[E]=e),t!=null&&t.chatReference&&(r[d]=t.chatReference),{...r,...n}},h=e=>{const t={...e};return t[E]&&(t[E]=t[E].substring(0,8)+"...[REDACTED]"),t.Authorization&&(t.Authorization="Bearer [REDACTED]"),t},p=e=>({"Content-Type":`multipart/form-data; boundary=${e}`}),b=e=>(e==null?void 0:e.toLowerCase())==="true",L=async(e,t,n)=>await fetch(e,{method:n.method||"GET",headers:t,body:n.body?JSON.stringify(n.body):void 0}),B=(e,t)=>{var n,r;return(r=(n=e==null?void 0:e.split("/"))==null?void 0:n.filter(i=>i!==t))==null?void 0:r.join("/")};exports.API_KEY_HEADER=E;exports.API_ROUTES=u;exports.APPLICATION_JSON=T;exports.CONTENT_TYPE_HEADER=l;exports.CUSTOM_PERIOD=g;exports.CalendarResolution=O;exports.HTTP_ERROR_CODES=S;exports.Locale=A;exports.QueryFilterType=R;exports.X_CONVERSATION_ID_HEADER=d;exports.defaultFormatNumbers=o;exports.formatNumberBySign=s;exports.getClearedConversationName=N;exports.getConversationId=D;exports.getConversationNavPath=C;exports.getConversationUrlWithoutLocale=B;exports.getHeaders=H;exports.getMultipartHeaders=p;exports.getTimePeriod=y;exports.parseBoolean=b;exports.sanitizeHeaders=h;exports.sendRequest=L;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u={CHAT:"/api/chat"},C="CUSTOM_PERIOD",c={decimal:"0.0",decimalSymbol:",",digitGroupingSymbol:" "},l="application/json",T="Content-Type",E="Api-Key",d="X-CONVERSATION-ID",g={BAD_REQUEST:400,UNAUTHORIZED:401,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_ALLOWED:405,CONFLICT:409,TOO_MANY_REQUESTS:429,INTERNAL_SERVER_ERROR:500,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504};var O=(e=>(e.MONTH="month",e.DAY="day",e))(O||{}),A=(e=>(e.UK="uk",e.EN="en",e))(A||{}),R=(e=>(e.IN="in",e.BETWEEN="between",e))(R||{});function N(e,t){const n=e.split("/")[0],r=t.split("/").pop();return`${n}/${r}`}const S=e=>(e==null?void 0:e.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,"").replace(/-/g," "))||"";function s(e,t){return`${e==null?void 0:e[0]}/${t}/${e==null?void 0:e[1]}`}const D=(e,t)=>(Math.round(e*10**t)/10**t).toString(),I=(e,t)=>{const n=(t==null?void 0:t.decimal)||c.decimal,r=(t==null?void 0:t.decimalSymbol)||c.decimalSymbol,o=(t==null?void 0:t.digitGroupingSymbol)??c.digitGroupingSymbol,a=Number(e);if(a==null||Number.isNaN(a)||e===null||e==="")return"";const _=n.replace("0.",""),i=`${n==="0"?Math.trunc(a):D(a,_.length)} `.split(".");return i[0]=i[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,`$1${o}`),`${i.join(r)}`},y=e=>isNaN(Date.parse(e))?null:new Date(e),H=(e,t,n)=>{const r={[T]:(t==null?void 0:t.contentType)||l};return t!=null&&t.jwt?r.Authorization=`Bearer ${t.jwt}`:e&&(r[E]=e),t!=null&&t.chatReference&&(r[d]=t.chatReference),{...r,...n}},h=e=>{const t={...e};return t[E]&&(t[E]=t[E].substring(0,8)+"...[REDACTED]"),t.Authorization&&(t.Authorization="Bearer [REDACTED]"),t},p=e=>({"Content-Type":`multipart/form-data; boundary=${e}`}),b=e=>(e==null?void 0:e.toLowerCase())==="true",L=async(e,t,n)=>await fetch(e,{method:n.method||"GET",headers:t,body:n.body?JSON.stringify(n.body):void 0}),$=(e,t)=>{var n,r;return(r=(n=e==null?void 0:e.split("/"))==null?void 0:n.filter(o=>o!==t))==null?void 0:r.join("/")},B=e=>e.map(t=>({...t,name:t.name.split(/-\d+$/)[0]}));exports.API_KEY_HEADER=E;exports.API_ROUTES=u;exports.APPLICATION_JSON=l;exports.CONTENT_TYPE_HEADER=T;exports.CUSTOM_PERIOD=C;exports.CalendarResolution=O;exports.HTTP_ERROR_CODES=g;exports.Locale=A;exports.QueryFilterType=R;exports.X_CONVERSATION_ID_HEADER=d;exports.cleanConversationNames=B;exports.defaultFormatNumbers=c;exports.formatNumberBySign=I;exports.getClearedConversationName=S;exports.getConversationId=s;exports.getConversationNavPath=N;exports.getConversationUrlWithoutLocale=$;exports.getHeaders=H;exports.getMultipartHeaders=p;exports.getTimePeriod=y;exports.parseBoolean=b;exports.sanitizeHeaders=h;exports.sendRequest=L;
package/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  const g = {
2
2
  CHAT: "/api/chat"
3
- }, D = "CUSTOM_PERIOD", o = {
3
+ }, D = "CUSTOM_PERIOD", l = {
4
4
  decimal: "0.0",
5
5
  decimalSymbol: ",",
6
6
  digitGroupingSymbol: " "
7
- }, A = "application/json", d = "Content-Type", r = "Api-Key", O = "X-CONVERSATION-ID", C = {
7
+ }, d = "application/json", A = "Content-Type", r = "Api-Key", a = "X-CONVERSATION-ID", C = {
8
8
  BAD_REQUEST: 400,
9
9
  UNAUTHORIZED: 401,
10
10
  FORBIDDEN: 403,
@@ -17,30 +17,30 @@ const g = {
17
17
  SERVICE_UNAVAILABLE: 503,
18
18
  GATEWAY_TIMEOUT: 504
19
19
  };
20
- var R = /* @__PURE__ */ ((t) => (t.MONTH = "month", t.DAY = "day", t))(R || {}), S = /* @__PURE__ */ ((t) => (t.UK = "uk", t.EN = "en", t))(S || {}), u = /* @__PURE__ */ ((t) => (t.IN = "in", t.BETWEEN = "between", t))(u || {});
21
- function I(t, e) {
20
+ var O = /* @__PURE__ */ ((t) => (t.MONTH = "month", t.DAY = "day", t))(O || {}), R = /* @__PURE__ */ ((t) => (t.UK = "uk", t.EN = "en", t))(R || {}), S = /* @__PURE__ */ ((t) => (t.IN = "in", t.BETWEEN = "between", t))(S || {});
21
+ function N(t, e) {
22
22
  const n = t.split("/")[0], c = e.split("/").pop();
23
23
  return `${n}/${c}`;
24
24
  }
25
- const N = (t) => (t == null ? void 0 : t.toLowerCase().replace(/[^\p{L}\p{N}]+/gu, "-").replace(/^-+|-+$/g, "").replace(/-/g, " ")) || "";
25
+ const I = (t) => (t == null ? void 0 : t.toLowerCase().replace(/[^\p{L}\p{N}]+/gu, "-").replace(/^-+|-+$/g, "").replace(/-/g, " ")) || "";
26
26
  function y(t, e) {
27
27
  return `${t == null ? void 0 : t[0]}/${e}/${t == null ? void 0 : t[1]}`;
28
28
  }
29
- const _ = (t, e) => (Math.round(t * 10 ** e) / 10 ** e).toString(), h = (t, e) => {
30
- const n = (e == null ? void 0 : e.decimal) || o.decimal, c = (e == null ? void 0 : e.decimalSymbol) || o.decimalSymbol, i = (e == null ? void 0 : e.digitGroupingSymbol) ?? o.digitGroupingSymbol, E = Number(t);
29
+ const u = (t, e) => (Math.round(t * 10 ** e) / 10 ** e).toString(), h = (t, e) => {
30
+ const n = (e == null ? void 0 : e.decimal) || l.decimal, c = (e == null ? void 0 : e.decimalSymbol) || l.decimalSymbol, i = (e == null ? void 0 : e.digitGroupingSymbol) ?? l.digitGroupingSymbol, E = Number(t);
31
31
  if (E == null || Number.isNaN(E) || t === null || t === "")
32
32
  return "";
33
- const l = n.replace("0.", ""), T = `${n === "0" ? Math.trunc(E) : _(E, l.length)} `.split(".");
33
+ const o = n.replace("0.", ""), T = `${n === "0" ? Math.trunc(E) : u(E, o.length)} `.split(".");
34
34
  return T[0] = T[0].replace(
35
35
  /(\d)(?=(\d\d\d)+(?!\d))/g,
36
36
  `$1${i}`
37
37
  ), `${T.join(c)}`;
38
- }, $ = (t) => isNaN(Date.parse(t)) ? null : new Date(t), p = (t, e, n) => {
38
+ }, s = (t) => isNaN(Date.parse(t)) ? null : new Date(t), p = (t, e, n) => {
39
39
  const c = {
40
- [d]: (e == null ? void 0 : e.contentType) || A
40
+ [A]: (e == null ? void 0 : e.contentType) || d
41
41
  };
42
- return e != null && e.jwt ? c.Authorization = `Bearer ${e.jwt}` : t && (c[r] = t), e != null && e.chatReference && (c[O] = e.chatReference), { ...c, ...n };
43
- }, s = (t) => {
42
+ return e != null && e.jwt ? c.Authorization = `Bearer ${e.jwt}` : t && (c[r] = t), e != null && e.chatReference && (c[a] = e.chatReference), { ...c, ...n };
43
+ }, $ = (t) => {
44
44
  const e = { ...t };
45
45
  return e[r] && (e[r] = e[r].substring(0, 8) + "...[REDACTED]"), e.Authorization && (e.Authorization = "Bearer [REDACTED]"), e;
46
46
  }, H = (t) => ({
@@ -52,28 +52,32 @@ const _ = (t, e) => (Math.round(t * 10 ** e) / 10 ** e).toString(), h = (t, e) =
52
52
  }), b = (t, e) => {
53
53
  var n, c;
54
54
  return (c = (n = t == null ? void 0 : t.split("/")) == null ? void 0 : n.filter((i) => i !== e)) == null ? void 0 : c.join("/");
55
- };
55
+ }, M = (t) => t.map((e) => ({
56
+ ...e,
57
+ name: e.name.split(/-\d+$/)[0]
58
+ }));
56
59
  export {
57
60
  r as API_KEY_HEADER,
58
61
  g as API_ROUTES,
59
- A as APPLICATION_JSON,
60
- d as CONTENT_TYPE_HEADER,
62
+ d as APPLICATION_JSON,
63
+ A as CONTENT_TYPE_HEADER,
61
64
  D as CUSTOM_PERIOD,
62
- R as CalendarResolution,
65
+ O as CalendarResolution,
63
66
  C as HTTP_ERROR_CODES,
64
- S as Locale,
65
- u as QueryFilterType,
66
- O as X_CONVERSATION_ID_HEADER,
67
- o as defaultFormatNumbers,
67
+ R as Locale,
68
+ S as QueryFilterType,
69
+ a as X_CONVERSATION_ID_HEADER,
70
+ M as cleanConversationNames,
71
+ l as defaultFormatNumbers,
68
72
  h as formatNumberBySign,
69
- N as getClearedConversationName,
73
+ I as getClearedConversationName,
70
74
  y as getConversationId,
71
- I as getConversationNavPath,
75
+ N as getConversationNavPath,
72
76
  b as getConversationUrlWithoutLocale,
73
77
  p as getHeaders,
74
78
  H as getMultipartHeaders,
75
- $ as getTimePeriod,
79
+ s as getTimePeriod,
76
80
  B as parseBoolean,
77
- s as sanitizeHeaders,
81
+ $ as sanitizeHeaders,
78
82
  L as sendRequest
79
83
  };
package/models/index.d.ts CHANGED
@@ -5,3 +5,5 @@ export * from './format-numbers-type';
5
5
  export * from './log-data';
6
6
  export * from './request-options';
7
7
  export * from './time-range';
8
+ export * from './onboarding-schema';
9
+ export * from './format-numbers-type';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epam/statgpt-shared-toolkit",
3
- "version": "0.1.0-rc.2",
3
+ "version": "0.1.0-rc.3",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": {
package/utils/index.d.ts CHANGED
@@ -7,3 +7,5 @@ export * from './headers';
7
7
  export * from './parse-boolean';
8
8
  export * from './send-request';
9
9
  export * from './conversation-url';
10
+ export * from './conversation-mapping';
11
+ export * from './format-numbers';