@softr/sdk 0.0.5 → 0.0.6

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/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as defineVisibility, C as AccessReason, D as SoftrUserGroups, E as SoftrUserGroupId, F as q, M as isAlreadySignedInError, N as isForbiddenError, O as User, P as isUnauthenticatedError, S as AccessError, T as SoftrContext, _ as SoftrUser, a as CreateOptions, b as AccessBehaviour, c as GetOptions, d as MetricOptions, f as MetricResult, g as SoftrSDK, h as SoftrRecord, i as ChartDataResult, j as isAccessError, k as VisibilityHandle, l as ListOptions, m as SoftrPermissions, n as AuthAPI, o as DatasourceAPI, p as SoftrMe, r as ChartDataOptions, s as DatasourcePermissions, t as AggregationFunction, u as ListResult, v as UpdateOptions, w as RouteVisibility, x as AccessCheck, y as WorkflowAPI } from "./types-BYfW8LV3.js";
1
+ import { A as VisibilityHandle, C as AccessError, D as SoftrUserGroupId, E as SoftrContext, F as isUnauthenticatedError, I as q, M as isAccessError, N as isAlreadySignedInError, O as SoftrUserGroups, P as isForbiddenError, S as AccessCheck, T as RouteVisibility, _ as SoftrSDK, a as CreateOptions, b as WorkflowAPI, c as GetOptions, d as ListResult, f as MetricOptions, g as SoftrRecord, h as SoftrPermissions, i as ChartDataResult, j as defineVisibility, k as User, l as IntegrationAPI, m as SoftrMe, n as AuthAPI, o as DatasourceAPI, p as MetricResult, r as ChartDataOptions, s as DatasourcePermissions, t as AggregationFunction, u as ListOptions, v as SoftrUser, w as AccessReason, x as AccessBehaviour, y as UpdateOptions } from "./types-CtUT4jd7.js";
2
2
  import * as _tanstack_react_start0 from "@tanstack/react-start";
3
3
 
4
4
  //#region src/auth/session.d.ts
@@ -34,4 +34,4 @@ declare function softrAuthMiddleware(): _tanstack_react_start0.RequestMiddleware
34
34
  user: User | null;
35
35
  }>;
36
36
  //#endregion
37
- export { type AccessBehaviour, type AccessCheck, type AccessError, type AccessReason, type AggregationFunction, type AuthAPI, type ChartDataOptions, type ChartDataResult, type CreateOptions, type DatasourceAPI, type DatasourcePermissions, type GetOptions, type ListOptions, type ListResult, type MetricOptions, type MetricResult, type RouteVisibility, type SoftrContext, type SoftrMe, type SoftrPermissions, type SoftrRecord, type SoftrSDK, type SoftrUser, type SoftrUserGroupId, type SoftrUserGroups, type UpdateOptions, type User, type VisibilityHandle, type WorkflowAPI, defineVisibility, getSoftrUser, isAccessError, isAlreadySignedInError, isForbiddenError, isUnauthenticatedError, q, softrAuthMiddleware };
37
+ export { type AccessBehaviour, type AccessCheck, type AccessError, type AccessReason, type AggregationFunction, type AuthAPI, type ChartDataOptions, type ChartDataResult, type CreateOptions, type DatasourceAPI, type DatasourcePermissions, type GetOptions, type IntegrationAPI, type ListOptions, type ListResult, type MetricOptions, type MetricResult, type RouteVisibility, type SoftrContext, type SoftrMe, type SoftrPermissions, type SoftrRecord, type SoftrSDK, type SoftrUser, type SoftrUserGroupId, type SoftrUserGroups, type UpdateOptions, type User, type VisibilityHandle, type WorkflowAPI, defineVisibility, getSoftrUser, isAccessError, isAlreadySignedInError, isForbiddenError, isUnauthenticatedError, q, softrAuthMiddleware };
@@ -1,4 +1,4 @@
1
- import { g as SoftrSDK } from "./types-BYfW8LV3.js";
1
+ import { _ as SoftrSDK } from "./types-CtUT4jd7.js";
2
2
 
3
3
  //#region src/tanstack.d.ts
4
4
 
package/dist/tanstack.js CHANGED
@@ -184,6 +184,38 @@ function aliasFields(fields, aliases) {
184
184
  return result;
185
185
  }
186
186
 
187
+ //#endregion
188
+ //#region src/core/integration.ts
189
+ var IntegrationAPIImpl = class {
190
+ id;
191
+ request;
192
+ constructor(id, fetch$1) {
193
+ this.id = id;
194
+ this.request = fetch$1;
195
+ }
196
+ async fetch(input, init) {
197
+ const req = new Request(input, init);
198
+ if (req.signal.aborted) throw req.signal.reason ?? new DOMException("The operation was aborted.", "AbortError");
199
+ const headers = {};
200
+ new Headers(req.headers).forEach((value, key) => {
201
+ headers[key] = value;
202
+ });
203
+ const payload = {
204
+ method: req.method,
205
+ url: req.url,
206
+ headers
207
+ };
208
+ const method = req.method.toUpperCase();
209
+ if (method !== "GET" && method !== "HEAD" && req.body !== null) payload.body = await req.clone().text();
210
+ return this.request(`/api/integrations/${this.id}/proxy`, {
211
+ method: "POST",
212
+ headers: { "Content-Type": "application/json" },
213
+ body: JSON.stringify(payload),
214
+ signal: req.signal
215
+ });
216
+ }
217
+ };
218
+
187
219
  //#endregion
188
220
  //#region src/core/workflow.ts
189
221
  var WorkflowAPIImpl = class {
@@ -244,6 +276,9 @@ var SoftrSDKImpl = class {
244
276
  datasource(id) {
245
277
  return new DatasourceAPIImpl(id, this._fetch.bind(this));
246
278
  }
279
+ integration(id) {
280
+ return new IntegrationAPIImpl(id, this._fetch.bind(this));
281
+ }
247
282
  workflow(id) {
248
283
  return new WorkflowAPIImpl(id, this._fetch.bind(this));
249
284
  }
@@ -614,6 +614,18 @@ interface DatasourceAPI {
614
614
  metric(options: MetricOptions): Promise<MetricResult>;
615
615
  chartData(options: ChartDataOptions): Promise<ChartDataResult>;
616
616
  }
617
+ /**
618
+ * Proxy fetch for a configured integration (e.g. Google Calendar).
619
+ * Behaves like the native `fetch` API — requests are forwarded through
620
+ * Softr's proxy, which handles authentication with the third-party service.
621
+ *
622
+ * ⚠️ Caveats (same as the vibe block's `useProxyFetch`):
623
+ * - Body must be a string — FormData and other binary types are not supported.
624
+ * - Multi-value headers are flattened.
625
+ */
626
+ interface IntegrationAPI {
627
+ fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
628
+ }
617
629
  interface WorkflowAPI {
618
630
  trigger(payload?: Record<string, unknown>): Promise<void>;
619
631
  }
@@ -634,7 +646,8 @@ interface SoftrSDK {
634
646
  me(): Promise<SoftrMe>;
635
647
  auth: AuthAPI;
636
648
  datasource(id: string): DatasourceAPI;
649
+ integration(id: string): IntegrationAPI;
637
650
  workflow(id: string): WorkflowAPI;
638
651
  }
639
652
  //#endregion
640
- export { defineVisibility as A, AccessReason as C, SoftrUserGroups as D, SoftrUserGroupId as E, q as F, isAlreadySignedInError as M, isForbiddenError as N, User as O, isUnauthenticatedError as P, AccessError as S, SoftrContext as T, SoftrUser as _, CreateOptions as a, AccessBehaviour as b, GetOptions as c, MetricOptions as d, MetricResult as f, SoftrSDK as g, SoftrRecord as h, ChartDataResult as i, isAccessError as j, VisibilityHandle as k, ListOptions as l, SoftrPermissions as m, AuthAPI as n, DatasourceAPI as o, SoftrMe as p, ChartDataOptions as r, DatasourcePermissions as s, AggregationFunction as t, ListResult as u, UpdateOptions as v, RouteVisibility as w, AccessCheck as x, WorkflowAPI as y };
653
+ export { VisibilityHandle as A, AccessError as C, SoftrUserGroupId as D, SoftrContext as E, isUnauthenticatedError as F, q as I, isAccessError as M, isAlreadySignedInError as N, SoftrUserGroups as O, isForbiddenError as P, AccessCheck as S, RouteVisibility as T, SoftrSDK as _, CreateOptions as a, WorkflowAPI as b, GetOptions as c, ListResult as d, MetricOptions as f, SoftrRecord as g, SoftrPermissions as h, ChartDataResult as i, defineVisibility as j, User as k, IntegrationAPI as l, SoftrMe as m, AuthAPI as n, DatasourceAPI as o, MetricResult as p, ChartDataOptions as r, DatasourcePermissions as s, AggregationFunction as t, ListOptions as u, SoftrUser as v, AccessReason as w, AccessBehaviour as x, UpdateOptions as y };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softr/sdk",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" },