@goodparty_org/sdk 1.7.0 → 1.8.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/README.md CHANGED
@@ -57,6 +57,19 @@ const updatedCampaign = await client.campaigns.update(1, {
57
57
  details: { office: 'Mayor' },
58
58
  })
59
59
 
60
+ const offices = await client.electedOffices.list({
61
+ userId: 42,
62
+ offset: 0,
63
+ limit: 20,
64
+ })
65
+
66
+ const office = await client.electedOffices.get('some-uuid')
67
+
68
+ const updatedOffice = await client.electedOffices.update('some-uuid', {
69
+ electedDate: '2026-01-15',
70
+ isActive: true,
71
+ })
72
+
60
73
  const p2vs = await client.pathsToVictory.list({
61
74
  userId: 42,
62
75
  offset: 0,
package/dist/index.d.mts CHANGED
@@ -250,6 +250,38 @@ declare class CampaignsResource extends BaseResource {
250
250
  update: (id: number, input: UpdateCampaignInput) => Promise<Campaign>;
251
251
  }
252
252
 
253
+ type ElectedOffice = {
254
+ id: string;
255
+ electedDate: string | null;
256
+ swornInDate: string | null;
257
+ termStartDate: string | null;
258
+ termEndDate: string | null;
259
+ termLengthDays: number | null;
260
+ isActive: boolean;
261
+ userId: number;
262
+ campaignId: number;
263
+ createdAt: string;
264
+ updatedAt: string;
265
+ };
266
+ type ListElectedOfficesOptions = PaginationOptions & {
267
+ userId?: number;
268
+ };
269
+ type UpdateElectedOfficeInput = {
270
+ electedDate?: string | null;
271
+ swornInDate?: string | null;
272
+ termStartDate?: string | null;
273
+ termEndDate?: string | null;
274
+ termLengthDays?: number | null;
275
+ isActive?: boolean;
276
+ };
277
+
278
+ declare class ElectedOfficesResource extends BaseResource {
279
+ protected readonly resourceBasePath = "/elected-office";
280
+ list: (options?: ListElectedOfficesOptions) => Promise<PaginatedList<ElectedOffice>>;
281
+ get: (id: string) => Promise<ElectedOffice>;
282
+ update: (id: string, input: UpdateElectedOfficeInput) => Promise<ElectedOffice>;
283
+ }
284
+
253
285
  declare enum P2VStatus {
254
286
  complete = "Complete",
255
287
  waiting = "Waiting",
@@ -401,6 +433,7 @@ type GoodPartyClientConfig = {
401
433
  declare class GoodPartyClient {
402
434
  readonly users: UsersResource;
403
435
  readonly campaigns: CampaignsResource;
436
+ readonly electedOffices: ElectedOfficesResource;
404
437
  readonly pathsToVictory: PathsToVictoryResource;
405
438
  private clerkService;
406
439
  private constructor();
@@ -408,4 +441,4 @@ declare class GoodPartyClient {
408
441
  destroy: () => void;
409
442
  }
410
443
 
411
- export { type AiChatMessage, type AiContentData, type AiContentGenerationStatus, type AiContentInputValues, BallotReadyPositionLevel, type Campaign, type CampaignAiContent, CampaignCreatedBy, type CampaignData, type CampaignDetails, CampaignLaunchStatus, CampaignTier, type CustomIssue, type CustomVoterFile, ElectionLevel, GenerationStatus, type GeoLocation, GoodPartyClient, type GoodPartyClientConfig, type HubSpotUpdates, type ListCampaignsOptions, type ListPathsToVictoryOptions, type ListUsersOptions, OnboardingStep, type Opponent, P2VSource, P2VStatus, type PaginatedList, type PaginationMeta, type PaginationOptions, type PathToVictory, type PathToVictoryData, SdkError, type UpdateCampaignInput, type UpdatePasswordInput, type UpdatePathToVictoryInput, type UpdateUserInput, type User, type UserMetaData, UserRole, type ViabilityScore, type VoterGoals, WhyBrowsing };
444
+ export { type AiChatMessage, type AiContentData, type AiContentGenerationStatus, type AiContentInputValues, BallotReadyPositionLevel, type Campaign, type CampaignAiContent, CampaignCreatedBy, type CampaignData, type CampaignDetails, CampaignLaunchStatus, CampaignTier, type CustomIssue, type CustomVoterFile, type ElectedOffice, ElectionLevel, GenerationStatus, type GeoLocation, GoodPartyClient, type GoodPartyClientConfig, type HubSpotUpdates, type ListCampaignsOptions, type ListElectedOfficesOptions, type ListPathsToVictoryOptions, type ListUsersOptions, OnboardingStep, type Opponent, P2VSource, P2VStatus, type PaginatedList, type PaginationMeta, type PaginationOptions, type PathToVictory, type PathToVictoryData, SdkError, type UpdateCampaignInput, type UpdateElectedOfficeInput, type UpdatePasswordInput, type UpdatePathToVictoryInput, type UpdateUserInput, type User, type UserMetaData, UserRole, type ViabilityScore, type VoterGoals, WhyBrowsing };
package/dist/index.d.ts CHANGED
@@ -250,6 +250,38 @@ declare class CampaignsResource extends BaseResource {
250
250
  update: (id: number, input: UpdateCampaignInput) => Promise<Campaign>;
251
251
  }
252
252
 
253
+ type ElectedOffice = {
254
+ id: string;
255
+ electedDate: string | null;
256
+ swornInDate: string | null;
257
+ termStartDate: string | null;
258
+ termEndDate: string | null;
259
+ termLengthDays: number | null;
260
+ isActive: boolean;
261
+ userId: number;
262
+ campaignId: number;
263
+ createdAt: string;
264
+ updatedAt: string;
265
+ };
266
+ type ListElectedOfficesOptions = PaginationOptions & {
267
+ userId?: number;
268
+ };
269
+ type UpdateElectedOfficeInput = {
270
+ electedDate?: string | null;
271
+ swornInDate?: string | null;
272
+ termStartDate?: string | null;
273
+ termEndDate?: string | null;
274
+ termLengthDays?: number | null;
275
+ isActive?: boolean;
276
+ };
277
+
278
+ declare class ElectedOfficesResource extends BaseResource {
279
+ protected readonly resourceBasePath = "/elected-office";
280
+ list: (options?: ListElectedOfficesOptions) => Promise<PaginatedList<ElectedOffice>>;
281
+ get: (id: string) => Promise<ElectedOffice>;
282
+ update: (id: string, input: UpdateElectedOfficeInput) => Promise<ElectedOffice>;
283
+ }
284
+
253
285
  declare enum P2VStatus {
254
286
  complete = "Complete",
255
287
  waiting = "Waiting",
@@ -401,6 +433,7 @@ type GoodPartyClientConfig = {
401
433
  declare class GoodPartyClient {
402
434
  readonly users: UsersResource;
403
435
  readonly campaigns: CampaignsResource;
436
+ readonly electedOffices: ElectedOfficesResource;
404
437
  readonly pathsToVictory: PathsToVictoryResource;
405
438
  private clerkService;
406
439
  private constructor();
@@ -408,4 +441,4 @@ declare class GoodPartyClient {
408
441
  destroy: () => void;
409
442
  }
410
443
 
411
- export { type AiChatMessage, type AiContentData, type AiContentGenerationStatus, type AiContentInputValues, BallotReadyPositionLevel, type Campaign, type CampaignAiContent, CampaignCreatedBy, type CampaignData, type CampaignDetails, CampaignLaunchStatus, CampaignTier, type CustomIssue, type CustomVoterFile, ElectionLevel, GenerationStatus, type GeoLocation, GoodPartyClient, type GoodPartyClientConfig, type HubSpotUpdates, type ListCampaignsOptions, type ListPathsToVictoryOptions, type ListUsersOptions, OnboardingStep, type Opponent, P2VSource, P2VStatus, type PaginatedList, type PaginationMeta, type PaginationOptions, type PathToVictory, type PathToVictoryData, SdkError, type UpdateCampaignInput, type UpdatePasswordInput, type UpdatePathToVictoryInput, type UpdateUserInput, type User, type UserMetaData, UserRole, type ViabilityScore, type VoterGoals, WhyBrowsing };
444
+ export { type AiChatMessage, type AiContentData, type AiContentGenerationStatus, type AiContentInputValues, BallotReadyPositionLevel, type Campaign, type CampaignAiContent, CampaignCreatedBy, type CampaignData, type CampaignDetails, CampaignLaunchStatus, CampaignTier, type CustomIssue, type CustomVoterFile, type ElectedOffice, ElectionLevel, GenerationStatus, type GeoLocation, GoodPartyClient, type GoodPartyClientConfig, type HubSpotUpdates, type ListCampaignsOptions, type ListElectedOfficesOptions, type ListPathsToVictoryOptions, type ListUsersOptions, OnboardingStep, type Opponent, P2VSource, P2VStatus, type PaginatedList, type PaginationMeta, type PaginationOptions, type PathToVictory, type PathToVictoryData, SdkError, type UpdateCampaignInput, type UpdateElectedOfficeInput, type UpdatePasswordInput, type UpdatePathToVictoryInput, type UpdateUserInput, type User, type UserMetaData, UserRole, type ViabilityScore, type VoterGoals, WhyBrowsing };
package/dist/index.js CHANGED
@@ -102,6 +102,17 @@ var CampaignsResource = class extends BaseResource {
102
102
  update = (id, input) => this.putRequest(`${this.resourceBasePath}/${id}`, input);
103
103
  };
104
104
 
105
+ // src/resources/ElectedOfficesResource.ts
106
+ var ElectedOfficesResource = class extends BaseResource {
107
+ resourceBasePath = "/elected-office";
108
+ list = (options) => this.getRequest(
109
+ `${this.resourceBasePath}/list`,
110
+ options
111
+ );
112
+ get = (id) => this.getRequest(`${this.resourceBasePath}/${id}`);
113
+ update = (id, input) => this.putRequest(`${this.resourceBasePath}/${id}`, input);
114
+ };
115
+
105
116
  // src/resources/PathsToVictoryResource.ts
106
117
  var PathsToVictoryResource = class extends BaseResource {
107
118
  resourceBasePath = "/path-to-victory";
@@ -214,6 +225,7 @@ var ClerkService = class {
214
225
  var GoodPartyClient = class _GoodPartyClient {
215
226
  users;
216
227
  campaigns;
228
+ electedOffices;
217
229
  pathsToVictory;
218
230
  clerkService;
219
231
  constructor(clerkService, gpApiRootUrl) {
@@ -221,6 +233,7 @@ var GoodPartyClient = class _GoodPartyClient {
221
233
  const httpClient = new HttpClient(gpApiRootUrl, clerkService.getToken);
222
234
  this.users = new UsersResource(httpClient);
223
235
  this.campaigns = new CampaignsResource(httpClient);
236
+ this.electedOffices = new ElectedOfficesResource(httpClient);
224
237
  this.pathsToVictory = new PathsToVictoryResource(httpClient);
225
238
  }
226
239
  static create = async (config) => {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/http/HttpClient.ts","../src/types/result.ts","../src/resources/BaseResource.ts","../src/resources/CampaignsResource.ts","../src/resources/PathsToVictoryResource.ts","../src/resources/UsersResource.ts","../src/vendor/clerk/clerk.service.ts","../src/GoodPartyClient.ts","../src/types/user.ts","../src/types/campaign.ts","../src/types/pathToVictory.ts"],"sourcesContent":["export { GoodPartyClient } from './GoodPartyClient'\nexport type { GoodPartyClientConfig } from './GoodPartyClient'\n\nexport { SdkError } from './types/result'\nexport type {\n PaginationOptions,\n PaginationMeta,\n PaginatedList,\n} from './types/result'\n\nexport type {\n User,\n UserMetaData,\n ListUsersOptions,\n UpdateUserInput,\n UpdatePasswordInput,\n} from './types/user'\n\nexport { UserRole, WhyBrowsing } from './types/user'\n\nexport type {\n Campaign,\n CampaignDetails,\n CampaignData,\n CampaignAiContent,\n VoterGoals,\n CustomVoterFile,\n AiChatMessage,\n AiContentInputValues,\n AiContentGenerationStatus,\n AiContentData,\n ListCampaignsOptions,\n UpdateCampaignInput,\n GeoLocation,\n CustomIssue,\n Opponent,\n HubSpotUpdates,\n} from './types/campaign'\n\nexport {\n CampaignTier,\n BallotReadyPositionLevel,\n ElectionLevel,\n CampaignCreatedBy,\n CampaignLaunchStatus,\n OnboardingStep,\n GenerationStatus,\n} from './types/campaign'\n\nexport type {\n PathToVictory,\n PathToVictoryData,\n ViabilityScore,\n ListPathsToVictoryOptions,\n UpdatePathToVictoryInput,\n} from './types/pathToVictory'\n\nexport { P2VStatus, P2VSource } from './types/pathToVictory'\n","import { ofetch, FetchError, FetchOptions } from 'ofetch'\nimport { SdkError } from '../types/result'\n\nexport type OfetchRequestBody = FetchOptions<'json'>['body']\n\nexport class HttpClient {\n private baseUrl: string\n private getToken: () => Promise<string>\n\n constructor(gpApiRootUrl: string, getToken: () => Promise<string>) {\n this.baseUrl = gpApiRootUrl\n this.getToken = getToken\n }\n\n request = async <T>(\n path: string,\n init?: FetchOptions<'json'>,\n ): Promise<T> => {\n try {\n return await ofetch<T>(path, {\n baseURL: this.baseUrl,\n headers: {\n Authorization: `Bearer ${await this.getToken()}`,\n ...(init?.headers ?? {}),\n },\n ...init,\n })\n } catch (error: unknown) {\n if (error instanceof FetchError) {\n throw new SdkError(error.statusCode ?? 0, error.message, error.response)\n }\n const message = error instanceof Error ? error.message : 'Unknown error'\n throw new SdkError(0, message)\n }\n }\n}\n","export class SdkError extends Error {\n readonly status: number\n readonly response?: Response\n\n constructor(status: number, message: string, response?: Response) {\n super(message)\n this.name = 'SdkError'\n this.status = status\n this.response = response\n }\n}\n\nexport type PaginationOptions = {\n offset?: number\n limit?: number\n sortBy?: string\n sortOrder?: 'asc' | 'desc'\n}\n\nexport type PaginationMeta = {\n total: number\n offset: number\n limit: number\n}\n\nexport type PaginatedList<T> = {\n data: T[]\n meta: PaginationMeta\n}\n","import type { FetchOptions } from 'ofetch'\nimport type { HttpClient, OfetchRequestBody } from '../http/HttpClient'\n\nexport abstract class BaseResource {\n protected httpClient: HttpClient\n protected abstract readonly resourceBasePath: string\n\n constructor(httpClient: HttpClient) {\n this.httpClient = httpClient\n }\n\n protected getRequest = <T>(\n path: string,\n query?: FetchOptions<'json'>['query'],\n ): Promise<T> => this.httpClient.request<T>(path, { method: 'GET', query })\n\n protected postRequest = <T>(\n path: string,\n body: OfetchRequestBody,\n ): Promise<T> => this.httpClient.request<T>(path, { method: 'POST', body })\n\n protected putRequest = <T>(\n path: string,\n body: OfetchRequestBody,\n ): Promise<T> => this.httpClient.request<T>(path, { method: 'PUT', body })\n\n protected deleteRequest = <T>(path: string): Promise<T> =>\n this.httpClient.request<T>(path, { method: 'DELETE' })\n}\n","import type { PaginatedList } from '../types/result'\nimport type {\n Campaign,\n ListCampaignsOptions,\n UpdateCampaignInput,\n} from '../types/campaign'\nimport { BaseResource } from './BaseResource'\n\nexport class CampaignsResource extends BaseResource {\n protected readonly resourceBasePath = '/campaigns'\n\n get = (id: number): Promise<Campaign> =>\n this.getRequest<Campaign>(`${this.resourceBasePath}/${id}`)\n\n list = (options?: ListCampaignsOptions): Promise<PaginatedList<Campaign>> =>\n this.getRequest<PaginatedList<Campaign>>(\n `${this.resourceBasePath}/list`,\n options,\n )\n\n update = (id: number, input: UpdateCampaignInput): Promise<Campaign> =>\n this.putRequest<Campaign>(`${this.resourceBasePath}/${id}`, input)\n}\n","import type { PaginatedList } from '../types/result'\nimport type {\n ListPathsToVictoryOptions,\n PathToVictory,\n UpdatePathToVictoryInput,\n} from '../types/pathToVictory'\nimport { BaseResource } from './BaseResource'\n\nexport class PathsToVictoryResource extends BaseResource {\n protected resourceBasePath = '/path-to-victory'\n list = (\n options?: ListPathsToVictoryOptions,\n ): Promise<PaginatedList<PathToVictory>> =>\n this.getRequest<PaginatedList<PathToVictory>>(\n `${this.resourceBasePath}/list`,\n options,\n )\n\n get = (id: number): Promise<PathToVictory> =>\n this.getRequest<PathToVictory>(`${this.resourceBasePath}/${id}`)\n\n update = (\n id: number,\n input: UpdatePathToVictoryInput,\n ): Promise<PathToVictory> =>\n this.putRequest<PathToVictory>(`${this.resourceBasePath}/${id}`, input)\n}\n","import type { PaginatedList } from '../types/result'\nimport type {\n ListUsersOptions,\n UpdatePasswordInput,\n UpdateUserInput,\n User,\n} from '../types/user'\nimport { BaseResource } from './BaseResource'\n\nexport class UsersResource extends BaseResource {\n protected readonly resourceBasePath = '/users'\n\n list = (options?: ListUsersOptions): Promise<PaginatedList<User>> =>\n this.getRequest<PaginatedList<User>>(this.resourceBasePath, options)\n\n get = (id: number): Promise<User> => this.getRequest<User>(`/users/${id}`)\n\n update = (id: number, input: UpdateUserInput): Promise<User> =>\n this.putRequest<User>(`${this.resourceBasePath}/${id}`, input)\n\n delete = (id: number): Promise<void> =>\n this.deleteRequest<void>(`${this.resourceBasePath}/${id}`)\n\n updatePassword = (id: number, input: UpdatePasswordInput): Promise<void> =>\n this.putRequest<void>(`${this.resourceBasePath}/${id}/password`, input)\n}\n","import { createClerkClient } from '@clerk/backend'\nimport { SdkError } from '../../types/result'\n\nconst TOKEN_RENEWAL_BUFFER_MS = 30_000\n\nexport class ClerkService {\n private readonly m2mSecret: string\n private readonly clerkClient: ReturnType<typeof createClerkClient>\n private cachedToken: string | null = null\n private tokenExpiration: number | null = null\n private renewalTimer: ReturnType<typeof setTimeout> | null = null\n private pendingTokenPromise: Promise<string> | null = null\n private destroyed = false\n\n constructor(m2mSecret: string) {\n this.m2mSecret = m2mSecret\n this.clerkClient = createClerkClient({})\n }\n\n getToken = async (): Promise<string> => {\n if (this.cachedToken && this.isTokenValid()) {\n return this.cachedToken\n }\n\n if (this.pendingTokenPromise) {\n return this.pendingTokenPromise\n }\n\n const promise = this.createAndCacheToken()\n this.pendingTokenPromise = promise\n\n try {\n return await promise\n } finally {\n if (this.pendingTokenPromise === promise) {\n this.pendingTokenPromise = null\n }\n }\n }\n\n destroy = (): void => {\n this.destroyed = true\n if (this.renewalTimer) {\n clearTimeout(this.renewalTimer)\n this.renewalTimer = null\n }\n this.cachedToken = null\n this.tokenExpiration = null\n this.pendingTokenPromise = null\n }\n\n private isTokenValid = (): boolean => {\n if (!this.tokenExpiration) return true\n return Date.now() < this.tokenExpiration - TOKEN_RENEWAL_BUFFER_MS\n }\n\n private createAndCacheToken = async (): Promise<string> => {\n try {\n const m2mToken = await this.clerkClient.m2m.createToken({\n machineSecretKey: this.m2mSecret,\n })\n\n if (!m2mToken.token) {\n throw new SdkError(\n 0,\n 'Clerk M2M token creation succeeded but returned no token string',\n )\n }\n\n if (this.destroyed) return m2mToken.token\n\n this.cachedToken = m2mToken.token\n this.tokenExpiration = m2mToken.expiration\n this.scheduleRenewal()\n\n return this.cachedToken\n } catch (error: unknown) {\n if (error instanceof SdkError) {\n throw error\n }\n const message = error instanceof Error ? error.message : 'Unknown error'\n throw new SdkError(0, `Failed to create Clerk M2M token: ${message}`)\n }\n }\n\n private scheduleRenewal = (): void => {\n if (this.renewalTimer) {\n clearTimeout(this.renewalTimer)\n this.renewalTimer = null\n }\n\n if (!this.tokenExpiration) return\n\n const timeUntilRenewal =\n this.tokenExpiration - Date.now() - TOKEN_RENEWAL_BUFFER_MS\n\n if (timeUntilRenewal <= 0) return\n\n this.renewalTimer = setTimeout(() => {\n this.cachedToken = null\n this.getToken().catch((error: unknown) => {\n console.error('Proactive M2M token renewal failed:', error)\n })\n }, timeUntilRenewal)\n }\n}\n","import { HttpClient } from './http/HttpClient'\nimport { CampaignsResource } from './resources/CampaignsResource'\nimport { PathsToVictoryResource } from './resources/PathsToVictoryResource'\nimport { UsersResource } from './resources/UsersResource'\nimport { ClerkService } from './vendor/clerk/clerk.service'\n\nexport type GoodPartyClientConfig = {\n m2mSecret: string\n gpApiRootUrl: string\n}\n\nexport class GoodPartyClient {\n readonly users: UsersResource\n readonly campaigns: CampaignsResource\n readonly pathsToVictory: PathsToVictoryResource\n private clerkService: ClerkService\n\n private constructor(clerkService: ClerkService, gpApiRootUrl: string) {\n this.clerkService = clerkService\n const httpClient = new HttpClient(gpApiRootUrl, clerkService.getToken)\n this.users = new UsersResource(httpClient)\n this.campaigns = new CampaignsResource(httpClient)\n this.pathsToVictory = new PathsToVictoryResource(httpClient)\n }\n\n static create = async (\n config: GoodPartyClientConfig,\n ): Promise<GoodPartyClient> => {\n const { m2mSecret, gpApiRootUrl } = config\n const clerkService = new ClerkService(m2mSecret)\n await clerkService.getToken()\n return new GoodPartyClient(clerkService, gpApiRootUrl)\n }\n\n destroy = (): void => {\n this.clerkService.destroy()\n }\n}\n","import type { PaginationOptions } from './result'\n\nexport enum UserRole {\n admin = 'admin',\n sales = 'sales',\n candidate = 'candidate',\n campaignManager = 'campaignManager',\n demo = 'demo',\n}\n\nexport enum WhyBrowsing {\n considering = 'considering',\n learning = 'learning',\n test = 'test',\n else = 'else',\n}\n\nexport enum SIGN_UP_MODE {\n CANDIDATE = 'candidate',\n FACILITATED = 'facilitated',\n}\n\nexport type UserMetaData = {\n customerId?: string\n checkoutSessionId?: string | null\n accountType?: string | null\n lastVisited?: number\n sessionCount?: number\n isDeleted?: boolean\n fsUserId?: string\n whyBrowsing?: WhyBrowsing | null\n hubspotId?: string\n profile_updated_count?: number\n textNotifications?: boolean\n} | null\n\nexport type User = {\n id: number\n firstName: string\n lastName: string\n name?: string | null\n email: string\n phone?: string | null\n zip?: string | null\n avatar?: string | null\n hasPassword: boolean\n roles?: UserRole[]\n metaData?: UserMetaData\n}\n\nexport type ListUsersOptions = PaginationOptions & {\n firstName?: string\n lastName?: string\n email?: string\n}\n\nexport type UpdateUserInput = {\n firstName?: string\n lastName?: string\n email?: string\n name?: string\n zip?: string\n phone?: string\n roles?: UserRole[]\n signUpMode?: SIGN_UP_MODE\n allowTexts?: boolean\n metaData?: UserMetaData\n}\n\nexport type UpdatePasswordInput = {\n oldPassword?: string\n newPassword: string\n}\n","import type { PaginationOptions } from './result'\n\nexport enum CampaignTier {\n WIN = 'WIN',\n LOSE = 'LOSE',\n TOSSUP = 'TOSSUP',\n}\n\nexport enum BallotReadyPositionLevel {\n CITY = 'CITY',\n COUNTY = 'COUNTY',\n FEDERAL = 'FEDERAL',\n LOCAL = 'LOCAL',\n REGIONAL = 'REGIONAL',\n STATE = 'STATE',\n TOWNSHIP = 'TOWNSHIP',\n}\n\nexport enum ElectionLevel {\n state = 'state',\n county = 'county',\n federal = 'federal',\n city = 'city',\n}\n\nexport enum CampaignCreatedBy {\n ADMIN = 'admin',\n}\n\nexport enum CampaignLaunchStatus {\n launched = 'launched',\n}\n\nexport enum OnboardingStep {\n complete = 'onboarding-complete',\n registration = 'registration',\n}\n\nexport enum GenerationStatus {\n processing = 'processing',\n completed = 'completed',\n}\n\nexport type VoterGoals = {\n doorKnocking?: number\n calls?: number\n digital?: number\n directMail?: number\n digitalAds?: number\n text?: number\n events?: number\n yardSigns?: number\n robocall?: number\n phoneBanking?: number\n socialMedia?: number\n}\n\nexport type CustomVoterFile = {\n name: string\n channel?: string\n purpose?: string\n filters: string[]\n createdAt: string\n}\n\nexport type AiChatMessage = {\n role: 'user' | 'system' | 'assistant'\n content: string\n createdAt?: number\n id?: string\n usage?: number\n}\n\nexport type AiContentInputValues = Record<\n string,\n string | boolean | number | undefined\n>\n\nexport type AiContentGenerationStatus = {\n status: GenerationStatus\n createdAt: number\n prompt?: string\n existingChat?: AiChatMessage[]\n inputValues?: AiContentInputValues\n}\n\nexport type AiContentData = {\n name: string\n content: string\n updatedAt: number\n inputValues?: AiContentInputValues\n}\n\nexport type GeoLocation = { geoHash?: string; lng?: number; lat?: number }\n\nexport type CustomIssue = { title: string; position: string }\n\nexport type Opponent = { name: string; party: string; description: string }\n\nexport type HubSpotUpdates = Partial<Record<string, string>>\n\nexport type CampaignDetails = {\n state?: string\n ballotLevel?: BallotReadyPositionLevel\n electionDate?: string\n primaryElectionDate?: string\n zip?: string | null\n knowRun?: 'yes' | null\n runForOffice?: 'yes' | 'no' | null\n pledged?: boolean\n isProUpdatedAt?: number\n customIssues?: CustomIssue[]\n runningAgainst?: Opponent[]\n geoLocation?: GeoLocation\n geoLocationFailed?: boolean\n city?: string | null\n county?: string | null\n normalizedOffice?: string | null\n otherOffice?: string\n office?: string\n party?: string\n otherParty?: string\n district?: string\n raceId?: string\n level?: ElectionLevel | null\n noNormalizedOffice?: boolean\n website?: string\n pastExperience?: string | Record<string, string>\n occupation?: string\n funFact?: string\n campaignCommittee?: string\n statementName?: string\n subscriptionId?: string | null\n endOfElectionSubscriptionCanceled?: boolean\n subscriptionCanceledAt?: number | null\n subscriptionCancelAt?: number | null\n filingPeriodsStart?: string | null\n filingPeriodsEnd?: string | null\n officeTermLength?: string\n partisanType?: string\n priorElectionDates?: string[]\n positionId?: string | null\n electionId?: string | null\n tier?: string\n einNumber?: string | null\n einSupportingDocument?: string | null\n wonGeneral?: boolean\n}\n\nexport type CampaignData = {\n createdBy?: CampaignCreatedBy\n slug?: string\n hubSpotUpdates?: HubSpotUpdates\n currentStep?: OnboardingStep\n launchStatus?: CampaignLaunchStatus\n lastVisited?: number\n claimProfile?: string\n customVoterFiles?: CustomVoterFile[]\n reportedVoterGoals?: VoterGoals\n textCampaignCount?: number\n lastStepDate?: string\n adminUserEmail?: string\n hubspotId?: string\n name?: string\n}\n\nexport type CampaignAiContent = {\n generationStatus?: Record<string, AiContentGenerationStatus>\n campaignPlanAttempts?: Record<string, number>\n} & Record<string, AiContentData>\n\nexport type Campaign = {\n id: number\n createdAt: string\n updatedAt: string\n slug: string\n isActive: boolean\n isVerified?: boolean | null\n isPro?: boolean | null\n isDemo: boolean\n didWin?: boolean | null\n dateVerified?: string | null\n tier?: CampaignTier | null\n formattedAddress?: string | null\n placeId?: string | null\n data: CampaignData\n details: CampaignDetails\n aiContent: CampaignAiContent\n userId: number\n canDownloadFederal: boolean\n completedTaskIds: string[]\n hasFreeTextsOffer: boolean\n freeTextsOfferRedeemedAt?: string | null\n}\n\nexport type ListCampaignsOptions = PaginationOptions & {\n userId?: number\n slug?: string\n}\n\nexport type UpdateCampaignInput = {\n slug?: string\n isActive?: boolean\n isVerified?: boolean | null\n isPro?: boolean | null\n isDemo?: boolean\n didWin?: boolean | null\n dateVerified?: string | null\n tier?: CampaignTier | null\n formattedAddress?: string | null\n placeId?: string | null\n data?: CampaignData\n details?: CampaignDetails\n aiContent?: CampaignAiContent\n canDownloadFederal?: boolean\n completedTaskIds?: string[]\n hasFreeTextsOffer?: boolean\n freeTextsOfferRedeemedAt?: string | null\n}\n","import type { PaginationOptions } from './result'\n\nexport enum P2VStatus {\n complete = 'Complete',\n waiting = 'Waiting',\n failed = 'Failed',\n districtMatched = 'DistrictMatched',\n}\n\nexport enum P2VSource {\n GpApi = 'GpApi',\n ElectionApi = 'ElectionApi',\n}\n\nexport type ViabilityScore = {\n level: string\n isPartisan: boolean\n isIncumbent: boolean\n isUncontested: boolean\n candidates: number\n seats: number\n candidatesPerSeat: number\n score: number\n probOfWin: number\n}\n\nexport type PathToVictoryData = {\n p2vStatus?: P2VStatus\n p2vAttempts?: number\n p2vCompleteDate?: string\n completedBy?: number\n electionType?: string\n electionLocation?: string\n voterContactGoal?: number\n winNumber?: number\n p2vNotNeeded?: boolean\n totalRegisteredVoters?: number\n republicans?: number\n democrats?: number\n indies?: number\n women?: number\n men?: number\n white?: number\n asian?: number\n africanAmerican?: number\n hispanic?: number\n averageTurnout?: number\n projectedTurnout?: number\n viability?: ViabilityScore\n source?: P2VSource\n districtId?: string\n districtManuallySet?: boolean\n officeContextFingerprint?: string\n}\n\nexport type PathToVictory = {\n id: number\n createdAt: string\n updatedAt: string\n campaignId: number\n data: PathToVictoryData\n}\n\nexport type ListPathsToVictoryOptions = PaginationOptions & {\n userId?: number\n}\n\nexport type UpdatePathToVictoryInput = {\n data: PathToVictoryData\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAAiD;;;ACA1C,IAAM,WAAN,cAAuB,MAAM;AAAA,EACzB;AAAA,EACA;AAAA,EAET,YAAY,QAAgB,SAAiB,UAAqB;A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GAAA;AAOL,IAAK,YAAL,kBAAKC,eAAL;AACL,EAAAA,WAAA,WAAQ;AACR,EAAAA,WAAA,iBAAc;AAFJ,SAAAA;AAAA,GAAA;","names":["UserRole","WhyBrowsing","CampaignTier","BallotReadyPositionLevel","ElectionLevel","CampaignCreatedBy","CampaignLaunchStatus","OnboardingStep","GenerationStatus","P2VStatus","P2VSource"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/http/HttpClient.ts","../src/types/result.ts","../src/resources/BaseResource.ts","../src/resources/CampaignsResource.ts","../src/resources/ElectedOfficesResource.ts","../src/resources/PathsToVictoryResource.ts","../src/resources/UsersResource.ts","../src/vendor/clerk/clerk.service.ts","../src/GoodPartyClient.ts","../src/types/user.ts","../src/types/campaign.ts","../src/types/pathToVictory.ts"],"sourcesContent":["export { GoodPartyClient } from './GoodPartyClient'\nexport type { GoodPartyClientConfig } from './GoodPartyClient'\n\nexport { SdkError } from './types/result'\nexport type {\n PaginationOptions,\n PaginationMeta,\n PaginatedList,\n} from './types/result'\n\nexport type {\n User,\n UserMetaData,\n ListUsersOptions,\n UpdateUserInput,\n UpdatePasswordInput,\n} from './types/user'\n\nexport { UserRole, WhyBrowsing } from './types/user'\n\nexport type {\n Campaign,\n CampaignDetails,\n CampaignData,\n CampaignAiContent,\n VoterGoals,\n CustomVoterFile,\n AiChatMessage,\n AiContentInputValues,\n AiContentGenerationStatus,\n AiContentData,\n ListCampaignsOptions,\n UpdateCampaignInput,\n GeoLocation,\n CustomIssue,\n Opponent,\n HubSpotUpdates,\n} from './types/campaign'\n\nexport {\n CampaignTier,\n BallotReadyPositionLevel,\n ElectionLevel,\n CampaignCreatedBy,\n CampaignLaunchStatus,\n OnboardingStep,\n GenerationStatus,\n} from './types/campaign'\n\nexport type {\n ElectedOffice,\n ListElectedOfficesOptions,\n UpdateElectedOfficeInput,\n} from './types/electedOffice'\n\nexport type {\n PathToVictory,\n PathToVictoryData,\n ViabilityScore,\n ListPathsToVictoryOptions,\n UpdatePathToVictoryInput,\n} from './types/pathToVictory'\n\nexport { P2VStatus, P2VSource } from './types/pathToVictory'\n","import { ofetch, FetchError, FetchOptions } from 'ofetch'\nimport { SdkError } from '../types/result'\n\nexport type OfetchRequestBody = FetchOptions<'json'>['body']\n\nexport class HttpClient {\n private baseUrl: string\n private getToken: () => Promise<string>\n\n constructor(gpApiRootUrl: string, getToken: () => Promise<string>) {\n this.baseUrl = gpApiRootUrl\n this.getToken = getToken\n }\n\n request = async <T>(\n path: string,\n init?: FetchOptions<'json'>,\n ): Promise<T> => {\n try {\n return await ofetch<T>(path, {\n baseURL: this.baseUrl,\n headers: {\n Authorization: `Bearer ${await this.getToken()}`,\n ...(init?.headers ?? {}),\n },\n ...init,\n })\n } catch (error: unknown) {\n if (error instanceof FetchError) {\n throw new SdkError(error.statusCode ?? 0, error.message, error.response)\n }\n const message = error instanceof Error ? error.message : 'Unknown error'\n throw new SdkError(0, message)\n }\n }\n}\n","export class SdkError extends Error {\n readonly status: number\n readonly response?: Response\n\n constructor(status: number, message: string, response?: Response) {\n super(message)\n this.name = 'SdkError'\n this.status = status\n this.response = response\n }\n}\n\nexport type PaginationOptions = {\n offset?: number\n limit?: number\n sortBy?: string\n sortOrder?: 'asc' | 'desc'\n}\n\nexport type PaginationMeta = {\n total: number\n offset: number\n limit: number\n}\n\nexport type PaginatedList<T> = {\n data: T[]\n meta: PaginationMeta\n}\n","import type { FetchOptions } from 'ofetch'\nimport type { HttpClient, OfetchRequestBody } from '../http/HttpClient'\n\nexport abstract class BaseResource {\n protected httpClient: HttpClient\n protected abstract readonly resourceBasePath: string\n\n constructor(httpClient: HttpClient) {\n this.httpClient = httpClient\n }\n\n protected getRequest = <T>(\n path: string,\n query?: FetchOptions<'json'>['query'],\n ): Promise<T> => this.httpClient.request<T>(path, { method: 'GET', query })\n\n protected postRequest = <T>(\n path: string,\n body: OfetchRequestBody,\n ): Promise<T> => this.httpClient.request<T>(path, { method: 'POST', body })\n\n protected putRequest = <T>(\n path: string,\n body: OfetchRequestBody,\n ): Promise<T> => this.httpClient.request<T>(path, { method: 'PUT', body })\n\n protected deleteRequest = <T>(path: string): Promise<T> =>\n this.httpClient.request<T>(path, { method: 'DELETE' })\n}\n","import type { PaginatedList } from '../types/result'\nimport type {\n Campaign,\n ListCampaignsOptions,\n UpdateCampaignInput,\n} from '../types/campaign'\nimport { BaseResource } from './BaseResource'\n\nexport class CampaignsResource extends BaseResource {\n protected readonly resourceBasePath = '/campaigns'\n\n get = (id: number): Promise<Campaign> =>\n this.getRequest<Campaign>(`${this.resourceBasePath}/${id}`)\n\n list = (options?: ListCampaignsOptions): Promise<PaginatedList<Campaign>> =>\n this.getRequest<PaginatedList<Campaign>>(\n `${this.resourceBasePath}/list`,\n options,\n )\n\n update = (id: number, input: UpdateCampaignInput): Promise<Campaign> =>\n this.putRequest<Campaign>(`${this.resourceBasePath}/${id}`, input)\n}\n","import type { PaginatedList } from '../types/result'\nimport type {\n ElectedOffice,\n ListElectedOfficesOptions,\n UpdateElectedOfficeInput,\n} from '../types/electedOffice'\nimport { BaseResource } from './BaseResource'\n\nexport class ElectedOfficesResource extends BaseResource {\n protected readonly resourceBasePath = '/elected-office'\n\n list = (\n options?: ListElectedOfficesOptions,\n ): Promise<PaginatedList<ElectedOffice>> =>\n this.getRequest<PaginatedList<ElectedOffice>>(\n `${this.resourceBasePath}/list`,\n options,\n )\n\n get = (id: string): Promise<ElectedOffice> =>\n this.getRequest<ElectedOffice>(`${this.resourceBasePath}/${id}`)\n\n update = (\n id: string,\n input: UpdateElectedOfficeInput,\n ): Promise<ElectedOffice> =>\n this.putRequest<ElectedOffice>(`${this.resourceBasePath}/${id}`, input)\n}\n","import type { PaginatedList } from '../types/result'\nimport type {\n ListPathsToVictoryOptions,\n PathToVictory,\n UpdatePathToVictoryInput,\n} from '../types/pathToVictory'\nimport { BaseResource } from './BaseResource'\n\nexport class PathsToVictoryResource extends BaseResource {\n protected resourceBasePath = '/path-to-victory'\n list = (\n options?: ListPathsToVictoryOptions,\n ): Promise<PaginatedList<PathToVictory>> =>\n this.getRequest<PaginatedList<PathToVictory>>(\n `${this.resourceBasePath}/list`,\n options,\n )\n\n get = (id: number): Promise<PathToVictory> =>\n this.getRequest<PathToVictory>(`${this.resourceBasePath}/${id}`)\n\n update = (\n id: number,\n input: UpdatePathToVictoryInput,\n ): Promise<PathToVictory> =>\n this.putRequest<PathToVictory>(`${this.resourceBasePath}/${id}`, input)\n}\n","import type { PaginatedList } from '../types/result'\nimport type {\n ListUsersOptions,\n UpdatePasswordInput,\n UpdateUserInput,\n User,\n} from '../types/user'\nimport { BaseResource } from './BaseResource'\n\nexport class UsersResource extends BaseResource {\n protected readonly resourceBasePath = '/users'\n\n list = (options?: ListUsersOptions): Promise<PaginatedList<User>> =>\n this.getRequest<PaginatedList<User>>(this.resourceBasePath, options)\n\n get = (id: number): Promise<User> => this.getRequest<User>(`/users/${id}`)\n\n update = (id: number, input: UpdateUserInput): Promise<User> =>\n this.putRequest<User>(`${this.resourceBasePath}/${id}`, input)\n\n delete = (id: number): Promise<void> =>\n this.deleteRequest<void>(`${this.resourceBasePath}/${id}`)\n\n updatePassword = (id: number, input: UpdatePasswordInput): Promise<void> =>\n this.putRequest<void>(`${this.resourceBasePath}/${id}/password`, input)\n}\n","import { createClerkClient } from '@clerk/backend'\nimport { SdkError } from '../../types/result'\n\nconst TOKEN_RENEWAL_BUFFER_MS = 30_000\n\nexport class ClerkService {\n private readonly m2mSecret: string\n private readonly clerkClient: ReturnType<typeof createClerkClient>\n private cachedToken: string | null = null\n private tokenExpiration: number | null = null\n private renewalTimer: ReturnType<typeof setTimeout> | null = null\n private pendingTokenPromise: Promise<string> | null = null\n private destroyed = false\n\n constructor(m2mSecret: string) {\n this.m2mSecret = m2mSecret\n this.clerkClient = createClerkClient({})\n }\n\n getToken = async (): Promise<string> => {\n if (this.cachedToken && this.isTokenValid()) {\n return this.cachedToken\n }\n\n if (this.pendingTokenPromise) {\n return this.pendingTokenPromise\n }\n\n const promise = this.createAndCacheToken()\n this.pendingTokenPromise = promise\n\n try {\n return await promise\n } finally {\n if (this.pendingTokenPromise === promise) {\n this.pendingTokenPromise = null\n }\n }\n }\n\n destroy = (): void => {\n this.destroyed = true\n if (this.renewalTimer) {\n clearTimeout(this.renewalTimer)\n this.renewalTimer = null\n }\n this.cachedToken = null\n this.tokenExpiration = null\n this.pendingTokenPromise = null\n }\n\n private isTokenValid = (): boolean => {\n if (!this.tokenExpiration) return true\n return Date.now() < this.tokenExpiration - TOKEN_RENEWAL_BUFFER_MS\n }\n\n private createAndCacheToken = async (): Promise<string> => {\n try {\n const m2mToken = await this.clerkClient.m2m.createToken({\n machineSecretKey: this.m2mSecret,\n })\n\n if (!m2mToken.token) {\n throw new SdkError(\n 0,\n 'Clerk M2M token creation succeeded but returned no token string',\n )\n }\n\n if (this.destroyed) return m2mToken.token\n\n this.cachedToken = m2mToken.token\n this.tokenExpiration = m2mToken.expiration\n this.scheduleRenewal()\n\n return this.cachedToken\n } catch (error: unknown) {\n if (error instanceof SdkError) {\n throw error\n }\n const message = error instanceof Error ? error.message : 'Unknown error'\n throw new SdkError(0, `Failed to create Clerk M2M token: ${message}`)\n }\n }\n\n private scheduleRenewal = (): void => {\n if (this.renewalTimer) {\n clearTimeout(this.renewalTimer)\n this.renewalTimer = null\n }\n\n if (!this.tokenExpiration) return\n\n const timeUntilRenewal =\n this.tokenExpiration - Date.now() - TOKEN_RENEWAL_BUFFER_MS\n\n if (timeUntilRenewal <= 0) return\n\n this.renewalTimer = setTimeout(() => {\n this.cachedToken = null\n this.getToken().catch((error: unknown) => {\n console.error('Proactive M2M token renewal failed:', error)\n })\n }, timeUntilRenewal)\n }\n}\n","import { HttpClient } from './http/HttpClient'\nimport { CampaignsResource } from './resources/CampaignsResource'\nimport { ElectedOfficesResource } from './resources/ElectedOfficesResource'\nimport { PathsToVictoryResource } from './resources/PathsToVictoryResource'\nimport { UsersResource } from './resources/UsersResource'\nimport { ClerkService } from './vendor/clerk/clerk.service'\n\nexport type GoodPartyClientConfig = {\n m2mSecret: string\n gpApiRootUrl: string\n}\n\nexport class GoodPartyClient {\n readonly users: UsersResource\n readonly campaigns: CampaignsResource\n readonly electedOffices: ElectedOfficesResource\n readonly pathsToVictory: PathsToVictoryResource\n private clerkService: ClerkService\n\n private constructor(clerkService: ClerkService, gpApiRootUrl: string) {\n this.clerkService = clerkService\n const httpClient = new HttpClient(gpApiRootUrl, clerkService.getToken)\n this.users = new UsersResource(httpClient)\n this.campaigns = new CampaignsResource(httpClient)\n this.electedOffices = new ElectedOfficesResource(httpClient)\n this.pathsToVictory = new PathsToVictoryResource(httpClient)\n }\n\n static create = async (\n config: GoodPartyClientConfig,\n ): Promise<GoodPartyClient> => {\n const { m2mSecret, gpApiRootUrl } = config\n const clerkService = new ClerkService(m2mSecret)\n await clerkService.getToken()\n return new GoodPartyClient(clerkService, gpApiRootUrl)\n }\n\n destroy = (): void => {\n this.clerkService.destroy()\n }\n}\n","import type { PaginationOptions } from './result'\n\nexport enum UserRole {\n admin = 'admin',\n sales = 'sales',\n candidate = 'candidate',\n campaignManager = 'campaignManager',\n demo = 'demo',\n}\n\nexport enum WhyBrowsing {\n considering = 'considering',\n learning = 'learning',\n test = 'test',\n else = 'else',\n}\n\nexport enum SIGN_UP_MODE {\n CANDIDATE = 'candidate',\n FACILITATED = 'facilitated',\n}\n\nexport type UserMetaData = {\n customerId?: string\n checkoutSessionId?: string | null\n accountType?: string | null\n lastVisited?: number\n sessionCount?: number\n isDeleted?: boolean\n fsUserId?: string\n whyBrowsing?: WhyBrowsing | null\n hubspotId?: string\n profile_updated_count?: number\n textNotifications?: boolean\n} | null\n\nexport type User = {\n id: number\n firstName: string\n lastName: string\n name?: string | null\n email: string\n phone?: string | null\n zip?: string | null\n avatar?: string | null\n hasPassword: boolean\n roles?: UserRole[]\n metaData?: UserMetaData\n}\n\nexport type ListUsersOptions = PaginationOptions & {\n firstName?: string\n lastName?: string\n email?: string\n}\n\nexport type UpdateUserInput = {\n firstName?: string\n lastName?: string\n email?: string\n name?: string\n zip?: string\n phone?: string\n roles?: UserRole[]\n signUpMode?: SIGN_UP_MODE\n allowTexts?: boolean\n metaData?: UserMetaData\n}\n\nexport type UpdatePasswordInput = {\n oldPassword?: string\n newPassword: string\n}\n","import type { PaginationOptions } from './result'\n\nexport enum CampaignTier {\n WIN = 'WIN',\n LOSE = 'LOSE',\n TOSSUP = 'TOSSUP',\n}\n\nexport enum BallotReadyPositionLevel {\n CITY = 'CITY',\n COUNTY = 'COUNTY',\n FEDERAL = 'FEDERAL',\n LOCAL = 'LOCAL',\n REGIONAL = 'REGIONAL',\n STATE = 'STATE',\n TOWNSHIP = 'TOWNSHIP',\n}\n\nexport enum ElectionLevel {\n state = 'state',\n county = 'county',\n federal = 'federal',\n city = 'city',\n}\n\nexport enum CampaignCreatedBy {\n ADMIN = 'admin',\n}\n\nexport enum CampaignLaunchStatus {\n launched = 'launched',\n}\n\nexport enum OnboardingStep {\n complete = 'onboarding-complete',\n registration = 'registration',\n}\n\nexport enum GenerationStatus {\n processing = 'processing',\n completed = 'completed',\n}\n\nexport type VoterGoals = {\n doorKnocking?: number\n calls?: number\n digital?: number\n directMail?: number\n digitalAds?: number\n text?: number\n events?: number\n yardSigns?: number\n robocall?: number\n phoneBanking?: number\n socialMedia?: number\n}\n\nexport type CustomVoterFile = {\n name: string\n channel?: string\n purpose?: string\n filters: string[]\n createdAt: string\n}\n\nexport type AiChatMessage = {\n role: 'user' | 'system' | 'assistant'\n content: string\n createdAt?: number\n id?: string\n usage?: number\n}\n\nexport type AiContentInputValues = Record<\n string,\n string | boolean | number | undefined\n>\n\nexport type AiContentGenerationStatus = {\n status: GenerationStatus\n createdAt: number\n prompt?: string\n existingChat?: AiChatMessage[]\n inputValues?: AiContentInputValues\n}\n\nexport type AiContentData = {\n name: string\n content: string\n updatedAt: number\n inputValues?: AiContentInputValues\n}\n\nexport type GeoLocation = { geoHash?: string; lng?: number; lat?: number }\n\nexport type CustomIssue = { title: string; position: string }\n\nexport type Opponent = { name: string; party: string; description: string }\n\nexport type HubSpotUpdates = Partial<Record<string, string>>\n\nexport type CampaignDetails = {\n state?: string\n ballotLevel?: BallotReadyPositionLevel\n electionDate?: string\n primaryElectionDate?: string\n zip?: string | null\n knowRun?: 'yes' | null\n runForOffice?: 'yes' | 'no' | null\n pledged?: boolean\n isProUpdatedAt?: number\n customIssues?: CustomIssue[]\n runningAgainst?: Opponent[]\n geoLocation?: GeoLocation\n geoLocationFailed?: boolean\n city?: string | null\n county?: string | null\n normalizedOffice?: string | null\n otherOffice?: string\n office?: string\n party?: string\n otherParty?: string\n district?: string\n raceId?: string\n level?: ElectionLevel | null\n noNormalizedOffice?: boolean\n website?: string\n pastExperience?: string | Record<string, string>\n occupation?: string\n funFact?: string\n campaignCommittee?: string\n statementName?: string\n subscriptionId?: string | null\n endOfElectionSubscriptionCanceled?: boolean\n subscriptionCanceledAt?: number | null\n subscriptionCancelAt?: number | null\n filingPeriodsStart?: string | null\n filingPeriodsEnd?: string | null\n officeTermLength?: string\n partisanType?: string\n priorElectionDates?: string[]\n positionId?: string | null\n electionId?: string | null\n tier?: string\n einNumber?: string | null\n einSupportingDocument?: string | null\n wonGeneral?: boolean\n}\n\nexport type CampaignData = {\n createdBy?: CampaignCreatedBy\n slug?: string\n hubSpotUpdates?: HubSpotUpdates\n currentStep?: OnboardingStep\n launchStatus?: CampaignLaunchStatus\n lastVisited?: number\n claimProfile?: string\n customVoterFiles?: CustomVoterFile[]\n reportedVoterGoals?: VoterGoals\n textCampaignCount?: number\n lastStepDate?: string\n adminUserEmail?: string\n hubspotId?: string\n name?: string\n}\n\nexport type CampaignAiContent = {\n generationStatus?: Record<string, AiContentGenerationStatus>\n campaignPlanAttempts?: Record<string, number>\n} & Record<string, AiContentData>\n\nexport type Campaign = {\n id: number\n createdAt: string\n updatedAt: string\n slug: string\n isActive: boolean\n isVerified?: boolean | null\n isPro?: boolean | null\n isDemo: boolean\n didWin?: boolean | null\n dateVerified?: string | null\n tier?: CampaignTier | null\n formattedAddress?: string | null\n placeId?: string | null\n data: CampaignData\n details: CampaignDetails\n aiContent: CampaignAiContent\n userId: number\n canDownloadFederal: boolean\n completedTaskIds: string[]\n hasFreeTextsOffer: boolean\n freeTextsOfferRedeemedAt?: string | null\n}\n\nexport type ListCampaignsOptions = PaginationOptions & {\n userId?: number\n slug?: string\n}\n\nexport type UpdateCampaignInput = {\n slug?: string\n isActive?: boolean\n isVerified?: boolean | null\n isPro?: boolean | null\n isDemo?: boolean\n didWin?: boolean | null\n dateVerified?: string | null\n tier?: CampaignTier | null\n formattedAddress?: string | null\n placeId?: string | null\n data?: CampaignData\n details?: CampaignDetails\n aiContent?: CampaignAiContent\n canDownloadFederal?: boolean\n completedTaskIds?: string[]\n hasFreeTextsOffer?: boolean\n freeTextsOfferRedeemedAt?: string | null\n}\n","import type { PaginationOptions } from './result'\n\nexport enum P2VStatus {\n complete = 'Complete',\n waiting = 'Waiting',\n failed = 'Failed',\n districtMatched = 'DistrictMatched',\n}\n\nexport enum P2VSource {\n GpApi = 'GpApi',\n ElectionApi = 'ElectionApi',\n}\n\nexport type ViabilityScore = {\n level: string\n isPartisan: boolean\n isIncumbent: boolean\n isUncontested: boolean\n candidates: number\n seats: number\n candidatesPerSeat: number\n score: number\n probOfWin: number\n}\n\nexport type PathToVictoryData = {\n p2vStatus?: P2VStatus\n p2vAttempts?: number\n p2vCompleteDate?: string\n completedBy?: number\n electionType?: string\n electionLocation?: string\n voterContactGoal?: number\n winNumber?: number\n p2vNotNeeded?: boolean\n totalRegisteredVoters?: number\n republicans?: number\n democrats?: number\n indies?: number\n women?: number\n men?: number\n white?: number\n asian?: number\n africanAmerican?: number\n hispanic?: number\n averageTurnout?: number\n projectedTurnout?: number\n viability?: ViabilityScore\n source?: P2VSource\n districtId?: string\n districtManuallySet?: boolean\n officeContextFingerprint?: string\n}\n\nexport type PathToVictory = {\n id: number\n createdAt: string\n updatedAt: string\n campaignId: number\n data: PathToVictoryData\n}\n\nexport type ListPathsToVictoryOptions = PaginationOptions & {\n userId?: number\n}\n\nexport type UpdatePathToVictoryInput = {\n data: PathToVictoryData\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAAiD;;;ACA1C,IAAM,WAAN,cAAuB,MAAM;AAAA,EACzB;AAAA,EACA;AAAA,EAET,YAAY,QAAgB,SAAiB,UAAqB;AAChE,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,WAAW;AAAA,EAClB;AACF;;;ADLO,IAAM,aAAN,MAAiB;AAAA,EACd;AAAA,EACA;AAAA,EAER,YAAY,cAAsB,UAAiC;AACjE,SAAK,UAAU;AACf,SAAK,WAAW;AAAA,EAClB;AAAA,EAEA,UAAU,OACR,MACA,SACe;AACf,QAAI;AACF,aAAO,UAAM,sBAAU,MAAM;AAAA,QAC3B,SAAS,KAAK;AAAA,QACd,SAAS;AAAA,UACP,eAAe,UAAU,MAAM,KAAK,SAAS,CAAC;AAAA,UAC9C,GAAI,MAAM,WAAW,CAAC;AAAA,QACxB;AAAA,QACA,GAAG;AAAA,MACL,CAAC;AAAA,IACH,SAAS,OAAgB;AACvB,UAAI,iBAAiB,0BAAY;AAC/B,cAAM,IAAI,SAAS,MAAM,cAAc,GAAG,MAAM,SAAS,MAAM,QAAQ;AAAA,MACzE;AACA,YAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU;AACzD,YAAM,IAAI,SAAS,GAAG,OAAO;AAAA,IAC/B;AAAA,EACF;AACF;;;AEhCO,IAAe,eAAf,MAA4B;AAAA,EACvB;AAAA,EAGV,YAAY,YAAwB;AAClC,SAAK,aAAa;AAAA,EACpB;AAAA,EAEU,aAAa,CACrB,MACA,UACe,KAAK,WAAW,QAAW,MAAM,EAAE,QAAQ,OAAO,MAAM,CAAC;AAAA,EAEh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AAA,GAAA;AAUL,IAAK,gBAAL,kBAAKC,mBAAL;AACL,EAAAA,eAAA,WAAQ;AACR,EAAAA,eAAA,YAAS;AACT,EAAAA,eAAA,aAAU;AACV,EAAAA,eAAA,UAAO;AAJG,SAAAA;AAAA,GAAA;AAOL,IAAK,oBAAL,kBAAKC,uBAAL;AACL,EAAAA,mBAAA,WAAQ;AADE,SAAAA;AAAA,GAAA;AAIL,IAAK,uBAAL,kBAAKC,0BAAL;AACL,EAAAA,sBAAA,cAAW;AADD,SAAAA;AAAA,GAAA;AAIL,IAAK,iBAAL,kBAAKC,oBAAL;AACL,EAAAA,gBAAA,cAAW;AACX,EAAAA,gBAAA,kBAAe;AAFL,SAAAA;AAAA,GAAA;AAKL,IAAK,mBAAL,kBAAKC,sBAAL;AACL,EAAAA,kBAAA,gBAAa;AACb,EAAAA,kBAAA,eAAY;AAFF,SAAAA;AAAA,GAAA;;;ACpCL,IAAK,YAAL,kBAAKC,eAAL;AACL,EAAAA,WAAA,cAAW;AACX,EAAAA,WAAA,aAAU;AACV,EAAAA,WAAA,YAAS;AACT,EAAAA,WAAA,qBAAkB;AAJR,SAAAA;AAAA,GAAA;AAOL,IAAK,YAAL,kBAAKC,eAAL;AACL,EAAAA,WAAA,WAAQ;AACR,EAAAA,WAAA,iBAAc;AAFJ,SAAAA;AAAA,GAAA;","names":["UserRole","WhyBrowsing","CampaignTier","BallotReadyPositionLevel","ElectionLevel","CampaignCreatedBy","CampaignLaunchStatus","OnboardingStep","GenerationStatus","P2VStatus","P2VSource"]}
package/dist/index.mjs CHANGED
@@ -64,6 +64,17 @@ var CampaignsResource = class extends BaseResource {
64
64
  update = (id, input) => this.putRequest(`${this.resourceBasePath}/${id}`, input);
65
65
  };
66
66
 
67
+ // src/resources/ElectedOfficesResource.ts
68
+ var ElectedOfficesResource = class extends BaseResource {
69
+ resourceBasePath = "/elected-office";
70
+ list = (options) => this.getRequest(
71
+ `${this.resourceBasePath}/list`,
72
+ options
73
+ );
74
+ get = (id) => this.getRequest(`${this.resourceBasePath}/${id}`);
75
+ update = (id, input) => this.putRequest(`${this.resourceBasePath}/${id}`, input);
76
+ };
77
+
67
78
  // src/resources/PathsToVictoryResource.ts
68
79
  var PathsToVictoryResource = class extends BaseResource {
69
80
  resourceBasePath = "/path-to-victory";
@@ -176,6 +187,7 @@ var ClerkService = class {
176
187
  var GoodPartyClient = class _GoodPartyClient {
177
188
  users;
178
189
  campaigns;
190
+ electedOffices;
179
191
  pathsToVictory;
180
192
  clerkService;
181
193
  constructor(clerkService, gpApiRootUrl) {
@@ -183,6 +195,7 @@ var GoodPartyClient = class _GoodPartyClient {
183
195
  const httpClient = new HttpClient(gpApiRootUrl, clerkService.getToken);
184
196
  this.users = new UsersResource(httpClient);
185
197
  this.campaigns = new CampaignsResource(httpClient);
198
+ this.electedOffices = new ElectedOfficesResource(httpClient);
186
199
  this.pathsToVictory = new PathsToVictoryResource(httpClient);
187
200
  }
188
201
  static create = async (config) => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/http/HttpClient.ts","../src/types/result.ts","../src/resources/BaseResource.ts","../src/resources/CampaignsResource.ts","../src/resources/PathsToVictoryResource.ts","../src/resources/UsersResource.ts","../src/vendor/clerk/clerk.service.ts","../src/GoodPartyClient.ts","../src/types/user.ts","../src/types/campaign.ts","../src/types/pathToVictory.ts"],"sourcesContent":["import { ofetch, FetchError, FetchOptions } from 'ofetch'\nimport { SdkError } from '../types/result'\n\nexport type OfetchRequestBody = FetchOptions<'json'>['body']\n\nexport class HttpClient {\n private baseUrl: string\n private getToken: () => Promise<string>\n\n constructor(gpApiRootUrl: string, getToken: () => Promise<string>) {\n this.baseUrl = gpApiRootUrl\n this.getToken = getToken\n }\n\n request = async <T>(\n path: string,\n init?: FetchOptions<'json'>,\n ): Promise<T> => {\n try {\n return await ofetch<T>(path, {\n baseURL: this.baseUrl,\n headers: {\n Authorization: `Bearer ${await this.getToken()}`,\n ...(init?.headers ?? {}),\n },\n ...init,\n })\n } catch (error: unknown) {\n if (error instanceof FetchError) {\n throw new SdkError(error.statusCode ?? 0, error.message, error.response)\n }\n const message = error instanceof Error ? error.message : 'Unknown error'\n throw new SdkError(0, message)\n }\n }\n}\n","export class SdkError extends Error {\n readonly status: number\n readonly response?: Response\n\n constructor(status: number, message: string, response?: Response) {\n super(message)\n this.name = 'SdkError'\n this.status = status\n this.response = response\n }\n}\n\nexport type PaginationOptions = {\n offset?: number\n limit?: number\n sortBy?: string\n sortOrder?: 'asc' | 'desc'\n}\n\nexport type PaginationMeta = {\n total: number\n offset: number\n limit: number\n}\n\nexport type PaginatedList<T> = {\n data: T[]\n meta: PaginationMeta\n}\n","import type { FetchOptions } from 'ofetch'\nimport type { HttpClient, OfetchRequestBody } from '../http/HttpClient'\n\nexport abstract class BaseResource {\n protected httpClient: HttpClient\n protected abstract readonly resourceBasePath: string\n\n constructor(httpClient: HttpClient) {\n this.httpClient = httpClient\n }\n\n protected getRequest = <T>(\n path: string,\n query?: FetchOptions<'json'>['query'],\n ): Promise<T> => this.httpClient.request<T>(path, { method: 'GET', query })\n\n protected postRequest = <T>(\n path: string,\n body: OfetchRequestBody,\n ): Promise<T> => this.httpClient.request<T>(path, { method: 'POST', body })\n\n protected putRequest = <T>(\n path: string,\n body: OfetchRequestBody,\n ): Promise<T> => this.httpClient.request<T>(path, { method: 'PUT', body })\n\n protected deleteRequest = <T>(path: string): Promise<T> =>\n this.httpClient.request<T>(path, { method: 'DELETE' })\n}\n","import type { PaginatedList } from '../types/result'\nimport type {\n Campaign,\n ListCampaignsOptions,\n UpdateCampaignInput,\n} from '../types/campaign'\nimport { BaseResource } from './BaseResource'\n\nexport class CampaignsResource extends BaseResource {\n protected readonly resourceBasePath = '/campaigns'\n\n get = (id: number): Promise<Campaign> =>\n this.getRequest<Campaign>(`${this.resourceBasePath}/${id}`)\n\n list = (options?: ListCampaignsOptions): Promise<PaginatedList<Campaign>> =>\n this.getRequest<PaginatedList<Campaign>>(\n `${this.resourceBasePath}/list`,\n options,\n )\n\n update = (id: number, input: UpdateCampaignInput): Promise<Campaign> =>\n this.putRequest<Campaign>(`${this.resourceBasePath}/${id}`, input)\n}\n","import type { PaginatedList } from '../types/result'\nimport type {\n ListPathsToVictoryOptions,\n PathToVictory,\n UpdatePathToVictoryInput,\n} from '../types/pathToVictory'\nimport { BaseResource } from './BaseResource'\n\nexport class PathsToVictoryResource extends BaseResource {\n protected resourceBasePath = '/path-to-victory'\n list = (\n options?: ListPathsToVictoryOptions,\n ): Promise<PaginatedList<PathToVictory>> =>\n this.getRequest<PaginatedList<PathToVictory>>(\n `${this.resourceBasePath}/list`,\n options,\n )\n\n get = (id: number): Promise<PathToVictory> =>\n this.getRequest<PathToVictory>(`${this.resourceBasePath}/${id}`)\n\n update = (\n id: number,\n input: UpdatePathToVictoryInput,\n ): Promise<PathToVictory> =>\n this.putRequest<PathToVictory>(`${this.resourceBasePath}/${id}`, input)\n}\n","import type { PaginatedList } from '../types/result'\nimport type {\n ListUsersOptions,\n UpdatePasswordInput,\n UpdateUserInput,\n User,\n} from '../types/user'\nimport { BaseResource } from './BaseResource'\n\nexport class UsersResource extends BaseResource {\n protected readonly resourceBasePath = '/users'\n\n list = (options?: ListUsersOptions): Promise<PaginatedList<User>> =>\n this.getRequest<PaginatedList<User>>(this.resourceBasePath, options)\n\n get = (id: number): Promise<User> => this.getRequest<User>(`/users/${id}`)\n\n update = (id: number, input: UpdateUserInput): Promise<User> =>\n this.putRequest<User>(`${this.resourceBasePath}/${id}`, input)\n\n delete = (id: number): Promise<void> =>\n this.deleteRequest<void>(`${this.resourceBasePath}/${id}`)\n\n updatePassword = (id: number, input: UpdatePasswordInput): Promise<void> =>\n this.putRequest<void>(`${this.resourceBasePath}/${id}/password`, input)\n}\n","import { createClerkClient } from '@clerk/backend'\nimport { SdkError } from '../../types/result'\n\nconst TOKEN_RENEWAL_BUFFER_MS = 30_000\n\nexport class ClerkService {\n private readonly m2mSecret: string\n private readonly clerkClient: ReturnType<typeof createClerkClient>\n private cachedToken: string | null = null\n private tokenExpiration: number | null = null\n private renewalTimer: ReturnType<typeof setTimeout> | null = null\n private pendingTokenPromise: Promise<string> | null = null\n private destroyed = false\n\n constructor(m2mSecret: string) {\n this.m2mSecret = m2mSecret\n this.clerkClient = createClerkClient({})\n }\n\n getToken = async (): Promise<string> => {\n if (this.cachedToken && this.isTokenValid()) {\n return this.cachedToken\n }\n\n if (this.pendingTokenPromise) {\n return this.pendingTokenPromise\n }\n\n const promise = this.createAndCacheToken()\n this.pendingTokenPromise = promise\n\n try {\n return await promise\n } finally {\n if (this.pendingTokenPromise === promise) {\n this.pendingTokenPromise = null\n }\n }\n }\n\n destroy = (): void => {\n this.destroyed = true\n if (this.renewalTimer) {\n clearTimeout(this.renewalTimer)\n this.renewalTimer = null\n }\n this.cachedToken = null\n this.tokenExpiration = null\n this.pendingTokenPromise = null\n }\n\n private isTokenValid = (): boolean => {\n if (!this.tokenExpiration) return true\n return Date.now() < this.tokenExpiration - TOKEN_RENEWAL_BUFFER_MS\n }\n\n private createAndCacheToken = async (): Promise<string> => {\n try {\n const m2mToken = await this.clerkClient.m2m.createToken({\n machineSecretKey: this.m2mSecret,\n })\n\n if (!m2mToken.token) {\n throw new SdkError(\n 0,\n 'Clerk M2M token creation succeeded but returned no token string',\n )\n }\n\n if (this.destroyed) return m2mToken.token\n\n this.cachedToken = m2mToken.token\n this.tokenExpiration = m2mToken.expiration\n this.scheduleRenewal()\n\n return this.cachedToken\n } catch (error: unknown) {\n if (error instanceof SdkError) {\n throw error\n }\n const message = error instanceof Error ? error.message : 'Unknown error'\n throw new SdkError(0, `Failed to create Clerk M2M token: ${message}`)\n }\n }\n\n private scheduleRenewal = (): void => {\n if (this.renewalTimer) {\n clearTimeout(this.renewalTimer)\n this.renewalTimer = null\n }\n\n if (!this.tokenExpiration) return\n\n const timeUntilRenewal =\n this.tokenExpiration - Date.now() - TOKEN_RENEWAL_BUFFER_MS\n\n if (timeUntilRenewal <= 0) return\n\n this.renewalTimer = setTimeout(() => {\n this.cachedToken = null\n this.getToken().catch((error: unknown) => {\n console.error('Proactive M2M token renewal failed:', error)\n })\n }, timeUntilRenewal)\n }\n}\n","import { HttpClient } from './http/HttpClient'\nimport { CampaignsResource } from './resources/CampaignsResource'\nimport { PathsToVictoryResource } from './resources/PathsToVictoryResource'\nimport { UsersResource } from './resources/UsersResource'\nimport { ClerkService } from './vendor/clerk/clerk.service'\n\nexport type GoodPartyClientConfig = {\n m2mSecret: string\n gpApiRootUrl: string\n}\n\nexport class GoodPartyClient {\n readonly users: UsersResource\n readonly campaigns: CampaignsResource\n readonly pathsToVictory: PathsToVictoryResource\n private clerkService: ClerkService\n\n private constructor(clerkService: ClerkService, gpApiRootUrl: string) {\n this.clerkService = clerkService\n const httpClient = new HttpClient(gpApiRootUrl, clerkService.getToken)\n this.users = new UsersResource(httpClient)\n this.campaigns = new CampaignsResource(httpClient)\n this.pathsToVictory = new PathsToVictoryResource(httpClient)\n }\n\n static create = async (\n config: GoodPartyClientConfig,\n ): Promise<GoodPartyClient> => {\n const { m2mSecret, gpApiRootUrl } = config\n const clerkService = new ClerkService(m2mSecret)\n await clerkService.getToken()\n return new GoodPartyClient(clerkService, gpApiRootUrl)\n }\n\n destroy = (): void => {\n this.clerkService.destroy()\n }\n}\n","import type { PaginationOptions } from './result'\n\nexport enum UserRole {\n admin = 'admin',\n sales = 'sales',\n candidate = 'candidate',\n campaignManager = 'campaignManager',\n demo = 'demo',\n}\n\nexport enum WhyBrowsing {\n considering = 'considering',\n learning = 'learning',\n test = 'test',\n else = 'else',\n}\n\nexport enum SIGN_UP_MODE {\n CANDIDATE = 'candidate',\n FACILITATED = 'facilitated',\n}\n\nexport type UserMetaData = {\n customerId?: string\n checkoutSessionId?: string | null\n accountType?: string | null\n lastVisited?: number\n sessionCount?: number\n isDeleted?: boolean\n fsUserId?: string\n whyBrowsing?: WhyBrowsing | null\n hubspotId?: string\n profile_updated_count?: number\n textNotifications?: boolean\n} | null\n\nexport type User = {\n id: number\n firstName: string\n lastName: string\n name?: string | null\n email: string\n phone?: string | null\n zip?: string | null\n avatar?: string | null\n hasPassword: boolean\n roles?: UserRole[]\n metaData?: UserMetaData\n}\n\nexport type ListUsersOptions = PaginationOptions & {\n firstName?: string\n lastName?: string\n email?: string\n}\n\nexport type UpdateUserInput = {\n firstName?: string\n lastName?: string\n email?: string\n name?: string\n zip?: string\n phone?: string\n roles?: UserRole[]\n signUpMode?: SIGN_UP_MODE\n allowTexts?: boolean\n metaData?: UserMetaData\n}\n\nexport type UpdatePasswordInput = {\n oldPassword?: string\n newPassword: string\n}\n","import type { PaginationOptions } from './result'\n\nexport enum CampaignTier {\n WIN = 'WIN',\n LOSE = 'LOSE',\n TOSSUP = 'TOSSUP',\n}\n\nexport enum BallotReadyPositionLevel {\n CITY = 'CITY',\n COUNTY = 'COUNTY',\n FEDERAL = 'FEDERAL',\n LOCAL = 'LOCAL',\n REGIONAL = 'REGIONAL',\n STATE = 'STATE',\n TOWNSHIP = 'TOWNSHIP',\n}\n\nexport enum ElectionLevel {\n state = 'state',\n county = 'county',\n federal = 'federal',\n city = 'city',\n}\n\nexport enum CampaignCreatedBy {\n ADMIN = 'admin',\n}\n\nexport enum CampaignLaunchStatus {\n launched = 'launched',\n}\n\nexport enum OnboardingStep {\n complete = 'onboarding-complete',\n registration = 'registration',\n}\n\nexport enum GenerationStatus {\n processing = 'processing',\n completed = 'completed',\n}\n\nexport type VoterGoals = {\n doorKnocking?: number\n calls?: number\n digital?: number\n directMail?: number\n digitalAds?: number\n text?: number\n events?: number\n yardSigns?: number\n robocall?: number\n phoneBanking?: number\n socialMedia?: number\n}\n\nexport type CustomVoterFile = {\n name: string\n channel?: string\n purpose?: string\n filters: string[]\n createdAt: string\n}\n\nexport type AiChatMessage = {\n role: 'user' | 'system' | 'assistant'\n content: string\n createdAt?: number\n id?: string\n usage?: number\n}\n\nexport type AiContentInputValues = Record<\n string,\n string | boolean | number | undefined\n>\n\nexport type AiContentGenerationStatus = {\n status: GenerationStatus\n createdAt: number\n prompt?: string\n existingChat?: AiChatMessage[]\n inputValues?: AiContentInputValues\n}\n\nexport type AiContentData = {\n name: string\n content: string\n updatedAt: number\n inputValues?: AiContentInputValues\n}\n\nexport type GeoLocation = { geoHash?: string; lng?: number; lat?: number }\n\nexport type CustomIssue = { title: string; position: string }\n\nexport type Opponent = { name: string; party: string; description: string }\n\nexport type HubSpotUpdates = Partial<Record<string, string>>\n\nexport type CampaignDetails = {\n state?: string\n ballotLevel?: BallotReadyPositionLevel\n electionDate?: string\n primaryElectionDate?: string\n zip?: string | null\n knowRun?: 'yes' | null\n runForOffice?: 'yes' | 'no' | null\n pledged?: boolean\n isProUpdatedAt?: number\n customIssues?: CustomIssue[]\n runningAgainst?: Opponent[]\n geoLocation?: GeoLocation\n geoLocationFailed?: boolean\n city?: string | null\n county?: string | null\n normalizedOffice?: string | null\n otherOffice?: string\n office?: string\n party?: string\n otherParty?: string\n district?: string\n raceId?: string\n level?: ElectionLevel | null\n noNormalizedOffice?: boolean\n website?: string\n pastExperience?: string | Record<string, string>\n occupation?: string\n funFact?: string\n campaignCommittee?: string\n statementName?: string\n subscriptionId?: string | null\n endOfElectionSubscriptionCanceled?: boolean\n subscriptionCanceledAt?: number | null\n subscriptionCancelAt?: number | null\n filingPeriodsStart?: string | null\n filingPeriodsEnd?: string | null\n officeTermLength?: string\n partisanType?: string\n priorElectionDates?: string[]\n positionId?: string | null\n electionId?: string | null\n tier?: string\n einNumber?: string | null\n einSupportingDocument?: string | null\n wonGeneral?: boolean\n}\n\nexport type CampaignData = {\n createdBy?: CampaignCreatedBy\n slug?: string\n hubSpotUpdates?: HubSpotUpdates\n currentStep?: OnboardingStep\n launchStatus?: CampaignLaunchStatus\n lastVisited?: number\n claimProfile?: string\n customVoterFiles?: CustomVoterFile[]\n reportedVoterGoals?: VoterGoals\n textCampaignCount?: number\n lastStepDate?: string\n adminUserEmail?: string\n hubspotId?: string\n name?: string\n}\n\nexport type CampaignAiContent = {\n generationStatus?: Record<string, AiContentGenerationStatus>\n campaignPlanAttempts?: Record<string, number>\n} & Record<string, AiContentData>\n\nexport type Campaign = {\n id: number\n createdAt: string\n updatedAt: string\n slug: string\n isActive: boolean\n isVerified?: boolean | null\n isPro?: boolean | null\n isDemo: boolean\n didWin?: boolean | null\n dateVerified?: string | null\n tier?: CampaignTier | null\n formattedAddress?: string | null\n placeId?: string | null\n data: CampaignData\n details: CampaignDetails\n aiContent: CampaignAiContent\n userId: number\n canDownloadFederal: boolean\n completedTaskIds: string[]\n hasFreeTextsOffer: boolean\n freeTextsOfferRedeemedAt?: string | null\n}\n\nexport type ListCampaignsOptions = PaginationOptions & {\n userId?: number\n slug?: string\n}\n\nexport type UpdateCampaignInput = {\n slug?: string\n isActive?: boolean\n isVerified?: boolean | null\n isPro?: boolean | null\n isDemo?: boolean\n didWin?: boolean | null\n dateVerified?: string | null\n tier?: CampaignTier | null\n formattedAddress?: string | null\n placeId?: string | null\n data?: CampaignData\n details?: CampaignDetails\n aiContent?: CampaignAiContent\n canDownloadFederal?: boolean\n completedTaskIds?: string[]\n hasFreeTextsOffer?: boolean\n freeTextsOfferRedeemedAt?: string | null\n}\n","import type { PaginationOptions } from './result'\n\nexport enum P2VStatus {\n complete = 'Complete',\n waiting = 'Waiting',\n failed = 'Failed',\n districtMatched = 'DistrictMatched',\n}\n\nexport enum P2VSource {\n GpApi = 'GpApi',\n ElectionApi = 'ElectionApi',\n}\n\nexport type ViabilityScore = {\n level: string\n isPartisan: boolean\n isIncumbent: boolean\n isUncontested: boolean\n candidates: number\n seats: number\n candidatesPerSeat: number\n score: number\n probOfWin: number\n}\n\nexport type PathToVictoryData = {\n p2vStatus?: P2VStatus\n p2vAttempts?: number\n p2vCompleteDate?: string\n completedBy?: number\n electionType?: string\n electionLocation?: string\n voterContactGoal?: number\n winNumber?: number\n p2vNotNeeded?: boolean\n totalRegisteredVoters?: number\n republicans?: number\n democrats?: number\n indies?: number\n women?: number\n men?: number\n white?: number\n asian?: number\n africanAmerican?: number\n hispanic?: number\n averageTurnout?: number\n projectedTurnout?: number\n viability?: ViabilityScore\n source?: P2VSource\n districtId?: string\n districtManuallySet?: boolean\n officeContextFingerprint?: string\n}\n\nexport type PathToVictory = {\n id: number\n createdAt: string\n updatedAt: string\n campaignId: number\n data: PathToVictoryData\n}\n\nexport type ListPathsToVictoryOptions = PaginationOptions & {\n userId?: number\n}\n\nexport type UpdatePathToVictoryInput = {\n data: PathToVictoryData\n}\n"],"mappings":";AAAA,SAAS,QAAQ,kBAAgC;;;ACA1C,IAAM,WAAN,cAAuB,MAAM;AAAA,EACzB;AAAA,EACA;AAAA,EAET,YAAY,QAAgB,SAAiB,UAAqB;AAChE,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,WAAW;AAAA,EAClB;AACF;;;ADLO,IAAM,aAAN,MAAiB;AAAA,EACd;AAAA,EACA;AAAA,EAER,YAAY,cAAsB,UAAiC;AACjE,SAAK,UAAU;AACf,SAAK,WAAW;AAAA,EAClB;AAAA,EAEA,UAAU,OACR,MACA,SACe;AACf,QAAI;AACF,aAAO,MAAM,OAAU,MAAM;AAAA,QAC3B,SAAS,KAAK;AAAA,QACd,SAAS;AAAA,UACP,eAAe,UAAU,MAAM,KAAK,SAAS,CAAC;AAAA,UAC9C,GAAI,MAAM,WAAW,CAAC;AAAA,QACxB;AAAA,QACA,GAAG;AAAA,MACL,CAAC;AAAA,IACH,SAAS,OAAgB;AACvB,UAAI,iBAAiB,YAAY;AAC/B,cAAM,IAAI,SAAS,MAAM,cAAc,GAAG,MAAM,SAAS,MAAM,QAAQ;AAAA,MACzE;AACA,YAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU;AACzD,YAAM,IAAI,SAAS,GAAG,OAAO;AAAA,IAC/B;AAAA,EACF;AACF;;;AEhCO,IAAe,eAAf,MAA4B;AAAA,EACvB;AAAA,EAGV,YAAY,YAAwB;AAClC,SAAK,aAAa;AAAA,EACpB;AAAA,EAEU,aAAa,C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AAAA,sBAAA,cAAW;AADD,SAAAA;AAAA,GAAA;AAIL,IAAK,iBAAL,kBAAKC,oBAAL;AACL,EAAAA,gBAAA,cAAW;AACX,EAAAA,gBAAA,kBAAe;AAFL,SAAAA;AAAA,GAAA;AAKL,IAAK,mBAAL,kBAAKC,sBAAL;AACL,EAAAA,kBAAA,gBAAa;AACb,EAAAA,kBAAA,eAAY;AAFF,SAAAA;AAAA,GAAA;;;ACpCL,IAAK,YAAL,kBAAKC,eAAL;AACL,EAAAA,WAAA,cAAW;AACX,EAAAA,WAAA,aAAU;AACV,EAAAA,WAAA,YAAS;AACT,EAAAA,WAAA,qBAAkB;AAJR,SAAAA;AAAA,GAAA;AAOL,IAAK,YAAL,kBAAKC,eAAL;AACL,EAAAA,WAAA,WAAQ;AACR,EAAAA,WAAA,iBAAc;AAFJ,SAAAA;AAAA,GAAA;","names":["UserRole","WhyBrowsing","CampaignTier","BallotReadyPositionLevel","ElectionLevel","CampaignCreatedBy","CampaignLaunchStatus","OnboardingStep","GenerationStatus","P2VStatus","P2VSource"]}
1
+ {"version":3,"sources":["../src/http/HttpClient.ts","../src/types/result.ts","../src/resources/BaseResource.ts","../src/resources/CampaignsResource.ts","../src/resources/ElectedOfficesResource.ts","../src/resources/PathsToVictoryResource.ts","../src/resources/UsersResource.ts","../src/vendor/clerk/clerk.service.ts","../src/GoodPartyClient.ts","../src/types/user.ts","../src/types/campaign.ts","../src/types/pathToVictory.ts"],"sourcesContent":["import { ofetch, FetchError, FetchOptions } from 'ofetch'\nimport { SdkError } from '../types/result'\n\nexport type OfetchRequestBody = FetchOptions<'json'>['body']\n\nexport class HttpClient {\n private baseUrl: string\n private getToken: () => Promise<string>\n\n constructor(gpApiRootUrl: string, getToken: () => Promise<string>) {\n this.baseUrl = gpApiRootUrl\n this.getToken = getToken\n }\n\n request = async <T>(\n path: string,\n init?: FetchOptions<'json'>,\n ): Promise<T> => {\n try {\n return await ofetch<T>(path, {\n baseURL: this.baseUrl,\n headers: {\n Authorization: `Bearer ${await this.getToken()}`,\n ...(init?.headers ?? {}),\n },\n ...init,\n })\n } catch (error: unknown) {\n if (error instanceof FetchError) {\n throw new SdkError(error.statusCode ?? 0, error.message, error.response)\n }\n const message = error instanceof Error ? error.message : 'Unknown error'\n throw new SdkError(0, message)\n }\n }\n}\n","export class SdkError extends Error {\n readonly status: number\n readonly response?: Response\n\n constructor(status: number, message: string, response?: Response) {\n super(message)\n this.name = 'SdkError'\n this.status = status\n this.response = response\n }\n}\n\nexport type PaginationOptions = {\n offset?: number\n limit?: number\n sortBy?: string\n sortOrder?: 'asc' | 'desc'\n}\n\nexport type PaginationMeta = {\n total: number\n offset: number\n limit: number\n}\n\nexport type PaginatedList<T> = {\n data: T[]\n meta: PaginationMeta\n}\n","import type { FetchOptions } from 'ofetch'\nimport type { HttpClient, OfetchRequestBody } from '../http/HttpClient'\n\nexport abstract class BaseResource {\n protected httpClient: HttpClient\n protected abstract readonly resourceBasePath: string\n\n constructor(httpClient: HttpClient) {\n this.httpClient = httpClient\n }\n\n protected getRequest = <T>(\n path: string,\n query?: FetchOptions<'json'>['query'],\n ): Promise<T> => this.httpClient.request<T>(path, { method: 'GET', query })\n\n protected postRequest = <T>(\n path: string,\n body: OfetchRequestBody,\n ): Promise<T> => this.httpClient.request<T>(path, { method: 'POST', body })\n\n protected putRequest = <T>(\n path: string,\n body: OfetchRequestBody,\n ): Promise<T> => this.httpClient.request<T>(path, { method: 'PUT', body })\n\n protected deleteRequest = <T>(path: string): Promise<T> =>\n this.httpClient.request<T>(path, { method: 'DELETE' })\n}\n","import type { PaginatedList } from '../types/result'\nimport type {\n Campaign,\n ListCampaignsOptions,\n UpdateCampaignInput,\n} from '../types/campaign'\nimport { BaseResource } from './BaseResource'\n\nexport class CampaignsResource extends BaseResource {\n protected readonly resourceBasePath = '/campaigns'\n\n get = (id: number): Promise<Campaign> =>\n this.getRequest<Campaign>(`${this.resourceBasePath}/${id}`)\n\n list = (options?: ListCampaignsOptions): Promise<PaginatedList<Campaign>> =>\n this.getRequest<PaginatedList<Campaign>>(\n `${this.resourceBasePath}/list`,\n options,\n )\n\n update = (id: number, input: UpdateCampaignInput): Promise<Campaign> =>\n this.putRequest<Campaign>(`${this.resourceBasePath}/${id}`, input)\n}\n","import type { PaginatedList } from '../types/result'\nimport type {\n ElectedOffice,\n ListElectedOfficesOptions,\n UpdateElectedOfficeInput,\n} from '../types/electedOffice'\nimport { BaseResource } from './BaseResource'\n\nexport class ElectedOfficesResource extends BaseResource {\n protected readonly resourceBasePath = '/elected-office'\n\n list = (\n options?: ListElectedOfficesOptions,\n ): Promise<PaginatedList<ElectedOffice>> =>\n this.getRequest<PaginatedList<ElectedOffice>>(\n `${this.resourceBasePath}/list`,\n options,\n )\n\n get = (id: string): Promise<ElectedOffice> =>\n this.getRequest<ElectedOffice>(`${this.resourceBasePath}/${id}`)\n\n update = (\n id: string,\n input: UpdateElectedOfficeInput,\n ): Promise<ElectedOffice> =>\n this.putRequest<ElectedOffice>(`${this.resourceBasePath}/${id}`, input)\n}\n","import type { PaginatedList } from '../types/result'\nimport type {\n ListPathsToVictoryOptions,\n PathToVictory,\n UpdatePathToVictoryInput,\n} from '../types/pathToVictory'\nimport { BaseResource } from './BaseResource'\n\nexport class PathsToVictoryResource extends BaseResource {\n protected resourceBasePath = '/path-to-victory'\n list = (\n options?: ListPathsToVictoryOptions,\n ): Promise<PaginatedList<PathToVictory>> =>\n this.getRequest<PaginatedList<PathToVictory>>(\n `${this.resourceBasePath}/list`,\n options,\n )\n\n get = (id: number): Promise<PathToVictory> =>\n this.getRequest<PathToVictory>(`${this.resourceBasePath}/${id}`)\n\n update = (\n id: number,\n input: UpdatePathToVictoryInput,\n ): Promise<PathToVictory> =>\n this.putRequest<PathToVictory>(`${this.resourceBasePath}/${id}`, input)\n}\n","import type { PaginatedList } from '../types/result'\nimport type {\n ListUsersOptions,\n UpdatePasswordInput,\n UpdateUserInput,\n User,\n} from '../types/user'\nimport { BaseResource } from './BaseResource'\n\nexport class UsersResource extends BaseResource {\n protected readonly resourceBasePath = '/users'\n\n list = (options?: ListUsersOptions): Promise<PaginatedList<User>> =>\n this.getRequest<PaginatedList<User>>(this.resourceBasePath, options)\n\n get = (id: number): Promise<User> => this.getRequest<User>(`/users/${id}`)\n\n update = (id: number, input: UpdateUserInput): Promise<User> =>\n this.putRequest<User>(`${this.resourceBasePath}/${id}`, input)\n\n delete = (id: number): Promise<void> =>\n this.deleteRequest<void>(`${this.resourceBasePath}/${id}`)\n\n updatePassword = (id: number, input: UpdatePasswordInput): Promise<void> =>\n this.putRequest<void>(`${this.resourceBasePath}/${id}/password`, input)\n}\n","import { createClerkClient } from '@clerk/backend'\nimport { SdkError } from '../../types/result'\n\nconst TOKEN_RENEWAL_BUFFER_MS = 30_000\n\nexport class ClerkService {\n private readonly m2mSecret: string\n private readonly clerkClient: ReturnType<typeof createClerkClient>\n private cachedToken: string | null = null\n private tokenExpiration: number | null = null\n private renewalTimer: ReturnType<typeof setTimeout> | null = null\n private pendingTokenPromise: Promise<string> | null = null\n private destroyed = false\n\n constructor(m2mSecret: string) {\n this.m2mSecret = m2mSecret\n this.clerkClient = createClerkClient({})\n }\n\n getToken = async (): Promise<string> => {\n if (this.cachedToken && this.isTokenValid()) {\n return this.cachedToken\n }\n\n if (this.pendingTokenPromise) {\n return this.pendingTokenPromise\n }\n\n const promise = this.createAndCacheToken()\n this.pendingTokenPromise = promise\n\n try {\n return await promise\n } finally {\n if (this.pendingTokenPromise === promise) {\n this.pendingTokenPromise = null\n }\n }\n }\n\n destroy = (): void => {\n this.destroyed = true\n if (this.renewalTimer) {\n clearTimeout(this.renewalTimer)\n this.renewalTimer = null\n }\n this.cachedToken = null\n this.tokenExpiration = null\n this.pendingTokenPromise = null\n }\n\n private isTokenValid = (): boolean => {\n if (!this.tokenExpiration) return true\n return Date.now() < this.tokenExpiration - TOKEN_RENEWAL_BUFFER_MS\n }\n\n private createAndCacheToken = async (): Promise<string> => {\n try {\n const m2mToken = await this.clerkClient.m2m.createToken({\n machineSecretKey: this.m2mSecret,\n })\n\n if (!m2mToken.token) {\n throw new SdkError(\n 0,\n 'Clerk M2M token creation succeeded but returned no token string',\n )\n }\n\n if (this.destroyed) return m2mToken.token\n\n this.cachedToken = m2mToken.token\n this.tokenExpiration = m2mToken.expiration\n this.scheduleRenewal()\n\n return this.cachedToken\n } catch (error: unknown) {\n if (error instanceof SdkError) {\n throw error\n }\n const message = error instanceof Error ? error.message : 'Unknown error'\n throw new SdkError(0, `Failed to create Clerk M2M token: ${message}`)\n }\n }\n\n private scheduleRenewal = (): void => {\n if (this.renewalTimer) {\n clearTimeout(this.renewalTimer)\n this.renewalTimer = null\n }\n\n if (!this.tokenExpiration) return\n\n const timeUntilRenewal =\n this.tokenExpiration - Date.now() - TOKEN_RENEWAL_BUFFER_MS\n\n if (timeUntilRenewal <= 0) return\n\n this.renewalTimer = setTimeout(() => {\n this.cachedToken = null\n this.getToken().catch((error: unknown) => {\n console.error('Proactive M2M token renewal failed:', error)\n })\n }, timeUntilRenewal)\n }\n}\n","import { HttpClient } from './http/HttpClient'\nimport { CampaignsResource } from './resources/CampaignsResource'\nimport { ElectedOfficesResource } from './resources/ElectedOfficesResource'\nimport { PathsToVictoryResource } from './resources/PathsToVictoryResource'\nimport { UsersResource } from './resources/UsersResource'\nimport { ClerkService } from './vendor/clerk/clerk.service'\n\nexport type GoodPartyClientConfig = {\n m2mSecret: string\n gpApiRootUrl: string\n}\n\nexport class GoodPartyClient {\n readonly users: UsersResource\n readonly campaigns: CampaignsResource\n readonly electedOffices: ElectedOfficesResource\n readonly pathsToVictory: PathsToVictoryResource\n private clerkService: ClerkService\n\n private constructor(clerkService: ClerkService, gpApiRootUrl: string) {\n this.clerkService = clerkService\n const httpClient = new HttpClient(gpApiRootUrl, clerkService.getToken)\n this.users = new UsersResource(httpClient)\n this.campaigns = new CampaignsResource(httpClient)\n this.electedOffices = new ElectedOfficesResource(httpClient)\n this.pathsToVictory = new PathsToVictoryResource(httpClient)\n }\n\n static create = async (\n config: GoodPartyClientConfig,\n ): Promise<GoodPartyClient> => {\n const { m2mSecret, gpApiRootUrl } = config\n const clerkService = new ClerkService(m2mSecret)\n await clerkService.getToken()\n return new GoodPartyClient(clerkService, gpApiRootUrl)\n }\n\n destroy = (): void => {\n this.clerkService.destroy()\n }\n}\n","import type { PaginationOptions } from './result'\n\nexport enum UserRole {\n admin = 'admin',\n sales = 'sales',\n candidate = 'candidate',\n campaignManager = 'campaignManager',\n demo = 'demo',\n}\n\nexport enum WhyBrowsing {\n considering = 'considering',\n learning = 'learning',\n test = 'test',\n else = 'else',\n}\n\nexport enum SIGN_UP_MODE {\n CANDIDATE = 'candidate',\n FACILITATED = 'facilitated',\n}\n\nexport type UserMetaData = {\n customerId?: string\n checkoutSessionId?: string | null\n accountType?: string | null\n lastVisited?: number\n sessionCount?: number\n isDeleted?: boolean\n fsUserId?: string\n whyBrowsing?: WhyBrowsing | null\n hubspotId?: string\n profile_updated_count?: number\n textNotifications?: boolean\n} | null\n\nexport type User = {\n id: number\n firstName: string\n lastName: string\n name?: string | null\n email: string\n phone?: string | null\n zip?: string | null\n avatar?: string | null\n hasPassword: boolean\n roles?: UserRole[]\n metaData?: UserMetaData\n}\n\nexport type ListUsersOptions = PaginationOptions & {\n firstName?: string\n lastName?: string\n email?: string\n}\n\nexport type UpdateUserInput = {\n firstName?: string\n lastName?: string\n email?: string\n name?: string\n zip?: string\n phone?: string\n roles?: UserRole[]\n signUpMode?: SIGN_UP_MODE\n allowTexts?: boolean\n metaData?: UserMetaData\n}\n\nexport type UpdatePasswordInput = {\n oldPassword?: string\n newPassword: string\n}\n","import type { PaginationOptions } from './result'\n\nexport enum CampaignTier {\n WIN = 'WIN',\n LOSE = 'LOSE',\n TOSSUP = 'TOSSUP',\n}\n\nexport enum BallotReadyPositionLevel {\n CITY = 'CITY',\n COUNTY = 'COUNTY',\n FEDERAL = 'FEDERAL',\n LOCAL = 'LOCAL',\n REGIONAL = 'REGIONAL',\n STATE = 'STATE',\n TOWNSHIP = 'TOWNSHIP',\n}\n\nexport enum ElectionLevel {\n state = 'state',\n county = 'county',\n federal = 'federal',\n city = 'city',\n}\n\nexport enum CampaignCreatedBy {\n ADMIN = 'admin',\n}\n\nexport enum CampaignLaunchStatus {\n launched = 'launched',\n}\n\nexport enum OnboardingStep {\n complete = 'onboarding-complete',\n registration = 'registration',\n}\n\nexport enum GenerationStatus {\n processing = 'processing',\n completed = 'completed',\n}\n\nexport type VoterGoals = {\n doorKnocking?: number\n calls?: number\n digital?: number\n directMail?: number\n digitalAds?: number\n text?: number\n events?: number\n yardSigns?: number\n robocall?: number\n phoneBanking?: number\n socialMedia?: number\n}\n\nexport type CustomVoterFile = {\n name: string\n channel?: string\n purpose?: string\n filters: string[]\n createdAt: string\n}\n\nexport type AiChatMessage = {\n role: 'user' | 'system' | 'assistant'\n content: string\n createdAt?: number\n id?: string\n usage?: number\n}\n\nexport type AiContentInputValues = Record<\n string,\n string | boolean | number | undefined\n>\n\nexport type AiContentGenerationStatus = {\n status: GenerationStatus\n createdAt: number\n prompt?: string\n existingChat?: AiChatMessage[]\n inputValues?: AiContentInputValues\n}\n\nexport type AiContentData = {\n name: string\n content: string\n updatedAt: number\n inputValues?: AiContentInputValues\n}\n\nexport type GeoLocation = { geoHash?: string; lng?: number; lat?: number }\n\nexport type CustomIssue = { title: string; position: string }\n\nexport type Opponent = { name: string; party: string; description: string }\n\nexport type HubSpotUpdates = Partial<Record<string, string>>\n\nexport type CampaignDetails = {\n state?: string\n ballotLevel?: BallotReadyPositionLevel\n electionDate?: string\n primaryElectionDate?: string\n zip?: string | null\n knowRun?: 'yes' | null\n runForOffice?: 'yes' | 'no' | null\n pledged?: boolean\n isProUpdatedAt?: number\n customIssues?: CustomIssue[]\n runningAgainst?: Opponent[]\n geoLocation?: GeoLocation\n geoLocationFailed?: boolean\n city?: string | null\n county?: string | null\n normalizedOffice?: string | null\n otherOffice?: string\n office?: string\n party?: string\n otherParty?: string\n district?: string\n raceId?: string\n level?: ElectionLevel | null\n noNormalizedOffice?: boolean\n website?: string\n pastExperience?: string | Record<string, string>\n occupation?: string\n funFact?: string\n campaignCommittee?: string\n statementName?: string\n subscriptionId?: string | null\n endOfElectionSubscriptionCanceled?: boolean\n subscriptionCanceledAt?: number | null\n subscriptionCancelAt?: number | null\n filingPeriodsStart?: string | null\n filingPeriodsEnd?: string | null\n officeTermLength?: string\n partisanType?: string\n priorElectionDates?: string[]\n positionId?: string | null\n electionId?: string | null\n tier?: string\n einNumber?: string | null\n einSupportingDocument?: string | null\n wonGeneral?: boolean\n}\n\nexport type CampaignData = {\n createdBy?: CampaignCreatedBy\n slug?: string\n hubSpotUpdates?: HubSpotUpdates\n currentStep?: OnboardingStep\n launchStatus?: CampaignLaunchStatus\n lastVisited?: number\n claimProfile?: string\n customVoterFiles?: CustomVoterFile[]\n reportedVoterGoals?: VoterGoals\n textCampaignCount?: number\n lastStepDate?: string\n adminUserEmail?: string\n hubspotId?: string\n name?: string\n}\n\nexport type CampaignAiContent = {\n generationStatus?: Record<string, AiContentGenerationStatus>\n campaignPlanAttempts?: Record<string, number>\n} & Record<string, AiContentData>\n\nexport type Campaign = {\n id: number\n createdAt: string\n updatedAt: string\n slug: string\n isActive: boolean\n isVerified?: boolean | null\n isPro?: boolean | null\n isDemo: boolean\n didWin?: boolean | null\n dateVerified?: string | null\n tier?: CampaignTier | null\n formattedAddress?: string | null\n placeId?: string | null\n data: CampaignData\n details: CampaignDetails\n aiContent: CampaignAiContent\n userId: number\n canDownloadFederal: boolean\n completedTaskIds: string[]\n hasFreeTextsOffer: boolean\n freeTextsOfferRedeemedAt?: string | null\n}\n\nexport type ListCampaignsOptions = PaginationOptions & {\n userId?: number\n slug?: string\n}\n\nexport type UpdateCampaignInput = {\n slug?: string\n isActive?: boolean\n isVerified?: boolean | null\n isPro?: boolean | null\n isDemo?: boolean\n didWin?: boolean | null\n dateVerified?: string | null\n tier?: CampaignTier | null\n formattedAddress?: string | null\n placeId?: string | null\n data?: CampaignData\n details?: CampaignDetails\n aiContent?: CampaignAiContent\n canDownloadFederal?: boolean\n completedTaskIds?: string[]\n hasFreeTextsOffer?: boolean\n freeTextsOfferRedeemedAt?: string | null\n}\n","import type { PaginationOptions } from './result'\n\nexport enum P2VStatus {\n complete = 'Complete',\n waiting = 'Waiting',\n failed = 'Failed',\n districtMatched = 'DistrictMatched',\n}\n\nexport enum P2VSource {\n GpApi = 'GpApi',\n ElectionApi = 'ElectionApi',\n}\n\nexport type ViabilityScore = {\n level: string\n isPartisan: boolean\n isIncumbent: boolean\n isUncontested: boolean\n candidates: number\n seats: number\n candidatesPerSeat: number\n score: number\n probOfWin: number\n}\n\nexport type PathToVictoryData = {\n p2vStatus?: P2VStatus\n p2vAttempts?: number\n p2vCompleteDate?: string\n completedBy?: number\n electionType?: string\n electionLocation?: string\n voterContactGoal?: number\n winNumber?: number\n p2vNotNeeded?: boolean\n totalRegisteredVoters?: number\n republicans?: number\n democrats?: number\n indies?: number\n women?: number\n men?: number\n white?: number\n asian?: number\n africanAmerican?: number\n hispanic?: number\n averageTurnout?: number\n projectedTurnout?: number\n viability?: ViabilityScore\n source?: P2VSource\n districtId?: string\n districtManuallySet?: boolean\n officeContextFingerprint?: string\n}\n\nexport type PathToVictory = {\n id: number\n createdAt: string\n updatedAt: string\n campaignId: number\n data: PathToVictoryData\n}\n\nexport type ListPathsToVictoryOptions = PaginationOptions & {\n userId?: number\n}\n\nexport type UpdatePathToVictoryInput = {\n data: PathToVictoryData\n}\n"],"mappings":";AAAA,SAAS,QAAQ,kBAAgC;;;ACA1C,IAAM,WAAN,cAAuB,MAAM;AAAA,EACzB;AAAA,EACA;AAAA,EAET,YAAY,QAAgB,SAAiB,UAAqB;AAChE,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,WAAW;AAAA,EAClB;AACF;;;ADLO,IAAM,aAAN,MAAiB;AAAA,EACd;AAAA,EACA;AAAA,EAER,YAAY,cAAsB,UAAiC;A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AA,gBAAa;AACb,EAAAA,kBAAA,eAAY;AAFF,SAAAA;AAAA,GAAA;;;ACpCL,IAAK,YAAL,kBAAKC,eAAL;AACL,EAAAA,WAAA,cAAW;AACX,EAAAA,WAAA,aAAU;AACV,EAAAA,WAAA,YAAS;AACT,EAAAA,WAAA,qBAAkB;AAJR,SAAAA;AAAA,GAAA;AAOL,IAAK,YAAL,kBAAKC,eAAL;AACL,EAAAA,WAAA,WAAQ;AACR,EAAAA,WAAA,iBAAc;AAFJ,SAAAA;AAAA,GAAA;","names":["UserRole","WhyBrowsing","CampaignTier","BallotReadyPositionLevel","ElectionLevel","CampaignCreatedBy","CampaignLaunchStatus","OnboardingStep","GenerationStatus","P2VStatus","P2VSource"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodparty_org/sdk",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "TypeScript SDK for interacting with the GoodParty API",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",