shred-api-client 2.11.4 → 2.12.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/dist/index.d.ts CHANGED
@@ -4866,6 +4866,9 @@ declare const ScoreRecapSchema: z.ZodObject<{
4866
4866
  key: string;
4867
4867
  } | undefined;
4868
4868
  }>, "many">;
4869
+ /** The neighbouring months that can be opened, taken from `history`. Absent at either edge. */
4870
+ previousPeriod: z.ZodOptional<z.ZodString>;
4871
+ nextPeriod: z.ZodOptional<z.ZodString>;
4869
4872
  }, "strip", z.ZodTypeAny, {
4870
4873
  history: {
4871
4874
  value: number;
@@ -4913,6 +4916,8 @@ declare const ScoreRecapSchema: z.ZodObject<{
4913
4916
  pointsToNextBand?: number | undefined;
4914
4917
  trend?: number | undefined;
4915
4918
  };
4919
+ previousPeriod?: string | undefined;
4920
+ nextPeriod?: string | undefined;
4916
4921
  }, {
4917
4922
  history: {
4918
4923
  value: number;
@@ -4960,6 +4965,142 @@ declare const ScoreRecapSchema: z.ZodObject<{
4960
4965
  pointsToNextBand?: number | undefined;
4961
4966
  trend?: number | undefined;
4962
4967
  };
4968
+ previousPeriod?: string | undefined;
4969
+ nextPeriod?: string | undefined;
4970
+ }>;
4971
+ declare const ScoreGoalOptionSchema: z.ZodObject<{
4972
+ key: z.ZodString;
4973
+ label: z.ZodString;
4974
+ target: z.ZodNumber;
4975
+ }, "strip", z.ZodTypeAny, {
4976
+ label: string;
4977
+ key: string;
4978
+ target: number;
4979
+ }, {
4980
+ label: string;
4981
+ key: string;
4982
+ target: number;
4983
+ }>;
4984
+ declare const ScoreGoalSchema: z.ZodObject<{
4985
+ /** The goal of the month being lived. */
4986
+ current: z.ZodNumber;
4987
+ /** A goal chosen this month, starting on `from` (`YYYY-MM`). */
4988
+ next: z.ZodOptional<z.ZodObject<{
4989
+ target: z.ZodNumber;
4990
+ from: z.ZodString;
4991
+ }, "strip", z.ZodTypeAny, {
4992
+ from: string;
4993
+ target: number;
4994
+ }, {
4995
+ from: string;
4996
+ target: number;
4997
+ }>>;
4998
+ /** Projects a month over the last `averageMonths` closed months; absent when there are none. */
4999
+ average: z.ZodOptional<z.ZodNumber>;
5000
+ averageMonths: z.ZodNumber;
5001
+ min: z.ZodNumber;
5002
+ options: z.ZodArray<z.ZodObject<{
5003
+ key: z.ZodString;
5004
+ label: z.ZodString;
5005
+ target: z.ZodNumber;
5006
+ }, "strip", z.ZodTypeAny, {
5007
+ label: string;
5008
+ key: string;
5009
+ target: number;
5010
+ }, {
5011
+ label: string;
5012
+ key: string;
5013
+ target: number;
5014
+ }>, "many">;
5015
+ /** The `key` of the option offered as recommended. */
5016
+ recommended: z.ZodOptional<z.ZodString>;
5017
+ }, "strip", z.ZodTypeAny, {
5018
+ options: {
5019
+ label: string;
5020
+ key: string;
5021
+ target: number;
5022
+ }[];
5023
+ min: number;
5024
+ current: number;
5025
+ averageMonths: number;
5026
+ next?: {
5027
+ from: string;
5028
+ target: number;
5029
+ } | undefined;
5030
+ average?: number | undefined;
5031
+ recommended?: string | undefined;
5032
+ }, {
5033
+ options: {
5034
+ label: string;
5035
+ key: string;
5036
+ target: number;
5037
+ }[];
5038
+ min: number;
5039
+ current: number;
5040
+ averageMonths: number;
5041
+ next?: {
5042
+ from: string;
5043
+ target: number;
5044
+ } | undefined;
5045
+ average?: number | undefined;
5046
+ recommended?: string | undefined;
5047
+ }>;
5048
+ declare const ScoreProgressMetricSchema: z.ZodObject<{
5049
+ key: z.ZodString;
5050
+ value: z.ZodNumber;
5051
+ target: z.ZodNumber;
5052
+ available: z.ZodBoolean;
5053
+ }, "strip", z.ZodTypeAny, {
5054
+ value: number;
5055
+ key: string;
5056
+ target: number;
5057
+ available: boolean;
5058
+ }, {
5059
+ value: number;
5060
+ key: string;
5061
+ target: number;
5062
+ available: boolean;
5063
+ }>;
5064
+ declare const ScoreProgressSchema: z.ZodObject<{
5065
+ period: z.ZodString;
5066
+ periodLabel: z.ZodString;
5067
+ computedAt: z.ZodNumber;
5068
+ metrics: z.ZodArray<z.ZodObject<{
5069
+ key: z.ZodString;
5070
+ value: z.ZodNumber;
5071
+ target: z.ZodNumber;
5072
+ available: z.ZodBoolean;
5073
+ }, "strip", z.ZodTypeAny, {
5074
+ value: number;
5075
+ key: string;
5076
+ target: number;
5077
+ available: boolean;
5078
+ }, {
5079
+ value: number;
5080
+ key: string;
5081
+ target: number;
5082
+ available: boolean;
5083
+ }>, "many">;
5084
+ }, "strip", z.ZodTypeAny, {
5085
+ period: string;
5086
+ periodLabel: string;
5087
+ computedAt: number;
5088
+ metrics: {
5089
+ value: number;
5090
+ key: string;
5091
+ target: number;
5092
+ available: boolean;
5093
+ }[];
5094
+ }, {
5095
+ period: string;
5096
+ periodLabel: string;
5097
+ computedAt: number;
5098
+ metrics: {
5099
+ value: number;
5100
+ key: string;
5101
+ target: number;
5102
+ available: boolean;
5103
+ }[];
4963
5104
  }>;
4964
5105
  type ScoreMetricKey = z.infer<typeof ScoreMetricKeySchema>;
4965
5106
  type ScoreBand = z.infer<typeof ScoreBandSchema>;
@@ -4967,6 +5108,10 @@ type ScoreMetric = z.infer<typeof ScoreMetricSchema>;
4967
5108
  type Score = z.infer<typeof ScoreSchema>;
4968
5109
  type ScoreHistoryEntry = z.infer<typeof ScoreHistoryEntrySchema>;
4969
5110
  type ScoreRecap = z.infer<typeof ScoreRecapSchema>;
5111
+ type ScoreProgressMetric = z.infer<typeof ScoreProgressMetricSchema>;
5112
+ type ScoreProgress = z.infer<typeof ScoreProgressSchema>;
5113
+ type ScoreGoalOption = z.infer<typeof ScoreGoalOptionSchema>;
5114
+ type ScoreGoal = z.infer<typeof ScoreGoalSchema>;
4970
5115
 
4971
5116
  interface IAPI$1 {
4972
5117
  /**
@@ -4975,27 +5120,55 @@ interface IAPI$1 {
4975
5120
  * and a month still being lived is rejected.
4976
5121
  */
4977
5122
  getRecap: (context: Context, period?: string) => Promise<ScoreRecap>;
5123
+ getProgress: (context: Context) => Promise<ScoreProgress>;
5124
+ /** The caller's monthly project goal, the options and their recent average. */
5125
+ getGoal: (context: Context) => Promise<ScoreGoal>;
5126
+ /**
5127
+ * Chooses a goal, which starts next month. `target` must be a whole number of at least
5128
+ * `min`; choosing the goal in effect cancels a pending one. Answers with the updated goal.
5129
+ */
5130
+ setGoal: (context: Context, target: number) => Promise<ScoreGoal>;
4978
5131
  }
4979
5132
  declare const Endpoints$1: {
4980
5133
  GetRecap: {
4981
5134
  uri: string;
4982
5135
  method: string;
4983
5136
  };
5137
+ GetProgress: {
5138
+ uri: string;
5139
+ method: string;
5140
+ };
5141
+ GetGoal: {
5142
+ uri: string;
5143
+ method: string;
5144
+ };
5145
+ SetGoal: {
5146
+ uri: string;
5147
+ method: string;
5148
+ };
4984
5149
  };
4985
5150
 
4986
5151
  type index$3_Score = Score;
4987
5152
  type index$3_ScoreBand = ScoreBand;
4988
5153
  declare const index$3_ScoreBandSchema: typeof ScoreBandSchema;
5154
+ type index$3_ScoreGoal = ScoreGoal;
5155
+ type index$3_ScoreGoalOption = ScoreGoalOption;
5156
+ declare const index$3_ScoreGoalOptionSchema: typeof ScoreGoalOptionSchema;
5157
+ declare const index$3_ScoreGoalSchema: typeof ScoreGoalSchema;
4989
5158
  type index$3_ScoreHistoryEntry = ScoreHistoryEntry;
4990
5159
  declare const index$3_ScoreHistoryEntrySchema: typeof ScoreHistoryEntrySchema;
4991
5160
  type index$3_ScoreMetric = ScoreMetric;
4992
5161
  type index$3_ScoreMetricKey = ScoreMetricKey;
4993
5162
  declare const index$3_ScoreMetricKeySchema: typeof ScoreMetricKeySchema;
4994
5163
  declare const index$3_ScoreMetricSchema: typeof ScoreMetricSchema;
5164
+ type index$3_ScoreProgress = ScoreProgress;
5165
+ type index$3_ScoreProgressMetric = ScoreProgressMetric;
5166
+ declare const index$3_ScoreProgressMetricSchema: typeof ScoreProgressMetricSchema;
5167
+ declare const index$3_ScoreProgressSchema: typeof ScoreProgressSchema;
4995
5168
  declare const index$3_ScoreRecapSchema: typeof ScoreRecapSchema;
4996
5169
  declare const index$3_ScoreSchema: typeof ScoreSchema;
4997
5170
  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 };
5171
+ 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_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, type index$3_ScoreProgress as ScoreProgress, type index$3_ScoreProgressMetric as ScoreProgressMetric, index$3_ScoreProgressMetricSchema as ScoreProgressMetricSchema, index$3_ScoreProgressSchema as ScoreProgressSchema, index$3_ScoreRecapSchema as ScoreRecapSchema, index$3_ScoreSchema as ScoreSchema };
4999
5172
  }
5000
5173
 
5001
5174
  /**
package/dist/index.js CHANGED
@@ -6286,7 +6286,10 @@ var ShredU_api_default = ShredUAPI;
6286
6286
 
6287
6287
  // src/model/score/Score.api.ts
6288
6288
  var Endpoints10 = {
6289
- GetRecap: { uri: "/score/", method: "GET" }
6289
+ GetRecap: { uri: "/score/", method: "GET" },
6290
+ GetProgress: { uri: "/score/progress/", method: "GET" },
6291
+ GetGoal: { uri: "/score/goal/", method: "GET" },
6292
+ SetGoal: { uri: "/score/goal/", method: "PUT" }
6290
6293
  };
6291
6294
 
6292
6295
  // src/model/score/Score.schema.ts
@@ -6337,7 +6340,40 @@ var ScoreHistoryEntrySchema = external_exports.object({
6337
6340
  var ScoreRecapSchema = external_exports.object({
6338
6341
  current: ScoreSchema,
6339
6342
  /** Oldest first. Months before the customer's first project are absent, not zero. */
6340
- history: external_exports.array(ScoreHistoryEntrySchema)
6343
+ history: external_exports.array(ScoreHistoryEntrySchema),
6344
+ /** The neighbouring months that can be opened, taken from `history`. Absent at either edge. */
6345
+ previousPeriod: external_exports.string().optional(),
6346
+ nextPeriod: external_exports.string().optional()
6347
+ });
6348
+ var ScoreGoalOptionSchema = external_exports.object({
6349
+ key: external_exports.string(),
6350
+ label: external_exports.string(),
6351
+ target: external_exports.number()
6352
+ });
6353
+ var ScoreGoalSchema = external_exports.object({
6354
+ /** The goal of the month being lived. */
6355
+ current: external_exports.number(),
6356
+ /** A goal chosen this month, starting on `from` (`YYYY-MM`). */
6357
+ next: external_exports.object({ target: external_exports.number(), from: external_exports.string() }).optional(),
6358
+ /** Projects a month over the last `averageMonths` closed months; absent when there are none. */
6359
+ average: external_exports.number().optional(),
6360
+ averageMonths: external_exports.number(),
6361
+ min: external_exports.number(),
6362
+ options: external_exports.array(ScoreGoalOptionSchema),
6363
+ /** The `key` of the option offered as recommended. */
6364
+ recommended: external_exports.string().optional()
6365
+ });
6366
+ var ScoreProgressMetricSchema = external_exports.object({
6367
+ key: external_exports.string(),
6368
+ value: external_exports.number(),
6369
+ target: external_exports.number(),
6370
+ available: external_exports.boolean()
6371
+ });
6372
+ var ScoreProgressSchema = external_exports.object({
6373
+ period: external_exports.string(),
6374
+ periodLabel: external_exports.string(),
6375
+ computedAt: external_exports.number(),
6376
+ metrics: external_exports.array(ScoreProgressMetricSchema)
6341
6377
  });
6342
6378
 
6343
6379
  // src/api/Score.api.ts
@@ -6358,6 +6394,18 @@ var ScoreAPI = class {
6358
6394
  ScoreRecapSchema
6359
6395
  );
6360
6396
  }
6397
+ async getProgress(ctx) {
6398
+ const { uri, method } = Endpoints10.GetProgress;
6399
+ return this.clientHTTP.makeRequest(this.env, uri, method, null, ctx, ScoreProgressSchema);
6400
+ }
6401
+ async getGoal(ctx) {
6402
+ const { uri, method } = Endpoints10.GetGoal;
6403
+ return this.clientHTTP.makeRequest(this.env, uri, method, null, ctx, ScoreGoalSchema);
6404
+ }
6405
+ async setGoal(ctx, target) {
6406
+ const { uri, method } = Endpoints10.SetGoal;
6407
+ return this.clientHTTP.makeRequest(this.env, uri, method, { target }, ctx, ScoreGoalSchema);
6408
+ }
6361
6409
  };
6362
6410
  var Score_api_default = ScoreAPI;
6363
6411
 
@@ -7165,9 +7213,13 @@ var score_exports = {};
7165
7213
  __export(score_exports, {
7166
7214
  Endpoints: () => Endpoints10,
7167
7215
  ScoreBandSchema: () => ScoreBandSchema,
7216
+ ScoreGoalOptionSchema: () => ScoreGoalOptionSchema,
7217
+ ScoreGoalSchema: () => ScoreGoalSchema,
7168
7218
  ScoreHistoryEntrySchema: () => ScoreHistoryEntrySchema,
7169
7219
  ScoreMetricKeySchema: () => ScoreMetricKeySchema,
7170
7220
  ScoreMetricSchema: () => ScoreMetricSchema,
7221
+ ScoreProgressMetricSchema: () => ScoreProgressMetricSchema,
7222
+ ScoreProgressSchema: () => ScoreProgressSchema,
7171
7223
  ScoreRecapSchema: () => ScoreRecapSchema,
7172
7224
  ScoreSchema: () => ScoreSchema
7173
7225
  });