lh-api-client 0.0.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.
Files changed (49) hide show
  1. package/dist/api-keys/index.d.ts +37 -0
  2. package/dist/api-keys/index.js +23 -0
  3. package/dist/api-keys/index.js.map +1 -0
  4. package/dist/audit/index.d.ts +47 -0
  5. package/dist/audit/index.js +27 -0
  6. package/dist/audit/index.js.map +1 -0
  7. package/dist/cache-coverage/index.d.ts +24 -0
  8. package/dist/cache-coverage/index.js +9 -0
  9. package/dist/cache-coverage/index.js.map +1 -0
  10. package/dist/client.d.ts +25 -0
  11. package/dist/client.js +68 -0
  12. package/dist/client.js.map +1 -0
  13. package/dist/index.d.ts +29 -0
  14. package/dist/index.js +53 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/member/index.d.ts +49 -0
  17. package/dist/member/index.js +38 -0
  18. package/dist/member/index.js.map +1 -0
  19. package/dist/models/index.d.ts +7 -0
  20. package/dist/models/index.js +15 -0
  21. package/dist/models/index.js.map +1 -0
  22. package/dist/org-usage/index.d.ts +47 -0
  23. package/dist/org-usage/index.js +7 -0
  24. package/dist/org-usage/index.js.map +1 -0
  25. package/dist/orgs/index.d.ts +113 -0
  26. package/dist/orgs/index.js +65 -0
  27. package/dist/orgs/index.js.map +1 -0
  28. package/dist/phase2/index.d.ts +46 -0
  29. package/dist/phase2/index.js +120 -0
  30. package/dist/phase2/index.js.map +1 -0
  31. package/dist/plan/index.d.ts +52 -0
  32. package/dist/plan/index.js +41 -0
  33. package/dist/plan/index.js.map +1 -0
  34. package/dist/platform-token/index.d.ts +37 -0
  35. package/dist/platform-token/index.js +22 -0
  36. package/dist/platform-token/index.js.map +1 -0
  37. package/dist/price-book/index.d.ts +17 -0
  38. package/dist/price-book/index.js +10 -0
  39. package/dist/price-book/index.js.map +1 -0
  40. package/dist/statement/index.d.ts +38 -0
  41. package/dist/statement/index.js +10 -0
  42. package/dist/statement/index.js.map +1 -0
  43. package/dist/subscription/index.d.ts +45 -0
  44. package/dist/subscription/index.js +30 -0
  45. package/dist/subscription/index.js.map +1 -0
  46. package/dist/topup/index.d.ts +37 -0
  47. package/dist/topup/index.js +19 -0
  48. package/dist/topup/index.js.map +1 -0
  49. package/package.json +27 -0
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.extendContract = extendContract;
4
+ exports.addSubscription = addSubscription;
5
+ /**
6
+ * US-8 (#29): extend a subscription's contract commitment (renewal). Per
7
+ * subscription (an org holds many — ADR-014). Only `commitmentEnd` moves;
8
+ * tier/quota changes go through re-subscribe (cancel + add).
9
+ */
10
+ async function extendContract(client, orgId, subId, args) {
11
+ return client.request(`/platform/orgs/${encodeURIComponent(orgId)}/subscriptions/${encodeURIComponent(subId)}/contract`, { method: 'PATCH', body: { commitmentEnd: args.commitmentEnd, memo: args.memo } });
12
+ }
13
+ /**
14
+ * Add an additional (paid) subscription to an already-existing org — operator
15
+ * change-order motion (#83, ADR-014: an org holds many subs). Mirrors
16
+ * `POST /platform/orgs/:orgId/subscriptions`. Token must carry `write:orgs`.
17
+ */
18
+ async function addSubscription(client, orgId, args) {
19
+ return client.request(`/platform/orgs/${encodeURIComponent(orgId)}/subscriptions`, {
20
+ method: 'POST',
21
+ body: {
22
+ planId: args.planId,
23
+ maxKeys: args.maxKeys,
24
+ contractStart: args.contractStart,
25
+ commitmentEnd: args.commitmentEnd,
26
+ priceBookVersion: args.priceBookVersion,
27
+ },
28
+ });
29
+ }
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/subscription/index.ts"],"names":[],"mappings":";;AA0BA,wCAYC;AAuBD,0CAkBC;AA1DD;;;;GAIG;AACI,KAAK,UAAU,cAAc,CAClC,MAAc,EACd,KAAa,EACb,KAAa,EACb,IAAwB;IAExB,OAAO,MAAM,CAAC,OAAO,CACnB,kBAAkB,kBAAkB,CAAC,KAAK,CAAC,kBAAkB,kBAAkB,CAC7E,KAAK,CACN,WAAW,EACZ,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,CAClF,CAAC;AACJ,CAAC;AAkBD;;;;GAIG;AACI,KAAK,UAAU,eAAe,CACnC,MAAc,EACd,KAAa,EACb,IAAyB;IAEzB,OAAO,MAAM,CAAC,OAAO,CACnB,kBAAkB,kBAAkB,CAAC,KAAK,CAAC,gBAAgB,EAC3D;QACE,MAAM,EAAE,MAAM;QACd,IAAI,EAAE;YACJ,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;SACxC;KACF,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { Client } from '../client';
2
+ /**
3
+ * Body for `POST /platform/topups/execute` (ExecuteTopupDto, #28 Smoke-A
4
+ * subset). Single-shot deposit: credits an org's balance and writes the audit +
5
+ * DEPOSIT log atomically. `amountUsd` must be positive (negative adjustments
6
+ * belong to a separate path). Requires the `write:billing` scope on the token.
7
+ */
8
+ export interface ExecuteTopupArgs {
9
+ orgId: string;
10
+ /** Positive USD amount (≥ 0.01). */
11
+ amountUsd: number;
12
+ memo?: string;
13
+ }
14
+ /**
15
+ * Result of a topup. Mirrors `OrganizationService.topup` — the updated org plus
16
+ * the created DEPOSIT balance log. Additive fields are pass-through.
17
+ */
18
+ export interface TopupResult {
19
+ organization: {
20
+ id: string;
21
+ balance: string;
22
+ [k: string]: unknown;
23
+ };
24
+ balanceLog: {
25
+ id: string;
26
+ type: 'DEPOSIT';
27
+ amount: string;
28
+ [k: string]: unknown;
29
+ };
30
+ [k: string]: unknown;
31
+ }
32
+ /**
33
+ * Execute a single-shot balance topup for a customer org (operator action,
34
+ * money movement). Mirrors `POST /platform/topups/execute`. Token must carry
35
+ * `write:billing`.
36
+ */
37
+ export declare function executeTopup(client: Client, args: ExecuteTopupArgs): Promise<TopupResult>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.executeTopup = executeTopup;
4
+ /**
5
+ * Execute a single-shot balance topup for a customer org (operator action,
6
+ * money movement). Mirrors `POST /platform/topups/execute`. Token must carry
7
+ * `write:billing`.
8
+ */
9
+ async function executeTopup(client, args) {
10
+ return client.request('/platform/topups/execute', {
11
+ method: 'POST',
12
+ body: {
13
+ orgId: args.orgId,
14
+ amountUsd: args.amountUsd,
15
+ memo: args.memo,
16
+ },
17
+ });
18
+ }
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/topup/index.ts"],"names":[],"mappings":";;AAuCA,oCAYC;AAjBD;;;;GAIG;AACI,KAAK,UAAU,YAAY,CAChC,MAAc,EACd,IAAsB;IAEtB,OAAO,MAAM,CAAC,OAAO,CAAc,0BAA0B,EAAE;QAC7D,MAAM,EAAE,MAAM;QACd,IAAI,EAAE;YACJ,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB;KACF,CAAC,CAAC;AACL,CAAC"}
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "lh-api-client",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "description": "Shared HTTP client + types + pure-logic helpers for talking to LH Enterprise backend. Consumed by lh-ops (CLI) and lh-ops-skill (MCP).",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "scripts": {
12
+ "build": "tsc",
13
+ "test": "jest",
14
+ "lint": "eslint 'src/**/*.ts'",
15
+ "clean": "rm -rf dist"
16
+ },
17
+ "devDependencies": {
18
+ "@types/jest": "^29.5.13",
19
+ "@types/node": "^22.10.0",
20
+ "jest": "^29.7.0",
21
+ "ts-jest": "^29.2.5",
22
+ "typescript": "^5.7.2"
23
+ },
24
+ "engines": {
25
+ "node": ">=18"
26
+ }
27
+ }