openxiangda 1.0.164 → 1.0.166

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.
Files changed (33) hide show
  1. package/README.md +9 -7
  2. package/lib/change-baseline.js +74 -6
  3. package/lib/cli.js +2508 -167
  4. package/lib/sdd.js +320 -6
  5. package/lib/utils.js +76 -2
  6. package/openxiangda-skills/SKILL.md +13 -6
  7. package/openxiangda-skills/references/pages/publish-flow.md +15 -16
  8. package/openxiangda-skills/references/resource-manifest-cheatsheet.md +24 -2
  9. package/openxiangda-skills/skills/openxiangda-core/SKILL.md +14 -6
  10. package/openxiangda-skills/skills/openxiangda-form/SKILL.md +10 -9
  11. package/openxiangda-skills/skills/openxiangda-workflow-automation/SKILL.md +2 -0
  12. package/package.json +2 -1
  13. package/packages/sdk/dist/runtime/index.cjs +164 -48
  14. package/packages/sdk/dist/runtime/index.cjs.map +1 -1
  15. package/packages/sdk/dist/runtime/index.d.mts +1 -1
  16. package/packages/sdk/dist/runtime/index.d.ts +1 -1
  17. package/packages/sdk/dist/runtime/index.mjs +164 -48
  18. package/packages/sdk/dist/runtime/index.mjs.map +1 -1
  19. package/packages/sdk/dist/runtime/react.cjs +164 -48
  20. package/packages/sdk/dist/runtime/react.cjs.map +1 -1
  21. package/packages/sdk/dist/runtime/react.d.mts +79 -1
  22. package/packages/sdk/dist/runtime/react.d.ts +79 -1
  23. package/packages/sdk/dist/runtime/react.mjs +164 -48
  24. package/packages/sdk/dist/runtime/react.mjs.map +1 -1
  25. package/templates/openxiangda-react-spa/.cursor/rules/openxiangda-resources.mdc +1 -0
  26. package/templates/openxiangda-react-spa/.qoder/rules/openxiangda-resources.md +1 -0
  27. package/templates/openxiangda-react-spa/AGENTS.md +12 -10
  28. package/templates/openxiangda-react-spa/scripts/build-js-code.mjs +20 -2
  29. package/templates/openxiangda-react-spa/scripts/deploy.mjs +2 -2
  30. package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda-resources.mdc +2 -0
  31. package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda-resources.md +1 -0
  32. package/templates/sy-lowcode-app-workspace/AGENTS.md +5 -3
  33. package/templates/sy-lowcode-app-workspace/scripts/build-js-code.mjs +20 -2
@@ -140,6 +140,75 @@ interface AppFunctionRuntimeContext {
140
140
  permissions?: AppFunctionPermissionContext;
141
141
  [key: string]: unknown;
142
142
  }
143
+ /** Metadata-only declaration stored in an App Function resource manifest. */
144
+ interface AppFunctionSecretRef {
145
+ name: string;
146
+ required: boolean;
147
+ }
148
+ /**
149
+ * Invocation-scoped secret resolver exposed only by trusted_node_v2.
150
+ * Values are never part of a page SDK response, manifest, build artifact, or
151
+ * source snapshot.
152
+ */
153
+ interface AppFunctionSecrets {
154
+ get(name: string): Promise<string>;
155
+ }
156
+ interface AppFunctionHttpRequest {
157
+ url: string;
158
+ method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD";
159
+ params?: Record<string, unknown>;
160
+ data?: unknown;
161
+ body?: unknown;
162
+ headers?: Record<string, string | number>;
163
+ timeout?: number;
164
+ }
165
+ interface AppFunctionHttpResponse<T = unknown> {
166
+ data: T;
167
+ status: number;
168
+ statusText?: string;
169
+ headers?: Record<string, unknown>;
170
+ }
171
+ /**
172
+ * Server-controlled public HTTPS bridge. It never forwards the platform
173
+ * Runtime bearer token and rejects redirects and private/reserved targets.
174
+ */
175
+ interface AppFunctionHttpApi {
176
+ request<T = unknown>(input: AppFunctionHttpRequest): Promise<AppFunctionHttpResponse<T>>;
177
+ get<T = unknown>(url: string, config?: Omit<AppFunctionHttpRequest, "url" | "method">): Promise<AppFunctionHttpResponse<T>>;
178
+ post<T = unknown>(url: string, data?: unknown, config?: Omit<AppFunctionHttpRequest, "url" | "method" | "data" | "body">): Promise<AppFunctionHttpResponse<T>>;
179
+ put<T = unknown>(url: string, data?: unknown, config?: Omit<AppFunctionHttpRequest, "url" | "method" | "data" | "body">): Promise<AppFunctionHttpResponse<T>>;
180
+ patch<T = unknown>(url: string, data?: unknown, config?: Omit<AppFunctionHttpRequest, "url" | "method" | "data" | "body">): Promise<AppFunctionHttpResponse<T>>;
181
+ delete<T = unknown>(url: string, config?: Omit<AppFunctionHttpRequest, "url" | "method">): Promise<AppFunctionHttpResponse<T>>;
182
+ }
183
+ interface AppFunctionUtils {
184
+ http: AppFunctionHttpApi;
185
+ log?(message: unknown): void;
186
+ info?(message: unknown): void;
187
+ error?(message: unknown): void;
188
+ parseJSON?<T = unknown>(value: string): T;
189
+ stringify?(value: unknown): string;
190
+ now?(): number;
191
+ today?(): Date;
192
+ uuid?(): string;
193
+ [key: string]: unknown;
194
+ }
195
+ /** Stable workspace shape for a Function that opts in to secret resolution. */
196
+ interface AppFunctionManifestV2 {
197
+ code: string;
198
+ name?: string;
199
+ description?: string;
200
+ secretRefs?: AppFunctionSecretRef[];
201
+ definitionJson: {
202
+ kind?: "app_function";
203
+ version: "function_v2";
204
+ runtimeMode: "trusted_node";
205
+ runtimeContractVersion: "trusted_node_v2";
206
+ sourceType?: "file_snapshot";
207
+ sourceFile?: Record<string, unknown>;
208
+ [key: string]: unknown;
209
+ };
210
+ [key: string]: unknown;
211
+ }
143
212
  interface AppFunctionFormQueryParams {
144
213
  formCode: string;
145
214
  filters?: SearchExpression | Record<string, unknown>;
@@ -300,6 +369,8 @@ interface AppFunctionContext {
300
369
  currentUser?: PageUserInfo | AppFunctionOperatorInfo;
301
370
  permissions?: AppFunctionPermissionContext;
302
371
  runtime?: AppFunctionRuntimeContext;
372
+ secrets?: AppFunctionSecrets;
373
+ utils?: AppFunctionUtils;
303
374
  resources?: Record<string, unknown>;
304
375
  form: AppFunctionFormApi;
305
376
  dataView: AppFunctionDataViewApi;
@@ -313,6 +384,12 @@ interface AppFunctionContext {
313
384
  methods?: Record<string, (...args: any[]) => unknown>;
314
385
  [key: string]: unknown;
315
386
  }
387
+ /** trusted_node_v2 always supplies the scoped Secret resolver. */
388
+ interface AppFunctionContextV2 extends AppFunctionContext {
389
+ secrets: AppFunctionSecrets;
390
+ utils: AppFunctionUtils;
391
+ }
392
+ type TrustedNodeV2Context = AppFunctionContextV2;
316
393
  interface SearchSortItem {
317
394
  id: string;
318
395
  isAsc: "y" | "n";
@@ -1923,6 +2000,7 @@ interface PublicAccessClient {
1923
2000
  appType: string;
1924
2001
  servicePrefix: string;
1925
2002
  startSession: (input?: PublicAccessSessionInput) => Promise<PublicAccessSessionData>;
2003
+ clearSession: (input?: PublicAccessSessionInput) => void;
1926
2004
  }
1927
2005
  declare class PublicAccessClientError extends Error {
1928
2006
  status?: number;
@@ -2394,4 +2472,4 @@ interface PublicAccessGateProps extends UsePublicAccessOptions {
2394
2472
  }
2395
2473
  declare const PublicAccessGate: React__default.FC<PublicAccessGateProps>;
2396
2474
 
2397
- export { type ApiEnvelope, type ApiPermissionListParams, type AppAuthClient, type AppFunctionConnectorApi, type AppFunctionContext, type AppFunctionDataViewApi, type AppFunctionFormApi, type AppFunctionFormGetByIdParams, type AppFunctionFormQueryParams, type AppFunctionFormWriteParams, type AppFunctionNotificationApi, type AppFunctionOperatorInfo, type AppFunctionOrganizationApi, type AppFunctionPermissionContext, type AppFunctionRuntimeContext, type ApproveTaskParams, type AssignPermissionsParams, type AssignRolesParams, AttachmentPreviewList, type AttachmentPreviewListProps, type AuthChallengePayload, AuthClientError, type AuthClientErrorOptions, type AuthClientOptions, type AuthErrorExtra, type AuthLogoutRedirectOptions, type AuthMethod, type AuthMethodType, type AuthTokenData, type AuthUser, type BatchAddUsersToRoleParams, type BatchSendNotificationByTypeParams, type ChangeOrganizationAccountPasswordParams, type ChangeUserRoleParams, type ConnectorCallParams, type ConnectorInvokeParams, type ConnectorInvokeResult, type ConnectorRequestBodyType, type ConnectorResponseType, type CreateApiPermissionParams, type CreateFileAccessTicketOptions, type CreateFormPermissionGroupDto, type CreateOrganizationAccountParams, type CreateOrganizationDepartmentParams, 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 DingTalkLoginFlow, type DingTalkLoginInput, type DingTalkNotificationCapabilities, type DingTalkNotificationCardConfig, type DingTalkNotificationCardField, type DingTalkNotificationCardMode, type DingTalkNotificationCardPreview, type DingTalkNotificationChannelConfig, type DingTalkNotificationDeliveryMode, type DingTalkNotificationPreviewResult, type DingTalkOAuthStartInput, type DingTalkOAuthStartResult, type ExecuteProcessOperationInput, type FieldAccessLevel, type FieldAccessPolicyDto, type FieldAccessPolicyItemDto, type FieldOptionValue, type FieldPermissionDto, type FileAccessTicketAction, type FileAccessTicketPurpose, type FileAccessTicketResult, type FilePreviewController, type FilePreviewItem, type FindNotificationConfigParams, type FormAdvancedSearchParams, type FormChangeRecordParams, type FormCreateParams, type FormCreateResult, type FormDetailResult, type FormExportParams, type FormFieldValue, type FormGetDetailParams, type FormImportParams, type FormInstanceIdentifierResult, type FormPermissionGroup, type FormRemoveParams, type FormSearchParams, type FormUpdateParams, type FormUpdateResult, type FunctionInvokeParams, type FunctionInvokeResult, type GetParentDepartmentsOptions, type GetProcessInstanceParams, type GetUserRolesParams, type GuestLoginInput, ImagePreviewGrid, type ImagePreviewGridProps, type ImportExportRecordDownloadParams, type ImportExportRecordQuery, InitiatorApproverSelector, type InstanceStatus, type ListNotificationInboxParams, type ListWorkCenterItemsParams, type LoginLogGetParams, type LoginLogListParams, type LoginLogRecord, type LoginLogStats, type LoginLogStatsParams, type LoginLogStatus, type LoginMethodsResult, LoginPage, type LoginPageProps, type MarkAllNotificationReadResult, type NotificationChannel, type NotificationChannelConfig, type NotificationChannelsConfig, type NotificationConfigLevel, type NotificationInboxListResult, type NotificationInboxMessage, type NotificationInboxReadStatus, type NotificationMessageRecord, type NotificationTemplate, type NotificationTemplatePreview, type NotificationTypeConfig, type NotificationUnreadCountResult, OpenXiangdaPageProvider, type OpenXiangdaPageProviderProps, OpenXiangdaProvider, type OpenXiangdaProviderProps, type OrganizationAccountListParams, type OrganizationCapabilities, type OrganizationListResult, 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 PasswordLoginInput, PermissionBoundary, type PermissionBoundaryFallback, type PermissionBoundaryFallbackState, type PermissionBoundaryProps, type PhoneCodeInput, type PhoneCodeLoginInput, type PhoneCodeRegisterInput, type PhoneCodeSendResult, type PreviewDingTalkNotificationParams, type PreviewNotificationTemplateParams, ProcessActionBar, type ProcessActionBarProps, type ProcessApproveAction, type ProcessCapabilities, type ProcessCapabilityOperation, type ProcessInstanceLookupParams, ProcessPreviewPanel, type ProcessPreviewPanelProps, ProcessTimeline, type ProcessTimelineProps, type PublicAccessClaim, type PublicAccessClient, PublicAccessClientError, type PublicAccessClientOptions, PublicAccessGate, type PublicAccessGateProps, type PublicAccessSessionData, type PublicAccessSessionInput, type PublicStorageAction, type PublicStorageGrant, type QueryFormPermissionGroupDto, type QueryPagePermissionGroupDto, type RefreshInput, type ResetOrganizationAccountPasswordParams, type ResolveLoginUrlInput, type ResolveProcessCapabilitiesParams, type RoleListParams, type RoleUsersParams, type RouteAccessResult, RuntimeAuthGuard, type RuntimeAuthGuardProps, type RuntimeAuthState, type RuntimeAuthStatus, type RuntimeBootstrap, type RuntimeErrorSnapshot, type RuntimeErrorType, type RuntimeLogoutOptions, type RuntimeMenuItem, type RuntimePagePermissions, type RuntimeRedirectLoginOptions, type RuntimeRequestError, type RuntimeRequestState, type RuntimeResolveLoginOptions, 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 SsoLoginUrlInput, type SsoLoginUrlResult, type SubFormRule, type SwitchAppRoleParams, type SwitchPlatformRoleParams, type TerminateProcessInstanceParams, type TriggerCallbackTaskParams, type UiPermissionListParams, type UpdateApiPermissionParams, type UpdateFormPermissionGroupDto, type UpdateOrganizationAccountParams, type UpdateOrganizationDepartmentParams, type UpdatePagePermissionGroupDto, type UpdateRoleParams, type UpdateUiPermissionParams, type UpdateUserParams, type UseAuthOptions, type UseCanAccessRouteInput, type UseFilePreviewOptions, type UseLoginMethodsState, type UseProcessActionsOptions, type UseProcessActionsReturn, type UseProcessCapabilitiesOptions, type UseProcessCapabilitiesReturn, type UsePublicAccessOptions, type UsePublicAccessState, type UserListParams, type UserMenuPermissionsResponse, type ValidateUserParams, type ViewFieldPermissionValue, type ViewOperationPermission, type ViewPermissionSummary, type WorkCenterBoxType, type WorkCenterGroupedStat, type WorkCenterItem, type WorkCenterListResult, type WorkCenterStats, type WorkCenterStatsParams, type WorkflowApproveParams, type WorkflowCapabilityActionKey, type WorkflowDefinitionByFormParams, type WorkflowInitiatorSelectCandidatesParams, type WorkflowInitiatorSelectRequirementsParams, type WorkflowPreviewParams, type WorkflowResubmitInitiatorSelectRequirementsParams, type WorkflowResubmitParams, type WorkflowReturnParams, type WorkflowSaveTaskParams, type WorkflowStartFromExistingInstanceParams, type WorkflowTaskParams, type WorkflowTransferParams, type WorkflowWithdrawParams, createAuthClient, createPageFormRuntimeApi, createPageSdk, createPublicAccessClient, createReactPage, getAuthErrorExtra, getAuthErrorReason, isAuthChallengeRequired, isAuthClientError, useAppMenus, useAuth, useCanAccessRoute, useCurrentUser, useDataSource, useFilePreview, useFormViewPermissions, useLoginMethods, useMessage, useModal, useNavigation, useOpenXiangda, usePageContext, usePageFormRuntimeApi, usePageProps, usePageRoute, usePageSdk, usePermission, useProcessActions, useProcessCapabilities, usePublicAccess, useRuntimeAuth, useRuntimeBootstrap };
2475
+ export { type ApiEnvelope, type ApiPermissionListParams, type AppAuthClient, type AppFunctionConnectorApi, type AppFunctionContext, type AppFunctionContextV2, type AppFunctionDataViewApi, type AppFunctionFormApi, type AppFunctionFormGetByIdParams, type AppFunctionFormQueryParams, type AppFunctionFormWriteParams, type AppFunctionHttpApi, type AppFunctionHttpRequest, type AppFunctionHttpResponse, type AppFunctionManifestV2, type AppFunctionNotificationApi, type AppFunctionOperatorInfo, type AppFunctionOrganizationApi, type AppFunctionPermissionContext, type AppFunctionRuntimeContext, type AppFunctionSecretRef, type AppFunctionSecrets, type AppFunctionUtils, type ApproveTaskParams, type AssignPermissionsParams, type AssignRolesParams, AttachmentPreviewList, type AttachmentPreviewListProps, type AuthChallengePayload, AuthClientError, type AuthClientErrorOptions, type AuthClientOptions, type AuthErrorExtra, type AuthLogoutRedirectOptions, type AuthMethod, type AuthMethodType, type AuthTokenData, type AuthUser, type BatchAddUsersToRoleParams, type BatchSendNotificationByTypeParams, type ChangeOrganizationAccountPasswordParams, type ChangeUserRoleParams, type ConnectorCallParams, type ConnectorInvokeParams, type ConnectorInvokeResult, type ConnectorRequestBodyType, type ConnectorResponseType, type CreateApiPermissionParams, type CreateFileAccessTicketOptions, type CreateFormPermissionGroupDto, type CreateOrganizationAccountParams, type CreateOrganizationDepartmentParams, 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 DingTalkLoginFlow, type DingTalkLoginInput, type DingTalkNotificationCapabilities, type DingTalkNotificationCardConfig, type DingTalkNotificationCardField, type DingTalkNotificationCardMode, type DingTalkNotificationCardPreview, type DingTalkNotificationChannelConfig, type DingTalkNotificationDeliveryMode, type DingTalkNotificationPreviewResult, type DingTalkOAuthStartInput, type DingTalkOAuthStartResult, type ExecuteProcessOperationInput, type FieldAccessLevel, type FieldAccessPolicyDto, type FieldAccessPolicyItemDto, type FieldOptionValue, type FieldPermissionDto, type FileAccessTicketAction, type FileAccessTicketPurpose, type FileAccessTicketResult, type FilePreviewController, type FilePreviewItem, type FindNotificationConfigParams, type FormAdvancedSearchParams, type FormChangeRecordParams, type FormCreateParams, type FormCreateResult, type FormDetailResult, type FormExportParams, type FormFieldValue, type FormGetDetailParams, type FormImportParams, type FormInstanceIdentifierResult, type FormPermissionGroup, type FormRemoveParams, type FormSearchParams, type FormUpdateParams, type FormUpdateResult, type FunctionInvokeParams, type FunctionInvokeResult, type GetParentDepartmentsOptions, type GetProcessInstanceParams, type GetUserRolesParams, type GuestLoginInput, ImagePreviewGrid, type ImagePreviewGridProps, type ImportExportRecordDownloadParams, type ImportExportRecordQuery, InitiatorApproverSelector, type InstanceStatus, type ListNotificationInboxParams, type ListWorkCenterItemsParams, type LoginLogGetParams, type LoginLogListParams, type LoginLogRecord, type LoginLogStats, type LoginLogStatsParams, type LoginLogStatus, type LoginMethodsResult, LoginPage, type LoginPageProps, type MarkAllNotificationReadResult, type NotificationChannel, type NotificationChannelConfig, type NotificationChannelsConfig, type NotificationConfigLevel, type NotificationInboxListResult, type NotificationInboxMessage, type NotificationInboxReadStatus, type NotificationMessageRecord, type NotificationTemplate, type NotificationTemplatePreview, type NotificationTypeConfig, type NotificationUnreadCountResult, OpenXiangdaPageProvider, type OpenXiangdaPageProviderProps, OpenXiangdaProvider, type OpenXiangdaProviderProps, type OrganizationAccountListParams, type OrganizationCapabilities, type OrganizationListResult, 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 PasswordLoginInput, PermissionBoundary, type PermissionBoundaryFallback, type PermissionBoundaryFallbackState, type PermissionBoundaryProps, type PhoneCodeInput, type PhoneCodeLoginInput, type PhoneCodeRegisterInput, type PhoneCodeSendResult, type PreviewDingTalkNotificationParams, type PreviewNotificationTemplateParams, ProcessActionBar, type ProcessActionBarProps, type ProcessApproveAction, type ProcessCapabilities, type ProcessCapabilityOperation, type ProcessInstanceLookupParams, ProcessPreviewPanel, type ProcessPreviewPanelProps, ProcessTimeline, type ProcessTimelineProps, type PublicAccessClaim, type PublicAccessClient, PublicAccessClientError, type PublicAccessClientOptions, PublicAccessGate, type PublicAccessGateProps, type PublicAccessSessionData, type PublicAccessSessionInput, type PublicStorageAction, type PublicStorageGrant, type QueryFormPermissionGroupDto, type QueryPagePermissionGroupDto, type RefreshInput, type ResetOrganizationAccountPasswordParams, type ResolveLoginUrlInput, type ResolveProcessCapabilitiesParams, type RoleListParams, type RoleUsersParams, type RouteAccessResult, RuntimeAuthGuard, type RuntimeAuthGuardProps, type RuntimeAuthState, type RuntimeAuthStatus, type RuntimeBootstrap, type RuntimeErrorSnapshot, type RuntimeErrorType, type RuntimeLogoutOptions, type RuntimeMenuItem, type RuntimePagePermissions, type RuntimeRedirectLoginOptions, type RuntimeRequestError, type RuntimeRequestState, type RuntimeResolveLoginOptions, 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 SsoLoginUrlInput, type SsoLoginUrlResult, type SubFormRule, type SwitchAppRoleParams, type SwitchPlatformRoleParams, type TerminateProcessInstanceParams, type TriggerCallbackTaskParams, type TrustedNodeV2Context, type UiPermissionListParams, type UpdateApiPermissionParams, type UpdateFormPermissionGroupDto, type UpdateOrganizationAccountParams, type UpdateOrganizationDepartmentParams, type UpdatePagePermissionGroupDto, type UpdateRoleParams, type UpdateUiPermissionParams, type UpdateUserParams, type UseAuthOptions, type UseCanAccessRouteInput, type UseFilePreviewOptions, type UseLoginMethodsState, type UseProcessActionsOptions, type UseProcessActionsReturn, type UseProcessCapabilitiesOptions, type UseProcessCapabilitiesReturn, type UsePublicAccessOptions, type UsePublicAccessState, type UserListParams, type UserMenuPermissionsResponse, type ValidateUserParams, type ViewFieldPermissionValue, type ViewOperationPermission, type ViewPermissionSummary, type WorkCenterBoxType, type WorkCenterGroupedStat, type WorkCenterItem, type WorkCenterListResult, type WorkCenterStats, type WorkCenterStatsParams, type WorkflowApproveParams, type WorkflowCapabilityActionKey, type WorkflowDefinitionByFormParams, type WorkflowInitiatorSelectCandidatesParams, type WorkflowInitiatorSelectRequirementsParams, type WorkflowPreviewParams, type WorkflowResubmitInitiatorSelectRequirementsParams, type WorkflowResubmitParams, type WorkflowReturnParams, type WorkflowSaveTaskParams, type WorkflowStartFromExistingInstanceParams, type WorkflowTaskParams, type WorkflowTransferParams, type WorkflowWithdrawParams, createAuthClient, createPageFormRuntimeApi, createPageSdk, createPublicAccessClient, createReactPage, getAuthErrorExtra, getAuthErrorReason, isAuthChallengeRequired, isAuthClientError, useAppMenus, useAuth, useCanAccessRoute, useCurrentUser, useDataSource, useFilePreview, useFormViewPermissions, useLoginMethods, useMessage, useModal, useNavigation, useOpenXiangda, usePageContext, usePageFormRuntimeApi, usePageProps, usePageRoute, usePageSdk, usePermission, useProcessActions, useProcessCapabilities, usePublicAccess, useRuntimeAuth, useRuntimeBootstrap };
@@ -140,6 +140,75 @@ interface AppFunctionRuntimeContext {
140
140
  permissions?: AppFunctionPermissionContext;
141
141
  [key: string]: unknown;
142
142
  }
143
+ /** Metadata-only declaration stored in an App Function resource manifest. */
144
+ interface AppFunctionSecretRef {
145
+ name: string;
146
+ required: boolean;
147
+ }
148
+ /**
149
+ * Invocation-scoped secret resolver exposed only by trusted_node_v2.
150
+ * Values are never part of a page SDK response, manifest, build artifact, or
151
+ * source snapshot.
152
+ */
153
+ interface AppFunctionSecrets {
154
+ get(name: string): Promise<string>;
155
+ }
156
+ interface AppFunctionHttpRequest {
157
+ url: string;
158
+ method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD";
159
+ params?: Record<string, unknown>;
160
+ data?: unknown;
161
+ body?: unknown;
162
+ headers?: Record<string, string | number>;
163
+ timeout?: number;
164
+ }
165
+ interface AppFunctionHttpResponse<T = unknown> {
166
+ data: T;
167
+ status: number;
168
+ statusText?: string;
169
+ headers?: Record<string, unknown>;
170
+ }
171
+ /**
172
+ * Server-controlled public HTTPS bridge. It never forwards the platform
173
+ * Runtime bearer token and rejects redirects and private/reserved targets.
174
+ */
175
+ interface AppFunctionHttpApi {
176
+ request<T = unknown>(input: AppFunctionHttpRequest): Promise<AppFunctionHttpResponse<T>>;
177
+ get<T = unknown>(url: string, config?: Omit<AppFunctionHttpRequest, "url" | "method">): Promise<AppFunctionHttpResponse<T>>;
178
+ post<T = unknown>(url: string, data?: unknown, config?: Omit<AppFunctionHttpRequest, "url" | "method" | "data" | "body">): Promise<AppFunctionHttpResponse<T>>;
179
+ put<T = unknown>(url: string, data?: unknown, config?: Omit<AppFunctionHttpRequest, "url" | "method" | "data" | "body">): Promise<AppFunctionHttpResponse<T>>;
180
+ patch<T = unknown>(url: string, data?: unknown, config?: Omit<AppFunctionHttpRequest, "url" | "method" | "data" | "body">): Promise<AppFunctionHttpResponse<T>>;
181
+ delete<T = unknown>(url: string, config?: Omit<AppFunctionHttpRequest, "url" | "method">): Promise<AppFunctionHttpResponse<T>>;
182
+ }
183
+ interface AppFunctionUtils {
184
+ http: AppFunctionHttpApi;
185
+ log?(message: unknown): void;
186
+ info?(message: unknown): void;
187
+ error?(message: unknown): void;
188
+ parseJSON?<T = unknown>(value: string): T;
189
+ stringify?(value: unknown): string;
190
+ now?(): number;
191
+ today?(): Date;
192
+ uuid?(): string;
193
+ [key: string]: unknown;
194
+ }
195
+ /** Stable workspace shape for a Function that opts in to secret resolution. */
196
+ interface AppFunctionManifestV2 {
197
+ code: string;
198
+ name?: string;
199
+ description?: string;
200
+ secretRefs?: AppFunctionSecretRef[];
201
+ definitionJson: {
202
+ kind?: "app_function";
203
+ version: "function_v2";
204
+ runtimeMode: "trusted_node";
205
+ runtimeContractVersion: "trusted_node_v2";
206
+ sourceType?: "file_snapshot";
207
+ sourceFile?: Record<string, unknown>;
208
+ [key: string]: unknown;
209
+ };
210
+ [key: string]: unknown;
211
+ }
143
212
  interface AppFunctionFormQueryParams {
144
213
  formCode: string;
145
214
  filters?: SearchExpression | Record<string, unknown>;
@@ -300,6 +369,8 @@ interface AppFunctionContext {
300
369
  currentUser?: PageUserInfo | AppFunctionOperatorInfo;
301
370
  permissions?: AppFunctionPermissionContext;
302
371
  runtime?: AppFunctionRuntimeContext;
372
+ secrets?: AppFunctionSecrets;
373
+ utils?: AppFunctionUtils;
303
374
  resources?: Record<string, unknown>;
304
375
  form: AppFunctionFormApi;
305
376
  dataView: AppFunctionDataViewApi;
@@ -313,6 +384,12 @@ interface AppFunctionContext {
313
384
  methods?: Record<string, (...args: any[]) => unknown>;
314
385
  [key: string]: unknown;
315
386
  }
387
+ /** trusted_node_v2 always supplies the scoped Secret resolver. */
388
+ interface AppFunctionContextV2 extends AppFunctionContext {
389
+ secrets: AppFunctionSecrets;
390
+ utils: AppFunctionUtils;
391
+ }
392
+ type TrustedNodeV2Context = AppFunctionContextV2;
316
393
  interface SearchSortItem {
317
394
  id: string;
318
395
  isAsc: "y" | "n";
@@ -1923,6 +2000,7 @@ interface PublicAccessClient {
1923
2000
  appType: string;
1924
2001
  servicePrefix: string;
1925
2002
  startSession: (input?: PublicAccessSessionInput) => Promise<PublicAccessSessionData>;
2003
+ clearSession: (input?: PublicAccessSessionInput) => void;
1926
2004
  }
1927
2005
  declare class PublicAccessClientError extends Error {
1928
2006
  status?: number;
@@ -2394,4 +2472,4 @@ interface PublicAccessGateProps extends UsePublicAccessOptions {
2394
2472
  }
2395
2473
  declare const PublicAccessGate: React__default.FC<PublicAccessGateProps>;
2396
2474
 
2397
- export { type ApiEnvelope, type ApiPermissionListParams, type AppAuthClient, type AppFunctionConnectorApi, type AppFunctionContext, type AppFunctionDataViewApi, type AppFunctionFormApi, type AppFunctionFormGetByIdParams, type AppFunctionFormQueryParams, type AppFunctionFormWriteParams, type AppFunctionNotificationApi, type AppFunctionOperatorInfo, type AppFunctionOrganizationApi, type AppFunctionPermissionContext, type AppFunctionRuntimeContext, type ApproveTaskParams, type AssignPermissionsParams, type AssignRolesParams, AttachmentPreviewList, type AttachmentPreviewListProps, type AuthChallengePayload, AuthClientError, type AuthClientErrorOptions, type AuthClientOptions, type AuthErrorExtra, type AuthLogoutRedirectOptions, type AuthMethod, type AuthMethodType, type AuthTokenData, type AuthUser, type BatchAddUsersToRoleParams, type BatchSendNotificationByTypeParams, type ChangeOrganizationAccountPasswordParams, type ChangeUserRoleParams, type ConnectorCallParams, type ConnectorInvokeParams, type ConnectorInvokeResult, type ConnectorRequestBodyType, type ConnectorResponseType, type CreateApiPermissionParams, type CreateFileAccessTicketOptions, type CreateFormPermissionGroupDto, type CreateOrganizationAccountParams, type CreateOrganizationDepartmentParams, 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 DingTalkLoginFlow, type DingTalkLoginInput, type DingTalkNotificationCapabilities, type DingTalkNotificationCardConfig, type DingTalkNotificationCardField, type DingTalkNotificationCardMode, type DingTalkNotificationCardPreview, type DingTalkNotificationChannelConfig, type DingTalkNotificationDeliveryMode, type DingTalkNotificationPreviewResult, type DingTalkOAuthStartInput, type DingTalkOAuthStartResult, type ExecuteProcessOperationInput, type FieldAccessLevel, type FieldAccessPolicyDto, type FieldAccessPolicyItemDto, type FieldOptionValue, type FieldPermissionDto, type FileAccessTicketAction, type FileAccessTicketPurpose, type FileAccessTicketResult, type FilePreviewController, type FilePreviewItem, type FindNotificationConfigParams, type FormAdvancedSearchParams, type FormChangeRecordParams, type FormCreateParams, type FormCreateResult, type FormDetailResult, type FormExportParams, type FormFieldValue, type FormGetDetailParams, type FormImportParams, type FormInstanceIdentifierResult, type FormPermissionGroup, type FormRemoveParams, type FormSearchParams, type FormUpdateParams, type FormUpdateResult, type FunctionInvokeParams, type FunctionInvokeResult, type GetParentDepartmentsOptions, type GetProcessInstanceParams, type GetUserRolesParams, type GuestLoginInput, ImagePreviewGrid, type ImagePreviewGridProps, type ImportExportRecordDownloadParams, type ImportExportRecordQuery, InitiatorApproverSelector, type InstanceStatus, type ListNotificationInboxParams, type ListWorkCenterItemsParams, type LoginLogGetParams, type LoginLogListParams, type LoginLogRecord, type LoginLogStats, type LoginLogStatsParams, type LoginLogStatus, type LoginMethodsResult, LoginPage, type LoginPageProps, type MarkAllNotificationReadResult, type NotificationChannel, type NotificationChannelConfig, type NotificationChannelsConfig, type NotificationConfigLevel, type NotificationInboxListResult, type NotificationInboxMessage, type NotificationInboxReadStatus, type NotificationMessageRecord, type NotificationTemplate, type NotificationTemplatePreview, type NotificationTypeConfig, type NotificationUnreadCountResult, OpenXiangdaPageProvider, type OpenXiangdaPageProviderProps, OpenXiangdaProvider, type OpenXiangdaProviderProps, type OrganizationAccountListParams, type OrganizationCapabilities, type OrganizationListResult, 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 PasswordLoginInput, PermissionBoundary, type PermissionBoundaryFallback, type PermissionBoundaryFallbackState, type PermissionBoundaryProps, type PhoneCodeInput, type PhoneCodeLoginInput, type PhoneCodeRegisterInput, type PhoneCodeSendResult, type PreviewDingTalkNotificationParams, type PreviewNotificationTemplateParams, ProcessActionBar, type ProcessActionBarProps, type ProcessApproveAction, type ProcessCapabilities, type ProcessCapabilityOperation, type ProcessInstanceLookupParams, ProcessPreviewPanel, type ProcessPreviewPanelProps, ProcessTimeline, type ProcessTimelineProps, type PublicAccessClaim, type PublicAccessClient, PublicAccessClientError, type PublicAccessClientOptions, PublicAccessGate, type PublicAccessGateProps, type PublicAccessSessionData, type PublicAccessSessionInput, type PublicStorageAction, type PublicStorageGrant, type QueryFormPermissionGroupDto, type QueryPagePermissionGroupDto, type RefreshInput, type ResetOrganizationAccountPasswordParams, type ResolveLoginUrlInput, type ResolveProcessCapabilitiesParams, type RoleListParams, type RoleUsersParams, type RouteAccessResult, RuntimeAuthGuard, type RuntimeAuthGuardProps, type RuntimeAuthState, type RuntimeAuthStatus, type RuntimeBootstrap, type RuntimeErrorSnapshot, type RuntimeErrorType, type RuntimeLogoutOptions, type RuntimeMenuItem, type RuntimePagePermissions, type RuntimeRedirectLoginOptions, type RuntimeRequestError, type RuntimeRequestState, type RuntimeResolveLoginOptions, 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 SsoLoginUrlInput, type SsoLoginUrlResult, type SubFormRule, type SwitchAppRoleParams, type SwitchPlatformRoleParams, type TerminateProcessInstanceParams, type TriggerCallbackTaskParams, type UiPermissionListParams, type UpdateApiPermissionParams, type UpdateFormPermissionGroupDto, type UpdateOrganizationAccountParams, type UpdateOrganizationDepartmentParams, type UpdatePagePermissionGroupDto, type UpdateRoleParams, type UpdateUiPermissionParams, type UpdateUserParams, type UseAuthOptions, type UseCanAccessRouteInput, type UseFilePreviewOptions, type UseLoginMethodsState, type UseProcessActionsOptions, type UseProcessActionsReturn, type UseProcessCapabilitiesOptions, type UseProcessCapabilitiesReturn, type UsePublicAccessOptions, type UsePublicAccessState, type UserListParams, type UserMenuPermissionsResponse, type ValidateUserParams, type ViewFieldPermissionValue, type ViewOperationPermission, type ViewPermissionSummary, type WorkCenterBoxType, type WorkCenterGroupedStat, type WorkCenterItem, type WorkCenterListResult, type WorkCenterStats, type WorkCenterStatsParams, type WorkflowApproveParams, type WorkflowCapabilityActionKey, type WorkflowDefinitionByFormParams, type WorkflowInitiatorSelectCandidatesParams, type WorkflowInitiatorSelectRequirementsParams, type WorkflowPreviewParams, type WorkflowResubmitInitiatorSelectRequirementsParams, type WorkflowResubmitParams, type WorkflowReturnParams, type WorkflowSaveTaskParams, type WorkflowStartFromExistingInstanceParams, type WorkflowTaskParams, type WorkflowTransferParams, type WorkflowWithdrawParams, createAuthClient, createPageFormRuntimeApi, createPageSdk, createPublicAccessClient, createReactPage, getAuthErrorExtra, getAuthErrorReason, isAuthChallengeRequired, isAuthClientError, useAppMenus, useAuth, useCanAccessRoute, useCurrentUser, useDataSource, useFilePreview, useFormViewPermissions, useLoginMethods, useMessage, useModal, useNavigation, useOpenXiangda, usePageContext, usePageFormRuntimeApi, usePageProps, usePageRoute, usePageSdk, usePermission, useProcessActions, useProcessCapabilities, usePublicAccess, useRuntimeAuth, useRuntimeBootstrap };
2475
+ export { type ApiEnvelope, type ApiPermissionListParams, type AppAuthClient, type AppFunctionConnectorApi, type AppFunctionContext, type AppFunctionContextV2, type AppFunctionDataViewApi, type AppFunctionFormApi, type AppFunctionFormGetByIdParams, type AppFunctionFormQueryParams, type AppFunctionFormWriteParams, type AppFunctionHttpApi, type AppFunctionHttpRequest, type AppFunctionHttpResponse, type AppFunctionManifestV2, type AppFunctionNotificationApi, type AppFunctionOperatorInfo, type AppFunctionOrganizationApi, type AppFunctionPermissionContext, type AppFunctionRuntimeContext, type AppFunctionSecretRef, type AppFunctionSecrets, type AppFunctionUtils, type ApproveTaskParams, type AssignPermissionsParams, type AssignRolesParams, AttachmentPreviewList, type AttachmentPreviewListProps, type AuthChallengePayload, AuthClientError, type AuthClientErrorOptions, type AuthClientOptions, type AuthErrorExtra, type AuthLogoutRedirectOptions, type AuthMethod, type AuthMethodType, type AuthTokenData, type AuthUser, type BatchAddUsersToRoleParams, type BatchSendNotificationByTypeParams, type ChangeOrganizationAccountPasswordParams, type ChangeUserRoleParams, type ConnectorCallParams, type ConnectorInvokeParams, type ConnectorInvokeResult, type ConnectorRequestBodyType, type ConnectorResponseType, type CreateApiPermissionParams, type CreateFileAccessTicketOptions, type CreateFormPermissionGroupDto, type CreateOrganizationAccountParams, type CreateOrganizationDepartmentParams, 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 DingTalkLoginFlow, type DingTalkLoginInput, type DingTalkNotificationCapabilities, type DingTalkNotificationCardConfig, type DingTalkNotificationCardField, type DingTalkNotificationCardMode, type DingTalkNotificationCardPreview, type DingTalkNotificationChannelConfig, type DingTalkNotificationDeliveryMode, type DingTalkNotificationPreviewResult, type DingTalkOAuthStartInput, type DingTalkOAuthStartResult, type ExecuteProcessOperationInput, type FieldAccessLevel, type FieldAccessPolicyDto, type FieldAccessPolicyItemDto, type FieldOptionValue, type FieldPermissionDto, type FileAccessTicketAction, type FileAccessTicketPurpose, type FileAccessTicketResult, type FilePreviewController, type FilePreviewItem, type FindNotificationConfigParams, type FormAdvancedSearchParams, type FormChangeRecordParams, type FormCreateParams, type FormCreateResult, type FormDetailResult, type FormExportParams, type FormFieldValue, type FormGetDetailParams, type FormImportParams, type FormInstanceIdentifierResult, type FormPermissionGroup, type FormRemoveParams, type FormSearchParams, type FormUpdateParams, type FormUpdateResult, type FunctionInvokeParams, type FunctionInvokeResult, type GetParentDepartmentsOptions, type GetProcessInstanceParams, type GetUserRolesParams, type GuestLoginInput, ImagePreviewGrid, type ImagePreviewGridProps, type ImportExportRecordDownloadParams, type ImportExportRecordQuery, InitiatorApproverSelector, type InstanceStatus, type ListNotificationInboxParams, type ListWorkCenterItemsParams, type LoginLogGetParams, type LoginLogListParams, type LoginLogRecord, type LoginLogStats, type LoginLogStatsParams, type LoginLogStatus, type LoginMethodsResult, LoginPage, type LoginPageProps, type MarkAllNotificationReadResult, type NotificationChannel, type NotificationChannelConfig, type NotificationChannelsConfig, type NotificationConfigLevel, type NotificationInboxListResult, type NotificationInboxMessage, type NotificationInboxReadStatus, type NotificationMessageRecord, type NotificationTemplate, type NotificationTemplatePreview, type NotificationTypeConfig, type NotificationUnreadCountResult, OpenXiangdaPageProvider, type OpenXiangdaPageProviderProps, OpenXiangdaProvider, type OpenXiangdaProviderProps, type OrganizationAccountListParams, type OrganizationCapabilities, type OrganizationListResult, 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 PasswordLoginInput, PermissionBoundary, type PermissionBoundaryFallback, type PermissionBoundaryFallbackState, type PermissionBoundaryProps, type PhoneCodeInput, type PhoneCodeLoginInput, type PhoneCodeRegisterInput, type PhoneCodeSendResult, type PreviewDingTalkNotificationParams, type PreviewNotificationTemplateParams, ProcessActionBar, type ProcessActionBarProps, type ProcessApproveAction, type ProcessCapabilities, type ProcessCapabilityOperation, type ProcessInstanceLookupParams, ProcessPreviewPanel, type ProcessPreviewPanelProps, ProcessTimeline, type ProcessTimelineProps, type PublicAccessClaim, type PublicAccessClient, PublicAccessClientError, type PublicAccessClientOptions, PublicAccessGate, type PublicAccessGateProps, type PublicAccessSessionData, type PublicAccessSessionInput, type PublicStorageAction, type PublicStorageGrant, type QueryFormPermissionGroupDto, type QueryPagePermissionGroupDto, type RefreshInput, type ResetOrganizationAccountPasswordParams, type ResolveLoginUrlInput, type ResolveProcessCapabilitiesParams, type RoleListParams, type RoleUsersParams, type RouteAccessResult, RuntimeAuthGuard, type RuntimeAuthGuardProps, type RuntimeAuthState, type RuntimeAuthStatus, type RuntimeBootstrap, type RuntimeErrorSnapshot, type RuntimeErrorType, type RuntimeLogoutOptions, type RuntimeMenuItem, type RuntimePagePermissions, type RuntimeRedirectLoginOptions, type RuntimeRequestError, type RuntimeRequestState, type RuntimeResolveLoginOptions, 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 SsoLoginUrlInput, type SsoLoginUrlResult, type SubFormRule, type SwitchAppRoleParams, type SwitchPlatformRoleParams, type TerminateProcessInstanceParams, type TriggerCallbackTaskParams, type TrustedNodeV2Context, type UiPermissionListParams, type UpdateApiPermissionParams, type UpdateFormPermissionGroupDto, type UpdateOrganizationAccountParams, type UpdateOrganizationDepartmentParams, type UpdatePagePermissionGroupDto, type UpdateRoleParams, type UpdateUiPermissionParams, type UpdateUserParams, type UseAuthOptions, type UseCanAccessRouteInput, type UseFilePreviewOptions, type UseLoginMethodsState, type UseProcessActionsOptions, type UseProcessActionsReturn, type UseProcessCapabilitiesOptions, type UseProcessCapabilitiesReturn, type UsePublicAccessOptions, type UsePublicAccessState, type UserListParams, type UserMenuPermissionsResponse, type ValidateUserParams, type ViewFieldPermissionValue, type ViewOperationPermission, type ViewPermissionSummary, type WorkCenterBoxType, type WorkCenterGroupedStat, type WorkCenterItem, type WorkCenterListResult, type WorkCenterStats, type WorkCenterStatsParams, type WorkflowApproveParams, type WorkflowCapabilityActionKey, type WorkflowDefinitionByFormParams, type WorkflowInitiatorSelectCandidatesParams, type WorkflowInitiatorSelectRequirementsParams, type WorkflowPreviewParams, type WorkflowResubmitInitiatorSelectRequirementsParams, type WorkflowResubmitParams, type WorkflowReturnParams, type WorkflowSaveTaskParams, type WorkflowStartFromExistingInstanceParams, type WorkflowTaskParams, type WorkflowTransferParams, type WorkflowWithdrawParams, createAuthClient, createPageFormRuntimeApi, createPageSdk, createPublicAccessClient, createReactPage, getAuthErrorExtra, getAuthErrorReason, isAuthChallengeRequired, isAuthClientError, useAppMenus, useAuth, useCanAccessRoute, useCurrentUser, useDataSource, useFilePreview, useFormViewPermissions, useLoginMethods, useMessage, useModal, useNavigation, useOpenXiangda, usePageContext, usePageFormRuntimeApi, usePageProps, usePageRoute, usePageSdk, usePermission, useProcessActions, useProcessCapabilities, usePublicAccess, useRuntimeAuth, useRuntimeBootstrap };
@@ -8959,6 +8959,8 @@ var resolveAppTypeFromLocation = () => {
8959
8959
  import { useCallback as useCallback11, useEffect as useEffect13, useMemo as useMemo16, useRef as useRef7, useState as useState14 } from "react";
8960
8960
 
8961
8961
  // packages/sdk/src/runtime/core/publicAccess.ts
8962
+ var PUBLIC_SESSION_RENEW_WINDOW_MS = 5 * 60 * 1e3;
8963
+ var publicSessionInflight = /* @__PURE__ */ new Map();
8962
8964
  var PublicAccessClientError = class extends Error {
8963
8965
  constructor(message3, options = {}) {
8964
8966
  super(message3);
@@ -8986,48 +8988,144 @@ var createPublicAccessClient = ({
8986
8988
  userAgent: input.userAgent || getCurrentUserAgent(),
8987
8989
  guestIdentifier: input.guestIdentifier || getOrCreatePublicGuestIdentifier(normalizedAppType)
8988
8990
  };
8989
- const response = await boundFetch(
8990
- buildServiceUrl3(
8991
- servicePrefix,
8992
- `/openxiangda-api/v1/apps/${encodeURIComponent(
8993
- normalizedAppType
8994
- )}/public/session`
8995
- ),
8996
- {
8997
- method: "POST",
8998
- credentials: "include",
8999
- headers: {
9000
- accept: "application/json",
9001
- "content-type": "application/json"
9002
- },
9003
- body: JSON.stringify(body)
9004
- }
8991
+ const identity = buildPublicSessionIdentity(
8992
+ normalizedAppType,
8993
+ servicePrefix,
8994
+ body
9005
8995
  );
9006
- const payload = await readPayload2(response);
9007
- const code = getRecordValue3(payload, "code");
9008
- const success = getRecordValue3(payload, "success");
9009
- if (!response.ok || success === false || !isSuccessCode7(code)) {
9010
- throw new PublicAccessClientError(
9011
- String(
9012
- getRecordValue3(payload, "message") || `Public access session failed: ${response.status}`
8996
+ const cached = readCachedPublicSession(identity);
8997
+ if (cached) return cached;
8998
+ const existing = publicSessionInflight.get(identity);
8999
+ if (existing) return existing;
9000
+ const pending = (async () => {
9001
+ const response = await boundFetch(
9002
+ buildServiceUrl3(
9003
+ servicePrefix,
9004
+ `/openxiangda-api/v1/apps/${encodeURIComponent(
9005
+ normalizedAppType
9006
+ )}/public/session`
9013
9007
  ),
9014
- { status: response.status, code, payload }
9008
+ {
9009
+ method: "POST",
9010
+ credentials: "include",
9011
+ headers: {
9012
+ accept: "application/json",
9013
+ "content-type": "application/json"
9014
+ },
9015
+ body: JSON.stringify(body)
9016
+ }
9015
9017
  );
9018
+ const payload = await readPayload2(response);
9019
+ const code = getRecordValue3(payload, "code");
9020
+ const success = getRecordValue3(payload, "success");
9021
+ if (!response.ok || success === false || !isSuccessCode7(code)) {
9022
+ throw new PublicAccessClientError(
9023
+ String(
9024
+ getRecordValue3(payload, "message") || `Public access session failed: ${response.status}`
9025
+ ),
9026
+ { status: response.status, code, payload }
9027
+ );
9028
+ }
9029
+ const data = getRecordValue3(payload, "data");
9030
+ const extra = getRecordValue3(payload, "extra");
9031
+ const session = {
9032
+ ...data,
9033
+ publicAccess: extra?.publicAccess || null,
9034
+ raw: payload
9035
+ };
9036
+ writeCachedPublicSession(identity, session);
9037
+ return session;
9038
+ })();
9039
+ publicSessionInflight.set(identity, pending);
9040
+ try {
9041
+ return await pending;
9042
+ } finally {
9043
+ if (publicSessionInflight.get(identity) === pending) {
9044
+ publicSessionInflight.delete(identity);
9045
+ }
9016
9046
  }
9017
- const data = getRecordValue3(payload, "data");
9018
- const extra = getRecordValue3(payload, "extra");
9019
- return {
9020
- ...data,
9021
- publicAccess: extra?.publicAccess || null,
9022
- raw: payload
9023
- };
9024
9047
  };
9025
9048
  return {
9026
9049
  appType: normalizedAppType,
9027
9050
  servicePrefix,
9028
- startSession: request
9051
+ startSession: request,
9052
+ clearSession: (input = {}) => {
9053
+ const body = {
9054
+ ...input,
9055
+ path: input.path || getCurrentPathname2(),
9056
+ domain: input.domain || getCurrentDomain(),
9057
+ userAgent: input.userAgent || getCurrentUserAgent(),
9058
+ guestIdentifier: input.guestIdentifier || getOrCreatePublicGuestIdentifier(normalizedAppType)
9059
+ };
9060
+ clearCachedPublicSession(
9061
+ buildPublicSessionIdentity(normalizedAppType, servicePrefix, body)
9062
+ );
9063
+ }
9029
9064
  };
9030
9065
  };
9066
+ var buildPublicSessionIdentity = (appType, servicePrefix, input) => JSON.stringify({
9067
+ appType,
9068
+ servicePrefix: servicePrefix.replace(/\/$/, ""),
9069
+ path: input.path || "",
9070
+ policyCode: input.policyCode || "",
9071
+ routeCode: input.routeCode || "",
9072
+ ticket: input.ticket || "",
9073
+ guestIdentifier: input.guestIdentifier || "",
9074
+ domain: input.domain || ""
9075
+ });
9076
+ var publicSessionStorageKey = (identity) => {
9077
+ let hash = 2166136261;
9078
+ for (let index = 0; index < identity.length; index += 1) {
9079
+ hash ^= identity.charCodeAt(index);
9080
+ hash = Math.imul(hash, 16777619);
9081
+ }
9082
+ return `openxiangda:public:session:v1:${identity.length}:${(hash >>> 0).toString(16)}`;
9083
+ };
9084
+ var readCachedPublicSession = (identity) => {
9085
+ try {
9086
+ if (typeof window === "undefined" || !window.sessionStorage) return null;
9087
+ const raw = window.sessionStorage.getItem(publicSessionStorageKey(identity));
9088
+ if (!raw) return null;
9089
+ const parsed = JSON.parse(raw);
9090
+ if (parsed.identity !== identity || !parsed.session) return null;
9091
+ if (!isPublicSessionReusable(parsed.session)) {
9092
+ clearCachedPublicSession(identity);
9093
+ return null;
9094
+ }
9095
+ return parsed.session;
9096
+ } catch {
9097
+ return null;
9098
+ }
9099
+ };
9100
+ var writeCachedPublicSession = (identity, session) => {
9101
+ if (!isPublicSessionReusable(session)) return;
9102
+ try {
9103
+ if (typeof window === "undefined" || !window.sessionStorage) return;
9104
+ const { raw: _raw, ...cacheableSession } = session;
9105
+ window.sessionStorage.setItem(
9106
+ publicSessionStorageKey(identity),
9107
+ JSON.stringify({ identity, session: cacheableSession })
9108
+ );
9109
+ } catch {
9110
+ }
9111
+ };
9112
+ var clearCachedPublicSession = (identity) => {
9113
+ try {
9114
+ if (typeof window !== "undefined" && window.sessionStorage) {
9115
+ window.sessionStorage.removeItem(publicSessionStorageKey(identity));
9116
+ }
9117
+ } catch {
9118
+ }
9119
+ };
9120
+ var isPublicSessionReusable = (session) => {
9121
+ const accessTokenExpiresAt = Number(session.accessTokenExpiresAt);
9122
+ if (!Number.isFinite(accessTokenExpiresAt) || accessTokenExpiresAt <= 0) {
9123
+ return false;
9124
+ }
9125
+ const policyExpiresAt = session.publicAccess?.expiresAt ? new Date(session.publicAccess.expiresAt).getTime() : Number.POSITIVE_INFINITY;
9126
+ const expiresAt = Math.min(accessTokenExpiresAt, policyExpiresAt);
9127
+ return expiresAt - Date.now() >= PUBLIC_SESSION_RENEW_WINDOW_MS;
9128
+ };
9031
9129
  var buildServiceUrl3 = (servicePrefix, path) => {
9032
9130
  const prefix = servicePrefix.endsWith("/") ? servicePrefix.slice(0, -1) : servicePrefix;
9033
9131
  const suffix = path.startsWith("/") ? path : `/${path}`;
@@ -9110,29 +9208,40 @@ var usePublicAccess = (options = {}) => {
9110
9208
  setError(null);
9111
9209
  try {
9112
9210
  const resolvedPath = input.path || stableSessionInput.path || readPathFromLocation();
9113
- const data = await client.startSession({
9211
+ const resolvedInput = {
9114
9212
  ...stableSessionInput,
9115
9213
  ...input,
9116
9214
  ticket: input.ticket || stableSessionInput.ticket || readTicketFromLocation(),
9117
9215
  path: resolvedPath
9118
- });
9119
- if (!mountedRef.current) return data;
9120
- activeSessionRef.current = {
9121
- accessToken: data.accessToken,
9122
- path: resolvedPath
9123
9216
  };
9124
- setSession(data);
9125
- setAccessToken(data.accessToken, {
9126
- scope: "public",
9127
- path: resolvedPath
9128
- });
9129
- await reloadRuntime({
9130
- accessToken: data.accessToken,
9131
- accessTokenOptions: {
9217
+ let data = await client.startSession(resolvedInput);
9218
+ if (!mountedRef.current) return data;
9219
+ const activateSession = async (next) => {
9220
+ activeSessionRef.current = {
9221
+ accessToken: next.accessToken,
9222
+ path: resolvedPath
9223
+ };
9224
+ setSession(next);
9225
+ setAccessToken(next.accessToken, {
9132
9226
  scope: "public",
9133
9227
  path: resolvedPath
9134
- }
9135
- });
9228
+ });
9229
+ await reloadRuntime({
9230
+ accessToken: next.accessToken,
9231
+ accessTokenOptions: {
9232
+ scope: "public",
9233
+ path: resolvedPath
9234
+ }
9235
+ });
9236
+ };
9237
+ try {
9238
+ await activateSession(data);
9239
+ } catch (activationError) {
9240
+ if (!isUnauthorizedPublicSessionError(activationError)) throw activationError;
9241
+ client.clearSession(resolvedInput);
9242
+ data = await client.startSession(resolvedInput);
9243
+ await activateSession(data);
9244
+ }
9136
9245
  if (!mountedRef.current) return data;
9137
9246
  setLoading(false);
9138
9247
  return data;
@@ -9194,6 +9303,13 @@ var readTicketFromLocation = () => {
9194
9303
  return new URLSearchParams(window.location.search).get("ticket") || void 0;
9195
9304
  };
9196
9305
  var readPathFromLocation = () => typeof window === "undefined" ? void 0 : window.location.pathname;
9306
+ var isUnauthorizedPublicSessionError = (error) => {
9307
+ if (!error || typeof error !== "object") return false;
9308
+ const status = Number(
9309
+ error.status ?? error.statusCode
9310
+ );
9311
+ return status === 401 || status === 403;
9312
+ };
9197
9313
  export {
9198
9314
  AttachmentPreviewList,
9199
9315
  AuthClientError,