gps-global-types 1.0.0 → 1.0.2

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.
@@ -0,0 +1,18 @@
1
+ export type StringDictionary = {
2
+ [key: string]: string;
3
+ };
4
+
5
+ export type RegexMatchedString<Pattern extends string> =
6
+ `${string & { __brand: Pattern }}`;
7
+ //TYPES OF STRINGS
8
+
9
+
10
+ export type armordAccessionNumber = string // who KNOWS the format of these
11
+ export type ObjectId = RegexMatchedString<'[a-zA-Z0-9]{12}'> //12 byte string meant to index mongo docs
12
+ export type armordMrsnId = string // 6 o/* */r 7 digit number typically, but the bi-db is a cesspool
13
+ export type mrsnId = string // ###### ('MRSN' + 6 or 7 digit number) typically, but the bi-db is a cesspool
14
+ export type armordPatientId = RegexMatchedString<'M\d+'> // M###### ('M'+6 digit number), but the bi-db is a cesspool
15
+ export type Hex = RegexMatchedString<'#\d{6}'> // 6 digit String hexadecimal w/ '#' prepended
16
+ export type Rgb = RegexMatchedString<'rgb\([1-256],[1-256],[1-256]\)'> // format rgb(\d[1-256],\d[1-256],\d[1-256])
17
+ export type Color = Hex | Rgb | String
18
+
package/index.tsx CHANGED
@@ -0,0 +1,4 @@
1
+ export * from './global.types.js'
2
+ export * from './link.types.js'
3
+ export * from './mst.types.js'
4
+ export * from './pie.types.js'
package/link.types.tsx ADDED
@@ -0,0 +1,22 @@
1
+ import {BaseType,Selection, SimulationLinkDatum, SimulationNodeDatum} from 'd3';
2
+ import { mstGlobalTypes } from './mst.types';
3
+ interface coords {
4
+ x:number,
5
+ y:number
6
+ }
7
+ export interface EdgeType { // extends SimulationLinkDatum<NodeType>} anything not defined here was added by d3 (or i fucked up)
8
+ source:coords // node _id edge to
9
+ target:coords // node _id edge from
10
+ value:number // distance between source and target
11
+ }
12
+
13
+ export type gLinkType = Selection<SVGGElement, EdgeType, BaseType, unknown>
14
+ export interface LinkType {
15
+ g:gLinkType
16
+ }
17
+
18
+ export interface LinkProps {
19
+ data: EdgeType[],
20
+ force:mstGlobalTypes
21
+ }
22
+ export type svgSelection = Selection<BaseType, gLinkType, Element, LinkType>; //Selection<Element,LinkType,Element,any>
package/mst.types.tsx CHANGED
@@ -1,3 +1,4 @@
1
+ import { armordAccessionNumber, Color, mrsnId, ObjectId, RegexMatchedString } from "./global.types";
1
2
 
2
3
  export interface mstGlobalTypes {
3
4
  //form values
@@ -24,19 +25,6 @@ export type colorKey = typeof colorFields[number];
24
25
  export type dateKey = typeof dateFields[number];
25
26
  export type labelKey = typeof labelFields[number];
26
27
 
27
- type RegexMatchedString<Pattern extends string> =
28
- `${string & { __brand: Pattern }}`;
29
- //TYPES OF STRINGS
30
- type armordAccessionNumber = string // who KNOWS the format of these
31
- type ObjectId = RegexMatchedString<'[a-zA-Z0-9]{12}'> //12 byte string meant to index mongo docs
32
- type armordMrsnId = string // 6 o/* */r 7 digit number typically, but the bi-db is a cesspool
33
- type mrsnId = string // ###### ('MRSN' + 6 or 7 digit number) typically, but the bi-db is a cesspool
34
- type armordPatientId = RegexMatchedString<'M\d+'> // M###### ('M'+6 digit number), but the bi-db is a cesspool
35
- type Hex = RegexMatchedString<'#\d{6}'> // 6 digit String hexadecimal w/ '#' prepended
36
- type Rgb = RegexMatchedString<'rgb\([1-256],[1-256],[1-256]\)'> // format rgb(\d[1-256],\d[1-256],\d[1-256])
37
- type Color = Hex|Rgb|String
38
-
39
-
40
28
 
41
29
 
42
30
 
package/package.json CHANGED
@@ -1,12 +1,19 @@
1
1
  {
2
2
  "name": "gps-global-types",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "types shared between front-end and back-end",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
8
8
  },
9
9
  "author": "lizz",
10
- "type":"module",
11
- "license": "ISC"
10
+ "type": "module",
11
+ "license": "ISC",
12
+ "dependencies": {
13
+ "d3": "^7.9.0",
14
+ "react": "^19.1.1"
15
+ },
16
+ "devDependencies": {
17
+ "typescript": "^5.9.2"
18
+ }
12
19
  }
package/pie.types.tsx CHANGED
@@ -1,8 +1,6 @@
1
1
  import { BaseType, Selection, SimulationNodeDatum } from "d3"
2
- import { Ref, RefObject } from "react"
3
- import { EdgeType, svgSelection } from "../../Link/link.types"
4
- import { ObjectId, Color, RegexMatchedString } from "@/assets/types/global.types"
5
- import { colorKey, dateKey, labelKey } from "../../mst.types"
2
+ import { ObjectId, Color, RegexMatchedString } from "./global.types"
3
+ import { colorKey, dateKey, labelKey } from "./mst.types"
6
4
 
7
5
  export interface ColorField {//TYPES OF GRAPH FIELDS ColorField datefields become colorFields but require additional processing
8
6
  color: string, // unique hex or rgb of parameter
@@ -10,16 +8,16 @@ export interface ColorField {//TYPES OF GRAPH FIELDS ColorField datefields becom
10
8
  latest?: string // most recent node designation; diff coloring logic for 'latest' nodes
11
9
  }
12
10
 
13
- export type LabelField = string //if n>1, seperated by '&' which are interpreted as newlines in front-end. var names ends with 'LBL'.
11
+ export type LabelField = string; //if n>1, seperated by '&' which are interpreted as newlines in front-end. var names ends with 'LBL'.
14
12
  export interface ColorType {
15
13
  color: Color, //unique hex of parameter
16
14
  value: number //count of how many times value will be represented in the pie
17
15
  }
18
16
  type LabelType = RegexMatchedString<'(\w&)*'> // if many, seperated by '&' qhich are interpreted as newlines in front-end. var names ends with 'LBL'.
19
- type DateType = string | Date // must be able to be interpreted as date type by Date js object
17
+ type DateType = string | Date; // must be able to be interpreted as date type by Date js object
20
18
 
21
19
 
22
- interface ExtraNodeTypeFields extends d3.SimulationNodeDatum {
20
+ interface ExtraNodeTypeFields extends SimulationNodeDatum {
23
21
  id: ObjectId,//unique identifier referenced by Graph.links and d3 Force. String but it's a string of a mongo id
24
22
  beforeAndAfter?: ColorType[], //[=[{color:'#fff',value:1}]] so it doesnt break on recalculation
25
23
  dateArr: DateType[], // array of armordCultureDates used for beforeAndAfter coloring
@@ -48,13 +46,13 @@ export interface SelectionObj {
48
46
  mrsnIds: string[],
49
47
  active: boolean
50
48
  }
51
- export interface InitializeDragProps {
52
- sticky: boolean,
53
- sim: RefObject<d3.Simulation<d3.SimulationNodeDatum, any>>,
54
- setSelected: React.Dispatch<React.SetStateAction<SelectionObj>>,
55
- height: number,
56
- width: number// todo can this be a global const somewhere instead?
57
- }
49
+ // export interface InitializeDragProps {
50
+ // sticky: boolean,
51
+ // sim: RefObject<Simulation<SimulationNodeDatum, any>>,
52
+ // setSelected: Dispatch<SetStateAction<SelectionObj>>,
53
+ // height: number,
54
+ // width: number// todo can this be a global const somewhere instead?
55
+ // }
58
56
  export interface NodeColorProps {
59
57
  colorField: keyof NodeType,
60
58
  svg: ParentSelection,
package/tsconfig.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ // Visit https://aka.ms/tsconfig to read more about this file
3
+ "compilerOptions": {
4
+ // File Layout
5
+ // "rootDir": "./src",
6
+ // "outDir": "./dist",
7
+
8
+ // Environment Settings
9
+ // See also https://aka.ms/tsconfig/module
10
+ "module": "nodenext",
11
+ "target": "esnext",
12
+ "types": [],
13
+ // For nodejs:
14
+ // "lib": ["esnext"],
15
+ // "types": ["node"],
16
+ // and npm install -D @types/node
17
+
18
+ // Other Outputs
19
+ "sourceMap": true,
20
+ "declaration": true,
21
+ "declarationMap": true,
22
+
23
+ // Stricter Typechecking Options
24
+ "noUncheckedIndexedAccess": true,
25
+ "exactOptionalPropertyTypes": true,
26
+
27
+ // Style Options
28
+ // "noImplicitReturns": true,
29
+ // "noImplicitOverride": true,
30
+ // "noUnusedLocals": true,
31
+ // "noUnusedParameters": true,
32
+ // "noFallthroughCasesInSwitch": true,
33
+ // "noPropertyAccessFromIndexSignature": true,
34
+
35
+ // Recommended Options
36
+ "strict": true,
37
+ "jsx": "react-jsx",
38
+ "verbatimModuleSyntax": true,
39
+ "isolatedModules": true,
40
+ "noUncheckedSideEffectImports": true,
41
+ "moduleDetection": "force",
42
+ "skipLibCheck": true,
43
+ }
44
+ }
package/line.types.tsx DELETED
File without changes