@renterra/sdk 0.2.0 → 0.2.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 +31 -3
- package/dist/generated/contracts.d.ts +159 -6
- package/dist/generated/list-filters.d.ts +4519 -0
- package/dist/generated/list-filters.js +1 -0
- package/dist/generated/resources.d.ts +1310 -70
- package/dist/generated/resources.js +86 -13
- package/dist/generated/rest.d.ts +4862 -920
- package/dist/generated/schemas.js +644 -42
- package/dist/index.d.ts +2 -1
- package/dist/mcp.d.ts +12 -6
- package/dist/mcp.js +1 -0
- package/dist/rest.d.ts +7091 -327
- package/dist/rest.js +5 -1
- package/dist/runtime.d.ts +8052 -0
- package/dist/runtime.js +49 -0
- package/dist/transport.d.ts +7 -5
- package/dist/transport.js +18 -4
- package/package.json +22 -18
package/README.md
CHANGED
|
@@ -15,13 +15,13 @@ The SDK is a private, general-purpose Renterra client for first-party surfaces,
|
|
|
15
15
|
|
|
16
16
|
## Inside Renterra
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
On `app.getrenterra.com`, `staging.renterra.engineering`, and Renterra previews (`*-renterra.vercel.app`), the SDK automatically uses the host session on every route. Requests go to same-origin `/v1/app/...`, which web rewrites to the public API's `/v1/...` routes. No OAuth redirects, token endpoint calls, or client-side token storage occur. Local Renterra web development can explicitly pass `{ mode: "session" }`. Explicit `{ mode: "oauth" }` overrides host detection.
|
|
19
19
|
|
|
20
20
|
Web requires `RENTERRA_API_ORIGIN` pointing to its matching API deployment. API requires `RENTERRA_OAUTH_ISSUER_ORIGIN` pointing to the web deployment that owns the session. API validates sessions without refreshing them and checks current membership and permissions on each request. Session writes require the configured issuer origin or an approved Renterra app/preview origin. Unrecognized origins and missing origins are rejected for session writes.
|
|
21
21
|
|
|
22
22
|
## Standalone development
|
|
23
23
|
|
|
24
|
-
Outside
|
|
24
|
+
Outside those Renterra hosts, including localhost, the SDK uses `https://api.getrenterra.com` and web's OAuth authorization-code flow with PKCE. The first API call redirects to Renterra for sign-in, organization selection, and consent. Reload the same app on the callback; the next API call completes authorization. The SDK validates state, exchanges the code, and refreshes expiring credentials. Browser credentials are omitted from public API and OAuth requests.
|
|
25
25
|
|
|
26
26
|
OAuth state, verifier, and tokens are scoped to the issuer/resource in `sessionStorage`, not shared across tabs. Use `renterra.signOut()` to clear this app's local authorization; this does not sign out of Renterra or revoke the server grant.
|
|
27
27
|
|
|
@@ -72,4 +72,32 @@ Replace `@renterra/artifacts` with `@renterra/sdk` and `connectArtifacts()` with
|
|
|
72
72
|
|
|
73
73
|
The default export surface now uses REST, not MCP. Remove `url`, `authProvider`, `tokenEndpoint`, and `authorizationCode` options. OAuth is handled by the standalone adapter; host sessions require no token provider. Replace `search` with `list`, `inventoryItems` with `inventory.items`, `inventoryOnOrders` with `inventory.orders`, and `orders.listContracts(id)` with `orders.contracts.list(id)`. Root SDK clients do not expose `api`, `close`, or the MCP debug controller. The legacy MCP transport remains available through `@renterra/sdk/mcp`. The MCP server, hosted session-token endpoint, and token validation are unchanged.
|
|
74
74
|
|
|
75
|
-
SDK resource methods and types
|
|
75
|
+
SDK resource methods and types come from the API `1.0.0` contract, including draft operations, rather than the MCP tool list. Contract generation stays beside the authoritative API/MCP code in `renterra/code`. Pushes to its `production` branch automatically publish the private GitHub Packages package `@renterra/sdk-contracts`. A maintainer then manually runs this repo's contract-update workflow with an exact `1.0.0-code-<source-sha>` version. It verifies/tests the package and opens a PR updating `contracts.lock.json`. There is no scheduled SDK update, cross-repo dispatch, automatic merge, or automatic SDK publication.
|
|
76
|
+
|
|
77
|
+
## Independent builds
|
|
78
|
+
|
|
79
|
+
The SDK has no internal workspace dependencies, including in tests or build tooling. No internal app or package depends on it. CI reads private contract packages using its own `GITHUB_TOKEN` with `packages:read`, after package Actions read access is granted to `renterra/sdk`. Local downloads use package-read credentials from `NODE_AUTH_TOKEN`, `GH_TOKEN`, or authenticated `gh`. No automation PAT is stored in either repository. Build/test/typecheck/runtime packaging verify the exact pinned package and install its self-contained TypeScript inputs into ignored `src/generated/`; a verified cache supports offline builds. Neither API source nor database packages are installed. Published SDK consumers need no contract downloads. The original release-asset pin remains supported read-only as a bootstrap until the first manual package update.
|
|
80
|
+
|
|
81
|
+
```sh
|
|
82
|
+
pnpm install --frozen-lockfile
|
|
83
|
+
pnpm build
|
|
84
|
+
pnpm typecheck
|
|
85
|
+
pnpm test
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The optional hosted-runtime distribution is packaged here after generation. It bundles declarations and JavaScript directly from the same source; no previous build is needed:
|
|
89
|
+
|
|
90
|
+
```sh
|
|
91
|
+
RENTERRA_AI_API_ORIGIN=https://<matching-api> pnpm runtime:bundle
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
This writes `runtime-sdk/renterra-sdk.tgz`, outside the standard client's `dist` pack tree. It is a self-contained distribution of the real SDK with hosted authentication/proxy defaults and bundled public types. Internal apps reference the uploaded archive's file ID, without importing or building the SDK. Packaging does not upload, publish, or deploy anything.
|
|
95
|
+
|
|
96
|
+
## Manual contract updates
|
|
97
|
+
|
|
98
|
+
1. Choose a contract version automatically published by **Build SDK contract package** after a push to `renterra/code`'s `production` branch. Only production pushes publish; pull requests and manual runs only verify/build artifacts. Publication uses `code`'s built-in `GITHUB_TOKEN` and publishes generated TypeScript contract inputs, not the npm SDK.
|
|
99
|
+
2. After the first publication, keep `@renterra/sdk-contracts` private and grant `renterra/sdk` read access under its **Manage Actions access** setting. This lets SDK workflows use their own `GITHUB_TOKEN`; no PAT, deploy key, or App private key is needed.
|
|
100
|
+
3. Manually run **Update API contracts** in this repo with the exact published version. The workflow downloads it with scripts disabled, verifies source/version and per-file checksums, runs SDK checks, and opens a reviewable pin-update PR. The local equivalent is `pnpm contracts:update 1.0.0-code-<source-sha>` followed by normal SDK verification.
|
|
101
|
+
4. Review and merge the update PR. Publish `@renterra/sdk` to npm separately through the approved manual release workflow when wanted.
|
|
102
|
+
|
|
103
|
+
Enable GitHub Actions to create PRs in this repository for the manually requested update workflow. If unavailable, maintainers can commit a locally verified lock update instead. `contracts.lock.json` pins source/version and SHA-256; normal builds never select a newer version. The initial bootstrap release asset remains available, but no workflow publishes new release assets or dispatches cross-repo events.
|
|
@@ -1,4 +1,151 @@
|
|
|
1
1
|
export interface McpContracts {
|
|
2
|
+
list_members: {
|
|
3
|
+
input: {
|
|
4
|
+
page?: number;
|
|
5
|
+
page_size?: number;
|
|
6
|
+
is_driver?: "true" | "false";
|
|
7
|
+
is_maintenance_staff?: "true" | "false";
|
|
8
|
+
};
|
|
9
|
+
output: {
|
|
10
|
+
data: {
|
|
11
|
+
id: string;
|
|
12
|
+
first_name: string | null;
|
|
13
|
+
last_name: string | null;
|
|
14
|
+
branch_id: string | null;
|
|
15
|
+
is_driver: boolean;
|
|
16
|
+
is_maintenance_staff: boolean;
|
|
17
|
+
[k: string]: unknown;
|
|
18
|
+
}[];
|
|
19
|
+
pagination: {
|
|
20
|
+
page: number;
|
|
21
|
+
page_size: number;
|
|
22
|
+
has_more: boolean;
|
|
23
|
+
[k: string]: unknown;
|
|
24
|
+
};
|
|
25
|
+
[k: string]: unknown;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
list_rental_intervals: {
|
|
29
|
+
input: {
|
|
30
|
+
page?: number;
|
|
31
|
+
page_size?: number;
|
|
32
|
+
};
|
|
33
|
+
output: {
|
|
34
|
+
data: {
|
|
35
|
+
id: string;
|
|
36
|
+
name: string;
|
|
37
|
+
/**
|
|
38
|
+
* Configured ISO 8601 rental duration, for example P1D or P1M. Calendar durations are not fixed hour counts.
|
|
39
|
+
*/
|
|
40
|
+
duration: string;
|
|
41
|
+
proration_duration: string | null;
|
|
42
|
+
proration_measurement_duration: string | null;
|
|
43
|
+
is_default: boolean;
|
|
44
|
+
is_storefront_enabled: boolean;
|
|
45
|
+
[k: string]: unknown;
|
|
46
|
+
}[];
|
|
47
|
+
pagination: {
|
|
48
|
+
page: number;
|
|
49
|
+
page_size: number;
|
|
50
|
+
has_more: boolean;
|
|
51
|
+
[k: string]: unknown;
|
|
52
|
+
};
|
|
53
|
+
[k: string]: unknown;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
list_special_rate_definitions: {
|
|
57
|
+
input: {
|
|
58
|
+
page?: number;
|
|
59
|
+
page_size?: number;
|
|
60
|
+
};
|
|
61
|
+
output: {
|
|
62
|
+
data: {
|
|
63
|
+
id: string;
|
|
64
|
+
name: string;
|
|
65
|
+
/**
|
|
66
|
+
* 0 = Sunday, 6 = Saturday; interpreted in the organization's timezone.
|
|
67
|
+
*/
|
|
68
|
+
day_of_week_start: number;
|
|
69
|
+
/**
|
|
70
|
+
* Local start time in HH:MM:SS format.
|
|
71
|
+
*/
|
|
72
|
+
time_of_day_start: string;
|
|
73
|
+
day_of_week_end: number;
|
|
74
|
+
/**
|
|
75
|
+
* Local end time in HH:MM:SS format.
|
|
76
|
+
*/
|
|
77
|
+
time_of_day_end: string;
|
|
78
|
+
order_priority: number;
|
|
79
|
+
is_default: boolean;
|
|
80
|
+
[k: string]: unknown;
|
|
81
|
+
}[];
|
|
82
|
+
pagination: {
|
|
83
|
+
page: number;
|
|
84
|
+
page_size: number;
|
|
85
|
+
has_more: boolean;
|
|
86
|
+
[k: string]: unknown;
|
|
87
|
+
};
|
|
88
|
+
[k: string]: unknown;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
submit_feedback: {
|
|
92
|
+
input: {
|
|
93
|
+
/**
|
|
94
|
+
* Feedback about Renterra or its MCP tools.
|
|
95
|
+
*/
|
|
96
|
+
message: string;
|
|
97
|
+
};
|
|
98
|
+
output: {
|
|
99
|
+
received: true;
|
|
100
|
+
[k: string]: unknown;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
list_inventory_categories: {
|
|
104
|
+
input: {
|
|
105
|
+
page?: number;
|
|
106
|
+
page_size?: number;
|
|
107
|
+
include_archived?: "true" | "false";
|
|
108
|
+
category?: string;
|
|
109
|
+
class?: string;
|
|
110
|
+
group?: string;
|
|
111
|
+
};
|
|
112
|
+
output: {
|
|
113
|
+
data: {
|
|
114
|
+
id: string;
|
|
115
|
+
category: string;
|
|
116
|
+
class: string;
|
|
117
|
+
group: string;
|
|
118
|
+
ara_code: number | null;
|
|
119
|
+
created_at: string;
|
|
120
|
+
updated_at: string;
|
|
121
|
+
archived_at: string | null;
|
|
122
|
+
[k: string]: unknown;
|
|
123
|
+
}[];
|
|
124
|
+
pagination: {
|
|
125
|
+
page: number;
|
|
126
|
+
page_size: number;
|
|
127
|
+
has_more: boolean;
|
|
128
|
+
[k: string]: unknown;
|
|
129
|
+
};
|
|
130
|
+
[k: string]: unknown;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
get_inventory_category: {
|
|
134
|
+
input: {
|
|
135
|
+
id: string;
|
|
136
|
+
};
|
|
137
|
+
output: {
|
|
138
|
+
id: string;
|
|
139
|
+
category: string;
|
|
140
|
+
class: string;
|
|
141
|
+
group: string;
|
|
142
|
+
ara_code: number | null;
|
|
143
|
+
created_at: string;
|
|
144
|
+
updated_at: string;
|
|
145
|
+
archived_at: string | null;
|
|
146
|
+
[k: string]: unknown;
|
|
147
|
+
};
|
|
148
|
+
};
|
|
2
149
|
search_customers: {
|
|
3
150
|
input: {
|
|
4
151
|
page?: number;
|
|
@@ -134,9 +281,12 @@ export interface McpContracts {
|
|
|
134
281
|
branch_id: string;
|
|
135
282
|
start_time: string;
|
|
136
283
|
end_time: string | null;
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
284
|
+
metadata: {
|
|
285
|
+
po_number: string | null;
|
|
286
|
+
job_number: string | null;
|
|
287
|
+
job_description: string | null;
|
|
288
|
+
[k: string]: unknown;
|
|
289
|
+
};
|
|
140
290
|
/**
|
|
141
291
|
* Creation time of the most recent signed contract, or null when none exists.
|
|
142
292
|
*/
|
|
@@ -195,9 +345,12 @@ export interface McpContracts {
|
|
|
195
345
|
branch_id: string;
|
|
196
346
|
start_time: string;
|
|
197
347
|
end_time: string | null;
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
348
|
+
metadata: {
|
|
349
|
+
po_number: string | null;
|
|
350
|
+
job_number: string | null;
|
|
351
|
+
job_description: string | null;
|
|
352
|
+
[k: string]: unknown;
|
|
353
|
+
};
|
|
201
354
|
/**
|
|
202
355
|
* Creation time of the most recent signed contract, or null when none exists.
|
|
203
356
|
*/
|