Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: dependency updates #144

Merged
merged 3 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ dist/
.eggs/
.yarn/
renovate.json
socket.io-websocket-only.js
doc/resource
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@
"dist"
],
"devDependencies": {
"@types/uuid": "^9.0.2",
"cross-fetch": "^3.1.6",
"dayjs": "^1.11.8",
"eslint": "^8.43.0",
"@types/uuid": "^9.0.4",
"cross-fetch": "^4.0.0",
"dayjs": "^1.11.9",
"eslint": "^8.49.0",
"eslint-config-react-app": "^7.0.1",
"husky": "^8.0.3",
"jsdom": "^22.1.0",
"lint-staged": "^13.2.2",
"msw": "^1.2.2",
"lint-staged": "^14.0.1",
"msw": "^1.3.1",
"pinst": "^3.0.0",
"prettier": "^2.8.8",
"typescript": "^5.1.3",
"vite": "^4.3.9",
"vite-plugin-dts": "^2.3.0",
"vitest": "^0.32.2",
"ws": "^8.13.0"
"prettier": "^3.0.3",
"typescript": "^5.2.2",
"vite": "^4.4.9",
"vite-plugin-dts": "^3.5.3",
"vitest": "^0.34.4",
"ws": "^8.14.1"
},
"repository": {
"type": "git",
Expand All @@ -61,7 +61,7 @@
"isomorphic-ws": "^5.0.0",
"loglevel": "^1.8.1",
"moment": "^2.29.4",
"uuid": "^9.0.0"
"uuid": "^9.0.1"
},
"peerDependencies": {
"ws": "^8.13.0"
Expand Down
6 changes: 3 additions & 3 deletions source/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const ServerError = errorFactory("ServerError");
* @memberof error
*/
export const ServerPermissionDeniedError = errorFactory(
"ServerPermissionDeniedError"
"ServerPermissionDeniedError",
);

/**
Expand All @@ -51,7 +51,7 @@ export const ServerValidationError = errorFactory("ServerValidationError");
* @memberof error
*/
export const EventServerReplyTimeoutError = errorFactory(
"EventServerReplyTimeoutError"
"EventServerReplyTimeoutError",
);

/**
Expand All @@ -60,7 +60,7 @@ export const EventServerReplyTimeoutError = errorFactory(
* @memberof error
*/
export const EventServerConnectionTimeoutError = errorFactory(
"EventServerConnectionTimeoutError"
"EventServerConnectionTimeoutError",
);

/**
Expand Down
2 changes: 1 addition & 1 deletion source/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class Event {
constructor(
topic: string,
data: object,
options: { [key: string]: unknown } = {}
options: { [key: string]: unknown } = {},
) {
this._data = {
topic,
Expand Down
32 changes: 17 additions & 15 deletions source/event_hub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ export class EventHub {
serverUrl: string,
apiUser: string,
apiKey: string,
{ applicationId = "ftrack.api.javascript" }: { applicationId?: string } = {}
{
applicationId = "ftrack.api.javascript",
}: { applicationId?: string } = {},
) {
this.logger = loglevel.getLogger("ftrack_api:EventHub");
this._applicationId = applicationId;
Expand Down Expand Up @@ -253,11 +255,11 @@ export class EventHub {
}: {
onReply?: EventCallback;
timeout?: number;
} = {}
} = {},
): Promise<string> {
if (!this._socketIo) {
throw new EventServerPublishError(
"Unable to publish event, not connected to server."
"Unable to publish event, not connected to server.",
);
}

Expand All @@ -279,7 +281,7 @@ export class EventHub {
if (timeout) {
setTimeout(() => {
const error = new EventServerConnectionTimeoutError(
"Unable to connect to event server within timeout."
"Unable to connect to event server within timeout.",
);
reject(error);
}, timeout * 1000);
Expand All @@ -294,7 +296,7 @@ export class EventHub {
this.logger.debug("Publishing event.", eventData);
if (!this._socketIo) {
throw new EventServerPublishError(
"Unable to publish event, not connected to server."
"Unable to publish event, not connected to server.",
);
}
this._socketIo.emit("ftrack.event", eventData);
Expand All @@ -315,7 +317,7 @@ export class EventHub {
*/
publishAndWaitForReply(
event: Event,
{ timeout = 30 }: { timeout: number }
{ timeout = 30 }: { timeout: number },
): Promise<unknown> {
const eventId = event.getData().id;
const response = new Promise((resolve, reject) => {
Expand All @@ -328,7 +330,7 @@ export class EventHub {
if (timeout) {
setTimeout(() => {
const error = new EventServerReplyTimeoutError(
"No reply event received within timeout."
"No reply event received within timeout.",
);
reject(error);
this._removeReplyCallback(eventId);
Expand Down Expand Up @@ -379,7 +381,7 @@ export class EventHub {
subscribe(
subscription: string,
callback: EventCallback,
metadata?: SubscriberMetadata
metadata?: SubscriberMetadata,
): string {
if (typeof callback !== "function") {
throw new Error("Callback must be a function.");
Expand Down Expand Up @@ -426,7 +428,7 @@ export class EventHub {
return matches[1];
}
throw new Error(
'Only subscriptions on the format "topic=value" are supported.'
'Only subscriptions on the format "topic=value" are supported.',
);
}

Expand All @@ -446,7 +448,7 @@ export class EventHub {
callback: EventCallback,
metadata: SubscriberMetadata = {
id: uuidV4(),
}
},
) {
// Ensure subscription is on supported format.
// TODO: Remove once subscription parsing is supported.
Expand All @@ -461,7 +463,7 @@ export class EventHub {

if (existingSubscriber) {
throw new NotUniqueError(
`Subscriber with identifier "${metadata.id}" already exists.`
`Subscriber with identifier "${metadata.id}" already exists.`,
);
}

Expand Down Expand Up @@ -521,7 +523,7 @@ export class EventHub {
*/
private _IsSubscriberInterestedIn(
subscriber: Subscriber,
eventPayload: EventPayload
eventPayload: EventPayload,
) {
const topic = this._getExpressionTopic(subscriber.subscription);

Expand Down Expand Up @@ -557,7 +559,7 @@ export class EventHub {
}
try {
const responsePromise = Promise.resolve(
subscriber.callback(eventPayload)
subscriber.callback(eventPayload),
);
promises.push(responsePromise);
responsePromise.then((response) => {
Expand All @@ -571,7 +573,7 @@ export class EventHub {
"Error calling subscriber for event.",
error,
subscriber,
eventPayload
eventPayload,
);
}
}
Expand Down Expand Up @@ -601,7 +603,7 @@ export class EventHub {
publishReply(
sourceEventPayload: EventPayload,
data: Data,
source: Data | null = null
source: Data | null = null,
): Promise<string> {
const replyEvent = new Event("ftrack.meta.reply", data, {
target: `id=${sourceEventPayload.source.id}`,
Expand Down
4 changes: 2 additions & 2 deletions source/operation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export function search({
export function update(
type: string,
keys: string[] | string,
data: any
data: any,
): UpdateOperation {
return {
action: "update",
Expand All @@ -160,7 +160,7 @@ export function update(
*/
function deleteOperation(
type: string,
keys: string[] | string
keys: string[] | string,
): DeleteOperation {
return {
action: "delete",
Expand Down
10 changes: 5 additions & 5 deletions source/project_schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function getStatuses(
session: Session,
projectSchemaId: string,
entityType: string,
typeId: string | null = null
typeId: string | null = null,
) {
let response;

Expand Down Expand Up @@ -66,9 +66,9 @@ export function getStatuses(
const operations = groupedAttributes.map((select) =>
operation.query(
`select ${select.join(
", "
)} from ProjectSchema where id is ${projectSchemaId}`
)
", ",
)} from ProjectSchema where id is ${projectSchemaId}`,
),
);

response = session.call<QueryResponse<Data>>(operations);
Expand Down Expand Up @@ -108,7 +108,7 @@ export function getStatuses(
for (const index in data._schemas) {
if (data._schemas[index].type_id === objectTypeId) {
statuses = data._schemas[index].statuses.map(
(status: any) => status.task_status
(status: any) => status.task_status,
);
}
}
Expand Down
Loading