@rachelallyson/planning-center-check-ins-ts 1.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.
- package/CHANGELOG.md +19 -0
- package/LICENSE +22 -0
- package/README.md +102 -0
- package/dist/client.d.ts +95 -0
- package/dist/client.js +167 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +38 -0
- package/dist/modules/attendance-types.d.ts +27 -0
- package/dist/modules/attendance-types.js +44 -0
- package/dist/modules/check-in-groups.d.ts +27 -0
- package/dist/modules/check-in-groups.js +44 -0
- package/dist/modules/check-in-times.d.ts +27 -0
- package/dist/modules/check-in-times.js +44 -0
- package/dist/modules/check-ins.d.ts +88 -0
- package/dist/modules/check-ins.js +157 -0
- package/dist/modules/event-periods.d.ts +57 -0
- package/dist/modules/event-periods.js +75 -0
- package/dist/modules/event-times.d.ts +51 -0
- package/dist/modules/event-times.js +69 -0
- package/dist/modules/events.d.ts +93 -0
- package/dist/modules/events.js +101 -0
- package/dist/modules/headcounts.d.ts +27 -0
- package/dist/modules/headcounts.js +44 -0
- package/dist/modules/integration-links.d.ts +27 -0
- package/dist/modules/integration-links.js +44 -0
- package/dist/modules/labels.d.ts +51 -0
- package/dist/modules/labels.js +108 -0
- package/dist/modules/locations.d.ts +51 -0
- package/dist/modules/locations.js +63 -0
- package/dist/modules/options.d.ts +27 -0
- package/dist/modules/options.js +44 -0
- package/dist/modules/organization.d.ts +13 -0
- package/dist/modules/organization.js +19 -0
- package/dist/modules/passes.d.ts +27 -0
- package/dist/modules/passes.js +44 -0
- package/dist/modules/person-events.d.ts +27 -0
- package/dist/modules/person-events.js +44 -0
- package/dist/modules/pre-checks.d.ts +27 -0
- package/dist/modules/pre-checks.js +44 -0
- package/dist/modules/roster-list-persons.d.ts +27 -0
- package/dist/modules/roster-list-persons.js +44 -0
- package/dist/modules/stations.d.ts +27 -0
- package/dist/modules/stations.js +44 -0
- package/dist/modules/themes.d.ts +27 -0
- package/dist/modules/themes.js +44 -0
- package/dist/types/check-ins.d.ts +325 -0
- package/dist/types/check-ins.js +6 -0
- package/dist/types/client.d.ts +12 -0
- package/dist/types/client.js +5 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +18 -0
- package/package.json +75 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this package will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [1.0.0] - 2024-XX-XX
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Initial release of Check-Ins API client
|
|
13
|
+
- Full TypeScript type definitions for all 24 Check-Ins API resource types
|
|
14
|
+
- Module-based architecture with specialized modules for each resource domain
|
|
15
|
+
- Support for all Check-Ins API endpoints
|
|
16
|
+
- Batch operations support
|
|
17
|
+
- Event system for monitoring requests, errors, and rate limits
|
|
18
|
+
- Comprehensive error handling
|
|
19
|
+
- Rate limiting and retry logic
|
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Rachel Allyson
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# @rachelallyson/planning-center-check-ins-ts
|
|
2
|
+
|
|
3
|
+
A strictly typed TypeScript client for Planning Center Online Check-Ins API with batch operations and enhanced developer experience.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @rachelallyson/planning-center-check-ins-ts
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { PcoCheckInsClient } from '@rachelallyson/planning-center-check-ins-ts';
|
|
15
|
+
|
|
16
|
+
const client = new PcoCheckInsClient({
|
|
17
|
+
auth: {
|
|
18
|
+
type: 'personal_access_token',
|
|
19
|
+
personalAccessToken: 'your-token-here'
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// Get all events
|
|
24
|
+
const events = await client.events.getAll();
|
|
25
|
+
|
|
26
|
+
// Get check-ins for an event
|
|
27
|
+
const checkIns = await client.checkIns.getAll({
|
|
28
|
+
filter: ['attendee', 'not_checked_out']
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Get a specific check-in
|
|
32
|
+
const checkIn = await client.checkIns.getById('123', ['person', 'event']);
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Features
|
|
36
|
+
|
|
37
|
+
- **Type-safe**: Full TypeScript support with complete type definitions for all 24 Check-Ins API resource types
|
|
38
|
+
- **Modular architecture**: 19 specialized modules organized by resource domain
|
|
39
|
+
- **Batch operations**: Execute multiple operations with dependency resolution
|
|
40
|
+
- **Event system**: Monitor requests, errors, and rate limits
|
|
41
|
+
- **Rate limiting**: Automatic rate limit handling (100 requests per 20 seconds)
|
|
42
|
+
- **Error handling**: Comprehensive error handling with typed errors
|
|
43
|
+
- **Pagination**: Built-in pagination helpers
|
|
44
|
+
- **JSON:API compliant**: Full support for JSON:API 1.0 specification
|
|
45
|
+
|
|
46
|
+
## Modules
|
|
47
|
+
|
|
48
|
+
The client exposes 19 specialized modules:
|
|
49
|
+
|
|
50
|
+
- **events** - Event management (recurring events)
|
|
51
|
+
- **checkIns** - Check-in records (attendance)
|
|
52
|
+
- **locations** - Location management
|
|
53
|
+
- **eventPeriods** - Event period management
|
|
54
|
+
- **eventTimes** - Specific check-in times
|
|
55
|
+
- **stations** - Check-in stations
|
|
56
|
+
- **labels** - Labels for check-ins, events, and locations
|
|
57
|
+
- **options** - Check-in options
|
|
58
|
+
- **checkInGroups** - Group check-ins
|
|
59
|
+
- **checkInTimes** - When check-ins occurred
|
|
60
|
+
- **personEvents** - Person-event relationships
|
|
61
|
+
- **preChecks** - Pre-check records
|
|
62
|
+
- **passes** - Pass management
|
|
63
|
+
- **headcounts** - Headcount tracking
|
|
64
|
+
- **attendanceTypes** - Attendance type definitions
|
|
65
|
+
- **rosterListPersons** - Roster list persons
|
|
66
|
+
- **organization** - Organization info
|
|
67
|
+
- **integrationLinks** - Integration links
|
|
68
|
+
- **themes** - Themes for check-ins
|
|
69
|
+
|
|
70
|
+
## Documentation
|
|
71
|
+
|
|
72
|
+
For complete documentation, see the [monorepo documentation site](../../docs/content/index.mdx).
|
|
73
|
+
|
|
74
|
+
## Testing
|
|
75
|
+
|
|
76
|
+
### Unit Tests (Mocked Data)
|
|
77
|
+
|
|
78
|
+
Run unit tests with mocked HTTP responses:
|
|
79
|
+
```bash
|
|
80
|
+
npm test
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Integration Tests (Real API Data)
|
|
84
|
+
|
|
85
|
+
Integration tests make real HTTP requests to Planning Center servers:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# First, create .env.test with your credentials
|
|
89
|
+
# See tests/integration/README.md for setup instructions
|
|
90
|
+
|
|
91
|
+
npm run test:integration
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Integration tests verify:
|
|
95
|
+
- Real API responses and data structures
|
|
96
|
+
- End-to-end functionality with actual Planning Center data
|
|
97
|
+
- Error handling with real API errors
|
|
98
|
+
- JSON:API compliance with real responses
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
MIT
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v1.0.0 Main PcoCheckInsClient Class
|
|
3
|
+
*/
|
|
4
|
+
import type { PcoCheckInsClientConfig } from './types/client';
|
|
5
|
+
import type { EventEmitter, PcoEvent, EventHandler, EventType } from '@rachelallyson/planning-center-base-ts';
|
|
6
|
+
import { BatchExecutor } from '@rachelallyson/planning-center-base-ts';
|
|
7
|
+
import { EventsModule } from './modules/events';
|
|
8
|
+
import { CheckInsModule } from './modules/check-ins';
|
|
9
|
+
import { LocationsModule } from './modules/locations';
|
|
10
|
+
import { EventPeriodsModule } from './modules/event-periods';
|
|
11
|
+
import { EventTimesModule } from './modules/event-times';
|
|
12
|
+
import { StationsModule } from './modules/stations';
|
|
13
|
+
import { LabelsModule } from './modules/labels';
|
|
14
|
+
import { OptionsModule } from './modules/options';
|
|
15
|
+
import { CheckInGroupsModule } from './modules/check-in-groups';
|
|
16
|
+
import { CheckInTimesModule } from './modules/check-in-times';
|
|
17
|
+
import { PersonEventsModule } from './modules/person-events';
|
|
18
|
+
import { PreChecksModule } from './modules/pre-checks';
|
|
19
|
+
import { PassesModule } from './modules/passes';
|
|
20
|
+
import { HeadcountsModule } from './modules/headcounts';
|
|
21
|
+
import { AttendanceTypesModule } from './modules/attendance-types';
|
|
22
|
+
import { RosterListPersonsModule } from './modules/roster-list-persons';
|
|
23
|
+
import { OrganizationModule } from './modules/organization';
|
|
24
|
+
import { IntegrationLinksModule } from './modules/integration-links';
|
|
25
|
+
import { ThemesModule } from './modules/themes';
|
|
26
|
+
export declare class PcoCheckInsClient implements EventEmitter {
|
|
27
|
+
events: EventsModule;
|
|
28
|
+
checkIns: CheckInsModule;
|
|
29
|
+
locations: LocationsModule;
|
|
30
|
+
eventPeriods: EventPeriodsModule;
|
|
31
|
+
eventTimes: EventTimesModule;
|
|
32
|
+
stations: StationsModule;
|
|
33
|
+
labels: LabelsModule;
|
|
34
|
+
options: OptionsModule;
|
|
35
|
+
checkInGroups: CheckInGroupsModule;
|
|
36
|
+
checkInTimes: CheckInTimesModule;
|
|
37
|
+
personEvents: PersonEventsModule;
|
|
38
|
+
preChecks: PreChecksModule;
|
|
39
|
+
passes: PassesModule;
|
|
40
|
+
headcounts: HeadcountsModule;
|
|
41
|
+
attendanceTypes: AttendanceTypesModule;
|
|
42
|
+
rosterListPersons: RosterListPersonsModule;
|
|
43
|
+
organization: OrganizationModule;
|
|
44
|
+
integrationLinks: IntegrationLinksModule;
|
|
45
|
+
themes: ThemesModule;
|
|
46
|
+
batch: BatchExecutor;
|
|
47
|
+
private httpClient;
|
|
48
|
+
private paginationHelper;
|
|
49
|
+
private eventEmitter;
|
|
50
|
+
private config;
|
|
51
|
+
constructor(config: PcoCheckInsClientConfig);
|
|
52
|
+
on<T extends PcoEvent>(eventType: T['type'], handler: EventHandler<T>): void;
|
|
53
|
+
off<T extends PcoEvent>(eventType: T['type'], handler: EventHandler<T>): void;
|
|
54
|
+
emit<T extends PcoEvent>(event: T): void;
|
|
55
|
+
/**
|
|
56
|
+
* Get the current configuration
|
|
57
|
+
*/
|
|
58
|
+
getConfig(): PcoCheckInsClientConfig;
|
|
59
|
+
/**
|
|
60
|
+
* Update the configuration
|
|
61
|
+
*/
|
|
62
|
+
updateConfig(updates: Partial<PcoCheckInsClientConfig>): void;
|
|
63
|
+
/**
|
|
64
|
+
* Get performance metrics
|
|
65
|
+
*/
|
|
66
|
+
getPerformanceMetrics(): Record<string, {
|
|
67
|
+
count: number;
|
|
68
|
+
averageTime: number;
|
|
69
|
+
minTime: number;
|
|
70
|
+
maxTime: number;
|
|
71
|
+
errorRate: number;
|
|
72
|
+
}>;
|
|
73
|
+
/**
|
|
74
|
+
* Get rate limit information
|
|
75
|
+
*/
|
|
76
|
+
getRateLimitInfo(): Record<string, {
|
|
77
|
+
limit: number;
|
|
78
|
+
remaining: number;
|
|
79
|
+
resetTime: number;
|
|
80
|
+
}>;
|
|
81
|
+
/**
|
|
82
|
+
* Clear all event listeners
|
|
83
|
+
*/
|
|
84
|
+
removeAllListeners(eventType?: EventType): void;
|
|
85
|
+
/**
|
|
86
|
+
* Get the number of listeners for an event type
|
|
87
|
+
*/
|
|
88
|
+
listenerCount(eventType: EventType): number;
|
|
89
|
+
/**
|
|
90
|
+
* Get all registered event types
|
|
91
|
+
*/
|
|
92
|
+
eventTypes(): EventType[];
|
|
93
|
+
private setupEventHandlers;
|
|
94
|
+
private updateModules;
|
|
95
|
+
}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* v1.0.0 Main PcoCheckInsClient Class
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PcoCheckInsClient = void 0;
|
|
7
|
+
const planning_center_base_ts_1 = require("@rachelallyson/planning-center-base-ts");
|
|
8
|
+
const events_1 = require("./modules/events");
|
|
9
|
+
const check_ins_1 = require("./modules/check-ins");
|
|
10
|
+
const locations_1 = require("./modules/locations");
|
|
11
|
+
const event_periods_1 = require("./modules/event-periods");
|
|
12
|
+
const event_times_1 = require("./modules/event-times");
|
|
13
|
+
const stations_1 = require("./modules/stations");
|
|
14
|
+
const labels_1 = require("./modules/labels");
|
|
15
|
+
const options_1 = require("./modules/options");
|
|
16
|
+
const check_in_groups_1 = require("./modules/check-in-groups");
|
|
17
|
+
const check_in_times_1 = require("./modules/check-in-times");
|
|
18
|
+
const person_events_1 = require("./modules/person-events");
|
|
19
|
+
const pre_checks_1 = require("./modules/pre-checks");
|
|
20
|
+
const passes_1 = require("./modules/passes");
|
|
21
|
+
const headcounts_1 = require("./modules/headcounts");
|
|
22
|
+
const attendance_types_1 = require("./modules/attendance-types");
|
|
23
|
+
const roster_list_persons_1 = require("./modules/roster-list-persons");
|
|
24
|
+
const organization_1 = require("./modules/organization");
|
|
25
|
+
const integration_links_1 = require("./modules/integration-links");
|
|
26
|
+
const themes_1 = require("./modules/themes");
|
|
27
|
+
class PcoCheckInsClient {
|
|
28
|
+
constructor(config) {
|
|
29
|
+
// Set default base URL for check-ins API
|
|
30
|
+
const { baseUrl, ...restConfig } = config;
|
|
31
|
+
const fullConfig = {
|
|
32
|
+
...restConfig,
|
|
33
|
+
baseURL: baseUrl || 'https://api.planningcenteronline.com',
|
|
34
|
+
};
|
|
35
|
+
this.config = config;
|
|
36
|
+
this.eventEmitter = new planning_center_base_ts_1.PcoEventEmitter();
|
|
37
|
+
this.httpClient = new planning_center_base_ts_1.PcoHttpClient(fullConfig, this.eventEmitter);
|
|
38
|
+
this.paginationHelper = new planning_center_base_ts_1.PaginationHelper(this.httpClient);
|
|
39
|
+
// Initialize modules
|
|
40
|
+
this.events = new events_1.EventsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
41
|
+
this.checkIns = new check_ins_1.CheckInsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
42
|
+
this.locations = new locations_1.LocationsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
43
|
+
this.eventPeriods = new event_periods_1.EventPeriodsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
44
|
+
this.eventTimes = new event_times_1.EventTimesModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
45
|
+
this.stations = new stations_1.StationsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
46
|
+
this.labels = new labels_1.LabelsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
47
|
+
this.options = new options_1.OptionsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
48
|
+
this.checkInGroups = new check_in_groups_1.CheckInGroupsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
49
|
+
this.checkInTimes = new check_in_times_1.CheckInTimesModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
50
|
+
this.personEvents = new person_events_1.PersonEventsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
51
|
+
this.preChecks = new pre_checks_1.PreChecksModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
52
|
+
this.passes = new passes_1.PassesModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
53
|
+
this.headcounts = new headcounts_1.HeadcountsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
54
|
+
this.attendanceTypes = new attendance_types_1.AttendanceTypesModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
55
|
+
this.rosterListPersons = new roster_list_persons_1.RosterListPersonsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
56
|
+
this.organization = new organization_1.OrganizationModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
57
|
+
this.integrationLinks = new integration_links_1.IntegrationLinksModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
58
|
+
this.themes = new themes_1.ThemesModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
59
|
+
this.batch = new planning_center_base_ts_1.BatchExecutor(this, this.eventEmitter);
|
|
60
|
+
// Set up event handlers from config
|
|
61
|
+
this.setupEventHandlers();
|
|
62
|
+
}
|
|
63
|
+
// EventEmitter implementation
|
|
64
|
+
on(eventType, handler) {
|
|
65
|
+
this.eventEmitter.on(eventType, handler);
|
|
66
|
+
}
|
|
67
|
+
off(eventType, handler) {
|
|
68
|
+
this.eventEmitter.off(eventType, handler);
|
|
69
|
+
}
|
|
70
|
+
emit(event) {
|
|
71
|
+
this.eventEmitter.emit(event);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Get the current configuration
|
|
75
|
+
*/
|
|
76
|
+
getConfig() {
|
|
77
|
+
return { ...this.config };
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Update the configuration
|
|
81
|
+
*/
|
|
82
|
+
updateConfig(updates) {
|
|
83
|
+
this.config = { ...this.config, ...updates };
|
|
84
|
+
const { baseUrl, ...restConfig } = this.config;
|
|
85
|
+
const fullConfig = {
|
|
86
|
+
...restConfig,
|
|
87
|
+
baseURL: baseUrl || 'https://api.planningcenteronline.com',
|
|
88
|
+
};
|
|
89
|
+
// Recreate HTTP client with new config
|
|
90
|
+
this.httpClient = new planning_center_base_ts_1.PcoHttpClient(fullConfig, this.eventEmitter);
|
|
91
|
+
this.paginationHelper = new planning_center_base_ts_1.PaginationHelper(this.httpClient);
|
|
92
|
+
// Update modules with new HTTP client
|
|
93
|
+
this.updateModules();
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Get performance metrics
|
|
97
|
+
*/
|
|
98
|
+
getPerformanceMetrics() {
|
|
99
|
+
return this.httpClient.getPerformanceMetrics();
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Get rate limit information
|
|
103
|
+
*/
|
|
104
|
+
getRateLimitInfo() {
|
|
105
|
+
return this.httpClient.getRateLimitInfo();
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Clear all event listeners
|
|
109
|
+
*/
|
|
110
|
+
removeAllListeners(eventType) {
|
|
111
|
+
this.eventEmitter.removeAllListeners(eventType);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Get the number of listeners for an event type
|
|
115
|
+
*/
|
|
116
|
+
listenerCount(eventType) {
|
|
117
|
+
return this.eventEmitter.listenerCount(eventType);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Get all registered event types
|
|
121
|
+
*/
|
|
122
|
+
eventTypes() {
|
|
123
|
+
return this.eventEmitter.eventTypes();
|
|
124
|
+
}
|
|
125
|
+
setupEventHandlers() {
|
|
126
|
+
// Set up config event handlers from events config
|
|
127
|
+
if (this.config.events?.onError) {
|
|
128
|
+
this.on('error', this.config.events.onError);
|
|
129
|
+
}
|
|
130
|
+
if (this.config.events?.onAuthFailure) {
|
|
131
|
+
this.on('auth:failure', this.config.events.onAuthFailure);
|
|
132
|
+
}
|
|
133
|
+
if (this.config.events?.onRequestStart) {
|
|
134
|
+
this.on('request:start', this.config.events.onRequestStart);
|
|
135
|
+
}
|
|
136
|
+
if (this.config.events?.onRequestComplete) {
|
|
137
|
+
this.on('request:complete', this.config.events.onRequestComplete);
|
|
138
|
+
}
|
|
139
|
+
if (this.config.events?.onRateLimit) {
|
|
140
|
+
this.on('rate:limit', this.config.events.onRateLimit);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
updateModules() {
|
|
144
|
+
// Recreate modules with new HTTP client
|
|
145
|
+
this.events = new events_1.EventsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
146
|
+
this.checkIns = new check_ins_1.CheckInsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
147
|
+
this.locations = new locations_1.LocationsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
148
|
+
this.eventPeriods = new event_periods_1.EventPeriodsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
149
|
+
this.eventTimes = new event_times_1.EventTimesModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
150
|
+
this.stations = new stations_1.StationsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
151
|
+
this.labels = new labels_1.LabelsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
152
|
+
this.options = new options_1.OptionsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
153
|
+
this.checkInGroups = new check_in_groups_1.CheckInGroupsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
154
|
+
this.checkInTimes = new check_in_times_1.CheckInTimesModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
155
|
+
this.personEvents = new person_events_1.PersonEventsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
156
|
+
this.preChecks = new pre_checks_1.PreChecksModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
157
|
+
this.passes = new passes_1.PassesModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
158
|
+
this.headcounts = new headcounts_1.HeadcountsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
159
|
+
this.attendanceTypes = new attendance_types_1.AttendanceTypesModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
160
|
+
this.rosterListPersons = new roster_list_persons_1.RosterListPersonsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
161
|
+
this.organization = new organization_1.OrganizationModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
162
|
+
this.integrationLinks = new integration_links_1.IntegrationLinksModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
163
|
+
this.themes = new themes_1.ThemesModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
164
|
+
this.batch = new planning_center_base_ts_1.BatchExecutor(this, this.eventEmitter);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
exports.PcoCheckInsClient = PcoCheckInsClient;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { PcoCheckInsClient } from './client';
|
|
2
|
+
export type { PcoCheckInsClientConfig, } from './types/client';
|
|
3
|
+
export type { PcoEvent, EventHandler, EventType } from '@rachelallyson/planning-center-base-ts';
|
|
4
|
+
export type { BatchOperation, BatchResult, BatchOptions, BatchSummary } from '@rachelallyson/planning-center-base-ts';
|
|
5
|
+
export type { Paginated, Relationship, ResourceIdentifier, ResourceObject, Response, } from '@rachelallyson/planning-center-base-ts';
|
|
6
|
+
export type { EventResource, EventAttributes, EventRelationships, EventsList, EventSingle, CheckInResource, CheckInAttributes, CheckInRelationships, CheckInsList, CheckInSingle, LocationResource, LocationAttributes, LocationRelationships, LocationsList, LocationSingle, EventPeriodResource, EventPeriodAttributes, EventPeriodRelationships, EventPeriodsList, EventPeriodSingle, EventTimeResource, EventTimeAttributes, EventTimeRelationships, EventTimesList, EventTimeSingle, StationResource, StationAttributes, StationRelationships, StationsList, StationSingle, LabelResource, LabelAttributes, LabelRelationships, LabelsList, LabelSingle, EventLabelResource, EventLabelAttributes, EventLabelRelationships, EventLabelsList, EventLabelSingle, LocationLabelResource, LocationLabelAttributes, LocationLabelRelationships, LocationLabelsList, LocationLabelSingle, OptionResource, OptionAttributes, OptionRelationships, OptionsList, OptionSingle, CheckInGroupResource, CheckInGroupAttributes, CheckInGroupRelationships, CheckInGroupsList, CheckInGroupSingle, CheckInTimeResource, CheckInTimeAttributes, CheckInTimeRelationships, CheckInTimesList, CheckInTimeSingle, PersonEventResource, PersonEventAttributes, PersonEventRelationships, PersonEventsList, PersonEventSingle, PreCheckResource, PreCheckAttributes, PreCheckRelationships, PreChecksList, PreCheckSingle, PassResource, PassAttributes, PassRelationships, PassesList, PassSingle, HeadcountResource, HeadcountAttributes, HeadcountRelationships, HeadcountsList, HeadcountSingle, AttendanceTypeResource, AttendanceTypeAttributes, AttendanceTypeRelationships, AttendanceTypesList, AttendanceTypeSingle, RosterListPersonResource, RosterListPersonAttributes, RosterListPersonRelationships, RosterListPersonsList, RosterListPersonSingle, OrganizationResource, OrganizationAttributes, OrganizationRelationships, OrganizationsList, OrganizationSingle, IntegrationLinkResource, IntegrationLinkAttributes, IntegrationLinkRelationships, IntegrationLinksList, IntegrationLinkSingle, ThemeResource, ThemeAttributes, ThemeRelationships, ThemesList, ThemeSingle, LocationEventPeriodResource, LocationEventPeriodAttributes, LocationEventPeriodRelationships, LocationEventPeriodsList, LocationEventPeriodSingle, LocationEventTimeResource, LocationEventTimeAttributes, LocationEventTimeRelationships, LocationEventTimesList, LocationEventTimeSingle, } from './types';
|
|
7
|
+
export * from './types';
|
|
8
|
+
export { PcoApiError } from '@rachelallyson/planning-center-base-ts';
|
|
9
|
+
export type { RateLimitHeaders, RateLimitInfo } from '@rachelallyson/planning-center-base-ts';
|
|
10
|
+
export { PcoRateLimiter } from '@rachelallyson/planning-center-base-ts';
|
|
11
|
+
export type { ErrorContext } from '@rachelallyson/planning-center-base-ts';
|
|
12
|
+
export { ErrorCategory, ErrorSeverity, handleNetworkError, handleTimeoutError, handleValidationError, PcoError, retryWithBackoff, shouldNotRetry, withErrorBoundary, } from '@rachelallyson/planning-center-base-ts';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ===== v1.0.0 Main Exports =====
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.withErrorBoundary = exports.shouldNotRetry = exports.retryWithBackoff = exports.PcoError = exports.handleValidationError = exports.handleTimeoutError = exports.handleNetworkError = exports.ErrorSeverity = exports.ErrorCategory = exports.PcoRateLimiter = exports.PcoApiError = exports.PcoCheckInsClient = void 0;
|
|
19
|
+
// Main client class
|
|
20
|
+
var client_1 = require("./client");
|
|
21
|
+
Object.defineProperty(exports, "PcoCheckInsClient", { enumerable: true, get: function () { return client_1.PcoCheckInsClient; } });
|
|
22
|
+
// Export all types for convenience
|
|
23
|
+
__exportStar(require("./types"), exports);
|
|
24
|
+
// Export API error (re-exported from base)
|
|
25
|
+
var planning_center_base_ts_1 = require("@rachelallyson/planning-center-base-ts");
|
|
26
|
+
Object.defineProperty(exports, "PcoApiError", { enumerable: true, get: function () { return planning_center_base_ts_1.PcoApiError; } });
|
|
27
|
+
var planning_center_base_ts_2 = require("@rachelallyson/planning-center-base-ts");
|
|
28
|
+
Object.defineProperty(exports, "PcoRateLimiter", { enumerable: true, get: function () { return planning_center_base_ts_2.PcoRateLimiter; } });
|
|
29
|
+
var planning_center_base_ts_3 = require("@rachelallyson/planning-center-base-ts");
|
|
30
|
+
Object.defineProperty(exports, "ErrorCategory", { enumerable: true, get: function () { return planning_center_base_ts_3.ErrorCategory; } });
|
|
31
|
+
Object.defineProperty(exports, "ErrorSeverity", { enumerable: true, get: function () { return planning_center_base_ts_3.ErrorSeverity; } });
|
|
32
|
+
Object.defineProperty(exports, "handleNetworkError", { enumerable: true, get: function () { return planning_center_base_ts_3.handleNetworkError; } });
|
|
33
|
+
Object.defineProperty(exports, "handleTimeoutError", { enumerable: true, get: function () { return planning_center_base_ts_3.handleTimeoutError; } });
|
|
34
|
+
Object.defineProperty(exports, "handleValidationError", { enumerable: true, get: function () { return planning_center_base_ts_3.handleValidationError; } });
|
|
35
|
+
Object.defineProperty(exports, "PcoError", { enumerable: true, get: function () { return planning_center_base_ts_3.PcoError; } });
|
|
36
|
+
Object.defineProperty(exports, "retryWithBackoff", { enumerable: true, get: function () { return planning_center_base_ts_3.retryWithBackoff; } });
|
|
37
|
+
Object.defineProperty(exports, "shouldNotRetry", { enumerable: true, get: function () { return planning_center_base_ts_3.shouldNotRetry; } });
|
|
38
|
+
Object.defineProperty(exports, "withErrorBoundary", { enumerable: true, get: function () { return planning_center_base_ts_3.withErrorBoundary; } });
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AttendanceTypes 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 { AttendanceTypeResource } from '../types';
|
|
7
|
+
export interface AttendanceTypesListOptions {
|
|
8
|
+
where?: Record<string, any>;
|
|
9
|
+
include?: string[];
|
|
10
|
+
perPage?: number;
|
|
11
|
+
page?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare class AttendanceTypesModule extends BaseModule {
|
|
14
|
+
constructor(httpClient: PcoHttpClient, paginationHelper: PaginationHelper, eventEmitter: PcoEventEmitter);
|
|
15
|
+
/**
|
|
16
|
+
* Get all attendance types with optional filtering
|
|
17
|
+
*/
|
|
18
|
+
getAll(options?: AttendanceTypesListOptions): Promise<{
|
|
19
|
+
data: AttendanceTypeResource[];
|
|
20
|
+
meta?: any;
|
|
21
|
+
links?: any;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* Get a single attendance type by ID
|
|
25
|
+
*/
|
|
26
|
+
getById(id: string, include?: string[]): Promise<AttendanceTypeResource>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* AttendanceTypes Module for Check-Ins API
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AttendanceTypesModule = void 0;
|
|
7
|
+
const planning_center_base_ts_1 = require("@rachelallyson/planning-center-base-ts");
|
|
8
|
+
class AttendanceTypesModule extends planning_center_base_ts_1.BaseModule {
|
|
9
|
+
constructor(httpClient, paginationHelper, eventEmitter) {
|
|
10
|
+
super(httpClient, paginationHelper, eventEmitter);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Get all attendance types 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/attendance_types', params);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Get a single attendance type 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/attendance_types/${id}`, params);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.AttendanceTypesModule = AttendanceTypesModule;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CheckInGroups 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 { CheckInGroupResource } from '../types';
|
|
7
|
+
export interface CheckInGroupsListOptions {
|
|
8
|
+
where?: Record<string, any>;
|
|
9
|
+
include?: string[];
|
|
10
|
+
perPage?: number;
|
|
11
|
+
page?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare class CheckInGroupsModule extends BaseModule {
|
|
14
|
+
constructor(httpClient: PcoHttpClient, paginationHelper: PaginationHelper, eventEmitter: PcoEventEmitter);
|
|
15
|
+
/**
|
|
16
|
+
* Get all check-in groups with optional filtering
|
|
17
|
+
*/
|
|
18
|
+
getAll(options?: CheckInGroupsListOptions): Promise<{
|
|
19
|
+
data: CheckInGroupResource[];
|
|
20
|
+
meta?: any;
|
|
21
|
+
links?: any;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* Get a single check-in group by ID
|
|
25
|
+
*/
|
|
26
|
+
getById(id: string, include?: string[]): Promise<CheckInGroupResource>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* CheckInGroups Module for Check-Ins API
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CheckInGroupsModule = void 0;
|
|
7
|
+
const planning_center_base_ts_1 = require("@rachelallyson/planning-center-base-ts");
|
|
8
|
+
class CheckInGroupsModule extends planning_center_base_ts_1.BaseModule {
|
|
9
|
+
constructor(httpClient, paginationHelper, eventEmitter) {
|
|
10
|
+
super(httpClient, paginationHelper, eventEmitter);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Get all check-in groups 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_groups', params);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Get a single check-in group 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_groups/${id}`, params);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.CheckInGroupsModule = CheckInGroupsModule;
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
}
|