@lessly/sdk-app 0.3.0 → 0.4.0
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 +24 -14
- package/dist/client.gen-DH0z4Tfa.d.cts +1711 -0
- package/dist/client.gen-DH0z4Tfa.d.ts +1711 -0
- package/dist/deployment/index.cjs +531 -0
- package/dist/deployment/index.cjs.map +1 -0
- package/dist/deployment/index.d.cts +425 -0
- package/dist/deployment/index.d.ts +425 -0
- package/dist/deployment/index.js +425 -0
- package/dist/deployment/index.js.map +1 -0
- package/dist/index.cjs +1649 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1649 -0
- package/dist/index.js.map +1 -1
- package/dist/organization/index.d.cts +1 -1
- package/dist/organization/index.d.ts +1 -1
- package/dist/playground/index.d.cts +1 -1
- package/dist/playground/index.d.ts +1 -1
- package/docs/recipes/sdk-usage.md +24 -14
- package/package.json +8 -2
- package/src/gen/bindings.gen.ts +1649 -0
- package/src/gen/client.gen.ts +391 -0
- package/src/gen/deployment/index.ts +3 -0
- package/src/gen/deployment/queryOptions.gen.ts +681 -0
- package/src/gen/manifest.gen.ts +1 -1
- package/src/gen/types.gen.ts +838 -0
- package/dist/client.gen-DtgaSZYB.d.cts +0 -909
- package/dist/client.gen-DtgaSZYB.d.ts +0 -909
package/README.md
CHANGED
|
@@ -4,6 +4,8 @@ The Lessly SDK for App is a TypeScript SDK that provides runtime bindings and ty
|
|
|
4
4
|
|
|
5
5
|
**Note:** The `src/gen` directory contains generated SDK code and should not be edited by hand. Generated files are produced by running `npm run generate` with an API catalog.
|
|
6
6
|
|
|
7
|
+
The committed `src/gen` is a **convenience snapshot** — it lets the repo type-check, test, and build offline. It is **not** the source of truth: canonical generation happens **at publish time**, when Cloud Build regenerates `src/gen` from the live catalog before publishing. The catalog is **mid-migration**, so the committed snapshot's namespaces (currently `organization` and `playground`) will **grow as platform extensions migrate to `@lessly/tools`** — a namespace only appears once its tools carry a REST binding (tools without one are excluded until migrated). Regenerate the snapshot with `npx tsx scripts/generate.ts <catalog.json> src/gen && npm run sync-exports` against the live catalog (`https://api.lessly.dev/catalog/tools`).
|
|
8
|
+
|
|
7
9
|
## Usage
|
|
8
10
|
|
|
9
11
|
Create a client with `createLesslyApp`, then call operations through the Proxy namespace tree:
|
|
@@ -17,10 +19,13 @@ const sdk = createLesslyApp({
|
|
|
17
19
|
// getCsrfToken defaults to reading the `lessly_csrf` cookie; override for SSR/tests.
|
|
18
20
|
});
|
|
19
21
|
|
|
20
|
-
const
|
|
21
|
-
await sdk.
|
|
22
|
+
const connectors = await sdk.organization.connectors.list({ productId: 'prod_123' });
|
|
23
|
+
await sdk.organization.product.create({ name: 'Acme' });
|
|
22
24
|
```
|
|
23
25
|
|
|
26
|
+
The available namespaces track the live catalog and grow as platform extensions migrate; check
|
|
27
|
+
`package.json` `exports` (or `src/gen/manifest.gen.ts`) for what a given version exposes.
|
|
28
|
+
|
|
24
29
|
Errors are surfaced as a typed `LesslyApiError` (`status`, `code`, `body`).
|
|
25
30
|
|
|
26
31
|
### TanStack Query
|
|
@@ -34,14 +39,14 @@ explicitly:
|
|
|
34
39
|
// React example — works the same with any @tanstack/*-query adapter.
|
|
35
40
|
import { useQuery, useMutation } from '@tanstack/react-query';
|
|
36
41
|
import {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
} from '@lessly/sdk-app/
|
|
40
|
-
|
|
41
|
-
function
|
|
42
|
-
const { data } = useQuery(
|
|
43
|
-
const create = useMutation(
|
|
44
|
-
// create.mutate({
|
|
42
|
+
organizationConnectorsListQueryOptions,
|
|
43
|
+
organizationProductCreateMutationOptions,
|
|
44
|
+
} from '@lessly/sdk-app/organization';
|
|
45
|
+
|
|
46
|
+
function Connectors() {
|
|
47
|
+
const { data } = useQuery(organizationConnectorsListQueryOptions(sdk, { productId: 'prod_123' }));
|
|
48
|
+
const create = useMutation(organizationProductCreateMutationOptions(sdk));
|
|
49
|
+
// create.mutate({ name: 'Acme' })
|
|
45
50
|
}
|
|
46
51
|
```
|
|
47
52
|
|
|
@@ -116,10 +121,15 @@ MUST publish with an explicit override:
|
|
|
116
121
|
npm publish --registry https://registry.npmjs.org/
|
|
117
122
|
```
|
|
118
123
|
|
|
119
|
-
Base-version resolution (the `npm view
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
absent
|
|
124
|
+
Base-version resolution (the `npm view` lookups inside the pipeline CLI — both the per-channel
|
|
125
|
+
version and the package-wide max-version probe) follows the same rule, and in **two** steps:
|
|
126
|
+
it reads the registry from `package.json`'s `publishConfig.registry` first (falling back to the
|
|
127
|
+
`.npmrc` `@lessly:registry` value if absent), **and** passes that registry as an explicit CLI
|
|
128
|
+
scope override (`--@lessly:registry=<registry>`) on every `npm view`. The `--registry` flag alone
|
|
129
|
+
is not enough: because the package is scoped `@lessly`, the `.npmrc` `@lessly:registry=<GAR>` entry
|
|
130
|
+
would otherwise outrank it and silently resolve the lookup against GAR — which is exactly how an
|
|
131
|
+
early run read GAR's `0.1.x` line instead of the empty npmjs registry and skipped the `0.2.0`
|
|
132
|
+
floor. This requires no change to the CLI's `--channel`/`--catalog-url`/`--baseline` contract.
|
|
123
133
|
|
|
124
134
|
### Snapshot shape
|
|
125
135
|
|