ugcinc 4.5.92 → 4.6.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.
@@ -10,12 +10,22 @@ export interface HeaderEntry {
10
10
  key: string;
11
11
  value: string;
12
12
  }
13
+ export type ApiRequestOutputPrimitiveType = 'string' | 'number' | 'boolean' | 'image';
14
+ export type ApiRequestArrayItemType = ApiRequestOutputPrimitiveType | 'object';
15
+ export type ApiRequestOutputType = ApiRequestOutputPrimitiveType | 'object' | 'array';
16
+ export interface ApiRequestOutputField {
17
+ name: string;
18
+ type: ApiRequestOutputType;
19
+ items?: ApiRequestArrayItemType;
20
+ objectSchema?: ObjectSchemaField[];
21
+ required?: boolean;
22
+ }
13
23
  declare const definition: import("./types").NodeDefinition<"api-request", "generator", {
14
24
  url: string;
15
25
  method: HttpMethod;
16
26
  headers: HeaderEntry[];
17
27
  body: string;
18
- outputFields: ObjectSchemaField[];
28
+ outputFields: ApiRequestOutputField[];
19
29
  outputMode: OutputMode;
20
30
  selectionMode: SelectionMode | null;
21
31
  }, ApiRequestNodeInputs, ApiRequestNodeOutputs, false>;
@@ -8,6 +8,41 @@ const types_1 = require("./types");
8
8
  // =============================================================================
9
9
  const HttpMethods = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'];
10
10
  exports.HttpMethods = HttpMethods;
11
+ function getArrayItemPortType(items) {
12
+ switch (items) {
13
+ case 'number':
14
+ return 'number';
15
+ case 'boolean':
16
+ return 'boolean';
17
+ case 'object':
18
+ return 'object';
19
+ case 'image':
20
+ return 'image';
21
+ default:
22
+ return 'text';
23
+ }
24
+ }
25
+ function getOutputPortShape(field) {
26
+ if (field.type === 'array') {
27
+ return {
28
+ type: getArrayItemPortType(field.items),
29
+ isArray: true,
30
+ };
31
+ }
32
+ if (field.type === 'object') {
33
+ return { type: 'object', isArray: false };
34
+ }
35
+ if (field.type === 'number') {
36
+ return { type: 'number', isArray: false };
37
+ }
38
+ if (field.type === 'boolean') {
39
+ return { type: 'boolean', isArray: false };
40
+ }
41
+ if (field.type === 'image') {
42
+ return { type: 'image', isArray: false };
43
+ }
44
+ return { type: 'text', isArray: false };
45
+ }
11
46
  // =============================================================================
12
47
  // Node Definition
13
48
  // =============================================================================
@@ -15,7 +50,7 @@ const definition = (0, types_1.defineNode)({
15
50
  nodeId: 'api-request',
16
51
  label: 'API Request',
17
52
  description: 'Make HTTP requests to external APIs',
18
- guide: 'Makes HTTP requests to external APIs and returns parsed response data. Use when you need to fetch data from or send data to external services. Configure URL, method (GET/POST/PUT/PATCH/DELETE), headers, and body. Supports template variables ({{var}}) in URL, header values, and body for dynamic values from upstream nodes. Define output fields to extract specific data from JSON responses. Use cases: fetching external data, triggering webhooks, integrating third-party APIs, sending data to external services.',
53
+ guide: 'Makes HTTP requests to external APIs and returns parsed response data. Use when you need to fetch data from or send data to external services. Configure URL, method (GET/POST/PUT/PATCH/DELETE), headers, and body. Supports template variables ({{var}}) in URL, header values, and body for dynamic values from upstream nodes. Define output fields to extract specific data from JSON responses, including typed arrays and image URL fields that should flow into image ports. Use cases: fetching external data, triggering webhooks, integrating third-party APIs, sending data to external services.',
19
54
  type: 'generator',
20
55
  category: 'Generation',
21
56
  outputModes: ['per-input', 'single'],
@@ -49,32 +84,11 @@ const definition = (0, types_1.defineNode)({
49
84
  // Output ports from outputFields
50
85
  const outputFields = (config?.outputFields ?? [{ name: 'response', type: 'string' }]);
51
86
  const outputs = outputFields.map(f => {
52
- let pType;
53
- let pIsArray;
54
- if (f.type === 'array') {
55
- pType = f.items === 'object' ? 'object' : 'text';
56
- pIsArray = true;
57
- }
58
- else if (f.type === 'object') {
59
- pType = 'object';
60
- pIsArray = false;
61
- }
62
- else if (f.type === 'number') {
63
- pType = 'number';
64
- pIsArray = false;
65
- }
66
- else if (f.type === 'boolean') {
67
- pType = 'boolean';
68
- pIsArray = false;
69
- }
70
- else {
71
- pType = 'text';
72
- pIsArray = false;
73
- }
87
+ const { type, isArray } = getOutputPortShape(f);
74
88
  return {
75
89
  id: f.name,
76
- type: pType,
77
- isArray: pIsArray,
90
+ type,
91
+ isArray,
78
92
  required: f.required ?? true,
79
93
  ...(f.objectSchema && { objectSchema: f.objectSchema }),
80
94
  };
@@ -18,7 +18,7 @@ export declare const nodeDefinitions: {
18
18
  method: import("./api-request").HttpMethod;
19
19
  headers: import("./api-request").HeaderEntry[];
20
20
  body: string;
21
- outputFields: import("./types").ObjectSchemaField[];
21
+ outputFields: import("./api-request").ApiRequestOutputField[];
22
22
  outputMode: import("./types").OutputMode;
23
23
  selectionMode: import("./types").SelectionMode | null;
24
24
  }, import("./api-request").ApiRequestNodeInputs, import("./api-request").ApiRequestNodeOutputs, false> & {
package/dist/billing.d.ts CHANGED
@@ -17,19 +17,29 @@ export interface BillingInfo {
17
17
  name: string | null;
18
18
  }>;
19
19
  }
20
- export interface CancelSubscriptionResponse {
21
- message: string;
22
- }
23
20
  export interface PortalUrlResponse {
24
21
  url: string;
25
22
  }
26
- export interface DeactivateAccountParams {
23
+ export interface CancelAccountParams {
24
+ account_id: string;
25
+ }
26
+ export interface CancelAccountResponse {
27
+ message: string;
28
+ account_id: string;
29
+ cancel_at: string;
30
+ }
31
+ export interface ReactivateAccountParams {
27
32
  account_id: string;
28
33
  }
29
- export interface DeactivateAccountResponse {
34
+ export interface ReactivateAccountResponse {
30
35
  message: string;
31
36
  account_id: string;
32
37
  }
38
+ export interface CancelSubscriptionResponse {
39
+ message: string;
40
+ cancelled: number;
41
+ cancel_at: string | null;
42
+ }
33
43
  export interface RequestReplacementParams {
34
44
  account_id: string;
35
45
  reason?: string;
@@ -37,7 +47,6 @@ export interface RequestReplacementParams {
37
47
  export interface RequestReplacementResponse {
38
48
  message: string;
39
49
  request: BillingRequestInfo | null;
40
- new_account_id: string | null;
41
50
  }
42
51
  export interface RequestRefundParams {
43
52
  account_id: string;
@@ -68,22 +77,28 @@ export declare class BillingClient extends BaseClient {
68
77
  * Get billing information including subscription details and linked orgs
69
78
  */
70
79
  getBilling(): Promise<ApiResponse<BillingInfo>>;
71
- /**
72
- * Cancel subscription at the end of the current billing period
73
- */
74
- cancelSubscription(): Promise<ApiResponse<CancelSubscriptionResponse>>;
75
80
  /**
76
81
  * Get a Stripe billing portal URL for managing payment methods
77
82
  */
78
83
  getPortalUrl(params?: PortalParams): Promise<ApiResponse<PortalUrlResponse>>;
79
84
  /**
80
- * Deactivate an account slot, removing it from your subscription
81
- * The account is reclaimed and billing is adjusted (no proration)
85
+ * Cancel the subscription for a single account. The account keeps access until
86
+ * the end of the current billing period, then is reclaimed automatically.
87
+ * Can be reversed with reactivateAccount before that date.
82
88
  */
83
- deactivateAccount(params: DeactivateAccountParams): Promise<ApiResponse<DeactivateAccountResponse>>;
89
+ cancelAccount(params: CancelAccountParams): Promise<ApiResponse<CancelAccountResponse>>;
90
+ /**
91
+ * Undo a pending cancellation on an account, restoring it to its prior status.
92
+ */
93
+ reactivateAccount(params: ReactivateAccountParams): Promise<ApiResponse<ReactivateAccountResponse>>;
94
+ /**
95
+ * Cancel all accounts under this billing. Each account keeps access until the
96
+ * end of the current billing period, then is reclaimed automatically.
97
+ */
98
+ cancelSubscription(): Promise<ApiResponse<CancelSubscriptionResponse>>;
84
99
  /**
85
- * Request a replacement for an account
86
- * First replacement is auto-approved; subsequent requests require manual review
100
+ * Request a replacement for an account. All replacement requests require
101
+ * admin review.
87
102
  */
88
103
  requestReplacement(params: RequestReplacementParams): Promise<ApiResponse<RequestReplacementResponse>>;
89
104
  /**
package/dist/billing.js CHANGED
@@ -15,12 +15,6 @@ class BillingClient extends base_1.BaseClient {
15
15
  async getBilling() {
16
16
  return this.get('/billing');
17
17
  }
18
- /**
19
- * Cancel subscription at the end of the current billing period
20
- */
21
- async cancelSubscription() {
22
- return this.post('/billing/cancel');
23
- }
24
18
  /**
25
19
  * Get a Stripe billing portal URL for managing payment methods
26
20
  */
@@ -28,15 +22,29 @@ class BillingClient extends base_1.BaseClient {
28
22
  return this.post('/billing/portal', params ?? {});
29
23
  }
30
24
  /**
31
- * Deactivate an account slot, removing it from your subscription
32
- * The account is reclaimed and billing is adjusted (no proration)
25
+ * Cancel the subscription for a single account. The account keeps access until
26
+ * the end of the current billing period, then is reclaimed automatically.
27
+ * Can be reversed with reactivateAccount before that date.
33
28
  */
34
- async deactivateAccount(params) {
35
- return this.post('/billing/deactivate', params);
29
+ async cancelAccount(params) {
30
+ return this.post('/billing/cancel-account', params);
31
+ }
32
+ /**
33
+ * Undo a pending cancellation on an account, restoring it to its prior status.
34
+ */
35
+ async reactivateAccount(params) {
36
+ return this.post('/billing/reactivate-account', params);
37
+ }
38
+ /**
39
+ * Cancel all accounts under this billing. Each account keeps access until the
40
+ * end of the current billing period, then is reclaimed automatically.
41
+ */
42
+ async cancelSubscription() {
43
+ return this.post('/billing/cancel-subscription');
36
44
  }
37
45
  /**
38
- * Request a replacement for an account
39
- * First replacement is auto-approved; subsequent requests require manual review
46
+ * Request a replacement for an account. All replacement requests require
47
+ * admin review.
40
48
  */
41
49
  async requestReplacement(params) {
42
50
  return this.post('/billing/request-replacement', params);
package/dist/index.d.ts CHANGED
@@ -28,17 +28,17 @@ export type { ClientConfig } from './base';
28
28
  export type { Account, AccountStat, AccountTask, EditProfileInfo, GetAccountsParams, GetAccountStatsParams, GetAccountStatusParams, AccountInfoUpdate, UpdateAccountInfoParams, AccountInfoUpdateResult, UpdateAccountInfoResponse, AccountSocialUpdate, UpdateAccountSocialParams, AccountSocialUpdateResult, UpdateAccountSocialResponse, DeleteAccountPostsParams, DeleteAccountPostsResponse, ResetWarmupParams, ResetWarmupResponse, NicheSwitchUpdate, NicheSwitchParams, NicheSwitchResult, NicheSwitchResponse, CreateAccountInput, CreateAccountsParams, CreateAccountResult, CreateAccountsResponse, TroubleshootFailReason, TroubleshootAccount, TroubleshootParams, } from './accounts';
29
29
  export type { TaskType, Task, GetTasksParams } from './tasks';
30
30
  export type { PostType, PostStatus, Post, PostStat, GetPostsParams, CreateDraftParams, CreateSlideshowParams, GetPostStatsParams, GetPostStatusParams, CreateVideoParams, UpdatePostParams, DeletePostsParams, DeletePostsResponse, RetryPostsParams, SetPostStatusParams, SetPostStatusResponse, PreviewScheduleEntry, PreviewScheduleParams, PreviewScheduleResult, } from './posts';
31
- export type { RefreshStatsParams, RefreshStatsError, RefreshStatsResponse, RefreshStartEvent, RefreshProgressEvent, RefreshDoneEvent, RefreshStreamEvent, DailyAggregatedStat, GetDailyAggregatedStatsParams, DailyAccountStat, GetDailyAccountStatsParams, DailyPostStat, GetDailyPostStatsParams, DashboardDailyStat, GetDashboardDailyStatsParams, TopAccount, GetTopAccountsParams, TopPost, GetTopPostsParams, } from './stats';
31
+ export type { RefreshStatsParams, RefreshStatsError, RefreshStatsResponse, RefreshStatsProgressResponse, RefreshStartEvent, RefreshProgressEvent, RefreshDoneEvent, RefreshStreamEvent, DailyAggregatedStat, GetDailyAggregatedStatsParams, DailyAccountStat, GetDailyAccountStatsParams, DailyPostStat, GetDailyPostStatsParams, DashboardDailyStat, GetDashboardDailyStatsParams, TopAccount, GetTopAccountsParams, TopPost, GetTopPostsParams, } from './stats';
32
32
  export type { Org, ApiKey, DeleteApiKeyParams, EditApiKeyParams, IntegrationKey, IntegrationProvider, UpsertIntegrationKeyParams, DeleteIntegrationKeyParams } from './org';
33
33
  export type { UserMedia, MediaUse, SocialAudio, Media, GetMediaParams, GetSocialAudioParams, UploadMediaParams, UploadMediaResponse, MediaTagUpdate, UpdateMediaTagsParams, MediaTagUpdateResult, UpdateMediaTagsResponse, UpdateMediaTagParams, UpdateMediaNameParams, DeleteMediaParams, DeleteMediaResponse, CreateSocialAudioParams, ImportTextParams, ImportTextResponse, CreateMediaFromUrlParams, GetMediaUseParams, GetMediaUseResponse, FilterMediaParams, FilterMediaResponse, GetUploadTokenParams, UploadTokenResponse, } from './media';
34
34
  export type { CommentStatus, Comment, CreateCommentParams, CreateCommentResponse, GetCommentsParams, } from './comments';
35
- export type { BillingInfo, CancelSubscriptionResponse, PortalUrlResponse, DeactivateAccountParams, DeactivateAccountResponse, RequestReplacementParams, RequestReplacementResponse, RequestRefundParams, RequestRefundResponse, BillingRequestInfo, PortalParams, } from './billing';
35
+ export type { BillingInfo, PortalUrlResponse, CancelAccountParams, CancelAccountResponse, ReactivateAccountParams, ReactivateAccountResponse, CancelSubscriptionResponse, RequestReplacementParams, RequestReplacementResponse, RequestRefundParams, RequestRefundResponse, BillingRequestInfo, PortalParams, } from './billing';
36
36
  export type { RenderJobResponse, RenderJobStatus, SubmitImageRenderJobParams, SubmitVideoRenderJobParams, SubmitScreenshotAnimationRenderJobParams, SubmitAutoCaptionRenderJobParams, SubmitSceneSplitJobParams, SceneSplitDetectorConfig, SubmitInstagramDmRenderJobParams, SubmitIMessageDmRenderJobParams, IgDmMessage, ImDmMessage, RenderVideoEditorConfig, } from './render';
37
37
  export type { VideoEditorNodeConfig, VideoEditorChannel, VideoEditorSegment, VideoEditorVideoSegment, VideoEditorAudioSegment, VideoEditorImageSegment, VideoEditorTextSegment, VideoEditorImageSequenceSegment, VideoEditorVideoSequenceSegment, TimeValue, TimeMode, SegmentTimelinePosition, DeduplicationLevel, DeduplicationInput, ImageEditorElement, DimensionPresetKey, } from './render/types';
38
38
  export type { ImageEditorNodeConfig, ImageComposerNodeConfig, ImageComposerRenderInput } from './automations/nodes/image-composer';
39
39
  export { prepareImageComposerInput } from './automations/nodes/image-composer';
40
40
  export type { AccountNodeConfig } from './automations/nodes/account';
41
- export type { ApiRequestNodeConfig, HeaderEntry, HttpMethod } from './automations/nodes/api-request';
41
+ export type { ApiRequestNodeConfig, ApiRequestOutputField, ApiRequestOutputType, ApiRequestArrayItemType, HeaderEntry, HttpMethod, } from './automations/nodes/api-request';
42
42
  export { HttpMethods } from './automations/nodes/api-request';
43
43
  export type { AutoCaptionNodeConfig, AutoCaptionPreset, AutoCaptionFontWeight, AutoCaptionPosition, } from './automations/nodes/auto-caption';
44
44
  export { nodeConfigToCaptionStyle } from './automations/nodes/auto-caption';
package/dist/stats.d.ts CHANGED
@@ -12,11 +12,23 @@ export interface RefreshStatsError {
12
12
  error: string;
13
13
  }
14
14
  export interface RefreshStatsResponse {
15
- accounts_refreshed: number;
16
- accounts_failed: number;
17
- total_accounts: number;
18
- post_stats_count: number;
19
- errors?: RefreshStatsError[];
15
+ batchId: string;
16
+ batchCreatedAtMs: number;
17
+ queuedAccounts: number;
18
+ totalAccounts: number;
19
+ totalPosts: number;
20
+ }
21
+ export interface RefreshStatsProgressResponse {
22
+ batchId: string;
23
+ batchCreatedAtMs: number;
24
+ totalAccounts: number;
25
+ completedAccounts: number;
26
+ failedAccounts: number;
27
+ activeAccounts: number;
28
+ queuedAccounts: number;
29
+ done: boolean;
30
+ totalPosts: number;
31
+ completedPosts: number;
20
32
  }
21
33
  export interface DailyAggregatedStat {
22
34
  date: Date | string;
@@ -358,6 +370,10 @@ export declare class StatsClient extends BaseClient {
358
370
  * Note: Can only be called once per hour per organization (or per org_group if specified)
359
371
  */
360
372
  refresh(params?: RefreshStatsParams): Promise<ApiResponse<RefreshStatsResponse>>;
373
+ getRefreshProgress(params: {
374
+ batchId: string;
375
+ org_group?: string;
376
+ }): Promise<ApiResponse<RefreshStatsProgressResponse>>;
361
377
  /**
362
378
  * Refresh stats with NDJSON streaming progress.
363
379
  * Returns the raw Response so the caller can read the stream.
package/dist/stats.js CHANGED
@@ -209,6 +209,13 @@ class StatsClient extends base_1.BaseClient {
209
209
  async refresh(params) {
210
210
  return this.post('/stats/refresh', params ?? {});
211
211
  }
212
+ async getRefreshProgress(params) {
213
+ const searchParams = new URLSearchParams({ batchId: params.batchId });
214
+ if (params.org_group) {
215
+ searchParams.set('org_group', params.org_group);
216
+ }
217
+ return this.get(`/stats/refresh/progress?${searchParams.toString()}`);
218
+ }
212
219
  /**
213
220
  * Refresh stats with NDJSON streaming progress.
214
221
  * Returns the raw Response so the caller can read the stream.
@@ -11,14 +11,6 @@ exports.billingTools = [
11
11
  return client.billing.getBilling();
12
12
  },
13
13
  },
14
- {
15
- name: 'cancel_subscription',
16
- description: 'Cancel subscription at the end of the current billing period. The subscription remains active until the period ends.',
17
- schema: zod_1.z.object({}).optional(),
18
- execute: async (client) => {
19
- return client.billing.cancelSubscription();
20
- },
21
- },
22
14
  {
23
15
  name: 'get_billing_portal',
24
16
  description: 'Get a Stripe billing portal URL for managing payment methods and invoices.',
@@ -30,18 +22,36 @@ exports.billingTools = [
30
22
  },
31
23
  },
32
24
  {
33
- name: 'deactivate_account',
34
- description: 'Deactivate an account slot. Removes it from your subscription (no proration) and reclaims the account.',
25
+ name: 'cancel_account',
26
+ description: 'Cancel the subscription for a single account. The account keeps access until the end of the current billing period, then is reclaimed automatically.',
27
+ schema: zod_1.z.object({
28
+ account_id: zod_1.z.string().describe('ID of the account to cancel'),
29
+ }),
30
+ execute: async (client, params) => {
31
+ return client.billing.cancelAccount(params);
32
+ },
33
+ },
34
+ {
35
+ name: 'reactivate_account',
36
+ description: 'Undo a pending cancellation on an account, restoring it to its prior status. Must be called before the billing period ends.',
35
37
  schema: zod_1.z.object({
36
- account_id: zod_1.z.string().describe('ID of the account to deactivate'),
38
+ account_id: zod_1.z.string().describe('ID of the account to reactivate'),
37
39
  }),
38
40
  execute: async (client, params) => {
39
- return client.billing.deactivateAccount(params);
41
+ return client.billing.reactivateAccount(params);
42
+ },
43
+ },
44
+ {
45
+ name: 'cancel_subscription',
46
+ description: 'Cancel every account under this billing. Each account keeps access until the end of the current billing period, then is reclaimed automatically.',
47
+ schema: zod_1.z.object({}).optional(),
48
+ execute: async (client) => {
49
+ return client.billing.cancelSubscription();
40
50
  },
41
51
  },
42
52
  {
43
53
  name: 'request_replacement',
44
- description: 'Request a replacement for an account. First replacement is auto-approved; subsequent requests require manual review.',
54
+ description: 'Request a replacement for an account. All replacement requests require manual review.',
45
55
  schema: zod_1.z.object({
46
56
  account_id: zod_1.z.string().describe('ID of the account to replace'),
47
57
  reason: zod_1.z.string().optional().describe('Reason for replacement'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugcinc",
3
- "version": "4.5.92",
3
+ "version": "4.6.0",
4
4
  "description": "TypeScript/JavaScript client for the UGC Inc API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",