Hello, I am making a pack that was building successfully for over a dozen versions, but is now failing on a Typescript error that I am having a hard time troubleshooting. Can anyone help with this?
The error is on the execute section of the code block shown below:
import * as coda from "@codahq/packs-sdk";
export const pack = coda.newPack();
pack.addNetworkDomain("pagerduty.com");
pack.setUserAuthentication({
type: coda.AuthenticationType.OAuth2,
authorizationUrl: "https://identity.pagerduty.com/oauth/authorize",
tokenUrl: "https://identity.pagerduty.com/oauth/token",
scopes: ["incidents.read"],
useProofKeyForCodeExchange: true,
});
// Define incident schema
const IncidentSchema = coda.makeObjectSchema({
properties: {
title: {
description: "The name of the incident.",
type: coda.ValueType.String,
required: true,
},
description: {
description: "A detailed description of the incident.",
type: coda.ValueType.String,
},
created_at: {
description: "The date the incident was created",
type: coda.ValueType.String,
codaType: coda.ValueHintType.DateTime,
},
id: {
description: "The ID of the incident.",
type: coda.ValueType.String,
},
service: {
description: "The service of the incident.",
type: coda.ValueType.String,
},
escalation_policy: {
description: "The escalation policy of the incident." ,
type: coda.ValueType.String,
},
priority: {
description: "The severity of the incident." ,
type: coda.ValueType.String,
},
html_url: {
description: "The url of the incident." ,
type: coda.ValueType.String,
codaType: coda.ValueHintType.Url
},
},
displayProperty: "title",
idProperty: "id",
featuredProperties: ["title", "description", "created_at", "service", "priority", "html_url"]
});
// Sync incident schema
pack.addSyncTable({
name: "IncidentList",
description: "Pull all incident information",
identityName: "IncidentList",
schema: IncidentSchema,
formula: {
name: "IncidentList",
description: "Export incident details for a given timeframe, status and service",
parameters: [],
execute: async function ([IncidentList], context) {
let url = coda.withQueryParams("https://api.pagerduty.com/incidents");
let response = await context.fetcher.fetch ({
method: "GET",
url: url,
headers: {
"Accept": "application/vnd.pagerduty+json;version=2",
"Content-Type": "application/json",
},
});
let results = response.body.incidents;
return {
title: results.title,
description: results.description,
created_at: results.created_at,
id: results.id,
service: results.service.summary,
escalation_policy: results.escalation_policy.summary,
priority: results.priority.summary,
html_url: results.html_url,
};
}
}
});
Here is the error:
On line 70 Type '([IncidentList]: [any], context: any) => Promise<{ title: any; description: any; created_at: any; id: any; service: any; escalation_policy: any; priority: any; html_url: any; }>' is not assignable to type '{ (params: ParamValues<[]>, context: SyncExecutionContext): Promise<SyncFormulaResult<string, string, { properties: { title: { description: string; type: ValueType.String; required: true; }; ... 6 more ...; html_url: { ...; }; }; displayProperty: "title"; idProperty: "id"; featuredProperties: ("description" | ... 4 ...'. Types of parameters '__0' and 'params' are incompatible. Property '0' is missing in type '[] & any[]' but required in type '[any]'.
Any help you can offer would be greatly appreciated!