shred-api-client 2.11.3 → 2.12.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.
- package/dist/index.d.ts +322 -7
- package/dist/index.js +60 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4452,6 +4452,49 @@ declare const ScoreMetricSchema: z.ZodObject<{
|
|
|
4452
4452
|
key: string;
|
|
4453
4453
|
} | undefined;
|
|
4454
4454
|
}>;
|
|
4455
|
+
/** The month's score as if it had ended on `day`. The last point equals the month's value. */
|
|
4456
|
+
declare const ScoreDaySchema: z.ZodObject<{
|
|
4457
|
+
day: z.ZodNumber;
|
|
4458
|
+
value: z.ZodNumber;
|
|
4459
|
+
}, "strip", z.ZodTypeAny, {
|
|
4460
|
+
value: number;
|
|
4461
|
+
day: number;
|
|
4462
|
+
}, {
|
|
4463
|
+
value: number;
|
|
4464
|
+
day: number;
|
|
4465
|
+
}>;
|
|
4466
|
+
/** The month before, for the day-by-day chart. `value` is the score `trend` is measured from. */
|
|
4467
|
+
declare const ScoreComparisonSchema: z.ZodObject<{
|
|
4468
|
+
period: z.ZodString;
|
|
4469
|
+
periodLabel: z.ZodString;
|
|
4470
|
+
value: z.ZodNumber;
|
|
4471
|
+
daily: z.ZodArray<z.ZodObject<{
|
|
4472
|
+
day: z.ZodNumber;
|
|
4473
|
+
value: z.ZodNumber;
|
|
4474
|
+
}, "strip", z.ZodTypeAny, {
|
|
4475
|
+
value: number;
|
|
4476
|
+
day: number;
|
|
4477
|
+
}, {
|
|
4478
|
+
value: number;
|
|
4479
|
+
day: number;
|
|
4480
|
+
}>, "many">;
|
|
4481
|
+
}, "strip", z.ZodTypeAny, {
|
|
4482
|
+
daily: {
|
|
4483
|
+
value: number;
|
|
4484
|
+
day: number;
|
|
4485
|
+
}[];
|
|
4486
|
+
value: number;
|
|
4487
|
+
period: string;
|
|
4488
|
+
periodLabel: string;
|
|
4489
|
+
}, {
|
|
4490
|
+
daily: {
|
|
4491
|
+
value: number;
|
|
4492
|
+
day: number;
|
|
4493
|
+
}[];
|
|
4494
|
+
value: number;
|
|
4495
|
+
period: string;
|
|
4496
|
+
periodLabel: string;
|
|
4497
|
+
}>;
|
|
4455
4498
|
declare const ScoreSchema: z.ZodObject<{
|
|
4456
4499
|
value: z.ZodNumber;
|
|
4457
4500
|
hasData: z.ZodBoolean;
|
|
@@ -4548,11 +4591,54 @@ declare const ScoreSchema: z.ZodObject<{
|
|
|
4548
4591
|
key: string;
|
|
4549
4592
|
} | undefined;
|
|
4550
4593
|
}>, "many">;
|
|
4594
|
+
/** Served on the recap's `current` only. */
|
|
4595
|
+
daily: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4596
|
+
day: z.ZodNumber;
|
|
4597
|
+
value: z.ZodNumber;
|
|
4598
|
+
}, "strip", z.ZodTypeAny, {
|
|
4599
|
+
value: number;
|
|
4600
|
+
day: number;
|
|
4601
|
+
}, {
|
|
4602
|
+
value: number;
|
|
4603
|
+
day: number;
|
|
4604
|
+
}>, "many">>;
|
|
4605
|
+
/** Absent when the month before predates the customer's first project. */
|
|
4606
|
+
comparison: z.ZodOptional<z.ZodObject<{
|
|
4607
|
+
period: z.ZodString;
|
|
4608
|
+
periodLabel: z.ZodString;
|
|
4609
|
+
value: z.ZodNumber;
|
|
4610
|
+
daily: z.ZodArray<z.ZodObject<{
|
|
4611
|
+
day: z.ZodNumber;
|
|
4612
|
+
value: z.ZodNumber;
|
|
4613
|
+
}, "strip", z.ZodTypeAny, {
|
|
4614
|
+
value: number;
|
|
4615
|
+
day: number;
|
|
4616
|
+
}, {
|
|
4617
|
+
value: number;
|
|
4618
|
+
day: number;
|
|
4619
|
+
}>, "many">;
|
|
4620
|
+
}, "strip", z.ZodTypeAny, {
|
|
4621
|
+
daily: {
|
|
4622
|
+
value: number;
|
|
4623
|
+
day: number;
|
|
4624
|
+
}[];
|
|
4625
|
+
value: number;
|
|
4626
|
+
period: string;
|
|
4627
|
+
periodLabel: string;
|
|
4628
|
+
}, {
|
|
4629
|
+
daily: {
|
|
4630
|
+
value: number;
|
|
4631
|
+
day: number;
|
|
4632
|
+
}[];
|
|
4633
|
+
value: number;
|
|
4634
|
+
period: string;
|
|
4635
|
+
periodLabel: string;
|
|
4636
|
+
}>>;
|
|
4551
4637
|
}, "strip", z.ZodTypeAny, {
|
|
4552
4638
|
value: number;
|
|
4553
|
-
hasData: boolean;
|
|
4554
4639
|
period: string;
|
|
4555
4640
|
periodLabel: string;
|
|
4641
|
+
hasData: boolean;
|
|
4556
4642
|
computedAt: number;
|
|
4557
4643
|
metrics: {
|
|
4558
4644
|
value: number;
|
|
@@ -4568,6 +4654,10 @@ declare const ScoreSchema: z.ZodObject<{
|
|
|
4568
4654
|
key: string;
|
|
4569
4655
|
} | undefined;
|
|
4570
4656
|
}[];
|
|
4657
|
+
daily?: {
|
|
4658
|
+
value: number;
|
|
4659
|
+
day: number;
|
|
4660
|
+
}[] | undefined;
|
|
4571
4661
|
band?: {
|
|
4572
4662
|
label: string;
|
|
4573
4663
|
min: number;
|
|
@@ -4582,11 +4672,20 @@ declare const ScoreSchema: z.ZodObject<{
|
|
|
4582
4672
|
} | undefined;
|
|
4583
4673
|
pointsToNextBand?: number | undefined;
|
|
4584
4674
|
trend?: number | undefined;
|
|
4675
|
+
comparison?: {
|
|
4676
|
+
daily: {
|
|
4677
|
+
value: number;
|
|
4678
|
+
day: number;
|
|
4679
|
+
}[];
|
|
4680
|
+
value: number;
|
|
4681
|
+
period: string;
|
|
4682
|
+
periodLabel: string;
|
|
4683
|
+
} | undefined;
|
|
4585
4684
|
}, {
|
|
4586
4685
|
value: number;
|
|
4587
|
-
hasData: boolean;
|
|
4588
4686
|
period: string;
|
|
4589
4687
|
periodLabel: string;
|
|
4688
|
+
hasData: boolean;
|
|
4590
4689
|
computedAt: number;
|
|
4591
4690
|
metrics: {
|
|
4592
4691
|
value: number;
|
|
@@ -4602,6 +4701,10 @@ declare const ScoreSchema: z.ZodObject<{
|
|
|
4602
4701
|
key: string;
|
|
4603
4702
|
} | undefined;
|
|
4604
4703
|
}[];
|
|
4704
|
+
daily?: {
|
|
4705
|
+
value: number;
|
|
4706
|
+
day: number;
|
|
4707
|
+
}[] | undefined;
|
|
4605
4708
|
band?: {
|
|
4606
4709
|
label: string;
|
|
4607
4710
|
min: number;
|
|
@@ -4616,6 +4719,15 @@ declare const ScoreSchema: z.ZodObject<{
|
|
|
4616
4719
|
} | undefined;
|
|
4617
4720
|
pointsToNextBand?: number | undefined;
|
|
4618
4721
|
trend?: number | undefined;
|
|
4722
|
+
comparison?: {
|
|
4723
|
+
daily: {
|
|
4724
|
+
value: number;
|
|
4725
|
+
day: number;
|
|
4726
|
+
}[];
|
|
4727
|
+
value: number;
|
|
4728
|
+
period: string;
|
|
4729
|
+
periodLabel: string;
|
|
4730
|
+
} | undefined;
|
|
4619
4731
|
}>;
|
|
4620
4732
|
declare const ScoreHistoryEntrySchema: z.ZodObject<{
|
|
4621
4733
|
period: z.ZodString;
|
|
@@ -4755,11 +4867,54 @@ declare const ScoreRecapSchema: z.ZodObject<{
|
|
|
4755
4867
|
key: string;
|
|
4756
4868
|
} | undefined;
|
|
4757
4869
|
}>, "many">;
|
|
4870
|
+
/** Served on the recap's `current` only. */
|
|
4871
|
+
daily: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4872
|
+
day: z.ZodNumber;
|
|
4873
|
+
value: z.ZodNumber;
|
|
4874
|
+
}, "strip", z.ZodTypeAny, {
|
|
4875
|
+
value: number;
|
|
4876
|
+
day: number;
|
|
4877
|
+
}, {
|
|
4878
|
+
value: number;
|
|
4879
|
+
day: number;
|
|
4880
|
+
}>, "many">>;
|
|
4881
|
+
/** Absent when the month before predates the customer's first project. */
|
|
4882
|
+
comparison: z.ZodOptional<z.ZodObject<{
|
|
4883
|
+
period: z.ZodString;
|
|
4884
|
+
periodLabel: z.ZodString;
|
|
4885
|
+
value: z.ZodNumber;
|
|
4886
|
+
daily: z.ZodArray<z.ZodObject<{
|
|
4887
|
+
day: z.ZodNumber;
|
|
4888
|
+
value: z.ZodNumber;
|
|
4889
|
+
}, "strip", z.ZodTypeAny, {
|
|
4890
|
+
value: number;
|
|
4891
|
+
day: number;
|
|
4892
|
+
}, {
|
|
4893
|
+
value: number;
|
|
4894
|
+
day: number;
|
|
4895
|
+
}>, "many">;
|
|
4896
|
+
}, "strip", z.ZodTypeAny, {
|
|
4897
|
+
daily: {
|
|
4898
|
+
value: number;
|
|
4899
|
+
day: number;
|
|
4900
|
+
}[];
|
|
4901
|
+
value: number;
|
|
4902
|
+
period: string;
|
|
4903
|
+
periodLabel: string;
|
|
4904
|
+
}, {
|
|
4905
|
+
daily: {
|
|
4906
|
+
value: number;
|
|
4907
|
+
day: number;
|
|
4908
|
+
}[];
|
|
4909
|
+
value: number;
|
|
4910
|
+
period: string;
|
|
4911
|
+
periodLabel: string;
|
|
4912
|
+
}>>;
|
|
4758
4913
|
}, "strip", z.ZodTypeAny, {
|
|
4759
4914
|
value: number;
|
|
4760
|
-
hasData: boolean;
|
|
4761
4915
|
period: string;
|
|
4762
4916
|
periodLabel: string;
|
|
4917
|
+
hasData: boolean;
|
|
4763
4918
|
computedAt: number;
|
|
4764
4919
|
metrics: {
|
|
4765
4920
|
value: number;
|
|
@@ -4775,6 +4930,10 @@ declare const ScoreRecapSchema: z.ZodObject<{
|
|
|
4775
4930
|
key: string;
|
|
4776
4931
|
} | undefined;
|
|
4777
4932
|
}[];
|
|
4933
|
+
daily?: {
|
|
4934
|
+
value: number;
|
|
4935
|
+
day: number;
|
|
4936
|
+
}[] | undefined;
|
|
4778
4937
|
band?: {
|
|
4779
4938
|
label: string;
|
|
4780
4939
|
min: number;
|
|
@@ -4789,11 +4948,20 @@ declare const ScoreRecapSchema: z.ZodObject<{
|
|
|
4789
4948
|
} | undefined;
|
|
4790
4949
|
pointsToNextBand?: number | undefined;
|
|
4791
4950
|
trend?: number | undefined;
|
|
4951
|
+
comparison?: {
|
|
4952
|
+
daily: {
|
|
4953
|
+
value: number;
|
|
4954
|
+
day: number;
|
|
4955
|
+
}[];
|
|
4956
|
+
value: number;
|
|
4957
|
+
period: string;
|
|
4958
|
+
periodLabel: string;
|
|
4959
|
+
} | undefined;
|
|
4792
4960
|
}, {
|
|
4793
4961
|
value: number;
|
|
4794
|
-
hasData: boolean;
|
|
4795
4962
|
period: string;
|
|
4796
4963
|
periodLabel: string;
|
|
4964
|
+
hasData: boolean;
|
|
4797
4965
|
computedAt: number;
|
|
4798
4966
|
metrics: {
|
|
4799
4967
|
value: number;
|
|
@@ -4809,6 +4977,10 @@ declare const ScoreRecapSchema: z.ZodObject<{
|
|
|
4809
4977
|
key: string;
|
|
4810
4978
|
} | undefined;
|
|
4811
4979
|
}[];
|
|
4980
|
+
daily?: {
|
|
4981
|
+
value: number;
|
|
4982
|
+
day: number;
|
|
4983
|
+
}[] | undefined;
|
|
4812
4984
|
band?: {
|
|
4813
4985
|
label: string;
|
|
4814
4986
|
min: number;
|
|
@@ -4823,6 +4995,15 @@ declare const ScoreRecapSchema: z.ZodObject<{
|
|
|
4823
4995
|
} | undefined;
|
|
4824
4996
|
pointsToNextBand?: number | undefined;
|
|
4825
4997
|
trend?: number | undefined;
|
|
4998
|
+
comparison?: {
|
|
4999
|
+
daily: {
|
|
5000
|
+
value: number;
|
|
5001
|
+
day: number;
|
|
5002
|
+
}[];
|
|
5003
|
+
value: number;
|
|
5004
|
+
period: string;
|
|
5005
|
+
periodLabel: string;
|
|
5006
|
+
} | undefined;
|
|
4826
5007
|
}>;
|
|
4827
5008
|
/** Oldest first. Months before the customer's first project are absent, not zero. */
|
|
4828
5009
|
history: z.ZodArray<z.ZodObject<{
|
|
@@ -4866,6 +5047,9 @@ declare const ScoreRecapSchema: z.ZodObject<{
|
|
|
4866
5047
|
key: string;
|
|
4867
5048
|
} | undefined;
|
|
4868
5049
|
}>, "many">;
|
|
5050
|
+
/** The neighbouring months that can be opened, taken from `history`. Absent at either edge. */
|
|
5051
|
+
previousPeriod: z.ZodOptional<z.ZodString>;
|
|
5052
|
+
nextPeriod: z.ZodOptional<z.ZodString>;
|
|
4869
5053
|
}, "strip", z.ZodTypeAny, {
|
|
4870
5054
|
history: {
|
|
4871
5055
|
value: number;
|
|
@@ -4880,9 +5064,9 @@ declare const ScoreRecapSchema: z.ZodObject<{
|
|
|
4880
5064
|
}[];
|
|
4881
5065
|
current: {
|
|
4882
5066
|
value: number;
|
|
4883
|
-
hasData: boolean;
|
|
4884
5067
|
period: string;
|
|
4885
5068
|
periodLabel: string;
|
|
5069
|
+
hasData: boolean;
|
|
4886
5070
|
computedAt: number;
|
|
4887
5071
|
metrics: {
|
|
4888
5072
|
value: number;
|
|
@@ -4898,6 +5082,10 @@ declare const ScoreRecapSchema: z.ZodObject<{
|
|
|
4898
5082
|
key: string;
|
|
4899
5083
|
} | undefined;
|
|
4900
5084
|
}[];
|
|
5085
|
+
daily?: {
|
|
5086
|
+
value: number;
|
|
5087
|
+
day: number;
|
|
5088
|
+
}[] | undefined;
|
|
4901
5089
|
band?: {
|
|
4902
5090
|
label: string;
|
|
4903
5091
|
min: number;
|
|
@@ -4912,7 +5100,18 @@ declare const ScoreRecapSchema: z.ZodObject<{
|
|
|
4912
5100
|
} | undefined;
|
|
4913
5101
|
pointsToNextBand?: number | undefined;
|
|
4914
5102
|
trend?: number | undefined;
|
|
5103
|
+
comparison?: {
|
|
5104
|
+
daily: {
|
|
5105
|
+
value: number;
|
|
5106
|
+
day: number;
|
|
5107
|
+
}[];
|
|
5108
|
+
value: number;
|
|
5109
|
+
period: string;
|
|
5110
|
+
periodLabel: string;
|
|
5111
|
+
} | undefined;
|
|
4915
5112
|
};
|
|
5113
|
+
previousPeriod?: string | undefined;
|
|
5114
|
+
nextPeriod?: string | undefined;
|
|
4916
5115
|
}, {
|
|
4917
5116
|
history: {
|
|
4918
5117
|
value: number;
|
|
@@ -4927,9 +5126,9 @@ declare const ScoreRecapSchema: z.ZodObject<{
|
|
|
4927
5126
|
}[];
|
|
4928
5127
|
current: {
|
|
4929
5128
|
value: number;
|
|
4930
|
-
hasData: boolean;
|
|
4931
5129
|
period: string;
|
|
4932
5130
|
periodLabel: string;
|
|
5131
|
+
hasData: boolean;
|
|
4933
5132
|
computedAt: number;
|
|
4934
5133
|
metrics: {
|
|
4935
5134
|
value: number;
|
|
@@ -4945,6 +5144,10 @@ declare const ScoreRecapSchema: z.ZodObject<{
|
|
|
4945
5144
|
key: string;
|
|
4946
5145
|
} | undefined;
|
|
4947
5146
|
}[];
|
|
5147
|
+
daily?: {
|
|
5148
|
+
value: number;
|
|
5149
|
+
day: number;
|
|
5150
|
+
}[] | undefined;
|
|
4948
5151
|
band?: {
|
|
4949
5152
|
label: string;
|
|
4950
5153
|
min: number;
|
|
@@ -4959,7 +5162,92 @@ declare const ScoreRecapSchema: z.ZodObject<{
|
|
|
4959
5162
|
} | undefined;
|
|
4960
5163
|
pointsToNextBand?: number | undefined;
|
|
4961
5164
|
trend?: number | undefined;
|
|
5165
|
+
comparison?: {
|
|
5166
|
+
daily: {
|
|
5167
|
+
value: number;
|
|
5168
|
+
day: number;
|
|
5169
|
+
}[];
|
|
5170
|
+
value: number;
|
|
5171
|
+
period: string;
|
|
5172
|
+
periodLabel: string;
|
|
5173
|
+
} | undefined;
|
|
4962
5174
|
};
|
|
5175
|
+
previousPeriod?: string | undefined;
|
|
5176
|
+
nextPeriod?: string | undefined;
|
|
5177
|
+
}>;
|
|
5178
|
+
declare const ScoreGoalOptionSchema: z.ZodObject<{
|
|
5179
|
+
key: z.ZodString;
|
|
5180
|
+
label: z.ZodString;
|
|
5181
|
+
target: z.ZodNumber;
|
|
5182
|
+
}, "strip", z.ZodTypeAny, {
|
|
5183
|
+
label: string;
|
|
5184
|
+
key: string;
|
|
5185
|
+
target: number;
|
|
5186
|
+
}, {
|
|
5187
|
+
label: string;
|
|
5188
|
+
key: string;
|
|
5189
|
+
target: number;
|
|
5190
|
+
}>;
|
|
5191
|
+
declare const ScoreGoalSchema: z.ZodObject<{
|
|
5192
|
+
/** The goal of the month being lived. */
|
|
5193
|
+
current: z.ZodNumber;
|
|
5194
|
+
/** A goal chosen this month, starting on `from` (`YYYY-MM`). */
|
|
5195
|
+
next: z.ZodOptional<z.ZodObject<{
|
|
5196
|
+
target: z.ZodNumber;
|
|
5197
|
+
from: z.ZodString;
|
|
5198
|
+
}, "strip", z.ZodTypeAny, {
|
|
5199
|
+
from: string;
|
|
5200
|
+
target: number;
|
|
5201
|
+
}, {
|
|
5202
|
+
from: string;
|
|
5203
|
+
target: number;
|
|
5204
|
+
}>>;
|
|
5205
|
+
/** Projects a month over the last `averageMonths` closed months; absent when there are none. */
|
|
5206
|
+
average: z.ZodOptional<z.ZodNumber>;
|
|
5207
|
+
averageMonths: z.ZodNumber;
|
|
5208
|
+
options: z.ZodArray<z.ZodObject<{
|
|
5209
|
+
key: z.ZodString;
|
|
5210
|
+
label: z.ZodString;
|
|
5211
|
+
target: z.ZodNumber;
|
|
5212
|
+
}, "strip", z.ZodTypeAny, {
|
|
5213
|
+
label: string;
|
|
5214
|
+
key: string;
|
|
5215
|
+
target: number;
|
|
5216
|
+
}, {
|
|
5217
|
+
label: string;
|
|
5218
|
+
key: string;
|
|
5219
|
+
target: number;
|
|
5220
|
+
}>, "many">;
|
|
5221
|
+
/** The `key` of the option offered as recommended. */
|
|
5222
|
+
recommended: z.ZodOptional<z.ZodString>;
|
|
5223
|
+
}, "strip", z.ZodTypeAny, {
|
|
5224
|
+
options: {
|
|
5225
|
+
label: string;
|
|
5226
|
+
key: string;
|
|
5227
|
+
target: number;
|
|
5228
|
+
}[];
|
|
5229
|
+
current: number;
|
|
5230
|
+
averageMonths: number;
|
|
5231
|
+
next?: {
|
|
5232
|
+
from: string;
|
|
5233
|
+
target: number;
|
|
5234
|
+
} | undefined;
|
|
5235
|
+
average?: number | undefined;
|
|
5236
|
+
recommended?: string | undefined;
|
|
5237
|
+
}, {
|
|
5238
|
+
options: {
|
|
5239
|
+
label: string;
|
|
5240
|
+
key: string;
|
|
5241
|
+
target: number;
|
|
5242
|
+
}[];
|
|
5243
|
+
current: number;
|
|
5244
|
+
averageMonths: number;
|
|
5245
|
+
next?: {
|
|
5246
|
+
from: string;
|
|
5247
|
+
target: number;
|
|
5248
|
+
} | undefined;
|
|
5249
|
+
average?: number | undefined;
|
|
5250
|
+
recommended?: string | undefined;
|
|
4963
5251
|
}>;
|
|
4964
5252
|
type ScoreMetricKey = z.infer<typeof ScoreMetricKeySchema>;
|
|
4965
5253
|
type ScoreBand = z.infer<typeof ScoreBandSchema>;
|
|
@@ -4967,6 +5255,10 @@ type ScoreMetric = z.infer<typeof ScoreMetricSchema>;
|
|
|
4967
5255
|
type Score = z.infer<typeof ScoreSchema>;
|
|
4968
5256
|
type ScoreHistoryEntry = z.infer<typeof ScoreHistoryEntrySchema>;
|
|
4969
5257
|
type ScoreRecap = z.infer<typeof ScoreRecapSchema>;
|
|
5258
|
+
type ScoreDay = z.infer<typeof ScoreDaySchema>;
|
|
5259
|
+
type ScoreComparison = z.infer<typeof ScoreComparisonSchema>;
|
|
5260
|
+
type ScoreGoalOption = z.infer<typeof ScoreGoalOptionSchema>;
|
|
5261
|
+
type ScoreGoal = z.infer<typeof ScoreGoalSchema>;
|
|
4970
5262
|
|
|
4971
5263
|
interface IAPI$1 {
|
|
4972
5264
|
/**
|
|
@@ -4975,17 +5267,40 @@ interface IAPI$1 {
|
|
|
4975
5267
|
* and a month still being lived is rejected.
|
|
4976
5268
|
*/
|
|
4977
5269
|
getRecap: (context: Context, period?: string) => Promise<ScoreRecap>;
|
|
5270
|
+
/** The caller's monthly project goal, the options and their recent average. */
|
|
5271
|
+
getGoal: (context: Context) => Promise<ScoreGoal>;
|
|
5272
|
+
/**
|
|
5273
|
+
* Chooses a goal, which starts next month. `target` must be one of the options;
|
|
5274
|
+
* choosing the goal in effect cancels a pending one. Answers with the updated goal.
|
|
5275
|
+
*/
|
|
5276
|
+
setGoal: (context: Context, target: number) => Promise<ScoreGoal>;
|
|
4978
5277
|
}
|
|
4979
5278
|
declare const Endpoints$1: {
|
|
4980
5279
|
GetRecap: {
|
|
4981
5280
|
uri: string;
|
|
4982
5281
|
method: string;
|
|
4983
5282
|
};
|
|
5283
|
+
GetGoal: {
|
|
5284
|
+
uri: string;
|
|
5285
|
+
method: string;
|
|
5286
|
+
};
|
|
5287
|
+
SetGoal: {
|
|
5288
|
+
uri: string;
|
|
5289
|
+
method: string;
|
|
5290
|
+
};
|
|
4984
5291
|
};
|
|
4985
5292
|
|
|
4986
5293
|
type index$3_Score = Score;
|
|
4987
5294
|
type index$3_ScoreBand = ScoreBand;
|
|
4988
5295
|
declare const index$3_ScoreBandSchema: typeof ScoreBandSchema;
|
|
5296
|
+
type index$3_ScoreComparison = ScoreComparison;
|
|
5297
|
+
declare const index$3_ScoreComparisonSchema: typeof ScoreComparisonSchema;
|
|
5298
|
+
type index$3_ScoreDay = ScoreDay;
|
|
5299
|
+
declare const index$3_ScoreDaySchema: typeof ScoreDaySchema;
|
|
5300
|
+
type index$3_ScoreGoal = ScoreGoal;
|
|
5301
|
+
type index$3_ScoreGoalOption = ScoreGoalOption;
|
|
5302
|
+
declare const index$3_ScoreGoalOptionSchema: typeof ScoreGoalOptionSchema;
|
|
5303
|
+
declare const index$3_ScoreGoalSchema: typeof ScoreGoalSchema;
|
|
4989
5304
|
type index$3_ScoreHistoryEntry = ScoreHistoryEntry;
|
|
4990
5305
|
declare const index$3_ScoreHistoryEntrySchema: typeof ScoreHistoryEntrySchema;
|
|
4991
5306
|
type index$3_ScoreMetric = ScoreMetric;
|
|
@@ -4995,7 +5310,7 @@ declare const index$3_ScoreMetricSchema: typeof ScoreMetricSchema;
|
|
|
4995
5310
|
declare const index$3_ScoreRecapSchema: typeof ScoreRecapSchema;
|
|
4996
5311
|
declare const index$3_ScoreSchema: typeof ScoreSchema;
|
|
4997
5312
|
declare namespace index$3 {
|
|
4998
|
-
export { Endpoints$1 as Endpoints, type ScoreRecap as Entity, type IAPI$1 as IAPI, type index$3_Score as Score, type index$3_ScoreBand as ScoreBand, index$3_ScoreBandSchema as ScoreBandSchema, type index$3_ScoreHistoryEntry as ScoreHistoryEntry, index$3_ScoreHistoryEntrySchema as ScoreHistoryEntrySchema, type index$3_ScoreMetric as ScoreMetric, type index$3_ScoreMetricKey as ScoreMetricKey, index$3_ScoreMetricKeySchema as ScoreMetricKeySchema, index$3_ScoreMetricSchema as ScoreMetricSchema, index$3_ScoreRecapSchema as ScoreRecapSchema, index$3_ScoreSchema as ScoreSchema };
|
|
5313
|
+
export { Endpoints$1 as Endpoints, type ScoreRecap as Entity, type IAPI$1 as IAPI, type index$3_Score as Score, type index$3_ScoreBand as ScoreBand, index$3_ScoreBandSchema as ScoreBandSchema, type index$3_ScoreComparison as ScoreComparison, index$3_ScoreComparisonSchema as ScoreComparisonSchema, type index$3_ScoreDay as ScoreDay, index$3_ScoreDaySchema as ScoreDaySchema, type index$3_ScoreGoal as ScoreGoal, type index$3_ScoreGoalOption as ScoreGoalOption, index$3_ScoreGoalOptionSchema as ScoreGoalOptionSchema, index$3_ScoreGoalSchema as ScoreGoalSchema, type index$3_ScoreHistoryEntry as ScoreHistoryEntry, index$3_ScoreHistoryEntrySchema as ScoreHistoryEntrySchema, type index$3_ScoreMetric as ScoreMetric, type index$3_ScoreMetricKey as ScoreMetricKey, index$3_ScoreMetricKeySchema as ScoreMetricKeySchema, index$3_ScoreMetricSchema as ScoreMetricSchema, index$3_ScoreRecapSchema as ScoreRecapSchema, index$3_ScoreSchema as ScoreSchema };
|
|
4999
5314
|
}
|
|
5000
5315
|
|
|
5001
5316
|
/**
|
package/dist/index.js
CHANGED
|
@@ -156,11 +156,16 @@ var HTTPClient = class {
|
|
|
156
156
|
}
|
|
157
157
|
throw toException(response.status, message);
|
|
158
158
|
}
|
|
159
|
+
const raw = await response.text();
|
|
159
160
|
let result;
|
|
160
|
-
|
|
161
|
-
result =
|
|
162
|
-
}
|
|
163
|
-
|
|
161
|
+
if (raw === "") {
|
|
162
|
+
result = void 0;
|
|
163
|
+
} else {
|
|
164
|
+
try {
|
|
165
|
+
result = JSON.parse(raw);
|
|
166
|
+
} catch {
|
|
167
|
+
result = raw;
|
|
168
|
+
}
|
|
164
169
|
}
|
|
165
170
|
if (schema) return schema.parse(result);
|
|
166
171
|
return result;
|
|
@@ -6281,7 +6286,9 @@ var ShredU_api_default = ShredUAPI;
|
|
|
6281
6286
|
|
|
6282
6287
|
// src/model/score/Score.api.ts
|
|
6283
6288
|
var Endpoints10 = {
|
|
6284
|
-
GetRecap: { uri: "/score/", method: "GET" }
|
|
6289
|
+
GetRecap: { uri: "/score/", method: "GET" },
|
|
6290
|
+
GetGoal: { uri: "/score/goal/", method: "GET" },
|
|
6291
|
+
SetGoal: { uri: "/score/goal/", method: "PUT" }
|
|
6285
6292
|
};
|
|
6286
6293
|
|
|
6287
6294
|
// src/model/score/Score.schema.ts
|
|
@@ -6311,6 +6318,16 @@ var ScoreMetricSchema = external_exports.object({
|
|
|
6311
6318
|
available: external_exports.boolean(),
|
|
6312
6319
|
rating: ScoreBandSchema.optional()
|
|
6313
6320
|
});
|
|
6321
|
+
var ScoreDaySchema = external_exports.object({
|
|
6322
|
+
day: external_exports.number(),
|
|
6323
|
+
value: external_exports.number()
|
|
6324
|
+
});
|
|
6325
|
+
var ScoreComparisonSchema = external_exports.object({
|
|
6326
|
+
period: external_exports.string(),
|
|
6327
|
+
periodLabel: external_exports.string(),
|
|
6328
|
+
value: external_exports.number(),
|
|
6329
|
+
daily: external_exports.array(ScoreDaySchema)
|
|
6330
|
+
});
|
|
6314
6331
|
var ScoreSchema = external_exports.object({
|
|
6315
6332
|
value: external_exports.number(),
|
|
6316
6333
|
hasData: external_exports.boolean(),
|
|
@@ -6321,7 +6338,11 @@ var ScoreSchema = external_exports.object({
|
|
|
6321
6338
|
pointsToNextBand: external_exports.number().optional(),
|
|
6322
6339
|
trend: external_exports.number().optional(),
|
|
6323
6340
|
computedAt: external_exports.number(),
|
|
6324
|
-
metrics: external_exports.array(ScoreMetricSchema)
|
|
6341
|
+
metrics: external_exports.array(ScoreMetricSchema),
|
|
6342
|
+
/** Served on the recap's `current` only. */
|
|
6343
|
+
daily: external_exports.array(ScoreDaySchema).optional(),
|
|
6344
|
+
/** Absent when the month before predates the customer's first project. */
|
|
6345
|
+
comparison: ScoreComparisonSchema.optional()
|
|
6325
6346
|
});
|
|
6326
6347
|
var ScoreHistoryEntrySchema = external_exports.object({
|
|
6327
6348
|
period: external_exports.string(),
|
|
@@ -6332,7 +6353,27 @@ var ScoreHistoryEntrySchema = external_exports.object({
|
|
|
6332
6353
|
var ScoreRecapSchema = external_exports.object({
|
|
6333
6354
|
current: ScoreSchema,
|
|
6334
6355
|
/** Oldest first. Months before the customer's first project are absent, not zero. */
|
|
6335
|
-
history: external_exports.array(ScoreHistoryEntrySchema)
|
|
6356
|
+
history: external_exports.array(ScoreHistoryEntrySchema),
|
|
6357
|
+
/** The neighbouring months that can be opened, taken from `history`. Absent at either edge. */
|
|
6358
|
+
previousPeriod: external_exports.string().optional(),
|
|
6359
|
+
nextPeriod: external_exports.string().optional()
|
|
6360
|
+
});
|
|
6361
|
+
var ScoreGoalOptionSchema = external_exports.object({
|
|
6362
|
+
key: external_exports.string(),
|
|
6363
|
+
label: external_exports.string(),
|
|
6364
|
+
target: external_exports.number()
|
|
6365
|
+
});
|
|
6366
|
+
var ScoreGoalSchema = external_exports.object({
|
|
6367
|
+
/** The goal of the month being lived. */
|
|
6368
|
+
current: external_exports.number(),
|
|
6369
|
+
/** A goal chosen this month, starting on `from` (`YYYY-MM`). */
|
|
6370
|
+
next: external_exports.object({ target: external_exports.number(), from: external_exports.string() }).optional(),
|
|
6371
|
+
/** Projects a month over the last `averageMonths` closed months; absent when there are none. */
|
|
6372
|
+
average: external_exports.number().optional(),
|
|
6373
|
+
averageMonths: external_exports.number(),
|
|
6374
|
+
options: external_exports.array(ScoreGoalOptionSchema),
|
|
6375
|
+
/** The `key` of the option offered as recommended. */
|
|
6376
|
+
recommended: external_exports.string().optional()
|
|
6336
6377
|
});
|
|
6337
6378
|
|
|
6338
6379
|
// src/api/Score.api.ts
|
|
@@ -6353,6 +6394,14 @@ var ScoreAPI = class {
|
|
|
6353
6394
|
ScoreRecapSchema
|
|
6354
6395
|
);
|
|
6355
6396
|
}
|
|
6397
|
+
async getGoal(ctx) {
|
|
6398
|
+
const { uri, method } = Endpoints10.GetGoal;
|
|
6399
|
+
return this.clientHTTP.makeRequest(this.env, uri, method, null, ctx, ScoreGoalSchema);
|
|
6400
|
+
}
|
|
6401
|
+
async setGoal(ctx, target) {
|
|
6402
|
+
const { uri, method } = Endpoints10.SetGoal;
|
|
6403
|
+
return this.clientHTTP.makeRequest(this.env, uri, method, { target }, ctx, ScoreGoalSchema);
|
|
6404
|
+
}
|
|
6356
6405
|
};
|
|
6357
6406
|
var Score_api_default = ScoreAPI;
|
|
6358
6407
|
|
|
@@ -7160,6 +7209,10 @@ var score_exports = {};
|
|
|
7160
7209
|
__export(score_exports, {
|
|
7161
7210
|
Endpoints: () => Endpoints10,
|
|
7162
7211
|
ScoreBandSchema: () => ScoreBandSchema,
|
|
7212
|
+
ScoreComparisonSchema: () => ScoreComparisonSchema,
|
|
7213
|
+
ScoreDaySchema: () => ScoreDaySchema,
|
|
7214
|
+
ScoreGoalOptionSchema: () => ScoreGoalOptionSchema,
|
|
7215
|
+
ScoreGoalSchema: () => ScoreGoalSchema,
|
|
7163
7216
|
ScoreHistoryEntrySchema: () => ScoreHistoryEntrySchema,
|
|
7164
7217
|
ScoreMetricKeySchema: () => ScoreMetricKeySchema,
|
|
7165
7218
|
ScoreMetricSchema: () => ScoreMetricSchema,
|