@epam/statgpt-shared-toolkit 0.3.0-rc.9 → 0.3.1

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