Skip to content

Commit a0e1fc1

Browse files
committed
Add integration transport tooling and table defaults
1 parent 0073e2c commit a0e1fc1

145 files changed

Lines changed: 40090 additions & 46 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,22 @@ daptin-cli describe action document createDocument
246246

247247
Shows whether the action is instance-bound, whether `--reference-id` is required, the action's InFields, and an example `execute` command.
248248

249+
## Table Defaults
250+
251+
Use `table defaults` to inspect and update schema-level defaults before creating
252+
rows in setup scripts:
253+
254+
```bash
255+
daptin-cli table defaults get oauth_connect
256+
daptin-cli table defaults set oauth_connect --permission 1618275
257+
daptin-cli table defaults group add oauth_connect users --permission 1618275
258+
daptin-cli table defaults ensure oauth_connect --permission 1618275 --group users:1618275
259+
```
260+
261+
These commands update the table's `world_schema_json`; restart Daptin or run the
262+
supported reload flow before relying on changed defaults in a long-running
263+
server process.
264+
249265
## OAuth And Integrations
250266

251267
OAuth provider setup and OpenAPI integration workflows have first-class wrappers. The generic `create`, `list`, `describe action`, and `execute` commands still work, but these commands keep the common lifecycle discoverable and avoid passing large specs as shell arguments.
@@ -269,6 +285,8 @@ daptin-cli oauth tokens list --provider asana.com
269285
Import large OpenAPI specs from files, URLs, or stdin:
270286

271287
```bash
288+
daptin-cli integration validate-spec --spec-file ./provider.yaml
289+
272290
daptin-cli integration import \
273291
--provider asana.com \
274292
--spec-file ./asana_oas.yaml \
@@ -279,11 +297,46 @@ daptin-cli integration import \
279297
daptin-cli integration install asana.com
280298
```
281299

300+
Transport extensions can be patched during import for generated facade specs:
301+
302+
```bash
303+
daptin-cli integration import \
304+
--provider linear.app \
305+
--spec-file ./linear-openapi.yaml \
306+
--auth custom_credentials \
307+
--auth-spec-file ./linear-auth.json \
308+
--set-operation-transport listIssues=graphql \
309+
--set-operation-upstream-path listIssues=/graphql \
310+
--set-graphql-document-file listIssues=./list_issues.graphql \
311+
--set-graphql-operation-name listIssues=ListIssues \
312+
--validate
313+
```
314+
315+
For gRPC services without reflection, embed a descriptor set during import:
316+
317+
```bash
318+
daptin-cli integration import \
319+
--provider grpc.example \
320+
--spec-file ./grpc-facade.yaml \
321+
--auth custom_credentials \
322+
--auth-spec-file ./grpc-auth.json \
323+
--set-operation-transport Search=grpc \
324+
--set-grpc-service Search=grpc.testing.SearchService \
325+
--set-grpc-method Search=Search \
326+
--grpc-descriptor-set Search=./search.protoset \
327+
--validate
328+
```
329+
330+
The CLI can also invoke `protoc` with `--grpc-proto Search=./proto/search.proto`
331+
and optional `--grpc-proto-path Search=./proto`; descriptor blobs are embedded
332+
in the imported spec but hidden from normal discovery output.
333+
282334
Discover installed operations through Daptin's scoped integration discovery endpoints:
283335

284336
```bash
285337
daptin-cli integration list
286338
daptin-cli integration operations asana.com
339+
daptin-cli integration operations asana.com --columns operation_id,method,path,transport
287340
daptin-cli integration describe asana.com getWorkspaces
288341
```
289342

@@ -297,6 +350,18 @@ daptin-cli integration execute asana.com getWorkspaces \
297350
daptin-cli integration execute example.com listUsers \
298351
--credential-id <credential_reference_id> \
299352
limit=10
353+
354+
daptin-cli integration execute linear.app listIssues \
355+
--credential-id <credential_reference_id> \
356+
--input-json '{"first":2,"after":"cursor"}'
357+
358+
daptin-cli integration execute realtime.example wsSearch \
359+
--credential-id <credential_reference_id> \
360+
query=tickets
361+
362+
daptin-cli integration execute grpc.example Search \
363+
--credential-id <credential_reference_id> \
364+
query=daptin
300365
```
301366

302367
`integration operations` and `integration describe` require Daptin versions with scoped discovery endpoints: `GET /integration/:provider/operations` and `GET /integration/:provider/operations/:operation`.
@@ -423,3 +488,21 @@ DAPTIN_CLI_CONFIG Config file path
423488
DAPTIN_ENDPOINT Server endpoint
424489
DAPTIN_CLI_OUTPUT Output format
425490
```
491+
492+
## E2E Tests
493+
494+
The regular Go test suite stays lightweight:
495+
496+
```bash
497+
go test ./...
498+
```
499+
500+
To run the real integration transport E2E, provide either `DAPTIN_BINARY` or a
501+
local Daptin source checkout via `DAPTIN_SOURCE_DIR` (defaults to `../daptin`):
502+
503+
```bash
504+
DAPTIN_SOURCE_DIR=../daptin ./scripts/integration-transport-e2e.sh
505+
```
506+
507+
This starts a fresh Daptin process, local REST/GraphQL/WebSocket/gRPC upstreams,
508+
and exercises the integration lifecycle using only `daptin-cli` commands.

cmd/app.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ func NewApp(cfg *config.Config, version string) *cli.App {
140140
storageCommand(appCtx),
141141
assetCommand(appCtx),
142142
permissionCommand(appCtx),
143+
tableCommand(appCtx),
143144
wsCommand(appCtx),
144145
},
145146
}

cmd/args.go

Lines changed: 64 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@ var knownCommands = map[string]bool{
99
"update": true, "delete": true, "related": true, "describe": true,
1010
"execute": true, "help": true, "relate": true, "unrelate": true,
1111
"permission": true, "storage": true, "asset": true, "oauth": true,
12-
"integration": true,
12+
"integration": true, "table": true,
1313
}
1414

1515
// Only commands that actually have subcommands, mapped to their subcommand names.
1616
var commandSubcommands = map[string]map[string]bool{
1717
"context": {"set": true, "add": true, "list": true},
1818
"describe": {"table": true, "action": true},
1919
"permission": {"decode": true, "encode": true},
20+
"table": {"defaults": true},
21+
"defaults": {"get": true, "set": true, "group": true, "ensure": true},
22+
"group": {"add": true},
2023
"storage": {
2124
"add": true, "list": true, "remove": true, "ls": true,
2225
"upload": true, "download": true, "mv": true, "rm": true, "mkdir": true,
@@ -26,55 +29,71 @@ var commandSubcommands = map[string]map[string]bool{
2629
"connect": {"create": true, "list": true},
2730
"tokens": {"list": true},
2831
"integration": {
29-
"import": true, "install": true, "list": true, "operations": true,
30-
"describe": true, "execute": true,
32+
"validate-spec": true, "import": true, "install": true, "list": true,
33+
"operations": true, "describe": true, "execute": true,
3134
},
3235
}
3336

3437
var valueFlags = map[string]bool{
3538
"--config": true, "-c": true,
3639
"--output": true, "-o": true,
37-
"--endpoint": true,
38-
"--columns": true,
39-
"--page-size": true,
40-
"--page": true,
41-
"--sort": true,
42-
"--filter": true,
43-
"--include": true,
44-
"--reference-id": true,
45-
"--type": true,
46-
"--provider": true,
47-
"--store-provider": true,
48-
"--access-key": true,
49-
"--secret-key": true,
50-
"--bucket": true,
51-
"--root-path": true,
52-
"--credential": true,
53-
"--param": true,
54-
"--spec-file": true,
55-
"--spec-url": true,
56-
"--spec-format": true,
57-
"--spec-language": true,
58-
"--auth": true,
59-
"--oauth-connect": true,
60-
"--auth-spec-json": true,
61-
"--auth-spec-file": true,
62-
"--oauth-token-id": true,
63-
"--credential-id": true,
64-
"--input-json": true,
65-
"--input-file": true,
66-
"--client-id": true,
67-
"--client-secret": true,
68-
"--client-secret-env": true,
69-
"--client-secret-file": true,
70-
"--scope": true,
71-
"--response-type": true,
72-
"--redirect-uri": true,
73-
"--auth-url": true,
74-
"--token-url": true,
75-
"--profile-url": true,
76-
"--profile-email-path": true,
77-
"--pkce-challenge-method": true,
40+
"--endpoint": true,
41+
"--columns": true,
42+
"--page-size": true,
43+
"--page": true,
44+
"--sort": true,
45+
"--filter": true,
46+
"--include": true,
47+
"--reference-id": true,
48+
"--type": true,
49+
"--provider": true,
50+
"--store-provider": true,
51+
"--access-key": true,
52+
"--secret-key": true,
53+
"--bucket": true,
54+
"--root-path": true,
55+
"--credential": true,
56+
"--param": true,
57+
"--spec-file": true,
58+
"--spec-url": true,
59+
"--spec-format": true,
60+
"--spec-language": true,
61+
"--auth": true,
62+
"--oauth-connect": true,
63+
"--auth-spec-json": true,
64+
"--auth-spec-file": true,
65+
"--set-operation-transport": true,
66+
"--set-operation-upstream-path": true,
67+
"--set-operation-timeout-ms": true,
68+
"--set-graphql-document": true,
69+
"--set-graphql-document-file": true,
70+
"--set-graphql-operation-name": true,
71+
"--set-websocket-message-template": true,
72+
"--set-websocket-response-selector": true,
73+
"--set-grpc-service": true,
74+
"--set-grpc-method": true,
75+
"--grpc-descriptor-set": true,
76+
"--grpc-proto": true,
77+
"--grpc-proto-path": true,
78+
"--protoc": true,
79+
"--oauth-token-id": true,
80+
"--credential-id": true,
81+
"--input-json": true,
82+
"--input-file": true,
83+
"--client-id": true,
84+
"--client-secret": true,
85+
"--client-secret-env": true,
86+
"--client-secret-file": true,
87+
"--scope": true,
88+
"--response-type": true,
89+
"--redirect-uri": true,
90+
"--auth-url": true,
91+
"--token-url": true,
92+
"--profile-url": true,
93+
"--profile-email-path": true,
94+
"--pkce-challenge-method": true,
95+
"--permission": true,
96+
"--group": true,
7897
}
7998

8099
var boolFlags = map[string]bool{
@@ -85,6 +104,7 @@ var boolFlags = map[string]bool{
85104
"--restart": true,
86105
"--recursive": true,
87106
"--spec-stdin": true,
107+
"--validate": true,
88108
"--disable": true,
89109
"--update": true,
90110
"--allow-login": true,

0 commit comments

Comments
 (0)