@highnote-oss/nodejs-sdk 0.1.0-alpha.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/LICENSE +21 -0
- package/README.md +182 -0
- package/dist/index.cjs +6587 -0
- package/dist/index.d.cts +21310 -0
- package/dist/index.d.ts +21310 -0
- package/dist/index.js +6524 -0
- package/package.json +74 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Highnote
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# @highnote-oss/nodejs-sdk
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@highnote-oss/nodejs-sdk)
|
|
4
|
+
[](https://github.com/highnote-oss/nodejs-sdk/actions/workflows/ci.yml)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
TypeScript server SDK for the [Highnote](https://highnote.com) GraphQL API. Resource-oriented — no GraphQL knowledge required.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @highnote-oss/nodejs-sdk
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import {
|
|
19
|
+
Highnote,
|
|
20
|
+
PaymentCardClientTokenPermission,
|
|
21
|
+
PhoneLabel,
|
|
22
|
+
} from "@highnote-oss/nodejs-sdk";
|
|
23
|
+
|
|
24
|
+
const client = new Highnote({
|
|
25
|
+
apiKey: "sk_test_...",
|
|
26
|
+
environment: "test", // "test" | "live"
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// Create an account holder
|
|
30
|
+
const holder = await client.accountHolders.createUSPerson({
|
|
31
|
+
personAccountHolder: {
|
|
32
|
+
name: { givenName: "Jane", familyName: "Doe" },
|
|
33
|
+
dateOfBirth: "1990-01-15",
|
|
34
|
+
email: "jane@example.com",
|
|
35
|
+
billingAddress: {
|
|
36
|
+
streetAddress: "123 Main St",
|
|
37
|
+
locality: "San Francisco",
|
|
38
|
+
region: "CA",
|
|
39
|
+
postalCode: "94105",
|
|
40
|
+
countryCodeAlpha3: "USA",
|
|
41
|
+
},
|
|
42
|
+
phoneNumber: {
|
|
43
|
+
countryCode: "1",
|
|
44
|
+
number: "5551234567",
|
|
45
|
+
label: PhoneLabel.MOBILE,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Issue a card
|
|
51
|
+
const card = await client.cards.issue({
|
|
52
|
+
financialAccountId: "fa_...",
|
|
53
|
+
options: { activateOnCreate: true, expirationDate: "2028-12-31T00:00:00Z" },
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// Generate a client token for the frontend card viewer
|
|
57
|
+
const token = await client.clientTokens.createForPaymentCard({
|
|
58
|
+
paymentCardId: card.id,
|
|
59
|
+
permissions: [PaymentCardClientTokenPermission.READ_RESTRICTED_DETAILS],
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// List card products (auto-paginated)
|
|
63
|
+
for await (const product of client.cardProducts.list()) {
|
|
64
|
+
console.log(product.name);
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Resources
|
|
69
|
+
|
|
70
|
+
<!-- resources:start -->
|
|
71
|
+
| Resource | Methods | Status |
|
|
72
|
+
|----------|---------|--------|
|
|
73
|
+
| `accountHolders` | `createUSPerson()`, `get()`, `listBusinesses()`, `listPersons()`, `searchBusinesses()`, `searchPersons()` | Available |
|
|
74
|
+
| `ach` | `cancelTransfer()`, `createOneTimeTransfer()`, `createRecurringTransfer()`, `initiateTransfer()` | Available |
|
|
75
|
+
| `addresses` | `validate()` | Available |
|
|
76
|
+
| `applications` | `create()`, `get()` | Available |
|
|
77
|
+
| `cardProducts` | `get()`, `list()` | Available |
|
|
78
|
+
| `cards` | `activate()`, `cancelPhysicalOrder()`, `close()`, `findATMLocations()`, `get()`, `issue()`, `orderPhysical()`, `orderPhysicalWithValidatedAddress()`, `reissue()`, `suspend()` | Available |
|
|
79
|
+
| `clientTokens` | `createForDocumentUpload()`, `createForPaymentCard()`, `createForTokenization()` | Available |
|
|
80
|
+
| `collaborativeAuth` | `activateEndpoint()`, `addEndpoint()`, `deactivateEndpoint()` | Available |
|
|
81
|
+
| `digitalWallets` | `addToApplePay()`, `addToGooglePay()` | Available |
|
|
82
|
+
| `disputes` | `get()`, `initiate()` | Available |
|
|
83
|
+
| `documents` | `createUploadLink()`, `endSession()`, `startSession()` | Available |
|
|
84
|
+
| `externalAccounts` | `addNonVerified()`, `addVerifiedThroughFinicity()`, `addVerifiedThroughPlaid()` | Available |
|
|
85
|
+
| `financialAccounts` | `get()`, `issue()`, `listActivities()`, `listReviewWorkflowEvents()`, `suspend()`, `unsuspend()` | Available |
|
|
86
|
+
| `provisioning` | `create()` | Available |
|
|
87
|
+
| `spendRules` | `attachToCard()`, `createAmountLimit()`, `createMerchantCategory()`, `detachFromCard()` | Available |
|
|
88
|
+
| `transactions` | `list()` | Available |
|
|
89
|
+
| `transfers` | `initiateBetweenAccounts()` | Available |
|
|
90
|
+
| `webhooks` | `activate()`, `add()`, `addSubscriptions()`, `deactivate()`, `get()`, `list()`, `listEvents()`, `remove()`, `removeEmail()`, `removeSubscriptions()`, `rename()`, `replay()`, `rotateSigningKey()`, `setEmail()` | Available |
|
|
91
|
+
<!-- resources:end -->
|
|
92
|
+
|
|
93
|
+
## Configuration
|
|
94
|
+
|
|
95
|
+
| Option | Type | Default | Description |
|
|
96
|
+
|--------|------|---------|-------------|
|
|
97
|
+
| `apiKey` | `string` | *required* | Highnote API key (`sk_test_...` or `sk_live_...`) |
|
|
98
|
+
| `environment` | `"test" \| "live"` | `"test"` | API environment |
|
|
99
|
+
| `baseUrl` | `string` | — | Override API URL (for proxies/mocking) |
|
|
100
|
+
| `defaultPageSize` | `number` | `20` | Items per page for paginated queries |
|
|
101
|
+
|
|
102
|
+
## Exported Enums
|
|
103
|
+
|
|
104
|
+
The SDK exports enums for properly typing inputs — no `as any` needed:
|
|
105
|
+
|
|
106
|
+
| Enum | Used For |
|
|
107
|
+
|------|----------|
|
|
108
|
+
| `PhoneLabel` | Account holder phone numbers (`MOBILE`, `HOME`, `WORK`, `SUPPORT`) |
|
|
109
|
+
| `PaymentCardClientTokenPermission` | Client token permissions (`READ_RESTRICTED_DETAILS`, `SET_PAYMENT_CARD_PIN`, etc.) |
|
|
110
|
+
| `GeneratePaymentMethodTokenizationClientTokenPermission` | Tokenization permissions |
|
|
111
|
+
| `PaymentCardStatus` | Card status (`ACTIVE`, `SUSPENDED`, `CLOSED`, `ACTIVATION_REQUIRED`) |
|
|
112
|
+
| `PaymentCardOrderStatus` | Physical card order status (`NEW`, `APPROVED`, `SHIPPED`, `CANCELED`, etc.) |
|
|
113
|
+
| `CardFormFactor` | Card form factor (`PHYSICAL`, `VIRTUAL`) |
|
|
114
|
+
| `FinancialAccountStatus` | Account status (`ACTIVE`, `SUSPENDED`, `CLOSED`, `PENDING_CLOSURE`) |
|
|
115
|
+
| `FinancialAccountSuspensionReasonInput` | Suspension reason (`ACCOUNT_HOLDER_REQUEST`, `SUSPECTED_FRAUD`, etc.) |
|
|
116
|
+
| `AccountHolderApplicationStatusCode` | Application status (`APPROVED`, `DENIED`, `IN_REVIEW`, `PENDING`, `CLOSED`) |
|
|
117
|
+
| `PaymentTransactionStatus` | Transaction status (`AUTHORIZED`, `CAPTURED`, etc.) |
|
|
118
|
+
| `TransferPurpose` | Transfer purpose (`GENERAL`, `LOAN_ADVANCE`, `REFUND_OR_REVERSAL`, etc.) |
|
|
119
|
+
| `InterFinancialAccountTransferStatus` | Transfer status |
|
|
120
|
+
| `NotificationEventName` | Webhook event subscriptions (50+ events) |
|
|
121
|
+
| `NotificationTargetStatus` | Webhook target status (`ACTIVE`, `PENDING_VERIFICATION`, `DEACTIVATED`) |
|
|
122
|
+
| `DocumentType` | Document upload type (`DRIVERS_LICENSE`, `BANK_STATEMENT`, etc.) |
|
|
123
|
+
| `DocumentUploadSessionStatusCode` | Upload session status (`CREATED`, `INITIATED`, `SUBMITTED`, etc.) |
|
|
124
|
+
| `PaymentCardDigitalWalletDeviceType` | Device type for wallet provisioning (`MOBILE`, `TABLET`, `WATCH`) |
|
|
125
|
+
| `CollaborativeAuthorizationEndpointStatus` | Auth endpoint status (`ACTIVE`, `PENDING_VERIFICATION`, `DEACTIVATED`) |
|
|
126
|
+
| `PaymentCardDisputeStatus` | Dispute status (`INITIATED`, `IN_PROGRESS`, `WON`, `LOST`, etc.) |
|
|
127
|
+
| `PaymentCardDisputeCategoryType` | Dispute category (`FRAUD`, `CUSTOMER_DISPUTE`, `AUTHORIZATION`, `PROCESSING_ERROR`) |
|
|
128
|
+
| `PaymentCardDisputeCustomerClaimType` | Customer claim type (`VERBAL`, `WRITTEN`) |
|
|
129
|
+
| `PaymentCardChargebackStatus` | Chargeback status (`SUBMITTED`, `RECEIVED`, `WON`, `LOST`, etc.) |
|
|
130
|
+
| `BankAccountType` | External bank account type (`CHECKING`, `SAVINGS`) |
|
|
131
|
+
| `AchTransferPurpose` | ACH transfer purpose (`DEPOSIT`, `WITHDRAWAL`, `PAYROLL`, etc.) |
|
|
132
|
+
|
|
133
|
+
## Error Handling
|
|
134
|
+
|
|
135
|
+
The SDK throws typed exceptions when the API returns error union members:
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
import {
|
|
139
|
+
HighnoteUserError,
|
|
140
|
+
HighnoteAccessDeniedError,
|
|
141
|
+
} from "@highnote-oss/nodejs-sdk";
|
|
142
|
+
|
|
143
|
+
try {
|
|
144
|
+
await client.cardProducts.get("invalid_id");
|
|
145
|
+
} catch (err) {
|
|
146
|
+
if (err instanceof HighnoteUserError) {
|
|
147
|
+
// fieldErrors: Array<{ code?: string, description?: string }>
|
|
148
|
+
console.error("Validation errors:", err.fieldErrors);
|
|
149
|
+
} else if (err instanceof HighnoteAccessDeniedError) {
|
|
150
|
+
console.error("Permission denied:", err.message);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Pagination
|
|
156
|
+
|
|
157
|
+
All `.list()` methods return async iterables with lazy page fetching:
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
// Iterate all items (fetches pages on demand)
|
|
161
|
+
for await (const product of client.cardProducts.list()) {
|
|
162
|
+
console.log(product.name);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Custom page size
|
|
166
|
+
for await (const product of client.cardProducts.list({ pageSize: 10 })) {
|
|
167
|
+
// ...
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Break early — no extra pages fetched
|
|
171
|
+
for await (const product of client.cardProducts.list()) {
|
|
172
|
+
if (product.name === "Target") break;
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Contributing
|
|
177
|
+
|
|
178
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for setup, development workflow, and how to add new resources.
|
|
179
|
+
|
|
180
|
+
## License
|
|
181
|
+
|
|
182
|
+
MIT
|