@epam/statgpt-shared-toolkit 0.4.0-rc.9 → 0.5.0-rc.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.
@@ -3,3 +3,4 @@ export declare const CONTENT_TYPE_HEADER = "Content-Type";
3
3
  export declare const API_KEY_HEADER = "Api-Key";
4
4
  export declare const X_CONVERSATION_ID_HEADER = "X-CONVERSATION-ID";
5
5
  export declare const OCP_APIM_SUBSCRIPTION_KEY_HEADER = "Ocp-Apim-Subscription-Key";
6
+ export declare const X_SOURCE_ARTEFACT_URN_HEADER = "X-Source-Artefact-Urn";
package/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("date-fns"),R={CHAT:"/api/chat"},f="CUSTOM_PERIOD",l={decimal:"0.0",decimalSymbol:",",digitGroupingSymbol:" "},A="application/json",T="Content-Type",a="Api-Key",N="X-CONVERSATION-ID",u="Ocp-Apim-Subscription-Key",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},v="onboarding",y="share";class D extends Error{constructor(e){super(e.message),this.isHttpError=!0,this.name="HttpError",this.code=e.code,this.status=e.status,this.details=e.details,this.displayMessage=e.displayMessage}}function U(t){const e=t;return typeof t=="object"&&t!==null&&e.isHttpError===!0&&typeof e.status=="number"&&typeof e.message=="string"&&(e.code===void 0||typeof e.code=="string")}var g=(t=>(t.MONTH="month",t.DAY="day",t))(g||{}),C=(t=>(t.UK="uk",t.EN="en",t))(C||{}),_=(t=>(t.IN="in",t.BETWEEN="between",t))(_||{});function b(t,e){const n=t.split("/")[0],r=e.split("/").pop();return`${n}/${r}`}const O=t=>t.messages.flatMap(e=>{const n=e.custom_content?.attachments??[],r=e.custom_content?.stages?.flatMap(({attachments:s})=>s??[])??[];return[...n,...r]}),P=t=>t.endsWith("/"),H=t=>{const e=t.toLowerCase();return e.startsWith("http://")||e.startsWith("https://")},h=t=>!!t&&!H(t)&&!P(t),M=t=>[...new Set(O(t).map(e=>e.url).filter(e=>!!e).filter(e=>h(e)))],p=(t,e)=>t?.map(n=>({...n,url:n.url?e[n.url]??n.url:n.url})),F=(t,e)=>({...t,messages:t.messages.map(n=>({...n,custom_content:n.custom_content?{...n.custom_content,attachments:p(n.custom_content.attachments,e),stages:n.custom_content.stages?.map(r=>({...r,attachments:p(r.attachments,e)}))}:n.custom_content}))}),E=t=>t?.split(/-\d+$/)[0]??"",B=t=>t?.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,"").replace(/-/g," ")||"";function L(t,e){return`${t?.[0]}/${e}/${t?.[1]}`}const x=(t,e)=>(Math.round(t*10**e)/10**e).toString(),$=(t,e)=>{const n=e?.decimal||l.decimal,r=e?.decimalSymbol||l.decimalSymbol,s=e?.digitGroupingSymbol??l.digitGroupingSymbol,o=Number(t);if(o==null||Number.isNaN(o)||t===null||t==="")return"";const i=n.replace("0.",""),m=`${n==="0"?Math.trunc(o):x(o,i.length)} `.split(".");return m[0]=m[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,`$1${s}`),`${m.join(r)}`},w=t=>{if(!t.includes("T")){for(const n of G){const r=c.parse(t,n,new Date);if(c.isValid(r))return r}return null}const e=c.parseISO(t);return c.isValid(e)?e:null},G=["yyyy-MM-dd","MM-dd-yyyy"],V=(t,e,n)=>{const r={};return e?.contentType!==null&&(r[T]=e?.contentType||A),e?.jwt?r.Authorization=`Bearer ${e.jwt}`:t&&(r[a]=t),e?.chatReference&&(r[N]=e.chatReference),{...r,...n}},Y=t=>{const e={...t};return e[a]&&(e[a]=e[a].substring(0,8)+"...[REDACTED]"),e.Authorization&&(e.Authorization="Bearer [REDACTED]"),e[u]&&(e[u]=e[u].substring(0,8)+"...[REDACTED]"),e},W=t=>({"Content-Type":`multipart/form-data; boundary=${t}`}),j=t=>t?.toLowerCase()==="true",z=async(t,e,n)=>await fetch(t,{method:n.method||"GET",headers:e,body:n.body?JSON.stringify(n.body):void 0}),K=(t,e)=>t?.split("/")?.filter(n=>n!==e)?.join("/"),k=t=>t.replace(/^conversations\//,""),X=t=>t.split("/").slice(0,-1).join("/"),q=t=>E(decodeURIComponent(t.split("/").at(-1)??"")),J=t=>t.map(e=>({...e,name:E(e.name)})),Q=new Set([")","]","}",">",",",".","!","?",":",";"]);function I(t){let e=t.length;for(;e>0&&Q.has(t[e-1]);)e--;return e===t.length?{cleanUrl:t,trailing:""}:{cleanUrl:t.slice(0,e),trailing:t.slice(e)}}function Z(t){if(!t)return[{type:"text",value:""}];const e=[];let n=0;for(const r of t.matchAll(/\bhttps?:\/\/[^\s<>"']+/gi)){const s=r[0],o=r.index??0;o>n&&e.push({type:"text",value:t.slice(n,o)});const{cleanUrl:i,trailing:d}=I(s);i?e.push({type:"link",value:i}):e.push({type:"text",value:s}),d&&e.push({type:"text",value:d}),n=o+s.length}return n<t.length&&e.push({type:"text",value:t.slice(n)}),e.length?e:[{type:"text",value:t}]}exports.API_KEY_HEADER=a;exports.API_ROUTES=R;exports.APPLICATION_JSON=A;exports.CONTENT_TYPE_HEADER=T;exports.CUSTOM_PERIOD=f;exports.CalendarResolution=g;exports.HTTP_ERROR_CODES=S;exports.HttpError=D;exports.Locale=C;exports.OCP_APIM_SUBSCRIPTION_KEY_HEADER=u;exports.ONBOARDING_MODEL_POSTFIX=v;exports.QueryFilterType=_;exports.SHARE_CONVERSATION_ROUTE=y;exports.X_CONVERSATION_ID_HEADER=N;exports.cleanConversationNames=J;exports.defaultFormatNumbers=l;exports.deleteConversationNamePostfix=E;exports.formatNumberBySign=$;exports.getClearedConversationName=B;exports.getConversationAttachmentUrls=M;exports.getConversationAttachments=O;exports.getConversationFolderIdFromConversationId=X;exports.getConversationId=L;exports.getConversationIdFromResourceUrl=k;exports.getConversationNameFromConversationId=q;exports.getConversationNavPath=b;exports.getConversationUrlWithoutLocale=K;exports.getHeaders=V;exports.getMultipartHeaders=W;exports.getTimePeriod=w;exports.isDialFileAttachmentUrl=h;exports.isHttpError=U;exports.linkifyText=Z;exports.parseBoolean=j;exports.replaceConversationAttachmentUrls=F;exports.sanitizeHeaders=Y;exports.sendRequest=z;exports.splitTrailingPunctuation=I;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("date-fns"),f={CHAT:"/api/chat"},I="CUSTOM_PERIOD",l={decimal:"0.0",decimalSymbol:",",digitGroupingSymbol:" "},_="application/json",T="Content-Type",a="Api-Key",p="X-CONVERSATION-ID",u="Ocp-Apim-Subscription-Key",S="X-Source-Artefact-Urn",D={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},y="onboarding",v="share";class U extends Error{constructor(e){super(e.message),this.isHttpError=!0,this.name="HttpError",this.code=e.code,this.status=e.status,this.details=e.details,this.displayMessage=e.displayMessage}}function b(t){const e=t;return typeof t=="object"&&t!==null&&e.isHttpError===!0&&typeof e.status=="number"&&typeof e.message=="string"&&(e.code===void 0||typeof e.code=="string")}var C=(t=>(t.MONTH="month",t.DAY="day",t))(C||{}),N=(t=>(t.UK="uk",t.EN="en",t))(N||{}),O=(t=>(t.IN="in",t.BETWEEN="between",t))(O||{});function H(t,e){const n=t.split("/")[0],r=e.split("/").pop();return`${n}/${r}`}const R=t=>t.messages.flatMap(e=>{const n=e.custom_content?.attachments??[],r=e.custom_content?.stages?.flatMap(({attachments:o})=>o??[])??[];return[...n,...r]}),P=t=>t.endsWith("/"),M=t=>{const e=t.toLowerCase();return e.startsWith("http://")||e.startsWith("https://")},g=t=>!!t&&!M(t)&&!P(t),F=t=>[...new Set(R(t).map(e=>e.url).filter(e=>!!e).filter(e=>g(e)))],A=(t,e)=>t?.map(n=>({...n,url:n.url?e[n.url]??n.url:n.url})),B=(t,e)=>({...t,messages:t.messages.map(n=>({...n,custom_content:n.custom_content?{...n.custom_content,attachments:A(n.custom_content.attachments,e),stages:n.custom_content.stages?.map(r=>({...r,attachments:A(r.attachments,e)}))}:n.custom_content}))}),m=t=>t?.split(/-\d+$/)[0]??"",L=t=>new RegExp("\\p{L}","u").test(t)||new RegExp("\\p{N}","u").test(t),w=t=>{if(!t)return"";const e=t.toLowerCase(),n=[];let r="";for(const o of e)L(o)?r+=o:r&&(n.push(r),r="");return r&&n.push(r),n.join(" ")};function x(t,e){return`${t?.[0]}/${e}/${t?.[1]}`}const $=(t,e)=>(Math.round(t*10**e)/10**e).toString(),G=(t,e)=>{const n=e?.decimal||l.decimal,r=e?.decimalSymbol||l.decimalSymbol,o=e?.digitGroupingSymbol??l.digitGroupingSymbol,s=Number(t);if(s==null||Number.isNaN(s)||t===null||t==="")return"";const i=n.replace("0.",""),d=`${n==="0"?Math.trunc(s):$(s,i.length)} `.split(".");return d[0]=d[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,`$1${o}`),`${d.join(r)}`},V=t=>{if(!t.includes("T")){for(const n of Y){const r=c.parse(t,n,new Date);if(c.isValid(r))return r}return null}const e=c.parseISO(t);return c.isValid(e)?e:null},Y=["yyyy-MM-dd","MM-dd-yyyy"],j=(t,e,n)=>{const r={};return e?.contentType!==null&&(r[T]=e?.contentType||_),e?.jwt?r.Authorization=`Bearer ${e.jwt}`:t&&(r[a]=t),e?.chatReference&&(r[p]=e.chatReference),{...r,...n}},W=t=>{const e={...t};return e[a]&&(e[a]=e[a].substring(0,8)+"...[REDACTED]"),e.Authorization&&(e.Authorization="Bearer [REDACTED]"),e[u]&&(e[u]=e[u].substring(0,8)+"...[REDACTED]"),e},X=t=>({"Content-Type":`multipart/form-data; boundary=${t}`}),z=t=>t?.toLowerCase()==="true",K=async(t,e,n)=>await fetch(t,{method:n.method||"GET",headers:e,body:n.body?JSON.stringify(n.body):void 0}),k=(t,e)=>t?.split("/")?.filter(n=>n!==e)?.join("/"),q=t=>t.replace(/^conversations\//,""),J=t=>t.split("/").slice(0,-1).join("/"),Q=t=>m(decodeURIComponent(t.split("/").at(-1)??"")),Z=t=>t.map(e=>({...e,name:m(e.name)})),tt=new Set([")","]","}",">",",",".","!","?",":",";"]);function h(t){let e=t.length;for(;e>0&&tt.has(t[e-1]);)e--;return e===t.length?{cleanUrl:t,trailing:""}:{cleanUrl:t.slice(0,e),trailing:t.slice(e)}}function et(t){if(!t)return[{type:"text",value:""}];const e=[];let n=0;for(const r of t.matchAll(/\bhttps?:\/\/[^\s<>"']+/gi)){const o=r[0],s=r.index??0;s>n&&e.push({type:"text",value:t.slice(n,s)});const{cleanUrl:i,trailing:E}=h(o);i?e.push({type:"link",value:i}):e.push({type:"text",value:o}),E&&e.push({type:"text",value:E}),n=s+o.length}return n<t.length&&e.push({type:"text",value:t.slice(n)}),e.length?e:[{type:"text",value:t}]}exports.API_KEY_HEADER=a;exports.API_ROUTES=f;exports.APPLICATION_JSON=_;exports.CONTENT_TYPE_HEADER=T;exports.CUSTOM_PERIOD=I;exports.CalendarResolution=C;exports.HTTP_ERROR_CODES=D;exports.HttpError=U;exports.Locale=N;exports.OCP_APIM_SUBSCRIPTION_KEY_HEADER=u;exports.ONBOARDING_MODEL_POSTFIX=y;exports.QueryFilterType=O;exports.SHARE_CONVERSATION_ROUTE=v;exports.X_CONVERSATION_ID_HEADER=p;exports.X_SOURCE_ARTEFACT_URN_HEADER=S;exports.cleanConversationNames=Z;exports.defaultFormatNumbers=l;exports.deleteConversationNamePostfix=m;exports.formatNumberBySign=G;exports.getClearedConversationName=w;exports.getConversationAttachmentUrls=F;exports.getConversationAttachments=R;exports.getConversationFolderIdFromConversationId=J;exports.getConversationId=x;exports.getConversationIdFromResourceUrl=q;exports.getConversationNameFromConversationId=Q;exports.getConversationNavPath=H;exports.getConversationUrlWithoutLocale=k;exports.getHeaders=j;exports.getMultipartHeaders=X;exports.getTimePeriod=V;exports.isDialFileAttachmentUrl=g;exports.isHttpError=b;exports.linkifyText=et;exports.parseBoolean=z;exports.replaceConversationAttachmentUrls=B;exports.sanitizeHeaders=W;exports.sendRequest=K;exports.splitTrailingPunctuation=h;
package/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
- import { parse as h, isValid as d, parseISO as A } from "date-fns";
1
+ import { parse as h, isValid as m, parseISO as f } from "date-fns";
2
2
  const M = {
3
3
  CHAT: "/api/chat"
4
- }, H = "CUSTOM_PERIOD", u = {
4
+ }, w = "CUSTOM_PERIOD", u = {
5
5
  decimal: "0.0",
6
6
  decimalSymbol: ",",
7
7
  digitGroupingSymbol: " "
8
- }, T = "application/json", f = "Content-Type", a = "Api-Key", g = "X-CONVERSATION-ID", m = "Ocp-Apim-Subscription-Key", x = {
8
+ }, A = "application/json", T = "Content-Type", i = "Api-Key", N = "X-CONVERSATION-ID", d = "Ocp-Apim-Subscription-Key", x = "X-Source-Artefact-Urn", B = {
9
9
  BAD_REQUEST: 400,
10
10
  UNAUTHORIZED: 401,
11
11
  FORBIDDEN: 403,
@@ -17,8 +17,8 @@ const M = {
17
17
  BAD_GATEWAY: 502,
18
18
  SERVICE_UNAVAILABLE: 503,
19
19
  GATEWAY_TIMEOUT: 504
20
- }, B = "onboarding", P = "share";
21
- class L extends Error {
20
+ }, L = "onboarding", P = "share";
21
+ class F extends Error {
22
22
  constructor(e) {
23
23
  super(e.message), this.isHttpError = !0, this.name = "HttpError", this.code = e.code, this.status = e.status, this.details = e.details, this.displayMessage = e.displayMessage;
24
24
  }
@@ -27,86 +27,93 @@ function $(t) {
27
27
  const e = t;
28
28
  return typeof t == "object" && t !== null && e.isHttpError === !0 && typeof e.status == "number" && typeof e.message == "string" && (e.code === void 0 || typeof e.code == "string");
29
29
  }
30
- var N = /* @__PURE__ */ ((t) => (t.MONTH = "month", t.DAY = "day", t))(N || {}), _ = /* @__PURE__ */ ((t) => (t.UK = "uk", t.EN = "en", t))(_ || {}), O = /* @__PURE__ */ ((t) => (t.IN = "in", t.BETWEEN = "between", t))(O || {});
31
- function w(t, e) {
30
+ var _ = /* @__PURE__ */ ((t) => (t.MONTH = "month", t.DAY = "day", t))(_ || {}), g = /* @__PURE__ */ ((t) => (t.UK = "uk", t.EN = "en", t))(g || {}), O = /* @__PURE__ */ ((t) => (t.IN = "in", t.BETWEEN = "between", t))(O || {});
31
+ function G(t, e) {
32
32
  const n = t.split("/")[0], r = e.split("/").pop();
33
33
  return `${n}/${r}`;
34
34
  }
35
- const I = (t) => t.messages.flatMap((e) => {
35
+ const R = (t) => t.messages.flatMap((e) => {
36
36
  const n = e.custom_content?.attachments ?? [], r = e.custom_content?.stages?.flatMap(
37
- ({ attachments: s }) => s ?? []
37
+ ({ attachments: o }) => o ?? []
38
38
  ) ?? [];
39
39
  return [...n, ...r];
40
- }), C = (t) => t.endsWith("/"), y = (t) => {
40
+ }), C = (t) => t.endsWith("/"), I = (t) => {
41
41
  const e = t.toLowerCase();
42
42
  return e.startsWith("http://") || e.startsWith("https://");
43
- }, R = (t) => !!t && !y(t) && !C(t), F = (t) => [
43
+ }, y = (t) => !!t && !I(t) && !C(t), j = (t) => [
44
44
  ...new Set(
45
- I(t).map((e) => e.url).filter((e) => !!e).filter((e) => R(e))
45
+ R(t).map((e) => e.url).filter((e) => !!e).filter((e) => y(e))
46
46
  )
47
- ], p = (t, e) => t?.map((n) => ({
47
+ ], E = (t, e) => t?.map((n) => ({
48
48
  ...n,
49
49
  url: n.url ? e[n.url] ?? n.url : n.url
50
- })), G = (t, e) => ({
50
+ })), W = (t, e) => ({
51
51
  ...t,
52
52
  messages: t.messages.map((n) => ({
53
53
  ...n,
54
54
  custom_content: n.custom_content ? {
55
55
  ...n.custom_content,
56
- attachments: p(
56
+ attachments: E(
57
57
  n.custom_content.attachments,
58
58
  e
59
59
  ),
60
60
  stages: n.custom_content.stages?.map((r) => ({
61
61
  ...r,
62
- attachments: p(
62
+ attachments: E(
63
63
  r.attachments,
64
64
  e
65
65
  )
66
66
  }))
67
67
  } : n.custom_content
68
68
  }))
69
- }), E = (t) => t?.split(/-\d+$/)[0] ?? "", W = (t) => t?.toLowerCase().replace(/[^\p{L}\p{N}]+/gu, "-").replace(/^-+|-+$/g, "").replace(/-/g, " ") || "";
70
- function j(t, e) {
69
+ }), p = (t) => t?.split(/-\d+$/)[0] ?? "", S = (t) => new RegExp("\\p{L}", "u").test(t) || new RegExp("\\p{N}", "u").test(t), V = (t) => {
70
+ if (!t) return "";
71
+ const e = t.toLowerCase(), n = [];
72
+ let r = "";
73
+ for (const o of e)
74
+ S(o) ? r += o : r && (n.push(r), r = "");
75
+ return r && n.push(r), n.join(" ");
76
+ };
77
+ function Y(t, e) {
71
78
  return `${t?.[0]}/${e}/${t?.[1]}`;
72
79
  }
73
- const S = (t, e) => (Math.round(t * 10 ** e) / 10 ** e).toString(), V = (t, e) => {
74
- const n = e?.decimal || u.decimal, r = e?.decimalSymbol || u.decimalSymbol, s = e?.digitGroupingSymbol ?? u.digitGroupingSymbol, o = Number(t);
75
- if (o == null || Number.isNaN(o) || t === null || t === "")
80
+ const D = (t, e) => (Math.round(t * 10 ** e) / 10 ** e).toString(), z = (t, e) => {
81
+ const n = e?.decimal || u.decimal, r = e?.decimalSymbol || u.decimalSymbol, o = e?.digitGroupingSymbol ?? u.digitGroupingSymbol, s = Number(t);
82
+ if (s == null || Number.isNaN(s) || t === null || t === "")
76
83
  return "";
77
- const c = n.replace("0.", ""), l = `${n === "0" ? Math.trunc(o) : S(o, c.length)} `.split(".");
84
+ const c = n.replace("0.", ""), l = `${n === "0" ? Math.trunc(s) : D(s, c.length)} `.split(".");
78
85
  return l[0] = l[0].replace(
79
86
  /(\d)(?=(\d\d\d)+(?!\d))/g,
80
- `$1${s}`
87
+ `$1${o}`
81
88
  ), `${l.join(r)}`;
82
- }, Y = (t) => {
89
+ }, X = (t) => {
83
90
  if (!t.includes("T")) {
84
- for (const n of D) {
91
+ for (const n of U) {
85
92
  const r = h(t, n, /* @__PURE__ */ new Date());
86
- if (d(r))
93
+ if (m(r))
87
94
  return r;
88
95
  }
89
96
  return null;
90
97
  }
91
- const e = A(t);
92
- return d(e) ? e : null;
93
- }, D = ["yyyy-MM-dd", "MM-dd-yyyy"], z = (t, e, n) => {
98
+ const e = f(t);
99
+ return m(e) ? e : null;
100
+ }, U = ["yyyy-MM-dd", "MM-dd-yyyy"], k = (t, e, n) => {
94
101
  const r = {};
95
- return e?.contentType !== null && (r[f] = e?.contentType || T), e?.jwt ? r.Authorization = `Bearer ${e.jwt}` : t && (r[a] = t), e?.chatReference && (r[g] = e.chatReference), { ...r, ...n };
96
- }, k = (t) => {
102
+ return e?.contentType !== null && (r[T] = e?.contentType || A), e?.jwt ? r.Authorization = `Bearer ${e.jwt}` : t && (r[i] = t), e?.chatReference && (r[N] = e.chatReference), { ...r, ...n };
103
+ }, K = (t) => {
97
104
  const e = { ...t };
98
- return e[a] && (e[a] = e[a].substring(0, 8) + "...[REDACTED]"), e.Authorization && (e.Authorization = "Bearer [REDACTED]"), e[m] && (e[m] = e[m].substring(0, 8) + "...[REDACTED]"), e;
99
- }, K = (t) => ({
105
+ return e[i] && (e[i] = e[i].substring(0, 8) + "...[REDACTED]"), e.Authorization && (e.Authorization = "Bearer [REDACTED]"), e[d] && (e[d] = e[d].substring(0, 8) + "...[REDACTED]"), e;
106
+ }, J = (t) => ({
100
107
  "Content-Type": `multipart/form-data; boundary=${t}`
101
- }), X = (t) => t?.toLowerCase() === "true", J = async (t, e, n) => await fetch(t, {
108
+ }), q = (t) => t?.toLowerCase() === "true", Q = async (t, e, n) => await fetch(t, {
102
109
  method: n.method || "GET",
103
110
  headers: e,
104
111
  body: n.body ? JSON.stringify(n.body) : void 0
105
- }), q = (t, e) => t?.split("/")?.filter((n) => n !== e)?.join("/"), Q = (t) => t.replace(/^conversations\//, ""), Z = (t) => t.split("/").slice(0, -1).join("/"), tt = (t) => E(
112
+ }), Z = (t, e) => t?.split("/")?.filter((n) => n !== e)?.join("/"), tt = (t) => t.replace(/^conversations\//, ""), et = (t) => t.split("/").slice(0, -1).join("/"), nt = (t) => p(
106
113
  decodeURIComponent(t.split("/").at(-1) ?? "")
107
- ), et = (t) => t.map((e) => ({
114
+ ), rt = (t) => t.map((e) => ({
108
115
  ...e,
109
- name: E(e.name)
116
+ name: p(e.name)
110
117
  })), b = /* @__PURE__ */ new Set([
111
118
  ")",
112
119
  "]",
@@ -128,55 +135,56 @@ function v(t) {
128
135
  trailing: t.slice(e)
129
136
  };
130
137
  }
131
- function nt(t) {
138
+ function ot(t) {
132
139
  if (!t) return [{ type: "text", value: "" }];
133
140
  const e = [];
134
141
  let n = 0;
135
142
  for (const r of t.matchAll(/\bhttps?:\/\/[^\s<>"']+/gi)) {
136
- const s = r[0], o = r.index ?? 0;
137
- o > n && e.push({ type: "text", value: t.slice(n, o) });
138
- const { cleanUrl: c, trailing: i } = v(s);
139
- c ? e.push({ type: "link", value: c }) : e.push({ type: "text", value: s }), i && e.push({ type: "text", value: i }), n = o + s.length;
143
+ const o = r[0], s = r.index ?? 0;
144
+ s > n && e.push({ type: "text", value: t.slice(n, s) });
145
+ const { cleanUrl: c, trailing: a } = v(o);
146
+ c ? e.push({ type: "link", value: c }) : e.push({ type: "text", value: o }), a && e.push({ type: "text", value: a }), n = s + o.length;
140
147
  }
141
148
  return n < t.length && e.push({ type: "text", value: t.slice(n) }), e.length ? e : [{ type: "text", value: t }];
142
149
  }
143
150
  export {
144
- a as API_KEY_HEADER,
151
+ i as API_KEY_HEADER,
145
152
  M as API_ROUTES,
146
- T as APPLICATION_JSON,
147
- f as CONTENT_TYPE_HEADER,
148
- H as CUSTOM_PERIOD,
149
- N as CalendarResolution,
150
- x as HTTP_ERROR_CODES,
151
- L as HttpError,
152
- _ as Locale,
153
- m as OCP_APIM_SUBSCRIPTION_KEY_HEADER,
154
- B as ONBOARDING_MODEL_POSTFIX,
153
+ A as APPLICATION_JSON,
154
+ T as CONTENT_TYPE_HEADER,
155
+ w as CUSTOM_PERIOD,
156
+ _ as CalendarResolution,
157
+ B as HTTP_ERROR_CODES,
158
+ F as HttpError,
159
+ g as Locale,
160
+ d as OCP_APIM_SUBSCRIPTION_KEY_HEADER,
161
+ L as ONBOARDING_MODEL_POSTFIX,
155
162
  O as QueryFilterType,
156
163
  P as SHARE_CONVERSATION_ROUTE,
157
- g as X_CONVERSATION_ID_HEADER,
158
- et as cleanConversationNames,
164
+ N as X_CONVERSATION_ID_HEADER,
165
+ x as X_SOURCE_ARTEFACT_URN_HEADER,
166
+ rt as cleanConversationNames,
159
167
  u as defaultFormatNumbers,
160
- E as deleteConversationNamePostfix,
161
- V as formatNumberBySign,
162
- W as getClearedConversationName,
163
- F as getConversationAttachmentUrls,
164
- I as getConversationAttachments,
165
- Z as getConversationFolderIdFromConversationId,
166
- j as getConversationId,
167
- Q as getConversationIdFromResourceUrl,
168
- tt as getConversationNameFromConversationId,
169
- w as getConversationNavPath,
170
- q as getConversationUrlWithoutLocale,
171
- z as getHeaders,
172
- K as getMultipartHeaders,
173
- Y as getTimePeriod,
174
- R as isDialFileAttachmentUrl,
168
+ p as deleteConversationNamePostfix,
169
+ z as formatNumberBySign,
170
+ V as getClearedConversationName,
171
+ j as getConversationAttachmentUrls,
172
+ R as getConversationAttachments,
173
+ et as getConversationFolderIdFromConversationId,
174
+ Y as getConversationId,
175
+ tt as getConversationIdFromResourceUrl,
176
+ nt as getConversationNameFromConversationId,
177
+ G as getConversationNavPath,
178
+ Z as getConversationUrlWithoutLocale,
179
+ k as getHeaders,
180
+ J as getMultipartHeaders,
181
+ X as getTimePeriod,
182
+ y as isDialFileAttachmentUrl,
175
183
  $ as isHttpError,
176
- nt as linkifyText,
177
- X as parseBoolean,
178
- G as replaceConversationAttachmentUrls,
179
- k as sanitizeHeaders,
180
- J as sendRequest,
184
+ ot as linkifyText,
185
+ q as parseBoolean,
186
+ W as replaceConversationAttachmentUrls,
187
+ K as sanitizeHeaders,
188
+ Q as sendRequest,
181
189
  v as splitTrailingPunctuation
182
190
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epam/statgpt-shared-toolkit",
3
- "version": "0.4.0-rc.9",
3
+ "version": "0.5.0-rc.0",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": {