@goodparty_org/sdk 1.5.0 → 1.5.1
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/dist/index.d.mts +4 -69
- package/dist/index.d.ts +4 -69
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -96,18 +96,6 @@ type AiContentData = {
|
|
|
96
96
|
updatedAt: number;
|
|
97
97
|
inputValues?: AiContentInputValues;
|
|
98
98
|
};
|
|
99
|
-
type TopIssuePosition = {
|
|
100
|
-
id: number;
|
|
101
|
-
name: string;
|
|
102
|
-
topIssue: {
|
|
103
|
-
id: number;
|
|
104
|
-
name: string;
|
|
105
|
-
createdAt: number;
|
|
106
|
-
updatedAt: number;
|
|
107
|
-
};
|
|
108
|
-
createdAt: number;
|
|
109
|
-
updatedAt: number;
|
|
110
|
-
};
|
|
111
99
|
type GeoLocation = {
|
|
112
100
|
geoHash?: string;
|
|
113
101
|
lng?: number;
|
|
@@ -123,26 +111,6 @@ type Opponent = {
|
|
|
123
111
|
description: string;
|
|
124
112
|
};
|
|
125
113
|
type HubSpotUpdates = Partial<Record<string, string>>;
|
|
126
|
-
type CampaignFinance = {
|
|
127
|
-
ein?: boolean;
|
|
128
|
-
filing?: boolean;
|
|
129
|
-
management?: boolean;
|
|
130
|
-
regulatory?: boolean;
|
|
131
|
-
};
|
|
132
|
-
type CampaignPlan = {
|
|
133
|
-
why?: string;
|
|
134
|
-
slogan?: string;
|
|
135
|
-
aboutMe?: string;
|
|
136
|
-
messageBox?: string;
|
|
137
|
-
mobilizing?: string;
|
|
138
|
-
pathToVictory?: string;
|
|
139
|
-
policyPlatform?: string;
|
|
140
|
-
communicationsStrategy?: string;
|
|
141
|
-
};
|
|
142
|
-
type CampaignPlanStatus = {
|
|
143
|
-
status: string;
|
|
144
|
-
createdAt: number;
|
|
145
|
-
};
|
|
146
114
|
type CampaignDetails = {
|
|
147
115
|
state?: string;
|
|
148
116
|
ballotLevel?: BallotReadyPositionLevel;
|
|
@@ -187,25 +155,9 @@ type CampaignDetails = {
|
|
|
187
155
|
electionId?: string | null;
|
|
188
156
|
tier?: string;
|
|
189
157
|
einNumber?: string | null;
|
|
158
|
+
einSupportingDocument?: string | null;
|
|
190
159
|
wonGeneral?: boolean;
|
|
191
|
-
|
|
192
|
-
phone?: string;
|
|
193
|
-
firstName?: string;
|
|
194
|
-
lastName?: string;
|
|
195
|
-
citizen?: string;
|
|
196
|
-
runBefore?: string;
|
|
197
|
-
filedStatement?: string;
|
|
198
|
-
campaignPhone?: string;
|
|
199
|
-
campaignWebsite?: string;
|
|
200
|
-
officeRunBefore?: string;
|
|
201
|
-
articles?: string;
|
|
202
|
-
hasPrimary?: boolean;
|
|
203
|
-
noCommittee?: boolean;
|
|
204
|
-
topIssues?: {
|
|
205
|
-
positions: TopIssuePosition[];
|
|
206
|
-
[key: string]: string | TopIssuePosition[];
|
|
207
|
-
};
|
|
208
|
-
} | null;
|
|
160
|
+
};
|
|
209
161
|
type CampaignData = {
|
|
210
162
|
createdBy?: CampaignCreatedBy;
|
|
211
163
|
slug?: string;
|
|
@@ -221,24 +173,7 @@ type CampaignData = {
|
|
|
221
173
|
adminUserEmail?: string;
|
|
222
174
|
hubspotId?: string;
|
|
223
175
|
name?: string;
|
|
224
|
-
|
|
225
|
-
team?: {
|
|
226
|
-
completed: boolean;
|
|
227
|
-
};
|
|
228
|
-
image?: string;
|
|
229
|
-
launch?: Record<string, boolean>;
|
|
230
|
-
social?: {
|
|
231
|
-
completed: boolean;
|
|
232
|
-
};
|
|
233
|
-
finance?: CampaignFinance;
|
|
234
|
-
profile?: {
|
|
235
|
-
completed: boolean;
|
|
236
|
-
};
|
|
237
|
-
campaignPlan?: CampaignPlan;
|
|
238
|
-
hasVoterFile?: string;
|
|
239
|
-
campaignPlanStatus?: Record<string, CampaignPlanStatus>;
|
|
240
|
-
path_to_victory_status?: string;
|
|
241
|
-
} | null;
|
|
176
|
+
};
|
|
242
177
|
type CampaignAiContent = {
|
|
243
178
|
generationStatus?: Record<string, AiContentGenerationStatus>;
|
|
244
179
|
campaignPlanAttempts?: Record<string, number>;
|
|
@@ -398,4 +333,4 @@ declare class GoodPartyClient {
|
|
|
398
333
|
destroy: () => void;
|
|
399
334
|
}
|
|
400
335
|
|
|
401
|
-
export { type AiChatMessage, type AiContentData, type AiContentGenerationStatus, type AiContentInputValues, BallotReadyPositionLevel, type Campaign, type CampaignAiContent, CampaignCreatedBy, type CampaignData, type CampaignDetails,
|
|
336
|
+
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 ListUsersOptions, OnboardingStep, type Opponent, type PaginatedList, type PaginationMeta, type PaginationOptions, SdkError, type UpdateCampaignInput, type UpdatePasswordInput, type UpdateUserInput, type User, type UserMetaData, UserRole, type VoterGoals, WhyBrowsing };
|
package/dist/index.d.ts
CHANGED
|
@@ -96,18 +96,6 @@ type AiContentData = {
|
|
|
96
96
|
updatedAt: number;
|
|
97
97
|
inputValues?: AiContentInputValues;
|
|
98
98
|
};
|
|
99
|
-
type TopIssuePosition = {
|
|
100
|
-
id: number;
|
|
101
|
-
name: string;
|
|
102
|
-
topIssue: {
|
|
103
|
-
id: number;
|
|
104
|
-
name: string;
|
|
105
|
-
createdAt: number;
|
|
106
|
-
updatedAt: number;
|
|
107
|
-
};
|
|
108
|
-
createdAt: number;
|
|
109
|
-
updatedAt: number;
|
|
110
|
-
};
|
|
111
99
|
type GeoLocation = {
|
|
112
100
|
geoHash?: string;
|
|
113
101
|
lng?: number;
|
|
@@ -123,26 +111,6 @@ type Opponent = {
|
|
|
123
111
|
description: string;
|
|
124
112
|
};
|
|
125
113
|
type HubSpotUpdates = Partial<Record<string, string>>;
|
|
126
|
-
type CampaignFinance = {
|
|
127
|
-
ein?: boolean;
|
|
128
|
-
filing?: boolean;
|
|
129
|
-
management?: boolean;
|
|
130
|
-
regulatory?: boolean;
|
|
131
|
-
};
|
|
132
|
-
type CampaignPlan = {
|
|
133
|
-
why?: string;
|
|
134
|
-
slogan?: string;
|
|
135
|
-
aboutMe?: string;
|
|
136
|
-
messageBox?: string;
|
|
137
|
-
mobilizing?: string;
|
|
138
|
-
pathToVictory?: string;
|
|
139
|
-
policyPlatform?: string;
|
|
140
|
-
communicationsStrategy?: string;
|
|
141
|
-
};
|
|
142
|
-
type CampaignPlanStatus = {
|
|
143
|
-
status: string;
|
|
144
|
-
createdAt: number;
|
|
145
|
-
};
|
|
146
114
|
type CampaignDetails = {
|
|
147
115
|
state?: string;
|
|
148
116
|
ballotLevel?: BallotReadyPositionLevel;
|
|
@@ -187,25 +155,9 @@ type CampaignDetails = {
|
|
|
187
155
|
electionId?: string | null;
|
|
188
156
|
tier?: string;
|
|
189
157
|
einNumber?: string | null;
|
|
158
|
+
einSupportingDocument?: string | null;
|
|
190
159
|
wonGeneral?: boolean;
|
|
191
|
-
|
|
192
|
-
phone?: string;
|
|
193
|
-
firstName?: string;
|
|
194
|
-
lastName?: string;
|
|
195
|
-
citizen?: string;
|
|
196
|
-
runBefore?: string;
|
|
197
|
-
filedStatement?: string;
|
|
198
|
-
campaignPhone?: string;
|
|
199
|
-
campaignWebsite?: string;
|
|
200
|
-
officeRunBefore?: string;
|
|
201
|
-
articles?: string;
|
|
202
|
-
hasPrimary?: boolean;
|
|
203
|
-
noCommittee?: boolean;
|
|
204
|
-
topIssues?: {
|
|
205
|
-
positions: TopIssuePosition[];
|
|
206
|
-
[key: string]: string | TopIssuePosition[];
|
|
207
|
-
};
|
|
208
|
-
} | null;
|
|
160
|
+
};
|
|
209
161
|
type CampaignData = {
|
|
210
162
|
createdBy?: CampaignCreatedBy;
|
|
211
163
|
slug?: string;
|
|
@@ -221,24 +173,7 @@ type CampaignData = {
|
|
|
221
173
|
adminUserEmail?: string;
|
|
222
174
|
hubspotId?: string;
|
|
223
175
|
name?: string;
|
|
224
|
-
|
|
225
|
-
team?: {
|
|
226
|
-
completed: boolean;
|
|
227
|
-
};
|
|
228
|
-
image?: string;
|
|
229
|
-
launch?: Record<string, boolean>;
|
|
230
|
-
social?: {
|
|
231
|
-
completed: boolean;
|
|
232
|
-
};
|
|
233
|
-
finance?: CampaignFinance;
|
|
234
|
-
profile?: {
|
|
235
|
-
completed: boolean;
|
|
236
|
-
};
|
|
237
|
-
campaignPlan?: CampaignPlan;
|
|
238
|
-
hasVoterFile?: string;
|
|
239
|
-
campaignPlanStatus?: Record<string, CampaignPlanStatus>;
|
|
240
|
-
path_to_victory_status?: string;
|
|
241
|
-
} | null;
|
|
176
|
+
};
|
|
242
177
|
type CampaignAiContent = {
|
|
243
178
|
generationStatus?: Record<string, AiContentGenerationStatus>;
|
|
244
179
|
campaignPlanAttempts?: Record<string, number>;
|
|
@@ -398,4 +333,4 @@ declare class GoodPartyClient {
|
|
|
398
333
|
destroy: () => void;
|
|
399
334
|
}
|
|
400
335
|
|
|
401
|
-
export { type AiChatMessage, type AiContentData, type AiContentGenerationStatus, type AiContentInputValues, BallotReadyPositionLevel, type Campaign, type CampaignAiContent, CampaignCreatedBy, type CampaignData, type CampaignDetails,
|
|
336
|
+
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 ListUsersOptions, OnboardingStep, type Opponent, type PaginatedList, type PaginationMeta, type PaginationOptions, SdkError, type UpdateCampaignInput, type UpdatePasswordInput, type UpdateUserInput, type User, type UserMetaData, UserRole, type VoterGoals, WhyBrowsing };
|
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/UsersResource.ts","../src/vendor/clerk/clerk.service.ts","../src/GoodPartyClient.ts","../src/types/user.ts","../src/types/campaign.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 TopIssuePosition,\n GeoLocation,\n CustomIssue,\n Opponent,\n HubSpotUpdates,\n CampaignFinance,\n CampaignPlan,\n CampaignPlanStatus,\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","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\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 list = (options?: ListCampaignsOptions): Promise<PaginatedList<Campaign>> =>\n this.getRequest<PaginatedList<Campaign>>('/campaigns/list', options)\n\n update = (id: number, input: UpdateCampaignInput): Promise<Campaign> =>\n this.putRequest<Campaign>(`/campaigns/${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 list = (options?: ListUsersOptions): Promise<PaginatedList<User>> =>\n this.getRequest<PaginatedList<User>>('/users', 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>(`/users/${id}`, input)\n\n delete = (id: number): Promise<void> =>\n this.deleteRequest<void>(`/users/${id}`)\n\n updatePassword = (id: number, input: UpdatePasswordInput): Promise<void> =>\n this.putRequest<void>(`/users/${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 { 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 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 }\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 TopIssuePosition = {\n id: number\n name: string\n topIssue: { id: number; name: string; createdAt: number; updatedAt: number }\n createdAt: number\n updatedAt: number\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 CampaignFinance = {\n ein?: boolean\n filing?: boolean\n management?: boolean\n regulatory?: boolean\n}\n\nexport type CampaignPlan = {\n why?: string\n slogan?: string\n aboutMe?: string\n messageBox?: string\n mobilizing?: string\n pathToVictory?: string\n policyPlatform?: string\n communicationsStrategy?: string\n}\n\nexport type CampaignPlanStatus = {\n status: string\n createdAt: number\n}\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 wonGeneral?: boolean\n dob?: string\n phone?: string\n firstName?: string\n lastName?: string\n citizen?: string\n runBefore?: string\n filedStatement?: string\n campaignPhone?: string\n campaignWebsite?: string\n officeRunBefore?: string\n articles?: string\n hasPrimary?: boolean\n noCommittee?: boolean\n topIssues?: {\n positions: TopIssuePosition[]\n [key: string]: string | TopIssuePosition[]\n }\n} | null\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 id?: number\n team?: { completed: boolean }\n image?: string\n launch?: Record<string, boolean>\n social?: { completed: boolean }\n finance?: CampaignFinance\n profile?: { completed: boolean }\n campaignPlan?: CampaignPlan\n hasVoterFile?: string\n campaignPlanStatus?: Record<string, CampaignPlanStatus>\n path_to_victory_status?: string\n} | null\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"],"mappings":";;;;;;;;;;;;;;;;;;;;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,aAA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AA,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;","names":["UserRole","WhyBrowsing","CampaignTier","BallotReadyPositionLevel","ElectionLevel","CampaignCreatedBy","CampaignLaunchStatus","OnboardingStep","GenerationStatus"]}
|
|
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/UsersResource.ts","../src/vendor/clerk/clerk.service.ts","../src/GoodPartyClient.ts","../src/types/user.ts","../src/types/campaign.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","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\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 list = (options?: ListCampaignsOptions): Promise<PaginatedList<Campaign>> =>\n this.getRequest<PaginatedList<Campaign>>('/campaigns/list', options)\n\n update = (id: number, input: UpdateCampaignInput): Promise<Campaign> =>\n this.putRequest<Campaign>(`/campaigns/${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 list = (options?: ListUsersOptions): Promise<PaginatedList<User>> =>\n this.getRequest<PaginatedList<User>>('/users', 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>(`/users/${id}`, input)\n\n delete = (id: number): Promise<void> =>\n this.deleteRequest<void>(`/users/${id}`)\n\n updatePassword = (id: number, input: UpdatePasswordInput): Promise<void> =>\n this.putRequest<void>(`/users/${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 { 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 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 }\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"],"mappings":";;;;;;;;;;;;;;;;;;;;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,EAEV,YAAY,YAAwB;AAClC,SAAK,aAAa;AAAA,EACpB;AAAA,EAEU,aAAa,CACrB,MACA,U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cAAA,UAAO;AACP,EAAAA,cAAA,YAAS;AAHC,SAAAA;AAAA,GAAA;AAML,IAAK,2BAAL,kBAAKC,8BAAL;AACL,EAAAA,0BAAA,UAAO;AACP,EAAAA,0BAAA,YAAS;AACT,EAAAA,0BAAA,aAAU;AACV,EAAAA,0BAAA,WAAQ;AACR,EAAAA,0BAAA,cAAW;AACX,EAAAA,0BAAA,WAAQ;AACR,EAAAA,0BAAA,cAAW;AAPD,SAAAA;AAAA,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;","names":["UserRole","WhyBrowsing","CampaignTier","BallotReadyPositionLevel","ElectionLevel","CampaignCreatedBy","CampaignLaunchStatus","OnboardingStep","GenerationStatus"]}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/http/HttpClient.ts","../src/types/result.ts","../src/resources/BaseResource.ts","../src/resources/CampaignsResource.ts","../src/resources/UsersResource.ts","../src/vendor/clerk/clerk.service.ts","../src/GoodPartyClient.ts","../src/types/user.ts","../src/types/campaign.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\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 list = (options?: ListCampaignsOptions): Promise<PaginatedList<Campaign>> =>\n this.getRequest<PaginatedList<Campaign>>('/campaigns/list', options)\n\n update = (id: number, input: UpdateCampaignInput): Promise<Campaign> =>\n this.putRequest<Campaign>(`/campaigns/${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 list = (options?: ListUsersOptions): Promise<PaginatedList<User>> =>\n this.getRequest<PaginatedList<User>>('/users', 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>(`/users/${id}`, input)\n\n delete = (id: number): Promise<void> =>\n this.deleteRequest<void>(`/users/${id}`)\n\n updatePassword = (id: number, input: UpdatePasswordInput): Promise<void> =>\n this.putRequest<void>(`/users/${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 { 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 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 }\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 TopIssuePosition = {\n id: number\n name: string\n topIssue: { id: number; name: string; createdAt: number; updatedAt: number }\n createdAt: number\n updatedAt: number\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 CampaignFinance = {\n ein?: boolean\n filing?: boolean\n management?: boolean\n regulatory?: boolean\n}\n\nexport type CampaignPlan = {\n why?: string\n slogan?: string\n aboutMe?: string\n messageBox?: string\n mobilizing?: string\n pathToVictory?: string\n policyPlatform?: string\n communicationsStrategy?: string\n}\n\nexport type CampaignPlanStatus = {\n status: string\n createdAt: number\n}\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 wonGeneral?: boolean\n dob?: string\n phone?: string\n firstName?: string\n lastName?: string\n citizen?: string\n runBefore?: string\n filedStatement?: string\n campaignPhone?: string\n campaignWebsite?: string\n officeRunBefore?: string\n articles?: string\n hasPrimary?: boolean\n noCommittee?: boolean\n topIssues?: {\n positions: TopIssuePosition[]\n [key: string]: string | TopIssuePosition[]\n }\n} | null\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 id?: number\n team?: { completed: boolean }\n image?: string\n launch?: Record<string, boolean>\n social?: { completed: boolean }\n finance?: CampaignFinance\n profile?: { completed: boolean }\n campaignPlan?: CampaignPlan\n hasVoterFile?: string\n campaignPlanStatus?: Record<string, CampaignPlanStatus>\n path_to_victory_status?: string\n} | null\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"],"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;AAA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ADE,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;","names":["UserRole","WhyBrowsing","CampaignTier","BallotReadyPositionLevel","ElectionLevel","CampaignCreatedBy","CampaignLaunchStatus","OnboardingStep","GenerationStatus"]}
|
|
1
|
+
{"version":3,"sources":["../src/http/HttpClient.ts","../src/types/result.ts","../src/resources/BaseResource.ts","../src/resources/CampaignsResource.ts","../src/resources/UsersResource.ts","../src/vendor/clerk/clerk.service.ts","../src/GoodPartyClient.ts","../src/types/user.ts","../src/types/campaign.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\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 list = (options?: ListCampaignsOptions): Promise<PaginatedList<Campaign>> =>\n this.getRequest<PaginatedList<Campaign>>('/campaigns/list', options)\n\n update = (id: number, input: UpdateCampaignInput): Promise<Campaign> =>\n this.putRequest<Campaign>(`/campaigns/${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 list = (options?: ListUsersOptions): Promise<PaginatedList<User>> =>\n this.getRequest<PaginatedList<User>>('/users', 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>(`/users/${id}`, input)\n\n delete = (id: number): Promise<void> =>\n this.deleteRequest<void>(`/users/${id}`)\n\n updatePassword = (id: number, input: UpdatePasswordInput): Promise<void> =>\n this.putRequest<void>(`/users/${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 { 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 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 }\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"],"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,EA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L,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;","names":["UserRole","WhyBrowsing","CampaignTier","BallotReadyPositionLevel","ElectionLevel","CampaignCreatedBy","CampaignLaunchStatus","OnboardingStep","GenerationStatus"]}
|