@whereq/cloud 0.6.0 → 0.7.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.
- package/README.md +71 -0
- package/dist/index.cjs +81 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +362 -2
- package/dist/index.d.ts +362 -2
- package/dist/index.js +81 -1
- package/dist/index.js.map +1 -1
- package/package.json +11 -10
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The SDK version, read straight from `package.json` so it can never drift
|
|
3
|
-
* from what is published.
|
|
3
|
+
* from what is published. The release tooling bumps `package.json`; this
|
|
4
|
+
* follows it.
|
|
4
5
|
*/
|
|
5
6
|
declare const VERSION: string;
|
|
6
7
|
/** The products a station can quote. Mexico's CRE feed carries the first,
|
|
@@ -297,6 +298,233 @@ declare class WhereqError extends Error {
|
|
|
297
298
|
readonly url: string;
|
|
298
299
|
constructor(status: number, message: string, url: string);
|
|
299
300
|
}
|
|
301
|
+
/** One item from a local feed — a story, an event, a notice. */
|
|
302
|
+
interface LocalContent {
|
|
303
|
+
id: number;
|
|
304
|
+
type: string;
|
|
305
|
+
category?: string | null;
|
|
306
|
+
title: string;
|
|
307
|
+
summary?: string | null;
|
|
308
|
+
description?: string | null;
|
|
309
|
+
source_name?: string | null;
|
|
310
|
+
source_url?: string | null;
|
|
311
|
+
url?: string | null;
|
|
312
|
+
publish_time?: string | null;
|
|
313
|
+
latitude?: number | null;
|
|
314
|
+
longitude?: number | null;
|
|
315
|
+
city?: string | null;
|
|
316
|
+
province?: string | null;
|
|
317
|
+
country?: string | null;
|
|
318
|
+
geocode_status?: string | null;
|
|
319
|
+
confidence_score?: number | null;
|
|
320
|
+
status: string;
|
|
321
|
+
expires_at?: string | null;
|
|
322
|
+
tags?: string[];
|
|
323
|
+
}
|
|
324
|
+
/** One point of interest. */
|
|
325
|
+
interface LocalPlace {
|
|
326
|
+
id: number;
|
|
327
|
+
source: string;
|
|
328
|
+
source_url?: string | null;
|
|
329
|
+
license?: string | null;
|
|
330
|
+
external_id: string;
|
|
331
|
+
name: string;
|
|
332
|
+
latitude?: number | null;
|
|
333
|
+
longitude?: number | null;
|
|
334
|
+
city?: string | null;
|
|
335
|
+
province?: string | null;
|
|
336
|
+
country?: string | null;
|
|
337
|
+
category?: string | null;
|
|
338
|
+
kind?: string | null;
|
|
339
|
+
metadata?: Record<string, unknown>;
|
|
340
|
+
}
|
|
341
|
+
/** One configured local feed. */
|
|
342
|
+
interface LocalSource {
|
|
343
|
+
slug: string;
|
|
344
|
+
name: string;
|
|
345
|
+
kind: string;
|
|
346
|
+
url?: string | null;
|
|
347
|
+
default_type?: string | null;
|
|
348
|
+
default_city?: string | null;
|
|
349
|
+
default_province?: string | null;
|
|
350
|
+
default_country?: string | null;
|
|
351
|
+
enabled: boolean;
|
|
352
|
+
crawl_interval_minutes: number;
|
|
353
|
+
}
|
|
354
|
+
/** The page envelope every list endpoint uses. */
|
|
355
|
+
interface Page<T> {
|
|
356
|
+
data: T[];
|
|
357
|
+
pagination: {
|
|
358
|
+
limit: number;
|
|
359
|
+
count: number;
|
|
360
|
+
next_cursor?: string | null;
|
|
361
|
+
offset?: number;
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
/** One school board. */
|
|
365
|
+
interface SchoolBoard {
|
|
366
|
+
slug: string;
|
|
367
|
+
name: string;
|
|
368
|
+
type?: string | null;
|
|
369
|
+
region?: string | null;
|
|
370
|
+
/** The province code, e.g. `ON`. */
|
|
371
|
+
province?: string | null;
|
|
372
|
+
school_count: number;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* One school.
|
|
376
|
+
*
|
|
377
|
+
* The `hs_*` fields are **present only when the API key holds the
|
|
378
|
+
* `school_licensed` scope**. Without it they are absent — not null — so a
|
|
379
|
+
* caller can tell "you are not entitled to this" from "there is no value
|
|
380
|
+
* here".
|
|
381
|
+
*/
|
|
382
|
+
interface SchoolSummary {
|
|
383
|
+
/**
|
|
384
|
+
* The platform's own row id.
|
|
385
|
+
*
|
|
386
|
+
* **Not an identifier** — the `uid` is — but the join key for the
|
|
387
|
+
* migration: whereq.com's school rows carry the same integers, because
|
|
388
|
+
* the import preserved them. It changes if the dataset is reloaded.
|
|
389
|
+
*/
|
|
390
|
+
id: number;
|
|
391
|
+
uid: string;
|
|
392
|
+
name: string;
|
|
393
|
+
type?: string | null;
|
|
394
|
+
status?: string | null;
|
|
395
|
+
province?: string | null;
|
|
396
|
+
/**
|
|
397
|
+
* The **board's** region — `York Region`, `Toronto`.
|
|
398
|
+
*
|
|
399
|
+
* This is what the `region` filter matches. The school row's own
|
|
400
|
+
* `region` column holds a denormalised province name and is not served.
|
|
401
|
+
*/
|
|
402
|
+
region?: string | null;
|
|
403
|
+
city?: string | null;
|
|
404
|
+
municipality?: string | null;
|
|
405
|
+
board?: SchoolBoard | null;
|
|
406
|
+
latitude?: number | null;
|
|
407
|
+
longitude?: number | null;
|
|
408
|
+
grade_range?: string | null;
|
|
409
|
+
/**
|
|
410
|
+
* The programme **codes** (`french_immersion`), not the labels.
|
|
411
|
+
*
|
|
412
|
+
* The code is what the `program` filter takes and what the taxonomy
|
|
413
|
+
* lists as its `id`; the labels are in the taxonomy.
|
|
414
|
+
*/
|
|
415
|
+
programs: string[];
|
|
416
|
+
has_boundary: boolean;
|
|
417
|
+
source?: string | null;
|
|
418
|
+
source_url?: string | null;
|
|
419
|
+
license?: string | null;
|
|
420
|
+
hs_score?: number | null;
|
|
421
|
+
hs_rank?: number | null;
|
|
422
|
+
hs_rank_total?: number | null;
|
|
423
|
+
hs_school_type?: string | null;
|
|
424
|
+
}
|
|
425
|
+
/** One school's yearly assessment snapshot. Licensed. */
|
|
426
|
+
interface SchoolScores {
|
|
427
|
+
uid: string;
|
|
428
|
+
year: number;
|
|
429
|
+
rank?: number | null;
|
|
430
|
+
rank_total?: number | null;
|
|
431
|
+
rank_score?: number | null;
|
|
432
|
+
avg_exam_mark?: number | null;
|
|
433
|
+
year_label?: string | null;
|
|
434
|
+
source?: string | null;
|
|
435
|
+
eqao: Array<{
|
|
436
|
+
grade: number;
|
|
437
|
+
year_mark?: string | null;
|
|
438
|
+
rank?: number | null;
|
|
439
|
+
total?: number | null;
|
|
440
|
+
last5_avg?: number | null;
|
|
441
|
+
}>;
|
|
442
|
+
}
|
|
443
|
+
/** One school, with its contact block. `scores` needs `school_licensed`. */
|
|
444
|
+
interface SchoolDetail extends SchoolSummary {
|
|
445
|
+
address?: string | null;
|
|
446
|
+
phone?: string | null;
|
|
447
|
+
phone2?: string | null;
|
|
448
|
+
fax?: string | null;
|
|
449
|
+
website_url?: string | null;
|
|
450
|
+
boundary_pdf_url?: string | null;
|
|
451
|
+
principal?: string | null;
|
|
452
|
+
feeder_schools?: Record<string, unknown> | null;
|
|
453
|
+
extra?: Record<string, unknown> | null;
|
|
454
|
+
scores?: SchoolScores[];
|
|
455
|
+
/** HouseSigma's own name for the school. */
|
|
456
|
+
hs_name?: string | null;
|
|
457
|
+
/** HouseSigma's own label for the kind of board — `Public` or `Catholic`. */
|
|
458
|
+
hs_board_type?: string | null;
|
|
459
|
+
hs_score_year?: number | null;
|
|
460
|
+
hs_score_average?: number | null;
|
|
461
|
+
hs_rank_year?: number | null;
|
|
462
|
+
}
|
|
463
|
+
/** A school's catchment outline. Licensed. */
|
|
464
|
+
interface SchoolBoundary {
|
|
465
|
+
uid: string;
|
|
466
|
+
name: string;
|
|
467
|
+
geometry?: {
|
|
468
|
+
type: string;
|
|
469
|
+
coordinates: unknown;
|
|
470
|
+
} | null;
|
|
471
|
+
polygon_count: number;
|
|
472
|
+
point_count: number;
|
|
473
|
+
source?: string | null;
|
|
474
|
+
source_url?: string | null;
|
|
475
|
+
license?: string | null;
|
|
476
|
+
}
|
|
477
|
+
/** One catchment covering a queried point. Licensed. */
|
|
478
|
+
interface CatchmentHit {
|
|
479
|
+
uid: string;
|
|
480
|
+
name: string;
|
|
481
|
+
type?: string | null;
|
|
482
|
+
/** The board the school belongs to. */
|
|
483
|
+
board?: string | null;
|
|
484
|
+
/** Which of the school's polygons this is — a catchment can be split. */
|
|
485
|
+
polygon_index: number;
|
|
486
|
+
distance_m?: number | null;
|
|
487
|
+
}
|
|
488
|
+
/** The school vocabulary and the headline counts.
|
|
489
|
+
*
|
|
490
|
+
* The whole vocabulary comes in one call.
|
|
491
|
+
*/
|
|
492
|
+
interface SchoolTaxonomy {
|
|
493
|
+
boards: SchoolBoard[];
|
|
494
|
+
types: Array<{
|
|
495
|
+
id: string;
|
|
496
|
+
name: string;
|
|
497
|
+
count: number;
|
|
498
|
+
}>;
|
|
499
|
+
/** The programmes, as `{ id: <code>, name: <label> }`. */
|
|
500
|
+
program_categories: Array<{
|
|
501
|
+
id: string;
|
|
502
|
+
name: string;
|
|
503
|
+
count: number;
|
|
504
|
+
}>;
|
|
505
|
+
/** The provinces, by code. The *names* come from the geography feed. */
|
|
506
|
+
provinces: Array<{
|
|
507
|
+
id: string;
|
|
508
|
+
name: string;
|
|
509
|
+
count: number;
|
|
510
|
+
}>;
|
|
511
|
+
/** The boards' own regions, each with its province. */
|
|
512
|
+
regions: Array<{
|
|
513
|
+
id: string;
|
|
514
|
+
name: string;
|
|
515
|
+
province: string | null;
|
|
516
|
+
count: number;
|
|
517
|
+
}>;
|
|
518
|
+
/** The boards' own types — public, catholic, private. */
|
|
519
|
+
board_types: Array<{
|
|
520
|
+
id: string;
|
|
521
|
+
name: string;
|
|
522
|
+
count: number;
|
|
523
|
+
}>;
|
|
524
|
+
/** The headline counts, with the breakdowns by province, board type and
|
|
525
|
+
* school type. */
|
|
526
|
+
stats: Record<string, unknown>;
|
|
527
|
+
}
|
|
300
528
|
interface ClientOptions {
|
|
301
529
|
/** `wq_live_…` key for metered endpoints (sent as `X-API-Key`). */
|
|
302
530
|
apiKey?: string;
|
|
@@ -445,6 +673,138 @@ declare class Whereq {
|
|
|
445
673
|
min_ratio?: number;
|
|
446
674
|
limit?: number;
|
|
447
675
|
} & Params): Promise<GeoOverlapList>;
|
|
676
|
+
/** The local feed — news, events, stories and notices. */
|
|
677
|
+
localContent(p?: {
|
|
678
|
+
type?: string;
|
|
679
|
+
category?: string;
|
|
680
|
+
source?: string;
|
|
681
|
+
city?: string;
|
|
682
|
+
province?: string;
|
|
683
|
+
bbox?: string;
|
|
684
|
+
q?: string;
|
|
685
|
+
since?: string;
|
|
686
|
+
until?: string;
|
|
687
|
+
has_location?: boolean;
|
|
688
|
+
include_expired?: boolean;
|
|
689
|
+
limit?: number;
|
|
690
|
+
cursor?: string;
|
|
691
|
+
} & Params): Promise<Page<LocalContent>>;
|
|
692
|
+
/** One item, with its tags. */
|
|
693
|
+
localContentItem(contentId: number): Promise<LocalContent>;
|
|
694
|
+
/** The points of interest — the OpenStreetMap sweep.
|
|
695
|
+
*
|
|
696
|
+
* `lat`, `lng` and `radius_km` go together: a proximity search needs
|
|
697
|
+
* all three.
|
|
698
|
+
*/
|
|
699
|
+
localPlaces(p?: {
|
|
700
|
+
category?: string;
|
|
701
|
+
kind?: string;
|
|
702
|
+
sub?: string;
|
|
703
|
+
bbox?: string;
|
|
704
|
+
lat?: number;
|
|
705
|
+
lng?: number;
|
|
706
|
+
radius_km?: number;
|
|
707
|
+
q?: string;
|
|
708
|
+
limit?: number;
|
|
709
|
+
offset?: number;
|
|
710
|
+
} & Params): Promise<Page<LocalPlace>>;
|
|
711
|
+
/** One place. */
|
|
712
|
+
localPlace(placeId: number): Promise<LocalPlace>;
|
|
713
|
+
/** The configured local feeds. */
|
|
714
|
+
localSources(p?: {
|
|
715
|
+
enabled?: boolean;
|
|
716
|
+
kind?: string;
|
|
717
|
+
limit?: number;
|
|
718
|
+
} & Params): Promise<Page<LocalSource>>;
|
|
719
|
+
/** The local vocabulary — types, categories, place categories, sources. */
|
|
720
|
+
localTaxonomy(): Promise<{
|
|
721
|
+
types: Array<{
|
|
722
|
+
id: string;
|
|
723
|
+
name: string;
|
|
724
|
+
count: number;
|
|
725
|
+
}>;
|
|
726
|
+
categories: Array<{
|
|
727
|
+
id: string;
|
|
728
|
+
name: string;
|
|
729
|
+
count: number;
|
|
730
|
+
}>;
|
|
731
|
+
place_categories: Array<{
|
|
732
|
+
id: string;
|
|
733
|
+
name: string;
|
|
734
|
+
count: number;
|
|
735
|
+
}>;
|
|
736
|
+
sources: Array<{
|
|
737
|
+
slug: string;
|
|
738
|
+
name: string;
|
|
739
|
+
count: number;
|
|
740
|
+
}>;
|
|
741
|
+
}>;
|
|
742
|
+
/** The school directory.
|
|
743
|
+
*
|
|
744
|
+
* `sort` is a whitelist — `name`, `hs_score`, `hs_rank`, `grade_range`,
|
|
745
|
+
* `type`, `city` — and anything else is a 422. `rank` orders name
|
|
746
|
+
* matches by relevance: exact, then prefix, then a word that starts
|
|
747
|
+
* with the query, then any substring.
|
|
748
|
+
*
|
|
749
|
+
* The limit goes to **5 000**: the map needs a whole viewport in one
|
|
750
|
+
* call, and the whole directory is 2 528 schools.
|
|
751
|
+
*/
|
|
752
|
+
schools(p?: {
|
|
753
|
+
q?: string;
|
|
754
|
+
board?: string;
|
|
755
|
+
/** The board's own type — public, catholic or private. */
|
|
756
|
+
board_type?: string;
|
|
757
|
+
/** The board's region, matched loosely. */
|
|
758
|
+
region?: string;
|
|
759
|
+
city?: string;
|
|
760
|
+
province?: string;
|
|
761
|
+
type?: string;
|
|
762
|
+
/** A programme code, e.g. `french_immersion`. */
|
|
763
|
+
program?: string;
|
|
764
|
+
bbox?: string;
|
|
765
|
+
lat?: number;
|
|
766
|
+
lng?: number;
|
|
767
|
+
radius_km?: number;
|
|
768
|
+
has_boundary?: boolean;
|
|
769
|
+
sort?: string;
|
|
770
|
+
order?: "asc" | "desc";
|
|
771
|
+
rank?: boolean;
|
|
772
|
+
limit?: number;
|
|
773
|
+
offset?: number;
|
|
774
|
+
} & Params): Promise<Page<SchoolSummary>>;
|
|
775
|
+
/** The board registry — the vocabulary the `board` filter uses. */
|
|
776
|
+
schoolBoards(): Promise<Page<SchoolBoard>>;
|
|
777
|
+
/** The school vocabulary and the headline counts. */
|
|
778
|
+
schoolTaxonomy(): Promise<SchoolTaxonomy>;
|
|
779
|
+
/** The catchments that cover a point.
|
|
780
|
+
*
|
|
781
|
+
* **Licensed.** This reads the catchment polygons, so it needs the
|
|
782
|
+
* `school_licensed` scope — a key without it gets a 403.
|
|
783
|
+
*/
|
|
784
|
+
schoolsAt(p: {
|
|
785
|
+
lat: number;
|
|
786
|
+
lng: number;
|
|
787
|
+
limit?: number;
|
|
788
|
+
} & Params): Promise<Page<CatchmentHit>>;
|
|
789
|
+
/** One school.
|
|
790
|
+
*
|
|
791
|
+
* The uid is board-qualified — `ycdsb/0158`, or
|
|
792
|
+
* `ycdsb/st-theresa-of-lisieux-chs` when the board publishes no code.
|
|
793
|
+
* It carries a slash, and the API's route is built for that.
|
|
794
|
+
*
|
|
795
|
+
* The scores come back only with the `school_licensed` scope.
|
|
796
|
+
*/
|
|
797
|
+
school(uid: string): Promise<SchoolDetail>;
|
|
798
|
+
/** A school's catchment outline, as GeoJSON. **Licensed.**
|
|
799
|
+
* `simplify` is in METRES. */
|
|
800
|
+
schoolBoundary(uid: string, p?: {
|
|
801
|
+
simplify?: number;
|
|
802
|
+
} & Params): Promise<SchoolBoundary>;
|
|
803
|
+
/** One year's assessment snapshot, with the EQAO marks. **Licensed.**
|
|
804
|
+
* `year` picks a year; the latest is the default. */
|
|
805
|
+
schoolScores(uid: string, p?: {
|
|
806
|
+
year?: number;
|
|
807
|
+
} & Params): Promise<SchoolScores>;
|
|
448
808
|
}
|
|
449
809
|
|
|
450
|
-
export { type ClientOptions, FUEL_COUNTRIES, FUEL_CURRENCIES, FUEL_PRODUCTS, type FuelCountry, type FuelPricesParams, type FuelProduct, type FuelStation, type FuelStationDetail, type FuelStationParams, type FuelStationPrice, type FuelStationPricePoint, type FuelStationsParams, type FuelStationsResponse, type GeoAtPlace, type GeoAtResponse, type GeoBoundary, type GeoConcept, type GeoConceptList, type GeoOverlap, type GeoOverlapList, type GeoParent, type GeoPlace, type GeoPlaceDetail, type GeoPlaceList, type GeoPlacesParams, type PriceSeries, type PriceSeriesResponse, VERSION, Whereq, WhereqError, Whereq as default };
|
|
810
|
+
export { type CatchmentHit, type ClientOptions, FUEL_COUNTRIES, FUEL_CURRENCIES, FUEL_PRODUCTS, type FuelCountry, type FuelPricesParams, type FuelProduct, type FuelStation, type FuelStationDetail, type FuelStationParams, type FuelStationPrice, type FuelStationPricePoint, type FuelStationsParams, type FuelStationsResponse, type GeoAtPlace, type GeoAtResponse, type GeoBoundary, type GeoConcept, type GeoConceptList, type GeoOverlap, type GeoOverlapList, type GeoParent, type GeoPlace, type GeoPlaceDetail, type GeoPlaceList, type GeoPlacesParams, type LocalContent, type LocalPlace, type LocalSource, type Page, type PriceSeries, type PriceSeriesResponse, type SchoolBoard, type SchoolBoundary, type SchoolDetail, type SchoolScores, type SchoolSummary, type SchoolTaxonomy, VERSION, Whereq, WhereqError, Whereq as default };
|