Skip to content

Commit 3c5607a

Browse files
authored
fix(logs): remove support for number (NangoHQ#2523)
## Describe your changes Fixes https://linear.app/nango/issue/NAN-1448/remove-number-from-activitylogid - Activity log id has been `string` for the last 2 months now
1 parent 822c766 commit 3c5607a

File tree

19 files changed

+37
-79
lines changed

19 files changed

+37
-79
lines changed

packages/cli/lib/services/__snapshots__/model.service.unit.test.ts.snap

+2-2
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ export interface NangoProps {
233233
connectionId: string;
234234
environmentId: number;
235235
environmentName?: string;
236-
activityLogId?: number | string | undefined;
236+
activityLogId?: string | undefined;
237237
providerConfigKey: string;
238238
provider?: string;
239239
lastSyncDate?: Date;
@@ -266,7 +266,7 @@ export declare class NangoAction {
266266
protected nango: Nango;
267267
private attributes;
268268
protected persistApi: AxiosInstance;
269-
activityLogId?: number | string | undefined;
269+
activityLogId?: string | undefined;
270270
syncId?: string;
271271
nangoConnectionId?: number;
272272
environmentId: number;

packages/jobs/lib/integration.service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { logContextGetter } from '@nangohq/logs';
88

99
interface ScriptObject {
1010
runner: Runner;
11-
activityLogId: number | undefined;
11+
activityLogId: string | undefined;
1212
cancelled?: boolean;
1313
}
1414

packages/node-client/lib/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class Nango {
5757
providerConfigKey?: string;
5858
isSync = false;
5959
dryRun = false;
60-
activityLogId?: number | string | undefined;
60+
activityLogId?: string | undefined;
6161
userAgent: string;
6262
http: AxiosInstance;
6363

packages/node-client/lib/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export interface NangoProps {
6161
providerConfigKey?: string;
6262
isSync?: boolean;
6363
dryRun?: boolean;
64-
activityLogId?: number | string | undefined;
64+
activityLogId?: string | undefined;
6565
}
6666

6767
export interface CreateConnectionOAuth1 extends OAuth1Credentials {

packages/orchestrator/lib/clients/client.integration.test.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ describe('OrchestratorClient', async () => {
167167
provider_config_key: 'P',
168168
environment_id: 456
169169
},
170-
activityLogId: 789,
170+
activityLogId: '789',
171171
input: { foo: 'bar' }
172172
}
173173
});
@@ -204,7 +204,7 @@ describe('OrchestratorClient', async () => {
204204
provider_config_key: 'P',
205205
environment_id: 5678
206206
},
207-
activityLogId: 9876,
207+
activityLogId: '9876',
208208
input: { foo: 'bar' }
209209
}
210210
});
@@ -235,7 +235,7 @@ describe('OrchestratorClient', async () => {
235235
provider_config_key: 'P',
236236
environment_id: 5678
237237
},
238-
activityLogId: 9876,
238+
activityLogId: '9876',
239239
input: { foo: 'bar' }
240240
}
241241
});
@@ -272,7 +272,7 @@ describe('OrchestratorClient', async () => {
272272
provider_config_key: 'P',
273273
environment_id: 5678
274274
},
275-
activityLogId: 9876,
275+
activityLogId: '9876',
276276
input: { foo: 'bar' }
277277
}
278278
});
@@ -304,7 +304,7 @@ describe('OrchestratorClient', async () => {
304304
provider_config_key: 'P',
305305
environment_id: 5678
306306
},
307-
activityLogId: 9876,
307+
activityLogId: '9876',
308308
input: { foo: 'bar' }
309309
}
310310
});
@@ -334,7 +334,7 @@ describe('OrchestratorClient', async () => {
334334
provider_config_key: 'P',
335335
environment_id: 456
336336
},
337-
activityLogId: 789,
337+
activityLogId: '789',
338338
input: { foo: 'bar' }
339339
}
340340
});
@@ -360,7 +360,7 @@ describe('OrchestratorClient', async () => {
360360
provider_config_key: 'P',
361361
environment_id: 456
362362
},
363-
activityLogId: 789,
363+
activityLogId: '789',
364364
input: { foo: 'bar' }
365365
}
366366
});
@@ -378,7 +378,7 @@ describe('OrchestratorClient', async () => {
378378
provider_config_key: 'P',
379379
environment_id: 456
380380
},
381-
activityLogId: 789,
381+
activityLogId: '789',
382382
input: { foo: 'bar' }
383383
}
384384
});
@@ -409,7 +409,7 @@ describe('OrchestratorClient', async () => {
409409
provider_config_key: 'P',
410410
environment_id: 456
411411
},
412-
activityLogId: 789,
412+
activityLogId: '789',
413413
input: { foo: 'bar' }
414414
}
415415
});
@@ -428,7 +428,7 @@ describe('OrchestratorClient', async () => {
428428
provider_config_key: 'P',
429429
environment_id: 456
430430
},
431-
activityLogId: 789,
431+
activityLogId: '789',
432432
input: { foo: 'bar' }
433433
}
434434
});

packages/orchestrator/lib/clients/processor.integration.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ async function immediateTask({ groupKey }: { groupKey: string }) {
124124
heartbeatTimeoutSecs: 30,
125125
payload: {
126126
type: 'action',
127-
activityLogId: 1234,
127+
activityLogId: '1234',
128128
actionName: 'Task',
129129
connection: {
130130
id: 1234,

packages/orchestrator/lib/clients/types.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ interface ActionArgs {
2727
environment_id: number;
2828
connection_id: string;
2929
};
30-
activityLogId: string | number;
30+
activityLogId: string;
3131
input: JsonValue;
3232
}
3333
interface WebhookArgs {
@@ -39,7 +39,7 @@ interface WebhookArgs {
3939
provider_config_key: string;
4040
environment_id: number;
4141
};
42-
activityLogId: string | number;
42+
activityLogId: string;
4343
input: JsonValue;
4444
}
4545

@@ -53,7 +53,7 @@ interface PostConnectionArgs {
5353
};
5454
version: string;
5555
fileLocation: string;
56-
activityLogId: string | number;
56+
activityLogId: string;
5757
}
5858
export type SchedulesReturn = Result<OrchestratorSchedule[]>;
5959
export type VoidReturn = Result<void, ClientError>;

packages/orchestrator/lib/clients/validate.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ export const syncArgsSchema = z.object({
2727
export const actionArgsSchema = z.object({
2828
type: z.literal('action'),
2929
actionName: z.string().min(1),
30-
activityLogId: z.union([z.number(), z.string()]),
30+
activityLogId: z.string(),
3131
input: jsonSchema,
3232
...commonSchemaArgsFields
3333
});
3434
export const webhookArgsSchema = z.object({
3535
type: z.literal('webhook'),
3636
webhookName: z.string().min(1),
3737
parentSyncName: z.string().min(1),
38-
activityLogId: z.union([z.number(), z.string()]),
38+
activityLogId: z.string(),
3939
input: jsonSchema,
4040
...commonSchemaArgsFields
4141
});
@@ -44,7 +44,7 @@ export const postConnectionArgsSchema = z.object({
4444
postConnectionName: z.string().min(1),
4545
version: z.string().min(1),
4646
fileLocation: z.string().min(1),
47-
activityLogId: z.union([z.number(), z.string()]),
47+
activityLogId: z.string(),
4848
...commonSchemaArgsFields
4949
});
5050

packages/persist/lib/controllers/persist.controller.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type RecordRequest = Request<
2323
records: Record<string, any>[];
2424
providerConfigKey: string;
2525
connectionId: string;
26-
activityLogId: number | string;
26+
activityLogId: string;
2727
},
2828
void
2929
>;
@@ -32,7 +32,7 @@ const MAX_LOG_CHAR = 10000;
3232

3333
class PersistController {
3434
public async saveLog(
35-
req: Request<{ environmentId: number }, void, { activityLogId: number | string; level: LegacyLogLevel; msg: string; timestamp?: number }, void>,
35+
req: Request<{ environmentId: number }, void, { activityLogId: string; level: LegacyLogLevel; msg: string; timestamp?: number }, void>,
3636
res: Response,
3737
next: NextFunction
3838
) {
@@ -168,7 +168,7 @@ class PersistController {
168168
syncJobId: number;
169169
model: string;
170170
records: Record<string, any>[];
171-
activityLogId: number | string;
171+
activityLogId: string;
172172
softDelete: boolean;
173173
persistFunction: (records: FormattedRecord[]) => Promise<Result<UpsertSummary>>;
174174
}): Promise<Result<void>> {

packages/persist/lib/server.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ server.post(
3232
}),
3333
body: z
3434
.object({
35-
activityLogId: z.union([z.number(), z.string()]),
35+
activityLogId: z.string(),
3636
level: z.enum(['info', 'debug', 'error', 'warn', 'http', 'verbose', 'silly']),
3737
msg: z.string(),
3838
timestamp: z.number().optional() // Optional until fully deployed
@@ -54,7 +54,7 @@ const validateRecordsRequest = validateRequest({
5454
records: z.array(z.object({ id: z.union([z.string().max(255).min(1), z.number()]) })).nonempty(),
5555
providerConfigKey: z.string(),
5656
connectionId: z.string(),
57-
activityLogId: z.union([z.number(), z.string()])
57+
activityLogId: z.string()
5858
})
5959
});
6060
const recordPath = '/environment/:environmentId/connection/:nangoConnectionId/sync/:syncId/job/:syncJobId/records';

packages/runner/lib/client.unit.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('Runner client', () => {
1212
connectionId: 'connection-id',
1313
environmentId: 1,
1414
providerConfigKey: 'provider-config-key',
15-
activityLogId: 1,
15+
activityLogId: '1',
1616
secretKey: 'secret-key',
1717
nangoConnectionId: 1,
1818
syncId: 'sync-id',

packages/runner/lib/exec.unit.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('Exec', () => {
99
connectionId: 'connection-id',
1010
environmentId: 1,
1111
providerConfigKey: 'provider-config-key',
12-
activityLogId: 1,
12+
activityLogId: '1',
1313
secretKey: 'secret-key',
1414
nangoConnectionId: 1,
1515
syncId: 'sync-id',

packages/server/lib/controllers/proxy.controller.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class ProxyController {
4343
const isSync = (req.get('Nango-Is-Sync') as string) === 'true';
4444
const isDryRun = (req.get('Nango-Is-Dry-Run') as string) === 'true';
4545
const retryOn = req.get('Retry-On') ? (req.get('Retry-On') as string).split(',').map(Number) : null;
46-
const existingActivityLogId = req.get('Nango-Activity-Log-Id') as number | string;
46+
const existingActivityLogId = req.get('Nango-Activity-Log-Id') as string;
4747

4848
if (!isSync) {
4949
metrics.increment(metrics.Types.PROXY, 1, { accountId: account.id });

packages/shared/lib/models/Proxy.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export type ResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text'
3939
export interface InternalProxyConfiguration {
4040
provider: string;
4141
connection: Connection;
42-
existingActivityLogId?: number | string | null;
42+
existingActivityLogId?: string | null;
4343
}
4444

4545
export interface RetryHeaderConfig {

packages/shared/lib/models/Sync.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export interface RunScriptOptions {
157157
syncConfig?: SyncConfig;
158158
syncName: string;
159159
syncId: string;
160-
activityLogId?: number | undefined;
160+
activityLogId?: string | undefined;
161161
nangoProps: NangoProps;
162162
writeToDb: boolean;
163163
isInvokedImmediately: boolean;

packages/shared/lib/models/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@ export * from './Flow.js';
99
export * from './NangoConfig.js';
1010
export * from './Proxy.js';
1111
export * from './Runner.js';
12-
export * from './worker.js';

packages/shared/lib/models/worker.ts

-41
This file was deleted.

packages/shared/lib/sdk/sync.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ export interface NangoProps {
295295
connectionId: string;
296296
environmentId: number;
297297
environmentName?: string;
298-
activityLogId?: number | string | undefined;
298+
activityLogId?: string | undefined;
299299
providerConfigKey: string;
300300
provider?: string;
301301
lastSyncDate?: Date;
@@ -335,7 +335,7 @@ export class NangoAction {
335335
protected nango: Nango;
336336
private attributes = {};
337337
protected persistApi: AxiosInstance;
338-
activityLogId?: number | string | undefined;
338+
activityLogId?: string | undefined;
339339
syncId?: string;
340340
nangoConnectionId?: number;
341341
environmentId: number;

packages/shared/lib/services/sync/run.service.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export type SyncRunConfig = {
7575
} & (
7676
| {
7777
writeToDb: true;
78-
activityLogId: string | number;
78+
activityLogId: string;
7979
logCtx: LogContext;
8080
slackService: SlackService;
8181
sendSyncWebhook: (params: SendSyncParams) => Promise<void>;
@@ -115,7 +115,7 @@ export class SyncRunService {
115115

116116
syncId?: string;
117117
syncJobId?: number;
118-
activityLogId?: string | number;
118+
activityLogId?: string;
119119
provider?: string;
120120
loadLocation?: string;
121121
debug?: boolean;
@@ -328,7 +328,7 @@ export class SyncRunService {
328328
syncId:
329329
(this.syncId as string) ||
330330
`${syncName}-${this.nangoConnection.environment_id}-${this.nangoConnection.provider_config_key}-${this.nangoConnection.connection_id}`,
331-
activityLogId: this.activityLogId as unknown as number,
331+
activityLogId: this.activityLogId as unknown as string,
332332
nangoProps,
333333
writeToDb: this.writeToDb,
334334
isInvokedImmediately: this.isInvokedImmediately,

0 commit comments

Comments
 (0)