krisspy-sdk 0.8.0 → 0.8.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/index.js +24 -29
- package/dist/index.mjs +24 -29
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2104,37 +2104,32 @@ var KrisspyClient = class {
|
|
|
2104
2104
|
get functions() {
|
|
2105
2105
|
return {
|
|
2106
2106
|
invoke: async (functionName, options) => {
|
|
2107
|
-
if (this.functionsUrl) {
|
|
2108
|
-
|
|
2109
|
-
try {
|
|
2110
|
-
const res = await fetch(url, {
|
|
2111
|
-
method: "POST",
|
|
2112
|
-
headers: __spreadValues({
|
|
2113
|
-
"Content-Type": "application/json"
|
|
2114
|
-
}, options == null ? void 0 : options.headers),
|
|
2115
|
-
body: (options == null ? void 0 : options.body) ? JSON.stringify(options.body) : void 0
|
|
2116
|
-
});
|
|
2117
|
-
const contentType = res.headers.get("content-type");
|
|
2118
|
-
let data = null;
|
|
2119
|
-
if (contentType == null ? void 0 : contentType.includes("application/json")) {
|
|
2120
|
-
data = await res.json();
|
|
2121
|
-
} else {
|
|
2122
|
-
data = await res.text();
|
|
2123
|
-
}
|
|
2124
|
-
if (!res.ok) {
|
|
2125
|
-
return { data: null, error: { message: (data == null ? void 0 : data.error) || (data == null ? void 0 : data.message) || `Request failed with status ${res.status}`, status: res.status } };
|
|
2126
|
-
}
|
|
2127
|
-
return { data, error: null };
|
|
2128
|
-
} catch (err) {
|
|
2129
|
-
return { data: null, error: { message: err.message || "Network error", code: "NETWORK_ERROR", status: 0 } };
|
|
2130
|
-
}
|
|
2107
|
+
if (!this.functionsUrl) {
|
|
2108
|
+
return { data: null, error: { message: 'functionsUrl is required. Pass it in createClient({ functionsUrl: "https://your-func-app.azurewebsites.net" })', code: "CONFIG_ERROR", status: 0 } };
|
|
2131
2109
|
}
|
|
2132
|
-
const
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2110
|
+
const url = `${this.functionsUrl}/api/${functionName}`;
|
|
2111
|
+
try {
|
|
2112
|
+
const res = await fetch(url, {
|
|
2113
|
+
method: "POST",
|
|
2114
|
+
headers: __spreadValues({
|
|
2115
|
+
"Content-Type": "application/json"
|
|
2116
|
+
}, options == null ? void 0 : options.headers),
|
|
2117
|
+
body: (options == null ? void 0 : options.body) ? JSON.stringify(options.body) : void 0
|
|
2118
|
+
});
|
|
2119
|
+
const contentType = res.headers.get("content-type");
|
|
2120
|
+
let data = null;
|
|
2121
|
+
if (contentType == null ? void 0 : contentType.includes("application/json")) {
|
|
2122
|
+
data = await res.json();
|
|
2123
|
+
} else {
|
|
2124
|
+
data = await res.text();
|
|
2125
|
+
}
|
|
2126
|
+
if (!res.ok) {
|
|
2127
|
+
return { data: null, error: { message: (data == null ? void 0 : data.error) || (data == null ? void 0 : data.message) || `Request failed with status ${res.status}`, status: res.status } };
|
|
2128
|
+
}
|
|
2129
|
+
return { data, error: null };
|
|
2130
|
+
} catch (err) {
|
|
2131
|
+
return { data: null, error: { message: err.message || "Network error", code: "NETWORK_ERROR", status: 0 } };
|
|
2136
2132
|
}
|
|
2137
|
-
return { data: response.data, error: null };
|
|
2138
2133
|
},
|
|
2139
2134
|
list: async () => {
|
|
2140
2135
|
var _a, _b;
|
package/dist/index.mjs
CHANGED
|
@@ -2069,37 +2069,32 @@ var KrisspyClient = class {
|
|
|
2069
2069
|
get functions() {
|
|
2070
2070
|
return {
|
|
2071
2071
|
invoke: async (functionName, options) => {
|
|
2072
|
-
if (this.functionsUrl) {
|
|
2073
|
-
|
|
2074
|
-
try {
|
|
2075
|
-
const res = await fetch(url, {
|
|
2076
|
-
method: "POST",
|
|
2077
|
-
headers: __spreadValues({
|
|
2078
|
-
"Content-Type": "application/json"
|
|
2079
|
-
}, options == null ? void 0 : options.headers),
|
|
2080
|
-
body: (options == null ? void 0 : options.body) ? JSON.stringify(options.body) : void 0
|
|
2081
|
-
});
|
|
2082
|
-
const contentType = res.headers.get("content-type");
|
|
2083
|
-
let data = null;
|
|
2084
|
-
if (contentType == null ? void 0 : contentType.includes("application/json")) {
|
|
2085
|
-
data = await res.json();
|
|
2086
|
-
} else {
|
|
2087
|
-
data = await res.text();
|
|
2088
|
-
}
|
|
2089
|
-
if (!res.ok) {
|
|
2090
|
-
return { data: null, error: { message: (data == null ? void 0 : data.error) || (data == null ? void 0 : data.message) || `Request failed with status ${res.status}`, status: res.status } };
|
|
2091
|
-
}
|
|
2092
|
-
return { data, error: null };
|
|
2093
|
-
} catch (err) {
|
|
2094
|
-
return { data: null, error: { message: err.message || "Network error", code: "NETWORK_ERROR", status: 0 } };
|
|
2095
|
-
}
|
|
2072
|
+
if (!this.functionsUrl) {
|
|
2073
|
+
return { data: null, error: { message: 'functionsUrl is required. Pass it in createClient({ functionsUrl: "https://your-func-app.azurewebsites.net" })', code: "CONFIG_ERROR", status: 0 } };
|
|
2096
2074
|
}
|
|
2097
|
-
const
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2075
|
+
const url = `${this.functionsUrl}/api/${functionName}`;
|
|
2076
|
+
try {
|
|
2077
|
+
const res = await fetch(url, {
|
|
2078
|
+
method: "POST",
|
|
2079
|
+
headers: __spreadValues({
|
|
2080
|
+
"Content-Type": "application/json"
|
|
2081
|
+
}, options == null ? void 0 : options.headers),
|
|
2082
|
+
body: (options == null ? void 0 : options.body) ? JSON.stringify(options.body) : void 0
|
|
2083
|
+
});
|
|
2084
|
+
const contentType = res.headers.get("content-type");
|
|
2085
|
+
let data = null;
|
|
2086
|
+
if (contentType == null ? void 0 : contentType.includes("application/json")) {
|
|
2087
|
+
data = await res.json();
|
|
2088
|
+
} else {
|
|
2089
|
+
data = await res.text();
|
|
2090
|
+
}
|
|
2091
|
+
if (!res.ok) {
|
|
2092
|
+
return { data: null, error: { message: (data == null ? void 0 : data.error) || (data == null ? void 0 : data.message) || `Request failed with status ${res.status}`, status: res.status } };
|
|
2093
|
+
}
|
|
2094
|
+
return { data, error: null };
|
|
2095
|
+
} catch (err) {
|
|
2096
|
+
return { data: null, error: { message: err.message || "Network error", code: "NETWORK_ERROR", status: 0 } };
|
|
2101
2097
|
}
|
|
2102
|
-
return { data: response.data, error: null };
|
|
2103
2098
|
},
|
|
2104
2099
|
list: async () => {
|
|
2105
2100
|
var _a, _b;
|