@rachelallyson/planning-center-people-ts 3.0.0 → 3.1.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 CHANGED
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.1.0] - 2026-02-05
9
+
10
+ ### Added
11
+
12
+ - **ListsModule.getRules(listId)**: New method to fetch rules for a list (`GET /people/v2/lists/:id/rules`). Returns paginated list of rules with `data`, `meta`, and `links`. Types `ListRuleResource`, `ListRuleAttributes`, and `ListRulesList` are exported.
13
+
8
14
  ## [3.0.0] - 2026-01-28
9
15
 
10
16
  ### Added
package/dist/helpers.js CHANGED
@@ -528,12 +528,13 @@ async function getPeopleByHousehold(client, householdId) {
528
528
  const household = p.household;
529
529
  if (!household)
530
530
  return false;
531
- // household can be a HouseholdResource or ResourceIdentifier (both have id)
531
+ // household can be a HouseholdResource, ResourceIdentifier, or array at runtime (types say to-one only)
532
532
  if (Array.isArray(household)) {
533
533
  return household.some((h) => h && 'id' in h && h.id === householdId);
534
534
  }
535
535
  // Check if it has an id property (both ResourceIdentifier and HouseholdResource have it)
536
- return 'id' in household && household.id === householdId;
536
+ const h = household;
537
+ return 'id' in h && h.id === householdId;
537
538
  })
538
539
  };
539
540
  return filtered;
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ export type { Paginated, Relationship, ResourceIdentifier, ResourceObject, } fro
9
9
  export type { PersonResource, PersonAttributes, PersonSingle, PeopleList, EmailResource, EmailAttributes, PhoneNumberResource, PhoneNumberAttributes, AddressResource, AddressAttributes, SocialProfileResource, SocialProfileAttributes, } from './types';
10
10
  export type { FieldDefinitionResource, FieldDefinitionAttributes, FieldDatumResource, FieldDatumAttributes, FieldOptionResource, FieldOptionAttributes, TabResource, TabAttributes, } from './types';
11
11
  export type { WorkflowResource, WorkflowAttributes, WorkflowCardResource, WorkflowCardAttributes, WorkflowCardNoteResource, WorkflowCardNoteAttributes, } from './types';
12
- export type { HouseholdResource, HouseholdAttributes, NoteResource, NoteAttributes, ListResource, ListAttributes, OrganizationResource, OrganizationAttributes, CampusResource, CampusAttributes, CampusesList, ServiceTimeResource, ServiceTimeAttributes, ServiceTimesList, FormResource, FormAttributes, FormsList, FormCategoryResource, FormCategoryAttributes, FormFieldResource, FormFieldAttributes, FormFieldOptionResource, FormFieldOptionAttributes, FormSubmissionResource, FormSubmissionAttributes, FormSubmissionValueResource, FormSubmissionValueAttributes, ReportResource, ReportAttributes, ReportsList, } from './types';
12
+ export type { HouseholdResource, HouseholdAttributes, NoteResource, NoteAttributes, ListResource, ListAttributes, ListRuleResource, ListRuleAttributes, ListRulesList, OrganizationResource, OrganizationAttributes, CampusResource, CampusAttributes, CampusesList, ServiceTimeResource, ServiceTimeAttributes, ServiceTimesList, FormResource, FormAttributes, FormsList, FormCategoryResource, FormCategoryAttributes, FormFieldResource, FormFieldAttributes, FormFieldOptionResource, FormFieldOptionAttributes, FormSubmissionResource, FormSubmissionAttributes, FormSubmissionValueResource, FormSubmissionValueAttributes, ReportResource, ReportAttributes, ReportsList, } from './types';
13
13
  export { createPcoClient, getRateLimitInfo } from './core';
14
14
  export type { PcoClientState, PcoClientConfig as CorePcoClientConfig } from './core';
15
15
  export { attemptTokenRefresh, refreshAccessToken, updateClientTokens, hasRefreshTokenCapability } from './auth';
@@ -61,6 +61,14 @@ export declare class ListsModule extends BaseModule {
61
61
  meta?: Meta;
62
62
  links?: TopLevelLinks;
63
63
  }>;
64
+ /**
65
+ * Get rules for a list (GET /people/v2/lists/:id/rules)
66
+ */
67
+ getRules(listId: string): Promise<{
68
+ data: import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Rule", import("../types").ListRuleAttributes, import("../types").ListRuleRelationships, Record<string, never>>[];
69
+ meta?: Meta;
70
+ links?: TopLevelLinks;
71
+ }>;
64
72
  /**
65
73
  * Run a List to update its results
66
74
  */
@@ -81,6 +81,13 @@ class ListsModule extends planning_center_base_ts_1.BaseModule {
81
81
  async getPeople(listId) {
82
82
  return this.getList(`/lists/${listId}/people`);
83
83
  }
84
+ /**
85
+ * Get rules for a list (GET /people/v2/lists/:id/rules)
86
+ */
87
+ async getRules(listId) {
88
+ this.debugLog('lists.getRules', { listId });
89
+ return this.getList(`/lists/${listId}/rules`);
90
+ }
84
91
  /**
85
92
  * Run a List to update its results
86
93
  */
@@ -80,7 +80,9 @@ class WorkflowsModule extends planning_center_base_ts_1.BaseModule {
80
80
  if (skipIfExists || skipIfActive) {
81
81
  const existingCards = await this.getPersonWorkflowCards(personId);
82
82
  const existingCard = existingCards.data.find(card => {
83
- const workflowData = card?.workflow?.data;
83
+ // workflow may be Relationship (with .data) or flattened resource/identifier; support both
84
+ const raw = card?.workflow;
85
+ const workflowData = raw && 'id' in raw ? raw : raw?.data;
84
86
  return workflowData && !Array.isArray(workflowData) && workflowData.id === workflowId;
85
87
  });
86
88
  if (existingCard) {
@@ -273,6 +273,20 @@ export interface ListStarResource extends ResourceObject<'ListStar', ListStarAtt
273
273
  }
274
274
  export type ListStarsList = Paginated<ListStarResource>;
275
275
  export type ListStarSingle = Response<ListStarResource>;
276
+ export interface ListRuleAttributes extends Attributes {
277
+ group?: string;
278
+ operator?: string;
279
+ value?: string;
280
+ created_at?: string;
281
+ updated_at?: string;
282
+ }
283
+ export interface ListRuleRelationships {
284
+ list?: Relationship;
285
+ }
286
+ export interface ListRuleResource extends ResourceObject<'Rule', ListRuleAttributes, ListRuleRelationships> {
287
+ }
288
+ export type ListRulesList = Paginated<ListRuleResource>;
289
+ export type ListRuleSingle = Response<ListRuleResource>;
276
290
  export interface NoteAttributes extends Attributes {
277
291
  note?: string;
278
292
  note_category_id?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rachelallyson/planning-center-people-ts",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "A strictly typed TypeScript client for Planning Center Online People API with comprehensive functionality and enhanced developer experience",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",