@zackbart/connecta 0.35.0 → 0.36.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.
Files changed (63) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +8 -4
  3. package/bin/version.mjs +1 -1
  4. package/dist/auth/downstream-oauth.js +71 -79
  5. package/dist/auth/static-oauth.js +104 -26
  6. package/dist/connectors/api-connector.d.ts +17 -0
  7. package/dist/connectors/api-connector.js +3 -1
  8. package/dist/http/client.js +1 -1
  9. package/dist/http/paging.js +1 -2
  10. package/dist/http/services.js +1 -1
  11. package/dist/http/tools.js +0 -4
  12. package/dist/operator-ui/contract.d.ts +1 -0
  13. package/dist/operator-ui/generated.js +4 -4
  14. package/dist/providers/_shared/google/kit.js +29 -139
  15. package/dist/providers/_shared/rest/kit.js +4 -404
  16. package/dist/providers/docs/tools.js +1 -2
  17. package/dist/providers/drive/api.js +1 -1
  18. package/dist/providers/forms/tools.js +1 -2
  19. package/dist/providers/gmail/tools.js +2 -2
  20. package/dist/providers/planning-center/lib/constants.d.ts +1 -1
  21. package/dist/providers/quickbooks/api.js +299 -0
  22. package/dist/providers/quickbooks/index.d.ts +13 -0
  23. package/dist/providers/quickbooks/index.js +93 -0
  24. package/dist/providers/quickbooks/lib/query.js +118 -0
  25. package/dist/providers/quickbooks/lib/writes.js +168 -0
  26. package/dist/providers/quickbooks/safety.js +222 -0
  27. package/dist/providers/quickbooks/skill.generated.js +5 -0
  28. package/dist/providers/quickbooks/tools.js +117 -0
  29. package/dist/providers/sheets/tools.js +1 -2
  30. package/dist/providers/slides/tools.js +2 -2
  31. package/dist/providers/vercel/index.js +1 -2
  32. package/dist/routes/oauth.js +3 -0
  33. package/dist/runtime/call.js +0 -4
  34. package/dist/skills.js +0 -1
  35. package/dist/types.d.ts +2 -0
  36. package/dist/ui.d.ts +1 -1
  37. package/dist/ui.js +0 -1
  38. package/dist/version.d.ts +1 -1
  39. package/dist/version.js +1 -1
  40. package/documentation/README.md +1 -0
  41. package/documentation/architecture.md +134 -301
  42. package/documentation/auth.md +47 -17
  43. package/documentation/integrating.md +1 -1
  44. package/documentation/meta-tools.md +1 -1
  45. package/documentation/operator-ui.md +16 -3
  46. package/documentation/providers.md +382 -0
  47. package/package.json +7 -8
  48. package/templates/node/package.json +1 -1
  49. package/dist/operator-ui/agents.d.ts +0 -75
  50. package/dist/operator-ui/agents.js +0 -114
  51. package/dist/operator-ui/config-summary.js +0 -566
  52. package/dist/operator-ui/connection-map.js +0 -378
  53. package/dist/operator-ui/endpoints.js +0 -212
  54. package/dist/operator-ui/fix-prompts.d.ts +0 -18
  55. package/dist/operator-ui/fix-prompts.js +0 -79
  56. package/dist/operator-ui/health.js +0 -52
  57. package/dist/operator-ui/member-page.js +0 -97
  58. package/dist/operator-ui/overview.js +0 -126
  59. package/dist/operator-ui/setup-commands.js +0 -47
  60. package/dist/operator-ui/view.d.ts +0 -378
  61. package/dist/operator-ui/view.js +0 -631
  62. package/dist/providers/_shared/rest/dispatch.js +0 -21
  63. package/dist/providers/_shared/rest/tools.js +0 -592
@@ -42,6 +42,10 @@ export interface ApiOAuthConfig {
42
42
  authorizationEndpoint: string;
43
43
  /** Where codes are exchanged and refresh tokens redeemed. Absolute https URL. */
44
44
  tokenEndpoint: string;
45
+ /** Trusted RFC 7009 endpoint; disconnect removes the local grant then attempts revocation once. */
46
+ revocationEndpoint?: string;
47
+ /** Revocation body encoding, default form. JSON omits the RFC 7009 token_type_hint. */
48
+ revocationRequestFormat?: "form" | "json";
45
49
  /** The client id the provider issued for this deployment. */
46
50
  clientId: string;
47
51
  /**
@@ -64,6 +68,15 @@ export interface ApiOAuthConfig {
64
68
  * `access_type`. The grant's own parameters cannot be overridden.
65
69
  */
66
70
  authorizationParams?: Record<string, string>;
71
+ /**
72
+ * Fixed provider callback parameters, such as a configured company id.
73
+ * After pending-state verification, each must occur exactly once with this
74
+ * exact value, before issuer validation or code exchange. OAuth response
75
+ * fields (code, state, iss, error, error_description, error_uri) are reserved.
76
+ * Names must be nonempty ASCII letters, digits, dots, underscores or hyphens;
77
+ * values must be nonempty strings. Values are never described or returned.
78
+ */
79
+ expectedCallbackParameters?: Readonly<Record<string, string>>;
67
80
  /**
68
81
  * Headers added to every token-endpoint request — the code exchange and
69
82
  * each refresh — for a provider whose token endpoint demands its own
@@ -199,6 +212,7 @@ export declare const API_OPTIONS: import("../config-schema.js").Field<unknown, u
199
212
  oauth: import("../config-schema.js").Field<unknown, unknown, true> & {
200
213
  readonly shape: {
201
214
  authorizationParams: import("../config-schema.js").Field<Record<string, string>, Readonly<Record<string, string>> | undefined, true>;
215
+ expectedCallbackParameters: import("../config-schema.js").Field<Record<string, string>, Readonly<Record<string, string>> | undefined, true>;
202
216
  tokenRequestHeaders: import("../config-schema.js").Field<Record<string, string>, Readonly<Record<string, string>> | undefined, true>;
203
217
  scope: import("../config-schema.js").Field<unknown, unknown, true>;
204
218
  authorizationEndpoint: import("../config-schema.js").Field<unknown, unknown, true>;
@@ -208,6 +222,8 @@ export declare const API_OPTIONS: import("../config-schema.js").Field<unknown, u
208
222
  pkce: import("../config-schema.js").Field<unknown, unknown, true>;
209
223
  clientId: import("../config-schema.js").Field<unknown, unknown, true>;
210
224
  clientSecret: import("../config-schema.js").Field<unknown, unknown, true>;
225
+ revocationEndpoint: import("../config-schema.js").Field<unknown, unknown, true>;
226
+ revocationRequestFormat: import("../config-schema.js").Field<unknown, unknown, true>;
211
227
  };
212
228
  };
213
229
  tools: import("../config-schema.js").Field<unknown[], readonly unknown[] | undefined, true>;
@@ -233,6 +249,7 @@ export interface ApiOAuthHooks {
233
249
  }): Promise<ConnectorStatus>;
234
250
  disconnectAuth(ctx: ConnectorContext): Promise<void>;
235
251
  verifyState(state: string | null, ctx: ConnectorContext): Promise<boolean>;
252
+ verifyCallbackParameters(params: URLSearchParams, ctx: ConnectorContext): Promise<boolean>;
236
253
  verifyCallbackIssuer(issuer: string | null, ctx: ConnectorContext): Promise<boolean>;
237
254
  consumeAuthError(ctx: ConnectorContext): Promise<void>;
238
255
  /** Requires callbackParams with a nonempty state, including without PKCE. */
@@ -57,8 +57,9 @@ export const API_OPTIONS = optionsOf()({
57
57
  usageGuide: USAGE_GUIDE,
58
58
  credential: CREDENTIAL,
59
59
  oauth: optionsOf()({
60
- ...keys("authorizationEndpoint", "tokenEndpoint", "clientId", "clientSecret", "tokenEndpointAuthMethod", "scope", "pkce", "apiOrigins"),
60
+ ...keys("authorizationEndpoint", "tokenEndpoint", "clientId", "clientSecret", "tokenEndpointAuthMethod", "scope", "pkce", "apiOrigins", "revocationEndpoint", "revocationRequestFormat"),
61
61
  authorizationParams: strings(),
62
+ expectedCallbackParameters: strings(),
62
63
  tokenRequestHeaders: strings(),
63
64
  }),
64
65
  // A tool's annotations stay open: MCP lets a tool carry hints Connecta
@@ -158,6 +159,7 @@ export function apiConnector(id, opts, oauth) {
158
159
  // Callback work belongs to its request, including the route's
159
160
  // uninterruptible exchange, rather than any resource call.
160
161
  verifyState: (state, ctx) => settleOnClose(ctx, () => oauth.verifyState(state, ctx), true),
162
+ verifyCallbackParameters: (params, ctx) => settleOnClose(ctx, () => oauth.verifyCallbackParameters(params, ctx), true),
161
163
  verifyCallbackIssuer: (issuer, ctx) => settleOnClose(ctx, () => oauth.verifyCallbackIssuer(issuer, ctx), true),
162
164
  consumeAuthError: (ctx) => settleOnClose(ctx, () => oauth.consumeAuthError(ctx), true),
163
165
  finishAuth: (code, ctx, callbackParams) => settleOnClose(ctx, () => oauth.finishAuth(code, ctx, callbackParams), true),
@@ -324,7 +324,7 @@ function bodyInit(request) {
324
324
  return { body: body.body };
325
325
  case "Uint8Array":
326
326
  // The retained text when there is one, so the wire carries exactly the
327
- // string guarded-fetch sent and goldens record the same body.
327
+ // string guarded-fetch sent.
328
328
  return { body: (body.text ?? body.body) };
329
329
  case "FormData":
330
330
  return { body: body.formData };
@@ -4,8 +4,7 @@
4
4
  // after this cursor" into a vendor request and reads back rows and the next
5
5
  // vendor cursor; tools take one page, and `allRows` walks every page as a
6
6
  // Stream for programs and the hatch. The codec is the only place a cursor is
7
- // minted: `plain` hands the vendor's cursor through (what shipped providers
8
- // promise today, so goldens hold), `bound` ties it to the tool and its
7
+ // minted: `plain` hands the vendor's cursor through; `bound` ties it to the tool and its
9
8
  // arguments so a cursor from another call is refused instead of silently
10
9
  // reading the wrong list.
11
10
  import { Effect, Option, Schema, Stream } from "effect";
@@ -6,7 +6,7 @@ import { fromSignal } from "../runtime/run.js";
6
6
  import { callFromContext, ContinuationBinding, ContinuationStorage, openCall as openCoreCall, serviceFor, Signal, } from "../runtime/call.js";
7
7
  import { RequestRefused, ResendRefused } from "./errors.js";
8
8
  export { writeRequestKey } from "./write-request.js";
9
- export { Caller, Credentials, Secrets, RequestSecrets, Budget, Recovery, Signal, Classification, Ledger, openRequest, operationView, deriveView, viewCaller, callView, chargeView, } from "../runtime/call.js";
9
+ export { Caller, Credentials, Secrets, RequestSecrets, Budget, Recovery, Signal, Classification, Ledger, } from "../runtime/call.js";
10
10
  /** Permanent write reservations plus resource dispatches, in reservation order. */
11
11
  export class Dispatches extends Context.Service()("connecta/http/Dispatches") {
12
12
  }
@@ -264,10 +264,6 @@ export function write(connection, spec) {
264
264
  ...(spec.idempotent === undefined ? {} : { idempotentHint: spec.idempotent }),
265
265
  }, spec.idempotency);
266
266
  }
267
- /** Money, mail, and refunds are always destructive and never idempotent hints. */
268
- export function action(connection, spec) {
269
- return build(connection, spec, "write", { readOnlyHint: false, destructiveHint: true, idempotentHint: false });
270
- }
271
267
  /**
272
268
  * A key the transport may send: not blank, and only characters an HTTP
273
269
  * header carries. The REST layer refuses the same keys before dispatch.
@@ -2,6 +2,7 @@ import type { ActivityOutcome } from "../activity.js";
2
2
  import type { ConnectaConfigDescription } from "../describe-config.js";
3
3
  import type { ConnectorStatus, ConnectorToolDescription } from "../types.js";
4
4
  import type { UiProblem } from "./model.js";
5
+ export type OperatorPage = "overview" | "endpoints" | "settings" | "connector" | "tokens" | "connections" | "activity";
5
6
  /** The registry's final verdict, independent of whether the viewer's endpoint is read-only. */
6
7
  export interface OperatorTool extends ConnectorToolDescription {
7
8
  address: string;