@acms-subir/client 0.1.21 → 0.1.22

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 CHANGED
@@ -43,7 +43,7 @@ language. Update the site before shipping an app build with a newer client.
43
43
  | `post(slug, opts)` | Scans post summaries, then loads detail by ID; pass `collection` for ambiguous slugs |
44
44
  | `pages(opts)` | Page **summaries**, with pagination; use `page()` for sections |
45
45
  | `search(text, opts)` | Top matches in `posts`, `pages` and `events`, plus `more` per group; `types`, `collection`, `limit` (1–20, default 5). Blank text resolves empty without a request |
46
- | `events(opts)` | Occurrences with `from`, `to`, `calendar`, `tag`, `excludeTag`, `q`, pagination |
46
+ | `events(opts)` | Occurrences with `from`, `to`, `calendar`, `tag`, `excludeTag`, `room`, `q`, pagination. The filters take one value or an array (any of them matches) |
47
47
  | `event(slug, opts)` | One event by slug, whatever its date (`GET /events/{slug}`; on sites older than core 0.3.40, the first match in the requested window) |
48
48
  | `eventDetail(slug, { on? })` | The event and its next occurrence, or the one on `on` (`YYYY-MM-DD`) |
49
49
  | `calendars()` | Public calendars |
package/dist/index.d.ts CHANGED
@@ -29,12 +29,15 @@ export type EventBound = `${number}-${number}-${number}` | `${number}-${number}-
29
29
  export interface EventOptions extends ListOptions {
30
30
  from?: EventBound | (string & {});
31
31
  to?: EventBound | (string & {});
32
- calendar?: string;
33
32
  q?: string;
34
- /** only events with this public tag (its name or slug, any case) */
35
- tag?: string;
36
- /** leave out events with this public tag (its name or slug, any case) */
37
- excludeTag?: string;
33
+ /** only events in these calendars (slugs) */
34
+ calendar?: string | string[];
35
+ /** only events with one of these public tags (a name in any case, or a slug) */
36
+ tag?: string | string[];
37
+ /** leave out events with any of these public tags (a name in any case, or a slug) */
38
+ excludeTag?: string | string[];
39
+ /** only events held in one of these rooms (slugs of rooms the site shows on public events) */
40
+ room?: string | string[];
38
41
  }
39
42
  export interface SearchOptions extends RequestOptions {
40
43
  /** Which groups to search; default all three. */
package/dist/index.js CHANGED
@@ -238,7 +238,9 @@ export function createClient(options) {
238
238
  return { ...result, items: result.items.filter(p => !o.tag || p.tags.includes(o.tag)) };
239
239
  };
240
240
  const pages = (o = {}) => content({ ...o, kind: 'page' });
241
- const events = (o = {}) => request('events', o, { ...paging(o), from: o.from, to: o.to, calendar: o.calendar, tag: o.tag, excludeTag: o.excludeTag, q: o.q });
241
+ // several values travel comma-separated: tag=Class,Youth
242
+ const list = (v) => (Array.isArray(v) ? (v.length ? v.join(',') : undefined) : v);
243
+ const events = (o = {}) => request('events', o, { ...paging(o), from: o.from, to: o.to, calendar: list(o.calendar), tag: list(o.tag), excludeTag: list(o.excludeTag), room: list(o.room), q: o.q });
242
244
  const resources = (o = {}) => request('resources', o, paging(o));
243
245
  const announcements = (o = {}) => request('announcements', o, { ...paging(o), kind: o.kind, pinned: o.pinned ? 'true' : undefined });
244
246
  const paginate = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acms-subir/client",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
4
4
  "description": "Typed, dependency-free client for the ACMS public mobile API.",
5
5
  "type": "module",
6
6
  "license": "MIT",