triangle-types 1.0.245 → 1.0.247

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.
@@ -1,4 +1,4 @@
1
- export * from "./types/errors/APIError.js";
1
+ export * from "./types/errors/TriangleAPIError.js";
2
2
  export * from "./types/application/ApplicationStage.js";
3
3
  export * from "./types/twitter/TwitterTweet.js";
4
4
  export * from "./types/twitter/TwitterUser.js";
package/dist/src/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export * from "./types/errors/APIError.js";
1
+ export * from "./types/errors/TriangleAPIError.js";
2
2
  export * from "./types/application/ApplicationStage.js";
3
3
  export * from "./types/twitter/TwitterTweet.js";
4
4
  export * from "./types/twitter/TwitterUser.js";
@@ -0,0 +1,4 @@
1
+ export declare class TriangleAPIError extends Error {
2
+ status: number;
3
+ constructor(status: number, message?: string);
4
+ }
@@ -0,0 +1,19 @@
1
+ const default_messages_by_status = {
2
+ 400: "Bad Request",
3
+ 401: "Unauthorized",
4
+ 403: "Forbidden",
5
+ 404: "Not Found",
6
+ 405: "Method Not Allowed",
7
+ 500: "Internal Server Error",
8
+ 504: "Gateway Timeout",
9
+ 600: "Failed to Parse Output"
10
+ };
11
+ export class TriangleAPIError extends Error {
12
+ status;
13
+ constructor(status, message) {
14
+ const default_message = default_messages_by_status[status];
15
+ super(message !== undefined ? message : default_message !== undefined ? default_message : "Error");
16
+ this.name = "TriangleAPIError";
17
+ this.status = status;
18
+ }
19
+ }
@@ -1,4 +1,4 @@
1
- declare const resource_type_ids: readonly ["tenant_document", "scout", "prism", "tag", "target", "tenant_role", "user", "fragment_type", "palette"];
1
+ declare const resource_type_ids: readonly ["document", "scout", "prism", "tag", "target", "role", "user", "fragment_type", "palette"];
2
2
  export type ResourceTypeID = typeof resource_type_ids[number];
3
3
  export declare function is_resource_type_id(resource_type_id: any): resource_type_id is ResourceTypeID;
4
4
  export declare class TenantProvision {
@@ -1,4 +1,4 @@
1
- const resource_type_ids = ["tenant_document", "scout", "prism", "tag", "target", "tenant_role", "user", "fragment_type", "palette"];
1
+ const resource_type_ids = ["document", "scout", "prism", "tag", "target", "role", "user", "fragment_type", "palette"];
2
2
  export function is_resource_type_id(resource_type_id) {
3
3
  return resource_type_ids.includes(resource_type_id);
4
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-types",
3
- "version": "1.0.245",
3
+ "version": "1.0.247",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from "./types/errors/APIError"
1
+ export * from "./types/errors/TriangleAPIError"
2
2
 
3
3
  export * from "./types/application/ApplicationStage"
4
4
 
@@ -10,12 +10,12 @@ const default_messages_by_status : Record<number, string> = {
10
10
  }
11
11
 
12
12
 
13
- export class APIError extends Error {
13
+ export class TriangleAPIError extends Error {
14
14
  status : number
15
15
  constructor(status : number, message?: string) {
16
16
  const default_message = default_messages_by_status[status]
17
17
  super(message !== undefined ? message : default_message !== undefined ? default_message : "Error")
18
- this.name = "APIError"
18
+ this.name = "TriangleAPIError"
19
19
  this.status = status
20
20
  }
21
21
  }
@@ -1,6 +1,6 @@
1
1
  import { FederalCongressBillDocument } from "../federal_congress/FederalCongressBillDocument"
2
2
  import { LegistarDocument } from "../legistar/LegistarDocument"
3
- import { WebArticleTag, WebArticleTagAux } from "../web/WebArticleTag"
3
+ import { WebArticleTag } from "../web/WebArticleTag"
4
4
  import { ScoutDocument } from "../scout/ScoutDocument"
5
5
  import { TwitterTweet } from "../twitter/TwitterTweet"
6
6
 
@@ -1,4 +1,4 @@
1
- const resource_type_ids = ["tenant_document", "scout", "prism", "tag", "target", "tenant_role", "user", "fragment_type", "palette"] as const
1
+ const resource_type_ids = ["document", "scout", "prism", "tag", "target", "role", "user", "fragment_type", "palette"] as const
2
2
 
3
3
  export type ResourceTypeID = typeof resource_type_ids[number]
4
4