@asgard-js/react 0.0.34 → 0.0.37-canary.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/dist/components/chatbot/chatbot-footer/chatbot-footer.d.ts.map +1 -1
- package/dist/index.js +18022 -18716
- package/package.json +2 -2
- package/.babelrc +0 -12
- package/eslint.config.cjs +0 -12
- package/src/components/chatbot/chatbot-body/chatbot-body.module.scss +0 -13
- package/src/components/chatbot/chatbot-body/chatbot-body.tsx +0 -45
- package/src/components/chatbot/chatbot-body/conversation-message-renderer.tsx +0 -55
- package/src/components/chatbot/chatbot-body/index.ts +0 -1
- package/src/components/chatbot/chatbot-container/chatbot-container.module.scss +0 -41
- package/src/components/chatbot/chatbot-container/chatbot-container.tsx +0 -49
- package/src/components/chatbot/chatbot-container/chatbot-full-screen-container.tsx +0 -54
- package/src/components/chatbot/chatbot-footer/chatbot-footer.module.scss +0 -67
- package/src/components/chatbot/chatbot-footer/chatbot-footer.tsx +0 -144
- package/src/components/chatbot/chatbot-footer/index.ts +0 -1
- package/src/components/chatbot/chatbot-footer/speech-input-button.tsx +0 -132
- package/src/components/chatbot/chatbot-header/chatbot-header.module.scss +0 -48
- package/src/components/chatbot/chatbot-header/chatbot-header.tsx +0 -98
- package/src/components/chatbot/chatbot-header/index.ts +0 -1
- package/src/components/chatbot/chatbot.spec.tsx +0 -8
- package/src/components/chatbot/chatbot.tsx +0 -118
- package/src/components/chatbot/profile-icon.tsx +0 -26
- package/src/components/index.ts +0 -2
- package/src/components/templates/avatar/avatar.module.scss +0 -6
- package/src/components/templates/avatar/avatar.tsx +0 -28
- package/src/components/templates/avatar/index.ts +0 -1
- package/src/components/templates/button-template/button-template.module.scss +0 -0
- package/src/components/templates/button-template/button-template.tsx +0 -45
- package/src/components/templates/button-template/card.module.scss +0 -58
- package/src/components/templates/button-template/card.spec.tsx +0 -213
- package/src/components/templates/button-template/card.tsx +0 -123
- package/src/components/templates/button-template/index.ts +0 -1
- package/src/components/templates/carousel-template/carousel-template.module.scss +0 -15
- package/src/components/templates/carousel-template/carousel-template.tsx +0 -49
- package/src/components/templates/carousel-template/index.ts +0 -1
- package/src/components/templates/chart-template/chart-template.module.scss +0 -52
- package/src/components/templates/chart-template/chart-template.tsx +0 -75
- package/src/components/templates/chart-template/index.ts +0 -1
- package/src/components/templates/hint-template/hint-template.module.scss +0 -39
- package/src/components/templates/hint-template/hint-template.tsx +0 -71
- package/src/components/templates/hint-template/index.ts +0 -1
- package/src/components/templates/image-template/image-template.module.scss +0 -67
- package/src/components/templates/image-template/image-template.tsx +0 -58
- package/src/components/templates/image-template/index.ts +0 -1
- package/src/components/templates/index.ts +0 -10
- package/src/components/templates/quick-replies/index.ts +0 -1
- package/src/components/templates/quick-replies/quick-replies.module.scss +0 -16
- package/src/components/templates/quick-replies/quick-replies.tsx +0 -44
- package/src/components/templates/template-box/index.ts +0 -2
- package/src/components/templates/template-box/template-box-content.module.scss +0 -13
- package/src/components/templates/template-box/template-box-content.tsx +0 -30
- package/src/components/templates/template-box/template-box.module.scss +0 -19
- package/src/components/templates/template-box/template-box.tsx +0 -48
- package/src/components/templates/text-template/bot-typing-box.tsx +0 -81
- package/src/components/templates/text-template/bot-typing-placeholder.tsx +0 -28
- package/src/components/templates/text-template/index.ts +0 -3
- package/src/components/templates/text-template/text-template.module.scss +0 -131
- package/src/components/templates/text-template/text-template.tsx +0 -90
- package/src/components/templates/text-template/use-react-markdown-renderer.spec.tsx +0 -758
- package/src/components/templates/time/index.ts +0 -1
- package/src/components/templates/time/time.module.scss +0 -6
- package/src/components/templates/time/time.tsx +0 -34
- package/src/context/asgard-app-initialization-context.tsx +0 -154
- package/src/context/asgard-service-context.tsx +0 -139
- package/src/context/asgard-template-context.tsx +0 -83
- package/src/context/asgard-theme-context.tsx +0 -401
- package/src/context/index.ts +0 -4
- package/src/hooks/index.ts +0 -11
- package/src/hooks/use-asgard-service-client.ts +0 -68
- package/src/hooks/use-channel.ts +0 -154
- package/src/hooks/use-debounce.ts +0 -18
- package/src/hooks/use-deep-compare-memo.ts +0 -19
- package/src/hooks/use-is-on-screen-keyboard-open.ts +0 -43
- package/src/hooks/use-on-screen-keyboard-scroll-fix.ts +0 -15
- package/src/hooks/use-prevent-over-scrolling.ts +0 -77
- package/src/hooks/use-react-markdown-renderer.tsx +0 -266
- package/src/hooks/use-resize-observer.tsx +0 -27
- package/src/hooks/use-update-vh.ts +0 -30
- package/src/hooks/use-viewport-size.ts +0 -51
- package/src/icons/add_a_photo.svg +0 -3
- package/src/icons/bot.svg +0 -14
- package/src/icons/close.svg +0 -3
- package/src/icons/distance.svg +0 -3
- package/src/icons/mic.svg +0 -3
- package/src/icons/photo_library.svg +0 -3
- package/src/icons/profile.svg +0 -28
- package/src/icons/refresh.svg +0 -3
- package/src/icons/send.svg +0 -3
- package/src/icons/stop.svg +0 -22
- package/src/icons/volume_up.svg +0 -3
- package/src/index.ts +0 -4
- package/src/models/bot-provider.ts +0 -108
- package/src/styles/_index.scss +0 -1
- package/src/styles/_styles.scss +0 -11
- package/src/styles/colors/_colors.scss +0 -10
- package/src/styles/colors/_index.scss +0 -1
- package/src/styles/colors/_variables.scss +0 -72
- package/src/styles/palette/_index.scss +0 -1
- package/src/styles/palette/_palette.scss +0 -42
- package/src/styles/palette/_variables.scss +0 -40
- package/src/styles/radius/_index.scss +0 -1
- package/src/styles/radius/_radius.scss +0 -8
- package/src/styles/radius/_variables.scss +0 -12
- package/src/styles/spacing/_index.scss +0 -1
- package/src/styles/spacing/_spacing.scss +0 -8
- package/src/styles/spacing/_variables.scss +0 -13
- package/src/styles/utils/_index.scss +0 -1
- package/src/styles/utils/_map.scss +0 -22
- package/src/test-setup.ts +0 -1
- package/src/utils/deep-merge.ts +0 -26
- package/src/utils/extractors.ts +0 -20
- package/src/utils/format-time.ts +0 -8
- package/src/utils/index.ts +0 -1
- package/src/utils/is.ts +0 -72
- package/src/utils/selectors.ts +0 -7
- package/src/utils/uri-validation.spec.ts +0 -208
- package/src/utils/uri-validation.ts +0 -103
- package/tsconfig.json +0 -16
- package/tsconfig.lib.json +0 -63
- package/tsconfig.spec.json +0 -36
- package/tsconfig.tsbuildinfo +0 -1
- package/vite.config.ts +0 -63
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { ClientConfig } from '@asgard-js/core';
|
|
2
|
-
import { annotationSelectorFromBotProviderMetadata } from '../utils/selectors';
|
|
3
|
-
|
|
4
|
-
export type BotProviderMetadataResponse = {
|
|
5
|
-
name: string;
|
|
6
|
-
namespace: string;
|
|
7
|
-
uid: string;
|
|
8
|
-
resourceVersion: string;
|
|
9
|
-
generation: number;
|
|
10
|
-
creationTimestamp: string;
|
|
11
|
-
labels: Record<string, string>;
|
|
12
|
-
annotations: Record<string, string>;
|
|
13
|
-
managedFields: Array<{
|
|
14
|
-
manager: string;
|
|
15
|
-
operation: string;
|
|
16
|
-
apiVersion: string;
|
|
17
|
-
time: string;
|
|
18
|
-
fieldsType: string;
|
|
19
|
-
fieldsV1: Record<string, unknown>;
|
|
20
|
-
subresource: string;
|
|
21
|
-
}>;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const stubGetAsgardBotProviderMetadata =
|
|
25
|
-
async (): Promise<BotProviderMetadataResponse> => {
|
|
26
|
-
return {
|
|
27
|
-
name: '',
|
|
28
|
-
namespace: '',
|
|
29
|
-
uid: '',
|
|
30
|
-
resourceVersion: '0',
|
|
31
|
-
generation: 0,
|
|
32
|
-
creationTimestamp: new Date().toISOString(),
|
|
33
|
-
labels: {},
|
|
34
|
-
annotations: {
|
|
35
|
-
'asgard-ai.com/additional-annotation': JSON.stringify({
|
|
36
|
-
embedConfig: {
|
|
37
|
-
theme: {
|
|
38
|
-
chatbot: {},
|
|
39
|
-
botMessage: {},
|
|
40
|
-
userMessage: {},
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
}),
|
|
44
|
-
},
|
|
45
|
-
managedFields: [],
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const stubGetAnnotations = async (): Promise<Record<string, unknown>> => {
|
|
50
|
-
const metadata = await stubGetAsgardBotProviderMetadata();
|
|
51
|
-
|
|
52
|
-
return annotationSelectorFromBotProviderMetadata(metadata);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export const getBotProviderModels = (
|
|
56
|
-
config: ClientConfig
|
|
57
|
-
): {
|
|
58
|
-
getAsgardBotProviderMetadata: () => Promise<BotProviderMetadataResponse>;
|
|
59
|
-
getAnnotations: () => Promise<Record<string, unknown>>;
|
|
60
|
-
} => {
|
|
61
|
-
if (!config.botProviderEndpoint) {
|
|
62
|
-
// eslint-disable-next-line no-console
|
|
63
|
-
console.warn(
|
|
64
|
-
'[getBotProviderModels] botProviderEndpoint is not defined in config. ' +
|
|
65
|
-
'Bot provider features will be disabled. Consider providing botProviderEndpoint for full functionality.'
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
return {
|
|
69
|
-
getAsgardBotProviderMetadata: stubGetAsgardBotProviderMetadata,
|
|
70
|
-
getAnnotations: stubGetAnnotations,
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const headers: Record<string, string> = {};
|
|
75
|
-
|
|
76
|
-
if (config.apiKey) {
|
|
77
|
-
headers['x-api-key'] = config.apiKey;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
async function getAsgardBotProviderMetadata(): Promise<BotProviderMetadataResponse> {
|
|
81
|
-
const response = await fetch(`${config.botProviderEndpoint}/metadata`, {
|
|
82
|
-
method: 'GET',
|
|
83
|
-
headers: {
|
|
84
|
-
...headers,
|
|
85
|
-
'Content-Type': 'application/json',
|
|
86
|
-
},
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
if (!response.ok) {
|
|
90
|
-
throw new Error(`Failed to fetch metadata: ${response.statusText}`);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const json: { data: BotProviderMetadataResponse } = await response.json();
|
|
94
|
-
|
|
95
|
-
return json.data;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
async function getAnnotations(): Promise<Record<string, unknown>> {
|
|
99
|
-
const metadata = await getAsgardBotProviderMetadata();
|
|
100
|
-
|
|
101
|
-
return annotationSelectorFromBotProviderMetadata(metadata);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return {
|
|
105
|
-
getAsgardBotProviderMetadata,
|
|
106
|
-
getAnnotations,
|
|
107
|
-
};
|
|
108
|
-
};
|
package/src/styles/_index.scss
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@forward './styles';
|
package/src/styles/_styles.scss
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@forward './colors';
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
$blue-colors: (
|
|
2
|
-
#edf0fd,
|
|
3
|
-
#d3dbfa,
|
|
4
|
-
#b0bef6,
|
|
5
|
-
#6882ef,
|
|
6
|
-
#8b9ff2,
|
|
7
|
-
#4767eb,
|
|
8
|
-
#3c58c8,
|
|
9
|
-
#3249a7,
|
|
10
|
-
#283b86,
|
|
11
|
-
#202e6a
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
$orange-colors: (
|
|
15
|
-
#ffeded,
|
|
16
|
-
#ffd4d5,
|
|
17
|
-
#ffb2b3,
|
|
18
|
-
#ff8f90,
|
|
19
|
-
#ff6d6f,
|
|
20
|
-
#ff4d4f,
|
|
21
|
-
#d94143,
|
|
22
|
-
#b53738,
|
|
23
|
-
#912c2d,
|
|
24
|
-
#732324
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
$green-colors: (
|
|
28
|
-
#eef9e8,
|
|
29
|
-
#d5f1c8,
|
|
30
|
-
#b5e69d,
|
|
31
|
-
#92da6f,
|
|
32
|
-
#71cf43,
|
|
33
|
-
#52c41a,
|
|
34
|
-
#46a716,
|
|
35
|
-
#3a8b12,
|
|
36
|
-
#2f700f,
|
|
37
|
-
#25580c,
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
$yellow-colors: (
|
|
41
|
-
#fef7eb,
|
|
42
|
-
#fdebcf,
|
|
43
|
-
#fcdba9,
|
|
44
|
-
#facb82,
|
|
45
|
-
#f8bb5c,
|
|
46
|
-
#f7ac38,
|
|
47
|
-
#d29230,
|
|
48
|
-
#af7a28,
|
|
49
|
-
#8d6220,
|
|
50
|
-
#6f4d19,
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
$grey-colors: (
|
|
54
|
-
#f3f3f3,
|
|
55
|
-
#e2e2e2,
|
|
56
|
-
#cbcbcb,
|
|
57
|
-
#b2b2b2,
|
|
58
|
-
#9b9b9b,
|
|
59
|
-
#585858,
|
|
60
|
-
#717171,
|
|
61
|
-
#5e5e5e,
|
|
62
|
-
#4c4c4c,
|
|
63
|
-
#3c3c3c
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
$colors-map: (
|
|
67
|
-
blue: $blue-colors,
|
|
68
|
-
orange: $orange-colors,
|
|
69
|
-
green: $green-colors,
|
|
70
|
-
yellow: $yellow-colors,
|
|
71
|
-
grey: $grey-colors
|
|
72
|
-
);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@forward './palette';
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
@use 'sass:map';
|
|
2
|
-
@use './variables';
|
|
3
|
-
|
|
4
|
-
$prefix: asg-color;
|
|
5
|
-
|
|
6
|
-
@mixin generate-state-colors($map: variables.$state-colors-map) {
|
|
7
|
-
@each $state, $colors-map in $map {
|
|
8
|
-
|
|
9
|
-
$main-color: map.get($colors-map, main);
|
|
10
|
-
$light-color: map.get($colors-map, light);
|
|
11
|
-
$dark-color: map.get($colors-map, dark);
|
|
12
|
-
|
|
13
|
-
--#{$prefix}-#{$state}: #{$main-color};
|
|
14
|
-
--#{$prefix}-#{$state}-light: #{$light-color};
|
|
15
|
-
--#{$prefix}-#{$state}-dark: #{$dark-color};
|
|
16
|
-
--#{$prefix}-#{$state}-on-#{$state}: #ffffff;
|
|
17
|
-
--#{$prefix}-#{$state}-hover-bg: #{rgba($light-color, 0.15)};
|
|
18
|
-
--#{$prefix}-#{$state}-selected-bg: #{rgba($main-color, 0.20)};
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
@mixin generate() {
|
|
23
|
-
@include generate-state-colors();
|
|
24
|
-
|
|
25
|
-
--#{$prefix}-action-active: #ffffff;
|
|
26
|
-
--#{$prefix}-action-inactive: #8c8c8c;
|
|
27
|
-
--#{$prefix}-action-disabled: #595959;
|
|
28
|
-
--#{$prefix}-action-disabled-bg: #393939;
|
|
29
|
-
|
|
30
|
-
--#{$prefix}-text-primary: #ffffff;
|
|
31
|
-
--#{$prefix}-text-secondary: #8c8c8c;
|
|
32
|
-
--#{$prefix}-text-disabled: #595959;
|
|
33
|
-
--#{$prefix}-text-placeholder: #8c8c8c;
|
|
34
|
-
|
|
35
|
-
--#{$prefix}-bg: #141414;
|
|
36
|
-
--#{$prefix}-surface: #1f1f1f;
|
|
37
|
-
--#{$prefix}-divider: #333333;
|
|
38
|
-
--#{$prefix}-border: #434343;
|
|
39
|
-
|
|
40
|
-
--#{$prefix}-overlay-dark: #{rgba(#000000, 0.5)};
|
|
41
|
-
--#{$prefix}-overlay-light: #{rgba(#1f1f1f, 0.9)};
|
|
42
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
@use 'sass:list';
|
|
2
|
-
@use '../colors/variables';
|
|
3
|
-
|
|
4
|
-
$primary-colors: (
|
|
5
|
-
main: list.nth(variables.$blue-colors, 6),
|
|
6
|
-
light: list.nth(variables.$blue-colors, 5),
|
|
7
|
-
dark: list.nth(variables.$blue-colors, 8),
|
|
8
|
-
);
|
|
9
|
-
|
|
10
|
-
$secondary-colors: (
|
|
11
|
-
main: list.nth(variables.$grey-colors, 6),
|
|
12
|
-
light: list.nth(variables.$grey-colors, 4),
|
|
13
|
-
dark: list.nth(variables.$grey-colors, 9),
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
$error-colors: (
|
|
17
|
-
main: list.nth(variables.$orange-colors, 6),
|
|
18
|
-
light: list.nth(variables.$orange-colors, 5),
|
|
19
|
-
dark: list.nth(variables.$orange-colors, 7),
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
$warning-colors: (
|
|
23
|
-
main: list.nth(variables.$yellow-colors, 6),
|
|
24
|
-
light: list.nth(variables.$yellow-colors, 5),
|
|
25
|
-
dark: list.nth(variables.$yellow-colors, 8),
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
$success-colors: (
|
|
29
|
-
main: list.nth(variables.$green-colors, 6),
|
|
30
|
-
light: list.nth(variables.$green-colors, 5),
|
|
31
|
-
dark: list.nth(variables.$green-colors, 8),
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
$state-colors-map: (
|
|
35
|
-
primary: $primary-colors,
|
|
36
|
-
secondary: $secondary-colors,
|
|
37
|
-
error: $error-colors,
|
|
38
|
-
warning: $warning-colors,
|
|
39
|
-
success: $success-colors,
|
|
40
|
-
);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@forward './radius';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@forward './spacing';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@forward './map';
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
@use 'sass:meta';
|
|
2
|
-
@use 'sass:list';
|
|
3
|
-
@use 'sass:map';
|
|
4
|
-
|
|
5
|
-
@mixin generate-vars($prefix, $data) {
|
|
6
|
-
$map: null;
|
|
7
|
-
|
|
8
|
-
@if meta.type-of($data) == "list" {
|
|
9
|
-
$map: ();
|
|
10
|
-
@for $i from 1 through list.length($data) {
|
|
11
|
-
$map: map.merge($map, ($i: list.nth($data, $i)));
|
|
12
|
-
}
|
|
13
|
-
} @else if meta.type-of($data) == "map" {
|
|
14
|
-
$map: $data;
|
|
15
|
-
} @else {
|
|
16
|
-
@warn "generate-vars: The provided data is neither a list nor a map. (type: #{meta.type-of($data)})";
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@each $index, $item in $map {
|
|
20
|
-
--#{$prefix}-#{$index}: #{$item};
|
|
21
|
-
}
|
|
22
|
-
}
|
package/src/test-setup.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|
package/src/utils/deep-merge.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export function isObject(item: unknown): item is Record<string, unknown> {
|
|
2
|
-
return item !== null && typeof item === 'object' && !Array.isArray(item);
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
export function deepMerge<T extends Record<string, unknown>, U extends Record<string, unknown>>(
|
|
6
|
-
target: T,
|
|
7
|
-
source: U
|
|
8
|
-
): T & U {
|
|
9
|
-
const output = { ...target } as T & U;
|
|
10
|
-
|
|
11
|
-
if (!source) return output;
|
|
12
|
-
|
|
13
|
-
for (const [key, value] of Object.entries(source)) {
|
|
14
|
-
if (!isObject(value)) {
|
|
15
|
-
(output as Record<string, unknown>)[key] = value;
|
|
16
|
-
continue;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
(output as Record<string, unknown>)[key] = deepMerge(
|
|
20
|
-
isObject((output as Record<string, unknown>)[key]) ? (output as Record<string, unknown>)[key] as Record<string, unknown> : {},
|
|
21
|
-
value as Record<string, unknown>
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return output;
|
|
26
|
-
}
|
package/src/utils/extractors.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export function extractRefs(obj: unknown): unknown[] {
|
|
2
|
-
const refs: unknown[] = [];
|
|
3
|
-
|
|
4
|
-
function traverse(o: unknown): void {
|
|
5
|
-
if (o && typeof o === 'object') {
|
|
6
|
-
if (Array.isArray(o)) {
|
|
7
|
-
for (const item of o) traverse(item);
|
|
8
|
-
} else {
|
|
9
|
-
for (const key of Object.keys(o))
|
|
10
|
-
traverse((o as Record<string, unknown>)[key]);
|
|
11
|
-
}
|
|
12
|
-
} else {
|
|
13
|
-
refs.push(o);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
traverse(obj);
|
|
18
|
-
|
|
19
|
-
return refs;
|
|
20
|
-
}
|
package/src/utils/format-time.ts
DELETED
package/src/utils/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './format-time';
|
package/src/utils/is.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Performs a deep equality check between two values (primitive, array, plain object).
|
|
3
|
-
* - Functions are compared by reference.
|
|
4
|
-
* - No circular reference support.
|
|
5
|
-
* - Returns true if deeply equal, false otherwise.
|
|
6
|
-
*/
|
|
7
|
-
export function isEqual(a: unknown, b: unknown): boolean {
|
|
8
|
-
// Check for strict equality first (handles primitives and reference equality)
|
|
9
|
-
if (a === b) {
|
|
10
|
-
return true;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// Handle null cases
|
|
14
|
-
if (a === null || b === null) {
|
|
15
|
-
return a === b;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// Compare types
|
|
19
|
-
if (typeof a !== typeof b) {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// Handle arrays
|
|
24
|
-
if (Array.isArray(a) && Array.isArray(b)) {
|
|
25
|
-
if (a.length !== b.length) {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
for (let i = 0; i < a.length; i++) {
|
|
30
|
-
if (!isEqual(a[i], b[i])) {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// If one is array and the other is not
|
|
39
|
-
if (Array.isArray(a) || Array.isArray(b)) {
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Handle objects (but not functions)
|
|
44
|
-
if (typeof a === 'object' && typeof b === 'object') {
|
|
45
|
-
const aKeys = Object.keys(a as object);
|
|
46
|
-
const bKeys = Object.keys(b as object);
|
|
47
|
-
if (aKeys.length !== bKeys.length) {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
for (const key of aKeys) {
|
|
52
|
-
// Use Object.prototype.hasOwnProperty.call to be safe
|
|
53
|
-
if (!Object.prototype.hasOwnProperty.call(b, key)) {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (
|
|
58
|
-
!isEqual(
|
|
59
|
-
(a as Record<string, unknown>)[key],
|
|
60
|
-
(b as Record<string, unknown>)[key]
|
|
61
|
-
)
|
|
62
|
-
) {
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return true;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Fallback for functions, symbols, etc. (compare by reference)
|
|
71
|
-
return a === b;
|
|
72
|
-
}
|
package/src/utils/selectors.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { BotProviderMetadataResponse } from '../models/bot-provider';
|
|
2
|
-
|
|
3
|
-
export const annotationSelectorFromBotProviderMetadata = (
|
|
4
|
-
value: BotProviderMetadataResponse
|
|
5
|
-
): Record<string, unknown> => {
|
|
6
|
-
return JSON.parse(value.annotations['asgard-ai.com/additional-annotation']);
|
|
7
|
-
};
|