ide-assi 0.175.0 → 0.176.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.
@@ -194003,6 +194003,46 @@ class ideAssiSettings extends HTMLElement
194003
194003
 
194004
194004
  customElements.define("ide-assi-settings", ideAssiSettings);
194005
194005
 
194006
+ class IdeFetch {
194007
+ static baseUrl = "/api";
194008
+
194009
+ static #request = (method, url, data = {}) => {
194010
+
194011
+ console.log(method, url, data);
194012
+
194013
+ const fullUrl = method === "GET"
194014
+ ? `${IdeFetch.baseUrl}/${url}?${new URLSearchParams(data)}`
194015
+ : `${IdeFetch.baseUrl}/${url}`;
194016
+
194017
+ const options = {
194018
+ method,
194019
+ headers: { "Content-Type": "application/json" }
194020
+ };
194021
+
194022
+ if (method !== "GET") {
194023
+ options.body = JSON.stringify(data);
194024
+ }
194025
+
194026
+ return fetch(fullUrl, options)
194027
+ .then(res => {
194028
+ if (!res.ok) {
194029
+ return res.text().then(text => {
194030
+ throw new Error(`API 오류 (${res.status}): ${text}`);
194031
+ });
194032
+ }
194033
+ return res.json();
194034
+ })
194035
+ .catch(err => {
194036
+ console.error(`[fetch.${method.toLowerCase()}] ${url} 실패:`, err);
194037
+ throw err;
194038
+ });
194039
+ };
194040
+
194041
+ static get = (url, data = {}) => IdeFetch.#request("GET", url, data);
194042
+
194043
+ static post = (url, data = {}) => IdeFetch.#request("POST", url, data);
194044
+ }
194045
+
194006
194046
  //import "./components/ideAssi.js";
194007
194047
 
194008
194048
 
@@ -194015,5 +194055,6 @@ function defineCustomElements() {
194015
194055
  }
194016
194056
 
194017
194057
  exports.IdeAssi = IdeAssi;
194058
+ exports.api = IdeFetch;
194018
194059
  exports.default = IdeAssi;
194019
194060
  exports.defineCustomElements = defineCustomElements;
@@ -193999,6 +193999,46 @@ class ideAssiSettings extends HTMLElement
193999
193999
 
194000
194000
  customElements.define("ide-assi-settings", ideAssiSettings);
194001
194001
 
194002
+ class IdeFetch {
194003
+ static baseUrl = "/api";
194004
+
194005
+ static #request = (method, url, data = {}) => {
194006
+
194007
+ console.log(method, url, data);
194008
+
194009
+ const fullUrl = method === "GET"
194010
+ ? `${IdeFetch.baseUrl}/${url}?${new URLSearchParams(data)}`
194011
+ : `${IdeFetch.baseUrl}/${url}`;
194012
+
194013
+ const options = {
194014
+ method,
194015
+ headers: { "Content-Type": "application/json" }
194016
+ };
194017
+
194018
+ if (method !== "GET") {
194019
+ options.body = JSON.stringify(data);
194020
+ }
194021
+
194022
+ return fetch(fullUrl, options)
194023
+ .then(res => {
194024
+ if (!res.ok) {
194025
+ return res.text().then(text => {
194026
+ throw new Error(`API 오류 (${res.status}): ${text}`);
194027
+ });
194028
+ }
194029
+ return res.json();
194030
+ })
194031
+ .catch(err => {
194032
+ console.error(`[fetch.${method.toLowerCase()}] ${url} 실패:`, err);
194033
+ throw err;
194034
+ });
194035
+ };
194036
+
194037
+ static get = (url, data = {}) => IdeFetch.#request("GET", url, data);
194038
+
194039
+ static post = (url, data = {}) => IdeFetch.#request("POST", url, data);
194040
+ }
194041
+
194002
194042
  //import "./components/ideAssi.js";
194003
194043
 
194004
194044
 
@@ -194010,4 +194050,4 @@ function defineCustomElements() {
194010
194050
  }
194011
194051
  }
194012
194052
 
194013
- export { IdeAssi, IdeAssi as default, defineCustomElements };
194053
+ export { IdeAssi, IdeFetch as api, IdeAssi as default, defineCustomElements };
package/dist/index.js CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  import { IdeAssi } from "./components/ideAssi.js";
4
4
  import "./components/ideAssiSettings.js";
5
- import "./components/ideFetch.js";
5
+ import { IdeFetch } from "./components/ideFetch.js";
6
6
 
7
- export { IdeAssi }; // Named Export
7
+ export { IdeAssi, IdeFetch as api }; // Named Export
8
8
 
9
9
 
10
10
  // ✅ Custom Elements 등록 함수 정의
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ide-assi",
3
3
  "type": "module",
4
- "version": "0.175.0",
4
+ "version": "0.176.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
package/src/index.js CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  import { IdeAssi } from "./components/ideAssi.js";
4
4
  import "./components/ideAssiSettings.js";
5
- import "./components/ideFetch.js";
5
+ import { IdeFetch } from "./components/ideFetch.js";
6
6
 
7
- export { IdeAssi }; // Named Export
7
+ export { IdeAssi, IdeFetch as api }; // Named Export
8
8
 
9
9
 
10
10
  // ✅ Custom Elements 등록 함수 정의