@inferencesh/sdk 0.6.4 → 0.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/agent/reducer.test.d.ts +1 -0
- package/dist/agent/reducer.test.js +127 -0
- package/dist/api/agents.test.d.ts +1 -0
- package/dist/api/agents.test.js +141 -0
- package/dist/api/files.test.d.ts +1 -0
- package/dist/api/files.test.js +68 -0
- package/dist/api/tasks.d.ts +1 -5
- package/dist/api/tasks.js +1 -1
- package/dist/api/tasks.test.d.ts +1 -0
- package/dist/api/tasks.test.js +157 -0
- package/dist/http/client.test.d.ts +1 -0
- package/dist/http/client.test.js +152 -0
- package/dist/http/errors.test.d.ts +1 -0
- package/dist/http/errors.test.js +53 -0
- package/dist/http/poll.test.d.ts +1 -0
- package/dist/http/poll.test.js +85 -0
- package/dist/proxy/index.test.d.ts +1 -0
- package/dist/proxy/index.test.js +147 -0
- package/dist/stream.test.js +48 -0
- package/dist/types.d.ts +603 -6
- package/dist/types.js +309 -0
- package/dist/utils.test.d.ts +1 -0
- package/dist/utils.test.js +43 -0
- package/package.json +1 -1
package/dist/types.js
CHANGED
|
@@ -1,4 +1,236 @@
|
|
|
1
1
|
// Code generated by gotypegen. DO NOT EDIT.
|
|
2
|
+
/**
|
|
3
|
+
* API Key Scopes - hierarchical permission system.
|
|
4
|
+
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
5
|
+
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
6
|
+
*/
|
|
7
|
+
export const ScopeAll = "*";
|
|
8
|
+
/**
|
|
9
|
+
* Resource-level scopes (implies all actions)
|
|
10
|
+
*/
|
|
11
|
+
export const ScopeAgents = "agents";
|
|
12
|
+
/**
|
|
13
|
+
* API Key Scopes - hierarchical permission system.
|
|
14
|
+
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
15
|
+
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
16
|
+
*/
|
|
17
|
+
export const ScopeApps = "apps";
|
|
18
|
+
/**
|
|
19
|
+
* API Key Scopes - hierarchical permission system.
|
|
20
|
+
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
21
|
+
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
22
|
+
*/
|
|
23
|
+
export const ScopeConversations = "conversations";
|
|
24
|
+
/**
|
|
25
|
+
* API Key Scopes - hierarchical permission system.
|
|
26
|
+
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
27
|
+
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
28
|
+
*/
|
|
29
|
+
export const ScopeFiles = "files";
|
|
30
|
+
/**
|
|
31
|
+
* API Key Scopes - hierarchical permission system.
|
|
32
|
+
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
33
|
+
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
34
|
+
*/
|
|
35
|
+
export const ScopeDatastores = "datastores";
|
|
36
|
+
/**
|
|
37
|
+
* API Key Scopes - hierarchical permission system.
|
|
38
|
+
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
39
|
+
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
40
|
+
*/
|
|
41
|
+
export const ScopeTemplates = "templates";
|
|
42
|
+
/**
|
|
43
|
+
* API Key Scopes - hierarchical permission system.
|
|
44
|
+
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
45
|
+
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
46
|
+
*/
|
|
47
|
+
export const ScopeFlows = "flows";
|
|
48
|
+
/**
|
|
49
|
+
* API Key Scopes - hierarchical permission system.
|
|
50
|
+
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
51
|
+
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
52
|
+
*/
|
|
53
|
+
export const ScopeProjects = "projects";
|
|
54
|
+
/**
|
|
55
|
+
* API Key Scopes - hierarchical permission system.
|
|
56
|
+
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
57
|
+
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
58
|
+
*/
|
|
59
|
+
export const ScopeTeams = "teams";
|
|
60
|
+
/**
|
|
61
|
+
* API Key Scopes - hierarchical permission system.
|
|
62
|
+
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
63
|
+
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
64
|
+
*/
|
|
65
|
+
export const ScopeBilling = "billing";
|
|
66
|
+
/**
|
|
67
|
+
* Action-level scopes for Agents
|
|
68
|
+
*/
|
|
69
|
+
export const ScopeAgentsRead = "agents:read";
|
|
70
|
+
/**
|
|
71
|
+
* API Key Scopes - hierarchical permission system.
|
|
72
|
+
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
73
|
+
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
74
|
+
*/
|
|
75
|
+
export const ScopeAgentsWrite = "agents:write";
|
|
76
|
+
/**
|
|
77
|
+
* API Key Scopes - hierarchical permission system.
|
|
78
|
+
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
79
|
+
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
80
|
+
*/
|
|
81
|
+
export const ScopeAgentsExecute = "agents:execute";
|
|
82
|
+
/**
|
|
83
|
+
* Action-level scopes for Apps
|
|
84
|
+
*/
|
|
85
|
+
export const ScopeAppsRead = "apps:read";
|
|
86
|
+
/**
|
|
87
|
+
* API Key Scopes - hierarchical permission system.
|
|
88
|
+
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
89
|
+
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
90
|
+
*/
|
|
91
|
+
export const ScopeAppsWrite = "apps:write";
|
|
92
|
+
/**
|
|
93
|
+
* API Key Scopes - hierarchical permission system.
|
|
94
|
+
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
95
|
+
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
96
|
+
*/
|
|
97
|
+
export const ScopeAppsExecute = "apps:execute";
|
|
98
|
+
/**
|
|
99
|
+
* Action-level scopes for Conversations/Chats
|
|
100
|
+
*/
|
|
101
|
+
export const ScopeConversationsRead = "conversations:read";
|
|
102
|
+
/**
|
|
103
|
+
* API Key Scopes - hierarchical permission system.
|
|
104
|
+
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
105
|
+
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
106
|
+
*/
|
|
107
|
+
export const ScopeConversationsWrite = "conversations:write";
|
|
108
|
+
/**
|
|
109
|
+
* Action-level scopes for Files
|
|
110
|
+
*/
|
|
111
|
+
export const ScopeFilesRead = "files:read";
|
|
112
|
+
/**
|
|
113
|
+
* API Key Scopes - hierarchical permission system.
|
|
114
|
+
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
115
|
+
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
116
|
+
*/
|
|
117
|
+
export const ScopeFilesWrite = "files:write";
|
|
118
|
+
/**
|
|
119
|
+
* Action-level scopes for Datastores
|
|
120
|
+
*/
|
|
121
|
+
export const ScopeDatastoresRead = "datastores:read";
|
|
122
|
+
/**
|
|
123
|
+
* API Key Scopes - hierarchical permission system.
|
|
124
|
+
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
125
|
+
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
126
|
+
*/
|
|
127
|
+
export const ScopeDatastoresWrite = "datastores:write";
|
|
128
|
+
/**
|
|
129
|
+
* Action-level scopes for Flows
|
|
130
|
+
*/
|
|
131
|
+
export const ScopeFlowsRead = "flows:read";
|
|
132
|
+
/**
|
|
133
|
+
* API Key Scopes - hierarchical permission system.
|
|
134
|
+
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
135
|
+
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
136
|
+
*/
|
|
137
|
+
export const ScopeFlowsWrite = "flows:write";
|
|
138
|
+
/**
|
|
139
|
+
* API Key Scopes - hierarchical permission system.
|
|
140
|
+
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
141
|
+
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
142
|
+
*/
|
|
143
|
+
export const ScopeFlowsExecute = "flows:execute";
|
|
144
|
+
/**
|
|
145
|
+
* Action-level scopes for Projects
|
|
146
|
+
*/
|
|
147
|
+
export const ScopeProjectsRead = "projects:read";
|
|
148
|
+
/**
|
|
149
|
+
* API Key Scopes - hierarchical permission system.
|
|
150
|
+
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
151
|
+
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
152
|
+
*/
|
|
153
|
+
export const ScopeProjectsWrite = "projects:write";
|
|
154
|
+
/**
|
|
155
|
+
* Action-level scopes for Teams
|
|
156
|
+
*/
|
|
157
|
+
export const ScopeTeamsRead = "teams:read";
|
|
158
|
+
/**
|
|
159
|
+
* API Key Scopes - hierarchical permission system.
|
|
160
|
+
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
161
|
+
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
162
|
+
*/
|
|
163
|
+
export const ScopeTeamsWrite = "teams:write";
|
|
164
|
+
/**
|
|
165
|
+
* Action-level scopes for Billing
|
|
166
|
+
*/
|
|
167
|
+
export const ScopeBillingRead = "billing:read";
|
|
168
|
+
/**
|
|
169
|
+
* API Key Scopes - hierarchical permission system.
|
|
170
|
+
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
171
|
+
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
172
|
+
*/
|
|
173
|
+
export const ScopeBillingWrite = "billing:write";
|
|
174
|
+
/**
|
|
175
|
+
* Action-level scopes for Secrets (sensitive - not in read/run presets)
|
|
176
|
+
*/
|
|
177
|
+
export const ScopeSecretsRead = "secrets:read";
|
|
178
|
+
/**
|
|
179
|
+
* API Key Scopes - hierarchical permission system.
|
|
180
|
+
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
181
|
+
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
182
|
+
*/
|
|
183
|
+
export const ScopeSecretsWrite = "secrets:write";
|
|
184
|
+
/**
|
|
185
|
+
* Action-level scopes for Integrations
|
|
186
|
+
*/
|
|
187
|
+
export const ScopeIntegrationsRead = "integrations:read";
|
|
188
|
+
/**
|
|
189
|
+
* API Key Scopes - hierarchical permission system.
|
|
190
|
+
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
191
|
+
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
192
|
+
*/
|
|
193
|
+
export const ScopeIntegrationsWrite = "integrations:write";
|
|
194
|
+
/**
|
|
195
|
+
* Action-level scopes for Engines
|
|
196
|
+
*/
|
|
197
|
+
export const ScopeEnginesRead = "engines:read";
|
|
198
|
+
/**
|
|
199
|
+
* API Key Scopes - hierarchical permission system.
|
|
200
|
+
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
201
|
+
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
202
|
+
*/
|
|
203
|
+
export const ScopeEnginesWrite = "engines:write";
|
|
204
|
+
/**
|
|
205
|
+
* Action-level scopes for API Keys
|
|
206
|
+
*/
|
|
207
|
+
export const ScopeApiKeysRead = "apikeys:read";
|
|
208
|
+
/**
|
|
209
|
+
* API Key Scopes - hierarchical permission system.
|
|
210
|
+
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
211
|
+
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
212
|
+
*/
|
|
213
|
+
export const ScopeApiKeysWrite = "apikeys:write";
|
|
214
|
+
/**
|
|
215
|
+
* Action-level scopes for User profile
|
|
216
|
+
*/
|
|
217
|
+
export const ScopeUserRead = "user:read";
|
|
218
|
+
/**
|
|
219
|
+
* API Key Scopes - hierarchical permission system.
|
|
220
|
+
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
221
|
+
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
222
|
+
*/
|
|
223
|
+
export const ScopeUserWrite = "user:write";
|
|
224
|
+
/**
|
|
225
|
+
* Action-level scopes for Settings/Notifications
|
|
226
|
+
*/
|
|
227
|
+
export const ScopeSettingsRead = "settings:read";
|
|
228
|
+
/**
|
|
229
|
+
* API Key Scopes - hierarchical permission system.
|
|
230
|
+
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
231
|
+
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
232
|
+
*/
|
|
233
|
+
export const ScopeSettingsWrite = "settings:write";
|
|
2
234
|
export const ScopeGroupAgents = "agents";
|
|
3
235
|
export const ScopeGroupApps = "apps";
|
|
4
236
|
export const ScopeGroupConversations = "conversations";
|
|
@@ -90,6 +322,14 @@ export const GraphEdgeTypeExecution = "execution";
|
|
|
90
322
|
export const GraphEdgeTypeParent = "parent";
|
|
91
323
|
export const GraphEdgeTypeAncestor = "ancestor";
|
|
92
324
|
export const GraphEdgeTypeDuplicate = "duplicate";
|
|
325
|
+
export const EntitlementSourceTier = "tier";
|
|
326
|
+
export const EntitlementSourceOverride = "override";
|
|
327
|
+
export const EntitlementSourceWhitelist = "whitelist";
|
|
328
|
+
export const EntitlementSourceTrial = "trial";
|
|
329
|
+
export const EntitlementTypeBoolean = "boolean";
|
|
330
|
+
export const EntitlementTypeLimit = "limit";
|
|
331
|
+
export const EnforcementBlock = "block";
|
|
332
|
+
export const EnforcementWarn = "warn";
|
|
93
333
|
export const PageStatusUnknown = 0;
|
|
94
334
|
export const PageStatusDraft = 1;
|
|
95
335
|
export const PageStatusPublished = 2;
|
|
@@ -140,6 +380,21 @@ export const ProjectTypeFlow = "flow";
|
|
|
140
380
|
export const ProjectTypeOther = "other";
|
|
141
381
|
export const UsageEventResourceTierPrivate = "private";
|
|
142
382
|
export const UsageEventResourceTierCloud = "cloud";
|
|
383
|
+
export const MetaItemTypeText = "text";
|
|
384
|
+
export const MetaItemTypeImage = "image";
|
|
385
|
+
export const MetaItemTypeVideo = "video";
|
|
386
|
+
export const MetaItemTypeAudio = "audio";
|
|
387
|
+
export const MetaItemTypeRaw = "raw";
|
|
388
|
+
export const VideoRes480P = "480p";
|
|
389
|
+
export const VideoRes720P = "720p";
|
|
390
|
+
export const VideoRes1080P = "1080p";
|
|
391
|
+
export const VideoRes1440P = "1440p";
|
|
392
|
+
export const VideoRes4K = "4k";
|
|
393
|
+
export const TeamInviteStatusPending = "pending";
|
|
394
|
+
export const TeamInviteStatusAccepted = "accepted";
|
|
395
|
+
export const TeamInviteStatusDeclined = "declined";
|
|
396
|
+
export const TeamInviteStatusExpired = "expired";
|
|
397
|
+
export const TeamInviteStatusRevoked = "revoked";
|
|
143
398
|
export const OpEqual = "eq";
|
|
144
399
|
export const OpNotEqual = "neq";
|
|
145
400
|
export const OpIn = "in";
|
|
@@ -156,6 +411,22 @@ export const OpIsNull = "is_null";
|
|
|
156
411
|
export const OpIsNotNull = "is_not_null";
|
|
157
412
|
export const OpIsEmpty = "is_empty";
|
|
158
413
|
export const OpIsNotEmpty = "is_not_empty";
|
|
414
|
+
export const ResourceAPIKeys = "api_keys";
|
|
415
|
+
export const ResourceConnectors = "connectors";
|
|
416
|
+
export const ResourceKnowledgeBases = "knowledge_bases";
|
|
417
|
+
export const ResourcePrivateApps = "private_apps";
|
|
418
|
+
export const ResourceStorageMB = "storage_mb";
|
|
419
|
+
export const ResourceConcurrency = "concurrency";
|
|
420
|
+
export const ResourceRatePerMin = "rate_per_min";
|
|
421
|
+
export const ResourceSeats = "seats";
|
|
422
|
+
export const ResourceTaskExecutions = "task_executions";
|
|
423
|
+
export const ResourceFeatureScopes = "feature:scopes";
|
|
424
|
+
export const ResourceFeatureWebhooks = "feature:webhooks";
|
|
425
|
+
export const ResourceFeatureBYOK = "feature:byok";
|
|
426
|
+
export const ResourceFeatureTeamBilling = "feature:team_billing";
|
|
427
|
+
export const ResourceFeatureAutoRecharge = "feature:auto_recharge";
|
|
428
|
+
export const ResourceFeatureInvoices = "feature:invoices";
|
|
429
|
+
export const ResourceFeaturePublishApps = "feature:publish_apps";
|
|
159
430
|
export const ContentSafe = "safe";
|
|
160
431
|
export const ContentSexualSuggestive = "sexual_suggestive";
|
|
161
432
|
export const ContentSexualExplicit = "sexual_explicit";
|
|
@@ -213,6 +484,44 @@ export const TaskLogTypeTask = 4;
|
|
|
213
484
|
export const TeamTypePersonal = "personal";
|
|
214
485
|
export const TeamTypeTeam = "team";
|
|
215
486
|
export const TeamTypeSystem = "system";
|
|
487
|
+
export const TeamStatusActive = "active";
|
|
488
|
+
export const TeamStatusSuspended = "suspended";
|
|
489
|
+
export const TeamStatusTerminated = "terminated";
|
|
490
|
+
export const TeamRoleOwner = "owner";
|
|
491
|
+
export const TeamRoleAdmin = "admin";
|
|
492
|
+
export const TeamRoleMember = "member";
|
|
493
|
+
/**
|
|
494
|
+
* Tool types and parameter types
|
|
495
|
+
*/
|
|
496
|
+
export const ToolTypeFunction = "function";
|
|
497
|
+
/**
|
|
498
|
+
* Tool types and parameter types
|
|
499
|
+
*/
|
|
500
|
+
export const ToolParamTypeObject = "object";
|
|
501
|
+
/**
|
|
502
|
+
* Tool types and parameter types
|
|
503
|
+
*/
|
|
504
|
+
export const ToolParamTypeString = "string";
|
|
505
|
+
/**
|
|
506
|
+
* Tool types and parameter types
|
|
507
|
+
*/
|
|
508
|
+
export const ToolParamTypeInteger = "integer";
|
|
509
|
+
/**
|
|
510
|
+
* Tool types and parameter types
|
|
511
|
+
*/
|
|
512
|
+
export const ToolParamTypeNumber = "number";
|
|
513
|
+
/**
|
|
514
|
+
* Tool types and parameter types
|
|
515
|
+
*/
|
|
516
|
+
export const ToolParamTypeBoolean = "boolean";
|
|
517
|
+
/**
|
|
518
|
+
* Tool types and parameter types
|
|
519
|
+
*/
|
|
520
|
+
export const ToolParamTypeArray = "array";
|
|
521
|
+
/**
|
|
522
|
+
* Tool types and parameter types
|
|
523
|
+
*/
|
|
524
|
+
export const ToolParamTypeNull = "null";
|
|
216
525
|
export const RoleGuest = "guest";
|
|
217
526
|
export const RoleUser = "user";
|
|
218
527
|
export const RoleAdmin = "admin";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { TaskStatusCancelled, TaskStatusCompleted, TaskStatusFailed, TaskStatusRunning, TaskStatusUnknown, } from './types';
|
|
2
|
+
import { isTerminalStatus, parseStatus } from './utils';
|
|
3
|
+
describe('parseStatus', () => {
|
|
4
|
+
it('should return TaskStatusUnknown for null and undefined', () => {
|
|
5
|
+
expect(parseStatus(null)).toBe(TaskStatusUnknown);
|
|
6
|
+
expect(parseStatus(undefined)).toBe(TaskStatusUnknown);
|
|
7
|
+
});
|
|
8
|
+
it('should pass through numeric status values', () => {
|
|
9
|
+
expect(parseStatus(TaskStatusRunning)).toBe(TaskStatusRunning);
|
|
10
|
+
expect(parseStatus(TaskStatusCompleted)).toBe(TaskStatusCompleted);
|
|
11
|
+
});
|
|
12
|
+
it('should map lowercase string status names to TaskStatus', () => {
|
|
13
|
+
expect(parseStatus('running')).toBe(TaskStatusRunning);
|
|
14
|
+
expect(parseStatus('completed')).toBe(TaskStatusCompleted);
|
|
15
|
+
expect(parseStatus('failed')).toBe(TaskStatusFailed);
|
|
16
|
+
expect(parseStatus('cancelled')).toBe(TaskStatusCancelled);
|
|
17
|
+
});
|
|
18
|
+
it('should be case-insensitive for string statuses', () => {
|
|
19
|
+
expect(parseStatus('COMPLETED')).toBe(TaskStatusCompleted);
|
|
20
|
+
expect(parseStatus('Running')).toBe(TaskStatusRunning);
|
|
21
|
+
});
|
|
22
|
+
it('should return TaskStatusUnknown for unrecognized strings', () => {
|
|
23
|
+
expect(parseStatus('not_a_real_status')).toBe(TaskStatusUnknown);
|
|
24
|
+
});
|
|
25
|
+
it('should return TaskStatusUnknown for non-string non-number values', () => {
|
|
26
|
+
expect(parseStatus(true)).toBe(TaskStatusUnknown);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
describe('isTerminalStatus', () => {
|
|
30
|
+
it('should be true for completed, failed, and cancelled (int or string)', () => {
|
|
31
|
+
expect(isTerminalStatus(TaskStatusCompleted)).toBe(true);
|
|
32
|
+
expect(isTerminalStatus(TaskStatusFailed)).toBe(true);
|
|
33
|
+
expect(isTerminalStatus(TaskStatusCancelled)).toBe(true);
|
|
34
|
+
expect(isTerminalStatus('completed')).toBe(true);
|
|
35
|
+
expect(isTerminalStatus('failed')).toBe(true);
|
|
36
|
+
expect(isTerminalStatus('cancelled')).toBe(true);
|
|
37
|
+
});
|
|
38
|
+
it('should be false for non-terminal statuses', () => {
|
|
39
|
+
expect(isTerminalStatus(TaskStatusRunning)).toBe(false);
|
|
40
|
+
expect(isTerminalStatus('running')).toBe(false);
|
|
41
|
+
expect(isTerminalStatus(null)).toBe(false);
|
|
42
|
+
});
|
|
43
|
+
});
|