@brownandroot/api 1.0.0 → 1.1.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/README.md +59 -1
- package/dist/businessUnits.remote.d.ts +4 -4
- package/dist/costcodes.remote.d.ts +9 -6
- package/dist/employees.remote.d.ts +18 -10
- package/dist/index.d.ts +3 -0
- package/dist/jobtypejobsteps.remote.d.ts +3 -3
- package/dist/llm.remote.d.ts +12 -2
- package/dist/paytypes.remote.d.ts +4 -4
- package/dist/rag.remote.d.ts +11 -4
- package/dist/workorders.remote.d.ts +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,65 @@ TypeScript client for the Brown & Root APIHub data service. Provides access to e
|
|
|
8
8
|
npm install @brownandroot/api
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## SvelteKit Remote Functions
|
|
14
|
+
|
|
15
|
+
For SvelteKit apps, the package ships ready-to-use remote functions that run on the server and read credentials from environment variables automatically — no manual client instantiation needed.
|
|
16
|
+
|
|
17
|
+
### Setup
|
|
18
|
+
|
|
19
|
+
Add to your app's `.env`:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
APIHUB_URL=https://your-apihub-url.com
|
|
23
|
+
APIHUB_API_KEY=your-api-key
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Enable remote functions in `svelte.config.js` (if not already):
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
kit: {
|
|
30
|
+
experimental: { remoteFunctions: true }
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Usage
|
|
35
|
+
|
|
36
|
+
Import directly from the domain sub-path and call in components:
|
|
37
|
+
|
|
38
|
+
```svelte
|
|
39
|
+
<script lang="ts">
|
|
40
|
+
import { getEmployeesDropdown } from '@brownandroot/api/employees'
|
|
41
|
+
import { getBusinessUnitsDropdown } from '@brownandroot/api/businessUnits'
|
|
42
|
+
|
|
43
|
+
const employees = $derived(await getEmployeesDropdown())
|
|
44
|
+
const businessUnits = $derived(await getBusinessUnitsDropdown())
|
|
45
|
+
</script>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Or compose with your own remote functions:
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
import { query } from '$app/server'
|
|
52
|
+
import { getSupervisorChain } from '@brownandroot/api/employees'
|
|
53
|
+
|
|
54
|
+
export const getMyManagers = query(async () => {
|
|
55
|
+
return (await getSupervisorChain('12345')).slice(0, 2)
|
|
56
|
+
})
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Available sub-paths:** `employees`, `businessUnits`, `costcodes`, `paytypes`, `workorders`, `jobtypejobsteps`, `llm`, `rag`
|
|
60
|
+
|
|
61
|
+
> `chatStream` is not available as a remote function — use `ApiHubClient` directly to proxy the SSE response.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## ApiHubClient (direct usage)
|
|
66
|
+
|
|
67
|
+
For non-SvelteKit environments or when you need full control (caching, streaming):
|
|
68
|
+
|
|
69
|
+
### Setup
|
|
12
70
|
|
|
13
71
|
```typescript
|
|
14
72
|
import { ApiHubClient } from '@brownandroot/api'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const getBusinessUnits:
|
|
2
|
-
export declare const getBusinessUnitsDropdown:
|
|
3
|
-
export declare const getBusinessUnit:
|
|
4
|
-
export declare const searchBusinessUnits:
|
|
1
|
+
export declare const getBusinessUnits: import("@sveltejs/kit").RemoteQueryFunction<void, import("./index.js").BusinessUnit[]>;
|
|
2
|
+
export declare const getBusinessUnitsDropdown: import("@sveltejs/kit").RemoteQueryFunction<void, import("./index.js").DropdownOption[]>;
|
|
3
|
+
export declare const getBusinessUnit: import("@sveltejs/kit").RemoteQueryFunction<string, import("./index.js").BusinessUnit>;
|
|
4
|
+
export declare const searchBusinessUnits: import("@sveltejs/kit").RemoteQueryFunction<string, import("./index.js").BusinessUnit[]>;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
export declare const getCostcodes:
|
|
2
|
-
export declare const getCostcodesDropdown:
|
|
3
|
-
export declare const getCostcode:
|
|
4
|
-
export declare const getCostcodesDropdownByBu:
|
|
5
|
-
export declare const getCostcodesDropdownByBuAndPayType:
|
|
6
|
-
|
|
1
|
+
export declare const getCostcodes: import("@sveltejs/kit").RemoteQueryFunction<void, import("./index.js").Costcode[]>;
|
|
2
|
+
export declare const getCostcodesDropdown: import("@sveltejs/kit").RemoteQueryFunction<void, import("./index.js").DropdownOption[]>;
|
|
3
|
+
export declare const getCostcode: import("@sveltejs/kit").RemoteQueryFunction<string, import("./index.js").Costcode>;
|
|
4
|
+
export declare const getCostcodesDropdownByBu: import("@sveltejs/kit").RemoteQueryFunction<string, import("./index.js").DropdownOption[]>;
|
|
5
|
+
export declare const getCostcodesDropdownByBuAndPayType: import("@sveltejs/kit").RemoteQueryFunction<{
|
|
6
|
+
businessUnitId: string;
|
|
7
|
+
payTypeCode: string;
|
|
8
|
+
}, import("./index.js").DropdownOption[]>;
|
|
9
|
+
export declare const searchCostcodes: import("@sveltejs/kit").RemoteQueryFunction<string, import("./index.js").Costcode[]>;
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
export declare const getEmployees:
|
|
2
|
-
export declare const getEmployeesDropdown:
|
|
3
|
-
export declare const getEmployee:
|
|
4
|
-
export declare const searchByName:
|
|
5
|
-
export declare const getBySupervisor:
|
|
6
|
-
export declare const searchByEmail:
|
|
7
|
-
export declare const getSupervisorChain:
|
|
8
|
-
export declare const getJdeFromEmail:
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
export declare const getEmployees: import("@sveltejs/kit").RemoteQueryFunction<void, import("./index.js").Employee[]>;
|
|
2
|
+
export declare const getEmployeesDropdown: import("@sveltejs/kit").RemoteQueryFunction<void, import("./index.js").DropdownOption[]>;
|
|
3
|
+
export declare const getEmployee: import("@sveltejs/kit").RemoteQueryFunction<string, import("./index.js").Employee>;
|
|
4
|
+
export declare const searchByName: import("@sveltejs/kit").RemoteQueryFunction<string, import("./index.js").Employee[]>;
|
|
5
|
+
export declare const getBySupervisor: import("@sveltejs/kit").RemoteQueryFunction<string, import("./index.js").Employee[]>;
|
|
6
|
+
export declare const searchByEmail: import("@sveltejs/kit").RemoteQueryFunction<string, import("./index.js").Employee[]>;
|
|
7
|
+
export declare const getSupervisorChain: import("@sveltejs/kit").RemoteQueryFunction<string, import("./index.js").Employee[]>;
|
|
8
|
+
export declare const getJdeFromEmail: import("@sveltejs/kit").RemoteQueryFunction<string, {
|
|
9
|
+
jde: string | null;
|
|
10
|
+
employee: import("./index.js").Employee | null;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const searchByHbu: import("@sveltejs/kit").RemoteQueryFunction<string, import("./index.js").Employee[]>;
|
|
13
|
+
export declare const verifyIdentity: import("@sveltejs/kit").RemoteCommand<{
|
|
14
|
+
first3FirstName: string;
|
|
15
|
+
first3LastName: string;
|
|
16
|
+
dob: string;
|
|
17
|
+
ssn4: string;
|
|
18
|
+
}, Promise<import("./index.js").Employee | null>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,9 @@ export interface Employee {
|
|
|
5
5
|
employeeId: string;
|
|
6
6
|
name: string | null;
|
|
7
7
|
email: string | null;
|
|
8
|
+
personalEmail: string | null;
|
|
9
|
+
clientEmail: string | null;
|
|
10
|
+
workEmail: string | null;
|
|
8
11
|
badgeNumber: string | null;
|
|
9
12
|
employementStatus: string | null;
|
|
10
13
|
residentTaxArea: string | null;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const getJobtypejobsteps:
|
|
2
|
-
export declare const getJobtypejobstepsDropdown:
|
|
3
|
-
export declare const getJobtypejobstep:
|
|
1
|
+
export declare const getJobtypejobsteps: import("@sveltejs/kit").RemoteQueryFunction<void, import("./index.js").Jobtypejobstep[]>;
|
|
2
|
+
export declare const getJobtypejobstepsDropdown: import("@sveltejs/kit").RemoteQueryFunction<void, import("./index.js").DropdownOption[]>;
|
|
3
|
+
export declare const getJobtypejobstep: import("@sveltejs/kit").RemoteQueryFunction<string, import("./index.js").Jobtypejobstep>;
|
package/dist/llm.remote.d.ts
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
export declare const getLlmLogs:
|
|
2
|
-
export declare const chat:
|
|
1
|
+
export declare const getLlmLogs: import("@sveltejs/kit").RemoteQueryFunction<void, import("./index.js").LlmLog[]>;
|
|
2
|
+
export declare const chat: import("@sveltejs/kit").RemoteCommand<{
|
|
3
|
+
user: string;
|
|
4
|
+
messages: {
|
|
5
|
+
role: "system" | "user" | "assistant";
|
|
6
|
+
content: string;
|
|
7
|
+
}[];
|
|
8
|
+
source: string;
|
|
9
|
+
function?: string | undefined;
|
|
10
|
+
temperature?: number | undefined;
|
|
11
|
+
maxTokens?: number | undefined;
|
|
12
|
+
}, Promise<import("./index.js").ChatResponse>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const getPaytypes:
|
|
2
|
-
export declare const getPaytypesDropdown:
|
|
3
|
-
export declare const getPaytype:
|
|
4
|
-
export declare const searchPaytypes:
|
|
1
|
+
export declare const getPaytypes: import("@sveltejs/kit").RemoteQueryFunction<void, import("./index.js").Paytype[]>;
|
|
2
|
+
export declare const getPaytypesDropdown: import("@sveltejs/kit").RemoteQueryFunction<void, import("./index.js").PaytypeDropdownOption[]>;
|
|
3
|
+
export declare const getPaytype: import("@sveltejs/kit").RemoteQueryFunction<string, import("./index.js").Paytype>;
|
|
4
|
+
export declare const searchPaytypes: import("@sveltejs/kit").RemoteQueryFunction<string, import("./index.js").Paytype[]>;
|
package/dist/rag.remote.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
export declare const listDocuments:
|
|
2
|
-
export declare const uploadDocument:
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export declare const listDocuments: import("@sveltejs/kit").RemoteQueryFunction<void, import("./index.js").DocumentRecord[]>;
|
|
2
|
+
export declare const uploadDocument: import("@sveltejs/kit").RemoteCommand<{
|
|
3
|
+
fileName: string;
|
|
4
|
+
base64Content: string;
|
|
5
|
+
uploadedBy: string;
|
|
6
|
+
}, Promise<import("./index.js").DocumentRecord>>;
|
|
7
|
+
export declare const deleteDocument: import("@sveltejs/kit").RemoteCommand<number, Promise<void>>;
|
|
8
|
+
export declare const searchDocuments: import("@sveltejs/kit").RemoteCommand<{
|
|
9
|
+
query: string;
|
|
10
|
+
topK?: number | undefined;
|
|
11
|
+
}, Promise<import("./index.js").SearchResult[]>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const getWorkorders:
|
|
2
|
-
export declare const getWorkordersDropdown:
|
|
3
|
-
export declare const getWorkordersDropdownByBu:
|
|
4
|
-
export declare const getWorkorder:
|
|
5
|
-
export declare const searchWorkorders:
|
|
1
|
+
export declare const getWorkorders: import("@sveltejs/kit").RemoteQueryFunction<void, import("./index.js").Workorder[]>;
|
|
2
|
+
export declare const getWorkordersDropdown: import("@sveltejs/kit").RemoteQueryFunction<void, import("./index.js").DropdownOption[]>;
|
|
3
|
+
export declare const getWorkordersDropdownByBu: import("@sveltejs/kit").RemoteQueryFunction<string, import("./index.js").DropdownOption[]>;
|
|
4
|
+
export declare const getWorkorder: import("@sveltejs/kit").RemoteQueryFunction<string, import("./index.js").Workorder>;
|
|
5
|
+
export declare const searchWorkorders: import("@sveltejs/kit").RemoteQueryFunction<string, import("./index.js").Workorder[]>;
|