shred-api-client 2.13.5 → 2.14.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.js CHANGED
@@ -36,6 +36,7 @@ __export(index_exports, {
36
36
  Email: () => email_exports,
37
37
  Exceptions: () => exceptions_exports,
38
38
  Goal: () => goal_exports,
39
+ Kpi: () => kpi_exports,
39
40
  Note: () => note_exports,
40
41
  Notification: () => notification_exports,
41
42
  Project: () => project_exports,
@@ -6445,12 +6446,88 @@ var ScoreAPI = class {
6445
6446
  };
6446
6447
  var Score_api_default = ScoreAPI;
6447
6448
 
6449
+ // src/model/kpi/Kpi.api.ts
6450
+ var Endpoints11 = {
6451
+ ListBoards: { uri: "/kpis/boards/", method: "GET" },
6452
+ GetBoard: { uri: "/kpis/boards/:board/", method: "GET" }
6453
+ };
6454
+
6455
+ // src/model/kpi/Kpi.schema.ts
6456
+ var KpiBoardSchema = external_exports.object({
6457
+ id: external_exports.string(),
6458
+ kpiCount: external_exports.number()
6459
+ });
6460
+ var KpiEntrySchema = external_exports.object({
6461
+ kpiId: external_exports.string(),
6462
+ kpiName: external_exports.string(),
6463
+ category: external_exports.string(),
6464
+ /** `num`, `pct` (percentage points: 5.5 means 5.5%), `dec`, `score`, `stars` or `usd`. */
6465
+ unit: external_exports.string(),
6466
+ /** `up` or `down`. */
6467
+ better: external_exports.string(),
6468
+ /** `stock` (level at the end of the month), `flow` (volume in the month) or `rate`. */
6469
+ kpiType: external_exports.string(),
6470
+ sortOrder: external_exports.number().nullable(),
6471
+ /** YYYY-MM-DD, always the first day of the month. */
6472
+ periodStart: external_exports.string(),
6473
+ actualValue: external_exports.number().nullable(),
6474
+ targetValue: external_exports.number().nullable(),
6475
+ /** `typed` or `derived` (from the plan assumptions). */
6476
+ targetSource: external_exports.string().nullable(),
6477
+ /** Only alongside a typed target. */
6478
+ baseline: external_exports.number().nullable(),
6479
+ /** True for the month still being lived. */
6480
+ isPartial: external_exports.boolean(),
6481
+ /** `no_data`, `no_target`, `in_progress`, `met` or `missed`. */
6482
+ status: external_exports.string(),
6483
+ /** Against the previous month's value. */
6484
+ delta: external_exports.number().nullable(),
6485
+ /** Direction-aware: at or above 1 means the target was met, whichever way `better` points. */
6486
+ attainment: external_exports.number().nullable()
6487
+ });
6488
+ var KpiMonthSummarySchema = external_exports.object({
6489
+ periodStart: external_exports.string(),
6490
+ met: external_exports.number(),
6491
+ missed: external_exports.number(),
6492
+ judged: external_exports.number(),
6493
+ inProgress: external_exports.number(),
6494
+ noTarget: external_exports.number(),
6495
+ noData: external_exports.number(),
6496
+ /** Null when no KPI was judged in the month. */
6497
+ scoreOutOf10: external_exports.number().nullable()
6498
+ });
6499
+ var KpiBoardHistorySchema = external_exports.object({
6500
+ board: external_exports.string(),
6501
+ /** ISO timestamp of the last automatic calculation. */
6502
+ calculatedAt: external_exports.string().nullable(),
6503
+ entries: external_exports.array(KpiEntrySchema),
6504
+ summaries: external_exports.array(KpiMonthSummarySchema)
6505
+ });
6506
+
6507
+ // src/api/Kpi.api.ts
6508
+ var KpiAPI = class {
6509
+ constructor(env) {
6510
+ this.env = env;
6511
+ this.clientHTTP = new HTTPClient();
6512
+ }
6513
+ async listBoards(ctx) {
6514
+ const { uri, method } = Endpoints11.ListBoards;
6515
+ return this.clientHTTP.makeRequest(this.env, uri, method, null, ctx, external_exports.array(KpiBoardSchema));
6516
+ }
6517
+ async getBoard(ctx, board) {
6518
+ const { uri, method } = Endpoints11.GetBoard;
6519
+ const endpoint = uri.replace(":board", encodeURIComponent(board));
6520
+ return this.clientHTTP.makeRequest(this.env, endpoint, method, null, ctx, KpiBoardHistorySchema);
6521
+ }
6522
+ };
6523
+ var Kpi_api_default = KpiAPI;
6524
+
6448
6525
  // src/model/rbac/index.ts
6449
6526
  var rbac_exports = {};
6450
6527
  __export(rbac_exports, {
6451
6528
  ActionCatalog: () => ActionCatalog,
6452
6529
  Actions: () => Actions,
6453
- Endpoints: () => Endpoints11,
6530
+ Endpoints: () => Endpoints12,
6454
6531
  PrincipalSchema: () => PrincipalSchema,
6455
6532
  RoleAssignmentSchema: () => RoleAssignmentSchema,
6456
6533
  RoleGrantSchema: () => RoleGrantSchema,
@@ -6554,6 +6631,8 @@ var Actions = {
6554
6631
  USER_CHANGE_EMAIL: "user.change_email",
6555
6632
  USER_GET_TOKEN: "user.get_token",
6556
6633
  USER_CREATE_TOKEN: "user.create_token",
6634
+ // — KPIs —
6635
+ KPI_VIEW: "kpi.view",
6557
6636
  // — RBAC administration —
6558
6637
  ROLE_MANAGE: "role.manage",
6559
6638
  USER_ASSIGN_ROLE: "user.assign_role"
@@ -6651,6 +6730,8 @@ var ActionCatalog = {
6651
6730
  [Actions.USER_CHANGE_EMAIL]: { label: "Change your own email", group: "Users" },
6652
6731
  [Actions.USER_GET_TOKEN]: { label: "Get your own API token", group: "Users" },
6653
6732
  [Actions.USER_CREATE_TOKEN]: { label: "Create your own API token", group: "Users" },
6733
+ // KPIs
6734
+ [Actions.KPI_VIEW]: { label: "View the KPI scorecards", group: "KPIs" },
6654
6735
  // Administration
6655
6736
  [Actions.ROLE_MANAGE]: { label: "Manage roles (create, edit, delete)", group: "Administration" },
6656
6737
  [Actions.USER_ASSIGN_ROLE]: { label: "Assign roles to users", group: "Administration" }
@@ -6696,7 +6777,7 @@ var PrincipalSchema = external_exports.object({
6696
6777
  });
6697
6778
 
6698
6779
  // src/model/rbac/RBAC.api.ts
6699
- var Endpoints11 = {
6780
+ var Endpoints12 = {
6700
6781
  GetActions: { uri: "/rbac/actions", method: "GET" },
6701
6782
  ListRoles: { uri: "/rbac/roles", method: "GET" },
6702
6783
  CreateRole: { uri: "/rbac/roles", method: "POST" },
@@ -6715,29 +6796,29 @@ var RBACAPI = class {
6715
6796
  this.clientHTTP = new HTTPClient();
6716
6797
  }
6717
6798
  async getActions(c) {
6718
- const e = Endpoints11.GetActions;
6799
+ const e = Endpoints12.GetActions;
6719
6800
  return this.clientHTTP.makeRequest(this.env, e.uri, e.method, null, c);
6720
6801
  }
6721
6802
  async listRoles(c) {
6722
- const e = Endpoints11.ListRoles;
6803
+ const e = Endpoints12.ListRoles;
6723
6804
  return this.clientHTTP.makeRequest(this.env, e.uri, e.method, null, c, external_exports.array(RoleSchema));
6724
6805
  }
6725
6806
  async createRole(c, input) {
6726
- const e = Endpoints11.CreateRole;
6807
+ const e = Endpoints12.CreateRole;
6727
6808
  return this.clientHTTP.makeRequest(this.env, e.uri, e.method, input, c, RoleSchema);
6728
6809
  }
6729
6810
  async updateRole(c, roleId, input) {
6730
- const e = Endpoints11.UpdateRole;
6811
+ const e = Endpoints12.UpdateRole;
6731
6812
  const uri = e.uri.replace(":roleId", roleId);
6732
6813
  return this.clientHTTP.makeRequest(this.env, uri, e.method, input, c, RoleSchema);
6733
6814
  }
6734
6815
  async deleteRole(c, roleId) {
6735
- const e = Endpoints11.DeleteRole;
6816
+ const e = Endpoints12.DeleteRole;
6736
6817
  const uri = e.uri.replace(":roleId", roleId);
6737
6818
  return this.clientHTTP.makeRequest(this.env, uri, e.method, null, c, external_exports.boolean());
6738
6819
  }
6739
6820
  async getAssignments(c, uid) {
6740
- const e = Endpoints11.GetAssignments;
6821
+ const e = Endpoints12.GetAssignments;
6741
6822
  const uri = e.uri.replace(":uid", uid);
6742
6823
  return this.clientHTTP.makeRequest(
6743
6824
  this.env,
@@ -6749,17 +6830,17 @@ var RBACAPI = class {
6749
6830
  );
6750
6831
  }
6751
6832
  async assign(c, uid, input) {
6752
- const e = Endpoints11.Assign;
6833
+ const e = Endpoints12.Assign;
6753
6834
  const uri = e.uri.replace(":uid", uid);
6754
6835
  return this.clientHTTP.makeRequest(this.env, uri, e.method, input, c, RoleAssignmentSchema);
6755
6836
  }
6756
6837
  async unassign(c, uid, input) {
6757
- const e = Endpoints11.Unassign;
6838
+ const e = Endpoints12.Unassign;
6758
6839
  const uri = e.uri.replace(":uid", uid);
6759
6840
  return this.clientHTTP.makeRequest(this.env, uri, e.method, input, c, RoleAssignmentSchema);
6760
6841
  }
6761
6842
  async searchPrincipals(c, term) {
6762
- const e = Endpoints11.SearchPrincipals;
6843
+ const e = Endpoints12.SearchPrincipals;
6763
6844
  const uri = `${e.uri}?q=${encodeURIComponent(term)}`;
6764
6845
  return this.clientHTTP.makeRequest(this.env, uri, e.method, null, c, external_exports.array(PrincipalSchema));
6765
6846
  }
@@ -6784,6 +6865,7 @@ var ShredAPI = class {
6784
6865
  this.specialOffer = new SpecialOffer_api_default(env);
6785
6866
  this.shredu = new ShredU_api_default(env);
6786
6867
  this.score = new Score_api_default(env);
6868
+ this.kpi = new Kpi_api_default(env);
6787
6869
  this.rbac = new RBAC_api_default(env);
6788
6870
  }
6789
6871
  };
@@ -6803,7 +6885,7 @@ __export(exceptions_exports, {
6803
6885
  var prompt_exports = {};
6804
6886
  __export(prompt_exports, {
6805
6887
  CategorySchema: () => CategorySchema,
6806
- Endpoints: () => Endpoints12,
6888
+ Endpoints: () => Endpoints13,
6807
6889
  PromptSchema: () => PromptSchema,
6808
6890
  ScriptIARequestSchema: () => ScriptIARequestSchema,
6809
6891
  ScriptSchema: () => ScriptSchema
@@ -6839,7 +6921,7 @@ var PromptSchema = external_exports.object({
6839
6921
  });
6840
6922
 
6841
6923
  // src/model/prompt/Prompt.api.ts
6842
- var Endpoints12 = {
6924
+ var Endpoints13 = {
6843
6925
  GetPrompt: {
6844
6926
  uri: "/prompts/getPrompt",
6845
6927
  method: "GET"
@@ -6870,7 +6952,7 @@ var Endpoints12 = {
6870
6952
  var tenant_exports = {};
6871
6953
  __export(tenant_exports, {
6872
6954
  Action: () => Action,
6873
- Endpoints: () => Endpoints13,
6955
+ Endpoints: () => Endpoints14,
6874
6956
  MemberSchema: () => MemberSchema,
6875
6957
  MemberUpdateSchema: () => MemberUpdateSchema,
6876
6958
  PreferencesSchema: () => PreferencesSchema,
@@ -7001,7 +7083,7 @@ var TenantUpdateSchema = TenantSchema.pick({
7001
7083
  }).partial();
7002
7084
 
7003
7085
  // src/model/tenant/Tenant.api.ts
7004
- var Endpoints13 = {
7086
+ var Endpoints14 = {
7005
7087
  GetByInviteCode: {
7006
7088
  uri: "/tenants/public/invitation/",
7007
7089
  method: "GET"
@@ -7043,7 +7125,7 @@ var Endpoints13 = {
7043
7125
  // src/model/user/index.ts
7044
7126
  var user_exports = {};
7045
7127
  __export(user_exports, {
7046
- Endpoints: () => Endpoints14,
7128
+ Endpoints: () => Endpoints15,
7047
7129
  PreferencesSchema: () => PreferencesSchema2,
7048
7130
  Role: () => Role,
7049
7131
  System: () => System,
@@ -7098,7 +7180,7 @@ var UserSchema = external_exports.object({
7098
7180
  });
7099
7181
 
7100
7182
  // src/model/user/User.api.ts
7101
- var Endpoints14 = {
7183
+ var Endpoints15 = {
7102
7184
  ChangeEmail: { uri: "/accounts/user/changeEmail", method: "PUT" },
7103
7185
  GetUserInfo: { uri: "/accounts/user/info", method: "GET" },
7104
7186
  GetBindedUsers: { uri: "/accounts/binded/list", method: "GET" },
@@ -7121,7 +7203,7 @@ var Endpoints14 = {
7121
7203
  var subscription_exports = {};
7122
7204
  __export(subscription_exports, {
7123
7205
  ChargeSchema: () => ChargeSchema,
7124
- Endpoints: () => Endpoints15,
7206
+ Endpoints: () => Endpoints16,
7125
7207
  PlanSchema: () => PlanSchema,
7126
7208
  ProductSchema: () => ProductSchema,
7127
7209
  SubscriptionSchema: () => SubscriptionSchema,
@@ -7130,7 +7212,7 @@ __export(subscription_exports, {
7130
7212
  });
7131
7213
 
7132
7214
  // src/model/subscription/Subscription.api.ts
7133
- var Endpoints15 = {
7215
+ var Endpoints16 = {
7134
7216
  GetPortal: {
7135
7217
  uri: "/subscriptions/portal/",
7136
7218
  method: "GET"
@@ -7192,7 +7274,7 @@ var Endpoints15 = {
7192
7274
  // src/model/track/index.ts
7193
7275
  var track_exports = {};
7194
7276
  __export(track_exports, {
7195
- Endpoints: () => Endpoints16,
7277
+ Endpoints: () => Endpoints17,
7196
7278
  TrackParamSchema: () => TrackParamSchema,
7197
7279
  TrackSchema: () => TrackSchema
7198
7280
  });
@@ -7210,7 +7292,7 @@ var TrackSchema = external_exports.object({
7210
7292
  });
7211
7293
 
7212
7294
  // src/model/track/Track.api.ts
7213
- var Endpoints16 = {
7295
+ var Endpoints17 = {
7214
7296
  Track: {
7215
7297
  uri: "/track/public/send/",
7216
7298
  method: "POST"
@@ -7268,6 +7350,16 @@ __export(score_exports, {
7268
7350
  ScoreSchema: () => ScoreSchema
7269
7351
  });
7270
7352
 
7353
+ // src/model/kpi/index.ts
7354
+ var kpi_exports = {};
7355
+ __export(kpi_exports, {
7356
+ Endpoints: () => Endpoints11,
7357
+ KpiBoardHistorySchema: () => KpiBoardHistorySchema,
7358
+ KpiBoardSchema: () => KpiBoardSchema,
7359
+ KpiEntrySchema: () => KpiEntrySchema,
7360
+ KpiMonthSummarySchema: () => KpiMonthSummarySchema
7361
+ });
7362
+
7271
7363
  // src/index.ts
7272
7364
  var index_default = ShredAPI;
7273
7365
  //# sourceMappingURL=index.js.map