@rachelallyson/planning-center-check-ins-ts 1.0.0 → 3.0.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.
Files changed (43) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +4 -5
  3. package/dist/client.d.ts +0 -6
  4. package/dist/client.js +3 -12
  5. package/dist/index.d.ts +1 -1
  6. package/dist/modules/attendance-types.d.ts +11 -5
  7. package/dist/modules/attendance-types.js +20 -14
  8. package/dist/modules/check-in-groups.d.ts +13 -5
  9. package/dist/modules/check-in-groups.js +23 -15
  10. package/dist/modules/check-ins.d.ts +22 -6
  11. package/dist/modules/check-ins.js +39 -25
  12. package/dist/modules/event-times.d.ts +11 -5
  13. package/dist/modules/event-times.js +24 -18
  14. package/dist/modules/events.d.ts +57 -23
  15. package/dist/modules/events.js +85 -18
  16. package/dist/modules/headcounts.d.ts +11 -5
  17. package/dist/modules/headcounts.js +20 -14
  18. package/dist/modules/integration-links.d.ts +11 -5
  19. package/dist/modules/integration-links.js +20 -14
  20. package/dist/modules/labels.d.ts +12 -30
  21. package/dist/modules/labels.js +20 -71
  22. package/dist/modules/locations.d.ts +15 -6
  23. package/dist/modules/locations.js +27 -18
  24. package/dist/modules/options.d.ts +11 -5
  25. package/dist/modules/options.js +20 -14
  26. package/dist/modules/organization.js +2 -1
  27. package/dist/modules/passes.d.ts +11 -5
  28. package/dist/modules/passes.js +20 -14
  29. package/dist/modules/pre-checks.d.ts +11 -5
  30. package/dist/modules/pre-checks.js +20 -14
  31. package/dist/modules/roster-list-persons.d.ts +11 -5
  32. package/dist/modules/roster-list-persons.js +20 -14
  33. package/dist/modules/stations.d.ts +11 -5
  34. package/dist/modules/stations.js +20 -14
  35. package/dist/modules/themes.d.ts +11 -5
  36. package/dist/modules/themes.js +20 -14
  37. package/package.json +6 -6
  38. package/dist/modules/check-in-times.d.ts +0 -27
  39. package/dist/modules/check-in-times.js +0 -44
  40. package/dist/modules/event-periods.d.ts +0 -57
  41. package/dist/modules/event-periods.js +0 -75
  42. package/dist/modules/person-events.d.ts +0 -27
  43. package/dist/modules/person-events.js +0 -44
@@ -10,25 +10,31 @@ class StationsModule extends planning_center_base_ts_1.BaseModule {
10
10
  super(httpClient, paginationHelper, eventEmitter);
11
11
  }
12
12
  /**
13
- * Get all stations with optional filtering
13
+ * Get all stations across all pages with optional filtering.
14
+ * Use getPage() when you need a single page or custom perPage/page.
14
15
  */
15
16
  async getAll(options = {}) {
17
+ const params = this.buildParams(options);
18
+ return this.getAllPages('/stations', params);
19
+ }
20
+ /**
21
+ * Get a single page of stations with optional filtering and pagination.
22
+ */
23
+ async getPage(options = {}) {
24
+ const params = this.buildParams(options);
25
+ return this.getList('/stations', params);
26
+ }
27
+ buildParams(options) {
16
28
  const params = {};
17
- if (options.where) {
18
- Object.entries(options.where).forEach(([key, value]) => {
19
- params[`where[${key}]`] = value;
20
- });
21
- }
22
- if (options.include) {
29
+ if (options.where)
30
+ Object.entries(options.where).forEach(([k, v]) => { params[`where[${k}]`] = v; });
31
+ if (options.include)
23
32
  params.include = options.include.join(',');
24
- }
25
- if (options.perPage) {
33
+ if (options.perPage != null)
26
34
  params.per_page = options.perPage;
27
- }
28
- if (options.page) {
35
+ if (options.page != null)
29
36
  params.page = options.page;
30
- }
31
- return this.getList('/check-ins/v2/stations', params);
37
+ return params;
32
38
  }
33
39
  /**
34
40
  * Get a single station by ID
@@ -38,7 +44,7 @@ class StationsModule extends planning_center_base_ts_1.BaseModule {
38
44
  if (include) {
39
45
  params.include = include.join(',');
40
46
  }
41
- return this.getSingle(`/check-ins/v2/stations/${id}`, params);
47
+ return this.getSingle(`/stations/${id}`, params);
42
48
  }
43
49
  }
44
50
  exports.StationsModule = StationsModule;
@@ -2,7 +2,7 @@
2
2
  * Themes Module for Check-Ins API
3
3
  */
4
4
  import { BaseModule } from '@rachelallyson/planning-center-base-ts';
5
- import type { PcoHttpClient, PaginationHelper, PcoEventEmitter } from '@rachelallyson/planning-center-base-ts';
5
+ import type { PcoHttpClient, PaginationHelper, PcoEventEmitter, PaginationResult, Meta, TopLevelLinks } from '@rachelallyson/planning-center-base-ts';
6
6
  import type { ThemeResource } from '../types';
7
7
  export interface ThemesListOptions {
8
8
  where?: Record<string, any>;
@@ -13,13 +13,19 @@ export interface ThemesListOptions {
13
13
  export declare class ThemesModule extends BaseModule {
14
14
  constructor(httpClient: PcoHttpClient, paginationHelper: PaginationHelper, eventEmitter: PcoEventEmitter);
15
15
  /**
16
- * Get all themes with optional filtering
16
+ * Get all themes across all pages with optional filtering.
17
+ * Use getPage() when you need a single page or custom perPage/page.
17
18
  */
18
- getAll(options?: ThemesListOptions): Promise<{
19
+ getAll(options?: ThemesListOptions): Promise<PaginationResult<ThemeResource>>;
20
+ /**
21
+ * Get a single page of themes with optional filtering and pagination.
22
+ */
23
+ getPage(options?: ThemesListOptions): Promise<{
19
24
  data: ThemeResource[];
20
- meta?: any;
21
- links?: any;
25
+ meta?: Meta;
26
+ links?: TopLevelLinks;
22
27
  }>;
28
+ private buildParams;
23
29
  /**
24
30
  * Get a single theme by ID
25
31
  */
@@ -10,25 +10,31 @@ class ThemesModule extends planning_center_base_ts_1.BaseModule {
10
10
  super(httpClient, paginationHelper, eventEmitter);
11
11
  }
12
12
  /**
13
- * Get all themes with optional filtering
13
+ * Get all themes across all pages with optional filtering.
14
+ * Use getPage() when you need a single page or custom perPage/page.
14
15
  */
15
16
  async getAll(options = {}) {
17
+ const params = this.buildParams(options);
18
+ return this.getAllPages('/themes', params);
19
+ }
20
+ /**
21
+ * Get a single page of themes with optional filtering and pagination.
22
+ */
23
+ async getPage(options = {}) {
24
+ const params = this.buildParams(options);
25
+ return this.getList('/themes', params);
26
+ }
27
+ buildParams(options) {
16
28
  const params = {};
17
- if (options.where) {
18
- Object.entries(options.where).forEach(([key, value]) => {
19
- params[`where[${key}]`] = value;
20
- });
21
- }
22
- if (options.include) {
29
+ if (options.where)
30
+ Object.entries(options.where).forEach(([k, v]) => { params[`where[${k}]`] = v; });
31
+ if (options.include)
23
32
  params.include = options.include.join(',');
24
- }
25
- if (options.perPage) {
33
+ if (options.perPage != null)
26
34
  params.per_page = options.perPage;
27
- }
28
- if (options.page) {
35
+ if (options.page != null)
29
36
  params.page = options.page;
30
- }
31
- return this.getList('/check-ins/v2/themes', params);
37
+ return params;
32
38
  }
33
39
  /**
34
40
  * Get a single theme by ID
@@ -38,7 +44,7 @@ class ThemesModule extends planning_center_base_ts_1.BaseModule {
38
44
  if (include) {
39
45
  params.include = include.join(',');
40
46
  }
41
- return this.getSingle(`/check-ins/v2/themes/${id}`, params);
47
+ return this.getSingle(`/themes/${id}`, params);
42
48
  }
43
49
  }
44
50
  exports.ThemesModule = ThemesModule;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rachelallyson/planning-center-check-ins-ts",
3
- "version": "1.0.0",
3
+ "version": "3.0.0",
4
4
  "description": "A strictly typed TypeScript client for Planning Center Online Check-Ins API with batch operations and enhanced developer experience",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -9,10 +9,10 @@
9
9
  "dev": "tsc --watch",
10
10
  "clean": "rm -rf dist",
11
11
  "prebuild": "npm run clean",
12
- "test": "jest --testPathIgnorePatterns=integration.test.ts",
13
- "test:watch": "jest --watch --testPathIgnorePatterns=integration.test.ts",
14
- "test:coverage": "jest --coverage --testPathIgnorePatterns=integration.test.ts",
15
- "test:ci": "jest --ci --coverage --watchAll=false --testPathIgnorePatterns=integration.test.ts",
12
+ "test": "dotenv -e .env.test -- jest",
13
+ "test:watch": "jest --watch",
14
+ "test:coverage": "jest --coverage",
15
+ "test:ci": "jest --ci --coverage --watchAll=false",
16
16
  "test:integration": "dotenv -e .env.test -- jest --testPathPatterns=integration/.*.integration.test.ts --setupFilesAfterEnv='<rootDir>/tests/integration-setup.ts' --testTimeout=60000",
17
17
  "docs": "typedoc",
18
18
  "docs:watch": "typedoc --watch",
@@ -70,6 +70,6 @@
70
70
  "access": "public"
71
71
  },
72
72
  "dependencies": {
73
- "@rachelallyson/planning-center-base-ts": "^1.0.0"
73
+ "@rachelallyson/planning-center-base-ts": "^1.1.2"
74
74
  }
75
75
  }
@@ -1,27 +0,0 @@
1
- /**
2
- * CheckInTimes Module for Check-Ins API
3
- */
4
- import { BaseModule } from '@rachelallyson/planning-center-base-ts';
5
- import type { PcoHttpClient, PaginationHelper, PcoEventEmitter } from '@rachelallyson/planning-center-base-ts';
6
- import type { CheckInTimeResource } from '../types';
7
- export interface CheckInTimesListOptions {
8
- where?: Record<string, any>;
9
- include?: string[];
10
- perPage?: number;
11
- page?: number;
12
- }
13
- export declare class CheckInTimesModule extends BaseModule {
14
- constructor(httpClient: PcoHttpClient, paginationHelper: PaginationHelper, eventEmitter: PcoEventEmitter);
15
- /**
16
- * Get all check-in times with optional filtering
17
- */
18
- getAll(options?: CheckInTimesListOptions): Promise<{
19
- data: CheckInTimeResource[];
20
- meta?: any;
21
- links?: any;
22
- }>;
23
- /**
24
- * Get a single check-in time by ID
25
- */
26
- getById(id: string, include?: string[]): Promise<CheckInTimeResource>;
27
- }
@@ -1,44 +0,0 @@
1
- "use strict";
2
- /**
3
- * CheckInTimes Module for Check-Ins API
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.CheckInTimesModule = void 0;
7
- const planning_center_base_ts_1 = require("@rachelallyson/planning-center-base-ts");
8
- class CheckInTimesModule extends planning_center_base_ts_1.BaseModule {
9
- constructor(httpClient, paginationHelper, eventEmitter) {
10
- super(httpClient, paginationHelper, eventEmitter);
11
- }
12
- /**
13
- * Get all check-in times with optional filtering
14
- */
15
- async getAll(options = {}) {
16
- const params = {};
17
- if (options.where) {
18
- Object.entries(options.where).forEach(([key, value]) => {
19
- params[`where[${key}]`] = value;
20
- });
21
- }
22
- if (options.include) {
23
- params.include = options.include.join(',');
24
- }
25
- if (options.perPage) {
26
- params.per_page = options.perPage;
27
- }
28
- if (options.page) {
29
- params.page = options.page;
30
- }
31
- return this.getList('/check-ins/v2/check_in_times', params);
32
- }
33
- /**
34
- * Get a single check-in time by ID
35
- */
36
- async getById(id, include) {
37
- const params = {};
38
- if (include) {
39
- params.include = include.join(',');
40
- }
41
- return this.getSingle(`/check-ins/v2/check_in_times/${id}`, params);
42
- }
43
- }
44
- exports.CheckInTimesModule = CheckInTimesModule;
@@ -1,57 +0,0 @@
1
- /**
2
- * EventPeriods Module for Check-Ins API
3
- */
4
- import { BaseModule } from '@rachelallyson/planning-center-base-ts';
5
- import type { PcoHttpClient, PaginationHelper, PcoEventEmitter } from '@rachelallyson/planning-center-base-ts';
6
- import type { EventPeriodResource, EventResource, EventTimeResource, CheckInResource, LocationEventPeriodResource } from '../types';
7
- export interface EventPeriodsListOptions {
8
- where?: Record<string, any>;
9
- include?: string[];
10
- perPage?: number;
11
- page?: number;
12
- }
13
- export declare class EventPeriodsModule extends BaseModule {
14
- constructor(httpClient: PcoHttpClient, paginationHelper: PaginationHelper, eventEmitter: PcoEventEmitter);
15
- /**
16
- * Get all event periods with optional filtering
17
- */
18
- getAll(options?: EventPeriodsListOptions): Promise<{
19
- data: EventPeriodResource[];
20
- meta?: any;
21
- links?: any;
22
- }>;
23
- /**
24
- * Get a single event period by ID
25
- */
26
- getById(id: string, include?: string[]): Promise<EventPeriodResource>;
27
- /**
28
- * Get event for an event period
29
- */
30
- getEvent(eventPeriodId: string): Promise<EventResource>;
31
- /**
32
- * Get event times for an event period
33
- */
34
- getEventTimes(eventPeriodId: string): Promise<{
35
- data: EventTimeResource[];
36
- meta?: any;
37
- links?: any;
38
- }>;
39
- /**
40
- * Get check-ins for an event period
41
- */
42
- getCheckIns(eventPeriodId: string, options?: {
43
- filter?: string[];
44
- }): Promise<{
45
- data: CheckInResource[];
46
- meta?: any;
47
- links?: any;
48
- }>;
49
- /**
50
- * Get location event periods for an event period
51
- */
52
- getLocationEventPeriods(eventPeriodId: string): Promise<{
53
- data: LocationEventPeriodResource[];
54
- meta?: any;
55
- links?: any;
56
- }>;
57
- }
@@ -1,75 +0,0 @@
1
- "use strict";
2
- /**
3
- * EventPeriods Module for Check-Ins API
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.EventPeriodsModule = void 0;
7
- const planning_center_base_ts_1 = require("@rachelallyson/planning-center-base-ts");
8
- class EventPeriodsModule extends planning_center_base_ts_1.BaseModule {
9
- constructor(httpClient, paginationHelper, eventEmitter) {
10
- super(httpClient, paginationHelper, eventEmitter);
11
- }
12
- /**
13
- * Get all event periods with optional filtering
14
- */
15
- async getAll(options = {}) {
16
- const params = {};
17
- if (options.where) {
18
- Object.entries(options.where).forEach(([key, value]) => {
19
- params[`where[${key}]`] = value;
20
- });
21
- }
22
- if (options.include) {
23
- params.include = options.include.join(',');
24
- }
25
- if (options.perPage) {
26
- params.per_page = options.perPage;
27
- }
28
- if (options.page) {
29
- params.page = options.page;
30
- }
31
- return this.getList('/check-ins/v2/event_periods', params);
32
- }
33
- /**
34
- * Get a single event period by ID
35
- */
36
- async getById(id, include) {
37
- const params = {};
38
- if (include) {
39
- params.include = include.join(',');
40
- }
41
- return this.getSingle(`/check-ins/v2/event_periods/${id}`, params);
42
- }
43
- // ===== Associations =====
44
- /**
45
- * Get event for an event period
46
- */
47
- async getEvent(eventPeriodId) {
48
- return this.getSingle(`/check-ins/v2/event_periods/${eventPeriodId}/event`);
49
- }
50
- /**
51
- * Get event times for an event period
52
- */
53
- async getEventTimes(eventPeriodId) {
54
- return this.getList(`/check-ins/v2/event_periods/${eventPeriodId}/event_times`);
55
- }
56
- /**
57
- * Get check-ins for an event period
58
- */
59
- async getCheckIns(eventPeriodId, options = {}) {
60
- const params = {};
61
- if (options.filter && options.filter.length > 0) {
62
- options.filter.forEach(filter => {
63
- params[filter] = 'true';
64
- });
65
- }
66
- return this.getList(`/check-ins/v2/event_periods/${eventPeriodId}/check_ins`, params);
67
- }
68
- /**
69
- * Get location event periods for an event period
70
- */
71
- async getLocationEventPeriods(eventPeriodId) {
72
- return this.getList(`/check-ins/v2/event_periods/${eventPeriodId}/location_event_periods`);
73
- }
74
- }
75
- exports.EventPeriodsModule = EventPeriodsModule;
@@ -1,27 +0,0 @@
1
- /**
2
- * PersonEvents Module for Check-Ins API
3
- */
4
- import { BaseModule } from '@rachelallyson/planning-center-base-ts';
5
- import type { PcoHttpClient, PaginationHelper, PcoEventEmitter } from '@rachelallyson/planning-center-base-ts';
6
- import type { PersonEventResource } from '../types';
7
- export interface PersonEventsListOptions {
8
- where?: Record<string, any>;
9
- include?: string[];
10
- perPage?: number;
11
- page?: number;
12
- }
13
- export declare class PersonEventsModule extends BaseModule {
14
- constructor(httpClient: PcoHttpClient, paginationHelper: PaginationHelper, eventEmitter: PcoEventEmitter);
15
- /**
16
- * Get all person events with optional filtering
17
- */
18
- getAll(options?: PersonEventsListOptions): Promise<{
19
- data: PersonEventResource[];
20
- meta?: any;
21
- links?: any;
22
- }>;
23
- /**
24
- * Get a single person event by ID
25
- */
26
- getById(id: string, include?: string[]): Promise<PersonEventResource>;
27
- }
@@ -1,44 +0,0 @@
1
- "use strict";
2
- /**
3
- * PersonEvents Module for Check-Ins API
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.PersonEventsModule = void 0;
7
- const planning_center_base_ts_1 = require("@rachelallyson/planning-center-base-ts");
8
- class PersonEventsModule extends planning_center_base_ts_1.BaseModule {
9
- constructor(httpClient, paginationHelper, eventEmitter) {
10
- super(httpClient, paginationHelper, eventEmitter);
11
- }
12
- /**
13
- * Get all person events with optional filtering
14
- */
15
- async getAll(options = {}) {
16
- const params = {};
17
- if (options.where) {
18
- Object.entries(options.where).forEach(([key, value]) => {
19
- params[`where[${key}]`] = value;
20
- });
21
- }
22
- if (options.include) {
23
- params.include = options.include.join(',');
24
- }
25
- if (options.perPage) {
26
- params.per_page = options.perPage;
27
- }
28
- if (options.page) {
29
- params.page = options.page;
30
- }
31
- return this.getList('/check-ins/v2/person_events', params);
32
- }
33
- /**
34
- * Get a single person event by ID
35
- */
36
- async getById(id, include) {
37
- const params = {};
38
- if (include) {
39
- params.include = include.join(',');
40
- }
41
- return this.getSingle(`/check-ins/v2/person_events/${id}`, params);
42
- }
43
- }
44
- exports.PersonEventsModule = PersonEventsModule;