@ptkl/sdk 1.13.0 → 1.15.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,6 +10,7 @@ type FindParams = {
10
10
  dateTo?: string;
11
11
  dateField?: string;
12
12
  only?: string[];
13
+ cursor?: string;
13
14
  $adv?: FindAdvancedParams;
14
15
  $aggregate?: FindAggregateParams[];
15
16
  };
@@ -57,17 +58,23 @@ type FindStreamMeta = {
57
58
  total_filtered: number;
58
59
  total_pages: number;
59
60
  page: number;
61
+ next_cursor?: string;
60
62
  };
61
63
  /**
62
64
  * Callback invoked once with pagination metadata before any records
63
65
  */
64
66
  type FindStreamMetaCallback = (meta: FindStreamMeta) => void | Promise<void>;
67
+ type FindStreamCursor = {
68
+ next_cursor?: string;
69
+ };
70
+ type FindStreamCursorCallback = (cursor: FindStreamCursor) => void | Promise<void>;
65
71
  /**
66
72
  * Chainable find stream result for cursor-based NDJSON pagination
67
73
  */
68
74
  type FindChainable = {
69
75
  onMeta: (callback: FindStreamMetaCallback) => FindChainable;
70
76
  onData: (callback: StreamCallback) => FindChainable;
77
+ onCursor: (callback: FindStreamCursorCallback) => FindChainable;
71
78
  onError: (callback: (error: Error) => void) => FindChainable;
72
79
  onEnd: (callback: () => void) => FindChainable;
73
80
  stream: () => Promise<void>;
@@ -432,6 +439,7 @@ type SetupData = {
432
439
  is_public?: boolean;
433
440
  icon?: string;
434
441
  settings?: Settings;
442
+ force_override?: boolean;
435
443
  };
436
444
  type ComponentCreateResponse = ComponentListItem;
437
- export { FindParams, FindOptions, FindResponse, FindAdvancedParams, FindAggregateParams, Model, UpdateOptions, ModifyOptions, UpdateOperators, UpdateAggregate, ModelUpdateData, ComponentOptions, ComponentListResponse, ComponentListItem, ComponentLabel, ComponentWorkspace, StreamCallback, StreamHandler, AggregateChainable, FindChainable, FindStreamMeta, FindStreamMetaCallback, UpdateManyOptions, CreateManyOptions, Settings, SettingsField, FieldRoles, FieldConstraints, Context, Preset, PresetContext, Filters, Function, Extension, Policy, FieldAccessConfig, TemplatesDist, SetupData, ComponentCreateResponse, };
445
+ export { FindParams, FindOptions, FindResponse, FindAdvancedParams, FindAggregateParams, Model, UpdateOptions, ModifyOptions, UpdateOperators, UpdateAggregate, ModelUpdateData, ComponentOptions, ComponentListResponse, ComponentListItem, ComponentLabel, ComponentWorkspace, StreamCallback, StreamHandler, AggregateChainable, FindChainable, FindStreamMeta, FindStreamMetaCallback, FindStreamCursor, FindStreamCursorCallback, UpdateManyOptions, CreateManyOptions, Settings, SettingsField, FieldRoles, FieldConstraints, Context, Preset, PresetContext, Filters, Function, Extension, Policy, FieldAccessConfig, TemplatesDist, SetupData, ComponentCreateResponse, };
@@ -442,3 +442,145 @@ export type OCRExtractResult = {
442
442
  results: Record<string, string>;
443
443
  errors?: string[];
444
444
  };
445
+ export type LibraryExportStatus = 'queued' | 'running' | 'completed' | 'failed' | 'expired';
446
+ export type LibraryExportCreatePayload = {
447
+ path?: string;
448
+ format?: 'zip' | 'tar' | 'tar.gz';
449
+ };
450
+ /**
451
+ * A library export archive record (models.MediaExport)
452
+ */
453
+ export type LibraryExport = {
454
+ uuid: string;
455
+ library_uuid: string;
456
+ path?: string;
457
+ format?: string;
458
+ status: LibraryExportStatus;
459
+ size_bytes?: number;
460
+ created_at?: string;
461
+ updated_at?: string;
462
+ };
463
+ export type LibraryExportListResponse = LibraryExport[];
464
+ /**
465
+ * Response body for POST library/{uuid}/exports.
466
+ * `mode` indicates whether the export was queued (async, `export` populated)
467
+ * or streamed back directly as the response body (synchronous binary download,
468
+ * in which case the response will not be this JSON shape at all).
469
+ */
470
+ export type MediaExportCreateResult = {
471
+ mode: string;
472
+ export?: LibraryExport;
473
+ };
474
+ /**
475
+ * Response body for GET library/{uuid}/exports/{export_uuid}
476
+ */
477
+ export type LibraryExportGetResult = {
478
+ export: LibraryExport;
479
+ download_url?: string;
480
+ };
481
+ export type NotificationMode = 'off' | 'inherit' | 'enabled' | 'disabled' | (string & {});
482
+ export type NotificationDeliveryMode = 'digest' | 'immediate' | 'hourly_digest' | 'daily_digest' | (string & {});
483
+ export type NotifyEvent = 'upload' | 'download' | 'share_created' | 'file_deleted' | 'expiration_warning' | 'quota_warning' | 'worm_expiring';
484
+ export type QuotaExceededAction = 'block' | 'delete_oldest' | 'delete_lru';
485
+ export type LibraryPolicyPayload = {
486
+ ttl_after_last_access_days?: number;
487
+ ttl_after_last_modified_days?: number;
488
+ default_expiration_days?: number;
489
+ allowed_mime_types?: string[];
490
+ denied_mime_types?: string[];
491
+ allowed_extensions?: string[];
492
+ auto_private_after_days?: number;
493
+ disable_public_access?: boolean;
494
+ allowed_ip_ranges?: string[];
495
+ notification_mode?: NotificationMode;
496
+ notify_events?: NotifyEvent[];
497
+ notify_roles?: string[];
498
+ notify_emails?: string[];
499
+ notify_before_expiration_days?: number[];
500
+ notify_quota_thresholds?: number[];
501
+ notification_delivery_mode?: NotificationDeliveryMode;
502
+ notification_min_interval_minutes?: number;
503
+ prune_empty_dirs?: boolean;
504
+ worm_days?: number;
505
+ };
506
+ export type DirPolicyPayload = LibraryPolicyPayload & {
507
+ quota_bytes?: number;
508
+ quota_exceeded_action?: QuotaExceededAction;
509
+ };
510
+ export type LibraryPolicy = LibraryPolicyPayload & {
511
+ library_uuid: string;
512
+ scope: 'library';
513
+ };
514
+ export type DirPolicy = DirPolicyPayload & {
515
+ library_uuid: string;
516
+ scope: 'dir';
517
+ path: string;
518
+ };
519
+ /**
520
+ * Recurrence frequency for a per-file notification rule (models.MediaFileNotificationRule)
521
+ */
522
+ export type NotificationRuleFrequency = 'daily' | 'weekly' | 'monthly' | 'yearly';
523
+ export type NotificationRuleStatus = 'active' | 'paused' | 'cancelled' | 'completed';
524
+ /**
525
+ * Payload for creating a recurring reminder on a media file
526
+ * (media-api v3 `library/{uuid}/notification-rules`, mediaFileNotificationRuleRequest).
527
+ * One of `media_uuid` / `file_key` must identify the target file.
528
+ */
529
+ export type NotificationRuleCreatePayload = {
530
+ /** Target file UUID (required unless file_key is provided) */
531
+ media_uuid?: string;
532
+ /** Target file key/path (alternative to media_uuid) */
533
+ file_key?: string;
534
+ /** Recurrence frequency */
535
+ frequency: NotificationRuleFrequency;
536
+ /** First occurrence; must be a future timestamp (RFC3339) */
537
+ start_at: string;
538
+ /** Repeat every N frequency units (default: 1) */
539
+ interval?: number;
540
+ /** Optional recurrence end timestamp (RFC3339) */
541
+ end_at?: string;
542
+ /** Optional cap on number of occurrences */
543
+ max_occurrences?: number;
544
+ /** Recipient email for the reminder (only recipient field the server reads) */
545
+ recipient_email?: string;
546
+ };
547
+ export type NotificationRule = {
548
+ uuid: string;
549
+ library_uuid: string;
550
+ media_uuid: string;
551
+ file_key?: string;
552
+ frequency: NotificationRuleFrequency;
553
+ interval?: number;
554
+ start_at: string;
555
+ end_at?: string;
556
+ max_occurrences?: number;
557
+ recipient_email?: string;
558
+ status: NotificationRuleStatus;
559
+ created_at?: string;
560
+ updated_at?: string;
561
+ };
562
+ export type NotificationRuleListResponse = NotificationRule[];
563
+ export type FileNotificationStatus = 'scheduled' | 'queued' | 'sent' | 'cancelled';
564
+ export type FileNotificationCreatePayload = {
565
+ notify_at: string;
566
+ note: string;
567
+ /** Only recipient field the server (mediaFileNotificationRequest) reads */
568
+ recipient_email?: string;
569
+ };
570
+ export type FileNotification = {
571
+ uuid: string;
572
+ library_uuid: string;
573
+ media_uuid: string;
574
+ file_key?: string;
575
+ file_name?: string;
576
+ /** UUID of the notification rule that generated this occurrence, if any */
577
+ rule_uuid?: string;
578
+ note: string;
579
+ notify_at: string;
580
+ status: FileNotificationStatus;
581
+ sent_at?: string;
582
+ queued_at?: string;
583
+ created_by?: string;
584
+ recipient_email?: string;
585
+ };
586
+ export type FileNotificationListResponse = FileNotification[];
@@ -273,6 +273,21 @@ type Tier = {
273
273
  max_storage_bytes: number;
274
274
  max_users: number;
275
275
  };
276
+ type KnowledgeBaseSearchPayload = {
277
+ query: string;
278
+ agent_uuid: string;
279
+ top_k?: number;
280
+ };
281
+ type KnowledgeBaseSearchChunk = {
282
+ text: string;
283
+ score: number;
284
+ document_name: string;
285
+ document_uuid: string;
286
+ chunk_index: number;
287
+ };
288
+ type KnowledgeBaseSearchResult = {
289
+ chunks: KnowledgeBaseSearchChunk[];
290
+ };
276
291
  type KortexWorkflowMessage = {
277
292
  role: string;
278
293
  content: string;
@@ -291,4 +306,4 @@ type KortexWorkflowResult = {
291
306
  content: string;
292
307
  usage: TokenUsage;
293
308
  };
294
- export { PagedResponse, PaginationParams, RAGConfig, LLMSettings, Agent, AgentCreatePayload, AgentUpdatePayload, ChunkingStrategy, KnowledgeBase, KnowledgeBaseCreatePayload, KnowledgeBaseUpdatePayload, Document, Participant, TokenUsage, ToolCall, RAGSource, Message, Conversation, ConversationCreatePayload, ConversationUpdatePayload, ParticipantAddPayload, ToolResultApproval, ToolResultPayload, PageContext, SendMessagePayload, InjectMessagePayload, OCRPayload, OCRResult, UserAccess, UserAccessCreatePayload, UserAccessUpdatePayload, TopUpPayload, UserMonthlyUsage, UserUsageBreakdown, MyAccess, AggregatedUsage, Tier, KortexWorkflowMessage, KortexWorkflowPayload, KortexWorkflowResult, };
309
+ export { PagedResponse, PaginationParams, RAGConfig, LLMSettings, Agent, AgentCreatePayload, AgentUpdatePayload, ChunkingStrategy, KnowledgeBase, KnowledgeBaseCreatePayload, KnowledgeBaseUpdatePayload, Document, Participant, TokenUsage, ToolCall, RAGSource, Message, Conversation, ConversationCreatePayload, ConversationUpdatePayload, ParticipantAddPayload, ToolResultApproval, ToolResultPayload, PageContext, SendMessagePayload, InjectMessagePayload, OCRPayload, OCRResult, UserAccess, UserAccessCreatePayload, UserAccessUpdatePayload, TopUpPayload, UserMonthlyUsage, UserUsageBreakdown, MyAccess, AggregatedUsage, Tier, KnowledgeBaseSearchPayload, KnowledgeBaseSearchChunk, KnowledgeBaseSearchResult, KortexWorkflowMessage, KortexWorkflowPayload, KortexWorkflowResult, };
@@ -0,0 +1,116 @@
1
+ /** "function" — a stateless FaaS spark; "app" — a long-running spark app. */
2
+ export type SparkType = "function" | "app";
3
+ /** Supported spark language runtimes. */
4
+ export type SparkRuntimeId = "node22" | "node20" | "node18" | "nodejs20" | "nodejs18" | "python311" | "python39" | "go121" | "go119" | "java17" | "java11" | (string & {});
5
+ export interface SparkDist {
6
+ handler: string;
7
+ package: string;
8
+ }
9
+ export interface SparkSettings {
10
+ version: string;
11
+ dist: SparkDist;
12
+ }
13
+ export interface SparkInfo {
14
+ status: string;
15
+ memory: number;
16
+ env_vars: Record<string, string>;
17
+ dependencies?: Record<string, string>;
18
+ }
19
+ export interface SparkEnvInfo {
20
+ dev: SparkInfo;
21
+ live: SparkInfo;
22
+ }
23
+ export interface CloudRunEnv {
24
+ service_name: string;
25
+ service_url: string;
26
+ region: string;
27
+ project_id: string;
28
+ revision: string;
29
+ image_uri: string;
30
+ build_id: string;
31
+ build_status: string;
32
+ build_start_time: number;
33
+ build_duration_seconds: number;
34
+ created_at: number;
35
+ updated_at: number;
36
+ }
37
+ export interface SparkCloudRunInfo {
38
+ dev: CloudRunEnv;
39
+ live: CloudRunEnv;
40
+ }
41
+ export interface Spark {
42
+ uuid: string;
43
+ project_uuid: string;
44
+ name: string;
45
+ type: SparkType;
46
+ runtime: SparkRuntimeId;
47
+ code?: string;
48
+ dev_version: string;
49
+ public_version: string;
50
+ settings: SparkSettings[];
51
+ info: SparkEnvInfo;
52
+ cloud_run?: SparkCloudRunInfo;
53
+ tags: string[];
54
+ }
55
+ /** Payload for `spark().create()`. Memory (Mi) must be one of 128/256/512. */
56
+ export interface CreateSparkPayload {
57
+ name: string;
58
+ type?: SparkType;
59
+ runtime: SparkRuntimeId;
60
+ memory: number;
61
+ settings?: SparkSettings[];
62
+ }
63
+ /** Payload for `spark().update()`. Memory (Mi) must be one of 128/256/512/1024. */
64
+ export interface UpdateSparkPayload {
65
+ memory?: number;
66
+ settings?: SparkSettings[];
67
+ info?: Partial<SparkEnvInfo>;
68
+ }
69
+ export type SparkEnv = "dev" | "live";
70
+ export interface SparkLogsParams {
71
+ env?: SparkEnv;
72
+ limit?: number;
73
+ level?: string;
74
+ since?: string;
75
+ }
76
+ export interface SparkTier {
77
+ [key: string]: any;
78
+ }
79
+ export type RuntimeStatus = "deploying" | "running" | "failed" | "stopped";
80
+ export interface ResourceSpec {
81
+ requests_cpu?: string;
82
+ requests_memory?: string;
83
+ limits_cpu?: string;
84
+ limits_memory?: string;
85
+ }
86
+ export interface Runtime {
87
+ uuid: string;
88
+ project_uuid: string;
89
+ name: string;
90
+ image: string;
91
+ port: number;
92
+ status: RuntimeStatus;
93
+ url: string;
94
+ resources: ResourceSpec;
95
+ env_vars: Record<string, string>;
96
+ created_at: number;
97
+ updated_at: number;
98
+ tags: string[];
99
+ }
100
+ export interface CreateRuntimePayload {
101
+ name: string;
102
+ image: string;
103
+ port: number;
104
+ env_vars?: Record<string, string>;
105
+ resources?: ResourceSpec;
106
+ tags?: string[];
107
+ }
108
+ export interface UpdateRuntimePayload {
109
+ image?: string;
110
+ env_vars?: Record<string, string>;
111
+ resources?: ResourceSpec;
112
+ tags?: string[];
113
+ }
114
+ export interface RuntimeLogsParams {
115
+ lines?: number;
116
+ }
@@ -0,0 +1,198 @@
1
+ /** ISO-8601 timestamp string as returned by the platform (e.g. "2026-07-17T12:00:00Z"). */
2
+ export type ISODateString = string;
3
+ export interface Subscription {
4
+ uuid: string;
5
+ project_uuid: string;
6
+ period: number;
7
+ discount: number;
8
+ renewed_at: ISODateString | null;
9
+ expires_at: ISODateString | null;
10
+ payment_provider: string;
11
+ payment_method: string;
12
+ is_active: boolean;
13
+ is_paused: boolean;
14
+ is_expired: boolean;
15
+ is_canceled: boolean;
16
+ is_trial: boolean;
17
+ trial_period_days: number;
18
+ is_lifetime: boolean;
19
+ payment_status: string;
20
+ ref_no: string;
21
+ price: number;
22
+ human_price: number;
23
+ prorated_human_price?: number;
24
+ license_code?: string | null;
25
+ license_product?: unknown;
26
+ bundle_products?: unknown;
27
+ product_id: string;
28
+ license_qty: string;
29
+ currency: string;
30
+ option_code: string;
31
+ usage?: unknown[];
32
+ created_at: ISODateString;
33
+ updated_at: ISODateString;
34
+ [key: string]: unknown;
35
+ }
36
+ /** Payload for `POST subscription/renew` — renews an expired subscription (bundle-aware). */
37
+ export interface RenewSubscriptionPayload {
38
+ subscription_id: string;
39
+ /** BCP-47-ish locale, e.g. "en_US". Defaults to "en_US" server-side. */
40
+ lang?: string;
41
+ /** ISO 4217 currency code, e.g. "USD". Defaults to "USD" server-side. */
42
+ currency?: string;
43
+ }
44
+ export interface RenewSubscriptionResult {
45
+ message: string;
46
+ invoice: Invoice;
47
+ checkout_link: string;
48
+ transaction_id: string;
49
+ new_expires_at: string;
50
+ amount: number;
51
+ bundle_count: number;
52
+ [key: string]: unknown;
53
+ }
54
+ /** Payload for `POST subscription/cancel`. */
55
+ export interface CancelSubscriptionPayload {
56
+ subscription_id: string;
57
+ reason?: string;
58
+ }
59
+ export interface CancelSubscriptionResult {
60
+ message: string;
61
+ refund_issued: boolean;
62
+ subscription?: Subscription;
63
+ refund_transaction_id?: string;
64
+ [key: string]: unknown;
65
+ }
66
+ export type InvoiceStatus = "draft" | "pending" | "paid" | "canceled" | "refunded" | "overdue" | "void";
67
+ export interface InvoiceLineItem {
68
+ description: string;
69
+ quantity: number;
70
+ unit_price: number;
71
+ amount: number;
72
+ product_id?: string;
73
+ option_code?: string;
74
+ [key: string]: unknown;
75
+ }
76
+ export interface Invoice {
77
+ uuid: string;
78
+ project_uuid: string;
79
+ subscription_uuids?: string[];
80
+ ref_no: string;
81
+ invoice_number: string;
82
+ status: InvoiceStatus;
83
+ period_start: ISODateString | null;
84
+ period_end: ISODateString | null;
85
+ due_date: ISODateString | null;
86
+ paid_at: ISODateString | null;
87
+ subtotal: number;
88
+ tax_amount: number;
89
+ tax_rate: number;
90
+ discount: number;
91
+ total: number;
92
+ amount_paid: number;
93
+ amount_due: number;
94
+ currency: string;
95
+ payment_provider: string;
96
+ payment_method: string;
97
+ transaction_id: string;
98
+ payment_reference: string;
99
+ external_reference?: string;
100
+ billing_name?: string;
101
+ billing_company?: string;
102
+ billing_address?: string;
103
+ billing_city?: string;
104
+ billing_zipcode?: string;
105
+ billing_country?: string;
106
+ billing_state?: string;
107
+ billing_email?: string;
108
+ billing_vat_number?: string;
109
+ description: string;
110
+ notes?: string;
111
+ line_items?: InvoiceLineItem[];
112
+ metadata?: Record<string, unknown>;
113
+ created_at: ISODateString;
114
+ updated_at: ISODateString;
115
+ [key: string]: unknown;
116
+ }
117
+ export interface BalanceResult {
118
+ balance_usd: number;
119
+ balance_display: number;
120
+ exchange_rate: number;
121
+ currency: string;
122
+ topup_bonus?: number;
123
+ [key: string]: unknown;
124
+ }
125
+ /** Payload for `POST billing/topup`. */
126
+ export interface TopUpPayload {
127
+ /** Purchase amount in USD cents (e.g. 1000 = $10.00). */
128
+ amount_cents: number;
129
+ /** ISO 4217 currency code. Defaults to "USD" server-side. */
130
+ currency?: string;
131
+ }
132
+ export interface TopUpResult {
133
+ checkout_url: string;
134
+ ref_no: string;
135
+ [key: string]: unknown;
136
+ }
137
+ export interface CreditsHistoryQuery {
138
+ /** Max rows to return (server default 50, capped at 200). */
139
+ limit?: number;
140
+ offset?: number;
141
+ /** Filter by entry type (e.g. "deduction" | "topup"). */
142
+ type?: string;
143
+ year?: number;
144
+ month?: number;
145
+ }
146
+ export interface CreditsHistoryItem {
147
+ id: string;
148
+ type: string;
149
+ amount_usd: number;
150
+ amount_display: number;
151
+ currency: string;
152
+ amount_micro_cents: number;
153
+ product_id?: string;
154
+ option_code?: string;
155
+ created_at: string;
156
+ event_count: number;
157
+ [key: string]: unknown;
158
+ }
159
+ export interface CreditsHistoryResult {
160
+ items: CreditsHistoryItem[];
161
+ total: number;
162
+ limit: number;
163
+ offset: number;
164
+ currency: string;
165
+ [key: string]: unknown;
166
+ }
167
+ /** Per-usage-domain pricing entries (usage-based pricing table), keyed by option code. */
168
+ export interface UsagePriceEntry {
169
+ price: number;
170
+ precision: number;
171
+ min_infra_cost?: number;
172
+ [key: string]: unknown;
173
+ }
174
+ /** Response of `GET prices/{currency}` — server-computed pricing table for the given currency. */
175
+ export type SubscriptionPrices = Record<string, unknown>;
176
+ export type BillingMode = "credits" | "hybrid" | "invoice";
177
+ export interface BillingModeEntry {
178
+ option_code: string;
179
+ mode: BillingMode;
180
+ [key: string]: unknown;
181
+ }
182
+ export interface GetBillingModesResult {
183
+ usage_billing_modes: BillingModeEntry[];
184
+ platform_defaults: Record<string, unknown>;
185
+ allowed_modes: Record<string, BillingMode[]>;
186
+ [key: string]: unknown;
187
+ }
188
+ /** Payload for `PUT billing/billing-modes` — overrides the billing mode for one usage option code. */
189
+ export interface UpdateBillingModePayload {
190
+ option_code: string;
191
+ mode: BillingMode;
192
+ }
193
+ export interface UpdateBillingModeResult {
194
+ status: boolean;
195
+ option_code: string;
196
+ mode: BillingMode;
197
+ [key: string]: unknown;
198
+ }
@@ -65,3 +65,13 @@ export interface Permission {
65
65
  action: string;
66
66
  role_uuid: string;
67
67
  }
68
+ /**
69
+ * Resolved RBAC permission set for a user on the current project.
70
+ * Matches the dashboard `models.Permissions` response shape returned by
71
+ * `GET /v1/user/role/permissions` and `GET /v1/user/role/principal-permissions`.
72
+ */
73
+ export interface Permissions {
74
+ is_admin: boolean;
75
+ roles: string[];
76
+ permissions: string[];
77
+ }
@@ -45,4 +45,107 @@ type WorkflowUpdatePayload = {
45
45
  settings?: WorkflowSettings[];
46
46
  };
47
47
  type WorkflowListResponse = WorkflowModel[];
48
- export { WorkflowNode, WorkflowNodeConnection, WorkflowSettings, WorkflowModel, WorkflowCreatePayload, WorkflowUpdatePayload, WorkflowListResponse, };
48
+ type WorkflowInstallPayload = {
49
+ name: string;
50
+ project_uuid?: string;
51
+ dev_version?: string;
52
+ public_version?: string;
53
+ integrator?: string;
54
+ settings: WorkflowSettings;
55
+ };
56
+ type WorkflowHistoryQuery = {
57
+ limit?: number;
58
+ offset?: number;
59
+ status?: string;
60
+ ref?: string;
61
+ type?: string;
62
+ workflow_name?: string;
63
+ context_uuid?: string;
64
+ date_from?: string;
65
+ };
66
+ type WorkflowHistoryEntry = {
67
+ execution_uuid: string;
68
+ project_uuid: string;
69
+ status: string;
70
+ ref?: string;
71
+ type?: string;
72
+ context_uuid?: string;
73
+ start_time: string;
74
+ duration?: number;
75
+ [key: string]: any;
76
+ };
77
+ type WorkflowHistoryGroup = {
78
+ context_uuid: string;
79
+ executions: WorkflowHistoryEntry[];
80
+ };
81
+ type WorkflowHistoryListResponse = {
82
+ data: WorkflowHistoryGroup[];
83
+ total: number;
84
+ limit: number;
85
+ offset: number;
86
+ };
87
+ type WorkflowStatsQuery = {
88
+ days?: number;
89
+ };
90
+ type WorkflowStats = {
91
+ period_days: number;
92
+ total_executions: number;
93
+ overall_avg_duration: number;
94
+ status_counts: Record<string, number>;
95
+ avg_durations: Record<string, number>;
96
+ daily_counts?: Record<string, any>[];
97
+ [key: string]: any;
98
+ };
99
+ type WorkflowRunningQuery = {
100
+ limit?: number;
101
+ offset?: number;
102
+ status?: string;
103
+ type?: string;
104
+ ref?: string;
105
+ workflow_name?: string;
106
+ context_uuid?: string;
107
+ };
108
+ type WorkflowRunningExecution = {
109
+ execution_uuid: string;
110
+ project_uuid: string;
111
+ workflow_name: string;
112
+ type: string;
113
+ ref: string;
114
+ context_uuid: string;
115
+ status: string;
116
+ start_time: string;
117
+ duration: number;
118
+ env?: string;
119
+ input_data?: any;
120
+ execution_nodes?: any;
121
+ current_node_id?: number;
122
+ [key: string]: any;
123
+ };
124
+ type WorkflowRunningListResponse = {
125
+ data: WorkflowRunningExecution[];
126
+ total: number;
127
+ limit: number;
128
+ offset: number;
129
+ };
130
+ type WorkflowControlResponse = {
131
+ status: boolean;
132
+ };
133
+ type WorkflowRestartOptions = {
134
+ clearState?: boolean;
135
+ };
136
+ type WorkflowRestartResponse = {
137
+ status: boolean;
138
+ execution_uuid: string;
139
+ };
140
+ type WorkflowNodeControlOptions = {
141
+ iterationIdx?: number;
142
+ parentNodeId?: number;
143
+ };
144
+ type WorkflowError = {
145
+ _id: string;
146
+ projectuuid?: string;
147
+ last_occurence?: string;
148
+ [key: string]: any;
149
+ };
150
+ type WorkflowErrorListResponse = WorkflowError[];
151
+ export { WorkflowNode, WorkflowNodeConnection, WorkflowSettings, WorkflowModel, WorkflowCreatePayload, WorkflowUpdatePayload, WorkflowListResponse, WorkflowInstallPayload, WorkflowHistoryQuery, WorkflowHistoryEntry, WorkflowHistoryGroup, WorkflowHistoryListResponse, WorkflowStatsQuery, WorkflowStats, WorkflowRunningQuery, WorkflowRunningExecution, WorkflowRunningListResponse, WorkflowControlResponse, WorkflowRestartOptions, WorkflowRestartResponse, WorkflowNodeControlOptions, WorkflowError, WorkflowErrorListResponse, };
@@ -1,5 +1,5 @@
1
1
  import PlatformBaseClient from "./platformBaseClient";
2
- import { UserClaims, UserModel, Role, CreateRoleRequest, EditRoleRequest, RoleModel, Permission } from "../types/users";
2
+ import { UserClaims, UserModel, Role, CreateRoleRequest, EditRoleRequest, RoleModel, Permission, Permissions } from "../types/users";
3
3
  import { AxiosResponse } from "axios";
4
4
  export default class Users extends PlatformBaseClient {
5
5
  auth(username: string, password: string, project: string): Promise<AxiosResponse<any>>;
@@ -28,9 +28,28 @@ export default class Users extends PlatformBaseClient {
28
28
  */
29
29
  editProfile(data: any): Promise<AxiosResponse<any>>;
30
30
  /**
31
- * Get user permissions
31
+ * Get the current token's permissions.
32
+ *
33
+ * Returns the resolved permission set carried by the calling token. For a
34
+ * forge actor token this is the scoped intersection minted at launch time —
35
+ * see `getPrincipalPermissions()` for the underlying user's full set.
32
36
  */
33
- getPermissions(): Promise<AxiosResponse<Permission[]>>;
37
+ getPermissions(): Promise<AxiosResponse<Permissions>>;
38
+ /**
39
+ * Get the FULL permissions of the user the current token is acting on behalf
40
+ * of (the "principal").
41
+ *
42
+ * When a forge app runs under an actor token, `getPermissions()` returns only
43
+ * the token's scoped permissions — the intersection of the app's declared
44
+ * runtime permissions and the user's permissions. This instead returns the
45
+ * complete permission set of the underlying user, so the app can check what
46
+ * that user is actually allowed to do, independent of what the app itself was
47
+ * granted. The token scope is unchanged: this exposes knowledge, not capability.
48
+ *
49
+ * For a normal user session (no actor token) it returns the caller's own
50
+ * permissions, identical to `getPermissions()`'s scope.
51
+ */
52
+ getPrincipalPermissions(): Promise<AxiosResponse<Permissions>>;
34
53
  /**
35
54
  * Get list of available permissions
36
55
  */