@dimmi/api 0.0.0-stage → 0.2.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 CHANGED
@@ -1,3 +1,49 @@
1
- # Temporary Holding Version
1
+ # @dimmi/api
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A typed client for the dimmi REST API. It is [openapi-fetch](https://openapi-ts.dev/openapi-fetch/) over types that [openapi-typescript](https://openapi-ts.dev) generates from the API's OpenAPI document. Runs anywhere `fetch` does: Node 20+, Bun, Deno, workers and browsers.
4
+
5
+ ```sh
6
+ npm install @dimmi/api
7
+ ```
8
+
9
+ ## Usage
10
+
11
+ ```ts
12
+ import { createDimmiApi, paginate, unwrap } from "@dimmi/api";
13
+
14
+ const api = createDimmiApi({
15
+ host: "https://dimmi.example.com", // or baseUrl: "https://.../api/v1"
16
+ token: process.env.DIMMI_TOKEN!, // a personal or app access token
17
+ workspace: "ws_...", // optional: a token works in its own workspace; sent as Dimmi-Workspace
18
+ autoIdempotency: true, // Idempotency-Key on every POST
19
+ });
20
+
21
+ const { data, error } = await api.GET("/contacts/{contact}", { params: { path: { contact: "ct_..." } } });
22
+
23
+ const created = await unwrap(api.POST("/contacts", { body: { email: "ada@example.com" } }));
24
+
25
+ for await (const contact of paginate(api, "/contacts", { params: { query: { limit: "100" } } })) {
26
+ console.log(contact.email);
27
+ }
28
+ ```
29
+
30
+ ## What it adds to openapi-fetch
31
+
32
+ - `Authorization: Bearer <token>` on every call, and `Dimmi-Workspace` when `workspace` is set. A token works in its own workspace; naming another is refused.
33
+ - 429 answers are retried after `Retry-After` (seconds or a date); `maxRetries` (3) and `maxRetryDelay` (30 s) tune it.
34
+ - `autoIdempotency` adds an `Idempotency-Key` to POSTs; retries reuse it. Only [some endpoints](https://trydimmi.com/docs/developers/api/idempotency/) read the key. Pass your own per call with `headers: { "Idempotency-Key": key }`.
35
+ - `paginate(api, path, init)` walks every item; `pages()` every page. Lists page by `cursor` (`meta.next_cursor`), by `after`, or by `offset` (`meta.total`), whichever the endpoint uses.
36
+ - `unwrap(call)` answers `data` or throws a `DimmiApiError` with `status`, `code`, `errors`.
37
+ - Types: `paths`, `operations`, `components`, and `Schemas` (`Schemas["Contact"]`).
38
+
39
+ ## Regenerating after API changes
40
+
41
+ The generated files are `src/schema.ts` (types) and `src/paging.ts` (how each list pages). Neither is committed (.gitignore): `make sdk-generate` writes them from the committed contract, and `pnpm sdk:build`, `pnpm sdk:test` and `pnpm typecheck` write them first when they are missing. `make sdk-check` generates, builds and tests every SDK.
42
+
43
+ ```sh
44
+ pnpm sdk:generate # from tests/contracts/api_v1.openapi.json
45
+ node sdk/api/scripts/generate.ts http://localhost:8080/api/v1/openapi.json # from a running server
46
+ pnpm sdk:build api
47
+ ```
48
+
49
+ The generator runs openapi-typescript through `pnpm dlx` with TypeScript 5, because the repo's TypeScript 7 has no compiler API.
package/dist/index.cjs ADDED
@@ -0,0 +1,138 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ // \0rolldown/runtime.js
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
+ get: ((k) => from[k]).bind(null, key),
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
20
+ value: mod,
21
+ enumerable: true
22
+ }) : target, mod));
23
+ let openapi_fetch = require("openapi-fetch");
24
+ openapi_fetch = __toESM(openapi_fetch, 1);
25
+ // src/paging.ts
26
+ var API_VERSION = "2026-11-01";
27
+ var paging = {
28
+ "/broadcasts": "offset",
29
+ "/broadcasts/{broadcast}/recipients": "offset",
30
+ "/conversations/{conversation}/messages": "after",
31
+ "/knowledge/sources/{source}/documents": "after",
32
+ "/reports/{report}/conversations": "offset",
33
+ "/series": "offset",
34
+ "/series/{series}/enrollments": "offset"
35
+ };
36
+ // src/index.ts
37
+ var DimmiApiError = class extends Error {
38
+ status;
39
+ code;
40
+ errors;
41
+ body;
42
+ constructor(status, body) {
43
+ const parsed = body && typeof body === "object" ? body : {};
44
+ super(parsed.message ?? `dimmi API answered ${status}`);
45
+ this.name = "DimmiApiError";
46
+ this.status = status;
47
+ this.code = parsed.code ?? "http_error";
48
+ this.errors = parsed.errors ?? {};
49
+ this.body = body;
50
+ }
51
+ };
52
+ function retryAfter(value, now = Date.now()) {
53
+ if (!value) return;
54
+ const seconds = Number(value);
55
+ if (Number.isFinite(seconds)) return Math.max(0, seconds * 1e3);
56
+ const date = Date.parse(value);
57
+ return Number.isNaN(date) ? void 0 : Math.max(0, date - now);
58
+ }
59
+ var sleep = (ms, signal) => new Promise((resolve, reject) => {
60
+ const timer = setTimeout(resolve, ms);
61
+ signal?.addEventListener("abort", () => {
62
+ clearTimeout(timer);
63
+ reject(signal.reason);
64
+ }, { once: true });
65
+ });
66
+ function retrying(send, maxRetries = 3, maxDelay = 3e4) {
67
+ return async (request) => {
68
+ for (let attempt = 0;; attempt++) {
69
+ const response = await send(attempt < maxRetries ? request.clone() : request);
70
+ if (response.status !== 429 || attempt >= maxRetries) return response;
71
+ const wait = retryAfter(response.headers.get("retry-after")) ?? 2 ** attempt * 500;
72
+ await sleep(Math.min(wait, maxDelay), request.signal);
73
+ }
74
+ };
75
+ }
76
+ function createDimmiApi(options) {
77
+ if (!options.token) throw new Error("dimmi: createDimmiApi needs a token.");
78
+ const baseUrl = options.baseUrl ?? (options.host ? `${options.host.replace(/\/+$/, "")}/api/v1` : "");
79
+ if (!baseUrl) throw new Error("dimmi: createDimmiApi needs host or baseUrl.");
80
+ const send = options.fetch ?? ((request) => globalThis.fetch(request));
81
+ const client = (0, openapi_fetch.default)({
82
+ baseUrl,
83
+ fetch: retrying(send, options.maxRetries, options.maxRetryDelay),
84
+ headers: options.headers
85
+ });
86
+ client.use({ onRequest({ request }) {
87
+ request.headers.set("Authorization", `Bearer ${options.token}`);
88
+ if (options.workspace && !request.headers.has("Dimmi-Workspace")) request.headers.set("Dimmi-Workspace", options.workspace);
89
+ if (options.autoIdempotency && request.method === "POST" && !request.headers.has("Idempotency-Key")) request.headers.set("Idempotency-Key", globalThis.crypto.randomUUID());
90
+ return request;
91
+ } });
92
+ return client;
93
+ }
94
+ async function unwrap(call) {
95
+ const { data, error, response } = await call;
96
+ if (error !== void 0 || !response.ok) throw new DimmiApiError(response.status, error);
97
+ return data;
98
+ }
99
+ async function* pages(api, path, init = {}) {
100
+ const query = { ...init.params?.query };
101
+ const kind = paging[path] ?? "cursor";
102
+ const get = api.GET;
103
+ for (;;) {
104
+ const page = await unwrap(get(path, {
105
+ ...init,
106
+ params: {
107
+ ...init.params,
108
+ query
109
+ }
110
+ }));
111
+ yield page;
112
+ const data = page.data ?? [];
113
+ const next = page.meta?.next_cursor;
114
+ if (next && kind !== "offset") {
115
+ query[kind] = next;
116
+ continue;
117
+ }
118
+ if (kind !== "offset" || data.length === 0) return;
119
+ const offset = Number(query.offset ?? 0) + data.length;
120
+ const total = page.meta?.total;
121
+ const limit = Number(query.limit ?? page.meta?.per_page ?? data.length);
122
+ if (total !== void 0 && offset >= total || data.length < limit) return;
123
+ query.offset = offset;
124
+ }
125
+ }
126
+ async function* paginate(api, path, init = {}) {
127
+ for await (const page of pages(api, path, init)) yield* page.data ?? [];
128
+ }
129
+ exports.API_VERSION = API_VERSION;
130
+ exports.DimmiApiError = DimmiApiError;
131
+ exports.createDimmiApi = createDimmiApi;
132
+ exports.pages = pages;
133
+ exports.paginate = paginate;
134
+ exports.retryAfter = retryAfter;
135
+ exports.retrying = retrying;
136
+ exports.unwrap = unwrap;
137
+
138
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":["createClient"],"sources":["../src/paging.ts","../src/index.ts"],"sourcesContent":["/* Generated by sdk/api/scripts/generate.ts from the dimmi API 2026-11-01. Do not edit. */\n\nexport const API_VERSION = \"2026-11-01\";\n\n/* Lists that page by offset or by an after cursor; every other list pages by cursor. */\nexport const paging: Record<string, \"offset\" | \"after\"> = {\n \"/broadcasts\": \"offset\",\n \"/broadcasts/{broadcast}/recipients\": \"offset\",\n \"/conversations/{conversation}/messages\": \"after\",\n \"/knowledge/sources/{source}/documents\": \"after\",\n \"/reports/{report}/conversations\": \"offset\",\n \"/series\": \"offset\",\n \"/series/{series}/enrollments\": \"offset\"\n};\n","/*\n * @dimmi/api is a typed client for the dimmi REST API: openapi-fetch over\n * types openapi-typescript generated from the API's OpenAPI document. It\n * runs anywhere fetch does. createDimmiApi adds the token, the\n * Dimmi-Workspace header, an Idempotency-Key on POSTs when asked, and\n * sends a call answered 429 again after the server's Retry-After.\n * paginate() walks every item of a list, by cursor or by offset.\n *\n * const api = createDimmiApi({ host, token, workspace });\n * const { data, error } = await api.GET(\"/contacts/{contact}\", { params: { path: { contact } } });\n */\nimport createClient, { type Client, type Middleware } from \"openapi-fetch\";\n\nimport { paging } from \"./paging.js\";\nimport type { components, paths } from \"./schema.js\";\n\nexport { API_VERSION } from \"./paging.js\";\nexport type { components, operations, paths } from \"./schema.js\";\n\nexport type Schemas = components[\"schemas\"];\nexport type DimmiApi = Client<paths>;\n\nexport interface DimmiApiOptions {\n /* A personal access token or an app's access token. */\n token: string;\n /* Your dimmi host, such as https://dimmi.acme.com; the API is under /api/v1. */\n host?: string;\n /* The API's full base URL, instead of host. */\n baseUrl?: string;\n /* The workspace calls work in, sent as Dimmi-Workspace. */\n workspace?: string;\n /* How many times a call answered 429 is sent again; 3 unless set. */\n maxRetries?: number;\n /* The longest wait before a retry, in milliseconds; 30 s unless set. */\n maxRetryDelay?: number;\n /* Adds an Idempotency-Key to every POST without one; retries reuse it. */\n autoIdempotency?: boolean;\n fetch?: (request: Request) => Promise<Response>;\n headers?: Record<string, string>;\n}\n\n/*\n * DimmiApiError is what paginate and unwrap throw for a failed call,\n * with the server's error code and per-field messages.\n */\nexport class DimmiApiError extends Error {\n readonly status: number;\n readonly code: string;\n readonly errors: Record<string, string[] | null>;\n readonly body: unknown;\n\n constructor(status: number, body: unknown) {\n const parsed = (body && typeof body === \"object\" ? body : {}) as Partial<Schemas[\"ResponseError\"]>;\n super(parsed.message ?? `dimmi API answered ${status}`);\n this.name = \"DimmiApiError\";\n this.status = status;\n this.code = parsed.code ?? \"http_error\";\n this.errors = parsed.errors ?? {};\n this.body = body;\n }\n}\n\n/*\n * retryAfter reads a Retry-After header, in seconds or as an HTTP date,\n * as milliseconds.\n */\nexport function retryAfter(value: string | null, now = Date.now()): number | undefined {\n if (!value) {\n return undefined;\n }\n const seconds = Number(value);\n if (Number.isFinite(seconds)) {\n return Math.max(0, seconds * 1000);\n }\n const date = Date.parse(value);\n return Number.isNaN(date) ? undefined : Math.max(0, date - now);\n}\n\nconst sleep = (ms: number, signal?: AbortSignal | null) =>\n new Promise<void>((resolve, reject) => {\n const timer = setTimeout(resolve, ms);\n signal?.addEventListener(\n \"abort\",\n () => {\n clearTimeout(timer);\n reject(signal.reason);\n },\n { once: true },\n );\n });\n\n/*\n * retrying wraps fetch so a 429 is sent again after its Retry-After.\n */\nexport function retrying(\n send: (request: Request) => Promise<Response>,\n maxRetries = 3,\n maxDelay = 30_000,\n): (request: Request) => Promise<Response> {\n return async (request) => {\n for (let attempt = 0; ; attempt++) {\n const response = await send(attempt < maxRetries ? request.clone() : request);\n if (response.status !== 429 || attempt >= maxRetries) {\n return response;\n }\n const wait = retryAfter(response.headers.get(\"retry-after\")) ?? 2 ** attempt * 500;\n await sleep(Math.min(wait, maxDelay), request.signal);\n }\n };\n}\n\n/*\n * createDimmiApi answers an openapi-fetch client for one token.\n */\nexport function createDimmiApi(options: DimmiApiOptions): DimmiApi {\n if (!options.token) {\n throw new Error(\"dimmi: createDimmiApi needs a token.\");\n }\n const baseUrl = options.baseUrl ?? (options.host ? `${options.host.replace(/\\/+$/, \"\")}/api/v1` : \"\");\n if (!baseUrl) {\n throw new Error(\"dimmi: createDimmiApi needs host or baseUrl.\");\n }\n const send = options.fetch ?? ((request: Request) => globalThis.fetch(request));\n const client = createClient<paths>({\n baseUrl,\n fetch: retrying(send, options.maxRetries, options.maxRetryDelay),\n headers: options.headers,\n });\n const auth: Middleware = {\n onRequest({ request }) {\n request.headers.set(\"Authorization\", `Bearer ${options.token}`);\n if (options.workspace && !request.headers.has(\"Dimmi-Workspace\")) {\n request.headers.set(\"Dimmi-Workspace\", options.workspace);\n }\n if (options.autoIdempotency && request.method === \"POST\" && !request.headers.has(\"Idempotency-Key\")) {\n request.headers.set(\"Idempotency-Key\", globalThis.crypto.randomUUID());\n }\n return request;\n },\n };\n client.use(auth);\n return client;\n}\n\n/*\n * unwrap answers a call's data, or throws its error as a DimmiApiError.\n */\nexport async function unwrap<T>(call: Promise<{ data?: T; error?: unknown; response: Response }>): Promise<T> {\n const { data, error, response } = await call;\n if (error !== undefined || !response.ok) {\n throw new DimmiApiError(response.status, error);\n }\n return data as T;\n}\n\ntype GetPaths = {\n [P in keyof paths]: paths[P] extends { get: { responses: { 200: unknown } } } ? P : never;\n}[keyof paths];\ntype ListBody<P extends GetPaths> = paths[P][\"get\"][\"responses\"][200] extends {\n content: { \"application/json\": infer B };\n}\n ? B\n : never;\ntype ListPaths = { [P in GetPaths]: ListBody<P> extends { data: unknown; meta: unknown } ? P : never }[GetPaths];\ntype ItemOf<P extends ListPaths> = ListBody<P> extends { data: Array<infer I> | null } ? I : never;\ntype Query = Record<string, unknown>;\ntype ListInit = { params?: { path?: Record<string, unknown>; query?: Query; header?: Record<string, unknown> } };\ntype Page = { data?: unknown[] | null; meta?: { next_cursor?: string; total?: number; per_page?: number } };\n\n/*\n * pages walks every page of a list, following its cursor, its after\n * cursor, or its offset.\n */\nexport async function* pages<P extends ListPaths>(\n api: DimmiApi,\n path: P,\n init: ListInit = {},\n): AsyncGenerator<ListBody<P>, void, undefined> {\n const query: Query = { ...init.params?.query };\n const kind = paging[path as string] ?? \"cursor\";\n const get = api.GET as unknown as (\n path: string,\n init: ListInit,\n ) => Promise<{ data?: Page; error?: unknown; response: Response }>;\n for (;;) {\n const page = await unwrap(get(path as string, { ...init, params: { ...init.params, query } }));\n yield page as ListBody<P>;\n const data = page.data ?? [];\n const next = page.meta?.next_cursor;\n if (next && kind !== \"offset\") {\n query[kind] = next;\n continue;\n }\n if (kind !== \"offset\" || data.length === 0) {\n return;\n }\n const offset = Number(query.offset ?? 0) + data.length;\n const total = page.meta?.total;\n const limit = Number(query.limit ?? page.meta?.per_page ?? data.length);\n if ((total !== undefined && offset >= total) || data.length < limit) {\n return;\n }\n query.offset = offset;\n }\n}\n\n/*\n * paginate walks every item of a list, across its pages.\n *\n * for await (const contact of paginate(api, \"/contacts\")) { ... }\n */\nexport async function* paginate<P extends ListPaths>(\n api: DimmiApi,\n path: P,\n init: ListInit = {},\n): AsyncGenerator<ItemOf<P>, void, undefined> {\n for await (const page of pages(api, path, init)) {\n yield* ((page as Page).data ?? []) as ItemOf<P>[];\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAa,cAAc;AAG3B,IAAa,SAA6C;CACxD,eAAe;CACf,sCAAsC;CACtC,0CAA0C;CAC1C,yCAAyC;CACzC,mCAAmC;CACnC,WAAW;CACX,gCAAgC;AAClC;;ACgCA,IAAa,gBAAb,cAAmC,MAAM;CACvC;CACA;CACA;C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3B,MAAM,OAAO,KAAK,MAAM;EACxB,IAAI,QAAQ,SAAS,UAAU;GAC7B,MAAM,QAAQ;GACd;EACF;EACA,IAAI,SAAS,YAAY,KAAK,WAAW,GACvC;EAEF,MAAM,SAAS,OAAO,MAAM,UAAU,CAAC,IAAI,KAAK;EAChD,MAAM,QAAQ,KAAK,MAAM;EACzB,MAAM,QAAQ,OAAO,MAAM,SAAS,KAAK,MAAM,YAAY,KAAK,MAAM;EACtE,IAAK,UAAU,KAAA,KAAa,UAAU,SAAU,KAAK,SAAS,OAC5D;EAEF,MAAM,SAAS;CACjB;AACF;AAOA,gBAAuB,SACrB,KACA,MACA,OAAiB,CAAC,GAC0B;CAC5C,WAAW,MAAM,QAAQ,MAAM,KAAK,MAAM,IAAI,GAC5C,OAAS,KAAc,QAAQ,CAAC;AAEpC"}
@@ -0,0 +1,65 @@
1
+ import { type Client } from "openapi-fetch";
2
+ import type { components, paths } from "./schema.js";
3
+ export { API_VERSION } from "./paging.js";
4
+ export type { components, operations, paths } from "./schema.js";
5
+ export type Schemas = components["schemas"];
6
+ export type DimmiApi = Client<paths>;
7
+ export interface DimmiApiOptions {
8
+ token: string;
9
+ host?: string;
10
+ baseUrl?: string;
11
+ workspace?: string;
12
+ maxRetries?: number;
13
+ maxRetryDelay?: number;
14
+ autoIdempotency?: boolean;
15
+ fetch?: (request: Request) => Promise<Response>;
16
+ headers?: Record<string, string>;
17
+ }
18
+ export declare class DimmiApiError extends Error {
19
+ readonly status: number;
20
+ readonly code: string;
21
+ readonly errors: Record<string, string[] | null>;
22
+ readonly body: unknown;
23
+ constructor(status: number, body: unknown);
24
+ }
25
+ export declare function retryAfter(value: string | null, now?: number): number | undefined;
26
+ export declare function retrying(send: (request: Request) => Promise<Response>, maxRetries?: number, maxDelay?: number): (request: Request) => Promise<Response>;
27
+ export declare function createDimmiApi(options: DimmiApiOptions): DimmiApi;
28
+ export declare function unwrap<T>(call: Promise<{
29
+ data?: T;
30
+ error?: unknown;
31
+ response: Response;
32
+ }>): Promise<T>;
33
+ type GetPaths = {
34
+ [P in keyof paths]: paths[P] extends {
35
+ get: {
36
+ responses: {
37
+ 200: unknown;
38
+ };
39
+ };
40
+ } ? P : never;
41
+ }[keyof paths];
42
+ type ListBody<P extends GetPaths> = paths[P]["get"]["responses"][200] extends {
43
+ content: {
44
+ "application/json": infer B;
45
+ };
46
+ } ? B : never;
47
+ type ListPaths = {
48
+ [P in GetPaths]: ListBody<P> extends {
49
+ data: unknown;
50
+ meta: unknown;
51
+ } ? P : never;
52
+ }[GetPaths];
53
+ type ItemOf<P extends ListPaths> = ListBody<P> extends {
54
+ data: Array<infer I> | null;
55
+ } ? I : never;
56
+ type Query = Record<string, unknown>;
57
+ type ListInit = {
58
+ params?: {
59
+ path?: Record<string, unknown>;
60
+ query?: Query;
61
+ header?: Record<string, unknown>;
62
+ };
63
+ };
64
+ export declare function pages<P extends ListPaths>(api: DimmiApi, path: P, init?: ListInit): AsyncGenerator<ListBody<P>, void, undefined>;
65
+ export declare function paginate<P extends ListPaths>(api: DimmiApi, path: P, init?: ListInit): AsyncGenerator<ItemOf<P>, void, undefined>;
@@ -0,0 +1,65 @@
1
+ import { type Client } from "openapi-fetch";
2
+ import type { components, paths } from "./schema.js";
3
+ export { API_VERSION } from "./paging.js";
4
+ export type { components, operations, paths } from "./schema.js";
5
+ export type Schemas = components["schemas"];
6
+ export type DimmiApi = Client<paths>;
7
+ export interface DimmiApiOptions {
8
+ token: string;
9
+ host?: string;
10
+ baseUrl?: string;
11
+ workspace?: string;
12
+ maxRetries?: number;
13
+ maxRetryDelay?: number;
14
+ autoIdempotency?: boolean;
15
+ fetch?: (request: Request) => Promise<Response>;
16
+ headers?: Record<string, string>;
17
+ }
18
+ export declare class DimmiApiError extends Error {
19
+ readonly status: number;
20
+ readonly code: string;
21
+ readonly errors: Record<string, string[] | null>;
22
+ readonly body: unknown;
23
+ constructor(status: number, body: unknown);
24
+ }
25
+ export declare function retryAfter(value: string | null, now?: number): number | undefined;
26
+ export declare function retrying(send: (request: Request) => Promise<Response>, maxRetries?: number, maxDelay?: number): (request: Request) => Promise<Response>;
27
+ export declare function createDimmiApi(options: DimmiApiOptions): DimmiApi;
28
+ export declare function unwrap<T>(call: Promise<{
29
+ data?: T;
30
+ error?: unknown;
31
+ response: Response;
32
+ }>): Promise<T>;
33
+ type GetPaths = {
34
+ [P in keyof paths]: paths[P] extends {
35
+ get: {
36
+ responses: {
37
+ 200: unknown;
38
+ };
39
+ };
40
+ } ? P : never;
41
+ }[keyof paths];
42
+ type ListBody<P extends GetPaths> = paths[P]["get"]["responses"][200] extends {
43
+ content: {
44
+ "application/json": infer B;
45
+ };
46
+ } ? B : never;
47
+ type ListPaths = {
48
+ [P in GetPaths]: ListBody<P> extends {
49
+ data: unknown;
50
+ meta: unknown;
51
+ } ? P : never;
52
+ }[GetPaths];
53
+ type ItemOf<P extends ListPaths> = ListBody<P> extends {
54
+ data: Array<infer I> | null;
55
+ } ? I : never;
56
+ type Query = Record<string, unknown>;
57
+ type ListInit = {
58
+ params?: {
59
+ path?: Record<string, unknown>;
60
+ query?: Query;
61
+ header?: Record<string, unknown>;
62
+ };
63
+ };
64
+ export declare function pages<P extends ListPaths>(api: DimmiApi, path: P, init?: ListInit): AsyncGenerator<ListBody<P>, void, undefined>;
65
+ export declare function paginate<P extends ListPaths>(api: DimmiApi, path: P, init?: ListInit): AsyncGenerator<ItemOf<P>, void, undefined>;
package/dist/index.js ADDED
@@ -0,0 +1,108 @@
1
+ import createClient from "openapi-fetch";
2
+ // src/paging.ts
3
+ var API_VERSION = "2026-11-01";
4
+ var paging = {
5
+ "/broadcasts": "offset",
6
+ "/broadcasts/{broadcast}/recipients": "offset",
7
+ "/conversations/{conversation}/messages": "after",
8
+ "/knowledge/sources/{source}/documents": "after",
9
+ "/reports/{report}/conversations": "offset",
10
+ "/series": "offset",
11
+ "/series/{series}/enrollments": "offset"
12
+ };
13
+ // src/index.ts
14
+ var DimmiApiError = class extends Error {
15
+ status;
16
+ code;
17
+ errors;
18
+ body;
19
+ constructor(status, body) {
20
+ const parsed = body && typeof body === "object" ? body : {};
21
+ super(parsed.message ?? `dimmi API answered ${status}`);
22
+ this.name = "DimmiApiError";
23
+ this.status = status;
24
+ this.code = parsed.code ?? "http_error";
25
+ this.errors = parsed.errors ?? {};
26
+ this.body = body;
27
+ }
28
+ };
29
+ function retryAfter(value, now = Date.now()) {
30
+ if (!value) return;
31
+ const seconds = Number(value);
32
+ if (Number.isFinite(seconds)) return Math.max(0, seconds * 1e3);
33
+ const date = Date.parse(value);
34
+ return Number.isNaN(date) ? void 0 : Math.max(0, date - now);
35
+ }
36
+ var sleep = (ms, signal) => new Promise((resolve, reject) => {
37
+ const timer = setTimeout(resolve, ms);
38
+ signal?.addEventListener("abort", () => {
39
+ clearTimeout(timer);
40
+ reject(signal.reason);
41
+ }, { once: true });
42
+ });
43
+ function retrying(send, maxRetries = 3, maxDelay = 3e4) {
44
+ return async (request) => {
45
+ for (let attempt = 0;; attempt++) {
46
+ const response = await send(attempt < maxRetries ? request.clone() : request);
47
+ if (response.status !== 429 || attempt >= maxRetries) return response;
48
+ const wait = retryAfter(response.headers.get("retry-after")) ?? 2 ** attempt * 500;
49
+ await sleep(Math.min(wait, maxDelay), request.signal);
50
+ }
51
+ };
52
+ }
53
+ function createDimmiApi(options) {
54
+ if (!options.token) throw new Error("dimmi: createDimmiApi needs a token.");
55
+ const baseUrl = options.baseUrl ?? (options.host ? `${options.host.replace(/\/+$/, "")}/api/v1` : "");
56
+ if (!baseUrl) throw new Error("dimmi: createDimmiApi needs host or baseUrl.");
57
+ const send = options.fetch ?? ((request) => globalThis.fetch(request));
58
+ const client = createClient({
59
+ baseUrl,
60
+ fetch: retrying(send, options.maxRetries, options.maxRetryDelay),
61
+ headers: options.headers
62
+ });
63
+ client.use({ onRequest({ request }) {
64
+ request.headers.set("Authorization", `Bearer ${options.token}`);
65
+ if (options.workspace && !request.headers.has("Dimmi-Workspace")) request.headers.set("Dimmi-Workspace", options.workspace);
66
+ if (options.autoIdempotency && request.method === "POST" && !request.headers.has("Idempotency-Key")) request.headers.set("Idempotency-Key", globalThis.crypto.randomUUID());
67
+ return request;
68
+ } });
69
+ return client;
70
+ }
71
+ async function unwrap(call) {
72
+ const { data, error, response } = await call;
73
+ if (error !== void 0 || !response.ok) throw new DimmiApiError(response.status, error);
74
+ return data;
75
+ }
76
+ async function* pages(api, path, init = {}) {
77
+ const query = { ...init.params?.query };
78
+ const kind = paging[path] ?? "cursor";
79
+ const get = api.GET;
80
+ for (;;) {
81
+ const page = await unwrap(get(path, {
82
+ ...init,
83
+ params: {
84
+ ...init.params,
85
+ query
86
+ }
87
+ }));
88
+ yield page;
89
+ const data = page.data ?? [];
90
+ const next = page.meta?.next_cursor;
91
+ if (next && kind !== "offset") {
92
+ query[kind] = next;
93
+ continue;
94
+ }
95
+ if (kind !== "offset" || data.length === 0) return;
96
+ const offset = Number(query.offset ?? 0) + data.length;
97
+ const total = page.meta?.total;
98
+ const limit = Number(query.limit ?? page.meta?.per_page ?? data.length);
99
+ if (total !== void 0 && offset >= total || data.length < limit) return;
100
+ query.offset = offset;
101
+ }
102
+ }
103
+ async function* paginate(api, path, init = {}) {
104
+ for await (const page of pages(api, path, init)) yield* page.data ?? [];
105
+ }
106
+ export { API_VERSION, DimmiApiError, createDimmiApi, pages, paginate, retryAfter, retrying, unwrap };
107
+
108
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/paging.ts","../src/index.ts"],"sourcesContent":["/* Generated by sdk/api/scripts/generate.ts from the dimmi API 2026-11-01. Do not edit. */\n\nexport const API_VERSION = \"2026-11-01\";\n\n/* Lists that page by offset or by an after cursor; every other list pages by cursor. */\nexport const paging: Record<string, \"offset\" | \"after\"> = {\n \"/broadcasts\": \"offset\",\n \"/broadcasts/{broadcast}/recipients\": \"offset\",\n \"/conversations/{conversation}/messages\": \"after\",\n \"/knowledge/sources/{source}/documents\": \"after\",\n \"/reports/{report}/conversations\": \"offset\",\n \"/series\": \"offset\",\n \"/series/{series}/enrollments\": \"offset\"\n};\n","/*\n * @dimmi/api is a typed client for the dimmi REST API: openapi-fetch over\n * types openapi-typescript generated from the API's OpenAPI document. It\n * runs anywhere fetch does. createDimmiApi adds the token, the\n * Dimmi-Workspace header, an Idempotency-Key on POSTs when asked, and\n * sends a call answered 429 again after the server's Retry-After.\n * paginate() walks every item of a list, by cursor or by offset.\n *\n * const api = createDimmiApi({ host, token, workspace });\n * const { data, error } = await api.GET(\"/contacts/{contact}\", { params: { path: { contact } } });\n */\nimport createClient, { type Client, type Middleware } from \"openapi-fetch\";\n\nimport { paging } from \"./paging.js\";\nimport type { components, paths } from \"./schema.js\";\n\nexport { API_VERSION } from \"./paging.js\";\nexport type { components, operations, paths } from \"./schema.js\";\n\nexport type Schemas = components[\"schemas\"];\nexport type DimmiApi = Client<paths>;\n\nexport interface DimmiApiOptions {\n /* A personal access token or an app's access token. */\n token: string;\n /* Your dimmi host, such as https://dimmi.acme.com; the API is under /api/v1. */\n host?: string;\n /* The API's full base URL, instead of host. */\n baseUrl?: string;\n /* The workspace calls work in, sent as Dimmi-Workspace. */\n workspace?: string;\n /* How many times a call answered 429 is sent again; 3 unless set. */\n maxRetries?: number;\n /* The longest wait before a retry, in milliseconds; 30 s unless set. */\n maxRetryDelay?: number;\n /* Adds an Idempotency-Key to every POST without one; retries reuse it. */\n autoIdempotency?: boolean;\n fetch?: (request: Request) => Promise<Response>;\n headers?: Record<string, string>;\n}\n\n/*\n * DimmiApiError is what paginate and unwrap throw for a failed call,\n * with the server's error code and per-field messages.\n */\nexport class DimmiApiError extends Error {\n readonly status: number;\n readonly code: string;\n readonly errors: Record<string, string[] | null>;\n readonly body: unknown;\n\n constructor(status: number, body: unknown) {\n const parsed = (body && typeof body === \"object\" ? body : {}) as Partial<Schemas[\"ResponseError\"]>;\n super(parsed.message ?? `dimmi API answered ${status}`);\n this.name = \"DimmiApiError\";\n this.status = status;\n this.code = parsed.code ?? \"http_error\";\n this.errors = parsed.errors ?? {};\n this.body = body;\n }\n}\n\n/*\n * retryAfter reads a Retry-After header, in seconds or as an HTTP date,\n * as milliseconds.\n */\nexport function retryAfter(value: string | null, now = Date.now()): number | undefined {\n if (!value) {\n return undefined;\n }\n const seconds = Number(value);\n if (Number.isFinite(seconds)) {\n return Math.max(0, seconds * 1000);\n }\n const date = Date.parse(value);\n return Number.isNaN(date) ? undefined : Math.max(0, date - now);\n}\n\nconst sleep = (ms: number, signal?: AbortSignal | null) =>\n new Promise<void>((resolve, reject) => {\n const timer = setTimeout(resolve, ms);\n signal?.addEventListener(\n \"abort\",\n () => {\n clearTimeout(timer);\n reject(signal.reason);\n },\n { once: true },\n );\n });\n\n/*\n * retrying wraps fetch so a 429 is sent again after its Retry-After.\n */\nexport function retrying(\n send: (request: Request) => Promise<Response>,\n maxRetries = 3,\n maxDelay = 30_000,\n): (request: Request) => Promise<Response> {\n return async (request) => {\n for (let attempt = 0; ; attempt++) {\n const response = await send(attempt < maxRetries ? request.clone() : request);\n if (response.status !== 429 || attempt >= maxRetries) {\n return response;\n }\n const wait = retryAfter(response.headers.get(\"retry-after\")) ?? 2 ** attempt * 500;\n await sleep(Math.min(wait, maxDelay), request.signal);\n }\n };\n}\n\n/*\n * createDimmiApi answers an openapi-fetch client for one token.\n */\nexport function createDimmiApi(options: DimmiApiOptions): DimmiApi {\n if (!options.token) {\n throw new Error(\"dimmi: createDimmiApi needs a token.\");\n }\n const baseUrl = options.baseUrl ?? (options.host ? `${options.host.replace(/\\/+$/, \"\")}/api/v1` : \"\");\n if (!baseUrl) {\n throw new Error(\"dimmi: createDimmiApi needs host or baseUrl.\");\n }\n const send = options.fetch ?? ((request: Request) => globalThis.fetch(request));\n const client = createClient<paths>({\n baseUrl,\n fetch: retrying(send, options.maxRetries, options.maxRetryDelay),\n headers: options.headers,\n });\n const auth: Middleware = {\n onRequest({ request }) {\n request.headers.set(\"Authorization\", `Bearer ${options.token}`);\n if (options.workspace && !request.headers.has(\"Dimmi-Workspace\")) {\n request.headers.set(\"Dimmi-Workspace\", options.workspace);\n }\n if (options.autoIdempotency && request.method === \"POST\" && !request.headers.has(\"Idempotency-Key\")) {\n request.headers.set(\"Idempotency-Key\", globalThis.crypto.randomUUID());\n }\n return request;\n },\n };\n client.use(auth);\n return client;\n}\n\n/*\n * unwrap answers a call's data, or throws its error as a DimmiApiError.\n */\nexport async function unwrap<T>(call: Promise<{ data?: T; error?: unknown; response: Response }>): Promise<T> {\n const { data, error, response } = await call;\n if (error !== undefined || !response.ok) {\n throw new DimmiApiError(response.status, error);\n }\n return data as T;\n}\n\ntype GetPaths = {\n [P in keyof paths]: paths[P] extends { get: { responses: { 200: unknown } } } ? P : never;\n}[keyof paths];\ntype ListBody<P extends GetPaths> = paths[P][\"get\"][\"responses\"][200] extends {\n content: { \"application/json\": infer B };\n}\n ? B\n : never;\ntype ListPaths = { [P in GetPaths]: ListBody<P> extends { data: unknown; meta: unknown } ? P : never }[GetPaths];\ntype ItemOf<P extends ListPaths> = ListBody<P> extends { data: Array<infer I> | null } ? I : never;\ntype Query = Record<string, unknown>;\ntype ListInit = { params?: { path?: Record<string, unknown>; query?: Query; header?: Record<string, unknown> } };\ntype Page = { data?: unknown[] | null; meta?: { next_cursor?: string; total?: number; per_page?: number } };\n\n/*\n * pages walks every page of a list, following its cursor, its after\n * cursor, or its offset.\n */\nexport async function* pages<P extends ListPaths>(\n api: DimmiApi,\n path: P,\n init: ListInit = {},\n): AsyncGenerator<ListBody<P>, void, undefined> {\n const query: Query = { ...init.params?.query };\n const kind = paging[path as string] ?? \"cursor\";\n const get = api.GET as unknown as (\n path: string,\n init: ListInit,\n ) => Promise<{ data?: Page; error?: unknown; response: Response }>;\n for (;;) {\n const page = await unwrap(get(path as string, { ...init, params: { ...init.params, query } }));\n yield page as ListBody<P>;\n const data = page.data ?? [];\n const next = page.meta?.next_cursor;\n if (next && kind !== \"offset\") {\n query[kind] = next;\n continue;\n }\n if (kind !== \"offset\" || data.length === 0) {\n return;\n }\n const offset = Number(query.offset ?? 0) + data.length;\n const total = page.meta?.total;\n const limit = Number(query.limit ?? page.meta?.per_page ?? data.length);\n if ((total !== undefined && offset >= total) || data.length < limit) {\n return;\n }\n query.offset = offset;\n }\n}\n\n/*\n * paginate walks every item of a list, across its pages.\n *\n * for await (const contact of paginate(api, \"/contacts\")) { ... }\n */\nexport async function* paginate<P extends ListPaths>(\n api: DimmiApi,\n path: P,\n init: ListInit = {},\n): AsyncGenerator<ItemOf<P>, void, undefined> {\n for await (const page of pages(api, path, init)) {\n yield* ((page as Page).data ?? []) as ItemOf<P>[];\n }\n}\n"],"mappings":";;AAEA,IAAa,cAAc;AAG3B,IAAa,SAA6C;CACxD,eAAe;CACf,sCAAsC;CACtC,0CAA0C;CAC1C,yCAAyC;CACzC,mCAAmC;CACnC,WAAW;CACX,gCAAgC;AAClC;;ACgCA,IAAa,gBAAb,cAAmC,MAAM;CACvC;CACA;CACA;CACA;CAEA,YAAY,QAAgB,MAAe;EACzC,MAAM,SAAU,QAAQ,OAAO,SAAS,WAAW,OAAO,CAAC;EAC3D,MAAM,OAAO,WAAW,sBAAsB,QAAQ;EACtD,KAAK,OAAO;EACZ,KAAK,SAAS;EACd,KAAK,OAAO,OAAO,QAAQ;EAC3B,KAAK,SAAS,OAAO,UAAU,CAAC;EAChC,KAAK,OAAO;CACd;AACF;AAMA,SAAgB,WAAW,OAAsB,MAAM,KAAK,IAAI,GAAuB;CACrF,IAAI,CAAC,OACH;CAEF,MAAM,UAAU,OAAO,KAAK;CAC5B,IAAI,OAAO,SAAS,OAAO,GACzB,OAAO,KAAK,IAAI,GAAG,UAAU,GAAI;CAEnC,MAAM,OAAO,KAAK,MAAM,KAAK;CAC7B,OAAO,OAAO,MAAM,IAAI,IAAI,KAAA,IAAY,KAAK,IAAI,GAAG,OAAO,GAAG;AAChE;AAEA,IAAM,SAAS,IAAY,WACzB,IAAI,SAAe,SAAS,WAAW;CACrC,MAAM,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