oasis-chat 0.1.5 → 0.1.6

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/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "oasis-chat",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Vanilla JS button component with no runtime deps.",
5
5
  "license": "MIT",
6
6
  "scripts": {
7
7
  "dev": "vite",
8
8
  "build": "vite build",
9
- "build:lib": "vite build --config vite.lib.config.js && vite build --config vite.react.config.js && vite build --config vite.vue.config.js && cp src/index.d.ts dist/index.d.ts && mkdir -p dist/react && cp src/react/index.d.ts dist/react/index.d.ts && mkdir -p dist/vue && cp src/vue/index.d.ts dist/vue/index.d.ts && cp dist/oasis-chat.css dist/react/oasis-chat.css && cp dist/oasis-chat.css dist/vue/oasis-chat.css && cp src/service/sw.js dist/sw.js && node scripts/post-build-react.js",
9
+ "build:lib": "vite build --config vite.lib.config.js && vite build --config vite.react.config.js && vite build --config vite.vue.config.js && cp src/index.d.ts dist/index.d.ts && mkdir -p dist/react && cp src/react/index.d.ts dist/react/index.d.ts && mkdir -p dist/vue && cp src/vue/index.d.ts dist/vue/index.d.ts && cp dist/oasis-chat.css dist/react/oasis-chat.css && cp dist/oasis-chat.css dist/vue/oasis-chat.css && node scripts/post-build-react.js",
10
10
  "preview": "vite preview",
11
11
  "format": "prettier --write ."
12
12
  },
@@ -45,8 +45,7 @@
45
45
  "default": "./dist/vue/index.es.js"
46
46
  },
47
47
  "./style.css": "./dist/oasis-chat.css",
48
- "./dist/oasis-chat.css": "./dist/oasis-chat.css",
49
- "./sw.js": "./dist/sw.js"
48
+ "./dist/oasis-chat.css": "./dist/oasis-chat.css"
50
49
  },
51
50
  "sideEffects": [
52
51
  "*.css"
package/dist/sw.js DELETED
@@ -1,79 +0,0 @@
1
- // Oasis Chat Service Worker - 프록시 처리
2
- // 이 파일은 빌드 시 자동으로 TARGET_API가 주입됩니다
3
- const TARGET_API = 'https://oasis-dev.haiqv.ai';
4
-
5
- self.addEventListener('install', (event) => {
6
- // 즉시 활성화하고 이전 Service Worker를 대체
7
- self.skipWaiting();
8
- });
9
-
10
- self.addEventListener('message', (event) => {
11
- if (event.data && event.data.type === 'SKIP_WAITING') {
12
- self.skipWaiting();
13
- }
14
- });
15
-
16
- self.addEventListener('activate', (event) => {
17
- event.waitUntil(self.clients.claim());
18
- });
19
-
20
- self.addEventListener('fetch', (event) => {
21
- const url = new URL(event.request.url);
22
-
23
- // /oasis 경로만 프록시 처리
24
- if (url.pathname.startsWith('/oasis')) {
25
- // /oasis/... -> /api/...로 변환하여 실제 API 서버에 요청
26
- const apiPath = url.pathname.replace('/oasis', '/api');
27
-
28
- // 허용된 헤더만 추출 (CORS 관련 문제 방지)
29
- const headers = new Headers();
30
- const allowedHeaders = [
31
- 'accept',
32
- 'content-type',
33
- 'authorization',
34
- 'cookie', // 쿠키 헤더 추가
35
- 'current-workspace-id',
36
- 'current-workspace-uuid',
37
- ];
38
-
39
- event.request.headers.forEach((value, key) => {
40
- const lowerKey = key.toLowerCase();
41
- if (allowedHeaders.includes(lowerKey)) {
42
- headers.set(key, value);
43
- }
44
- });
45
-
46
- // body가 있는 요청인 경우 (GET, HEAD가 아닌 경우)
47
- const hasBody =
48
- event.request.method !== 'GET' &&
49
- event.request.method !== 'HEAD' &&
50
- event.request.method !== 'OPTIONS';
51
-
52
- if (hasBody) {
53
- // 요청 body를 clone하여 사용
54
- event.respondWith(
55
- event.request
56
- .clone()
57
- .arrayBuffer()
58
- .then((body) => {
59
- return fetch(`${TARGET_API}${apiPath}${url.search}`, {
60
- method: event.request.method,
61
- headers: headers,
62
- credentials: 'include',
63
- mode: 'cors',
64
- body: body.byteLength > 0 ? body : undefined,
65
- });
66
- })
67
- );
68
- } else {
69
- event.respondWith(
70
- fetch(`${TARGET_API}${apiPath}${url.search}`, {
71
- method: event.request.method,
72
- headers: headers,
73
- credentials: 'include',
74
- mode: 'cors',
75
- })
76
- );
77
- }
78
- }
79
- });