payroll-gateway-transform.mjs 894 B

1234567891011121314
  1. const brokenHistoricalReservationWrapper = /async function historicalReservationPreviewLegacy\(context,input\)\{const co=payrollTenant\(context,input\),data=await historicalReservationPreviewLegacy\(context,input\)[^\n]*\}\n?/g;
  2. export function normalizeHistoricalReservationPreviewBase(code) {
  3. let normalized = code.replace(brokenHistoricalReservationWrapper, '');
  4. if (!normalized.includes('async function historicalReservationPreviewLegacy(context,input){')) {
  5. normalized = normalized.replace(
  6. 'async function historicalReservationPreview(context,input){',
  7. 'async function historicalReservationPreviewLegacy(context,input){',
  8. );
  9. }
  10. const legacyCount = normalized.split('async function historicalReservationPreviewLegacy(context,input){').length - 1;
  11. if (legacyCount !== 1) throw new Error('历史预约预览基础函数版本不兼容');
  12. return normalized;
  13. }