@compilot/js-sdk 2.0.40-dev

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.
Files changed (46) hide show
  1. package/dist/compilot-js-sdk.cjs.d.ts +2 -0
  2. package/dist/compilot-js-sdk.cjs.dev.js +1376 -0
  3. package/dist/compilot-js-sdk.cjs.js +7 -0
  4. package/dist/compilot-js-sdk.cjs.prod.js +1376 -0
  5. package/dist/compilot-js-sdk.esm.js +1360 -0
  6. package/dist/declarations/src/actions/attachCustomerInformation.d.ts +47 -0
  7. package/dist/declarations/src/actions/attachCustomerInformation.d.ts.map +1 -0
  8. package/dist/declarations/src/actions/createWeb2Session.d.ts +63 -0
  9. package/dist/declarations/src/actions/createWeb2Session.d.ts.map +1 -0
  10. package/dist/declarations/src/actions/createWeb3Challenge.d.ts +63 -0
  11. package/dist/declarations/src/actions/createWeb3Challenge.d.ts.map +1 -0
  12. package/dist/declarations/src/actions/getCustomerStatusByCustomerId.d.ts +29 -0
  13. package/dist/declarations/src/actions/getCustomerStatusByCustomerId.d.ts.map +1 -0
  14. package/dist/declarations/src/actions/getCustomerStatusByExternalCustomerId.d.ts +29 -0
  15. package/dist/declarations/src/actions/getCustomerStatusByExternalCustomerId.d.ts.map +1 -0
  16. package/dist/declarations/src/actions/getCustomerStatusByWallet.d.ts +29 -0
  17. package/dist/declarations/src/actions/getCustomerStatusByWallet.d.ts.map +1 -0
  18. package/dist/declarations/src/actions/getCustomerWallets.d.ts +31 -0
  19. package/dist/declarations/src/actions/getCustomerWallets.d.ts.map +1 -0
  20. package/dist/declarations/src/actions/getTxAuthDataSignature.d.ts +58 -0
  21. package/dist/declarations/src/actions/getTxAuthDataSignature.d.ts.map +1 -0
  22. package/dist/declarations/src/actions/validateWebhookEvent.d.ts +21 -0
  23. package/dist/declarations/src/actions/validateWebhookEvent.d.ts.map +1 -0
  24. package/dist/declarations/src/configuration/createSdk.d.ts +22 -0
  25. package/dist/declarations/src/configuration/createSdk.d.ts.map +1 -0
  26. package/dist/declarations/src/configuration/index.d.ts +2 -0
  27. package/dist/declarations/src/configuration/index.d.ts.map +1 -0
  28. package/dist/declarations/src/errors/ApiKeyNotProvidedError.d.ts +7 -0
  29. package/dist/declarations/src/errors/ApiKeyNotProvidedError.d.ts.map +1 -0
  30. package/dist/declarations/src/errors/WebhookEventDataNotSupportedByThisSdkVersion.d.ts +7 -0
  31. package/dist/declarations/src/errors/WebhookEventDataNotSupportedByThisSdkVersion.d.ts.map +1 -0
  32. package/dist/declarations/src/errors/WebhookSecretNotProvidedError.d.ts +7 -0
  33. package/dist/declarations/src/errors/WebhookSecretNotProvidedError.d.ts.map +1 -0
  34. package/dist/declarations/src/errors/WebhookSignatureInvalid.d.ts +7 -0
  35. package/dist/declarations/src/errors/WebhookSignatureInvalid.d.ts.map +1 -0
  36. package/dist/declarations/src/errors/index.d.ts +5 -0
  37. package/dist/declarations/src/errors/index.d.ts.map +1 -0
  38. package/dist/declarations/src/index.d.ts +5 -0
  39. package/dist/declarations/src/index.d.ts.map +1 -0
  40. package/dist/declarations/src/utils/index.d.ts +2 -0
  41. package/dist/declarations/src/utils/index.d.ts.map +1 -0
  42. package/dist/declarations/src/utils/internal.d.ts +17 -0
  43. package/dist/declarations/src/utils/internal.d.ts.map +1 -0
  44. package/dist/package.json +60 -0
  45. package/package.json +59 -0
  46. package/readme.md +69 -0
@@ -0,0 +1,47 @@
1
+ import type { NexeraAPIClient } from "@nexeraid/api-client";
2
+ import { AdditionalCustomerInformationParams } from "@nexeraid/identity-schemas";
3
+ import type { Logger } from "@nexeraid/logger";
4
+ import { z } from "zod";
5
+ /**
6
+ * Attach additional information to a customer
7
+ */
8
+ export type AttachCustomerInformationParams = {
9
+ /** The customer ID from the perspective of your system */
10
+ externalCustomerId: string;
11
+ /** The additional information to attach */
12
+ information: AdditionalCustomerInformationParams;
13
+ };
14
+ export declare const AttachCustomerInformationParams: z.ZodType<AttachCustomerInformationParams>;
15
+ /**
16
+ * Attach additional information to a customer
17
+ *
18
+ * @param params - The parameters required to attach the information
19
+ *
20
+ * @category Actions
21
+ *
22
+ * @example
23
+ *
24
+ * ```typescript
25
+ * import { createApiClient } from "@compilot/js-sdk";
26
+ *
27
+ * const apiClient = createApiClient({ apiKey });
28
+ *
29
+ * await apiClient.attachCustomerInformation({
30
+ * externalCustomerId: "123",
31
+ * information: {
32
+ * email: "test@test.com",
33
+ * phone: "+1234567890",
34
+ * wallet: {
35
+ * address: "tz1abc",
36
+ * namespace: "tezos",
37
+ * },
38
+ * }
39
+ * });
40
+ * ```
41
+ */
42
+ export type AttachCustomerInformationFn = (params: AttachCustomerInformationParams) => Promise<void>;
43
+ export declare const attachCustomerInformationFactory: ({ logger, compilotApiClient, }: {
44
+ logger: Logger;
45
+ compilotApiClient: NexeraAPIClient;
46
+ }) => AttachCustomerInformationFn;
47
+ //# sourceMappingURL=attachCustomerInformation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachCustomerInformation.d.ts","sourceRoot":"../../../../src/actions","sources":["attachCustomerInformation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EACL,mCAAmC,EAEpC,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,MAAM,+BAA+B,GAAG;IAC5C,0DAA0D;IAC1D,kBAAkB,EAAE,MAAM,CAAC;IAC3B,2CAA2C;IAC3C,WAAW,EAAE,mCAAmC,CAAC;CAClD,CAAC;AACF,eAAO,MAAM,+BAA+B,EAAE,CAAC,CAAC,OAAO,CAAC,+BAA+B,CAInF,CAAC;AAEL;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,MAAM,2BAA2B,GAAG,CACxC,MAAM,EAAE,+BAA+B,KACpC,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB,eAAO,MAAM,gCAAgC,mCAG1C;IACD,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,eAAe,CAAC;CACpC,KAAG,2BA6GH,CAAC"}
@@ -0,0 +1,63 @@
1
+ import type { IdentityApiClient } from "@nexeraid/identity-api-client";
2
+ import type { AuthSession, Web2CreateSessionParams } from "@nexeraid/identity-schemas";
3
+ /**
4
+ * Create a new web2 session
5
+ * @param params The parameters to create the session with
6
+ * @returns A promise that resolves when the session is created
7
+ *
8
+ * @category Actions
9
+ *
10
+ * @example
11
+ *
12
+ * Basic usage:
13
+ *
14
+ * ```typescript
15
+ * import { createApiClient } from "@compilot/js-sdk";
16
+ *
17
+ * const apiClient = createApiClient({ apiKey });
18
+ *
19
+ * const sessionContent = await apiClient.createSession({
20
+ * workflowId: "4f7b537f-0ae0-429c-98c8-3f6555ef23d6",
21
+ * externalCustomerId: "123",
22
+ * additionalInformation: {
23
+ * email: "test@test.com",
24
+ * phone: "+1234567890",
25
+ * wallet: {
26
+ * address: "tz1abc",
27
+ * namespace: "tezos",
28
+ * },
29
+ * }
30
+ * });
31
+ * ```
32
+ *
33
+ * More often used as part of an api to protect the api key.
34
+ * Please find below an example of how to use the createSession function in Next.js:
35
+ *
36
+ * ```typescript
37
+ * import { createApiClient } from "@compilot/js-sdk";
38
+ *
39
+ * const apiClient = createApiClient({ apiKey });
40
+ *
41
+ *
42
+ * export default async function handler(req: NextApiRequest, res: NextApiResponse ) {
43
+ * if (req.method !== "POST") {
44
+ * res.setHeader("Allow", ["POST"]);
45
+ * res.status(405).end(`Method ${req.method} Not Allowed`);
46
+ * return;
47
+ * }
48
+ *
49
+ * const sessionRes = await apiClient.createSession({
50
+ * workflowId: "4f7b537f-0ae0-429c-98c8-3f6555ef23d6",
51
+ * externalCustomerId: req.session.externalCustomerId,
52
+ * });
53
+ *
54
+ * // Return the session to the client
55
+ * res.status(200).json(sessionRes);
56
+ * }
57
+ * ```
58
+ */
59
+ export type CreateWeb2SessionFn = (params: Web2CreateSessionParams) => Promise<AuthSession>;
60
+ export declare const createWeb2SessionFactory: (deps: {
61
+ identityApiClient: IdentityApiClient;
62
+ }) => CreateWeb2SessionFn;
63
+ //# sourceMappingURL=createWeb2Session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createWeb2Session.d.ts","sourceRoot":"../../../../src/actions","sources":["createWeb2Session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,KAAK,EACV,WAAW,EACX,uBAAuB,EACxB,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAChC,MAAM,EAAE,uBAAuB,KAC5B,OAAO,CAAC,WAAW,CAAC,CAAC;AAE1B,eAAO,MAAM,wBAAwB,SAC5B;IAAE,iBAAiB,EAAE,iBAAiB,CAAA;CAAE,KAAG,mBAMjD,CAAC"}
@@ -0,0 +1,63 @@
1
+ import type { IdentityApiClient } from "@nexeraid/identity-api-client";
2
+ import type { ChallengeResponse, WalletChallengeRequest } from "@nexeraid/identity-schemas";
3
+ /**
4
+ * Create a challenge for a wallet. The web-sdk will use this to sign a message and prove ownership of a wallet.
5
+ *
6
+ * @param params The parameters to create the challenge with
7
+ * @returns A promise that resolves to the challenge content
8
+ *
9
+ * @category Actions
10
+ *
11
+ * @example
12
+ *
13
+ * Basic usage:
14
+ *
15
+ * ```typescript
16
+ * import { createApiClient } from "@compilot/js-sdk";
17
+ *
18
+ * const apiClient = createApiClient({ apiKey });
19
+ *
20
+ * const challengeContent = await apiClient.createWeb3Challenge({
21
+ * address: "0xabc",
22
+ * namespace: "eip155",
23
+ * blockchainId: "1",
24
+ * origin: "https://example.com",
25
+ * workflowId: "4f7b537f-0ae0-429c-98c8-3f6555ef23d6",
26
+ * externalCustomerId: "123",
27
+ * });
28
+ * ```
29
+ *
30
+ * More often used as part of an api to protect the api key.
31
+ * Please find below an example of how to use the createWeb3Challenge function in Next.js:
32
+ *
33
+ * ```typescript
34
+ * import { createApiClient } from "@compilot/js-sdk";
35
+ *
36
+ * const apiClient = createApiClient({ apiKey });
37
+ *
38
+ * export default async function handler(req: NextApiRequest, res: NextApiResponse ) {
39
+ * if (req.method !== "POST") {
40
+ * res.setHeader("Allow", ["POST"]);
41
+ * res.status(405).end(`Method ${req.method} Not Allowed`);
42
+ * return;
43
+ * }
44
+ *
45
+ * const challengeContent = await apiClient.createWeb3Challenge({
46
+ * address: "0xabc",
47
+ * namespace: "eip155",
48
+ * blockchainId: "1",
49
+ * origin: "https://example.com",
50
+ * workflowId: "4f7b537f-0ae0-429c-98c8-3f6555ef23d6",
51
+ * externalCustomerId: "123",
52
+ * });
53
+ *
54
+ * // Return the challenge to the client
55
+ * res.status(200).json(challengeRes);
56
+ * }
57
+ * ```
58
+ */
59
+ export type CreateWeb3ChallengeFn = (params: WalletChallengeRequest) => Promise<ChallengeResponse>;
60
+ export declare const createWeb3ChallengeFactory: (deps: {
61
+ identityApiClient: IdentityApiClient;
62
+ }) => CreateWeb3ChallengeFn;
63
+ //# sourceMappingURL=createWeb3Challenge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createWeb3Challenge.d.ts","sourceRoot":"../../../../src/actions","sources":["createWeb3Challenge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,KAAK,EACV,iBAAiB,EACjB,sBAAsB,EACvB,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAClC,MAAM,EAAE,sBAAsB,KAC3B,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAEhC,eAAO,MAAM,0BAA0B,SAC9B;IAAE,iBAAiB,EAAE,iBAAiB,CAAA;CAAE,KAAG,qBAMjD,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { NexeraAPIClient } from "@nexeraid/api-client";
2
+ import type { CustomerStatus } from "@nexeraid/identity-schemas";
3
+ /**
4
+ * Get the status of a customer by their customer ID
5
+ *
6
+ * @param params - The parameters required to get the customer status
7
+ * @returns The status of the customer
8
+ *
9
+ * @category Actions
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ *
14
+ * import { createApiClient } from "@compilot/js-sdk";
15
+ *
16
+ * const apiClient = createApiClient({ apiKey });
17
+ *
18
+ * const customerStatus = await apiClient.getCustomerStatusByCustomerId({
19
+ * customerId: "123",
20
+ * });
21
+ * ```
22
+ */
23
+ export type GetCustomerStatusByCustomerIdFn = (params: {
24
+ customerId: string;
25
+ }) => Promise<CustomerStatus | null>;
26
+ export declare const getCustomerStatusByCustomerIdFactory: (deps: {
27
+ compilotApiClient: NexeraAPIClient;
28
+ }) => GetCustomerStatusByCustomerIdFn;
29
+ //# sourceMappingURL=getCustomerStatusByCustomerId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCustomerStatusByCustomerId.d.ts","sourceRoot":"../../../../src/actions","sources":["getCustomerStatusByCustomerId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,+BAA+B,GAAG,CAAC,MAAM,EAAE;IACrD,UAAU,EAAE,MAAM,CAAC;CACpB,KAAK,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;AAErC,eAAO,MAAM,oCAAoC,SACxC;IACL,iBAAiB,EAAE,eAAe,CAAC;CACpC,KAAG,+BAOH,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { NexeraAPIClient } from "@nexeraid/api-client";
2
+ import type { CustomerStatus, ExternalCustomerId } from "@nexeraid/identity-schemas";
3
+ /**
4
+ * Get the status of a customer by their external customer ID
5
+ *
6
+ * @param params - The parameters required to get the customer status
7
+ * @returns The status of the customer
8
+ *
9
+ * @category Actions
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ *
14
+ * import { createApiClient } from "@compilot/js-sdk";
15
+ *
16
+ * const apiClient = createApiClient({ apiKey });
17
+ *
18
+ * const customerStatus = await apiClient.getCustomerStatusByExternalCustomerId({
19
+ * externalCustomerId: "123",
20
+ * });
21
+ * ```
22
+ */
23
+ export type GetCustomerStatusByExternalCustomerIdFn = (params: {
24
+ externalCustomerId: ExternalCustomerId;
25
+ }) => Promise<CustomerStatus | null>;
26
+ export declare const getCustomerStatusByExternalCustomerIdFactory: (deps: {
27
+ compilotApiClient: NexeraAPIClient;
28
+ }) => GetCustomerStatusByExternalCustomerIdFn;
29
+ //# sourceMappingURL=getCustomerStatusByExternalCustomerId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCustomerStatusByExternalCustomerId.d.ts","sourceRoot":"../../../../src/actions","sources":["getCustomerStatusByExternalCustomerId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,uCAAuC,GAAG,CAAC,MAAM,EAAE;IAC7D,kBAAkB,EAAE,kBAAkB,CAAC;CACxC,KAAK,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;AAErC,eAAO,MAAM,4CAA4C,SAChD;IACL,iBAAiB,EAAE,eAAe,CAAC;CACpC,KAAG,uCAOH,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { NexeraAPIClient } from "@nexeraid/api-client";
2
+ import type { CustomerStatus } from "@nexeraid/identity-schemas";
3
+ /**
4
+ * Get the status of a customer by their wallet address
5
+ *
6
+ * @param params - The parameters required to get the customer status
7
+ * @returns The status of the customer
8
+ *
9
+ * @category Actions
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * import { createApiClient } from "@compilot/js-sdk";
14
+ *
15
+ * const apiClient = createApiClient({ apiKey });
16
+ *
17
+ * const customerStatus = await apiClient.getCustomerStatusByWallet({
18
+ * walletAddress: "tz1abc",
19
+ * workspaceId: "123",
20
+ * });
21
+ */
22
+ export type GetCustomerStatusByWalletFn = (params: {
23
+ walletAddress: string;
24
+ workspaceId: string;
25
+ }) => Promise<CustomerStatus | null>;
26
+ export declare const getCustomerStatusByWalletFactory: (deps: {
27
+ compilotApiClient: NexeraAPIClient;
28
+ }) => GetCustomerStatusByWalletFn;
29
+ //# sourceMappingURL=getCustomerStatusByWallet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCustomerStatusByWallet.d.ts","sourceRoot":"../../../../src/actions","sources":["getCustomerStatusByWallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,2BAA2B,GAAG,CAAC,MAAM,EAAE;IACjD,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB,KAAK,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;AAErC,eAAO,MAAM,gCAAgC,SACpC;IAAE,iBAAiB,EAAE,eAAe,CAAA;CAAE,KAAG,2BAO/C,CAAC"}
@@ -0,0 +1,31 @@
1
+ import type { NexeraAPIClient } from "@nexeraid/api-client";
2
+ /**
3
+ * Get the wallets of a customer
4
+ *
5
+ * @param params - The parameters required to get the wallets
6
+ * @returns The wallets of the customer
7
+ *
8
+ * @category Actions
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * import { createApiClient } from "@compilot/js-sdk";
13
+ *
14
+ * const apiClient = createApiClient({ apiKey });
15
+ *
16
+ * const wallets = await apiClient.getCustomerWallets({
17
+ * customerId: "123",
18
+ * });
19
+ * ```
20
+ */
21
+ export type GetCustomerWalletsFn = (params: {
22
+ customerId: string;
23
+ }) => Promise<{
24
+ address: string;
25
+ chain: string;
26
+ verified: boolean;
27
+ }[]>;
28
+ export declare const getCustomerWalletsFactory: (deps: {
29
+ compilotApiClient: NexeraAPIClient;
30
+ }) => GetCustomerWalletsFn;
31
+ //# sourceMappingURL=getCustomerWallets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCustomerWallets.d.ts","sourceRoot":"../../../../src/actions","sources":["getCustomerWallets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,KAAK,OAAO,CAC5E;IACE,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CACnB,EAAE,CACJ,CAAC;AAEF,eAAO,MAAM,yBAAyB,SAC7B;IAAE,iBAAiB,EAAE,eAAe,CAAA;CAAE,KAAG,oBAW/C,CAAC"}
@@ -0,0 +1,58 @@
1
+ import type { NexeraAPIClient } from "@nexeraid/api-client";
2
+ import type { ExtendedTezosTxAuthInput, ExtendedTxAuthInput, TxAuthDataSignatureResponse } from "@nexeraid/identity-schemas";
3
+ import { ExtendedTezosTxAuthDataSignatureResponse } from "@nexeraid/identity-schemas";
4
+ /**
5
+ * Get the signature of the transaction authorization data
6
+ *
7
+ * @param params - The parameters required to get the transaction authorization data signature
8
+ * @returns The signature of the transaction authorization data
9
+ *
10
+ * @category Actions
11
+ *
12
+ * @example
13
+ *
14
+ * Eip155:
15
+ * ```typescript
16
+ * import { createApiClient } from "@compilot/js-sdk";
17
+ *
18
+ * const apiClient = createApiClient({ apiKey });
19
+ *
20
+ * const txAuthDataSignature = await apiClient.getTxAuthDataSignature({
21
+ * namespace: "eip155",
22
+ * contractAbi: ExampleGatedNFTMinterABI,
23
+ * contractAddress: "0x123",
24
+ * functionName: "mintNFTGated",
25
+ * args: [account.address],
26
+ * userAddress: account.address,
27
+ * chainId: EvmChainId.parse(chainId),
28
+ * });
29
+ *
30
+ * if (!signatureResponse.isAuthorized) {
31
+ * throw new Error("User is not authorized");
32
+ * }
33
+ *
34
+ * // Mint Gated Nft with signature
35
+ * const unsignedTx = encodeFunctionData({
36
+ * abi: contractAbi,
37
+ * functionName: "mintNFTGated",
38
+ * args: [account.address],
39
+ * });
40
+ *
41
+ * // Build the raw transaction data with the signature
42
+ * const txData = (unsignedTx + signatureResponse.payload) as `0x${string}`;
43
+ *
44
+ * // try to mint nft
45
+ * const tx = await walletClient.data.sendTransaction({
46
+ * to: contractAddress,
47
+ * data: txData,
48
+ * });
49
+ * ```
50
+ */
51
+ export type GetTxAuthDataSignatureFn = {
52
+ (params: ExtendedTxAuthInput): Promise<TxAuthDataSignatureResponse>;
53
+ (params: ExtendedTezosTxAuthInput): Promise<ExtendedTezosTxAuthDataSignatureResponse>;
54
+ };
55
+ export declare const getTxAuthDataSignatureFactory: (deps: {
56
+ compilotApiClient: NexeraAPIClient;
57
+ }) => GetTxAuthDataSignatureFn;
58
+ //# sourceMappingURL=getTxAuthDataSignature.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getTxAuthDataSignature.d.ts","sourceRoot":"../../../../src/actions","sources":["getTxAuthDataSignature.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAGV,wBAAwB,EACxB,mBAAmB,EACnB,2BAA2B,EAC5B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,wCAAwC,EAEzC,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;IACpE,CACE,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,wCAAwC,CAAC,CAAC;CACtD,CAAC;AAEF,eAAO,MAAM,6BAA6B,SAAU;IAClD,iBAAiB,EAAE,eAAe,CAAC;CACpC,KAAG,wBAiDH,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { WebhookEventPayload } from "@nexeraid/identity-schemas/webhooks";
2
+ import type { Logger } from "@nexeraid/logger";
3
+ /**
4
+ * Validate a webhook event and return the event type
5
+ *
6
+ * @param params.headers The headers of the webhook request. We are only interested in the `svix-*` header
7
+ * @param params.body The body of the webhook request
8
+ *
9
+ * @throws {WebhookSignatureInvalid} If the webhook event is invalid
10
+ *
11
+ * @returns The parsed webhook event
12
+ */
13
+ export type ValidateWebhookEventFn = (params: {
14
+ headers: Record<string, string>;
15
+ body: string | object;
16
+ }) => WebhookEventPayload;
17
+ export declare const validateWebhookEventFactory: ({ logger, webhookSecret, }: {
18
+ logger: Logger;
19
+ webhookSecret: string;
20
+ }) => ValidateWebhookEventFn;
21
+ //# sourceMappingURL=validateWebhookEvent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateWebhookEvent.d.ts","sourceRoot":"../../../../src/actions","sources":["validateWebhookEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAO/C;;;;;;;;;GASG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,MAAM,EAAE;IAC5C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB,KAAK,mBAAmB,CAAC;AAE1B,eAAO,MAAM,2BAA2B,+BAGrC;IACD,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;CACvB,KAAG,sBAsCH,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Create an API client for the ComPilot API
3
+ *
4
+ * @param config.apiKey The API key to use for the client
5
+ * @returns The API client
6
+ */
7
+ export declare const createSdk: ({ apiKey, webhookSecret, }: {
8
+ apiKey: string;
9
+ webhookSecret: string;
10
+ }) => {
11
+ createWeb3Challenge: import("../actions/createWeb3Challenge.js").CreateWeb3ChallengeFn;
12
+ createSession: import("../actions/createWeb2Session.js").CreateWeb2SessionFn;
13
+ getTxAuthDataSignature: import("../actions/getTxAuthDataSignature.js").GetTxAuthDataSignatureFn;
14
+ attachCustomerInformation: import("../actions/attachCustomerInformation.js").AttachCustomerInformationFn;
15
+ getCustomerStatusByExternalCustomerId: import("../actions/getCustomerStatusByExternalCustomerId.js").GetCustomerStatusByExternalCustomerIdFn;
16
+ getCustomerStatusByWallet: import("../actions/getCustomerStatusByWallet.js").GetCustomerStatusByWalletFn;
17
+ getCustomerStatusByCustomerId: import("../actions/getCustomerStatusByCustomerId.js").GetCustomerStatusByCustomerIdFn;
18
+ getCustomerWallets: import("../actions/getCustomerWallets.js").GetCustomerWalletsFn;
19
+ validateWebhookEvent: import("../actions/validateWebhookEvent.js").ValidateWebhookEventFn;
20
+ };
21
+ export { WalletChallengeRequest } from "@nexeraid/identity-schemas";
22
+ //# sourceMappingURL=createSdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createSdk.d.ts","sourceRoot":"../../../../src/configuration","sources":["createSdk.ts"],"names":[],"mappings":"AAgBA;;;;;GAKG;AACH,eAAO,MAAM,SAAS,+BAGnB;IACD,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;CACvB;;;;;;;;;;CA0CA,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./createSdk.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"../../../../src/configuration","sources":["index.ts"],"names":[],"mappings":"AAAA,+BAA4B"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Error thrown when API key is not provided.
3
+ */
4
+ export declare class ApiKeyNotProvidedError extends Error {
5
+ constructor();
6
+ }
7
+ //# sourceMappingURL=ApiKeyNotProvidedError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApiKeyNotProvidedError.d.ts","sourceRoot":"../../../../src/errors","sources":["ApiKeyNotProvidedError.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;;CAMhD"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Error thrown when the webhook event data is invalid.
3
+ */
4
+ export declare class WebhookEventDataNotSupportedByThisSdkVersion extends Error {
5
+ constructor();
6
+ }
7
+ //# sourceMappingURL=WebhookEventDataNotSupportedByThisSdkVersion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebhookEventDataNotSupportedByThisSdkVersion.d.ts","sourceRoot":"../../../../src/errors","sources":["WebhookEventDataNotSupportedByThisSdkVersion.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,4CAA6C,SAAQ,KAAK;;CAMtE"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Error thrown when webhook secret is not provided.
3
+ */
4
+ export declare class WebhookSecretNotProvidedError extends Error {
5
+ constructor();
6
+ }
7
+ //# sourceMappingURL=WebhookSecretNotProvidedError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebhookSecretNotProvidedError.d.ts","sourceRoot":"../../../../src/errors","sources":["WebhookSecretNotProvidedError.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,6BAA8B,SAAQ,KAAK;;CAMvD"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Error thrown when the webhook signature is invalid.
3
+ */
4
+ export declare class WebhookSignatureInvalid extends Error {
5
+ constructor();
6
+ }
7
+ //# sourceMappingURL=WebhookSignatureInvalid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebhookSignatureInvalid.d.ts","sourceRoot":"../../../../src/errors","sources":["WebhookSignatureInvalid.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;;CAMjD"}
@@ -0,0 +1,5 @@
1
+ export * from "./ApiKeyNotProvidedError.js";
2
+ export * from "./WebhookEventDataNotSupportedByThisSdkVersion.js";
3
+ export * from "./WebhookSecretNotProvidedError.js";
4
+ export * from "./WebhookSignatureInvalid.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"../../../../src/errors","sources":["index.ts"],"names":[],"mappings":"AAAA,4CAAyC;AACzC,kEAA+D;AAC/D,mDAAgD;AAChD,6CAA0C"}
@@ -0,0 +1,5 @@
1
+ export * from "./configuration/index.js";
2
+ export * from "./errors/index.js";
3
+ export * from "./utils/index.js";
4
+ export { AllNexeraEventTypes } from "@nexeraid/identity-schemas/webhooks";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"../../../src","sources":["index.ts"],"names":[],"mappings":"AAAA,yCAAgC;AAChC,kCAAyB;AACzB,iCAAwB;AAGxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./internal.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"../../../../src/utils","sources":["index.ts"],"names":[],"mappings":"AAAA,8BAA2B"}
@@ -0,0 +1,17 @@
1
+ import type { Environment } from "@nexeraid/identity-schemas";
2
+ /**
3
+ * @private exclude from documentation
4
+ */
5
+ type InternalConfig = {
6
+ env: Environment;
7
+ };
8
+ /**
9
+ * @private exclude from documentation
10
+ */
11
+ export declare const _setInternalConfig: (config: InternalConfig) => void;
12
+ /**
13
+ * @private exclude from documentation
14
+ */
15
+ export declare const getEnv: () => Environment;
16
+ export {};
17
+ //# sourceMappingURL=internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"../../../../src/utils","sources":["internal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D;;GAEG;AACH,KAAK,cAAc,GAAG;IACpB,GAAG,EAAE,WAAW,CAAC;CAClB,CAAC;AAUF;;GAEG;AACH,eAAO,MAAM,kBAAkB,WAAY,cAAc,KAAG,IAE3D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,MAAM,QAAO,WAAiC,CAAC"}
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@compilot/js-sdk",
3
+ "version": "2.0.40",
4
+ "description": "ComPilot JS SDK",
5
+ "keywords": [],
6
+ "license": "ISC",
7
+ "author": "",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/compilot-js-sdk.esm.js",
11
+ "require": "./dist/compilot-js-sdk.cjs.js"
12
+ }
13
+ },
14
+ "main": "dist/compilot-js-sdk.cjs.js",
15
+ "module": "dist/compilot-js-sdk.esm.js",
16
+ "types": "dist/compilot-js-sdk.cjs.d.ts",
17
+ "files": [
18
+ "/dist"
19
+ ],
20
+ "scripts": {
21
+ "build": "preconstruct build && npm run copy-package-json-to-dist",
22
+ "copy-package-json-to-dist": "copyfiles package.json dist/",
23
+ "postinstall": "if [ \"$BUILDING_IN_DOCKER\" != \"true\" ]; then preconstruct dev; fi",
24
+ "lint": "eslint .",
25
+ "lint:fix": "pnpm lint --fix",
26
+ "prepare:release": "sed -i 's/.*\"postinstall\":.*//' package.json",
27
+ "prepare:release:mac": "sed -i '' 's/.*\"postinstall\":.*//' package.json",
28
+ "prettier": "prettier 'src/' --check",
29
+ "prettier:fix": "prettier 'src/' --write",
30
+ "publish:public": "pnpm run prepare:release && publish --access=public --no-git-checks --registry https://registry.npmjs.org/",
31
+ "publish:public:mac": "pnpm run prepare:release:mac && publish --access=public --no-git-checks --registry https://registry.npmjs.org/",
32
+ "test": "vitest --config ./vitest.config.ts",
33
+ "type-check": "tsc --noEmit"
34
+ },
35
+ "eslintConfig": {
36
+ "extends": [
37
+ "@unblokttechnology/eslint-config/base"
38
+ ],
39
+ "root": true
40
+ },
41
+ "dependencies": {
42
+ "@nexeraid/api-client": "workspace:*",
43
+ "@nexeraid/identity-api-client": "workspace:*",
44
+ "@nexeraid/identity-schemas": "workspace:*",
45
+ "@nexeraid/logger": "workspace:*",
46
+ "pino": "^9.4.0",
47
+ "svix": "1.21.0",
48
+ "zod": "^3.23.8"
49
+ },
50
+ "devDependencies": {
51
+ "@unblokttechnology/eslint-config": "workspace:*",
52
+ "prettier": "^3.3.3",
53
+ "typescript": "^5.6.2"
54
+ },
55
+ "preconstruct": {
56
+ "entrypoints": [
57
+ "index.ts"
58
+ ]
59
+ }
60
+ }