@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
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@compilot/js-sdk",
3
+ "version": "2.0.40-dev",
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
+ "eslintConfig": {
21
+ "extends": [
22
+ "@unblokttechnology/eslint-config/base"
23
+ ],
24
+ "root": true
25
+ },
26
+ "dependencies": {
27
+ "pino": "^9.4.0",
28
+ "svix": "1.21.0",
29
+ "zod": "^3.23.8",
30
+ "@nexeraid/api-client": "1.10.2-dev",
31
+ "@nexeraid/identity-api-client": "1.3.215-dev",
32
+ "@nexeraid/identity-schemas": "1.12.38-dev",
33
+ "@nexeraid/logger": "0.1.2-dev"
34
+ },
35
+ "devDependencies": {
36
+ "prettier": "^3.3.3",
37
+ "typescript": "^5.6.2",
38
+ "@unblokttechnology/eslint-config": "0.1.1"
39
+ },
40
+ "preconstruct": {
41
+ "entrypoints": [
42
+ "index.ts"
43
+ ]
44
+ },
45
+ "scripts": {
46
+ "build": "preconstruct build && npm run copy-package-json-to-dist",
47
+ "copy-package-json-to-dist": "copyfiles package.json dist/",
48
+ "lint": "eslint .",
49
+ "lint:fix": "pnpm lint --fix",
50
+ "prepare:release": "sed -i 's/.*\"postinstall\":.*//' package.json",
51
+ "prepare:release:mac": "sed -i '' 's/.*\"postinstall\":.*//' package.json",
52
+ "prettier": "prettier 'src/' --check",
53
+ "prettier:fix": "prettier 'src/' --write",
54
+ "publish:public": "pnpm run prepare:release && publish --access=public --no-git-checks --registry https://registry.npmjs.org/",
55
+ "publish:public:mac": "pnpm run prepare:release:mac && publish --access=public --no-git-checks --registry https://registry.npmjs.org/",
56
+ "test": "vitest --config ./vitest.config.ts",
57
+ "type-check": "tsc --noEmit"
58
+ }
59
+ }
package/readme.md ADDED
@@ -0,0 +1,69 @@
1
+ # ComPilot JS SDK
2
+
3
+ - ComPilot JS SDK, use anywhere JS runs.
4
+
5
+ ## How to install
6
+
7
+ ```bash
8
+ npm install @compilot/js-sdk
9
+ ```
10
+
11
+ ### First steps
12
+
13
+ - Access your ComPilot Application's Settings > API page and get the API key.
14
+
15
+ ### How to use
16
+
17
+ ```javascript
18
+ /**
19
+ * Create an API client and authenticate with your API key
20
+ */
21
+ const apiClient = createApiClient({
22
+ apiKey: API_KEY,
23
+ });
24
+ ```
25
+
26
+ #### Self-provided authentication
27
+
28
+ If you already have your own authentication system, you can create a user session like so:
29
+
30
+ ```javascript
31
+ /*
32
+ * Get access token
33
+ * This has to be done from secured server, to avoid leaking API_KEY
34
+ */
35
+ const sessionRes = await apiClient.createSession({
36
+ /**
37
+ * The workflow id that this session will be bound to.
38
+ * You can find this id in compilot's dashboard.
39
+ */
40
+ workflowId: WORKFLOW_ID,
41
+ /**
42
+ * The unique identifier to associate this used to.
43
+ * This id is used to differenciate users on ComPilot and will be
44
+ * given back to you on every webhook we send.
45
+ */
46
+ externalUserId: "35194",
47
+ });
48
+ ```
49
+
50
+ Please find below an example endpoint using express:
51
+
52
+ ```javascript
53
+ const apiClient = createApiClient({
54
+ apiKey: API_KEY,
55
+ });
56
+
57
+ app.get('/my-compilot-auth', (req, res) => {
58
+ const userId = req.userId;
59
+ const authSession = await apiClient.createSession({
60
+ workflowId: WORKFLOW_ID,
61
+ externalUserId: userId,
62
+ });
63
+ res.json(authSession);
64
+ });
65
+ ```
66
+
67
+ #### Web3 auth
68
+
69
+ TODO