openxiangda 1.0.37 → 1.0.39
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 +2 -1
- package/lib/cli.js +135 -5
- package/openxiangda-skills/SKILL.md +2 -2
- package/openxiangda-skills/references/connector-resources.md +1 -1
- package/openxiangda-skills/references/data-views.md +130 -5
- package/openxiangda-skills/references/pages/page-sdk.md +62 -2
- package/openxiangda-skills/references/resource-manifest-cheatsheet.md +37 -1
- package/openxiangda-skills/skills/openxiangda-page/SKILL.md +1 -1
- package/package.json +1 -1
- package/packages/sdk/dist/runtime/index.cjs +151 -1
- package/packages/sdk/dist/runtime/index.cjs.map +1 -1
- package/packages/sdk/dist/runtime/index.d.mts +18 -1
- package/packages/sdk/dist/runtime/index.d.ts +18 -1
- package/packages/sdk/dist/runtime/index.mjs +151 -1
- package/packages/sdk/dist/runtime/index.mjs.map +1 -1
|
@@ -325,6 +325,9 @@ interface DataViewQueryParams {
|
|
|
325
325
|
pageSize?: number;
|
|
326
326
|
order?: SearchSortItem | SearchSortItem[];
|
|
327
327
|
}
|
|
328
|
+
interface DataViewStatsParams extends DataViewQueryParams {
|
|
329
|
+
having?: SearchExpression | string;
|
|
330
|
+
}
|
|
328
331
|
interface DataViewQueryResult<TItem = unknown> extends PageListResult<TItem> {
|
|
329
332
|
pageSize: number;
|
|
330
333
|
lastRefreshedAt?: string | null;
|
|
@@ -742,6 +745,15 @@ interface ConnectorInvokeResult<TResult = unknown> {
|
|
|
742
745
|
}
|
|
743
746
|
interface ConnectorCallParams<TBody = unknown> extends Omit<ConnectorInvokeParams<TBody>, "connector" | "api"> {
|
|
744
747
|
}
|
|
748
|
+
interface AuthLogoutRedirectOptions {
|
|
749
|
+
loginUrl?: string;
|
|
750
|
+
callbackUrl?: string;
|
|
751
|
+
callbackParamName?: string;
|
|
752
|
+
replace?: boolean;
|
|
753
|
+
continueOnLogoutError?: boolean;
|
|
754
|
+
fallback?: "reload" | "none";
|
|
755
|
+
redirect?: (url: string) => void;
|
|
756
|
+
}
|
|
745
757
|
interface PageSdk {
|
|
746
758
|
context: PageContext;
|
|
747
759
|
request<TResult = unknown, TRaw = TResult>(options: PageRequestOptions): Promise<PageApiResponse<TResult, TRaw>>;
|
|
@@ -750,6 +762,10 @@ interface PageSdk {
|
|
|
750
762
|
request<TResult = unknown, TRaw = TResult>(options: PageRequestOptions): Promise<PageApiResponse<TResult, TRaw>>;
|
|
751
763
|
download(options: PageRequestOptions): Promise<PageBinaryResponse>;
|
|
752
764
|
};
|
|
765
|
+
auth: {
|
|
766
|
+
logout<T = boolean>(): Promise<PageApiResponse<T>>;
|
|
767
|
+
logoutAndRedirect<T = boolean>(options?: AuthLogoutRedirectOptions): Promise<PageApiResponse<T> | null>;
|
|
768
|
+
};
|
|
753
769
|
connector: {
|
|
754
770
|
invoke<TResult = unknown, TBody = unknown>(params: ConnectorInvokeParams<TBody>): Promise<PageApiResponse<ConnectorInvokeResult<TResult>>>;
|
|
755
771
|
call<TResult = unknown, TBody = unknown>(name: string, params?: ConnectorCallParams<TBody>): Promise<PageApiResponse<ConnectorInvokeResult<TResult>>>;
|
|
@@ -863,6 +879,7 @@ interface PageSdk {
|
|
|
863
879
|
};
|
|
864
880
|
dataView: {
|
|
865
881
|
query<T = unknown>(code: string, params?: DataViewQueryParams): Promise<PageApiResponse<DataViewQueryResult<T>>>;
|
|
882
|
+
stats<T = unknown>(code: string, params?: DataViewStatsParams): Promise<PageApiResponse<DataViewQueryResult<T>>>;
|
|
866
883
|
};
|
|
867
884
|
notification: {
|
|
868
885
|
sendByType<T = SendNotificationResult>(params: SendNotificationByTypeParams): Promise<PageApiResponse<T>>;
|
|
@@ -948,4 +965,4 @@ declare const usePageRoute: () => PageRouteInfo;
|
|
|
948
965
|
|
|
949
966
|
declare const usePageSdk: () => PageSdk;
|
|
950
967
|
|
|
951
|
-
export { type ApiPermissionListParams, type ApproveTaskParams, type AssignPermissionsParams, type AssignRolesParams, type BatchAddUsersToRoleParams, type BatchSendNotificationByTypeParams, type ChangeUserRoleParams, type ConnectorCallParams, type ConnectorInvokeParams, type ConnectorInvokeResult, type ConnectorRequestBodyType, type ConnectorResponseType, type CreateApiPermissionParams, type CreateFormPermissionGroupDto, type CreatePagePermissionGroupDto, type CreateRoleParams, type CreateUiPermissionParams, type CreateUserParams, type CurrentUserDepartmentParents, type CustomPageEntryConfig, type CustomPageEntryMode, type DataManagementConfigParams, type DataManagementFilterState, type DataPermissionConditionDto, type DataPermissionDto, type DataPermissionRuleDto, type DataViewQueryParams, type DataViewQueryResult, type FieldPermissionDto, type FindNotificationConfigParams, type FormAdvancedSearchParams, type FormChangeRecordParams, type FormCreateParams, type FormExportParams, type FormGetDetailParams, type FormImportParams, type FormPermissionGroup, type FormRemoveParams, type FormSearchParams, type FormUpdateParams, type GetParentDepartmentsOptions, type GetProcessInstanceParams, type GetUserRolesParams, type ImportExportRecordDownloadParams, type ImportExportRecordQuery, type InstanceStatus, type NotificationChannel, type NotificationChannelConfig, type NotificationChannelsConfig, type NotificationConfigLevel, type NotificationMessageRecord, type NotificationTemplate, type NotificationTemplatePreview, type NotificationTypeConfig, type PageApiPermissionRecord, type PageApiResponse, type PageAppInfo, type PageBinaryResponse, type PageBridgeApi, type PageContext, type PageDataManagementConfig, type PageDataSourceDescriptor, type PageDepartmentInfo, type PageDepartmentRecord, type PageHttpMethod, type PageInfo, type PageListResult, type PageMessageApi, type PageModalApi, type PageNavigationApi, type PageOffsetListResult, type PagePermissionGroup, type PagePermissionInfo, PageProvider, type PageQueryValue, type PageRequestOptions, type PageRoleRecord, type PageRouteInfo, type PageScope, type PageSdk, type PageSdkError, type PageSdkMeta, type PageTransportDownloadPayload, type PageTransportRequestPayload, type PageUiPermissionRecord, type PageUiPermissionType, type PageUserInfo, type PageUserRecord, type PageUserType, type PreviewNotificationTemplateParams, type ProcessApproveAction, type QueryFormPermissionGroupDto, type QueryPagePermissionGroupDto, type RoleListParams, type RoleUsersParams, type SaveDataManagementConfigParams, type SearchComponentName, type SearchExpression, type SearchFieldKey, type SearchGroup, type SearchLogic, type SearchOperator, type SearchRule, type SearchSortItem, type SearchSystemField, type SendNotificationByTypeParams, type SendNotificationResult, type SubFormRule, type SwitchAppRoleParams, type SwitchPlatformRoleParams, type TerminateProcessInstanceParams, type TriggerCallbackTaskParams, type UiPermissionListParams, type UpdateApiPermissionParams, type UpdateFormPermissionGroupDto, type UpdatePagePermissionGroupDto, type UpdateRoleParams, type UpdateUiPermissionParams, type UpdateUserParams, type UserListParams, type UserMenuPermissionsResponse, type ValidateUserParams, type ViewFieldPermissionValue, type ViewOperationPermission, type ViewPermissionSummary, createPageSdk, createReactPage, useCurrentUser, useDataSource, useFormViewPermissions, useMessage, useModal, useNavigation, usePageContext, usePageProps, usePageRoute, usePageSdk };
|
|
968
|
+
export { type ApiPermissionListParams, type ApproveTaskParams, type AssignPermissionsParams, type AssignRolesParams, type AuthLogoutRedirectOptions, type BatchAddUsersToRoleParams, type BatchSendNotificationByTypeParams, type ChangeUserRoleParams, type ConnectorCallParams, type ConnectorInvokeParams, type ConnectorInvokeResult, type ConnectorRequestBodyType, type ConnectorResponseType, type CreateApiPermissionParams, type CreateFormPermissionGroupDto, type CreatePagePermissionGroupDto, type CreateRoleParams, type CreateUiPermissionParams, type CreateUserParams, type CurrentUserDepartmentParents, type CustomPageEntryConfig, type CustomPageEntryMode, type DataManagementConfigParams, type DataManagementFilterState, type DataPermissionConditionDto, type DataPermissionDto, type DataPermissionRuleDto, type DataViewQueryParams, type DataViewQueryResult, type DataViewStatsParams, type FieldPermissionDto, type FindNotificationConfigParams, type FormAdvancedSearchParams, type FormChangeRecordParams, type FormCreateParams, type FormExportParams, type FormGetDetailParams, type FormImportParams, type FormPermissionGroup, type FormRemoveParams, type FormSearchParams, type FormUpdateParams, type GetParentDepartmentsOptions, type GetProcessInstanceParams, type GetUserRolesParams, type ImportExportRecordDownloadParams, type ImportExportRecordQuery, type InstanceStatus, type NotificationChannel, type NotificationChannelConfig, type NotificationChannelsConfig, type NotificationConfigLevel, type NotificationMessageRecord, type NotificationTemplate, type NotificationTemplatePreview, type NotificationTypeConfig, type PageApiPermissionRecord, type PageApiResponse, type PageAppInfo, type PageBinaryResponse, type PageBridgeApi, type PageContext, type PageDataManagementConfig, type PageDataSourceDescriptor, type PageDepartmentInfo, type PageDepartmentRecord, type PageHttpMethod, type PageInfo, type PageListResult, type PageMessageApi, type PageModalApi, type PageNavigationApi, type PageOffsetListResult, type PagePermissionGroup, type PagePermissionInfo, PageProvider, type PageQueryValue, type PageRequestOptions, type PageRoleRecord, type PageRouteInfo, type PageScope, type PageSdk, type PageSdkError, type PageSdkMeta, type PageTransportDownloadPayload, type PageTransportRequestPayload, type PageUiPermissionRecord, type PageUiPermissionType, type PageUserInfo, type PageUserRecord, type PageUserType, type PreviewNotificationTemplateParams, type ProcessApproveAction, type QueryFormPermissionGroupDto, type QueryPagePermissionGroupDto, type RoleListParams, type RoleUsersParams, type SaveDataManagementConfigParams, type SearchComponentName, type SearchExpression, type SearchFieldKey, type SearchGroup, type SearchLogic, type SearchOperator, type SearchRule, type SearchSortItem, type SearchSystemField, type SendNotificationByTypeParams, type SendNotificationResult, type SubFormRule, type SwitchAppRoleParams, type SwitchPlatformRoleParams, type TerminateProcessInstanceParams, type TriggerCallbackTaskParams, type UiPermissionListParams, type UpdateApiPermissionParams, type UpdateFormPermissionGroupDto, type UpdatePagePermissionGroupDto, type UpdateRoleParams, type UpdateUiPermissionParams, type UpdateUserParams, type UserListParams, type UserMenuPermissionsResponse, type ValidateUserParams, type ViewFieldPermissionValue, type ViewOperationPermission, type ViewPermissionSummary, createPageSdk, createReactPage, useCurrentUser, useDataSource, useFormViewPermissions, useMessage, useModal, useNavigation, usePageContext, usePageProps, usePageRoute, usePageSdk };
|
|
@@ -325,6 +325,9 @@ interface DataViewQueryParams {
|
|
|
325
325
|
pageSize?: number;
|
|
326
326
|
order?: SearchSortItem | SearchSortItem[];
|
|
327
327
|
}
|
|
328
|
+
interface DataViewStatsParams extends DataViewQueryParams {
|
|
329
|
+
having?: SearchExpression | string;
|
|
330
|
+
}
|
|
328
331
|
interface DataViewQueryResult<TItem = unknown> extends PageListResult<TItem> {
|
|
329
332
|
pageSize: number;
|
|
330
333
|
lastRefreshedAt?: string | null;
|
|
@@ -742,6 +745,15 @@ interface ConnectorInvokeResult<TResult = unknown> {
|
|
|
742
745
|
}
|
|
743
746
|
interface ConnectorCallParams<TBody = unknown> extends Omit<ConnectorInvokeParams<TBody>, "connector" | "api"> {
|
|
744
747
|
}
|
|
748
|
+
interface AuthLogoutRedirectOptions {
|
|
749
|
+
loginUrl?: string;
|
|
750
|
+
callbackUrl?: string;
|
|
751
|
+
callbackParamName?: string;
|
|
752
|
+
replace?: boolean;
|
|
753
|
+
continueOnLogoutError?: boolean;
|
|
754
|
+
fallback?: "reload" | "none";
|
|
755
|
+
redirect?: (url: string) => void;
|
|
756
|
+
}
|
|
745
757
|
interface PageSdk {
|
|
746
758
|
context: PageContext;
|
|
747
759
|
request<TResult = unknown, TRaw = TResult>(options: PageRequestOptions): Promise<PageApiResponse<TResult, TRaw>>;
|
|
@@ -750,6 +762,10 @@ interface PageSdk {
|
|
|
750
762
|
request<TResult = unknown, TRaw = TResult>(options: PageRequestOptions): Promise<PageApiResponse<TResult, TRaw>>;
|
|
751
763
|
download(options: PageRequestOptions): Promise<PageBinaryResponse>;
|
|
752
764
|
};
|
|
765
|
+
auth: {
|
|
766
|
+
logout<T = boolean>(): Promise<PageApiResponse<T>>;
|
|
767
|
+
logoutAndRedirect<T = boolean>(options?: AuthLogoutRedirectOptions): Promise<PageApiResponse<T> | null>;
|
|
768
|
+
};
|
|
753
769
|
connector: {
|
|
754
770
|
invoke<TResult = unknown, TBody = unknown>(params: ConnectorInvokeParams<TBody>): Promise<PageApiResponse<ConnectorInvokeResult<TResult>>>;
|
|
755
771
|
call<TResult = unknown, TBody = unknown>(name: string, params?: ConnectorCallParams<TBody>): Promise<PageApiResponse<ConnectorInvokeResult<TResult>>>;
|
|
@@ -863,6 +879,7 @@ interface PageSdk {
|
|
|
863
879
|
};
|
|
864
880
|
dataView: {
|
|
865
881
|
query<T = unknown>(code: string, params?: DataViewQueryParams): Promise<PageApiResponse<DataViewQueryResult<T>>>;
|
|
882
|
+
stats<T = unknown>(code: string, params?: DataViewStatsParams): Promise<PageApiResponse<DataViewQueryResult<T>>>;
|
|
866
883
|
};
|
|
867
884
|
notification: {
|
|
868
885
|
sendByType<T = SendNotificationResult>(params: SendNotificationByTypeParams): Promise<PageApiResponse<T>>;
|
|
@@ -948,4 +965,4 @@ declare const usePageRoute: () => PageRouteInfo;
|
|
|
948
965
|
|
|
949
966
|
declare const usePageSdk: () => PageSdk;
|
|
950
967
|
|
|
951
|
-
export { type ApiPermissionListParams, type ApproveTaskParams, type AssignPermissionsParams, type AssignRolesParams, type BatchAddUsersToRoleParams, type BatchSendNotificationByTypeParams, type ChangeUserRoleParams, type ConnectorCallParams, type ConnectorInvokeParams, type ConnectorInvokeResult, type ConnectorRequestBodyType, type ConnectorResponseType, type CreateApiPermissionParams, type CreateFormPermissionGroupDto, type CreatePagePermissionGroupDto, type CreateRoleParams, type CreateUiPermissionParams, type CreateUserParams, type CurrentUserDepartmentParents, type CustomPageEntryConfig, type CustomPageEntryMode, type DataManagementConfigParams, type DataManagementFilterState, type DataPermissionConditionDto, type DataPermissionDto, type DataPermissionRuleDto, type DataViewQueryParams, type DataViewQueryResult, type FieldPermissionDto, type FindNotificationConfigParams, type FormAdvancedSearchParams, type FormChangeRecordParams, type FormCreateParams, type FormExportParams, type FormGetDetailParams, type FormImportParams, type FormPermissionGroup, type FormRemoveParams, type FormSearchParams, type FormUpdateParams, type GetParentDepartmentsOptions, type GetProcessInstanceParams, type GetUserRolesParams, type ImportExportRecordDownloadParams, type ImportExportRecordQuery, type InstanceStatus, type NotificationChannel, type NotificationChannelConfig, type NotificationChannelsConfig, type NotificationConfigLevel, type NotificationMessageRecord, type NotificationTemplate, type NotificationTemplatePreview, type NotificationTypeConfig, type PageApiPermissionRecord, type PageApiResponse, type PageAppInfo, type PageBinaryResponse, type PageBridgeApi, type PageContext, type PageDataManagementConfig, type PageDataSourceDescriptor, type PageDepartmentInfo, type PageDepartmentRecord, type PageHttpMethod, type PageInfo, type PageListResult, type PageMessageApi, type PageModalApi, type PageNavigationApi, type PageOffsetListResult, type PagePermissionGroup, type PagePermissionInfo, PageProvider, type PageQueryValue, type PageRequestOptions, type PageRoleRecord, type PageRouteInfo, type PageScope, type PageSdk, type PageSdkError, type PageSdkMeta, type PageTransportDownloadPayload, type PageTransportRequestPayload, type PageUiPermissionRecord, type PageUiPermissionType, type PageUserInfo, type PageUserRecord, type PageUserType, type PreviewNotificationTemplateParams, type ProcessApproveAction, type QueryFormPermissionGroupDto, type QueryPagePermissionGroupDto, type RoleListParams, type RoleUsersParams, type SaveDataManagementConfigParams, type SearchComponentName, type SearchExpression, type SearchFieldKey, type SearchGroup, type SearchLogic, type SearchOperator, type SearchRule, type SearchSortItem, type SearchSystemField, type SendNotificationByTypeParams, type SendNotificationResult, type SubFormRule, type SwitchAppRoleParams, type SwitchPlatformRoleParams, type TerminateProcessInstanceParams, type TriggerCallbackTaskParams, type UiPermissionListParams, type UpdateApiPermissionParams, type UpdateFormPermissionGroupDto, type UpdatePagePermissionGroupDto, type UpdateRoleParams, type UpdateUiPermissionParams, type UpdateUserParams, type UserListParams, type UserMenuPermissionsResponse, type ValidateUserParams, type ViewFieldPermissionValue, type ViewOperationPermission, type ViewPermissionSummary, createPageSdk, createReactPage, useCurrentUser, useDataSource, useFormViewPermissions, useMessage, useModal, useNavigation, usePageContext, usePageProps, usePageRoute, usePageSdk };
|
|
968
|
+
export { type ApiPermissionListParams, type ApproveTaskParams, type AssignPermissionsParams, type AssignRolesParams, type AuthLogoutRedirectOptions, type BatchAddUsersToRoleParams, type BatchSendNotificationByTypeParams, type ChangeUserRoleParams, type ConnectorCallParams, type ConnectorInvokeParams, type ConnectorInvokeResult, type ConnectorRequestBodyType, type ConnectorResponseType, type CreateApiPermissionParams, type CreateFormPermissionGroupDto, type CreatePagePermissionGroupDto, type CreateRoleParams, type CreateUiPermissionParams, type CreateUserParams, type CurrentUserDepartmentParents, type CustomPageEntryConfig, type CustomPageEntryMode, type DataManagementConfigParams, type DataManagementFilterState, type DataPermissionConditionDto, type DataPermissionDto, type DataPermissionRuleDto, type DataViewQueryParams, type DataViewQueryResult, type DataViewStatsParams, type FieldPermissionDto, type FindNotificationConfigParams, type FormAdvancedSearchParams, type FormChangeRecordParams, type FormCreateParams, type FormExportParams, type FormGetDetailParams, type FormImportParams, type FormPermissionGroup, type FormRemoveParams, type FormSearchParams, type FormUpdateParams, type GetParentDepartmentsOptions, type GetProcessInstanceParams, type GetUserRolesParams, type ImportExportRecordDownloadParams, type ImportExportRecordQuery, type InstanceStatus, type NotificationChannel, type NotificationChannelConfig, type NotificationChannelsConfig, type NotificationConfigLevel, type NotificationMessageRecord, type NotificationTemplate, type NotificationTemplatePreview, type NotificationTypeConfig, type PageApiPermissionRecord, type PageApiResponse, type PageAppInfo, type PageBinaryResponse, type PageBridgeApi, type PageContext, type PageDataManagementConfig, type PageDataSourceDescriptor, type PageDepartmentInfo, type PageDepartmentRecord, type PageHttpMethod, type PageInfo, type PageListResult, type PageMessageApi, type PageModalApi, type PageNavigationApi, type PageOffsetListResult, type PagePermissionGroup, type PagePermissionInfo, PageProvider, type PageQueryValue, type PageRequestOptions, type PageRoleRecord, type PageRouteInfo, type PageScope, type PageSdk, type PageSdkError, type PageSdkMeta, type PageTransportDownloadPayload, type PageTransportRequestPayload, type PageUiPermissionRecord, type PageUiPermissionType, type PageUserInfo, type PageUserRecord, type PageUserType, type PreviewNotificationTemplateParams, type ProcessApproveAction, type QueryFormPermissionGroupDto, type QueryPagePermissionGroupDto, type RoleListParams, type RoleUsersParams, type SaveDataManagementConfigParams, type SearchComponentName, type SearchExpression, type SearchFieldKey, type SearchGroup, type SearchLogic, type SearchOperator, type SearchRule, type SearchSortItem, type SearchSystemField, type SendNotificationByTypeParams, type SendNotificationResult, type SubFormRule, type SwitchAppRoleParams, type SwitchPlatformRoleParams, type TerminateProcessInstanceParams, type TriggerCallbackTaskParams, type UiPermissionListParams, type UpdateApiPermissionParams, type UpdateFormPermissionGroupDto, type UpdatePagePermissionGroupDto, type UpdateRoleParams, type UpdateUiPermissionParams, type UpdateUserParams, type UserListParams, type UserMenuPermissionsResponse, type ValidateUserParams, type ViewFieldPermissionValue, type ViewOperationPermission, type ViewPermissionSummary, createPageSdk, createReactPage, useCurrentUser, useDataSource, useFormViewPermissions, useMessage, useModal, useNavigation, usePageContext, usePageProps, usePageRoute, usePageSdk };
|
|
@@ -313,6 +313,99 @@ var withDefaultAppType = (context, params) => {
|
|
|
313
313
|
}
|
|
314
314
|
return params;
|
|
315
315
|
};
|
|
316
|
+
var AUTH_LOGIN_URL_ENV_KEYS = [
|
|
317
|
+
"loginUrl",
|
|
318
|
+
"authLoginUrl",
|
|
319
|
+
"bathAuthUrl",
|
|
320
|
+
"REACT_APP_VITE_BATH_AUTH_URL",
|
|
321
|
+
"VITE_BATH_AUTH_URL",
|
|
322
|
+
"BATH_AUTH_URL"
|
|
323
|
+
];
|
|
324
|
+
var normalizeOptionalString = (value) => {
|
|
325
|
+
const text = typeof value === "string" ? value.trim() : "";
|
|
326
|
+
return text || void 0;
|
|
327
|
+
};
|
|
328
|
+
var getCurrentHref = () => {
|
|
329
|
+
if (typeof window === "undefined") {
|
|
330
|
+
return "";
|
|
331
|
+
}
|
|
332
|
+
return window.location?.href || "";
|
|
333
|
+
};
|
|
334
|
+
var resolveAuthLoginUrl = (context, options) => {
|
|
335
|
+
const explicitLoginUrl = normalizeOptionalString(options.loginUrl);
|
|
336
|
+
if (explicitLoginUrl) {
|
|
337
|
+
return explicitLoginUrl;
|
|
338
|
+
}
|
|
339
|
+
for (const key of AUTH_LOGIN_URL_ENV_KEYS) {
|
|
340
|
+
const loginUrl = normalizeOptionalString(context.env?.[key]);
|
|
341
|
+
if (loginUrl) {
|
|
342
|
+
return loginUrl;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return void 0;
|
|
346
|
+
};
|
|
347
|
+
var buildAuthRedirectUrl = (loginUrl, callbackUrl, callbackParamName) => {
|
|
348
|
+
const paramName = normalizeOptionalString(callbackParamName) || "callback";
|
|
349
|
+
const normalizedCallbackUrl = normalizeOptionalString(callbackUrl);
|
|
350
|
+
if (!normalizedCallbackUrl) {
|
|
351
|
+
return loginUrl;
|
|
352
|
+
}
|
|
353
|
+
const baseHref = getCurrentHref() || "http://localhost/";
|
|
354
|
+
const isAbsoluteUrl = /^[a-z][a-z\d+.-]*:/i.test(loginUrl);
|
|
355
|
+
const isProtocolRelativeUrl = loginUrl.startsWith("//");
|
|
356
|
+
const isRootRelativeUrl = loginUrl.startsWith("/");
|
|
357
|
+
try {
|
|
358
|
+
const url = new URL(loginUrl, baseHref);
|
|
359
|
+
url.searchParams.set(paramName, normalizedCallbackUrl);
|
|
360
|
+
if (isAbsoluteUrl || isProtocolRelativeUrl) {
|
|
361
|
+
return url.toString();
|
|
362
|
+
}
|
|
363
|
+
const path = `${url.pathname}${url.search}${url.hash}`;
|
|
364
|
+
return isRootRelativeUrl ? path : path.replace(/^\//, "");
|
|
365
|
+
} catch {
|
|
366
|
+
const hashIndex = loginUrl.indexOf("#");
|
|
367
|
+
const pathAndQuery = hashIndex >= 0 ? loginUrl.slice(0, hashIndex) : loginUrl;
|
|
368
|
+
const hash = hashIndex >= 0 ? loginUrl.slice(hashIndex) : "";
|
|
369
|
+
const separator = pathAndQuery.includes("?") ? "&" : "?";
|
|
370
|
+
return `${pathAndQuery}${separator}${encodeURIComponent(
|
|
371
|
+
paramName
|
|
372
|
+
)}=${encodeURIComponent(normalizedCallbackUrl)}${hash}`;
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
var performRedirect = (url, options) => {
|
|
376
|
+
if (options.redirect) {
|
|
377
|
+
options.redirect(url);
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
if (typeof window === "undefined" || !window.location) {
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
if (options.replace && typeof window.location.replace === "function") {
|
|
384
|
+
window.location.replace(url);
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
window.location.href = url;
|
|
388
|
+
};
|
|
389
|
+
var reloadCurrentPage = () => {
|
|
390
|
+
if (typeof window === "undefined" || !window.location || typeof window.location.reload !== "function") {
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
window.location.reload();
|
|
394
|
+
};
|
|
395
|
+
var redirectAfterLogout = (context, options) => {
|
|
396
|
+
const loginUrl = resolveAuthLoginUrl(context, options);
|
|
397
|
+
const callbackUrl = normalizeOptionalString(options.callbackUrl) || getCurrentHref();
|
|
398
|
+
if (loginUrl) {
|
|
399
|
+
performRedirect(
|
|
400
|
+
buildAuthRedirectUrl(loginUrl, callbackUrl, options.callbackParamName),
|
|
401
|
+
options
|
|
402
|
+
);
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
if (options.fallback !== "none") {
|
|
406
|
+
reloadCurrentPage();
|
|
407
|
+
}
|
|
408
|
+
};
|
|
316
409
|
var createPageSdk = (context) => {
|
|
317
410
|
const request = async (options) => {
|
|
318
411
|
const payload = {
|
|
@@ -353,6 +446,26 @@ var createPageSdk = (context) => {
|
|
|
353
446
|
throw toSdkError(error, payload);
|
|
354
447
|
}
|
|
355
448
|
};
|
|
449
|
+
const logout = () => request({
|
|
450
|
+
path: "/api/auth/logout",
|
|
451
|
+
method: "post"
|
|
452
|
+
});
|
|
453
|
+
const auth = {
|
|
454
|
+
logout,
|
|
455
|
+
logoutAndRedirect: async (options = {}) => {
|
|
456
|
+
try {
|
|
457
|
+
const response = await logout();
|
|
458
|
+
redirectAfterLogout(context, options);
|
|
459
|
+
return response;
|
|
460
|
+
} catch (error) {
|
|
461
|
+
if (options.continueOnLogoutError === false) {
|
|
462
|
+
throw error;
|
|
463
|
+
}
|
|
464
|
+
redirectAfterLogout(context, options);
|
|
465
|
+
return null;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
};
|
|
356
469
|
const connector = {
|
|
357
470
|
invoke: (params) => request({
|
|
358
471
|
path: buildAppPath(
|
|
@@ -1053,6 +1166,30 @@ var createPageSdk = (context) => {
|
|
|
1053
1166
|
order: Array.isArray(params.order) ? params.order : params.order ? [params.order] : void 0
|
|
1054
1167
|
}
|
|
1055
1168
|
});
|
|
1169
|
+
},
|
|
1170
|
+
stats: (code, params = {}) => {
|
|
1171
|
+
const dataViewCode = String(code || "").trim();
|
|
1172
|
+
if (!dataViewCode) {
|
|
1173
|
+
throw new Error("\u6570\u636E\u89C6\u56FE code \u4E0D\u80FD\u4E3A\u7A7A");
|
|
1174
|
+
}
|
|
1175
|
+
return request({
|
|
1176
|
+
path: buildAppPath(
|
|
1177
|
+
context,
|
|
1178
|
+
params.appType,
|
|
1179
|
+
`/v1/data-views/${encodePathSegment(dataViewCode)}/stats.json`
|
|
1180
|
+
),
|
|
1181
|
+
method: "post",
|
|
1182
|
+
body: {
|
|
1183
|
+
fields: params.fields,
|
|
1184
|
+
filters: serializeSearchExpression(params.filters),
|
|
1185
|
+
having: serializeSearchExpression(params.having),
|
|
1186
|
+
conditionType: params.conditionType,
|
|
1187
|
+
searchKeyWord: params.searchKeyWord,
|
|
1188
|
+
currentPage: params.currentPage,
|
|
1189
|
+
pageSize: params.pageSize,
|
|
1190
|
+
order: Array.isArray(params.order) ? params.order : params.order ? [params.order] : void 0
|
|
1191
|
+
}
|
|
1192
|
+
});
|
|
1056
1193
|
}
|
|
1057
1194
|
};
|
|
1058
1195
|
const notification = {
|
|
@@ -1110,6 +1247,7 @@ var createPageSdk = (context) => {
|
|
|
1110
1247
|
request,
|
|
1111
1248
|
download
|
|
1112
1249
|
},
|
|
1250
|
+
auth,
|
|
1113
1251
|
connector,
|
|
1114
1252
|
form,
|
|
1115
1253
|
user,
|
|
@@ -1132,7 +1270,8 @@ var createPageSdk = (context) => {
|
|
|
1132
1270
|
runtimeParams.formUuid || descriptor.formUuid || ""
|
|
1133
1271
|
).trim();
|
|
1134
1272
|
switch (descriptor.type) {
|
|
1135
|
-
case "dataView.query":
|
|
1273
|
+
case "dataView.query":
|
|
1274
|
+
case "dataView.stats": {
|
|
1136
1275
|
const dataViewCode = String(
|
|
1137
1276
|
runtimeParams.code || runtimeParams.dataViewCode || descriptor.code || descriptor.dataViewCode || descriptor.viewCode || descriptor.key || ""
|
|
1138
1277
|
).trim();
|
|
@@ -1143,11 +1282,22 @@ var createPageSdk = (context) => {
|
|
|
1143
1282
|
filters: mergeSearchExpressions(
|
|
1144
1283
|
descriptor.defaultFilter,
|
|
1145
1284
|
runtimeParams.filters
|
|
1285
|
+
),
|
|
1286
|
+
having: mergeSearchExpressions(
|
|
1287
|
+
descriptor.defaultHaving || descriptor.having,
|
|
1288
|
+
runtimeParams.having
|
|
1146
1289
|
)
|
|
1147
1290
|
};
|
|
1148
1291
|
delete queryParams.code;
|
|
1149
1292
|
delete queryParams.dataViewCode;
|
|
1150
1293
|
delete queryParams.viewCode;
|
|
1294
|
+
if (descriptor.type === "dataView.stats") {
|
|
1295
|
+
return dataView.stats(
|
|
1296
|
+
dataViewCode,
|
|
1297
|
+
queryParams
|
|
1298
|
+
);
|
|
1299
|
+
}
|
|
1300
|
+
delete queryParams.having;
|
|
1151
1301
|
return dataView.query(
|
|
1152
1302
|
dataViewCode,
|
|
1153
1303
|
queryParams
|