@spooled/sdk 1.0.25 → 1.0.27
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 +5 -5
- package/dist/{index-BpdxwqW0.d.cts → index-BKzL6R4h.d.cts} +3 -3
- package/dist/{index-BpdxwqW0.d.ts → index-BKzL6R4h.d.ts} +3 -3
- package/dist/index.cjs +28 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +28 -16
- package/dist/index.js.map +1 -1
- package/dist/worker/index.cjs +1 -1
- package/dist/worker/index.cjs.map +1 -1
- package/dist/worker/index.d.cts +1 -1
- package/dist/worker/index.d.ts +1 -1
- package/dist/worker/index.js +1 -1
- package/dist/worker/index.js.map +1 -1
- package/package.json +14 -16
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RealtimeConnectionOptions, C as ConnectionState, S as SubscriptionFilter, a as RealtimeEventType, b as RealtimeEvent, c as RetryConfig } from './index-
|
|
2
|
-
export { A as API_VERSION,
|
|
1
|
+
import { R as RealtimeConnectionOptions, C as ConnectionState, S as SubscriptionFilter, a as RealtimeEventType, b as RealtimeEvent, c as RetryConfig } from './index-BKzL6R4h.cjs';
|
|
2
|
+
export { A as API_VERSION, d as AddDependenciesParams, e as AddDependenciesResponse, f as AdminApiKeyResponse, g as AdminCreateApiKeyParams, h as AdminCreateOrganizationParams, i as AdminCreateOrganizationResponse, j as AdminDeleteOrganizationParams, k as AdminListOrganizationsParams, l as AdminOrganizationDetail, m as AdminOrganizationList, n as AdminOrganizationSummary, o as AdminPlanLimits, p as AdminPlatformStats, q as AdminResource, r as AdminUpdateOrganizationParams, s as AdminUsageStats, t as ApiKeySummary, u as ApiKeysResource, v as AuthResource, B as BatchJobStatus, w as BillingResource, x as BillingStatus, y as BoostPriorityResponse, z as BulkEnqueueParams, D as BulkEnqueueResponse, E as BulkJobItem, F as CheckSlugResponse, G as CircuitBreaker, H as CircuitBreakerConfig, I as CircuitState, J as ClaimJobsParams, K as ClaimJobsResult, L as ClaimedJob, M as CompleteJobParams, N as CreateApiKeyParams, O as CreateApiKeyResponse, P as CreateBillingPortalParams, Q as CreateBillingPortalResponse, T as CreateJobParams, U as CreateJobResult, V as CreateOrganizationParams, W as CreateOrganizationResponse, X as CreateOutgoingWebhookParams, Y as CreateScheduleParams, Z as CreateScheduleResponse, _ as CreateWorkflowParams, $ as CreateWorkflowResponse, a0 as CurrentUserResponse, a1 as DEFAULT_CONFIG, a2 as DashboardData, a3 as DashboardResource, a4 as DashboardWorkerSummary, a5 as DebugFn, a6 as DependencyMode, a7 as FailJobParams, a8 as GrpcClientOptions, a9 as GrpcCompleteJobParams, aa as GrpcCompleteJobResponse, ab as GrpcCompleteRequest, ac as GrpcCompleteResponse, ad as GrpcDequeueJobParams, ae as GrpcDequeueJobResponse, af as GrpcDequeueRequest, ag as GrpcDequeueResponse, ah as GrpcDeregisterRequest, ai as GrpcDeregisterResponse, aj as GrpcEnqueueJobParams, ak as GrpcEnqueueJobResponse, al as GrpcEnqueueRequest, am as GrpcEnqueueResponse, an as GrpcErrorResponse, ao as GrpcFailJobParams, ap as GrpcFailJobResponse, aq as GrpcFailRequest, ar as GrpcFailResponse, as as GrpcGetJobRequest, at as GrpcGetJobResponse, au as GrpcGetQueueStatsRequest, av as GrpcGetQueueStatsResponse, aw as GrpcGetQueueStatsResponse_Legacy, ax as GrpcHeartbeatParams, ay as GrpcHeartbeatRequest, az as GrpcHeartbeatResponse, aA as GrpcHeartbeatResponse_Legacy, aB as GrpcJob, aC as GrpcJobStatus, aD as GrpcJobStatusNumber, aE as GrpcProcessRequest, aF as GrpcProcessResponse, aG as GrpcQueueOperations, aH as GrpcRegisterWorkerParams, aI as GrpcRegisterWorkerRequest, aJ as GrpcRegisterWorkerResponse, aK as GrpcRegisterWorkerResponse_Legacy, aL as GrpcRenewLeaseParams, aM as GrpcRenewLeaseRequest, aN as GrpcRenewLeaseResponse, aO as GrpcRenewLeaseResponse_Legacy, aP as GrpcStreamJobsRequest, aQ as GrpcTimestamp, aR as GrpcWorkerOperations, aS as HealthResource, aT as HealthResponse, aU as HeartbeatEvent, aV as HeartbeatJobParams, aW as HttpClient, aX as IngestCustomWebhookParams, aY as IngestGitHubWebhookOptions, aZ as IngestStripeWebhookOptions, a_ as InitialApiKey, a$ as Job, b0 as JobCompletedEvent, b1 as JobContext, b2 as JobCreatedEvent, b3 as JobFailedEvent, b4 as JobHandler, b5 as JobProgressEvent, b6 as JobResult, b7 as JobStartedEvent, b8 as JobStats, b9 as JobStatus, ba as JobStatusChangedEvent, bb as JobStream, bc as JobSummary, bd as JobSummaryStats, be as JobWithDependencies, bf as JobsResource, bg as JsonArray, bh as JsonObject, bi as JsonPrimitive, bj as JsonValue, bk as ListDlqParams, bl as ListJobsParams, bm as ListParams, bn as ListSchedulesParams, bo as ListWorkflowsParams, bp as LoginParams, bq as LoginResponse, br as MetricsResource, bs as Organization, bt as OrganizationMember, bu as OrganizationSummary, bv as OrganizationUsage, bw as OrganizationsResource, bx as OutgoingWebhook, by as OutgoingWebhookDelivery, bz as PaginatedResponse, bA as PaginationParams, bB as PauseQueueResponse, bC as PlanCount, bD as PlanLimits, bE as PlanTier, bF as ProcessJobsStream, bG as PurgeDlqParams, bH as PurgeDlqResponse, bI as QueueConfig, bJ as QueueConfigSummary, bK as QueuePausedEvent, bL as QueueResumedEvent, bM as QueueStats, bN as QueueSummary, bO as QueuesResource, bP as RealtimeEventData, bQ as RecentActivity, bR as RefreshTokenParams, bS as RefreshTokenResponse, bT as RegisterWorkerParams, bU as RegisterWorkerResponse, bV as ResolvedConfig, bW as ResourceUsage, bX as ResumeQueueResponse, bY as RetryDlqParams, bZ as RetryDlqResponse, b_ as SDK_VERSION, b$ as Schedule, c0 as ScheduleRun, c1 as ScheduleRunStatus, c2 as ScheduleTriggeredEvent, c3 as SchedulesResource, c4 as SpooledClient, c5 as SpooledClientConfig, c6 as SpooledGrpcClient, c7 as SpooledRealtime, c8 as SpooledRealtimeOptions, c9 as SpooledWorker, ca as SpooledWorkerOptions, cb as StreamOptions, cc as SystemInfo, cd as TestWebhookResponse, ce as TriggerScheduleResponse, cf as UpdateApiKeyParams, cg as UpdateOrganizationParams, ch as UpdateOutgoingWebhookParams, ci as UpdateQueueConfigParams, cj as UpdateScheduleParams, ck as UsageItem, cl as UsageWarning, cm as ValidateTokenParams, cn as ValidateTokenResponse, co as WebhookDeliveryStatus, cp as WebhookEventType, cq as WebhookIngestionResource, cr as WebhookTokenResponse, cs as WebhooksResource, ct as Worker, cu as WorkerDeregisteredEvent, cv as WorkerEvent, cw as WorkerEventData, cx as WorkerHeartbeatParams, cy as WorkerRegisteredEvent, cz as WorkerState, cA as WorkerStatus, cB as WorkerSummary, cC as WorkersResource, cD as Workflow, cE as WorkflowJob, cF as WorkflowJobDefinition, cG as WorkflowJobStatus, cH as WorkflowResponse, cI as WorkflowStatus, cJ as WorkflowsResource, cK as asyncIterableFromStream, cL as createCircuitBreaker, cM as createClient, cN as createHttpClient, cO as createJobStream, cP as createPaginatedResponse, cQ as createProcessJobsStream, cR as dateToTimestamp, cS as resolveConfig, cT as timestampToDate, cU as validateConfig } from './index-BKzL6R4h.cjs';
|
|
3
3
|
import * as protoLoader from '@grpc/proto-loader';
|
|
4
4
|
import { ServiceClientConstructor } from '@grpc/grpc-js';
|
|
5
5
|
|
|
@@ -34,6 +34,10 @@ declare class WebSocketRealtimeClient {
|
|
|
34
34
|
* Get current connection state
|
|
35
35
|
*/
|
|
36
36
|
getState(): ConnectionState;
|
|
37
|
+
/**
|
|
38
|
+
* Get WebSocket implementation (browser native or Node.js ws package)
|
|
39
|
+
*/
|
|
40
|
+
private getWebSocketImpl;
|
|
37
41
|
/**
|
|
38
42
|
* Connect to the WebSocket server
|
|
39
43
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RealtimeConnectionOptions, C as ConnectionState, S as SubscriptionFilter, a as RealtimeEventType, b as RealtimeEvent, c as RetryConfig } from './index-
|
|
2
|
-
export { A as API_VERSION,
|
|
1
|
+
import { R as RealtimeConnectionOptions, C as ConnectionState, S as SubscriptionFilter, a as RealtimeEventType, b as RealtimeEvent, c as RetryConfig } from './index-BKzL6R4h.js';
|
|
2
|
+
export { A as API_VERSION, d as AddDependenciesParams, e as AddDependenciesResponse, f as AdminApiKeyResponse, g as AdminCreateApiKeyParams, h as AdminCreateOrganizationParams, i as AdminCreateOrganizationResponse, j as AdminDeleteOrganizationParams, k as AdminListOrganizationsParams, l as AdminOrganizationDetail, m as AdminOrganizationList, n as AdminOrganizationSummary, o as AdminPlanLimits, p as AdminPlatformStats, q as AdminResource, r as AdminUpdateOrganizationParams, s as AdminUsageStats, t as ApiKeySummary, u as ApiKeysResource, v as AuthResource, B as BatchJobStatus, w as BillingResource, x as BillingStatus, y as BoostPriorityResponse, z as BulkEnqueueParams, D as BulkEnqueueResponse, E as BulkJobItem, F as CheckSlugResponse, G as CircuitBreaker, H as CircuitBreakerConfig, I as CircuitState, J as ClaimJobsParams, K as ClaimJobsResult, L as ClaimedJob, M as CompleteJobParams, N as CreateApiKeyParams, O as CreateApiKeyResponse, P as CreateBillingPortalParams, Q as CreateBillingPortalResponse, T as CreateJobParams, U as CreateJobResult, V as CreateOrganizationParams, W as CreateOrganizationResponse, X as CreateOutgoingWebhookParams, Y as CreateScheduleParams, Z as CreateScheduleResponse, _ as CreateWorkflowParams, $ as CreateWorkflowResponse, a0 as CurrentUserResponse, a1 as DEFAULT_CONFIG, a2 as DashboardData, a3 as DashboardResource, a4 as DashboardWorkerSummary, a5 as DebugFn, a6 as DependencyMode, a7 as FailJobParams, a8 as GrpcClientOptions, a9 as GrpcCompleteJobParams, aa as GrpcCompleteJobResponse, ab as GrpcCompleteRequest, ac as GrpcCompleteResponse, ad as GrpcDequeueJobParams, ae as GrpcDequeueJobResponse, af as GrpcDequeueRequest, ag as GrpcDequeueResponse, ah as GrpcDeregisterRequest, ai as GrpcDeregisterResponse, aj as GrpcEnqueueJobParams, ak as GrpcEnqueueJobResponse, al as GrpcEnqueueRequest, am as GrpcEnqueueResponse, an as GrpcErrorResponse, ao as GrpcFailJobParams, ap as GrpcFailJobResponse, aq as GrpcFailRequest, ar as GrpcFailResponse, as as GrpcGetJobRequest, at as GrpcGetJobResponse, au as GrpcGetQueueStatsRequest, av as GrpcGetQueueStatsResponse, aw as GrpcGetQueueStatsResponse_Legacy, ax as GrpcHeartbeatParams, ay as GrpcHeartbeatRequest, az as GrpcHeartbeatResponse, aA as GrpcHeartbeatResponse_Legacy, aB as GrpcJob, aC as GrpcJobStatus, aD as GrpcJobStatusNumber, aE as GrpcProcessRequest, aF as GrpcProcessResponse, aG as GrpcQueueOperations, aH as GrpcRegisterWorkerParams, aI as GrpcRegisterWorkerRequest, aJ as GrpcRegisterWorkerResponse, aK as GrpcRegisterWorkerResponse_Legacy, aL as GrpcRenewLeaseParams, aM as GrpcRenewLeaseRequest, aN as GrpcRenewLeaseResponse, aO as GrpcRenewLeaseResponse_Legacy, aP as GrpcStreamJobsRequest, aQ as GrpcTimestamp, aR as GrpcWorkerOperations, aS as HealthResource, aT as HealthResponse, aU as HeartbeatEvent, aV as HeartbeatJobParams, aW as HttpClient, aX as IngestCustomWebhookParams, aY as IngestGitHubWebhookOptions, aZ as IngestStripeWebhookOptions, a_ as InitialApiKey, a$ as Job, b0 as JobCompletedEvent, b1 as JobContext, b2 as JobCreatedEvent, b3 as JobFailedEvent, b4 as JobHandler, b5 as JobProgressEvent, b6 as JobResult, b7 as JobStartedEvent, b8 as JobStats, b9 as JobStatus, ba as JobStatusChangedEvent, bb as JobStream, bc as JobSummary, bd as JobSummaryStats, be as JobWithDependencies, bf as JobsResource, bg as JsonArray, bh as JsonObject, bi as JsonPrimitive, bj as JsonValue, bk as ListDlqParams, bl as ListJobsParams, bm as ListParams, bn as ListSchedulesParams, bo as ListWorkflowsParams, bp as LoginParams, bq as LoginResponse, br as MetricsResource, bs as Organization, bt as OrganizationMember, bu as OrganizationSummary, bv as OrganizationUsage, bw as OrganizationsResource, bx as OutgoingWebhook, by as OutgoingWebhookDelivery, bz as PaginatedResponse, bA as PaginationParams, bB as PauseQueueResponse, bC as PlanCount, bD as PlanLimits, bE as PlanTier, bF as ProcessJobsStream, bG as PurgeDlqParams, bH as PurgeDlqResponse, bI as QueueConfig, bJ as QueueConfigSummary, bK as QueuePausedEvent, bL as QueueResumedEvent, bM as QueueStats, bN as QueueSummary, bO as QueuesResource, bP as RealtimeEventData, bQ as RecentActivity, bR as RefreshTokenParams, bS as RefreshTokenResponse, bT as RegisterWorkerParams, bU as RegisterWorkerResponse, bV as ResolvedConfig, bW as ResourceUsage, bX as ResumeQueueResponse, bY as RetryDlqParams, bZ as RetryDlqResponse, b_ as SDK_VERSION, b$ as Schedule, c0 as ScheduleRun, c1 as ScheduleRunStatus, c2 as ScheduleTriggeredEvent, c3 as SchedulesResource, c4 as SpooledClient, c5 as SpooledClientConfig, c6 as SpooledGrpcClient, c7 as SpooledRealtime, c8 as SpooledRealtimeOptions, c9 as SpooledWorker, ca as SpooledWorkerOptions, cb as StreamOptions, cc as SystemInfo, cd as TestWebhookResponse, ce as TriggerScheduleResponse, cf as UpdateApiKeyParams, cg as UpdateOrganizationParams, ch as UpdateOutgoingWebhookParams, ci as UpdateQueueConfigParams, cj as UpdateScheduleParams, ck as UsageItem, cl as UsageWarning, cm as ValidateTokenParams, cn as ValidateTokenResponse, co as WebhookDeliveryStatus, cp as WebhookEventType, cq as WebhookIngestionResource, cr as WebhookTokenResponse, cs as WebhooksResource, ct as Worker, cu as WorkerDeregisteredEvent, cv as WorkerEvent, cw as WorkerEventData, cx as WorkerHeartbeatParams, cy as WorkerRegisteredEvent, cz as WorkerState, cA as WorkerStatus, cB as WorkerSummary, cC as WorkersResource, cD as Workflow, cE as WorkflowJob, cF as WorkflowJobDefinition, cG as WorkflowJobStatus, cH as WorkflowResponse, cI as WorkflowStatus, cJ as WorkflowsResource, cK as asyncIterableFromStream, cL as createCircuitBreaker, cM as createClient, cN as createHttpClient, cO as createJobStream, cP as createPaginatedResponse, cQ as createProcessJobsStream, cR as dateToTimestamp, cS as resolveConfig, cT as timestampToDate, cU as validateConfig } from './index-BKzL6R4h.js';
|
|
3
3
|
import * as protoLoader from '@grpc/proto-loader';
|
|
4
4
|
import { ServiceClientConstructor } from '@grpc/grpc-js';
|
|
5
5
|
|
|
@@ -34,6 +34,10 @@ declare class WebSocketRealtimeClient {
|
|
|
34
34
|
* Get current connection state
|
|
35
35
|
*/
|
|
36
36
|
getState(): ConnectionState;
|
|
37
|
+
/**
|
|
38
|
+
* Get WebSocket implementation (browser native or Node.js ws package)
|
|
39
|
+
*/
|
|
40
|
+
private getWebSocketImpl;
|
|
37
41
|
/**
|
|
38
42
|
* Connect to the WebSocket server
|
|
39
43
|
*/
|
package/dist/index.js
CHANGED
|
@@ -6,13 +6,6 @@ import { fileURLToPath } from 'url';
|
|
|
6
6
|
import { dirname, join } from 'path';
|
|
7
7
|
import { hostname } from 'os';
|
|
8
8
|
|
|
9
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
10
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
11
|
-
}) : x)(function(x) {
|
|
12
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
13
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
14
|
-
});
|
|
15
|
-
|
|
16
9
|
// src/config.ts
|
|
17
10
|
var DEFAULT_CONFIG = {
|
|
18
11
|
baseUrl: "https://api.spooled.cloud",
|
|
@@ -32,10 +25,10 @@ var DEFAULT_CONFIG = {
|
|
|
32
25
|
successThreshold: 3,
|
|
33
26
|
timeout: 3e4
|
|
34
27
|
},
|
|
35
|
-
userAgent: "@spooled/sdk-nodejs/1.0.
|
|
28
|
+
userAgent: "@spooled/sdk-nodejs/1.0.26",
|
|
36
29
|
autoRefreshToken: true
|
|
37
30
|
};
|
|
38
|
-
var SDK_VERSION = "1.0.
|
|
31
|
+
var SDK_VERSION = "1.0.26";
|
|
39
32
|
var API_VERSION = "v1";
|
|
40
33
|
var API_BASE_PATH = `/api/${API_VERSION}`;
|
|
41
34
|
function resolveConfig(options) {
|
|
@@ -1788,6 +1781,16 @@ var WebSocketRealtimeClient = class {
|
|
|
1788
1781
|
getState() {
|
|
1789
1782
|
return this.state;
|
|
1790
1783
|
}
|
|
1784
|
+
/**
|
|
1785
|
+
* Get WebSocket implementation (browser native or Node.js ws package)
|
|
1786
|
+
*/
|
|
1787
|
+
async getWebSocketImpl() {
|
|
1788
|
+
if (typeof WebSocket !== "undefined") {
|
|
1789
|
+
return WebSocket;
|
|
1790
|
+
}
|
|
1791
|
+
const wsModule = await import('ws');
|
|
1792
|
+
return wsModule.default;
|
|
1793
|
+
}
|
|
1791
1794
|
/**
|
|
1792
1795
|
* Connect to the WebSocket server
|
|
1793
1796
|
*/
|
|
@@ -1795,12 +1798,18 @@ var WebSocketRealtimeClient = class {
|
|
|
1795
1798
|
if (this.state === "connected" || this.state === "connecting") {
|
|
1796
1799
|
return;
|
|
1797
1800
|
}
|
|
1801
|
+
this.setState("connecting");
|
|
1802
|
+
const wsUrl = this.buildWsUrl();
|
|
1803
|
+
this.options.debug(`Connecting to ${wsUrl}`);
|
|
1804
|
+
let WebSocketImpl;
|
|
1805
|
+
try {
|
|
1806
|
+
WebSocketImpl = await this.getWebSocketImpl();
|
|
1807
|
+
} catch (error) {
|
|
1808
|
+
this.setState("disconnected");
|
|
1809
|
+
throw new Error(`Failed to load WebSocket implementation: ${error}`);
|
|
1810
|
+
}
|
|
1798
1811
|
return new Promise((resolve, reject) => {
|
|
1799
|
-
this.setState("connecting");
|
|
1800
|
-
const wsUrl = this.buildWsUrl();
|
|
1801
|
-
this.options.debug(`Connecting to ${wsUrl}`);
|
|
1802
1812
|
try {
|
|
1803
|
-
const WebSocketImpl = typeof WebSocket !== "undefined" ? WebSocket : __require("ws");
|
|
1804
1813
|
this.ws = new WebSocketImpl(wsUrl);
|
|
1805
1814
|
this.ws.onopen = () => {
|
|
1806
1815
|
this.options.debug("WebSocket connected");
|
|
@@ -2022,7 +2031,7 @@ var WebSocketRealtimeClient = class {
|
|
|
2022
2031
|
return JSON.stringify(filter);
|
|
2023
2032
|
}
|
|
2024
2033
|
generateRequestId() {
|
|
2025
|
-
return `req_${Date.now()}_${Math.random().toString(36).
|
|
2034
|
+
return `req_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
|
|
2026
2035
|
}
|
|
2027
2036
|
};
|
|
2028
2037
|
|
|
@@ -2214,7 +2223,10 @@ var SseRealtimeClient = class {
|
|
|
2214
2223
|
}
|
|
2215
2224
|
}
|
|
2216
2225
|
handleDisconnect() {
|
|
2217
|
-
this.eventSource
|
|
2226
|
+
if (this.eventSource) {
|
|
2227
|
+
this.eventSource.close();
|
|
2228
|
+
this.eventSource = null;
|
|
2229
|
+
}
|
|
2218
2230
|
if (this.options.autoReconnect && this.reconnectAttempts < this.options.maxReconnectAttempts) {
|
|
2219
2231
|
this.scheduleReconnect();
|
|
2220
2232
|
} else {
|
|
@@ -3026,7 +3038,7 @@ var SpooledWorker = class {
|
|
|
3026
3038
|
...DEFAULT_OPTIONS,
|
|
3027
3039
|
hostname: hostname(),
|
|
3028
3040
|
workerType: "nodejs",
|
|
3029
|
-
version: "1.0.
|
|
3041
|
+
version: "1.0.26",
|
|
3030
3042
|
metadata: {},
|
|
3031
3043
|
...options
|
|
3032
3044
|
};
|