@cellaware/utils 8.11.19 → 8.11.20

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.
Files changed (63) hide show
  1. package/dist/azure/cosmos.d.ts +112 -0
  2. package/dist/azure/cosmos.js +305 -0
  3. package/dist/azure/email.d.ts +3 -0
  4. package/dist/azure/email.js +20 -0
  5. package/dist/azure/function.d.ts +14 -0
  6. package/dist/azure/function.js +124 -0
  7. package/dist/azure/slot.d.ts +1 -0
  8. package/dist/azure/slot.js +4 -0
  9. package/dist/azure/storage.d.ts +14 -0
  10. package/dist/azure/storage.js +81 -0
  11. package/dist/chatwms/alert.d.ts +97 -0
  12. package/dist/chatwms/alert.js +74 -0
  13. package/dist/chatwms/azure/cosmos.d.ts +25 -0
  14. package/dist/chatwms/azure/cosmos.js +43 -0
  15. package/dist/chatwms/azure/function.d.ts +21 -0
  16. package/dist/chatwms/azure/function.js +29 -0
  17. package/dist/chatwms/azure/storage.d.ts +15 -0
  18. package/dist/chatwms/azure/storage.js +27 -0
  19. package/dist/chatwms/client.d.ts +18 -0
  20. package/dist/chatwms/client.js +48 -0
  21. package/dist/chatwms/cosmos.d.ts +24 -0
  22. package/dist/chatwms/cosmos.js +532 -0
  23. package/dist/chatwms/dashboard.d.ts +80 -0
  24. package/dist/chatwms/dashboard.js +17 -0
  25. package/dist/chatwms/datagrid.d.ts +215 -0
  26. package/dist/chatwms/datagrid.js +1454 -0
  27. package/dist/chatwms/developer.d.ts +27 -0
  28. package/dist/chatwms/developer.js +12 -0
  29. package/dist/chatwms/github/issue.d.ts +1 -0
  30. package/dist/chatwms/github/issue.js +4 -0
  31. package/dist/chatwms/instance.d.ts +16 -0
  32. package/dist/chatwms/instance.js +18 -0
  33. package/dist/chatwms/integration.d.ts +24 -0
  34. package/dist/chatwms/integration.js +19 -0
  35. package/dist/chatwms/pdf.d.ts +95 -0
  36. package/dist/chatwms/pdf.js +147 -0
  37. package/dist/chatwms/report.d.ts +126 -0
  38. package/dist/chatwms/report.js +55 -0
  39. package/dist/chatwms/response.d.ts +18 -0
  40. package/dist/chatwms/response.js +25 -0
  41. package/dist/chatwms/search.d.ts +12 -0
  42. package/dist/chatwms/search.js +9 -0
  43. package/dist/chatwms/teams.d.ts +237 -0
  44. package/dist/chatwms/teams.js +205 -0
  45. package/dist/chatwms/user.d.ts +31 -0
  46. package/dist/chatwms/user.js +42 -0
  47. package/dist/chatwms/warehouse.d.ts +3 -0
  48. package/dist/chatwms/warehouse.js +3 -0
  49. package/dist/github/issue.d.ts +1 -0
  50. package/dist/github/issue.js +23 -0
  51. package/dist/llm/chain-store.d.ts +49 -0
  52. package/dist/llm/chain-store.js +284 -0
  53. package/dist/llm/cost.d.ts +3 -0
  54. package/dist/llm/cost.js +42 -0
  55. package/dist/llm/model.d.ts +12 -0
  56. package/dist/llm/model.js +1 -0
  57. package/dist/stopwatch.d.ts +8 -0
  58. package/dist/stopwatch.js +36 -0
  59. package/dist/util.d.ts +45 -0
  60. package/dist/util.js +288 -0
  61. package/dist/version.d.ts +4 -0
  62. package/dist/version.js +12 -0
  63. package/package.json +1 -1
@@ -0,0 +1,27 @@
1
+ import { KeyValuePair } from "../util.js";
2
+ import { DataContext } from "./client.js";
3
+ export interface SqlCacheContext {
4
+ contextName: DataContext;
5
+ variables: KeyValuePair[];
6
+ tables: {
7
+ table_name: string;
8
+ table_description: string;
9
+ }[];
10
+ columns: {
11
+ table_name: string;
12
+ column_id: number;
13
+ column_name: string;
14
+ data_type: string;
15
+ column_description: string;
16
+ column_comment: string;
17
+ }[];
18
+ functions: {
19
+ name: string;
20
+ type: string;
21
+ args: string[];
22
+ description: string;
23
+ }[];
24
+ tableMappings: KeyValuePair[];
25
+ columnMappings: KeyValuePair[];
26
+ }
27
+ export declare function initSqlCacheContext(): SqlCacheContext;
@@ -0,0 +1,12 @@
1
+ import { CHATWMS_CONTEXT_NAME } from "./client.js";
2
+ export function initSqlCacheContext() {
3
+ return {
4
+ contextName: CHATWMS_CONTEXT_NAME,
5
+ variables: [],
6
+ tables: [],
7
+ columns: [],
8
+ functions: [],
9
+ tableMappings: [],
10
+ columnMappings: []
11
+ };
12
+ }
@@ -0,0 +1 @@
1
+ export declare function chatwmsGithubCreateIssue(title: string, body: any, labels: string[]): Promise<boolean>;
@@ -0,0 +1,4 @@
1
+ import { githubCreateIssue } from "../../github/issue.js";
2
+ export async function chatwmsGithubCreateIssue(title, body, labels) {
3
+ return githubCreateIssue(`https://api.github.com/repos/cellaware/chatwms-feedback/issues`, title, body, labels);
4
+ }
@@ -0,0 +1,16 @@
1
+ export interface ChatWMSInstance {
2
+ id: string;
3
+ clientId: string;
4
+ customer: string;
5
+ description: string;
6
+ url: string;
7
+ key: string;
8
+ }
9
+ export declare function initChatWMSInstance(): ChatWMSInstance;
10
+ export interface ChatWMSInstanceWarehouse {
11
+ instanceId: string;
12
+ clientId: string;
13
+ customer: string;
14
+ warehouse: string;
15
+ }
16
+ export declare function initChatWMSInstanceWarehouse(): ChatWMSInstanceWarehouse;
@@ -0,0 +1,18 @@
1
+ export function initChatWMSInstance() {
2
+ return {
3
+ id: '',
4
+ clientId: '',
5
+ customer: '',
6
+ description: '',
7
+ url: '',
8
+ key: ''
9
+ };
10
+ }
11
+ export function initChatWMSInstanceWarehouse() {
12
+ return {
13
+ instanceId: '',
14
+ clientId: '',
15
+ customer: '',
16
+ warehouse: '',
17
+ };
18
+ }
@@ -0,0 +1,24 @@
1
+ export declare const INTEGRATION_VISIBILITY_PRIVATE = "private";
2
+ export declare const INTEGRATION_VISIBILITY_PUBLIC = "public";
3
+ export declare const INTEGRATION_VENDOR_TEAMS = "teams";
4
+ export declare const INTEGRATION_VENDOR_SLACK = "slack";
5
+ export declare const INTEGRATION_TYPE_WEBHOOK = "webhook";
6
+ export interface SubscriptionIntegration {
7
+ integrationId: string;
8
+ name: string;
9
+ description: string;
10
+ visibility: string;
11
+ readonly: boolean;
12
+ /**
13
+ * `teams` | `slack`
14
+ */
15
+ vendor: string;
16
+ /**
17
+ * `webhook`
18
+ */
19
+ type: string;
20
+ url: string;
21
+ clientId: string;
22
+ userId: string;
23
+ }
24
+ export declare function initSubscriptionIntegration(): SubscriptionIntegration;
@@ -0,0 +1,19 @@
1
+ export const INTEGRATION_VISIBILITY_PRIVATE = 'private';
2
+ export const INTEGRATION_VISIBILITY_PUBLIC = 'public';
3
+ export const INTEGRATION_VENDOR_TEAMS = 'teams';
4
+ export const INTEGRATION_VENDOR_SLACK = 'slack';
5
+ export const INTEGRATION_TYPE_WEBHOOK = 'webhook';
6
+ export function initSubscriptionIntegration() {
7
+ return {
8
+ integrationId: '',
9
+ name: '',
10
+ description: '',
11
+ visibility: INTEGRATION_VISIBILITY_PRIVATE,
12
+ readonly: false,
13
+ vendor: INTEGRATION_VENDOR_TEAMS,
14
+ type: INTEGRATION_TYPE_WEBHOOK,
15
+ url: '',
16
+ clientId: '',
17
+ userId: ''
18
+ };
19
+ }
@@ -0,0 +1,95 @@
1
+ export interface PdfOptions {
2
+ /**
3
+ * Display header and footer. Defaults to `false`.
4
+ */
5
+ displayHeaderFooter?: boolean;
6
+ /**
7
+ * HTML template for the print footer. Should use the same format as the
8
+ * [`headerTemplate`](https://playwright.dev/docs/api/class-page#page-pdf-option-header-template).
9
+ */
10
+ footerTemplate?: string;
11
+ /**
12
+ * Paper format. If set, takes priority over
13
+ * [`width`](https://playwright.dev/docs/api/class-page#page-pdf-option-width) or
14
+ * [`height`](https://playwright.dev/docs/api/class-page#page-pdf-option-height) options. Defaults to 'Letter'.
15
+ */
16
+ format?: string;
17
+ /**
18
+ * HTML template for the print header. Should be valid HTML markup with following classes used to inject printing
19
+ * values into them:
20
+ * - `'date'` formatted print date
21
+ * - `'title'` document title
22
+ * - `'url'` document location
23
+ * - `'pageNumber'` current page number
24
+ * - `'totalPages'` total pages in the document
25
+ */
26
+ headerTemplate?: string;
27
+ /**
28
+ * Paper height, accepts values labeled with units.
29
+ */
30
+ height?: string | number;
31
+ /**
32
+ * Paper orientation. Defaults to `false`.
33
+ */
34
+ landscape?: boolean;
35
+ /**
36
+ * Paper margins, defaults to none.
37
+ */
38
+ margin?: {
39
+ /**
40
+ * Top margin, accepts values labeled with units. Defaults to `0`.
41
+ */
42
+ top?: string | number;
43
+ /**
44
+ * Right margin, accepts values labeled with units. Defaults to `0`.
45
+ */
46
+ right?: string | number;
47
+ /**
48
+ * Bottom margin, accepts values labeled with units. Defaults to `0`.
49
+ */
50
+ bottom?: string | number;
51
+ /**
52
+ * Left margin, accepts values labeled with units. Defaults to `0`.
53
+ */
54
+ left?: string | number;
55
+ };
56
+ /**
57
+ * Whether or not to embed the document outline into the PDF. Defaults to `false`.
58
+ */
59
+ outline?: boolean;
60
+ /**
61
+ * Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages.
62
+ */
63
+ pageRanges?: string;
64
+ /**
65
+ * The file path to save the PDF to. If [`path`](https://playwright.dev/docs/api/class-page#page-pdf-option-path) is a
66
+ * relative path, then it is resolved relative to the current working directory. If no path is provided, the PDF won't
67
+ * be saved to the disk.
68
+ */
69
+ path?: string;
70
+ /**
71
+ * Give any CSS `@page` size declared in the page priority over what is declared in
72
+ * [`width`](https://playwright.dev/docs/api/class-page#page-pdf-option-width) and
73
+ * [`height`](https://playwright.dev/docs/api/class-page#page-pdf-option-height) or
74
+ * [`format`](https://playwright.dev/docs/api/class-page#page-pdf-option-format) options. Defaults to `false`, which
75
+ * will scale the content to fit the paper size.
76
+ */
77
+ preferCSSPageSize?: boolean;
78
+ /**
79
+ * Print background graphics. Defaults to `false`.
80
+ */
81
+ printBackground?: boolean;
82
+ /**
83
+ * Scale of the webpage rendering. Defaults to `1`. Scale amount must be between 0.1 and 2.
84
+ */
85
+ scale?: number;
86
+ /**
87
+ * Whether or not to generate tagged (accessible) PDF. Defaults to `false`.
88
+ */
89
+ tagged?: boolean;
90
+ /**
91
+ * Paper width, accepts values labeled with units.
92
+ */
93
+ width?: string | number;
94
+ }
95
+ export declare function generatePdf(html: string, options?: PdfOptions): Promise<Buffer>;
@@ -0,0 +1,147 @@
1
+ import { sleep } from "../util.js";
2
+ /*
3
+
4
+ In summary -- try to generate a PDF, and if Browserless is busy, politely wait and try again a few times — then give up cleanly.
5
+
6
+ Step by step details:
7
+
8
+ 1. Send HTML to Browserless
9
+ - We make an HTTP request to Browserless’s `/pdf` endpoint.
10
+ - Browserless runs a browser, renders the HTML, and sends back a PDF.
11
+
12
+ 2. If it works → we’re done
13
+ - We return the PDF immediately.
14
+
15
+ 3. If Browserless is too busy
16
+ - Browserless may say:
17
+ - “Too many requests” (429), or
18
+ - “Service temporarily unavailable” (503/502/504)
19
+ - This usually means you hit your concurrency limit, not that something is broken.
20
+
21
+ 4. When that happens
22
+ - We wait a bit
23
+ - Then try again
24
+ - But:
25
+ - We don’t retry forever
26
+ - We wait slightly longer each time
27
+ - We add a little randomness so many requests don’t retry at once
28
+
29
+ 5. If Browserless tells us how long to wait
30
+ - We listen (`Retry-After` header)
31
+ - That’s the best signal
32
+
33
+ 6. If the request hangs or the network glitches
34
+ - We cancel it after a timeout
35
+ - Then retry (once or twice)
36
+
37
+ 7. If it keeps failing
38
+ - We stop retrying
39
+ - We throw a clear error explaining what happened
40
+ */
41
+ const ENDPOINT = "https://production-sfo.browserless.io/pdf";
42
+ const TIMEOUT_MS = 60_000;
43
+ const RETRIES = 3;
44
+ const BASE_DELAY_MS = 3_000;
45
+ const MAX_DELAY_MS = 15_000;
46
+ const JITTER_MS = 1_000;
47
+ function parseRetryAfterMs(retryAfter) {
48
+ if (!retryAfter)
49
+ return null;
50
+ const asSeconds = Number(retryAfter);
51
+ if (Number.isFinite(asSeconds) && asSeconds >= 0)
52
+ return Math.floor(asSeconds * 1000);
53
+ const asDate = Date.parse(retryAfter);
54
+ if (!Number.isNaN(asDate)) {
55
+ const delta = asDate - Date.now();
56
+ return delta > 0 ? delta : 0;
57
+ }
58
+ return null;
59
+ }
60
+ function backoffMs(attempt) {
61
+ const backoff = BASE_DELAY_MS * Math.pow(2, Math.max(0, attempt - 1));
62
+ const capped = Math.min(backoff, MAX_DELAY_MS);
63
+ const jitter = Math.floor(Math.random() * (JITTER_MS + 1));
64
+ return capped + jitter;
65
+ }
66
+ function shouldRetryStatus(status) {
67
+ return status === 429 || status === 503 || status === 502 || status === 504;
68
+ }
69
+ export async function generatePdf(html, options) {
70
+ const token = process.env.BROWSERLESS_TOKEN;
71
+ if (!token) {
72
+ throw new Error('PDF: `BROWSER_TOKEN` environment variable is not set');
73
+ }
74
+ const url = new URL(ENDPOINT);
75
+ url.searchParams.set("token", token);
76
+ const totalAttempts = 1 + RETRIES;
77
+ for (let attempt = 1; attempt <= totalAttempts; attempt++) {
78
+ const controller = new AbortController();
79
+ const timeout = setTimeout(() => {
80
+ console.log(`PDF: attempt ${attempt} timed out after ${TIMEOUT_MS}ms`);
81
+ controller.abort();
82
+ }, TIMEOUT_MS);
83
+ try {
84
+ const res = await fetch(url.toString(), {
85
+ method: "POST",
86
+ headers: {
87
+ "content-type": "application/json",
88
+ "accept": "application/pdf",
89
+ },
90
+ body: JSON.stringify({
91
+ html,
92
+ options: options ??
93
+ {
94
+ format: "Letter",
95
+ printBackground: true,
96
+ preferCSSPageSize: true,
97
+ }
98
+ }),
99
+ signal: controller.signal,
100
+ });
101
+ if (res.ok) {
102
+ const ab = await res.arrayBuffer();
103
+ return Buffer.from(ab);
104
+ }
105
+ console.log(`PDF: attempt ${attempt} failed with status ${res.status} ${res.statusText}`);
106
+ const retryable = shouldRetryStatus(res.status);
107
+ if (retryable && attempt < totalAttempts) {
108
+ const retryAfter = parseRetryAfterMs(res.headers.get("retry-after"));
109
+ const delay = retryAfter !== null
110
+ ? retryAfter + Math.floor(Math.random() * (JITTER_MS + 1))
111
+ : backoffMs(attempt);
112
+ console.log(`PDF: retryable failure (status ${res.status}), waiting ${delay}ms before retry`);
113
+ await sleep(delay);
114
+ continue;
115
+ }
116
+ const bodyText = await res.text().catch(() => "");
117
+ const preview = bodyText ? bodyText.slice(0, 1000) : "";
118
+ throw new Error(`PDF: Browserless /pdf failed (${res.status} ${res.statusText})` + (preview ? ` — ${preview}` : ""));
119
+ }
120
+ catch (err) {
121
+ const isAbort = err?.name === "AbortError";
122
+ const isTransientNetwork = isAbort ||
123
+ err?.code === "ECONNRESET" ||
124
+ err?.code === "ETIMEDOUT" ||
125
+ err?.code === "EAI_AGAIN" ||
126
+ err?.cause?.code === "ECONNRESET" ||
127
+ err?.cause?.code === "ETIMEDOUT";
128
+ if (isAbort) {
129
+ console.log(`PDF: attempt ${attempt} aborted`);
130
+ }
131
+ else {
132
+ console.log(`PDF: attempt ${attempt} threw error`, err);
133
+ }
134
+ if (isTransientNetwork && attempt < totalAttempts) {
135
+ const delay = backoffMs(attempt);
136
+ console.log(`PDF: transient error, waiting ${delay}ms before retry`);
137
+ await sleep(delay);
138
+ continue;
139
+ }
140
+ throw err;
141
+ }
142
+ finally {
143
+ clearTimeout(timeout);
144
+ }
145
+ }
146
+ throw new Error("PDF: Browserless /pdf failed");
147
+ }
@@ -0,0 +1,126 @@
1
+ import { DataContext } from "./client.js";
2
+ import { DatagridStateBase } from "./datagrid.js";
3
+ import { SubscriptionIntegration } from "./integration.js";
4
+ export declare const REPORT_VISIBILITY_PRIVATE = "private";
5
+ export declare const REPORT_VISIBILITY_PUBLIC = "public";
6
+ export declare const REPORT_VISIBILITY_GLOBAL = "global";
7
+ export interface ReportParameter {
8
+ sequence: number;
9
+ name: string;
10
+ required: boolean;
11
+ exampleValue: string;
12
+ }
13
+ export interface ReportParameterValue {
14
+ parameterName: string;
15
+ /** `text` | `number` | `date` | `boolean` */
16
+ dataType: string;
17
+ rule: string;
18
+ value: string;
19
+ value2?: string;
20
+ }
21
+ export declare function initReportParameterValue(): ReportParameterValue;
22
+ export interface Report {
23
+ reportId: string;
24
+ reportTitle: string;
25
+ reportRoute: string;
26
+ visibility: string;
27
+ readonly: boolean;
28
+ landscape?: boolean;
29
+ parameters: ReportParameter[];
30
+ folder: string;
31
+ brief: string;
32
+ email?: {
33
+ subject: string;
34
+ body: string;
35
+ };
36
+ clientId: string;
37
+ userId: string;
38
+ customerLevel?: boolean;
39
+ }
40
+ export declare function initReport(): Report;
41
+ export interface ReportWithLines extends Report {
42
+ lines: ReportLine[];
43
+ }
44
+ export interface InstanceReport extends ReportWithLines {
45
+ schedules: InstanceReportSchedule[];
46
+ }
47
+ export interface LineReportParameter {
48
+ parameterName: string;
49
+ columnName: string;
50
+ }
51
+ export interface ReportLineContentInfo extends DatagridStateBase {
52
+ visualizationOption: string;
53
+ reportParameters: LineReportParameter[];
54
+ contextName: DataContext;
55
+ specification: string;
56
+ query: string;
57
+ summary: string;
58
+ reviewOk?: boolean;
59
+ reviewConfidence?: string;
60
+ reviewFeedback?: string;
61
+ tableGroups?: string[];
62
+ developer?: boolean;
63
+ archive?: boolean;
64
+ referenceLineId?: string;
65
+ }
66
+ export interface ReportLine {
67
+ lineId: string;
68
+ lineTitle: string;
69
+ reportId: string;
70
+ contentInfo: ReportLineContentInfo;
71
+ sequence: number;
72
+ clientId: string;
73
+ userId: string;
74
+ }
75
+ export interface ReportLineResult {
76
+ rows: any[];
77
+ htmlRows: string;
78
+ teamsRows: any[];
79
+ chartRows: any[];
80
+ htmlTranspose: string;
81
+ teamsTranspose: any[];
82
+ briefRows: string;
83
+ briefRowCount: number;
84
+ }
85
+ export declare function initReportLineResult(): ReportLineResult;
86
+ export interface ReportUsage {
87
+ reportId: string;
88
+ reportTitle: string;
89
+ visibility: string;
90
+ clientId: string;
91
+ userId: string;
92
+ datetime: Date;
93
+ customerLevel?: boolean;
94
+ }
95
+ export interface ReportSchedule {
96
+ scheduleId: string;
97
+ reportId: string;
98
+ enabled: boolean;
99
+ cronExpression: string;
100
+ popup?: boolean;
101
+ email?: boolean;
102
+ additionalEmails?: string[];
103
+ integrations?: string[];
104
+ excel?: boolean;
105
+ parameterValues?: ReportParameterValue[];
106
+ /**
107
+ * **Important:** An undefined/empty array indicates that all lines are selected.
108
+ */
109
+ lineIds?: string[];
110
+ clientId: string;
111
+ userId: string;
112
+ userDetails: string;
113
+ }
114
+ export declare function initReportSchedule(): ReportSchedule;
115
+ export interface InstanceReportSchedule {
116
+ cronExpression: string;
117
+ popups: Set<string>;
118
+ emails: Set<string>;
119
+ integrations: Set<SubscriptionIntegration>;
120
+ excel: boolean;
121
+ parameterValues: ReportParameterValue[];
122
+ /**
123
+ * ***Important:** An empty array indicates that all lines are selected.
124
+ */
125
+ lineIds: string[];
126
+ }
@@ -0,0 +1,55 @@
1
+ export const REPORT_VISIBILITY_PRIVATE = 'private';
2
+ export const REPORT_VISIBILITY_PUBLIC = 'public';
3
+ export const REPORT_VISIBILITY_GLOBAL = 'global';
4
+ export function initReportParameterValue() {
5
+ return {
6
+ parameterName: '',
7
+ dataType: '',
8
+ rule: '',
9
+ value: ''
10
+ };
11
+ }
12
+ export function initReport() {
13
+ return {
14
+ reportId: '',
15
+ reportTitle: '',
16
+ reportRoute: '',
17
+ visibility: REPORT_VISIBILITY_PRIVATE,
18
+ readonly: false,
19
+ parameters: [],
20
+ folder: '',
21
+ brief: '',
22
+ clientId: '',
23
+ userId: ''
24
+ };
25
+ }
26
+ export function initReportLineResult() {
27
+ return {
28
+ rows: [],
29
+ htmlRows: '',
30
+ teamsRows: [],
31
+ chartRows: [],
32
+ htmlTranspose: '',
33
+ teamsTranspose: [],
34
+ briefRows: '',
35
+ briefRowCount: 0,
36
+ };
37
+ }
38
+ export function initReportSchedule() {
39
+ return {
40
+ scheduleId: '',
41
+ reportId: '',
42
+ enabled: false,
43
+ cronExpression: '',
44
+ popup: false,
45
+ email: false,
46
+ additionalEmails: [],
47
+ integrations: [],
48
+ excel: false,
49
+ parameterValues: [],
50
+ lineIds: [],
51
+ clientId: '',
52
+ userId: '',
53
+ userDetails: ''
54
+ };
55
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Throws error if `res` is not ok.
3
+ *
4
+ * **Note:** will throw message 'An error occurred. Please try again in a moment.' if none provided.
5
+ */
6
+ export declare function assertResponseOk(res: Response, message?: string): Response;
7
+ export interface ChatWMSResponse {
8
+ ok: boolean;
9
+ error: string;
10
+ data: any;
11
+ }
12
+ /**
13
+ * Initialization:
14
+ * - `ok`: `true`
15
+ * - `error`: `''`
16
+ * - `data`: `{}`
17
+ */
18
+ export declare function initChatWMSResponse(data?: any): ChatWMSResponse;
@@ -0,0 +1,25 @@
1
+ const RESPONSE_ERROR_MESSAGE = 'An error occurred. Please try again in a moment.';
2
+ /**
3
+ * Throws error if `res` is not ok.
4
+ *
5
+ * **Note:** will throw message 'An error occurred. Please try again in a moment.' if none provided.
6
+ */
7
+ export function assertResponseOk(res, message) {
8
+ if (!res.ok) {
9
+ throw new Error(message ?? RESPONSE_ERROR_MESSAGE);
10
+ }
11
+ return res;
12
+ }
13
+ /**
14
+ * Initialization:
15
+ * - `ok`: `true`
16
+ * - `error`: `''`
17
+ * - `data`: `{}`
18
+ */
19
+ export function initChatWMSResponse(data) {
20
+ return {
21
+ ok: true,
22
+ error: '',
23
+ data: data ?? {}
24
+ };
25
+ }
@@ -0,0 +1,12 @@
1
+ export declare enum SearchRecordType {
2
+ DASHBOARD = "dashboard",
3
+ DASHBOARD_WIDGET = "dashboard_widget",
4
+ DASHBOARD_FOLDER = "dashboard_folder",
5
+ REPORT = "report",
6
+ REPORT_LINE = "report_line",
7
+ REPORT_FOLDER = "report_folder"
8
+ }
9
+ export interface SearchRecord {
10
+ type: SearchRecordType;
11
+ data: any;
12
+ }
@@ -0,0 +1,9 @@
1
+ export var SearchRecordType;
2
+ (function (SearchRecordType) {
3
+ SearchRecordType["DASHBOARD"] = "dashboard";
4
+ SearchRecordType["DASHBOARD_WIDGET"] = "dashboard_widget";
5
+ SearchRecordType["DASHBOARD_FOLDER"] = "dashboard_folder";
6
+ SearchRecordType["REPORT"] = "report";
7
+ SearchRecordType["REPORT_LINE"] = "report_line";
8
+ SearchRecordType["REPORT_FOLDER"] = "report_folder";
9
+ })(SearchRecordType || (SearchRecordType = {}));