Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { type CalculationScope } from '@amalia/amalia-lang/formula/evaluate/shared';
import { AmaliaAccessorKeywords } from '@amalia/amalia-lang/tokens/types';
import { type FormatsEnum } from '@amalia/data-capture/fields/types';
import { dayjs } from '@amalia/ext/dayjs';
import { type ComputeEngine2DTable, type ComputeEnginePrimitiveTypes } from '@amalia/payout-calculation/types';
// Hardcoding a date so it doesn't change in the tests, and it's not used in the app anyway.
// I put my birthdate because why not.
const randomDate = dayjs('1995-06-12').unix().toString();
export const scopeValuesByFormat: Record<FormatsEnum, ComputeEngine2DTable | ComputeEnginePrimitiveTypes> = {
'date-time': randomDate,
boolean: true,
currency: 1,
date: randomDate,
number: 1,
percent: 1,
table: [[]],
text: 'string',
};
export const commonScope = {
[AmaliaAccessorKeywords.statementPeriod]: {
id: scopeValuesByFormat.text,
currentDate: scopeValuesByFormat.date,
startDate: scopeValuesByFormat.date,
endDate: scopeValuesByFormat.date,
startOfQuarter: scopeValuesByFormat.date,
startOfMonth: scopeValuesByFormat.date,
startOfSemester: scopeValuesByFormat.date,
startOfYear: scopeValuesByFormat.date,
endOfQuarter: scopeValuesByFormat.date,
endOfMonth: scopeValuesByFormat.date,
endOfSemester: scopeValuesByFormat.date,
endOfYear: scopeValuesByFormat.date,
},
[AmaliaAccessorKeywords.user]: {
id: scopeValuesByFormat.text,
email: scopeValuesByFormat.text,
firstName: scopeValuesByFormat.text,
lastName: scopeValuesByFormat.text,
teamMembers: scopeValuesByFormat.table,
externalId: scopeValuesByFormat.text,
currency: scopeValuesByFormat.text,
hrisId: scopeValuesByFormat.text,
},
[AmaliaAccessorKeywords.planAssignement]: {
effectiveAsOf: scopeValuesByFormat.date,
effectiveUntil: scopeValuesByFormat.date,
planId: scopeValuesByFormat.text,
[AmaliaAccessorKeywords.plan]: {
id: scopeValuesByFormat.text,
name: scopeValuesByFormat.text,
},
},
[AmaliaAccessorKeywords.plan]: {
id: scopeValuesByFormat.text,
name: scopeValuesByFormat.text,
},
[AmaliaAccessorKeywords.teamAssignment]: {
effectiveAsOf: scopeValuesByFormat.date,
effectiveUntil: scopeValuesByFormat.date,
},
[AmaliaAccessorKeywords.team]: {
name: scopeValuesByFormat.text,
members: scopeValuesByFormat.table,
managers: scopeValuesByFormat.table,
employees: scopeValuesByFormat.table,
},
} as CalculationScope;
|