openxiangda 1.0.36 → 1.0.38
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/README.md +10 -0
- package/lib/cli.js +43 -3
- package/lib/workspace-bootstrap.js +238 -0
- package/openxiangda-skills/SKILL.md +42 -3
- package/openxiangda-skills/references/pages/page-sdk.md +32 -0
- package/openxiangda-skills/references/resource-manifest-cheatsheet.md +348 -0
- package/openxiangda-skills/skills/openxiangda-app/SKILL.md +18 -2
- package/openxiangda-skills/skills/openxiangda-core/SKILL.md +37 -1
- package/openxiangda-skills/skills/openxiangda-form/SKILL.md +37 -2
- package/openxiangda-skills/skills/openxiangda-inspect/SKILL.md +26 -2
- package/openxiangda-skills/skills/openxiangda-page/SKILL.md +36 -2
- package/openxiangda-skills/skills/openxiangda-permission-settings/SKILL.md +19 -2
- package/openxiangda-skills/skills/openxiangda-workflow-automation/SKILL.md +26 -2
- package/package.json +1 -1
- package/packages/sdk/dist/runtime/index.cjs +114 -0
- package/packages/sdk/dist/runtime/index.cjs.map +1 -1
- package/packages/sdk/dist/runtime/index.d.mts +14 -1
- package/packages/sdk/dist/runtime/index.d.ts +14 -1
- package/packages/sdk/dist/runtime/index.mjs +114 -0
- package/packages/sdk/dist/runtime/index.mjs.map +1 -1
- package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda-form.mdc +20 -0
- package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda-page.mdc +19 -0
- package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda-resources.mdc +28 -0
- package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda-workflow-automation.mdc +21 -0
- package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda.mdc +47 -0
- package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda-form.md +34 -0
- package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda-page.md +37 -0
- package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda-resources.md +46 -0
- package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda-workflow-automation.md +46 -0
- package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda.md +47 -0
- package/templates/sy-lowcode-app-workspace/AGENTS.md +92 -0
- package/templates/sy-lowcode-app-workspace/package.json +7 -0
- package/templates/sy-lowcode-app-workspace/scripts/guard-publish.mjs +29 -0
|
@@ -361,6 +361,99 @@ var withDefaultAppType = (context, params) => {
|
|
|
361
361
|
}
|
|
362
362
|
return params;
|
|
363
363
|
};
|
|
364
|
+
var AUTH_LOGIN_URL_ENV_KEYS = [
|
|
365
|
+
"loginUrl",
|
|
366
|
+
"authLoginUrl",
|
|
367
|
+
"bathAuthUrl",
|
|
368
|
+
"REACT_APP_VITE_BATH_AUTH_URL",
|
|
369
|
+
"VITE_BATH_AUTH_URL",
|
|
370
|
+
"BATH_AUTH_URL"
|
|
371
|
+
];
|
|
372
|
+
var normalizeOptionalString = (value) => {
|
|
373
|
+
const text = typeof value === "string" ? value.trim() : "";
|
|
374
|
+
return text || void 0;
|
|
375
|
+
};
|
|
376
|
+
var getCurrentHref = () => {
|
|
377
|
+
if (typeof window === "undefined") {
|
|
378
|
+
return "";
|
|
379
|
+
}
|
|
380
|
+
return window.location?.href || "";
|
|
381
|
+
};
|
|
382
|
+
var resolveAuthLoginUrl = (context, options) => {
|
|
383
|
+
const explicitLoginUrl = normalizeOptionalString(options.loginUrl);
|
|
384
|
+
if (explicitLoginUrl) {
|
|
385
|
+
return explicitLoginUrl;
|
|
386
|
+
}
|
|
387
|
+
for (const key of AUTH_LOGIN_URL_ENV_KEYS) {
|
|
388
|
+
const loginUrl = normalizeOptionalString(context.env?.[key]);
|
|
389
|
+
if (loginUrl) {
|
|
390
|
+
return loginUrl;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
return void 0;
|
|
394
|
+
};
|
|
395
|
+
var buildAuthRedirectUrl = (loginUrl, callbackUrl, callbackParamName) => {
|
|
396
|
+
const paramName = normalizeOptionalString(callbackParamName) || "callback";
|
|
397
|
+
const normalizedCallbackUrl = normalizeOptionalString(callbackUrl);
|
|
398
|
+
if (!normalizedCallbackUrl) {
|
|
399
|
+
return loginUrl;
|
|
400
|
+
}
|
|
401
|
+
const baseHref = getCurrentHref() || "http://localhost/";
|
|
402
|
+
const isAbsoluteUrl = /^[a-z][a-z\d+.-]*:/i.test(loginUrl);
|
|
403
|
+
const isProtocolRelativeUrl = loginUrl.startsWith("//");
|
|
404
|
+
const isRootRelativeUrl = loginUrl.startsWith("/");
|
|
405
|
+
try {
|
|
406
|
+
const url = new URL(loginUrl, baseHref);
|
|
407
|
+
url.searchParams.set(paramName, normalizedCallbackUrl);
|
|
408
|
+
if (isAbsoluteUrl || isProtocolRelativeUrl) {
|
|
409
|
+
return url.toString();
|
|
410
|
+
}
|
|
411
|
+
const path = `${url.pathname}${url.search}${url.hash}`;
|
|
412
|
+
return isRootRelativeUrl ? path : path.replace(/^\//, "");
|
|
413
|
+
} catch {
|
|
414
|
+
const hashIndex = loginUrl.indexOf("#");
|
|
415
|
+
const pathAndQuery = hashIndex >= 0 ? loginUrl.slice(0, hashIndex) : loginUrl;
|
|
416
|
+
const hash = hashIndex >= 0 ? loginUrl.slice(hashIndex) : "";
|
|
417
|
+
const separator = pathAndQuery.includes("?") ? "&" : "?";
|
|
418
|
+
return `${pathAndQuery}${separator}${encodeURIComponent(
|
|
419
|
+
paramName
|
|
420
|
+
)}=${encodeURIComponent(normalizedCallbackUrl)}${hash}`;
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
var performRedirect = (url, options) => {
|
|
424
|
+
if (options.redirect) {
|
|
425
|
+
options.redirect(url);
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
if (typeof window === "undefined" || !window.location) {
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
if (options.replace && typeof window.location.replace === "function") {
|
|
432
|
+
window.location.replace(url);
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
window.location.href = url;
|
|
436
|
+
};
|
|
437
|
+
var reloadCurrentPage = () => {
|
|
438
|
+
if (typeof window === "undefined" || !window.location || typeof window.location.reload !== "function") {
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
window.location.reload();
|
|
442
|
+
};
|
|
443
|
+
var redirectAfterLogout = (context, options) => {
|
|
444
|
+
const loginUrl = resolveAuthLoginUrl(context, options);
|
|
445
|
+
const callbackUrl = normalizeOptionalString(options.callbackUrl) || getCurrentHref();
|
|
446
|
+
if (loginUrl) {
|
|
447
|
+
performRedirect(
|
|
448
|
+
buildAuthRedirectUrl(loginUrl, callbackUrl, options.callbackParamName),
|
|
449
|
+
options
|
|
450
|
+
);
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
if (options.fallback !== "none") {
|
|
454
|
+
reloadCurrentPage();
|
|
455
|
+
}
|
|
456
|
+
};
|
|
364
457
|
var createPageSdk = (context) => {
|
|
365
458
|
const request = async (options) => {
|
|
366
459
|
const payload = {
|
|
@@ -401,6 +494,26 @@ var createPageSdk = (context) => {
|
|
|
401
494
|
throw toSdkError(error, payload);
|
|
402
495
|
}
|
|
403
496
|
};
|
|
497
|
+
const logout = () => request({
|
|
498
|
+
path: "/api/auth/logout",
|
|
499
|
+
method: "post"
|
|
500
|
+
});
|
|
501
|
+
const auth = {
|
|
502
|
+
logout,
|
|
503
|
+
logoutAndRedirect: async (options = {}) => {
|
|
504
|
+
try {
|
|
505
|
+
const response = await logout();
|
|
506
|
+
redirectAfterLogout(context, options);
|
|
507
|
+
return response;
|
|
508
|
+
} catch (error) {
|
|
509
|
+
if (options.continueOnLogoutError === false) {
|
|
510
|
+
throw error;
|
|
511
|
+
}
|
|
512
|
+
redirectAfterLogout(context, options);
|
|
513
|
+
return null;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
};
|
|
404
517
|
const connector = {
|
|
405
518
|
invoke: (params) => request({
|
|
406
519
|
path: buildAppPath(
|
|
@@ -1158,6 +1271,7 @@ var createPageSdk = (context) => {
|
|
|
1158
1271
|
request,
|
|
1159
1272
|
download
|
|
1160
1273
|
},
|
|
1274
|
+
auth,
|
|
1161
1275
|
connector,
|
|
1162
1276
|
form,
|
|
1163
1277
|
user,
|