@classytic/ca-tax 0.0.1
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/CHANGELOG.md +62 -0
- package/LICENSE +21 -0
- package/README.md +78 -0
- package/dist/forms/index.d.mts +2 -0
- package/dist/forms/index.mjs +2 -0
- package/dist/forms.mjs +7786 -0
- package/dist/gst-hst/index.d.mts +2 -0
- package/dist/gst-hst/index.mjs +2 -0
- package/dist/gst-hst.mjs +675 -0
- package/dist/index.d.mts +622 -0
- package/dist/index.mjs +98 -0
- package/dist/index2.d.mts +182 -0
- package/dist/index3.d.mts +5603 -0
- package/dist/index4.d.mts +32 -0
- package/dist/t2/index.d.mts +3 -0
- package/dist/t2/index.mjs +3 -0
- package/dist/t2.mjs +6176 -0
- package/docs/research-2026-07.md +72 -0
- package/package.json +92 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,622 @@
|
|
|
1
|
+
//#region src/forms/types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* THE FORM MODEL — what a tax form *is*, as data.
|
|
4
|
+
*
|
|
5
|
+
* A filed return is not a set of numbers; it is a set of numbers **keyed by line
|
|
6
|
+
* number**. Every value CRA or TRA receives arrives against an identifier they
|
|
7
|
+
* assigned, and a figure with no identifier cannot be transmitted at all. So the
|
|
8
|
+
* line number is not metadata sitting on top of the calculation — it is half the
|
|
9
|
+
* calculation, and it belongs in typed data rather than in prose.
|
|
10
|
+
*
|
|
11
|
+
* This module is the jurisdiction-neutral vocabulary the federal T2, the Alberta
|
|
12
|
+
* AT1 and the Québec CO-17 form definitions all speak.
|
|
13
|
+
*
|
|
14
|
+
* ── Why TypeScript and not YAML or JSON ─────────────────────────────────────
|
|
15
|
+
*
|
|
16
|
+
* The obvious instinct is a data format — a YAML file per schedule. Rejected,
|
|
17
|
+
* for reasons that are worth stating because the instinct is a good one:
|
|
18
|
+
*
|
|
19
|
+
* - **A typo in YAML is a runtime surprise.** `side: deduc` or a section id
|
|
20
|
+
* that matches nothing parses perfectly and fails when someone files. In
|
|
21
|
+
* TypeScript both are compile errors, and the compiler checks every
|
|
22
|
+
* cross-reference in this file for free.
|
|
23
|
+
* - **The engine must stay dependency-free.** The purity audit exists to keep
|
|
24
|
+
* anything non-deterministic out of the graph; a YAML parser is a runtime
|
|
25
|
+
* dependency bought for no benefit when the consumer is already TypeScript.
|
|
26
|
+
* - **The reasoning has to live beside the data.** Half of what is known about
|
|
27
|
+
* a line is *why* it behaves as it does — that a figure is capped, that it
|
|
28
|
+
* carries to another schedule, that the numbering skips. JSON cannot hold a
|
|
29
|
+
* comment at all, and this project's whole discipline is that the reasoning
|
|
30
|
+
* travels with the code.
|
|
31
|
+
*
|
|
32
|
+
* What the machine extracts and what a human knows are still kept apart, because
|
|
33
|
+
* conflating them is how a regeneration silently discards someone's research:
|
|
34
|
+
*
|
|
35
|
+
* research/sources/cra-forms/<FORM>.pdf the primary source
|
|
36
|
+
* │ pdftotext -layout + parse
|
|
37
|
+
* ▼
|
|
38
|
+
* research/sources/cra-forms/<FORM>.lines.tsv extracted; regenerate freely
|
|
39
|
+
* │ generate
|
|
40
|
+
* ▼
|
|
41
|
+
* forms/generated/<form>.captions.ts GENERATED — never hand-edited
|
|
42
|
+
* │ referenced by
|
|
43
|
+
* ▼
|
|
44
|
+
* forms/<form>.ts HAND-AUTHORED — sections,
|
|
45
|
+
* roles, cross-form links, notes
|
|
46
|
+
*
|
|
47
|
+
* One author per file. A caption change in a CRA reprint shows up as a diff in
|
|
48
|
+
* the extracted table; the human structure beside it is untouched.
|
|
49
|
+
*/
|
|
50
|
+
/**
|
|
51
|
+
* How a jurisdiction identifies a field.
|
|
52
|
+
*
|
|
53
|
+
* These are genuinely different schemes and must not be conflated — a three
|
|
54
|
+
* digit CRA line and a nine character Alberta Line-Item-ID are not the same kind
|
|
55
|
+
* of thing, and code that assumes one shape breaks silently on the other.
|
|
56
|
+
*/
|
|
57
|
+
type LineNumberScheme = /** CRA federal: a three-digit line number — `'101'`, `'403'`, `'500'`. */'cra-line'
|
|
58
|
+
/**
|
|
59
|
+
* Alberta TRA: `SSSFFFOOO` — schedule, field, occurrence. Nine characters in
|
|
60
|
+
* Net File and eleven in the RSI print format (a two-character prefix).
|
|
61
|
+
*/
|
|
62
|
+
| 'tra-line-item-id'
|
|
63
|
+
/**
|
|
64
|
+
* Revenu Québec: a box number that may carry a LETTER — `'299'`, `'420c'`,
|
|
65
|
+
* `'421bi'`. The suffix is significant: `420c` is its own box, not a sub-part
|
|
66
|
+
* of `420`, so anything that assumes three digits will truncate it.
|
|
67
|
+
*/
|
|
68
|
+
| 'rq-box';
|
|
69
|
+
/** What kind of value a field holds — drives both rendering and validation. */
|
|
70
|
+
type FormFieldKind = /** Whole dollars. The overwhelming majority. */'money' /** A date, transmitted in the jurisdiction's own format. */ | 'date' /** Free text — a name, an address line, a description on an open row. */ | 'text' /** A proportion, such as an allocation factor. */ | 'rate' /** A yes/no or tick box. */ | 'flag' /** A code from a fixed list — a CCA class, a province, a corporation type. */ | 'code';
|
|
71
|
+
/**
|
|
72
|
+
* Who supplies the value.
|
|
73
|
+
*
|
|
74
|
+
* The distinction that matters is `input` versus everything else: only an
|
|
75
|
+
* `input` is a box a preparer types into. Rendering a `total` as editable
|
|
76
|
+
* invites someone to overwrite a computed figure, and the return then does not
|
|
77
|
+
* foot against its own schedules.
|
|
78
|
+
*/
|
|
79
|
+
type FormFieldRole = /** The preparer enters it. */'input' /** The engine derives it from other lines on this form. */ | 'computed' /** A subtotal or total of other lines on this form. */ | 'total' /** It arrives from another schedule, and is not entered here. */ | 'carried-in';
|
|
80
|
+
/** Which side of a reconciliation a line falls on, where the form has sides. */
|
|
81
|
+
type FormFieldSide = 'add' | 'deduct';
|
|
82
|
+
/**
|
|
83
|
+
* Whether the field must be present in a transmission.
|
|
84
|
+
*
|
|
85
|
+
* Alberta's specification is explicit about this and enforces it: a mandatory
|
|
86
|
+
* numeric field must be emitted even when nil, and omitting it is a rejection
|
|
87
|
+
* rather than a tidier payload. Modelled here so the renderers can obey it
|
|
88
|
+
* rather than each guessing.
|
|
89
|
+
*/
|
|
90
|
+
type FormFieldRequirement = /** Must be transmitted, printing zero when null. */'mandatory' /** Omitted entirely when null. */ | 'optional' /** Becomes mandatory when its condition is met. */ | 'conditional';
|
|
91
|
+
/** A pointer at a line on another form — the seam between schedules. */
|
|
92
|
+
interface FormLineRef {
|
|
93
|
+
/** The other form's id, as `FormDefinition.id` — `'T2SCH53'`, `'AT1SCH12'`. */
|
|
94
|
+
form: string;
|
|
95
|
+
/** The line on that form. */
|
|
96
|
+
line: string;
|
|
97
|
+
/** Why the value moves, when it is not obvious. */
|
|
98
|
+
note?: string;
|
|
99
|
+
}
|
|
100
|
+
/** One numbered field on a form. */
|
|
101
|
+
interface FormField {
|
|
102
|
+
/** The identifier the value is transmitted under. The primary key. */
|
|
103
|
+
line: string;
|
|
104
|
+
/** The caption **exactly as printed**. Never paraphrased. */
|
|
105
|
+
caption: string;
|
|
106
|
+
kind: FormFieldKind;
|
|
107
|
+
role: FormFieldRole;
|
|
108
|
+
/** The section it belongs to — `FormSection.id`. */
|
|
109
|
+
section: string;
|
|
110
|
+
/** Which side of the reconciliation, on forms that have sides. */
|
|
111
|
+
side?: FormFieldSide;
|
|
112
|
+
requirement?: FormFieldRequirement;
|
|
113
|
+
/** The page of the printed form, where the form runs to several. */
|
|
114
|
+
page?: number;
|
|
115
|
+
/** Where the figure comes from, when it is carried in from elsewhere. */
|
|
116
|
+
from?: FormLineRef;
|
|
117
|
+
/** Where the figure goes, when the form says to enter it elsewhere. */
|
|
118
|
+
to?: FormLineRef;
|
|
119
|
+
/**
|
|
120
|
+
* Anything a reader needs that the caption does not say — a cap, a statutory
|
|
121
|
+
* reference, a trap. This is the field that stops knowledge decaying into
|
|
122
|
+
* folklore.
|
|
123
|
+
*/
|
|
124
|
+
note?: string;
|
|
125
|
+
}
|
|
126
|
+
/** A titled block of fields, mirroring how the form itself is divided. */
|
|
127
|
+
interface FormSection {
|
|
128
|
+
id: string;
|
|
129
|
+
title: string;
|
|
130
|
+
/** The page it begins on. */
|
|
131
|
+
page?: number;
|
|
132
|
+
/** Shown under the heading — the guidance a preparer needs at that point. */
|
|
133
|
+
description?: string;
|
|
134
|
+
/**
|
|
135
|
+
* Continuation and overflow sections a typical return leaves empty. The
|
|
136
|
+
* interface may collapse these; the data still transmits.
|
|
137
|
+
*/
|
|
138
|
+
secondary?: boolean;
|
|
139
|
+
}
|
|
140
|
+
/** Where a definition came from, so a reader can check it against the original. */
|
|
141
|
+
interface FormProvenance {
|
|
142
|
+
/** Repository-relative path to the primary document. */
|
|
143
|
+
document: string;
|
|
144
|
+
/** ISO date the document was retrieved. */
|
|
145
|
+
retrieved: string;
|
|
146
|
+
/** The form's own revision marker — `'T2 SCH 1 E (25)'`, a TRA spec version. */
|
|
147
|
+
revision?: string;
|
|
148
|
+
}
|
|
149
|
+
/** A complete form definition. */
|
|
150
|
+
interface FormDefinition {
|
|
151
|
+
/** Stable id — `'T2SCH1'`, `'AT1SCH13'`. Used by {@link FormLineRef}. */
|
|
152
|
+
id: string;
|
|
153
|
+
/** The filing programme this form belongs to. */
|
|
154
|
+
program: 'T2' | 'AT1' | 'CO17';
|
|
155
|
+
/** The schedule number as the jurisdiction writes it — `'1'`, `'013'`. */
|
|
156
|
+
schedule: string;
|
|
157
|
+
/** The official title. */
|
|
158
|
+
title: string;
|
|
159
|
+
scheme: LineNumberScheme;
|
|
160
|
+
/** First tax year this revision applies to, and the last where it has ended. */
|
|
161
|
+
taxYears: {
|
|
162
|
+
from: number;
|
|
163
|
+
to?: number;
|
|
164
|
+
};
|
|
165
|
+
sections: readonly FormSection[];
|
|
166
|
+
fields: readonly FormField[];
|
|
167
|
+
provenance: FormProvenance;
|
|
168
|
+
}
|
|
169
|
+
/** Index a definition's fields by line number. */
|
|
170
|
+
declare function indexByLine(form: FormDefinition): ReadonlyMap<string, FormField>;
|
|
171
|
+
/** The fields in one section, in the order the form prints them. */
|
|
172
|
+
declare function fieldsInSection(form: FormDefinition, sectionId: string): FormField[];
|
|
173
|
+
/** Every field a preparer actually types into. */
|
|
174
|
+
declare function inputFields(form: FormDefinition): FormField[];
|
|
175
|
+
/** A field is transmissible when it exists on the form and is not a computed total. */
|
|
176
|
+
declare function isEnterableLine(form: FormDefinition, line: string): boolean;
|
|
177
|
+
/**
|
|
178
|
+
* Structural problems in a definition — the checks a type cannot make.
|
|
179
|
+
*
|
|
180
|
+
* Run as a test rather than at runtime: a malformed definition is a bug in the
|
|
181
|
+
* repository, not a condition a filed return should discover.
|
|
182
|
+
*/
|
|
183
|
+
declare function validateFormDefinition(form: FormDefinition): string[];
|
|
184
|
+
//#endregion
|
|
185
|
+
//#region src/t2/at1/forms/jacket.d.ts
|
|
186
|
+
declare const AT1_JACKET: FormDefinition;
|
|
187
|
+
/** 000080001 — Alberta tax payable, before credits. */
|
|
188
|
+
declare const AT1_TAX_PAYABLE_LINE: string;
|
|
189
|
+
/** 000090001 — the balance, signed. Negative is an overpayment. */
|
|
190
|
+
declare const AT1_BALANCE_LINE: string;
|
|
191
|
+
/**
|
|
192
|
+
* The five credits the specification nets against 080 to reach 090. The
|
|
193
|
+
* Innovation Employment Grant (129) is NOT among them.
|
|
194
|
+
*/
|
|
195
|
+
declare const AT1_BALANCE_CREDIT_LINES: readonly string[];
|
|
196
|
+
//#endregion
|
|
197
|
+
//#region src/t2/at1/forms/schedule12.d.ts
|
|
198
|
+
/**
|
|
199
|
+
* One reconciling item. `federal` is the odd line, `alberta` the even one.
|
|
200
|
+
*
|
|
201
|
+
* `emitOnlyWhenDifferent` carries the form's own instruction so a renderer
|
|
202
|
+
* cannot forget it — see the note at the top of this file.
|
|
203
|
+
*/
|
|
204
|
+
interface AlbertaReconcilingPair {
|
|
205
|
+
label: string;
|
|
206
|
+
federal: string;
|
|
207
|
+
alberta: string;
|
|
208
|
+
section: 'area-a' | 'area-b';
|
|
209
|
+
emitOnlyWhenDifferent: true;
|
|
210
|
+
note?: string;
|
|
211
|
+
}
|
|
212
|
+
declare const AT1_SCHEDULE_12_PAIRS: readonly AlbertaReconcilingPair[];
|
|
213
|
+
declare const AT1_SCHEDULE_12: FormDefinition;
|
|
214
|
+
//#endregion
|
|
215
|
+
//#region src/t2/at1/forms/schedule13.d.ts
|
|
216
|
+
/**
|
|
217
|
+
* One column of the Alberta CCA grid. `line` is absent where the column is
|
|
218
|
+
* arithmetic the form shows and does not number.
|
|
219
|
+
*/
|
|
220
|
+
interface AlbertaCcaColumn {
|
|
221
|
+
column: number;
|
|
222
|
+
caption: string;
|
|
223
|
+
line?: string;
|
|
224
|
+
note?: string;
|
|
225
|
+
}
|
|
226
|
+
declare const AT1_SCHEDULE_13_COLUMNS: readonly AlbertaCcaColumn[];
|
|
227
|
+
declare const AT1_SCHEDULE_13: FormDefinition;
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/t2/at1/forms/schedule16.d.ts
|
|
230
|
+
declare const AT1_SCHEDULE_16: FormDefinition;
|
|
231
|
+
/** Line 022 becomes the following year's line 012. */
|
|
232
|
+
declare const AT1_SCHEDULE_16_CARRYFORWARD_LINE = "016022001";
|
|
233
|
+
//#endregion
|
|
234
|
+
//#region src/t2/at1/forms/schedule17.d.ts
|
|
235
|
+
/**
|
|
236
|
+
* One reserve kind. `federal` names the matching federal Schedule 13 line where
|
|
237
|
+
* one exists — the two schedules are meant to be compared, and the reconciling
|
|
238
|
+
* item on Schedule 12 is the difference between them.
|
|
239
|
+
*/
|
|
240
|
+
interface AlbertaReserveKind {
|
|
241
|
+
label: string;
|
|
242
|
+
opening: string;
|
|
243
|
+
transfer: string;
|
|
244
|
+
closing: string;
|
|
245
|
+
/** The federal Schedule 13 opening line, where the kind exists federally. */
|
|
246
|
+
federalOpening?: string;
|
|
247
|
+
}
|
|
248
|
+
declare const AT1_SCHEDULE_17_RESERVES: readonly AlbertaReserveKind[];
|
|
249
|
+
declare const AT1_SCHEDULE_17: FormDefinition;
|
|
250
|
+
//#endregion
|
|
251
|
+
//#region src/t2/at1/forms/schedule18.d.ts
|
|
252
|
+
/** One category of disposed property, and its four columns. */
|
|
253
|
+
interface DispositionCategory {
|
|
254
|
+
label: string;
|
|
255
|
+
/** A — proceeds of disposition. */
|
|
256
|
+
proceeds: string;
|
|
257
|
+
/** B — adjusted cost base. */
|
|
258
|
+
adjustedCostBase: string;
|
|
259
|
+
/** C — outlays and expenses. */
|
|
260
|
+
outlays: string;
|
|
261
|
+
/** D — the resulting gain or loss. */
|
|
262
|
+
gainOrLoss: string;
|
|
263
|
+
/** Losses on this category are not deductible against ordinary gains. */
|
|
264
|
+
lossRestricted?: boolean;
|
|
265
|
+
}
|
|
266
|
+
declare const AT1_SCHEDULE_18_CATEGORIES: readonly DispositionCategory[];
|
|
267
|
+
declare const AT1_SCHEDULE_18: FormDefinition;
|
|
268
|
+
/** Lines 096 and 098 gross the federal Schedule 73 figures back up. */
|
|
269
|
+
declare const AT1_SECTION_34_2_GROSS_UP = 2;
|
|
270
|
+
//#endregion
|
|
271
|
+
//#region src/t2/at1/forms/schedule20.d.ts
|
|
272
|
+
/** The ten rows every donation continuity runs through, in form order. */
|
|
273
|
+
declare const CONTINUITY_ROWS: readonly [readonly ["opening", "Balance at the end of the previous year"], readonly ["expired", "Deduct: expired"], readonly ["beginning", "Balance at the beginning of the year"], readonly ["transferred", "Add: transferred on an amalgamation or wind-up"], readonly ["currentYear", "Add: donations and gifts made in the current year"], readonly ["subtotal", "Subtotal"], readonly ["acquisitionOfControl", "Adjustment on an acquisition of control"], readonly ["available", "Amount available for deduction"], readonly ["applied", "Amount applied against income"], readonly ["closing", "Closing balance carried forward"]];
|
|
274
|
+
type ContinuityRow = (typeof CONTINUITY_ROWS)[number][0];
|
|
275
|
+
/** One of the two pools, and its ten lines. */
|
|
276
|
+
interface DonationPool {
|
|
277
|
+
key: 'charitable' | 'gifts';
|
|
278
|
+
label: string;
|
|
279
|
+
lines: Record<ContinuityRow, string>;
|
|
280
|
+
}
|
|
281
|
+
declare const AT1_SCHEDULE_20_POOLS: readonly DonationPool[];
|
|
282
|
+
declare const AT1_SCHEDULE_20: FormDefinition;
|
|
283
|
+
/**
|
|
284
|
+
* Donations carry forward five years.
|
|
285
|
+
*
|
|
286
|
+
* The Area B rates are NOT redefined here: `AT1_DONATION_INCOME_RATE` and
|
|
287
|
+
* `AT1_DONATION_GAIN_RATE` already belong to the computation in
|
|
288
|
+
* `../schedules/schedule20-maximum.ts`, and a second copy beside the form
|
|
289
|
+
* definition is exactly the kind of duplicate that drifts.
|
|
290
|
+
*/
|
|
291
|
+
declare const AT1_DONATION_CARRYFORWARD_YEARS = 5;
|
|
292
|
+
//#endregion
|
|
293
|
+
//#region src/t2/at1/forms/schedule21.d.ts
|
|
294
|
+
/** One of the five loss pools, and its continuity lines. */
|
|
295
|
+
interface AlbertaLossPool {
|
|
296
|
+
key: 'non-capital' | 'capital' | 'farm' | 'restricted-farm' | 'listed-personal';
|
|
297
|
+
label: string;
|
|
298
|
+
carriedForward: string;
|
|
299
|
+
expired?: string;
|
|
300
|
+
opening?: string;
|
|
301
|
+
windUpTransfer?: string;
|
|
302
|
+
currentYearLoss: string;
|
|
303
|
+
appliedAgainstIncome?: string;
|
|
304
|
+
section80Adjustment?: string;
|
|
305
|
+
otherAdjustments?: string;
|
|
306
|
+
carryBack: string;
|
|
307
|
+
closing: string;
|
|
308
|
+
/** The Schedule 12 line this pool's claim lands on. */
|
|
309
|
+
toSchedule12?: string;
|
|
310
|
+
}
|
|
311
|
+
declare const AT1_SCHEDULE_21_POOLS: readonly AlbertaLossPool[];
|
|
312
|
+
declare const AT1_SCHEDULE_21: FormDefinition;
|
|
313
|
+
//#endregion
|
|
314
|
+
//#region src/t2/at1/forms/schedule29.d.ts
|
|
315
|
+
declare const AT1_SCHEDULE_29: FormDefinition;
|
|
316
|
+
/** Eight per cent, up to the base level of spending. */
|
|
317
|
+
declare const AT1_IEG_BASE_RATE = 0.08;
|
|
318
|
+
/** Twenty per cent, on the increment above it. */
|
|
319
|
+
declare const AT1_IEG_ENHANCED_RATE = 0.2;
|
|
320
|
+
/** The annual cap on eligible expenditures, shared across an associated group. */
|
|
321
|
+
declare const AT1_IEG_MAX_EXPENDITURE = 4000000;
|
|
322
|
+
/** The base level averages this many prior years. */
|
|
323
|
+
declare const AT1_IEG_PRIOR_YEARS = 2;
|
|
324
|
+
/** The jacket line the grant lands on — mandatory, and zero when absent. */
|
|
325
|
+
declare const AT1_IEG_JACKET_LINE = "000129001";
|
|
326
|
+
//#endregion
|
|
327
|
+
//#region src/t2/co17/forms/co17.d.ts
|
|
328
|
+
declare const CO17_RETURN: FormDefinition;
|
|
329
|
+
/** Box 299 — revenu imposable, the Québec taxable income. */
|
|
330
|
+
declare const CO17_TAXABLE_INCOME_BOX = "299";
|
|
331
|
+
/** Box 421 — the proportion of business done in Québec. */
|
|
332
|
+
declare const CO17_QUEBEC_PROPORTION_BOX = "421";
|
|
333
|
+
/** Box 425 — impôt à payer. */
|
|
334
|
+
declare const CO17_TAX_PAYABLE_BOX = "425";
|
|
335
|
+
//#endregion
|
|
336
|
+
//#region src/t2/forms/jacket.d.ts
|
|
337
|
+
declare const T2_JACKET: FormDefinition;
|
|
338
|
+
/** Line 300 — where Schedule 1 lands, and the start of the return proper. */
|
|
339
|
+
declare const T2_NET_INCOME_FOR_TAX_LINE = "300";
|
|
340
|
+
/** Line 360 — taxable income. */
|
|
341
|
+
declare const T2_TAXABLE_INCOME_LINE = "360";
|
|
342
|
+
/** Line 550 — the base amount of Part I tax, taxable income at 38%. */
|
|
343
|
+
declare const T2_BASE_PART_I_RATE = 0.38;
|
|
344
|
+
/** Line 430 — the small business deduction rate. */
|
|
345
|
+
declare const T2_SMALL_BUSINESS_DEDUCTION_RATE = 0.19;
|
|
346
|
+
/** Line 770 — total tax payable. */
|
|
347
|
+
declare const T2_TOTAL_TAX_PAYABLE_LINE = "770";
|
|
348
|
+
//#endregion
|
|
349
|
+
//#region src/t2/forms/schedule1.d.ts
|
|
350
|
+
declare const T2_SCHEDULE_1: FormDefinition;
|
|
351
|
+
/** Line 500 — total additions. */
|
|
352
|
+
declare const SCHEDULE_1_TOTAL_ADDITIONS_LINE = "500";
|
|
353
|
+
/** Line 510 — total deductions. */
|
|
354
|
+
declare const SCHEDULE_1_TOTAL_DEDUCTIONS_LINE = "510";
|
|
355
|
+
/**
|
|
356
|
+
* Schedule 1 fields by CRA line number.
|
|
357
|
+
*
|
|
358
|
+
* Derived from the definition rather than maintained beside it, so the lookup
|
|
359
|
+
* and the form can never disagree.
|
|
360
|
+
*/
|
|
361
|
+
declare const SCHEDULE_1_LINE_BY_NUMBER: ReadonlyMap<string, FormField>;
|
|
362
|
+
/** Every Schedule 1 field, in the order the form prints them. */
|
|
363
|
+
declare const SCHEDULE_1_LINES: readonly FormField[];
|
|
364
|
+
//#endregion
|
|
365
|
+
//#region src/t2/forms/schedule2.d.ts
|
|
366
|
+
declare const T2_SCHEDULE_2: FormDefinition;
|
|
367
|
+
/** Line 210 — charitable donations made this year, the figure Schedule 1 line 112 mirrors. */
|
|
368
|
+
declare const SCHEDULE_2_CHARITABLE_CURRENT_LINE = "210";
|
|
369
|
+
/** How long each kind of gift may be carried forward. */
|
|
370
|
+
declare const SCHEDULE_2_CARRYFORWARD_YEARS: {
|
|
371
|
+
readonly charitable: 5;
|
|
372
|
+
readonly cultural: 5;
|
|
373
|
+
readonly ecological: 10;
|
|
374
|
+
};
|
|
375
|
+
//#endregion
|
|
376
|
+
//#region src/t2/forms/schedule3.d.ts
|
|
377
|
+
declare const T2_SCHEDULE_3: FormDefinition;
|
|
378
|
+
/** Line 460 — taxable dividends paid that qualify for a dividend refund. */
|
|
379
|
+
declare const SCHEDULE_3_TAXABLE_PAID_LINE = "460";
|
|
380
|
+
/** Line 465 — total eligible dividends paid, the figure GRIP is measured against. */
|
|
381
|
+
declare const SCHEDULE_3_ELIGIBLE_PAID_LINE = "465";
|
|
382
|
+
//#endregion
|
|
383
|
+
//#region src/t2/forms/schedule4.d.ts
|
|
384
|
+
declare const T2_SCHEDULE_4: FormDefinition;
|
|
385
|
+
/** Non-capital losses carry forward twenty years. */
|
|
386
|
+
declare const SCHEDULE_4_NON_CAPITAL_CARRYFORWARD_YEARS = 20;
|
|
387
|
+
/** Listed personal property losses carry forward seven. */
|
|
388
|
+
declare const SCHEDULE_4_LPP_CARRYFORWARD_YEARS = 7;
|
|
389
|
+
/** Every loss type may be carried back three years. */
|
|
390
|
+
declare const SCHEDULE_4_CARRYBACK_YEARS = 3;
|
|
391
|
+
//#endregion
|
|
392
|
+
//#region src/t2/forms/schedule5.d.ts
|
|
393
|
+
/** One row of Part 1, exactly as printed. */
|
|
394
|
+
interface AllocationJurisdiction {
|
|
395
|
+
name: string;
|
|
396
|
+
/** Column A — tick if the corporation had a permanent establishment here. */
|
|
397
|
+
code: string;
|
|
398
|
+
/** Column B — total salaries and wages paid in the jurisdiction. */
|
|
399
|
+
salaries: string;
|
|
400
|
+
/** Column D — gross revenue attributable to the jurisdiction. */
|
|
401
|
+
grossRevenue: string;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Every jurisdiction on Part 1, read off the rendered form. Two provinces carry
|
|
405
|
+
* a second OFFSHORE row (Newfoundland 004, Nova Scotia 008) — offshore activity
|
|
406
|
+
* is allocated separately from the onshore province.
|
|
407
|
+
*/
|
|
408
|
+
declare const SCHEDULE_5_JURISDICTIONS: readonly AllocationJurisdiction[];
|
|
409
|
+
declare const T2_SCHEDULE_5: FormDefinition;
|
|
410
|
+
/** Column B is the jurisdiction code plus 100; column D is the code plus 140. */
|
|
411
|
+
declare const SCHEDULE_5_SALARIES_OFFSET = 100;
|
|
412
|
+
declare const SCHEDULE_5_REVENUE_OFFSET = 140;
|
|
413
|
+
//#endregion
|
|
414
|
+
//#region src/t2/forms/schedule6.d.ts
|
|
415
|
+
/** One property category and the columns of its grid. */
|
|
416
|
+
interface DispositionGrid {
|
|
417
|
+
section: string;
|
|
418
|
+
label: string;
|
|
419
|
+
/** Column line numbers in form order. */
|
|
420
|
+
columns: readonly {
|
|
421
|
+
line: string;
|
|
422
|
+
caption: string;
|
|
423
|
+
kind?: FormField['kind'];
|
|
424
|
+
}[];
|
|
425
|
+
/** The gain (or loss) column, which some parts floor at nil. */
|
|
426
|
+
gainLine: string;
|
|
427
|
+
/** True where the form prints "if negative, enter 0". */
|
|
428
|
+
lossRestricted?: boolean;
|
|
429
|
+
}
|
|
430
|
+
declare const SCHEDULE_6_GRIDS: readonly DispositionGrid[];
|
|
431
|
+
declare const T2_SCHEDULE_6: FormDefinition;
|
|
432
|
+
//#endregion
|
|
433
|
+
//#region src/t2/forms/schedule7.d.ts
|
|
434
|
+
declare const T2_SCHEDULE_7: FormDefinition;
|
|
435
|
+
/** Line 745 — adjusted aggregate investment income, the passive income grind. */
|
|
436
|
+
declare const SCHEDULE_7_ADJUSTED_AII_LINE = "745";
|
|
437
|
+
/** The grind starts here and exhausts the limit five times faster. */
|
|
438
|
+
declare const SCHEDULE_7_PASSIVE_INCOME_THRESHOLD = 50000;
|
|
439
|
+
//#endregion
|
|
440
|
+
//#region src/t2/forms/schedule8.d.ts
|
|
441
|
+
/**
|
|
442
|
+
* One column of the grid. `line` is present only where CRA numbers the column —
|
|
443
|
+
* seven of the twenty-two.
|
|
444
|
+
*/
|
|
445
|
+
interface CcaColumn {
|
|
446
|
+
/** The column's position on the page, 1 to 22. */
|
|
447
|
+
column: number;
|
|
448
|
+
caption: string;
|
|
449
|
+
/** The CRA line number, where the column has one. */
|
|
450
|
+
line?: string;
|
|
451
|
+
note?: string;
|
|
452
|
+
}
|
|
453
|
+
declare const SCHEDULE_8_COLUMNS: readonly CcaColumn[];
|
|
454
|
+
/** Column 19 — recapture, an ADDITION on Schedule 1. */
|
|
455
|
+
declare const SCHEDULE_8_RECAPTURE_LINE = "213";
|
|
456
|
+
/** Column 20 — terminal loss, a deduction. */
|
|
457
|
+
declare const SCHEDULE_8_TERMINAL_LOSS_LINE = "215";
|
|
458
|
+
/** Column 21 — the allowance itself, a deduction. */
|
|
459
|
+
declare const SCHEDULE_8_CCA_LINE = "217";
|
|
460
|
+
declare const T2_SCHEDULE_8: FormDefinition;
|
|
461
|
+
//#endregion
|
|
462
|
+
//#region src/t2/forms/schedule13.d.ts
|
|
463
|
+
/**
|
|
464
|
+
* One reserve, and its three cells. Read off the rendered form on 2026-08-11.
|
|
465
|
+
*
|
|
466
|
+
* The step is 20 between most rows but jumps from 160 to 190 — the numbering is
|
|
467
|
+
* NOT arithmetic, which is another reason it cannot be inferred.
|
|
468
|
+
*/
|
|
469
|
+
interface ReserveRow {
|
|
470
|
+
label: string;
|
|
471
|
+
/** Balance at the beginning of the year. */
|
|
472
|
+
opening: string;
|
|
473
|
+
/** Transfer on an amalgamation or the wind-up of a subsidiary. */
|
|
474
|
+
transfer: string;
|
|
475
|
+
/** Balance at the end of the year. */
|
|
476
|
+
closing: string;
|
|
477
|
+
}
|
|
478
|
+
declare const SCHEDULE_13_RESERVE_ROWS: readonly ReserveRow[];
|
|
479
|
+
declare const T2_SCHEDULE_13: FormDefinition;
|
|
480
|
+
//#endregion
|
|
481
|
+
//#region src/t2/forms/schedule21.d.ts
|
|
482
|
+
declare const T2_SCHEDULE_21: FormDefinition;
|
|
483
|
+
/** Line 180 — the non-business credit, which lands on jacket line 632. */
|
|
484
|
+
declare const SCHEDULE_21_NON_BUSINESS_CREDIT_LINE = "180";
|
|
485
|
+
/** Line 280 — the business credit, which lands on jacket line 636 and pools when unused. */
|
|
486
|
+
declare const SCHEDULE_21_BUSINESS_CREDIT_LINE = "280";
|
|
487
|
+
//#endregion
|
|
488
|
+
//#region src/t2/forms/schedule23.d.ts
|
|
489
|
+
declare const T2_SCHEDULE_23: FormDefinition;
|
|
490
|
+
/** The business limit an associated group shares between them. */
|
|
491
|
+
declare const SCHEDULE_23_GROUP_BUSINESS_LIMIT = 500000;
|
|
492
|
+
//#endregion
|
|
493
|
+
//#region src/t2/forms/schedule24.d.ts
|
|
494
|
+
declare const T2_SCHEDULE_24: FormDefinition;
|
|
495
|
+
/** Line 100 — the type of operation, the only field a first return always carries. */
|
|
496
|
+
declare const SCHEDULE_24_OPERATION_TYPE_LINE = "100";
|
|
497
|
+
//#endregion
|
|
498
|
+
//#region src/t2/forms/schedule31.d.ts
|
|
499
|
+
declare const T2_SCHEDULE_31: FormDefinition;
|
|
500
|
+
/** The enhanced SR&ED rate, available up to the expenditure limit. */
|
|
501
|
+
declare const SCHEDULE_31_ENHANCED_SRED_RATE = 0.35;
|
|
502
|
+
/** The general SR&ED rate, above the expenditure limit. */
|
|
503
|
+
declare const SCHEDULE_31_GENERAL_SRED_RATE = 0.15;
|
|
504
|
+
//#endregion
|
|
505
|
+
//#region src/t2/forms/schedule33.d.ts
|
|
506
|
+
declare const T2_SCHEDULE_33: FormDefinition;
|
|
507
|
+
/** Line 790 — the figure that grinds the business limit. */
|
|
508
|
+
declare const SCHEDULE_33_TAXABLE_CAPITAL_IN_CANADA_LINE = "790";
|
|
509
|
+
//#endregion
|
|
510
|
+
//#region src/t2/forms/schedule43.d.ts
|
|
511
|
+
declare const T2_SCHEDULE_43: FormDefinition;
|
|
512
|
+
/** The dividend allowance sheltering the first tranche from Part VI.1. */
|
|
513
|
+
declare const SCHEDULE_43_DIVIDEND_ALLOWANCE = 500000;
|
|
514
|
+
//#endregion
|
|
515
|
+
//#region src/t2/forms/schedule50.d.ts
|
|
516
|
+
declare const T2_SCHEDULE_50: FormDefinition;
|
|
517
|
+
/** A holding at or above this share attracts disclosure. */
|
|
518
|
+
declare const SCHEDULE_50_DISCLOSURE_THRESHOLD = 0.1;
|
|
519
|
+
//#endregion
|
|
520
|
+
//#region src/t2/forms/schedule53.d.ts
|
|
521
|
+
declare const T2_SCHEDULE_53: FormDefinition;
|
|
522
|
+
/** Line 590 — the pool that caps eligible dividend designations. */
|
|
523
|
+
declare const SCHEDULE_53_CLOSING_GRIP_LINE = "590";
|
|
524
|
+
/** The general rate factor applied at line 190. */
|
|
525
|
+
declare const SCHEDULE_53_GENERAL_RATE_FACTOR = 0.72;
|
|
526
|
+
//#endregion
|
|
527
|
+
//#region src/t2/forms/schedule55.d.ts
|
|
528
|
+
declare const T2_SCHEDULE_55: FormDefinition;
|
|
529
|
+
//#endregion
|
|
530
|
+
//#region src/t2/forms/schedule130.d.ts
|
|
531
|
+
declare const T2_SCHEDULE_130: FormDefinition;
|
|
532
|
+
//#endregion
|
|
533
|
+
//#region src/forms/build.d.ts
|
|
534
|
+
/** A caption as produced from the printed form. */
|
|
535
|
+
interface CaptionRow {
|
|
536
|
+
line: string;
|
|
537
|
+
caption: string;
|
|
538
|
+
page: number;
|
|
539
|
+
/** The part heading the line was printed under, when the extractor found one. */
|
|
540
|
+
part?: string;
|
|
541
|
+
}
|
|
542
|
+
/** A contiguous run of line numbers belonging to one section. */
|
|
543
|
+
interface LineBand {
|
|
544
|
+
/** The section id these lines belong to. */
|
|
545
|
+
section: string;
|
|
546
|
+
/** Inclusive bounds, as numbers — `[101, 199]`. */
|
|
547
|
+
range: [number, number];
|
|
548
|
+
/** Which side of a reconciliation, on forms that have sides. */
|
|
549
|
+
side?: FormFieldSide;
|
|
550
|
+
}
|
|
551
|
+
interface BuildFieldsSpec {
|
|
552
|
+
/** The extracted captions. */
|
|
553
|
+
captions: readonly CaptionRow[];
|
|
554
|
+
/**
|
|
555
|
+
* Which section each line falls in, by NUMBER RANGE. Checked in order; first
|
|
556
|
+
* match wins. Adequate only where the form numbers its parts consecutively.
|
|
557
|
+
*/
|
|
558
|
+
bands?: readonly LineBand[];
|
|
559
|
+
/**
|
|
560
|
+
* Which section each EXTRACTED PART maps to — `{ 'Part 1': 'aii' }`.
|
|
561
|
+
*
|
|
562
|
+
* Preferred over `bands`, and necessary wherever a form interleaves its
|
|
563
|
+
* numbering. Schedule 7 gives Part 1 and Part 3 the same captions on different
|
|
564
|
+
* lines (worldwide against foreign-source); no range can separate those, and
|
|
565
|
+
* getting it wrong files a foreign figure as a worldwide one.
|
|
566
|
+
*/
|
|
567
|
+
sectionByPart?: Readonly<Record<string, string>>;
|
|
568
|
+
/** Per-line override, for the handful a form places against its own pattern. */
|
|
569
|
+
sectionByLine?: Readonly<Record<string, string>>;
|
|
570
|
+
/** Lines that are a subtotal or total of others on the same form. */
|
|
571
|
+
totals?: readonly string[];
|
|
572
|
+
/** Lines the engine derives from other lines on this form. */
|
|
573
|
+
computed?: readonly string[];
|
|
574
|
+
/** Lines that arrive from another schedule, and where from. */
|
|
575
|
+
carriedIn?: Readonly<Record<string, FormLineRef>>;
|
|
576
|
+
/** Lines whose figure is sent somewhere else, and where to. */
|
|
577
|
+
carriedOut?: Readonly<Record<string, FormLineRef>>;
|
|
578
|
+
/** Anything a reader needs that the caption does not say. */
|
|
579
|
+
notes?: Readonly<Record<string, string>>;
|
|
580
|
+
/** Fields that are not money — a date, a tick box, a code. */
|
|
581
|
+
kinds?: Readonly<Record<string, FormFieldKind>>;
|
|
582
|
+
/** Transmission requirement, where the specification states one. */
|
|
583
|
+
requirements?: Readonly<Record<string, FormField['requirement']>>;
|
|
584
|
+
/** Lines to leave out entirely — a heading the extractor mistook for a field. */
|
|
585
|
+
exclude?: readonly string[];
|
|
586
|
+
}
|
|
587
|
+
declare class UnclassifiedLineError extends Error {
|
|
588
|
+
readonly lines: string[];
|
|
589
|
+
constructor(formHint: string, lines: string[]);
|
|
590
|
+
}
|
|
591
|
+
/** Join extracted captions with the hand-authored structure. */
|
|
592
|
+
declare function buildFields(spec: BuildFieldsSpec, formHint?: string): FormField[];
|
|
593
|
+
//#endregion
|
|
594
|
+
//#region src/forms/registry.d.ts
|
|
595
|
+
/** Every form defined in this package. */
|
|
596
|
+
declare const FORMS: readonly FormDefinition[];
|
|
597
|
+
/** A form definition by id — `'T2SCH1'`, `'AT1SCH12'`. */
|
|
598
|
+
declare function getForm(id: string): FormDefinition | undefined;
|
|
599
|
+
/** Every form for one filing programme, in schedule order. */
|
|
600
|
+
declare function formsForProgram(program: FormDefinition['program']): FormDefinition[];
|
|
601
|
+
/** One field, addressed across the whole registry. */
|
|
602
|
+
declare function getField(formId: string, line: string): FormField | undefined;
|
|
603
|
+
/**
|
|
604
|
+
* A caption for a line, for error messages and working papers.
|
|
605
|
+
*
|
|
606
|
+
* Falls back to the bare reference rather than throwing: a diagnostic that
|
|
607
|
+
* cannot be produced because a lookup failed is worse than one naming a line
|
|
608
|
+
* number only.
|
|
609
|
+
*/
|
|
610
|
+
declare function describeLine(formId: string, line: string): string;
|
|
611
|
+
/**
|
|
612
|
+
* Cross-form links that do not resolve.
|
|
613
|
+
*
|
|
614
|
+
* A link is allowed to name a form this package has not defined yet — most are
|
|
615
|
+
* not modelled, and pretending otherwise would mean deleting real knowledge
|
|
616
|
+
* about where a figure comes from. What is NOT allowed is naming a form that IS
|
|
617
|
+
* defined and a line on it that does not exist: that is a genuine mistake, and
|
|
618
|
+
* the kind that files a figure against the wrong destination.
|
|
619
|
+
*/
|
|
620
|
+
declare function findBrokenLinks(): string[];
|
|
621
|
+
//#endregion
|
|
622
|
+
export { SCHEDULE_4_CARRYBACK_YEARS as $, AT1_BALANCE_LINE as $t, SCHEDULE_21_BUSINESS_CREDIT_LINE as A, AT1_SCHEDULE_21 as At, SCHEDULE_8_TERMINAL_LOSS_LINE as B, DispositionCategory as Bt, SCHEDULE_31_ENHANCED_SRED_RATE as C, CO17_TAX_PAYABLE_BOX as Ct, T2_SCHEDULE_24 as D, AT1_IEG_MAX_EXPENDITURE as Dt, SCHEDULE_24_OPERATION_TYPE_LINE as E, AT1_IEG_JACKET_LINE as Et, T2_SCHEDULE_13 as F, AT1_SCHEDULE_20_POOLS as Ft, DispositionGrid as G, AT1_SCHEDULE_16_CARRYFORWARD_LINE as Gt, SCHEDULE_7_ADJUSTED_AII_LINE as H, AT1_SCHEDULE_17_RESERVES as Ht, CcaColumn as I, DonationPool as It, AllocationJurisdiction as J, AlbertaCcaColumn as Jt, SCHEDULE_6_GRIDS as K, AT1_SCHEDULE_13 as Kt, SCHEDULE_8_CCA_LINE as L, AT1_SCHEDULE_18 as Lt, T2_SCHEDULE_21 as M, AlbertaLossPool as Mt, ReserveRow as N, AT1_DONATION_CARRYFORWARD_YEARS as Nt, SCHEDULE_23_GROUP_BUSINESS_LIMIT as O, AT1_IEG_PRIOR_YEARS as Ot, SCHEDULE_13_RESERVE_ROWS as P, AT1_SCHEDULE_20 as Pt, T2_SCHEDULE_5 as Q, AT1_BALANCE_CREDIT_LINES as Qt, SCHEDULE_8_COLUMNS as R, AT1_SCHEDULE_18_CATEGORIES as Rt, T2_SCHEDULE_33 as S, CO17_TAXABLE_INCOME_BOX as St, T2_SCHEDULE_31 as T, AT1_IEG_ENHANCED_RATE as Tt, SCHEDULE_7_PASSIVE_INCOME_THRESHOLD as U, AlbertaReserveKind as Ut, T2_SCHEDULE_8 as V, AT1_SCHEDULE_17 as Vt, T2_SCHEDULE_7 as W, AT1_SCHEDULE_16 as Wt, SCHEDULE_5_REVENUE_OFFSET as X, AT1_SCHEDULE_12_PAIRS as Xt, SCHEDULE_5_JURISDICTIONS as Y, AT1_SCHEDULE_12 as Yt, SCHEDULE_5_SALARIES_OFFSET as Z, AlbertaReconcilingPair as Zt, SCHEDULE_50_DISCLOSURE_THRESHOLD as _, T2_SMALL_BUSINESS_DEDUCTION_RATE as _t, getField as a, FormFieldRequirement as an, T2_SCHEDULE_3 as at, T2_SCHEDULE_43 as b, CO17_QUEBEC_PROPORTION_BOX as bt, CaptionRow as c, FormLineRef as cn, T2_SCHEDULE_2 as ct, buildFields as d, LineNumberScheme as dn, SCHEDULE_1_TOTAL_ADDITIONS_LINE as dt, AT1_JACKET as en, SCHEDULE_4_LPP_CARRYFORWARD_YEARS as et, T2_SCHEDULE_130 as f, fieldsInSection as fn, SCHEDULE_1_TOTAL_DEDUCTIONS_LINE as ft, T2_SCHEDULE_53 as g, validateFormDefinition as gn, T2_NET_INCOME_FOR_TAX_LINE as gt, SCHEDULE_53_GENERAL_RATE_FACTOR as h, isEnterableLine as hn, T2_JACKET as ht, formsForProgram as i, FormFieldKind as in, SCHEDULE_3_TAXABLE_PAID_LINE as it, SCHEDULE_21_NON_BUSINESS_CREDIT_LINE as j, AT1_SCHEDULE_21_POOLS as jt, T2_SCHEDULE_23 as k, AT1_SCHEDULE_29 as kt, LineBand as l, FormProvenance as ln, SCHEDULE_1_LINES as lt, SCHEDULE_53_CLOSING_GRIP_LINE as m, inputFields as mn, T2_BASE_PART_I_RATE as mt, describeLine as n, FormDefinition as nn, T2_SCHEDULE_4 as nt, getForm as o, FormFieldRole as on, SCHEDULE_2_CARRYFORWARD_YEARS as ot, T2_SCHEDULE_55 as p, indexByLine as pn, T2_SCHEDULE_1 as pt, T2_SCHEDULE_6 as q, AT1_SCHEDULE_13_COLUMNS as qt, findBrokenLinks as r, FormField as rn, SCHEDULE_3_ELIGIBLE_PAID_LINE as rt, BuildFieldsSpec as s, FormFieldSide as sn, SCHEDULE_2_CHARITABLE_CURRENT_LINE as st, FORMS as t, AT1_TAX_PAYABLE_LINE as tn, SCHEDULE_4_NON_CAPITAL_CARRYFORWARD_YEARS as tt, UnclassifiedLineError as u, FormSection as un, SCHEDULE_1_LINE_BY_NUMBER as ut, T2_SCHEDULE_50 as v, T2_TAXABLE_INCOME_LINE as vt, SCHEDULE_31_GENERAL_SRED_RATE as w, AT1_IEG_BASE_RATE as wt, SCHEDULE_33_TAXABLE_CAPITAL_IN_CANADA_LINE as x, CO17_RETURN as xt, SCHEDULE_43_DIVIDEND_ALLOWANCE as y, T2_TOTAL_TAX_PAYABLE_LINE as yt, SCHEDULE_8_RECAPTURE_LINE as z, AT1_SECTION_34_2_GROSS_UP as zt };
|