@happyvertical/accounting 0.101.0 → 0.101.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/README.md CHANGED
@@ -2,6 +2,42 @@
2
2
 
3
3
  Provider-neutral accounting synchronization with Stripe billing support.
4
4
 
5
+ ## QuickBooks connection OAuth
6
+
7
+ Use the public connection helper to generate an accounting authorization URL,
8
+ exchange Intuit's callback, and revoke a refresh token:
9
+
10
+ ```ts
11
+ import { createQuickBooksOAuthClient } from '@happyvertical/accounting';
12
+
13
+ const oauth = await createQuickBooksOAuthClient({
14
+ clientId: process.env.QBO_CLIENT_ID!,
15
+ clientSecret: process.env.QBO_CLIENT_SECRET!,
16
+ environment: 'sandbox',
17
+ redirectUri: 'https://app.example.com/api/accounting/quickbooks/callback',
18
+ });
19
+
20
+ const url = oauth.authorizationUrl({ state: oneUseOpaqueState });
21
+ const connection = await oauth.exchangeCallback({
22
+ callbackUrl: request.url,
23
+ expectedState: oneUseOpaqueState,
24
+ });
25
+ await oauth.revoke({ refreshToken: connection.tokens.refreshToken });
26
+ ```
27
+
28
+ The helper requests only Intuit's QuickBooks accounting scope. Before the
29
+ official client receives a callback, it requires the configured origin and
30
+ path, exactly one nonempty state, code, and realm ID, and a constant-time state
31
+ match. Returned failures have stable `QuickBooksOAuthError.code` values and do
32
+ not retain provider errors that may contain callback URLs or credentials.
33
+
34
+ The application owns one-use state bound to its authenticated principal,
35
+ tenant, and environment; authorization to connect the returned realm;
36
+ encrypted token storage; and atomic connection persistence. The helper does
37
+ not make those application decisions. The redirect URI must also be registered
38
+ in Intuit's developer portal. See Intuit's [OAuth client authorization-code flow](https://github.com/intuit/oauth-jsclient#authorization-code-flow)
39
+ and [revocation helper](https://github.com/intuit/oauth-jsclient#revoke-access_token).
40
+
5
41
  ## QuickBooks invoice creation and retries
6
42
 
7
43
  QuickBooks sales lines can carry explicit references to existing entities in the
@@ -1,4 +1,4 @@
1
- import { a as __toCommonJS, i as __require, n as __esmMin, r as __exportAll, t as __commonJSMin } from "./quickbooks-BJlHXQSw.js";
1
+ import { a as __toCommonJS, i as __require, n as __esmMin, r as __exportAll, t as __commonJSMin } from "./rolldown-runtime-D1cXj70v.js";
2
2
  //#region ../../node_modules/.pnpm/atob@2.1.2/node_modules/atob/browser-atob.js
3
3
  var require_browser_atob = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4
4
  (function(w) {
@@ -18261,4 +18261,4 @@ var require_OAuthClient = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18261
18261
  //#endregion
18262
18262
  export default require_OAuthClient();
18263
18263
 
18264
- //# sourceMappingURL=OAuthClient-BbD5jYu3.js.map
18264
+ //# sourceMappingURL=OAuthClient-x9rUYj0b.js.map