@datocms/rest-api-events
Advanced tools
Comparing version 3.1.3 to 3.1.4
@@ -28,3 +28,3 @@ "use strict"; | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
while (g && (g = 0, op[0] && (_ = 0)), _) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
@@ -31,0 +31,0 @@ if (y = 0, t) op = [op[0] & 2, t.value]; |
@@ -17,3 +17,3 @@ "use strict"; | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
while (g && (g = 0, op[0] && (_ = 0)), _) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
@@ -20,0 +20,0 @@ if (y = 0, t) op = [op[0] & 2, t.value]; |
@@ -1,2 +0,2 @@ | ||
export declare type JobResult = { | ||
export type JobResult = { | ||
type: 'job_result'; | ||
@@ -3,0 +3,0 @@ id: string; |
import { GenericClient, JobResult } from './internalTypes'; | ||
import { SubscriptionConfig } from './subscribeToEvents'; | ||
export declare type SubscribeToEventsSubscriptionConfig = Pick<SubscriptionConfig, 'cluster' | 'appKey'>; | ||
export type SubscribeToEventsSubscriptionConfig = Pick<SubscriptionConfig, 'cluster' | 'appKey'>; | ||
export declare class JobResultsFetcher<T extends GenericClient> { | ||
@@ -5,0 +5,0 @@ private eventsSubscription; |
@@ -27,3 +27,3 @@ var __assign = (this && this.__assign) || function () { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
while (g && (g = 0, op[0] && (_ = 0)), _) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
@@ -30,0 +30,0 @@ if (y = 0, t) op = [op[0] & 2, t.value]; |
import { Channel, Options } from 'pusher-js'; | ||
import { JobResult } from './internalTypes'; | ||
export declare type EventsSubscription = { | ||
export type EventsSubscription = { | ||
channel: Channel; | ||
@@ -8,3 +8,3 @@ waitJobResult: (jobId: string) => Promise<JobResult>; | ||
}; | ||
export declare type SubscriptionConfig = { | ||
export type SubscriptionConfig = { | ||
authEndpoint: string; | ||
@@ -11,0 +11,0 @@ apiToken: string; |
@@ -0,5 +1,5 @@ | ||
import { SubscribeToEventsSubscriptionConfig } from './JobResultsFetcher'; | ||
import { GenericClient } from './internalTypes'; | ||
import { SubscribeToEventsSubscriptionConfig } from './JobResultsFetcher'; | ||
declare type UnsubscribeToEventsFn = () => void; | ||
type UnsubscribeToEventsFn = () => void; | ||
export declare function withEventsSubscription<T extends GenericClient>(client: T, config?: SubscribeToEventsSubscriptionConfig): Promise<[T, UnsubscribeToEventsFn]>; | ||
export {}; |
@@ -16,3 +16,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
while (g && (g = 0, op[0] && (_ = 0)), _) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
@@ -19,0 +19,0 @@ if (y = 0, t) op = [op[0] & 2, t.value]; |
@@ -1,2 +0,2 @@ | ||
export declare type JobResult = { | ||
export type JobResult = { | ||
type: 'job_result'; | ||
@@ -3,0 +3,0 @@ id: string; |
import { GenericClient, JobResult } from './internalTypes'; | ||
import { SubscriptionConfig } from './subscribeToEvents'; | ||
export declare type SubscribeToEventsSubscriptionConfig = Pick<SubscriptionConfig, 'cluster' | 'appKey'>; | ||
export type SubscribeToEventsSubscriptionConfig = Pick<SubscriptionConfig, 'cluster' | 'appKey'>; | ||
export declare class JobResultsFetcher<T extends GenericClient> { | ||
@@ -5,0 +5,0 @@ private eventsSubscription; |
import { Channel, Options } from 'pusher-js'; | ||
import { JobResult } from './internalTypes'; | ||
export declare type EventsSubscription = { | ||
export type EventsSubscription = { | ||
channel: Channel; | ||
@@ -8,3 +8,3 @@ waitJobResult: (jobId: string) => Promise<JobResult>; | ||
}; | ||
export declare type SubscriptionConfig = { | ||
export type SubscriptionConfig = { | ||
authEndpoint: string; | ||
@@ -11,0 +11,0 @@ apiToken: string; |
@@ -0,5 +1,5 @@ | ||
import { SubscribeToEventsSubscriptionConfig } from './JobResultsFetcher'; | ||
import { GenericClient } from './internalTypes'; | ||
import { SubscribeToEventsSubscriptionConfig } from './JobResultsFetcher'; | ||
declare type UnsubscribeToEventsFn = () => void; | ||
type UnsubscribeToEventsFn = () => void; | ||
export declare function withEventsSubscription<T extends GenericClient>(client: T, config?: SubscribeToEventsSubscriptionConfig): Promise<[T, UnsubscribeToEventsFn]>; | ||
export {}; |
{ | ||
"name": "@datocms/rest-api-events", | ||
"version": "3.1.3", | ||
"version": "3.1.4", | ||
"description": "Utilities to receive real-time events from DatoCMS REST APIs", | ||
@@ -42,6 +42,6 @@ "keywords": [ | ||
"devDependencies": { | ||
"@datocms/cma-client": "^3.1.3", | ||
"@datocms/dashboard-client": "^3.1.3" | ||
"@datocms/cma-client": "^3.1.4", | ||
"@datocms/dashboard-client": "^3.1.4" | ||
}, | ||
"gitHead": "d694fed022666f26bc0074bd55ee48aab5bd478a" | ||
"gitHead": "cad1c1fcae257e50798c58f430a3ff966030078b" | ||
} |
import { GenericClient, JobResult } from './internalTypes'; | ||
import { | ||
EventsSubscription, | ||
SubscriptionConfig, | ||
subscribeToEvents, | ||
SubscriptionConfig, | ||
} from './subscribeToEvents'; | ||
@@ -7,0 +7,0 @@ |
@@ -77,3 +77,3 @@ import Pusher, { Channel, Options } from 'pusher-js'; | ||
if (listeners[jobId]) { | ||
listeners[jobId](jobResult); | ||
listeners[jobId]!(jobResult); | ||
delete listeners[jobId]; | ||
@@ -91,3 +91,3 @@ } else { | ||
if (pastEmissions[jobId]) { | ||
resolve(pastEmissions[jobId]); | ||
resolve(pastEmissions[jobId]!); | ||
delete pastEmissions[jobId]; | ||
@@ -94,0 +94,0 @@ } else { |
@@ -1,2 +0,1 @@ | ||
import { GenericClient } from './internalTypes'; | ||
import { | ||
@@ -6,2 +5,3 @@ JobResultsFetcher, | ||
} from './JobResultsFetcher'; | ||
import { GenericClient } from './internalTypes'; | ||
@@ -8,0 +8,0 @@ type UnsubscribeToEventsFn = () => void; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46534