@mynameistito/hcc-bin-day 0.1.0 → 0.1.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.
- package/README.md +8 -9
- package/dist/index.mjs +15 -17
- package/package.json +14 -8
package/README.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
# hcc-bin-day
|
|
1
|
+
# @mynameistito/hcc-bin-day
|
|
2
2
|
|
|
3
|
-
[](./LICENSE)
|
|
3
|
+
[](https://github.com/mynameistito/hcc-bin-day/actions/workflows/ci.yml) [](./LICENSE)
|
|
5
4
|
|
|
6
5
|
TypeScript client for the Hamilton City Council Fight the Landfill bin-day lookup API.
|
|
7
6
|
|
|
@@ -27,11 +26,11 @@ https://api2.hcc.govt.nz
|
|
|
27
26
|
## Usage
|
|
28
27
|
|
|
29
28
|
```bash
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
npx @mynameistito/hcc-bin-day
|
|
30
|
+
npx @mynameistito/hcc-bin-day search "12 Grey Street"
|
|
31
|
+
npx @mynameistito/hcc-bin-day lookup "12 Grey Street"
|
|
32
|
+
npx @mynameistito/hcc-bin-day schedule "12 Grey Street"
|
|
33
|
+
npx @mynameistito/hcc-bin-day --json lookup "12 Grey Street"
|
|
35
34
|
```
|
|
36
35
|
|
|
37
36
|
## Output modes
|
|
@@ -73,4 +72,4 @@ It is provided independently as a convenience for accessing publicly available c
|
|
|
73
72
|
|
|
74
73
|
## License
|
|
75
74
|
|
|
76
|
-
MIT
|
|
75
|
+
[MIT](LICENSE)
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
1
2
|
//#region src/schedule.ts
|
|
2
3
|
const COLLECTION_DAY_NAMES = [
|
|
3
4
|
"Monday",
|
|
@@ -88,7 +89,6 @@ const toScheduleJson = (schedule) => {
|
|
|
88
89
|
yellowBin: schedule.yellowBin
|
|
89
90
|
};
|
|
90
91
|
};
|
|
91
|
-
|
|
92
92
|
//#endregion
|
|
93
93
|
//#region src/hamilton-api.ts
|
|
94
94
|
const API_BASE_URL = "https://api2.hcc.govt.nz";
|
|
@@ -112,7 +112,6 @@ const getCollectionSchedule = async (address) => {
|
|
|
112
112
|
if (!first) return null;
|
|
113
113
|
return buildSchedule(first);
|
|
114
114
|
};
|
|
115
|
-
|
|
116
115
|
//#endregion
|
|
117
116
|
//#region src/normalize-address.ts
|
|
118
117
|
const STREET_TYPE_ALIASES = {
|
|
@@ -156,10 +155,12 @@ const expandStreetTypes = (value) => {
|
|
|
156
155
|
return value.split(" ").map((token) => STREET_TYPE_ALIASES[token.toLowerCase()] ?? token).join(" ");
|
|
157
156
|
};
|
|
158
157
|
const normalizeAddress = (address) => {
|
|
159
|
-
|
|
158
|
+
const normalized = collapseWhitespace(address).toLowerCase();
|
|
159
|
+
return expandStreetTypes(normalizeUnitSuffix(normalized));
|
|
160
160
|
};
|
|
161
161
|
const expandAddressQuery = (query) => {
|
|
162
|
-
|
|
162
|
+
const normalized = collapseWhitespace(query);
|
|
163
|
+
return expandStreetTypes(normalizeUnitSuffix(normalized));
|
|
163
164
|
};
|
|
164
165
|
const pickMatchingAddress = (query, matches) => {
|
|
165
166
|
const normalizedQuery = normalizeAddress(query);
|
|
@@ -167,7 +168,6 @@ const pickMatchingAddress = (query, matches) => {
|
|
|
167
168
|
if (exactMatches.length === 1) return exactMatches[0] ?? null;
|
|
168
169
|
return null;
|
|
169
170
|
};
|
|
170
|
-
|
|
171
171
|
//#endregion
|
|
172
172
|
//#region src/address.ts
|
|
173
173
|
const NO_ADDRESS_FOUND = "No address found";
|
|
@@ -196,28 +196,27 @@ const resolveAddressQuery = async (query) => {
|
|
|
196
196
|
schedule
|
|
197
197
|
};
|
|
198
198
|
};
|
|
199
|
-
|
|
200
199
|
//#endregion
|
|
201
200
|
//#region src/index.ts
|
|
202
|
-
const TEXT_FLAGS = new Set([
|
|
201
|
+
const TEXT_FLAGS = /* @__PURE__ */ new Set([
|
|
203
202
|
"--text",
|
|
204
203
|
"--pretty",
|
|
205
204
|
"-p"
|
|
206
205
|
]);
|
|
207
|
-
const JSON_FLAGS = new Set(["--json", "-j"]);
|
|
206
|
+
const JSON_FLAGS = /* @__PURE__ */ new Set(["--json", "-j"]);
|
|
208
207
|
const printHelp = () => {
|
|
209
208
|
console.log(`Hamilton bin-day client
|
|
210
209
|
|
|
211
210
|
Usage:
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
211
|
+
npx @mynameistito/hcc-bin-day search <address>
|
|
212
|
+
npx @mynameistito/hcc-bin-day schedule <address>
|
|
213
|
+
npx @mynameistito/hcc-bin-day lookup <address>
|
|
214
|
+
npx @mynameistito/hcc-bin-day schedule <address> --text
|
|
216
215
|
|
|
217
216
|
Examples:
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
217
|
+
npx @mynameistito/hcc-bin-day schedule "14b mountbatten pl"
|
|
218
|
+
npx @mynameistito/hcc-bin-day schedule "14b mountbatten pl" --text
|
|
219
|
+
npx @mynameistito/hcc-bin-day lookup "12 grey st"
|
|
221
220
|
|
|
222
221
|
Output is JSON by default. Use --text (or --pretty) for human-readable output.
|
|
223
222
|
Address input is flexible: unit suffixes (14b -> 14B) and street types (pl, st, rd, etc.).
|
|
@@ -296,6 +295,5 @@ const main = async () => {
|
|
|
296
295
|
printHelp();
|
|
297
296
|
};
|
|
298
297
|
await main();
|
|
299
|
-
|
|
300
298
|
//#endregion
|
|
301
|
-
export {
|
|
299
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mynameistito/hcc-bin-day",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "TypeScript client for Hamilton City Council Fight the Landfill bin-day lookup API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"url": "git+https://github.com/mynameistito/hcc-bin-day.git"
|
|
22
22
|
},
|
|
23
23
|
"bin": {
|
|
24
|
-
"hcc-bin-day
|
|
24
|
+
"hcc-bin-day": "dist/index.mjs"
|
|
25
25
|
},
|
|
26
26
|
"files": [
|
|
27
27
|
"dist",
|
|
@@ -29,23 +29,29 @@
|
|
|
29
29
|
"LICENSE"
|
|
30
30
|
],
|
|
31
31
|
"type": "module",
|
|
32
|
-
"main": "./dist/
|
|
32
|
+
"main": "./dist/index.mjs",
|
|
33
33
|
"scripts": {
|
|
34
34
|
"build": "tsdown",
|
|
35
35
|
"dev": "bun run src/index.ts",
|
|
36
36
|
"check": "ultracite check",
|
|
37
|
+
"changeset": "changeset",
|
|
38
|
+
"changeset-add": "bun ./scripts/changeset-add.ts",
|
|
37
39
|
"fix": "ultracite fix",
|
|
38
40
|
"typecheck": "tsgo --noEmit",
|
|
39
41
|
"knip": "bunx knip@latest",
|
|
40
42
|
"ci": "bun run check && bun run typecheck && bun run build",
|
|
41
43
|
"prepare": "lefthook install"
|
|
42
44
|
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@changesets/cli": "^2.31.0",
|
|
47
|
+
"@types/node": "^26.1.0"
|
|
48
|
+
},
|
|
43
49
|
"devDependencies": {
|
|
44
|
-
"@typescript/native-preview": "^7.0.0-dev.
|
|
50
|
+
"@typescript/native-preview": "^7.0.0-dev.20260702.3",
|
|
45
51
|
"lefthook": "^2.1.9",
|
|
46
|
-
"oxfmt": "^0.
|
|
47
|
-
"oxlint": "^1.
|
|
48
|
-
"tsdown": "0.
|
|
49
|
-
"ultracite": "7.8.
|
|
52
|
+
"oxfmt": "^0.57.0",
|
|
53
|
+
"oxlint": "^1.72.0",
|
|
54
|
+
"tsdown": "0.22.3",
|
|
55
|
+
"ultracite": "7.8.4"
|
|
50
56
|
}
|
|
51
57
|
}
|