@cyc-seattle/platform 1.8.0 → 1.10.0

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.
@@ -0,0 +1,318 @@
1
+ /** A `uuid`. */
2
+ export type Id = string;
3
+ /** A `date`, as `YYYY-MM-DD`. */
4
+ export type DateString = string;
5
+ /** A `time`, as `HH:MM` or `HH:MM:SS`. */
6
+ export type TimeString = string;
7
+ /** The columns every version-scoped row carries. */
8
+ export interface Versioned {
9
+ id: Id;
10
+ version_id: Id;
11
+ /** Stable across versions; references from other plans use it. */
12
+ key: Id;
13
+ }
14
+ export type CostCenterType = "offering" | "product" | "pool" | "org";
15
+ export type AccountFunction = "program" | "management" | "fundraising";
16
+ export interface Product {
17
+ id: Id;
18
+ name: string;
19
+ kind: "program" | "charter" | "storage_lease" | "merchandise" | "event_hosting" | "other";
20
+ revenue_account_id: Id | null;
21
+ }
22
+ export interface Account {
23
+ id: Id;
24
+ number: string;
25
+ name: string;
26
+ type: "revenue" | "expense" | "asset" | "liability" | "net_assets";
27
+ form_990_part: string | null;
28
+ form_990_line: string | null;
29
+ default_function: AccountFunction | null;
30
+ parent_id: Id | null;
31
+ contra_account_id: Id | null;
32
+ retired: boolean;
33
+ }
34
+ export interface Qualification {
35
+ id: Id;
36
+ name: string;
37
+ }
38
+ export interface QualificationCover {
39
+ qualification_id: Id;
40
+ covers_id: Id;
41
+ }
42
+ export interface BoatClass {
43
+ id: Id;
44
+ name: string;
45
+ sailors_per_boat: number | null;
46
+ footprint_sq_ft: number | null;
47
+ }
48
+ export interface ResourceKind {
49
+ id: Id;
50
+ name: string;
51
+ }
52
+ export interface Organization {
53
+ id: Id;
54
+ name: string;
55
+ /** The fiscal year's first month, 1–12. */
56
+ fiscal_year_start_month: number;
57
+ }
58
+ /** A cost the engine calculates. The organization sets which account each is recorded in. */
59
+ export type CostType = "coach_wages" | "salaries" | "payroll_tax" | "ribs" | "boat_maintenance" | "resources" | "travel" | "cogs" | "card_fees";
60
+ export interface OrganizationCostAccount {
61
+ id: Id;
62
+ organization_id: Id;
63
+ cost_type: CostType;
64
+ account_id: Id;
65
+ }
66
+ export type ActivityKind = "practice" | "regatta" | "clinic" | "camp_week" | "travel";
67
+ export interface PlanOffering extends Versioned {
68
+ product_id: Id;
69
+ name: string;
70
+ season_term: string | null;
71
+ starts_on: DateString;
72
+ ends_on: DateString;
73
+ capacity: number | null;
74
+ target_enrollment: number | null;
75
+ fill_rate: number | null;
76
+ /** Per kid. */
77
+ price_cents: number | null;
78
+ sailors_per_coach: number | null;
79
+ min_coaches: number | null;
80
+ /** A `plan_staff_levels` key. */
81
+ coach_level_key: Id | null;
82
+ required_qualification: Id | null;
83
+ ribs_per_coach: number | null;
84
+ byob_share: number | null;
85
+ fixed_coaches: number | null;
86
+ fixed_ribs: number | null;
87
+ fixed_boats: number | null;
88
+ cogs_rate: number | null;
89
+ note: string | null;
90
+ }
91
+ export interface PlanOfferingBoatClass extends Versioned {
92
+ offering_id: Id;
93
+ boat_class_id: Id;
94
+ share: number;
95
+ }
96
+ export interface PlanTrip extends Versioned {
97
+ offering_id: Id;
98
+ name: string;
99
+ nights: number | null;
100
+ /** Per coach. */
101
+ airfare_cents: number | null;
102
+ miles: number | null;
103
+ }
104
+ /** One dated activity, or a travel day, as the planner or a scheduling tool entered it. */
105
+ export interface PlanActivity extends Versioned {
106
+ offering_id: Id;
107
+ /** The trip a travel day belongs to. */
108
+ trip_id: Id | null;
109
+ date: DateString;
110
+ start_time: TimeString | null;
111
+ end_time: TimeString | null;
112
+ on_water_minutes: number | null;
113
+ setup_minutes: number | null;
114
+ putaway_minutes: number | null;
115
+ kind: ActivityKind;
116
+ uses_boats: boolean;
117
+ fixed_coaches: number | null;
118
+ fixed_ribs: number | null;
119
+ fixed_boats: number | null;
120
+ }
121
+ export interface PlanActivityResource extends Versioned {
122
+ activity_id: Id;
123
+ /** A `plan_resources` key. */
124
+ resource_key: Id;
125
+ quantity: number;
126
+ hours: number | null;
127
+ }
128
+ export interface PlanLaborLine extends Versioned {
129
+ name: string;
130
+ cost_center_type: CostCenterType;
131
+ cost_center_key: Id | null;
132
+ /** A `plan_staff_levels` key. */
133
+ staff_level_key: Id;
134
+ hours: number;
135
+ account_id: Id;
136
+ function: AccountFunction | null;
137
+ note: string | null;
138
+ }
139
+ export interface PlanBudgetLine extends Versioned {
140
+ name: string;
141
+ account_id: Id;
142
+ function: AccountFunction | null;
143
+ cost_center_type: CostCenterType;
144
+ cost_center_key: Id | null;
145
+ amount_cents: number;
146
+ fiscal_year: number;
147
+ /** Set for a cost 2 CFR 200.1 leaves out of MTDC, such as equipment or participant support. */
148
+ excluded_from_mtdc: boolean;
149
+ note: string | null;
150
+ }
151
+ /** The year's rates. An Operations plan version has at most one row. */
152
+ export interface PlanRates extends Versioned {
153
+ /** Employer payroll costs, as a share of wages. */
154
+ payroll_tax_rate: number | null;
155
+ /** Card processing fees, as a share of revenue. */
156
+ card_fee_rate: number | null;
157
+ lodging_per_night_cents: number | null;
158
+ mileage_rate_cents: number | null;
159
+ }
160
+ export interface PlanStaffLevel extends Versioned {
161
+ name: string;
162
+ pay_type: "hourly" | "volunteer";
163
+ hourly_rate_cents: number | null;
164
+ /** `qualifications` ids. */
165
+ qualifications: Id[] | null;
166
+ }
167
+ export interface PlanSalariedPosition extends Versioned {
168
+ name: string;
169
+ annual_salary_cents: number;
170
+ paid_hours_per_year: number | null;
171
+ qualifications: Id[] | null;
172
+ ga_share: number | null;
173
+ /** The pool that takes the salary its hours don't charge to programs. */
174
+ remainder_pool_id: Id | null;
175
+ form_990_line: string | null;
176
+ }
177
+ export interface PlanSalariedBooking extends Versioned {
178
+ position_id: Id;
179
+ product_id: Id;
180
+ kind: "management";
181
+ hours: number;
182
+ }
183
+ export interface PlanResource extends Versioned {
184
+ resource_kind_id: Id;
185
+ name: string;
186
+ quantity: number | null;
187
+ cost_per_hour_cents: number | null;
188
+ cost_per_day_cents: number | null;
189
+ fuel_per_hour_cents: number | null;
190
+ maintenance_per_hour_cents: number | null;
191
+ /** Set for a rental, whose cost leaves MTDC. */
192
+ excluded_from_mtdc: boolean;
193
+ }
194
+ export interface PlanBoatRate extends Versioned {
195
+ boat_class_id: Id;
196
+ maintenance_per_boat_hour_cents: number;
197
+ }
198
+ export interface PlanActivityBlockRule extends Versioned {
199
+ name: string;
200
+ /** `plan_offerings` keys. */
201
+ offering_keys: Id[];
202
+ weekdays: number[] | null;
203
+ starts_on: DateString | null;
204
+ ends_on: DateString | null;
205
+ /** A `plan_staff_levels` id. */
206
+ coach_level_id: Id | null;
207
+ /** `plan_salaried_positions` keys. */
208
+ salaried_positions: Id[] | null;
209
+ }
210
+ /** A group of shared costs, such as G&A, divided among all of the plan year's offerings by MTDC. */
211
+ export interface PlanPool extends Versioned {
212
+ name: string;
213
+ }
214
+ export interface PlanBonusOwner extends Versioned {
215
+ role_name: string;
216
+ bonus_rate: number;
217
+ account_id: Id;
218
+ }
219
+ export interface PlanBonusOwnerProduct extends Versioned {
220
+ bonus_owner_id: Id;
221
+ product_id: Id;
222
+ }
223
+ /** The catalog plus every row of the plan versions being calculated. */
224
+ export interface PlanData {
225
+ /** The plan year. Fiscal year N ends in calendar year N. */
226
+ fiscal_year: number;
227
+ organization: Organization;
228
+ organization_cost_accounts: OrganizationCostAccount[];
229
+ /** The resource kind whose `plan_resources` price RIB hours. */
230
+ rib_resource_kind_id: Id | null;
231
+ products: Product[];
232
+ accounts: Account[];
233
+ qualifications: Qualification[];
234
+ qualification_covers: QualificationCover[];
235
+ boat_classes: BoatClass[];
236
+ resource_kinds: ResourceKind[];
237
+ plan_offerings: PlanOffering[];
238
+ plan_offering_boat_classes: PlanOfferingBoatClass[];
239
+ plan_trips: PlanTrip[];
240
+ plan_activities: PlanActivity[];
241
+ plan_activity_resources: PlanActivityResource[];
242
+ plan_labor_lines: PlanLaborLine[];
243
+ plan_budget_lines: PlanBudgetLine[];
244
+ plan_rates: PlanRates[];
245
+ plan_staff_levels: PlanStaffLevel[];
246
+ plan_salaried_positions: PlanSalariedPosition[];
247
+ plan_salaried_bookings: PlanSalariedBooking[];
248
+ plan_resources: PlanResource[];
249
+ plan_boat_rates: PlanBoatRate[];
250
+ plan_activity_block_rules: PlanActivityBlockRule[];
251
+ plan_pools: PlanPool[];
252
+ plan_bonus_owners: PlanBonusOwner[];
253
+ plan_bonus_owner_products: PlanBonusOwnerProduct[];
254
+ }
255
+ /** One line of cost or revenue for the plan year, on one offering, product, pool or the organization. */
256
+ export interface CostLine {
257
+ cost_center_type: CostCenterType;
258
+ cost_center_key: Id | null;
259
+ account_id: Id;
260
+ function: AccountFunction | null;
261
+ /** Always positive: the account's type says whether it's revenue or expense. */
262
+ amount_cents: number;
263
+ line_key: string;
264
+ explanation: string;
265
+ }
266
+ /** Revenue, expenses and net, in cents. */
267
+ export interface Totals {
268
+ revenue_cents: number;
269
+ expense_cents: number;
270
+ net_cents: number;
271
+ }
272
+ /** One offering's P&L for the plan year, or a product's, which adds up its offerings. */
273
+ export interface Pnl extends Totals {
274
+ level: "offering" | "product";
275
+ /** An offering key, or a product id. */
276
+ key: Id;
277
+ /** Each account's total, revenue and expense alike. */
278
+ by_account: {
279
+ account_id: Id;
280
+ amount_cents: number;
281
+ }[];
282
+ mtdc_cents: number;
283
+ enrollment: number;
284
+ /** The dates it has an activity other than travel. */
285
+ days: number;
286
+ /** Enrollment × days. */
287
+ sailor_days: number;
288
+ }
289
+ /** An activity with the staffing the engine gave it. */
290
+ export interface ComputedActivity {
291
+ offering_id: Id;
292
+ offering_key: Id;
293
+ trip_id: Id | null;
294
+ activity_id: Id;
295
+ date: DateString;
296
+ kind: ActivityKind;
297
+ /** Paid minutes: start to end plus setup and put-away. */
298
+ paid_minutes: number;
299
+ on_water_minutes: number;
300
+ uses_boats: boolean;
301
+ coaches: number;
302
+ ribs: number;
303
+ boats: number;
304
+ block_rule_id: Id | null;
305
+ }
306
+ export interface EngineWarning {
307
+ code: string;
308
+ message: string;
309
+ /** The key of the row it's about, when there is one. */
310
+ key?: string;
311
+ }
312
+ export interface EngineOutput {
313
+ lines: CostLine[];
314
+ /** Each offering's P&L, then each product's. */
315
+ pnl: Pnl[];
316
+ activities: ComputedActivity[];
317
+ warnings: EngineWarning[];
318
+ }
@@ -0,0 +1,3 @@
1
+ // Row types named as docs/planning-schema.md names its collections and fields, so a caller maps
2
+ // Directus rows onto them as they are. Optional fields are `null` when empty, as Directus returns them.
3
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyc-seattle/platform",
3
- "version": "1.8.0",
3
+ "version": "1.10.0",
4
4
  "description": "Pulumi components for CYC's shared Google Cloud platform: WebService, the platform outputs reader, and the stacks that build the platform",
5
5
  "author": "CYC Community Sailing Center",
6
6
  "license": "Apache-2.0",
@@ -26,6 +26,10 @@
26
26
  "types": "./dist/index.d.ts",
27
27
  "default": "./dist/index.js"
28
28
  },
29
+ "./planning": {
30
+ "types": "./dist/planning/index.d.ts",
31
+ "default": "./dist/planning/index.js"
32
+ },
29
33
  "./package.json": "./package.json"
30
34
  },
31
35
  "files": [