@offnominal/ndb2-api-types 0.4.0 → 0.6.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.
@@ -5,6 +5,10 @@ export declare namespace GET_ById {
5
5
  type Response = APIResponse<Data>;
6
6
  }
7
7
  export declare namespace DELETE_ById_trigger {
8
- type Data = null;
8
+ type Data = Entities.Predictions.Prediction;
9
+ type Response = APIResponse<Data>;
10
+ }
11
+ export declare namespace PATCH_ById_retire {
12
+ type Data = Entities.Predictions.Prediction;
9
13
  type Response = APIResponse<Data>;
10
14
  }
@@ -5,8 +5,8 @@ export declare const Errors: {
5
5
  readonly MALFORMED_URL_PARAMS: 90003;
6
6
  readonly PREDICTION_NOT_FOUND: 90200;
7
7
  readonly INVALID_PREDICTION_STATUS: 90201;
8
- readonly INVALID_CHECK_DATE: 90202;
9
- readonly BETS_NO_CHANGE: 90501;
10
- readonly BETS_UNCHANGEABLE: 90502;
8
+ readonly INVALID_PREDICTION_CHECK_DATE: 90202;
9
+ readonly INVALID_PREDICTION_OWNERSHIP: 90203;
10
+ readonly INVALID_PREDICTION_RETIREMENT_WINDOW: 90204;
11
11
  };
12
12
  export type NDB2APIError = (typeof Errors)[keyof typeof Errors];
package/dist/v2/errors.js CHANGED
@@ -23,12 +23,12 @@ exports.Errors = {
23
23
  // 02 Predictions
24
24
  PREDICTION_NOT_FOUND: 90200,
25
25
  INVALID_PREDICTION_STATUS: 90201,
26
- INVALID_CHECK_DATE: 90202,
26
+ INVALID_PREDICTION_CHECK_DATE: 90202,
27
+ INVALID_PREDICTION_OWNERSHIP: 90203,
28
+ INVALID_PREDICTION_RETIREMENT_WINDOW: 90204,
27
29
  // 03 Scores
28
30
  // 04 Seasons
29
31
  // 05 Bets
30
- BETS_NO_CHANGE: 90501,
31
- BETS_UNCHANGEABLE: 90502,
32
32
  // 06 Votes
33
33
  };
34
34
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/v2/errors.ts"],"names":[],"mappings":";AAAA,eAAe;;;AAEf,kBAAkB;AAClB,4BAA4B;AAC5B,8BAA8B;AAE9B,YAAY;AACZ,eAAe;AACf,aAAa;AACb,mBAAmB;AACnB,cAAc;AACd,eAAe;AACf,YAAY;AACZ,aAAa;AAEA,QAAA,MAAM,GAAG;IACpB,eAAe;IACf,YAAY,EAAE,KAAK;IACnB,mBAAmB,EAAE,KAAK;IAC1B,sBAAsB,EAAE,KAAK;IAC7B,oBAAoB,EAAE,KAAK;IAE3B,WAAW;IAEX,iBAAiB;IACjB,oBAAoB,EAAE,KAAK;IAC3B,yBAAyB,EAAE,KAAK;IAChC,kBAAkB,EAAE,KAAK;IAEzB,YAAY;IAEZ,aAAa;IAEb,UAAU;IACV,cAAc,EAAE,KAAK;IACrB,iBAAiB,EAAE,KAAK;IAExB,WAAW;CACH,CAAC"}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/v2/errors.ts"],"names":[],"mappings":";AAAA,eAAe;;;AAEf,kBAAkB;AAClB,4BAA4B;AAC5B,8BAA8B;AAE9B,YAAY;AACZ,eAAe;AACf,aAAa;AACb,mBAAmB;AACnB,cAAc;AACd,eAAe;AACf,YAAY;AACZ,aAAa;AAEA,QAAA,MAAM,GAAG;IACpB,eAAe;IACf,YAAY,EAAE,KAAK;IACnB,mBAAmB,EAAE,KAAK;IAC1B,sBAAsB,EAAE,KAAK;IAC7B,oBAAoB,EAAE,KAAK;IAE3B,WAAW;IAEX,iBAAiB;IACjB,oBAAoB,EAAE,KAAK;IAC3B,yBAAyB,EAAE,KAAK;IAChC,6BAA6B,EAAE,KAAK;IACpC,4BAA4B,EAAE,KAAK;IACnC,oCAAoC,EAAE,KAAK;IAE3C,YAAY;IAEZ,aAAa;IAEb,UAAU;IAEV,WAAW;CACH,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { Prediction } from "./entities/predictions";
2
- declare const WEBHOOK_EVENTS: readonly ["untriggered_prediction", "triggered_prediction"];
2
+ declare const WEBHOOK_EVENTS: readonly ["unjudged_prediction", "untriggered_prediction", "triggered_prediction", "retired_prediction"];
3
3
  export type WebhookEvent = (typeof WEBHOOK_EVENTS)[number];
4
4
  export type BasePayload<E extends WebhookEvent, D> = {
5
5
  event_name: E;
@@ -8,13 +8,19 @@ export type BasePayload<E extends WebhookEvent, D> = {
8
8
  data: D;
9
9
  };
10
10
  export declare namespace Events {
11
+ type UnjudgedPrediction = BasePayload<"unjudged_prediction", {
12
+ prediction: Prediction;
13
+ }>;
11
14
  type UntriggeredPrediction = BasePayload<"untriggered_prediction", {
12
15
  prediction: Prediction;
13
16
  }>;
14
17
  type TriggeredPrediction = BasePayload<"triggered_prediction", {
15
18
  prediction: Prediction;
16
19
  }>;
20
+ type RetiredPrediction = BasePayload<"retired_prediction", {
21
+ prediction: Prediction;
22
+ }>;
17
23
  }
18
- export type Payload = Events.UntriggeredPrediction | Events.TriggeredPrediction;
24
+ export type Payload = Events.UnjudgedPrediction | Events.UntriggeredPrediction | Events.TriggeredPrediction | Events.RetiredPrediction;
19
25
  export declare const isWebhookPayloadV2: (payload: any) => payload is Payload;
20
26
  export {};
@@ -3,8 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isWebhookPayloadV2 = void 0;
4
4
  // Single source of truth for webhook events
5
5
  const WEBHOOK_EVENTS = [
6
+ "unjudged_prediction",
6
7
  "untriggered_prediction",
7
8
  "triggered_prediction",
9
+ "retired_prediction",
8
10
  ];
9
11
  const isWebhookPayloadV2 = (payload) => {
10
12
  if (!payload || typeof payload !== "object") {
@@ -1 +1 @@
1
- {"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../../src/v2/webhooks.ts"],"names":[],"mappings":";;;AAEA,4CAA4C;AAC5C,MAAM,cAAc,GAAG;IACrB,wBAAwB;IACxB,sBAAsB;CACd,CAAC;AA6BJ,MAAM,kBAAkB,GAAG,CAAC,OAAY,EAAsB,EAAE;IACrE,IA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gDAAgD;IAChD,IACE,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ;QACtC,CAAC,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,UAA0B,CAAC,EAC5D,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,mBAAmB;IACnB,IAAI,OAAO,CAAC,OAAO,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,yEAAyE;IACzE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QAClB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,IAAI,GACR,OAAO,CAAC,IAAI,YAAY,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACvE,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAjCW,QAAA,kBAAkB,sBAiC7B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@offnominal/ndb2-api-types",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "author": "Jake Robins",
5
5
  "types": "./src/v2/index.ts",
6
6
  "main": "./dist/v2/index.js",
@@ -9,6 +9,12 @@ export namespace GET_ById {
9
9
 
10
10
  // DELETE /predictions/{prediction_id}/trigger
11
11
  export namespace DELETE_ById_trigger {
12
- export type Data = null;
12
+ export type Data = Entities.Predictions.Prediction;
13
+ export type Response = APIResponse<Data>;
14
+ }
15
+
16
+ // PATCH /predictions/{prediction_id}/retire
17
+ export namespace PATCH_ById_retire {
18
+ export type Data = Entities.Predictions.Prediction;
13
19
  export type Response = APIResponse<Data>;
14
20
  }
package/src/v2/errors.ts CHANGED
@@ -25,15 +25,15 @@ export const Errors = {
25
25
  // 02 Predictions
26
26
  PREDICTION_NOT_FOUND: 90200,
27
27
  INVALID_PREDICTION_STATUS: 90201,
28
- INVALID_CHECK_DATE: 90202,
28
+ INVALID_PREDICTION_CHECK_DATE: 90202,
29
+ INVALID_PREDICTION_OWNERSHIP: 90203,
30
+ INVALID_PREDICTION_RETIREMENT_WINDOW: 90204,
29
31
 
30
32
  // 03 Scores
31
33
 
32
34
  // 04 Seasons
33
35
 
34
36
  // 05 Bets
35
- BETS_NO_CHANGE: 90501,
36
- BETS_UNCHANGEABLE: 90502,
37
37
 
38
38
  // 06 Votes
39
39
  } as const;
@@ -2,8 +2,10 @@ import { Prediction } from "./entities/predictions";
2
2
 
3
3
  // Single source of truth for webhook events
4
4
  const WEBHOOK_EVENTS = [
5
+ "unjudged_prediction",
5
6
  "untriggered_prediction",
6
7
  "triggered_prediction",
8
+ "retired_prediction",
7
9
  ] as const;
8
10
 
9
11
  // Derive the type from the array
@@ -17,6 +19,12 @@ export type BasePayload<E extends WebhookEvent, D> = {
17
19
  };
18
20
 
19
21
  export namespace Events {
22
+ export type UnjudgedPrediction = BasePayload<
23
+ "unjudged_prediction",
24
+ {
25
+ prediction: Prediction;
26
+ }
27
+ >;
20
28
  export type UntriggeredPrediction = BasePayload<
21
29
  "untriggered_prediction",
22
30
  {
@@ -29,9 +37,19 @@ export namespace Events {
29
37
  prediction: Prediction;
30
38
  }
31
39
  >;
40
+ export type RetiredPrediction = BasePayload<
41
+ "retired_prediction",
42
+ {
43
+ prediction: Prediction;
44
+ }
45
+ >;
32
46
  }
33
47
 
34
- export type Payload = Events.UntriggeredPrediction | Events.TriggeredPrediction;
48
+ export type Payload =
49
+ | Events.UnjudgedPrediction
50
+ | Events.UntriggeredPrediction
51
+ | Events.TriggeredPrediction
52
+ | Events.RetiredPrediction;
35
53
 
36
54
  export const isWebhookPayloadV2 = (payload: any): payload is Payload => {
37
55
  if (!payload || typeof payload !== "object") {