venue-js 1.0.0-0 → 1.0.0-1

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.
Files changed (2) hide show
  1. package/README.md +85 -13
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,19 +1,91 @@
1
- # Usage
1
+ # Venue JS — Data Client SDK
2
2
 
3
+ Venue JS is a lightweight JavaScript/TypeScript SDK for accessing venue data such as occupants, amenities, kiosks, and other IMDF-based features from your Venue API.
4
+ It provides a simple, unified client for fetching and filtering features by type or ID — ideal for use in React apps, kiosk frontends, and data-driven dashboards.
5
+
6
+ ## Installation
3
7
  ```
4
- import { getDataClient } from 'lib/venue-js'
8
+ # with npm
9
+ npm install venue-js
5
10
 
6
- const client = await getDataClient({
7
- projectId: process.env.REACT_APP_PROJECT_ID,
8
- apiKey: process.env.REACT_APP_API_KEY,
9
- baseUrl: process.env.REACT_APP_API_HOST,
10
- })
11
+ # or with yarn
12
+ yarn add venue-js
13
+ ```
11
14
 
12
- setTimeout(() => {
13
- const unit = client.findById('unit', 'unit-3155')
14
- console.log({ unit })
15
+ ## Setup
16
+ Import the client and configure it with your project credentials.
15
17
 
16
- const occupants = client.filterByType('occupant')
17
- console.log({ occupants })
18
- }, 8000)
19
18
  ```
19
+ import { getDataClient, type VenueClientOptions } from "venue-js"
20
+
21
+ const venueConfig: VenueClientOptions = {
22
+ projectId: import.meta.env.VITE_VENUE_PROJECT_ID,
23
+ apiKey: import.meta.env.VITE_VENUE_APIKEY,
24
+ baseUrl: import.meta.env.VITE_VENUE_BASEURL,
25
+ }
26
+
27
+ const venueDataClient = getDataClient(venueConfig)
28
+ ```
29
+
30
+ ## Usage
31
+ The data client exposes two main functions:
32
+
33
+ ### 1. filterByType(featureType, options?)
34
+
35
+ Retrieve all features of a given type.
36
+
37
+ ```
38
+ // Get all occupants
39
+ const occupants = await venueDataClient.filterByType("occupant")
40
+
41
+ // Get all occupants with related data populated
42
+ const populatedOccupants = await venueDataClient.filterByType("occupant", { populate: true })
43
+ ```
44
+
45
+ #### Parameters
46
+ | Name | Type | Description |
47
+ |------------------|:------------------:|---------------------------------------------------------:|
48
+ | featureType | string | feature type, e.g. "occupant", "amenity", "unit" |
49
+ | options.populate | boolean (optional) | Whether to return fully populated objects with relations |
50
+
51
+ #### Returns
52
+ An array of feature objects (e.g. occupants).
53
+
54
+
55
+ ### 2. filterById(featureType, id, options?)
56
+
57
+ Retrieve all features of a given type.
58
+
59
+ ```
60
+ const occupantId = "occupant-1234"
61
+
62
+ // Basic record
63
+ const occupant = await venueDataClient.findById("occupant", occupantId)
64
+
65
+ // With related data populated
66
+ const populatedOccupant = await venueDataClient.findById("occupant", occupantId, { populate: true })
67
+ ```
68
+
69
+ #### Parameters
70
+ | Name | Type | Description |
71
+ |------------------|:------------------:|---------------------------------------------------------:|
72
+ | featureType | string | feature type, e.g. "occupant", "amenity", "unit" |
73
+ | id | string | id of a feature |
74
+ | options.populate | boolean (optional) | Whether to return fully populated objects with relations |
75
+
76
+ #### Returns
77
+ A single feature object or null if not found.
78
+
79
+ ### Available Feature Types
80
+ - amenity
81
+ - anchor
82
+ - building
83
+ - fixture
84
+ - kiosk
85
+ - level
86
+ - occupant
87
+ - opening
88
+ - relationship
89
+ - section
90
+ - unit
91
+ - venue
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "venue-js",
3
- "version": "1.0.0-0",
3
+ "version": "1.0.0-1",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",