Skip to content

Commit

Permalink
deploy: 295c106
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Oct 7, 2024
1 parent 6a8cdb9 commit e22e17f
Show file tree
Hide file tree
Showing 10 changed files with 15,902 additions and 12,692 deletions.
2 changes: 1 addition & 1 deletion css/app.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/mjs/servicestack-client.min.mjs

Large diffs are not rendered by default.

98 changes: 60 additions & 38 deletions lib/mjs/servicestack-client.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -745,15 +745,14 @@ export class JsonServiceClient {
static toBase64;
constructor(baseUrl = "/") {
this.baseUrl = baseUrl;
this.replyBaseUrl = combinePaths(baseUrl, "json", "reply") + "/";
this.oneWayBaseUrl = combinePaths(baseUrl, "json", "oneway") + "/";
this.mode = "cors";
this.credentials = "include";
this.headers = new Headers();
this.headers.set("Content-Type", "application/json");
this.manageCookies = typeof document == "undefined"; //because node-fetch doesn't
this.cookies = {};
this.enableAutoRefreshToken = true;
this.basePath = 'api';
}
setCredentials(userName, password) {
this.userName = userName;
Expand All @@ -769,9 +768,6 @@ export class JsonServiceClient {
this.oneWayBaseUrl = combinePaths(this.baseUrl, "json", "oneway") + "/";
}
else {
if (path[0] != '/') {
path = '/' + path;
}
this.replyBaseUrl = combinePaths(this.baseUrl, path) + "/";
this.oneWayBaseUrl = combinePaths(this.baseUrl, path) + "/";
}
Expand Down Expand Up @@ -1053,7 +1049,7 @@ export class JsonServiceClient {
let jwtRequest = this.createRequest({ method: HttpMethods.Post, request: jwtReq, args: null, url });
return fetch(url, jwtRequest)
.then(r => this.createResponse(r, jwtReq).then(jwtResponse => {
this.bearerToken = jwtResponse.accessToken || null;
this.bearerToken = jwtResponse?.accessToken || null;
return resendRequest();
}))
.catch(res => {
Expand Down Expand Up @@ -1134,6 +1130,7 @@ export class JsonApiClient {
let client = new JsonServiceClient(baseUrl).apply(c => {
c.basePath = "/api";
c.headers = new Headers(); //avoid pre-flight CORS requests
c.enableAutoRefreshToken = false; // Use JWT Cookies by default
if (f) {
f(c);
}
Expand All @@ -1142,9 +1139,9 @@ export class JsonApiClient {
}
}
export function getMethod(request, method) {
return (method ?? typeof request.getMethod == "function")
return method ?? (typeof request.getMethod == "function"
? request.getMethod()
: HttpMethods.Post;
: HttpMethods.Post);
}
export function getResponseStatus(e) {
return e.responseStatus ?? e.ResponseStatus ??
Expand Down Expand Up @@ -1226,30 +1223,32 @@ export function toCamelCase(s) { return !s ? s : s.charAt(0).toLowerCase() + s.s
export function toPascalCase(s) { return !s ? s : s.charAt(0).toUpperCase() + s.substring(1); }
export function toKebabCase(s) { return (s || '').replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); }
export function map(o, f) { return o == null ? null : f(o); }
export function camelCaseAny(o) {
if (!o || !(o instanceof Object) || Array.isArray(o))
return o;
let to = {};
for (let k in o) {
if (o.hasOwnProperty(k)) {
const key = toCamelCase(k);
const val = o[k];
if (Array.isArray(val))
to[key] = val.map(x => camelCaseAny(x));
else if (val instanceof Object)
to[key] = camelCaseAny(val);
else
to[key] = val;
}
}
return to;
}
export function sanitize(status) {
if (!sanitize)
return sanitize;
if (status.responseStatus)
return status;
if (status.errors)
return status;
let to = {};
for (let k in status) {
if (status.hasOwnProperty(k)) {
if (status[k] instanceof Object)
to[toCamelCase(k)] = sanitize(status[k]);
else
to[toCamelCase(k)] = status[k];
}
}
to.errors = [];
if (status.Errors != null) {
for (let i = 0, len = status.Errors.length; i < len; i++) {
let o = status.Errors[i];
let err = {};
for (let k in o)
err[toCamelCase(k)] = o[k];
to.errors.push(err);
}
}
let to = camelCaseAny(status);
return to;
}
export function nameOf(o) {
Expand Down Expand Up @@ -1362,7 +1361,11 @@ export function splitTitleCase(s) {
to.push(s.substring(lastSplit, s.length));
return to.filter(x => !!x);
}
export function humanify(s) { return !s || s.indexOf(' ') >= 0 ? s : ucFirst(splitTitleCase(s).join(' ')); }
export function humanify(s) {
return !s || indexOfAny(s, [' ', ',', '.', ':', '-']) >= 0
? s
: ucFirst(splitTitleCase(s).join(' '));
}
export function queryString(url) {
if (!url || url.indexOf('?') === -1)
return {};
Expand Down Expand Up @@ -1430,7 +1433,7 @@ export function appendQueryString(url, args) {
for (let k in args) {
if (args.hasOwnProperty(k)) {
let val = args[k];
if (typeof val == 'undefined')
if (typeof val == 'undefined' || typeof val == 'function' || typeof val == 'symbol')
continue;
url += url.indexOf("?") >= 0 ? "&" : "?";
url += k + (val === null ? '' : "=" + qsValue(val));
Expand Down Expand Up @@ -1756,13 +1759,18 @@ function remClass(el, cls) {
? el.className = el.className.replace(/(\s|^)someclass(\s|$)/, ' ')
: null;
}
export function isElement(el) {
return typeof window != "undefined" && (el instanceof window.Element || el == window.document);
}
export function $1(sel, el) {
return typeof sel === "string" ? (el || document).querySelector(sel) : sel || null;
}
export function $$(sel, el) {
return typeof sel === "string"
? Array.prototype.slice.call((el || document).querySelectorAll(sel))
: Array.isArray(sel) ? sel : [sel];
if (typeof sel === "string")
return Array.from((el || typeof document != "undefined" ? document : null)?.querySelectorAll(sel) ?? []);
if (Array.isArray(sel))
return sel.flatMap(x => $$(x, el));
return [sel];
}
export function on(sel, handlers) {
$$(sel).forEach(e => {
Expand Down Expand Up @@ -2243,20 +2251,34 @@ export function safeVarName(s) {
}
export function pick(o, keys) {
const to = {};
for (const k in o) {
if (o.hasOwnProperty(k) && keys.indexOf(k) >= 0) {
Object.keys(o).forEach(k => {
if (keys.indexOf(k) >= 0) {
to[k] = o[k];
}
}
});
return to;
}
export function omit(o, keys) {
const to = {};
for (const k in o) {
if (o.hasOwnProperty(k) && keys.indexOf(k) < 0) {
if (!o)
return to;
Object.keys(o).forEach(k => {
if (keys.indexOf(k) < 0) {
to[k] = o[k];
}
}
});
return to;
}
export function omitEmpty(o) {
const to = {};
if (!o)
return to;
Object.keys(o).forEach(k => {
const v = o[k];
if (v != null && v !== '') {
to[k] = v;
}
});
return to;
}
export function apply(x, fn) {
Expand Down
52 changes: 26 additions & 26 deletions lib/mjs/servicestack-vue.min.mjs

Large diffs are not rendered by default.

Loading

0 comments on commit e22e17f

Please sign in to comment.