posthog-node 6.4.0 → 6.4.1
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/dist/client.d.ts +2 -2
- package/dist/extensions/nestjs.d.ts.map +1 -1
- package/dist/extensions/nestjs.js +1 -0
- package/dist/extensions/nestjs.mjs +1 -0
- package/dist/types.d.ts +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +1 -1
- package/src/client.ts +2 -2
- package/src/extensions/nestjs.ts +12 -0
- package/src/types.ts +2 -2
- package/src/version.ts +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -309,10 +309,10 @@ export declare abstract class PostHogBackendClient extends PostHogCoreStateless
|
|
|
309
309
|
* })
|
|
310
310
|
* if (error) {
|
|
311
311
|
* console.error(error.code, error.message)
|
|
312
|
+
* } else {
|
|
313
|
+
* const status = await client.emails.get(data.id) // later, for example from a job
|
|
312
314
|
* }
|
|
313
315
|
*
|
|
314
|
-
* const status = await client.emails.get(data.id) // later, for example from a job
|
|
315
|
-
*
|
|
316
316
|
* // From a preference center: opt out of one topic, keep the rest
|
|
317
317
|
* await client.emails.setPreferences({ to: 'user@example.com', topics: { newsletter: false } })
|
|
318
318
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nestjs.d.ts","sourceRoot":"","sources":["../../src/extensions/nestjs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAc,MAAM,MAAM,CAAA;AAa7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAGhD,UAAU,iBAAiB;IACzB,UAAU,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,CAAA;IACxB,WAAW,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,CAAA;CAC1B;AAED,UAAU,gBAAgB;IACxB,YAAY,IAAI,iBAAiB,CAAA;CAClC;AAED,UAAU,WAAW,CAAC,CAAC,GAAG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G;IAC/G,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED,MAAM,WAAW,yBAAyB;IACxC,mGAAmG;IACnG,iBAAiB,CAAC,EAAE,OAAO,GAAG,uBAAuB,CAAA;IACrD;;;;OAIG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,MAAM,GAAG,SAAS,CAAA;CACrD;AAoCD;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,kBAAmB,YAAW,eAAe;IACxD,OAAO,CAAC,OAAO,CAAsB;IACrC,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,kBAAkB,CAAQ;IAClC,OAAO,CAAC,aAAa,CAAC,CAAsC;IAE5D;;;;;OAKG;IACH,YAAY,OAAO,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,yBAAyB,EAM7E;IAED,OAAO,CAAC,iBAAiB;IAczB,sEAAsE;IACtE,SAAS,CAAC,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,WAAW,GAAG,UAAU,CAAC,GAAG,CAAC,CAmFvE;CACF"}
|
|
@@ -60,6 +60,7 @@ function getExceptionStatus(exception) {
|
|
|
60
60
|
const status = exception.getStatus();
|
|
61
61
|
return 'number' == typeof status ? status : void 0;
|
|
62
62
|
}
|
|
63
|
+
if (exception instanceof Error && 'statusCode' in exception && 'number' == typeof exception.statusCode && 'status' in exception && exception.status === exception.statusCode && 'expose' in exception && 'boolean' == typeof exception.expose) return exception.statusCode;
|
|
63
64
|
}
|
|
64
65
|
class PostHogInterceptor {
|
|
65
66
|
constructor(posthog, options){
|
|
@@ -18,6 +18,7 @@ function getExceptionStatus(exception) {
|
|
|
18
18
|
const status = exception.getStatus();
|
|
19
19
|
return 'number' == typeof status ? status : void 0;
|
|
20
20
|
}
|
|
21
|
+
if (exception instanceof Error && 'statusCode' in exception && 'number' == typeof exception.statusCode && 'status' in exception && exception.status === exception.statusCode && 'expose' in exception && 'boolean' == typeof exception.expose) return exception.statusCode;
|
|
21
22
|
}
|
|
22
23
|
class PostHogInterceptor {
|
|
23
24
|
constructor(posthog, options){
|
package/dist/types.d.ts
CHANGED
|
@@ -1136,8 +1136,8 @@ export interface IPostHog {
|
|
|
1136
1136
|
*/
|
|
1137
1137
|
readonly metrics: Metrics;
|
|
1138
1138
|
/**
|
|
1139
|
-
* @description The `posthog.emails` API: sends transactional email from PostHog
|
|
1140
|
-
*
|
|
1139
|
+
* @description The `posthog.emails` API: sends transactional email from PostHog templates or from content
|
|
1140
|
+
* your code rendered, reads send status, and sets topic preferences. Needs `secretKey`.
|
|
1141
1141
|
*/
|
|
1142
1142
|
readonly emails: Emails;
|
|
1143
1143
|
/**
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "6.4.
|
|
1
|
+
export declare const version = "6.4.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
package/dist/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const version = "6.4.
|
|
1
|
+
const version = "6.4.1";
|
|
2
2
|
export { version };
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -1255,10 +1255,10 @@ export abstract class PostHogBackendClient extends PostHogCoreStateless implemen
|
|
|
1255
1255
|
* })
|
|
1256
1256
|
* if (error) {
|
|
1257
1257
|
* console.error(error.code, error.message)
|
|
1258
|
+
* } else {
|
|
1259
|
+
* const status = await client.emails.get(data.id) // later, for example from a job
|
|
1258
1260
|
* }
|
|
1259
1261
|
*
|
|
1260
|
-
* const status = await client.emails.get(data.id) // later, for example from a job
|
|
1261
|
-
*
|
|
1262
1262
|
* // From a preference center: opt out of one topic, keep the rest
|
|
1263
1263
|
* await client.emails.setPreferences({ to: 'user@example.com', topics: { newsletter: false } })
|
|
1264
1264
|
* ```
|
package/src/extensions/nestjs.ts
CHANGED
|
@@ -67,6 +67,18 @@ function getExceptionStatus(exception: unknown): number | undefined {
|
|
|
67
67
|
const status = (exception as any).getStatus()
|
|
68
68
|
return typeof status === 'number' ? status : undefined
|
|
69
69
|
}
|
|
70
|
+
// Nest also accepts http-errors instances, which have status fields instead of getStatus().
|
|
71
|
+
if (
|
|
72
|
+
exception instanceof Error &&
|
|
73
|
+
'statusCode' in exception &&
|
|
74
|
+
typeof exception.statusCode === 'number' &&
|
|
75
|
+
'status' in exception &&
|
|
76
|
+
exception.status === exception.statusCode &&
|
|
77
|
+
'expose' in exception &&
|
|
78
|
+
typeof exception.expose === 'boolean'
|
|
79
|
+
) {
|
|
80
|
+
return exception.statusCode
|
|
81
|
+
}
|
|
70
82
|
return undefined
|
|
71
83
|
}
|
|
72
84
|
|
package/src/types.ts
CHANGED
|
@@ -1243,8 +1243,8 @@ export interface IPostHog {
|
|
|
1243
1243
|
readonly metrics: Metrics
|
|
1244
1244
|
|
|
1245
1245
|
/**
|
|
1246
|
-
* @description The `posthog.emails` API: sends transactional email from PostHog
|
|
1247
|
-
*
|
|
1246
|
+
* @description The `posthog.emails` API: sends transactional email from PostHog templates or from content
|
|
1247
|
+
* your code rendered, reads send status, and sets topic preferences. Needs `secretKey`.
|
|
1248
1248
|
*/
|
|
1249
1249
|
readonly emails: Emails
|
|
1250
1250
|
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "6.4.
|
|
1
|
+
export const version = "6.4.1"
|