@kombo-api/sdk 0.2.3 → 0.2.4
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/README.md +2 -2
- package/esm/funcs/validateWebhook.d.ts +13 -0
- package/esm/funcs/validateWebhook.d.ts.map +1 -0
- package/esm/funcs/validateWebhook.js +34 -0
- package/esm/funcs/validateWebhook.js.map +1 -0
- package/esm/lib/config.d.ts +3 -3
- package/esm/lib/config.js +3 -3
- package/esm/sdk/sdk.d.ts +9 -0
- package/esm/sdk/sdk.d.ts.map +1 -1
- package/esm/sdk/sdk.js +5 -0
- package/esm/sdk/sdk.js.map +1 -1
- package/esm/types/enums.d.ts +1 -8
- package/esm/types/enums.d.ts.map +1 -1
- package/esm/types/enums.js +1 -18
- package/esm/types/enums.js.map +1 -1
- package/esm/types/index.d.ts +2 -1
- package/esm/types/index.d.ts.map +1 -1
- package/esm/types/index.js +1 -0
- package/esm/types/index.js.map +1 -1
- package/esm/types/unrecognized.d.ts +10 -0
- package/esm/types/unrecognized.d.ts.map +1 -0
- package/esm/types/unrecognized.js +23 -0
- package/esm/types/unrecognized.js.map +1 -0
- package/examples/package-lock.json +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/validateWebhook.ts +74 -0
- package/src/lib/config.ts +3 -3
- package/src/sdk/sdk.ts +28 -0
- package/src/types/enums.ts +1 -21
- package/src/types/index.ts +2 -1
- package/src/types/unrecognized.ts +27 -0
package/README.md
CHANGED
|
@@ -16,8 +16,8 @@ Developer-friendly & type-safe TypeScript SDK for the [Kombo Unified API](https:
|
|
|
16
16
|
|
|
17
17
|
<br />
|
|
18
18
|
|
|
19
|
-
> [!
|
|
20
|
-
> The Kombo TypeScript SDK is
|
|
19
|
+
> [!NOTE]
|
|
20
|
+
> The Kombo TypeScript SDK is **currently in beta**. The core API structure, methods, and input/output objects are considered stable. We may still make minor adjustments such as renames to exported type classes or fixes for code generator oddities, but all changes will be clearly documented in the changelog. We **do not foresee** any blockers for production use.
|
|
21
21
|
|
|
22
22
|
<!-- Start Table of Contents [toc] -->
|
|
23
23
|
## Table of Contents
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { KomboCore } from "../core.js";
|
|
2
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
3
|
+
import * as webhooks from "../models/webhooks/index.js";
|
|
4
|
+
import { Result } from "../types/fp.js";
|
|
5
|
+
export declare function validateWebhook(_client: KomboCore, { request: rawRequest, }: {
|
|
6
|
+
request: {
|
|
7
|
+
body: BodyInit;
|
|
8
|
+
method: string;
|
|
9
|
+
url: string;
|
|
10
|
+
headers: Record<string, string> | Headers;
|
|
11
|
+
} | Request;
|
|
12
|
+
}): Promise<Result<webhooks.WebhookDataChangedWebhookPayloadRequest | webhooks.WebhookConnectionFlowFailedWebhookPayloadRequest | webhooks.WebhookIntegrationCreatedWebhookPayloadRequest | webhooks.WebhookIntegrationDeletedWebhookPayloadRequest | webhooks.WebhookAssessmentOrderReceivedWebhookPayloadRequest | webhooks.WebhookInlineAssessmentOrderReceivedWebhookPayloadRequest | webhooks.WebhookIntegrationStateChangedWebhookPayloadRequest | webhooks.WebhookSyncFinishedWebhookPayloadRequest, SDKValidationError>>;
|
|
13
|
+
//# sourceMappingURL=validateWebhook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateWebhook.d.ts","sourceRoot":"","sources":["../../src/funcs/validateWebhook.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,KAAK,QAAQ,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAO,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C,wBAAsB,eAAe,CAAC,OAAO,EAAE,SAAS,EAAE,EACxD,OAAO,EAAE,UAAU,GACpB,EAAE;IACD,OAAO,EAAE;QACP,IAAI,EAAE,QAAQ,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,GAAG,EAAE,MAAM,CAAC;QACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC;KAC3C,GAAG,OAAO,CAAC;CACb,GAAG,OAAO,CACT,MAAM,CACF,QAAQ,CAAC,uCAAuC,GAChD,QAAQ,CAAC,gDAAgD,GACzD,QAAQ,CAAC,8CAA8C,GACvD,QAAQ,CAAC,8CAA8C,GACvD,QAAQ,CAAC,mDAAmD,GAC5D,QAAQ,CAAC,yDAAyD,GAClE,QAAQ,CAAC,mDAAmD,GAC5D,QAAQ,CAAC,wCAAwC,EACnD,kBAAkB,CACnB,CACF,CA6BA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
5
|
+
import * as webhooks from "../models/webhooks/index.js";
|
|
6
|
+
import { ERR } from "../types/fp.js";
|
|
7
|
+
export async function validateWebhook(_client, { request: rawRequest, }) {
|
|
8
|
+
const request = normalizeRequest(rawRequest);
|
|
9
|
+
const knownSchemas = [
|
|
10
|
+
webhooks.webhookDataChangedWebhookPayloadRequestFromJSON,
|
|
11
|
+
webhooks.webhookConnectionFlowFailedWebhookPayloadRequestFromJSON,
|
|
12
|
+
webhooks.webhookIntegrationCreatedWebhookPayloadRequestFromJSON,
|
|
13
|
+
webhooks.webhookIntegrationDeletedWebhookPayloadRequestFromJSON,
|
|
14
|
+
webhooks.webhookAssessmentOrderReceivedWebhookPayloadRequestFromJSON,
|
|
15
|
+
webhooks.webhookInlineAssessmentOrderReceivedWebhookPayloadRequestFromJSON,
|
|
16
|
+
webhooks.webhookIntegrationStateChangedWebhookPayloadRequestFromJSON,
|
|
17
|
+
webhooks.webhookSyncFinishedWebhookPayloadRequestFromJSON,
|
|
18
|
+
];
|
|
19
|
+
const jsonString = await request.text();
|
|
20
|
+
for (const schema of knownSchemas) {
|
|
21
|
+
const ret = schema(jsonString);
|
|
22
|
+
if (ret.ok) {
|
|
23
|
+
return ret;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return ERR(new SDKValidationError("No matching schema found for the given webhook payload", jsonString, jsonString));
|
|
27
|
+
}
|
|
28
|
+
function normalizeRequest(request) {
|
|
29
|
+
if (request instanceof Request) {
|
|
30
|
+
return request;
|
|
31
|
+
}
|
|
32
|
+
return new Request(request.url, request);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=validateWebhook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateWebhook.js","sourceRoot":"","sources":["../../src/funcs/validateWebhook.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,KAAK,QAAQ,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,GAAG,EAAU,MAAM,gBAAgB,CAAC;AAE7C,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,OAAkB,EAAE,EACxD,OAAO,EAAE,UAAU,GAQpB;IAaC,MAAM,OAAO,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAC7C,MAAM,YAAY,GAAG;QACnB,QAAQ,CAAC,+CAA+C;QACxD,QAAQ,CAAC,wDAAwD;QACjE,QAAQ,CAAC,sDAAsD;QAC/D,QAAQ,CAAC,sDAAsD;QAC/D,QAAQ,CAAC,2DAA2D;QACpE,QAAQ,CAAC,iEAAiE;QAC1E,QAAQ,CAAC,2DAA2D;QACpE,QAAQ,CAAC,gDAAgD;KAC1D,CAAC;IAEF,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;IAExC,KAAK,MAAM,MAAM,IAAI,YAAY,EAAE,CAAC;QAClC,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;QAC/B,IAAI,GAAG,CAAC,EAAE,EAAE,CAAC;YACX,OAAO,GAAG,CAAC;QACb,CAAC;IACH,CAAC;IAED,OAAO,GAAG,CACR,IAAI,kBAAkB,CACpB,wDAAwD,EACxD,UAAU,EACV,UAAU,CACX,CACF,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CACvB,OAKW;IAEX,IAAI,OAAO,YAAY,OAAO,EAAE,CAAC;QAC/B,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC"}
|
package/esm/lib/config.d.ts
CHANGED
|
@@ -46,8 +46,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
46
46
|
export declare const SDK_METADATA: {
|
|
47
47
|
readonly language: "typescript";
|
|
48
48
|
readonly openapiDocVersion: "1.0.0";
|
|
49
|
-
readonly sdkVersion: "0.2.
|
|
50
|
-
readonly genVersion: "2.
|
|
51
|
-
readonly userAgent: "speakeasy-sdk/typescript 0.2.
|
|
49
|
+
readonly sdkVersion: "0.2.4";
|
|
50
|
+
readonly genVersion: "2.760.2";
|
|
51
|
+
readonly userAgent: "speakeasy-sdk/typescript 0.2.4 2.760.2 1.0.0 @kombo-api/sdk";
|
|
52
52
|
};
|
|
53
53
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/lib/config.js
CHANGED
|
@@ -30,8 +30,8 @@ export function serverURLFromOptions(options) {
|
|
|
30
30
|
export const SDK_METADATA = {
|
|
31
31
|
language: "typescript",
|
|
32
32
|
openapiDocVersion: "1.0.0",
|
|
33
|
-
sdkVersion: "0.2.
|
|
34
|
-
genVersion: "2.
|
|
35
|
-
userAgent: "speakeasy-sdk/typescript 0.2.
|
|
33
|
+
sdkVersion: "0.2.4",
|
|
34
|
+
genVersion: "2.760.2",
|
|
35
|
+
userAgent: "speakeasy-sdk/typescript 0.2.4 2.760.2 1.0.0 @kombo-api/sdk",
|
|
36
36
|
};
|
|
37
37
|
//# sourceMappingURL=config.js.map
|
package/esm/sdk/sdk.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ClientSDK } from "../lib/sdks.js";
|
|
2
|
+
import * as webhooks from "../models/webhooks/index.js";
|
|
2
3
|
import { Assessment } from "./assessment.js";
|
|
3
4
|
import { Ats } from "./ats.js";
|
|
4
5
|
import { Connect } from "./connect.js";
|
|
@@ -15,5 +16,13 @@ export declare class Kombo extends ClientSDK {
|
|
|
15
16
|
get assessment(): Assessment;
|
|
16
17
|
private _connect?;
|
|
17
18
|
get connect(): Connect;
|
|
19
|
+
validateWebhook({ request, }: {
|
|
20
|
+
request: {
|
|
21
|
+
body: string;
|
|
22
|
+
headers: Record<string, string> | Headers;
|
|
23
|
+
url: string;
|
|
24
|
+
method: string;
|
|
25
|
+
} | Request;
|
|
26
|
+
}): Promise<webhooks.WebhookDataChangedWebhookPayloadRequest | webhooks.WebhookConnectionFlowFailedWebhookPayloadRequest | webhooks.WebhookIntegrationCreatedWebhookPayloadRequest | webhooks.WebhookIntegrationDeletedWebhookPayloadRequest | webhooks.WebhookAssessmentOrderReceivedWebhookPayloadRequest | webhooks.WebhookInlineAssessmentOrderReceivedWebhookPayloadRequest | webhooks.WebhookIntegrationStateChangedWebhookPayloadRequest | webhooks.WebhookSyncFinishedWebhookPayloadRequest>;
|
|
18
27
|
}
|
|
19
28
|
//# sourceMappingURL=sdk.d.ts.map
|
package/esm/sdk/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk/sdk.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk/sdk.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,QAAQ,MAAM,6BAA6B,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,qBAAa,KAAM,SAAQ,SAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,CAAU;IAC3B,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,OAAO,CAAC,KAAK,CAAC,CAAO;IACrB,IAAI,IAAI,IAAI,IAAI,CAEf;IAED,OAAO,CAAC,IAAI,CAAC,CAAM;IACnB,IAAI,GAAG,IAAI,GAAG,CAEb;IAED,OAAO,CAAC,WAAW,CAAC,CAAa;IACjC,IAAI,UAAU,IAAI,UAAU,CAE3B;IAED,OAAO,CAAC,QAAQ,CAAC,CAAU;IAC3B,IAAI,OAAO,IAAI,OAAO,CAErB;IAEK,eAAe,CAAC,EACpB,OAAO,GACR,EAAE;QACD,OAAO,EAAE;YACP,IAAI,EAAE,MAAM,CAAC;YACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC;YAC1C,GAAG,EAAE,MAAM,CAAC;YACZ,MAAM,EAAE,MAAM,CAAC;SAChB,GAAG,OAAO,CAAC;KACb,GAAG,OAAO,CACP,QAAQ,CAAC,uCAAuC,GAChD,QAAQ,CAAC,gDAAgD,GACzD,QAAQ,CAAC,8CAA8C,GACvD,QAAQ,CAAC,8CAA8C,GACvD,QAAQ,CAAC,mDAAmD,GAC5D,QAAQ,CAAC,yDAAyD,GAClE,QAAQ,CAAC,mDAAmD,GAC5D,QAAQ,CAAC,wCAAwC,CACpD;CAMF"}
|
package/esm/sdk/sdk.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
|
+
import { validateWebhook } from "../funcs/validateWebhook.js";
|
|
4
5
|
import { ClientSDK } from "../lib/sdks.js";
|
|
6
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
5
7
|
import { Assessment } from "./assessment.js";
|
|
6
8
|
import { Ats } from "./ats.js";
|
|
7
9
|
import { Connect } from "./connect.js";
|
|
@@ -23,5 +25,8 @@ export class Kombo extends ClientSDK {
|
|
|
23
25
|
get connect() {
|
|
24
26
|
return (this._connect ?? (this._connect = new Connect(this._options)));
|
|
25
27
|
}
|
|
28
|
+
async validateWebhook({ request, }) {
|
|
29
|
+
return unwrapAsync(validateWebhook(this, { request }));
|
|
30
|
+
}
|
|
26
31
|
}
|
|
27
32
|
//# sourceMappingURL=sdk.js.map
|
package/esm/sdk/sdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/sdk/sdk.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/sdk/sdk.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,OAAO,KAAM,SAAQ,SAAS;IAElC,IAAI,OAAO;QACT,OAAO,CAAC,IAAI,CAAC,QAAQ,KAAb,IAAI,CAAC,QAAQ,GAAK,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAC,CAAC;IACxD,CAAC;IAGD,IAAI,IAAI;QACN,OAAO,CAAC,IAAI,CAAC,KAAK,KAAV,IAAI,CAAC,KAAK,GAAK,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAC,CAAC;IAClD,CAAC;IAGD,IAAI,GAAG;QACL,OAAO,CAAC,IAAI,CAAC,IAAI,KAAT,IAAI,CAAC,IAAI,GAAK,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAC,CAAC;IAChD,CAAC;IAGD,IAAI,UAAU;QACZ,OAAO,CAAC,IAAI,CAAC,WAAW,KAAhB,IAAI,CAAC,WAAW,GAAK,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAC,CAAC;IAC9D,CAAC;IAGD,IAAI,OAAO;QACT,OAAO,CAAC,IAAI,CAAC,QAAQ,KAAb,IAAI,CAAC,QAAQ,GAAK,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAC,CAAC;IACxD,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,EACpB,OAAO,GAQR;QAUC,OAAO,WAAW,CAAC,eAAe,CAChC,IAAI,EACJ,EAAE,OAAO,EAAE,CACZ,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/esm/types/enums.d.ts
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import * as z from "zod/v3";
|
|
2
|
-
|
|
3
|
-
export type Unrecognized<T> = T & {
|
|
4
|
-
[__brand]: "unrecognized";
|
|
5
|
-
};
|
|
2
|
+
import { Unrecognized } from "./unrecognized.js";
|
|
6
3
|
export type ClosedEnum<T extends Readonly<Record<string, string | number>>> = T[keyof T];
|
|
7
4
|
export type OpenEnum<T extends Readonly<Record<string, string | number>>> = T[keyof T] | Unrecognized<T[keyof T] extends number ? number : string>;
|
|
8
|
-
export declare function unrecognizedCounter(): {
|
|
9
|
-
count: () => number;
|
|
10
|
-
};
|
|
11
5
|
export declare function inboundSchema<T extends Record<string, string>>(enumObj: T): z.ZodType<OpenEnum<T>, z.ZodTypeDef, unknown>;
|
|
12
6
|
export declare function inboundSchemaInt<T extends Record<string, number | string>>(enumObj: T): z.ZodType<OpenEnum<T>, z.ZodTypeDef, unknown>;
|
|
13
7
|
export declare function outboundSchema<T extends Record<string, string>>(_: T): z.ZodType<string, z.ZodTypeDef, OpenEnum<T>>;
|
|
14
8
|
export declare function outboundSchemaInt<T extends Record<string, number | string>>(_: T): z.ZodType<number, z.ZodTypeDef, OpenEnum<T>>;
|
|
15
|
-
export {};
|
|
16
9
|
//# sourceMappingURL=enums.d.ts.map
|
package/esm/types/enums.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../src/types/enums.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../src/types/enums.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAgB,MAAM,mBAAmB,CAAC;AAE/D,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,IACxE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AACb,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,IACpE,CAAC,CAAC,MAAM,CAAC,CAAC,GACV,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,CAAC;AAE9D,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5D,OAAO,EAAE,CAAC,GACT,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,UAAU,EAAE,OAAO,CAAC,CAM/C;AAED,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EACxE,OAAO,EAAE,CAAC,GACT,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,UAAU,EAAE,OAAO,CAAC,CAO/C;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC7D,CAAC,EAAE,CAAC,GACH,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAE9C;AAED,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EACzE,CAAC,EAAE,CAAC,GACH,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAE9C"}
|
package/esm/types/enums.js
CHANGED
|
@@ -2,24 +2,7 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
4
|
import * as z from "zod/v3";
|
|
5
|
-
|
|
6
|
-
unrecognizedCount++;
|
|
7
|
-
return value;
|
|
8
|
-
}
|
|
9
|
-
let unrecognizedCount = 0;
|
|
10
|
-
let refCount = 0;
|
|
11
|
-
export function unrecognizedCounter() {
|
|
12
|
-
refCount++;
|
|
13
|
-
const start = unrecognizedCount;
|
|
14
|
-
return {
|
|
15
|
-
count: () => {
|
|
16
|
-
const count = unrecognizedCount - start;
|
|
17
|
-
if (--refCount === 0)
|
|
18
|
-
unrecognizedCount = 0;
|
|
19
|
-
return count;
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
}
|
|
5
|
+
import { unrecognized } from "./unrecognized.js";
|
|
23
6
|
export function inboundSchema(enumObj) {
|
|
24
7
|
const options = Object.values(enumObj);
|
|
25
8
|
return z.union([
|
package/esm/types/enums.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../../src/types/enums.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../../src/types/enums.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAgB,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAQ/D,MAAM,UAAU,aAAa,CAC3B,OAAU;IAEV,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACvC,OAAO,CAAC,CAAC,KAAK,CAAC;QACb,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACjC,CAAC,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;KACpC,CAAC,CAAC;AACZ,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,OAAU;IAEV,wEAAwE;IACxE,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC;IAC1E,OAAO,CAAC,CAAC,KAAK,CAAC;QACb,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACjC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;KAC1C,CAAC,CAAC;AACZ,CAAC;AAED,MAAM,UAAU,cAAc,CAC5B,CAAI;IAEJ,OAAO,CAAC,CAAC,MAAM,EAAS,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,CAAI;IAEJ,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAS,CAAC;AACjC,CAAC"}
|
package/esm/types/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export { blobLikeSchema, isBlobLike } from "./blobs.js";
|
|
2
|
-
export type { ClosedEnum, OpenEnum
|
|
2
|
+
export type { ClosedEnum, OpenEnum } from "./enums.js";
|
|
3
3
|
export type { Result } from "./fp.js";
|
|
4
4
|
export type { PageIterator, Paginator } from "./operations.js";
|
|
5
5
|
export { createPageIterator } from "./operations.js";
|
|
6
6
|
export { RFCDate } from "./rfcdate.js";
|
|
7
|
+
export * from "./unrecognized.js";
|
|
7
8
|
export type { WebhookRecipient } from "./webhooks.js";
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
package/esm/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxD,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxD,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACvD,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtC,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
|
package/esm/types/index.js
CHANGED
package/esm/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAIxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAIxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const __brand: unique symbol;
|
|
2
|
+
export type Unrecognized<T> = T & {
|
|
3
|
+
[__brand]: "unrecognized";
|
|
4
|
+
};
|
|
5
|
+
declare function unrecognized<T>(value: T): Unrecognized<T>;
|
|
6
|
+
export declare function startCountingUnrecognized(): {
|
|
7
|
+
end: () => number;
|
|
8
|
+
};
|
|
9
|
+
export { unrecognized };
|
|
10
|
+
//# sourceMappingURL=unrecognized.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unrecognized.d.ts","sourceRoot":"","sources":["../../src/types/unrecognized.ts"],"names":[],"mappings":"AAIA,OAAO,CAAC,MAAM,OAAO,EAAE,OAAO,MAAM,CAAC;AACrC,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,CAAC,OAAO,CAAC,EAAE,cAAc,CAAA;CAAE,CAAC;AAEhE,iBAAS,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAGlD;AAID,wBAAgB,yBAAyB;;EAUxC;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
function unrecognized(value) {
|
|
5
|
+
globalCount++;
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
let globalCount = 0;
|
|
9
|
+
let refCount = 0;
|
|
10
|
+
export function startCountingUnrecognized() {
|
|
11
|
+
refCount++;
|
|
12
|
+
const start = globalCount;
|
|
13
|
+
return {
|
|
14
|
+
end: () => {
|
|
15
|
+
const count = globalCount - start;
|
|
16
|
+
if (--refCount === 0)
|
|
17
|
+
globalCount = 0;
|
|
18
|
+
return count;
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export { unrecognized };
|
|
23
|
+
//# sourceMappingURL=unrecognized.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unrecognized.js","sourceRoot":"","sources":["../../src/types/unrecognized.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,SAAS,YAAY,CAAI,KAAQ;IAC/B,WAAW,EAAE,CAAC;IACd,OAAO,KAAwB,CAAC;AAClC,CAAC;AAED,IAAI,WAAW,GAAG,CAAC,CAAC;AACpB,IAAI,QAAQ,GAAG,CAAC,CAAC;AACjB,MAAM,UAAU,yBAAyB;IACvC,QAAQ,EAAE,CAAC;IACX,MAAM,KAAK,GAAG,WAAW,CAAC;IAC1B,OAAO;QACL,GAAG,EAAE,GAAG,EAAE;YACR,MAAM,KAAK,GAAG,WAAW,GAAG,KAAK,CAAC;YAClC,IAAI,EAAE,QAAQ,KAAK,CAAC;gBAAE,WAAW,GAAG,CAAC,CAAC;YACtC,OAAO,KAAK,CAAC;QACf,CAAC;KACF,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kombo-api/sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"author": "Kombo Technologies GmbH <support@kombo.dev> (https://www.kombo.dev)",
|
|
5
5
|
"description": "The official TypeScript/JavaScript SDK for the Kombo Unified API",
|
|
6
6
|
"homepage": "https://github.com/kombohq/typescript-sdk#readme",
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { KomboCore } from "../core.js";
|
|
6
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
7
|
+
import * as webhooks from "../models/webhooks/index.js";
|
|
8
|
+
import { ERR, Result } from "../types/fp.js";
|
|
9
|
+
|
|
10
|
+
export async function validateWebhook(_client: KomboCore, {
|
|
11
|
+
request: rawRequest,
|
|
12
|
+
}: {
|
|
13
|
+
request: {
|
|
14
|
+
body: BodyInit;
|
|
15
|
+
method: string;
|
|
16
|
+
url: string;
|
|
17
|
+
headers: Record<string, string> | Headers;
|
|
18
|
+
} | Request;
|
|
19
|
+
}): Promise<
|
|
20
|
+
Result<
|
|
21
|
+
| webhooks.WebhookDataChangedWebhookPayloadRequest
|
|
22
|
+
| webhooks.WebhookConnectionFlowFailedWebhookPayloadRequest
|
|
23
|
+
| webhooks.WebhookIntegrationCreatedWebhookPayloadRequest
|
|
24
|
+
| webhooks.WebhookIntegrationDeletedWebhookPayloadRequest
|
|
25
|
+
| webhooks.WebhookAssessmentOrderReceivedWebhookPayloadRequest
|
|
26
|
+
| webhooks.WebhookInlineAssessmentOrderReceivedWebhookPayloadRequest
|
|
27
|
+
| webhooks.WebhookIntegrationStateChangedWebhookPayloadRequest
|
|
28
|
+
| webhooks.WebhookSyncFinishedWebhookPayloadRequest,
|
|
29
|
+
SDKValidationError
|
|
30
|
+
>
|
|
31
|
+
> {
|
|
32
|
+
const request = normalizeRequest(rawRequest);
|
|
33
|
+
const knownSchemas = [
|
|
34
|
+
webhooks.webhookDataChangedWebhookPayloadRequestFromJSON,
|
|
35
|
+
webhooks.webhookConnectionFlowFailedWebhookPayloadRequestFromJSON,
|
|
36
|
+
webhooks.webhookIntegrationCreatedWebhookPayloadRequestFromJSON,
|
|
37
|
+
webhooks.webhookIntegrationDeletedWebhookPayloadRequestFromJSON,
|
|
38
|
+
webhooks.webhookAssessmentOrderReceivedWebhookPayloadRequestFromJSON,
|
|
39
|
+
webhooks.webhookInlineAssessmentOrderReceivedWebhookPayloadRequestFromJSON,
|
|
40
|
+
webhooks.webhookIntegrationStateChangedWebhookPayloadRequestFromJSON,
|
|
41
|
+
webhooks.webhookSyncFinishedWebhookPayloadRequestFromJSON,
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
const jsonString = await request.text();
|
|
45
|
+
|
|
46
|
+
for (const schema of knownSchemas) {
|
|
47
|
+
const ret = schema(jsonString);
|
|
48
|
+
if (ret.ok) {
|
|
49
|
+
return ret;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return ERR(
|
|
54
|
+
new SDKValidationError(
|
|
55
|
+
"No matching schema found for the given webhook payload",
|
|
56
|
+
jsonString,
|
|
57
|
+
jsonString,
|
|
58
|
+
),
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function normalizeRequest(
|
|
63
|
+
request: {
|
|
64
|
+
body: BodyInit;
|
|
65
|
+
method: string;
|
|
66
|
+
url: string;
|
|
67
|
+
headers: Record<string, string> | Headers;
|
|
68
|
+
} | Request,
|
|
69
|
+
): Request {
|
|
70
|
+
if (request instanceof Request) {
|
|
71
|
+
return request;
|
|
72
|
+
}
|
|
73
|
+
return new Request(request.url, request);
|
|
74
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -69,7 +69,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
69
69
|
export const SDK_METADATA = {
|
|
70
70
|
language: "typescript",
|
|
71
71
|
openapiDocVersion: "1.0.0",
|
|
72
|
-
sdkVersion: "0.2.
|
|
73
|
-
genVersion: "2.
|
|
74
|
-
userAgent: "speakeasy-sdk/typescript 0.2.
|
|
72
|
+
sdkVersion: "0.2.4",
|
|
73
|
+
genVersion: "2.760.2",
|
|
74
|
+
userAgent: "speakeasy-sdk/typescript 0.2.4 2.760.2 1.0.0 @kombo-api/sdk",
|
|
75
75
|
} as const;
|
package/src/sdk/sdk.ts
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import { validateWebhook } from "../funcs/validateWebhook.js";
|
|
5
6
|
import { ClientSDK } from "../lib/sdks.js";
|
|
7
|
+
import * as webhooks from "../models/webhooks/index.js";
|
|
8
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
6
9
|
import { Assessment } from "./assessment.js";
|
|
7
10
|
import { Ats } from "./ats.js";
|
|
8
11
|
import { Connect } from "./connect.js";
|
|
@@ -34,4 +37,29 @@ export class Kombo extends ClientSDK {
|
|
|
34
37
|
get connect(): Connect {
|
|
35
38
|
return (this._connect ??= new Connect(this._options));
|
|
36
39
|
}
|
|
40
|
+
|
|
41
|
+
async validateWebhook({
|
|
42
|
+
request,
|
|
43
|
+
}: {
|
|
44
|
+
request: {
|
|
45
|
+
body: string;
|
|
46
|
+
headers: Record<string, string> | Headers;
|
|
47
|
+
url: string;
|
|
48
|
+
method: string;
|
|
49
|
+
} | Request;
|
|
50
|
+
}): Promise<
|
|
51
|
+
| webhooks.WebhookDataChangedWebhookPayloadRequest
|
|
52
|
+
| webhooks.WebhookConnectionFlowFailedWebhookPayloadRequest
|
|
53
|
+
| webhooks.WebhookIntegrationCreatedWebhookPayloadRequest
|
|
54
|
+
| webhooks.WebhookIntegrationDeletedWebhookPayloadRequest
|
|
55
|
+
| webhooks.WebhookAssessmentOrderReceivedWebhookPayloadRequest
|
|
56
|
+
| webhooks.WebhookInlineAssessmentOrderReceivedWebhookPayloadRequest
|
|
57
|
+
| webhooks.WebhookIntegrationStateChangedWebhookPayloadRequest
|
|
58
|
+
| webhooks.WebhookSyncFinishedWebhookPayloadRequest
|
|
59
|
+
> {
|
|
60
|
+
return unwrapAsync(validateWebhook(
|
|
61
|
+
this,
|
|
62
|
+
{ request },
|
|
63
|
+
));
|
|
64
|
+
}
|
|
37
65
|
}
|
package/src/types/enums.ts
CHANGED
|
@@ -3,34 +3,14 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import * as z from "zod/v3";
|
|
6
|
+
import { Unrecognized, unrecognized } from "./unrecognized.js";
|
|
6
7
|
|
|
7
|
-
declare const __brand: unique symbol;
|
|
8
|
-
export type Unrecognized<T> = T & { [__brand]: "unrecognized" };
|
|
9
8
|
export type ClosedEnum<T extends Readonly<Record<string, string | number>>> =
|
|
10
9
|
T[keyof T];
|
|
11
10
|
export type OpenEnum<T extends Readonly<Record<string, string | number>>> =
|
|
12
11
|
| T[keyof T]
|
|
13
12
|
| Unrecognized<T[keyof T] extends number ? number : string>;
|
|
14
13
|
|
|
15
|
-
function unrecognized<T>(value: T): Unrecognized<T> {
|
|
16
|
-
unrecognizedCount++;
|
|
17
|
-
return value as Unrecognized<T>;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
let unrecognizedCount = 0;
|
|
21
|
-
let refCount = 0;
|
|
22
|
-
export function unrecognizedCounter() {
|
|
23
|
-
refCount++;
|
|
24
|
-
const start = unrecognizedCount;
|
|
25
|
-
return {
|
|
26
|
-
count: () => {
|
|
27
|
-
const count = unrecognizedCount - start;
|
|
28
|
-
if (--refCount === 0) unrecognizedCount = 0;
|
|
29
|
-
return count;
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
14
|
export function inboundSchema<T extends Record<string, string>>(
|
|
35
15
|
enumObj: T,
|
|
36
16
|
): z.ZodType<OpenEnum<T>, z.ZodTypeDef, unknown> {
|
package/src/types/index.ts
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
export { blobLikeSchema, isBlobLike } from "./blobs.js";
|
|
6
|
-
export type { ClosedEnum, OpenEnum
|
|
6
|
+
export type { ClosedEnum, OpenEnum } from "./enums.js";
|
|
7
7
|
export type { Result } from "./fp.js";
|
|
8
8
|
export type { PageIterator, Paginator } from "./operations.js";
|
|
9
9
|
export { createPageIterator } from "./operations.js";
|
|
10
10
|
export { RFCDate } from "./rfcdate.js";
|
|
11
|
+
export * from "./unrecognized.js";
|
|
11
12
|
export type { WebhookRecipient } from "./webhooks.js";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
declare const __brand: unique symbol;
|
|
6
|
+
export type Unrecognized<T> = T & { [__brand]: "unrecognized" };
|
|
7
|
+
|
|
8
|
+
function unrecognized<T>(value: T): Unrecognized<T> {
|
|
9
|
+
globalCount++;
|
|
10
|
+
return value as Unrecognized<T>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let globalCount = 0;
|
|
14
|
+
let refCount = 0;
|
|
15
|
+
export function startCountingUnrecognized() {
|
|
16
|
+
refCount++;
|
|
17
|
+
const start = globalCount;
|
|
18
|
+
return {
|
|
19
|
+
end: () => {
|
|
20
|
+
const count = globalCount - start;
|
|
21
|
+
if (--refCount === 0) globalCount = 0;
|
|
22
|
+
return count;
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { unrecognized };
|