@cyc-seattle/platform 1.33.0 → 1.33.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.
@@ -47,7 +47,10 @@ export declare class Context {
47
47
  costAccount(type: CostType): Id | undefined;
48
48
  warn(code: string, message: string, key?: string): void;
49
49
  book(entry: EntryInput): void;
50
- /** An entry's function: the line's if set, otherwise its account's default, otherwise by cost center. */
50
+ /**
51
+ * An entry's function: the line's if set. Otherwise a cost charged to a program is `program`
52
+ * (cyc-seattle/platform#144), and anything else takes its account's default.
53
+ */
51
54
  functionFor(accountId: Id, explicit: AccountFunction | null | undefined, costCenter: CostCenterType): AccountFunction | null;
52
55
  accountType(accountId: Id): Account["type"] | undefined;
53
56
  /** Whether `accountId` is `ancestorId` or under it. */
@@ -57,18 +57,19 @@ export class Context {
57
57
  return;
58
58
  this.entries.push({ stage: "direct", mtdc_share: 1, wages: false, ...entry });
59
59
  }
60
- /** An entry's function: the line's if set, otherwise its account's default, otherwise by cost center. */
60
+ /**
61
+ * An entry's function: the line's if set. Otherwise a cost charged to a program is `program`
62
+ * (cyc-seattle/platform#144), and anything else takes its account's default.
63
+ */
61
64
  functionFor(accountId, explicit, costCenter) {
62
65
  if (explicit != null)
63
66
  return explicit;
64
67
  const account = this.accounts.get(accountId);
65
- if (account?.default_function != null)
66
- return account.default_function;
67
68
  if (account?.type === "revenue")
68
- return null;
69
- return costCenter === "offering" || costCenter === "product" || costCenter === "program_area"
70
- ? "program"
71
- : "management";
69
+ return account.default_function ?? null;
70
+ if (costCenter === "offering" || costCenter === "product" || costCenter === "program_area")
71
+ return "program";
72
+ return account?.default_function ?? "management";
72
73
  }
73
74
  accountType(accountId) {
74
75
  return this.accounts.get(accountId)?.type;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyc-seattle/platform",
3
- "version": "1.33.0",
3
+ "version": "1.33.1",
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",