triangle-types 1.0.106 → 1.0.108

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,6 +1,8 @@
1
1
  export * from "./types/APIError.js";
2
+ export * from "./types/County.js";
2
3
  export * from "./types/State.js";
3
4
  export * from "./types/User.js";
5
+ export * from "./types/application/ApplicationStage.js";
4
6
  export * from "./types/press/PressArticle.js";
5
7
  export * from "./types/press/PressArticleTag.js";
6
8
  export * from "./types/twitter/TwitterTweet.js";
package/dist/src/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  export * from "./types/APIError.js";
2
+ export * from "./types/County.js";
2
3
  export * from "./types/State.js";
3
4
  export * from "./types/User.js";
5
+ export * from "./types/application/ApplicationStage.js";
4
6
  export * from "./types/press/PressArticle.js";
5
7
  export * from "./types/press/PressArticleTag.js";
6
8
  export * from "./types/twitter/TwitterTweet.js";
@@ -0,0 +1,8 @@
1
+ import { StateID } from "./State.js";
2
+ export declare class County {
3
+ readonly county_id: string;
4
+ readonly state_id: StateID;
5
+ readonly name: string;
6
+ constructor(county: any);
7
+ static is(county: any): county is County;
8
+ }
@@ -0,0 +1,25 @@
1
+ // export const county_type_ids = ["H1", "H4", "H5", "H6", "C7"] as const
2
+ import { is_state_id } from "./State.js";
3
+ // export type CountyTypeID = typeof county_type_ids[number]
4
+ // export function is_county_type_id(county_type_id : any) : county_type_id is CountyTypeID {
5
+ // return county_type_ids.includes(county_type_id)
6
+ // }
7
+ export class County {
8
+ county_id;
9
+ state_id;
10
+ name;
11
+ constructor(county) {
12
+ if (!County.is(county)) {
13
+ throw Error("Invalid input.");
14
+ }
15
+ this.county_id = county.county_id;
16
+ this.state_id = county.state_id;
17
+ this.name = county.name;
18
+ }
19
+ static is(county) {
20
+ return (county !== undefined &&
21
+ typeof county.county_id === "string" &&
22
+ is_state_id(county.state_id) &&
23
+ typeof county.name === "string");
24
+ }
25
+ }
@@ -0,0 +1,8 @@
1
+ export declare const application_stage_ids: readonly ["DEV", "ALPHA", "BETA", "GAMMA", "PROD"];
2
+ export type ApplicationStageID = typeof application_stage_ids[number];
3
+ export declare function is_application_stage_id(application_stage_id: any): application_stage_id is ApplicationStageID;
4
+ export interface ApplicationStage {
5
+ application_stage_id: ApplicationStageID;
6
+ port: number;
7
+ }
8
+ export declare const application_stages: Record<ApplicationStageID, ApplicationStage>;
@@ -0,0 +1,26 @@
1
+ export const application_stage_ids = ["DEV", "ALPHA", "BETA", "GAMMA", "PROD"];
2
+ export function is_application_stage_id(application_stage_id) {
3
+ return application_stage_ids.includes(application_stage_id);
4
+ }
5
+ export const application_stages = {
6
+ DEV: {
7
+ application_stage_id: "DEV",
8
+ port: 3000
9
+ },
10
+ ALPHA: {
11
+ application_stage_id: "ALPHA",
12
+ port: 3001
13
+ },
14
+ BETA: {
15
+ application_stage_id: "BETA",
16
+ port: 3002
17
+ },
18
+ GAMMA: {
19
+ application_stage_id: "GAMMA",
20
+ port: 3003
21
+ },
22
+ PROD: {
23
+ application_stage_id: "PROD",
24
+ port: 80
25
+ }
26
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-types",
3
- "version": "1.0.106",
3
+ "version": "1.0.108",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -1,7 +1,10 @@
1
1
  export * from "./types/APIError"
2
+ export * from "./types/County"
2
3
  export * from "./types/State"
3
4
  export * from "./types/User"
4
5
 
6
+ export * from "./types/application/ApplicationStage"
7
+
5
8
  export * from "./types/press/PressArticle"
6
9
  export * from "./types/press/PressArticleTag"
7
10
  export * from "./types/twitter/TwitterTweet"
@@ -0,0 +1,33 @@
1
+ // export const county_type_ids = ["H1", "H4", "H5", "H6", "C7"] as const
2
+
3
+ import { is_state_id, StateID } from "./State"
4
+
5
+ // export type CountyTypeID = typeof county_type_ids[number]
6
+
7
+ // export function is_county_type_id(county_type_id : any) : county_type_id is CountyTypeID {
8
+ // return county_type_ids.includes(county_type_id)
9
+ // }
10
+
11
+ export class County {
12
+ readonly county_id : string
13
+ readonly state_id : StateID
14
+ readonly name : string
15
+
16
+ constructor(county : any) {
17
+ if (!County.is(county)) {
18
+ throw Error("Invalid input.")
19
+ }
20
+ this.county_id = county.county_id
21
+ this.state_id = county.state_id
22
+ this.name = county.name
23
+ }
24
+
25
+ static is(county : any) : county is County {
26
+ return (
27
+ county !== undefined &&
28
+ typeof county.county_id === "string" &&
29
+ is_state_id(county.state_id) &&
30
+ typeof county.name === "string"
31
+ )
32
+ }
33
+ }
@@ -0,0 +1,35 @@
1
+ export const application_stage_ids = ["DEV", "ALPHA", "BETA", "GAMMA", "PROD"] as const
2
+
3
+ export type ApplicationStageID = typeof application_stage_ids[number]
4
+
5
+ export function is_application_stage_id(application_stage_id : any) : application_stage_id is ApplicationStageID {
6
+ return application_stage_ids.includes(application_stage_id)
7
+ }
8
+
9
+ export interface ApplicationStage {
10
+ application_stage_id : ApplicationStageID,
11
+ port : number
12
+ }
13
+
14
+ export const application_stages : Record<ApplicationStageID, ApplicationStage> = {
15
+ DEV : {
16
+ application_stage_id : "DEV",
17
+ port : 3000
18
+ },
19
+ ALPHA : {
20
+ application_stage_id : "ALPHA",
21
+ port : 3001
22
+ },
23
+ BETA : {
24
+ application_stage_id : "BETA",
25
+ port : 3002
26
+ },
27
+ GAMMA : {
28
+ application_stage_id : "GAMMA",
29
+ port : 3003
30
+ },
31
+ PROD : {
32
+ application_stage_id : "PROD",
33
+ port : 80
34
+ }
35
+ }