@verne-software/sdk 1.1.0 → 1.3.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/dist/index.js CHANGED
@@ -110,6 +110,101 @@ function sleep(ms) {
110
110
  return new Promise((resolve) => setTimeout(resolve, ms));
111
111
  }
112
112
 
113
+ // src/resources/clockwork/delayed.ts
114
+ var ClockworkDelayedResource = class {
115
+ constructor(http) {
116
+ this.http = http;
117
+ }
118
+ /**
119
+ * Returns all delayed (one-shot) jobs for the current tenant.
120
+ */
121
+ async list(options) {
122
+ return this.http.get("/v1/clockwork/delayed", options);
123
+ }
124
+ /**
125
+ * Schedules a new delayed job to run once at the given `run_at` time.
126
+ *
127
+ * @example
128
+ * const job = await clockwork.delayed.create({
129
+ * name: 'send-reminder',
130
+ * run_at: '2026-01-01T09:00:00Z',
131
+ * url: 'https://example.com/hooks/reminder',
132
+ * });
133
+ */
134
+ async create(params, options) {
135
+ return this.http.post("/v1/clockwork/delayed", { body: params, ...options });
136
+ }
137
+ /**
138
+ * Cancels a pending delayed job. Resolves on `204 No Content`.
139
+ */
140
+ async cancel(jobId, options) {
141
+ return this.http.delete(`/v1/clockwork/delayed/${jobId}`, options);
142
+ }
143
+ /**
144
+ * Returns the execution history for a delayed job.
145
+ */
146
+ async executions(jobId, options) {
147
+ return this.http.get(`/v1/clockwork/delayed/${jobId}/executions`, options);
148
+ }
149
+ };
150
+
151
+ // src/resources/clockwork/jobs.ts
152
+ var ClockworkJobsResource = class {
153
+ constructor(http) {
154
+ this.http = http;
155
+ }
156
+ /**
157
+ * Returns all cron jobs for the current tenant.
158
+ */
159
+ async list(options) {
160
+ return this.http.get("/v1/clockwork/jobs", options);
161
+ }
162
+ /**
163
+ * Creates a new recurring cron job.
164
+ *
165
+ * @example
166
+ * const job = await clockwork.jobs.create({
167
+ * name: 'nightly-report',
168
+ * schedule: '0 2 * * *',
169
+ * url: 'https://example.com/hooks/report',
170
+ * });
171
+ */
172
+ async create(params, options) {
173
+ return this.http.post("/v1/clockwork/jobs", { body: params, ...options });
174
+ }
175
+ /**
176
+ * Partially updates an existing cron job. Only the fields you provide are changed.
177
+ */
178
+ async update(jobId, params, options) {
179
+ return this.http.patch(`/v1/clockwork/jobs/${jobId}`, { body: params, ...options });
180
+ }
181
+ /**
182
+ * Deletes a cron job. Resolves on `204 No Content`.
183
+ */
184
+ async delete(jobId, options) {
185
+ return this.http.delete(`/v1/clockwork/jobs/${jobId}`, options);
186
+ }
187
+ /**
188
+ * Returns the execution history for a cron job (most recent runs first).
189
+ */
190
+ async executions(jobId, options) {
191
+ return this.http.get(`/v1/clockwork/jobs/${jobId}/executions`, options);
192
+ }
193
+ };
194
+
195
+ // src/resources/clockwork/clockwork.ts
196
+ var Clockwork = class {
197
+ constructor(config) {
198
+ this.http = new HttpClient({
199
+ apiKey: config.apiKey,
200
+ baseUrl: config.baseUrl,
201
+ timeoutMs: config.timeoutMs
202
+ });
203
+ this.jobs = new ClockworkJobsResource(this.http);
204
+ this.delayed = new ClockworkDelayedResource(this.http);
205
+ }
206
+ };
207
+
113
208
  // src/resources/gate/identities.ts
114
209
  var IdentitiesResource = class {
115
210
  constructor(http) {
@@ -328,6 +423,50 @@ var Gate = class {
328
423
  }
329
424
  };
330
425
 
426
+ // src/resources/passepartout/passepartout.ts
427
+ var Passepartout = class {
428
+ constructor(config) {
429
+ this.http = new HttpClient({
430
+ apiKey: config.apiKey,
431
+ baseUrl: config.baseUrl,
432
+ timeoutMs: config.timeoutMs
433
+ });
434
+ }
435
+ /**
436
+ * Starts a Telegram login and returns a nonce + deep link. Send the user to
437
+ * `deep_link`, then poll {@link loginStatus} with `nonce` until it completes.
438
+ *
439
+ * @example
440
+ * const { nonce, deep_link } = await passepartout.loginStart();
441
+ * // redirect the user to `deep_link`, then poll:
442
+ * const status = await passepartout.loginStatus(nonce);
443
+ */
444
+ async loginStart(options) {
445
+ return this.http.post("/v1/passepartout/login/start", options);
446
+ }
447
+ /**
448
+ * Returns the current state of a login attempt. While the user hasn't
449
+ * finished, `status` is `pending`; once done it becomes `completed` and
450
+ * carries the `access_token` and `user`.
451
+ */
452
+ async loginStatus(nonce, options) {
453
+ return this.http.get(
454
+ `/v1/passepartout/login/status?nonce=${encodeURIComponent(nonce)}`,
455
+ options
456
+ );
457
+ }
458
+ /**
459
+ * Validates a Passepartout access token and returns its attributes.
460
+ * Tokens owned by another tenant are reported as `{ active: false }`.
461
+ */
462
+ async introspect(accessToken, options) {
463
+ return this.http.post("/v1/passepartout/tokens/introspect", {
464
+ body: { access_token: accessToken },
465
+ ...options
466
+ });
467
+ }
468
+ };
469
+
331
470
  // src/resources/relay/messages.ts
332
471
  var MessagesResource = class {
333
472
  constructor(http) {
@@ -375,8 +514,10 @@ var Relay = class {
375
514
  // src/verne.ts
376
515
  var Verne = class {
377
516
  constructor(config) {
378
- if (!config.relay && !config.gate) {
379
- throw new VerneError("At least one service key (relay or gate) must be provided.");
517
+ if (!config.relay && !config.gate && !config.passepartout && !config.clockwork) {
518
+ throw new VerneError(
519
+ "At least one service key (relay, gate, passepartout, or clockwork) must be provided."
520
+ );
380
521
  }
381
522
  this.config = config;
382
523
  }
@@ -406,9 +547,37 @@ var Verne = class {
406
547
  }));
407
548
  return this._gate;
408
549
  }
550
+ get passepartout() {
551
+ if (!this.config.passepartout) {
552
+ throw new VerneError(
553
+ "Passepartout API key not provided. Pass `passepartout` in the Verne constructor config."
554
+ );
555
+ }
556
+ this._passepartout ?? (this._passepartout = new Passepartout({
557
+ apiKey: this.config.passepartout,
558
+ baseUrl: this.config.baseUrl,
559
+ timeoutMs: this.config.timeoutMs
560
+ }));
561
+ return this._passepartout;
562
+ }
563
+ get clockwork() {
564
+ if (!this.config.clockwork) {
565
+ throw new VerneError(
566
+ "Clockwork API key not provided. Pass `clockwork` in the Verne constructor config."
567
+ );
568
+ }
569
+ this._clockwork ?? (this._clockwork = new Clockwork({
570
+ apiKey: this.config.clockwork,
571
+ baseUrl: this.config.baseUrl,
572
+ timeoutMs: this.config.timeoutMs
573
+ }));
574
+ return this._clockwork;
575
+ }
409
576
  };
410
577
 
578
+ exports.Clockwork = Clockwork;
411
579
  exports.Gate = Gate;
580
+ exports.Passepartout = Passepartout;
412
581
  exports.Relay = Relay;
413
582
  exports.Verne = Verne;
414
583
  exports.VerneAPIError = VerneAPIError;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/core/errors.ts","../src/core/http.ts","../src/resources/gate/identities.ts","../src/resources/gate/settings.ts","../src/resources/gate/tokens.ts","../src/resources/gate/gate.ts","../src/resources/relay/messages.ts","../src/resources/relay/relay.ts","../src/verne.ts"],"names":[],"mappings":";;;AAGO,IAAM,UAAA,GAAN,cAAyB,KAAA,CAAM;AAAA,EACpC,YAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,YAAA;AAAA,EACd;AACF;AAMO,IAAM,aAAA,GAAN,MAAM,cAAA,SAAsB,UAAA,CAAW;AAAA,EAQ5C,WAAA,CAAY;AAAA,IACV,IAAA;AAAA,IACA,OAAA;AAAA,IACA,MAAA;AAAA,IACA;AAAA,GACF,EAKG;AACD,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,eAAA;AACZ,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AACZ,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AACd,IAAA,IAAA,CAAK,SAAA,GAAY,SAAA;AAAA,EACnB;AAAA,EAEA,OAAO,YAAA,CAAa,MAAA,EAAgB,IAAA,EAAmC;AACrE,IAAA,OAAO,IAAI,cAAA,CAAc;AAAA,MACvB,IAAA,EAAM,KAAK,KAAA,CAAM,IAAA;AAAA,MACjB,OAAA,EAAS,KAAK,KAAA,CAAM,OAAA;AAAA,MACpB,MAAA;AAAA,MACA,SAAA,EAAW,KAAK,KAAA,CAAM;AAAA,KACvB,CAAA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AAA,KACxB,CAAA,CAAA;AACD,IAAA,OAAO,IAAA,CAAK,KAAA;AAAA,EACd;AACF","file":"index.js","sourcesContent":["/**\n * Base class for all errors thrown by the Verne SDK.\n */\nexport class VerneError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'VerneError';\n }\n}\n\n/**\n * Thrown when the Verne API returns an error response.\n * Contains structured information from the API error envelope.\n */\nexport class VerneAPIError extends VerneError {\n /** Machine-readable error code (e.g. 'invalid_payload', 'unauthorized'). */\n readonly code: string;\n /** HTTP status code. */\n readonly status: number;\n /** Request ID to include when contacting support. */\n readonly requestId: string;\n\n constructor({\n code,\n message,\n status,\n requestId,\n }: {\n code: string;\n message: string;\n status: number;\n requestId: string;\n }) {\n super(message);\n this.name = 'VerneAPIError';\n this.code = code;\n this.status = status;\n this.requestId = requestId;\n }\n\n static fromResponse(status: number, body: APIErrorBody): VerneAPIError {\n return new VerneAPIError({\n code: body.error.code,\n message: body.error.message,\n status,\n requestId: body.error.request_id,\n });\n }\n}\n\n/** Shape of the API error envelope returned by all Verne services. */\nexport interface APIErrorBody {\n error: {\n code: string;\n message: string;\n request_id: string;\n };\n}\n","import { VerneAPIError, VerneError, type APIErrorBody } from './errors.js';\nimport type { RequestOptions } from './types.js';\n\nconst DEFAULT_BASE_URL = 'https://api.vernesoft.com';\nconst DEFAULT_TIMEOUT_MS = 30_000;\n\nexport interface HttpClientConfig {\n apiKey: string;\n baseUrl?: string;\n timeoutMs?: number;\n}\n\nexport interface HttpRequestOptions extends RequestOptions {\n /** When true, omit the Authorization header (used by gate.tokens.create). */\n skipAuth?: boolean;\n /** Body to send as JSON. */\n body?: unknown;\n}\n\nexport class HttpClient {\n private readonly apiKey: string;\n private readonly baseUrl: string;\n private readonly timeoutMs: number;\n\n constructor(config: HttpClientConfig) {\n this.apiKey = config.apiKey;\n this.baseUrl = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/$/, '');\n this.timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n }\n\n async get<T>(path: string, options?: HttpRequestOptions): Promise<T> {\n return this.request<T>('GET', path, options);\n }\n\n async post<T>(path: string, options?: HttpRequestOptions): Promise<T> {\n return this.request<T>('POST', path, options);\n }\n\n async put<T>(path: string, options?: HttpRequestOptions): Promise<T> {\n return this.request<T>('PUT', path, options);\n }\n\n async patch<T>(path: string, options?: HttpRequestOptions): Promise<T> {\n return this.request<T>('PATCH', path, options);\n }\n\n async delete<T>(path: string, options?: HttpRequestOptions): Promise<T> {\n return this.request<T>('DELETE', path, options);\n }\n\n private async request<T>(\n method: string,\n path: string,\n options: HttpRequestOptions = {},\n attempt = 1,\n ): Promise<T> {\n const { skipAuth, body, signal, headers: extraHeaders, timeoutMs } = options;\n\n const url = `${this.baseUrl}${path}`;\n const timeout = timeoutMs ?? this.timeoutMs;\n\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n ...extraHeaders,\n };\n\n if (!skipAuth) {\n headers['Authorization'] = `Bearer ${this.apiKey}`;\n }\n\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), timeout);\n\n // Allow external signal to also abort the request\n const combinedSignal = signal\n ? AbortSignal.any([signal, controller.signal])\n : controller.signal;\n\n let response: Response;\n try {\n response = await fetch(url, {\n method,\n headers,\n body: body !== undefined ? JSON.stringify(body) : undefined,\n signal: combinedSignal,\n });\n } catch (err) {\n clearTimeout(timeoutId);\n if (err instanceof Error && err.name === 'AbortError') {\n throw new VerneError(`Request timed out after ${timeout}ms: ${method} ${path}`);\n }\n throw new VerneError(`Network error: ${err instanceof Error ? err.message : String(err)}`);\n } finally {\n clearTimeout(timeoutId);\n }\n\n // Retry on 429 with Retry-After header (only one retry, only for send-type requests)\n if (response.status === 429 && attempt === 1 && method === 'POST') {\n const retryAfter = response.headers.get('Retry-After');\n const waitMs = retryAfter ? parseFloat(retryAfter) * 1000 : 1000;\n await sleep(waitMs);\n return this.request<T>(method, path, options, 2);\n }\n\n if (!response.ok) {\n let errorBody: APIErrorBody;\n try {\n errorBody = (await response.json()) as APIErrorBody;\n } catch {\n throw new VerneError(`HTTP ${response.status}: ${method} ${path}`);\n }\n throw VerneAPIError.fromResponse(response.status, errorBody);\n }\n\n // 204 No Content\n if (response.status === 204) {\n return undefined as T;\n }\n\n return response.json() as Promise<T>;\n }\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n","import type { HttpClient } from '../../core/http.js';\nimport type { RequestOptions } from '../../core/types.js';\nimport type { CreateIdentityParams, Identity, JsonPatchOp } from './types.js';\n\nexport class IdentitiesResource {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Creates a new identity (end-user) bound to your tenant.\n * The `traits.tenant_id` is injected automatically by the Edge Gateway.\n */\n async create(params: CreateIdentityParams, options?: RequestOptions): Promise<Identity> {\n return this.http.post<Identity>('/v1/gate/identities', { body: params, ...options });\n }\n\n /**\n * Returns an identity by ID.\n * The Gateway will reject the request if the identity does not belong to your tenant.\n */\n async get(identityId: string, options?: RequestOptions): Promise<Identity> {\n return this.http.get<Identity>(`/v1/gate/identities/${identityId}`, options);\n }\n\n /**\n * Partially updates an identity using a JSON Patch document (RFC 6902).\n *\n * @example\n * await gate.identities.patch('identity_123', [\n * { op: 'replace', path: '/traits/custom_data/role', value: 'admin' }\n * ]);\n */\n async patch(\n identityId: string,\n ops: JsonPatchOp[],\n options?: RequestOptions,\n ): Promise<Identity> {\n return this.http.patch<Identity>(`/v1/gate/identities/${identityId}`, {\n body: ops,\n ...options,\n });\n }\n\n /**\n * Deletes an identity from Kratos.\n * The Gateway will reject the request if the identity does not belong to your tenant.\n */\n async delete(identityId: string, options?: RequestOptions): Promise<void> {\n return this.http.delete<void>(`/v1/gate/identities/${identityId}`, options);\n }\n\n /**\n * Activates or deactivates an identity. An `inactive` identity cannot log in —\n * Kratos rejects its credentials automatically — until it is reactivated.\n * The identity is not deleted. Fires the `identity.state_changed` webhook event.\n *\n * @example\n * await gate.identities.setState('identity_123', 'inactive');\n */\n async setState(\n identityId: string,\n state: 'active' | 'inactive',\n options?: RequestOptions,\n ): Promise<Identity> {\n return this.http.patch<Identity>(`/v1/gate/identities/${identityId}/state`, {\n body: { state },\n ...options,\n });\n }\n\n /** Convenience wrapper for {@link setState}(identityId, 'active'). */\n async activate(identityId: string, options?: RequestOptions): Promise<Identity> {\n return this.setState(identityId, 'active', options);\n }\n\n /** Convenience wrapper for {@link setState}(identityId, 'inactive'). */\n async deactivate(identityId: string, options?: RequestOptions): Promise<Identity> {\n return this.setState(identityId, 'inactive', options);\n }\n\n /**\n * Triggers a new email verification flow for an identity — useful when the\n * original verification email expired or was never received. The user receives\n * a fresh verification email. Resolves on `204 No Content`.\n */\n async resendVerification(identityId: string, options?: RequestOptions): Promise<void> {\n return this.http.post<void>(\n `/v1/gate/identities/${identityId}/resend-verification`,\n options,\n );\n }\n}\n","import type { HttpClient } from '../../core/http.js';\nimport type { RequestOptions } from '../../core/types.js';\nimport type { OidcProvider, SecuritySettings } from './types.js';\n\nexport class SettingsResource {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Returns the tenant's security settings (passwordless / MFA).\n */\n async getSecurity(options?: RequestOptions): Promise<SecuritySettings> {\n return this.http.get<SecuritySettings>('/v1/gate/settings/security', options);\n }\n\n /**\n * Replaces the tenant's security settings. Both fields are required — the\n * update is a full replacement, not a merge.\n *\n * @example\n * await gate.settings.updateSecurity({ passwordless_enabled: true, mfa_enabled: false });\n */\n async updateSecurity(\n settings: SecuritySettings,\n options?: RequestOptions,\n ): Promise<void> {\n return this.http.put<void>('/v1/gate/settings/security', {\n body: settings,\n ...options,\n });\n }\n\n /**\n * Returns the tenant's social login (OIDC) providers and whether each is\n * enabled. Covers all providers Gate supports, regardless of state.\n */\n async getOidcProviders(options?: RequestOptions): Promise<OidcProvider[]> {\n const res = await this.http.get<{ providers: OidcProvider[] }>(\n '/v1/gate/settings/oidc-providers',\n options,\n );\n return res.providers;\n }\n\n /**\n * Sets the `enabled` flag for one or more social login providers. Any\n * provider omitted from `providers` is left unchanged. Returns the full,\n * updated provider list.\n *\n * @example\n * await gate.settings.updateOidcProviders([\n * { provider: 'github', enabled: true },\n * { provider: 'google', enabled: true },\n * ]);\n */\n async updateOidcProviders(\n providers: OidcProvider[],\n options?: RequestOptions,\n ): Promise<OidcProvider[]> {\n const res = await this.http.put<{ providers: OidcProvider[] }>(\n '/v1/gate/settings/oidc-providers',\n { body: { providers }, ...options },\n );\n return res.providers;\n }\n}\n","import type { HttpClient } from '../../core/http.js';\nimport type { RequestOptions } from '../../core/types.js';\nimport type { AccessToken, CreateTokenParams, IntrospectResult } from './types.js';\n\nexport class TokensResource {\n constructor(\n private readonly http: HttpClient,\n private readonly apiKey: string,\n ) {}\n\n /**\n * Exchanges the Gate API key for a short-lived access token.\n *\n * Note: This endpoint does not use the Authorization header — the API key\n * is passed in the request body per the Gate API specification.\n */\n async create(params: CreateTokenParams, options?: RequestOptions): Promise<AccessToken> {\n return this.http.post<AccessToken>('/v1/gate/tokens', {\n body: { api_key: this.apiKey, ...params },\n skipAuth: true,\n ...options,\n });\n }\n\n /**\n * Validates a Gate access token and returns its decoded attributes.\n */\n async introspect(accessToken: string, options?: RequestOptions): Promise<IntrospectResult> {\n return this.http.post<IntrospectResult>('/v1/gate/tokens/introspect', {\n body: { access_token: accessToken },\n ...options,\n });\n }\n}\n","import { HttpClient } from '../../core/http.js';\nimport type { RequestOptions, ServiceConfig } from '../../core/types.js';\nimport { IdentitiesResource } from './identities.js';\nimport { SettingsResource } from './settings.js';\nimport { TokensResource } from './tokens.js';\nimport type { AuthorizeParams, AuthorizeResult, LoginFlow } from './types.js';\n\nexport class Gate {\n readonly identities: IdentitiesResource;\n readonly tokens: TokensResource;\n readonly settings: SettingsResource;\n\n private readonly http: HttpClient;\n\n constructor(config: ServiceConfig) {\n this.http = new HttpClient({\n apiKey: config.apiKey,\n baseUrl: config.baseUrl,\n timeoutMs: config.timeoutMs,\n });\n this.identities = new IdentitiesResource(this.http);\n this.tokens = new TokensResource(this.http, config.apiKey);\n this.settings = new SettingsResource(this.http);\n }\n\n /**\n * Checks whether a given subject is allowed to perform an action on a resource.\n * This is the core building block for enforcing authorization in your services.\n *\n * @example\n * const result = await gate.authorize({\n * subject: 'usr_123',\n * action: 'relay.messages.read',\n * resource: 'tenant:ten_001',\n * });\n * if (!result.allowed) throw new Error('Forbidden');\n */\n async authorize(params: AuthorizeParams, options?: RequestOptions): Promise<AuthorizeResult> {\n return this.http.post<AuthorizeResult>('/v1/gate/authorize', { body: params, ...options });\n }\n\n /**\n * Returns the list of social login providers currently enabled for a tenant.\n * This is a public, unauthenticated endpoint — call it from your login /\n * registration page to decide which social buttons to render.\n *\n * @example\n * const providers = await gate.getEnabledProviders('ten_001');\n * // → ['github', 'google']\n */\n async getEnabledProviders(tenantId: string, options?: RequestOptions): Promise<string[]> {\n const res = await this.http.get<{ providers: string[] }>(\n `/public/gate/providers/${encodeURIComponent(tenantId)}`,\n { skipAuth: true, ...options },\n );\n return res.providers;\n }\n\n /**\n * Initializes a Kratos login flow using your Gate API key. Call this from\n * your server and pass the returned flow JSON to your browser-side code to\n * render social login buttons. The flow already contains only the providers\n * your tenant has enabled.\n *\n * @example\n * const flow = await gate.createLoginFlow();\n * // send `flow` to the browser as JSON\n */\n async createLoginFlow(options?: RequestOptions): Promise<LoginFlow> {\n return this.http.get<LoginFlow>('/v1/gate/auth/login', options);\n }\n}\n","import type { HttpClient } from '../../core/http.js';\nimport type { RequestOptions } from '../../core/types.js';\nimport type {\n ListMessagesParams,\n ListMessagesResponse,\n Message,\n SendMessageParams,\n} from './types.js';\n\nexport class MessagesResource {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Publish an event to all endpoints subscribed to the given event_type.\n * Automatically retries once on 429 (respects Retry-After header).\n *\n * @returns The accepted message with its assigned ID and timestamp.\n */\n async send(params: SendMessageParams, options?: RequestOptions): Promise<Message> {\n return this.http.post<Message>('/v1/relay/messages', { body: params, ...options });\n }\n\n /**\n * Returns a paginated list of previously sent events for the current tenant.\n */\n async list(params?: ListMessagesParams, options?: RequestOptions): Promise<ListMessagesResponse> {\n const query = buildQuery(params);\n const path = query ? `/v1/relay/messages?${query}` : '/v1/relay/messages';\n return this.http.get<ListMessagesResponse>(path, options);\n }\n}\n\nfunction buildQuery(params?: ListMessagesParams): string {\n if (!params) return '';\n const searchParams = new URLSearchParams();\n for (const [k, v] of Object.entries(params)) {\n if (v !== undefined) searchParams.set(k, String(v));\n }\n return searchParams.toString();\n}\n","import { HttpClient } from '../../core/http.js';\nimport type { ServiceConfig } from '../../core/types.js';\nimport { MessagesResource } from './messages.js';\n\nexport class Relay {\n readonly messages: MessagesResource;\n\n constructor(config: ServiceConfig) {\n const http = new HttpClient({\n apiKey: config.apiKey,\n baseUrl: config.baseUrl,\n timeoutMs: config.timeoutMs,\n });\n this.messages = new MessagesResource(http);\n }\n}\n","import { VerneError } from './core/errors.js';\nimport type { VerneConfig } from './core/types.js';\nimport { Gate } from './resources/gate/gate.js';\nimport { Relay } from './resources/relay/relay.js';\n\nexport class Verne {\n private readonly config: VerneConfig;\n private _relay?: Relay;\n private _gate?: Gate;\n\n constructor(config: VerneConfig) {\n if (!config.relay && !config.gate) {\n throw new VerneError('At least one service key (relay or gate) must be provided.');\n }\n this.config = config;\n }\n\n get relay(): Relay {\n if (!this.config.relay) {\n throw new VerneError(\n 'Relay API key not provided. Pass `relay` in the Verne constructor config.',\n );\n }\n this._relay ??= new Relay({\n apiKey: this.config.relay,\n baseUrl: this.config.baseUrl,\n timeoutMs: this.config.timeoutMs,\n });\n return this._relay;\n }\n\n get gate(): Gate {\n if (!this.config.gate) {\n throw new VerneError(\n 'Gate API key not provided. Pass `gate` in the Verne constructor config.',\n );\n }\n this._gate ??= new Gate({\n apiKey: this.config.gate,\n baseUrl: this.config.baseUrl,\n timeoutMs: this.config.timeoutMs,\n });\n return this._gate;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/core/errors.ts","../src/core/http.ts","../src/resources/clockwork/delayed.ts","../src/resources/clockwork/jobs.ts","../src/resources/clockwork/clockwork.ts","../src/resources/gate/identities.ts","../src/resources/gate/settings.ts","../src/resources/gate/tokens.ts","../src/resources/gate/gate.ts","../src/resources/passepartout/passepartout.ts","../src/resources/relay/messages.ts","../src/resources/relay/relay.ts","../src/verne.ts"],"names":[],"mappings":";;;AAGO,IAAM,UAAA,GAAN,cAAyB,KAAA,CAAM;AAAA,EACpC,YAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,YAAA;AAAA,EACd;AACF;AAMO,IAAM,aAAA,GAAN,MAAM,cAAA,SAAsB,UAAA,CAAW;AAAA,EAQ5C,WAAA,CAAY;AAAA,IACV,IAAA;AAAA,IACA,OAAA;AAAA,IACA,MAAA;AAAA,IACA;AAAA,GACF,EAKG;AACD,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,eAAA;AACZ,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AACZ,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AACd,IAAA,IAAA,CAAK,SAAA,GAAY,SAAA;AAAA,EACnB;AAAA,EAEA,OAAO,YAAA,CAAa,MAAA,EAAgB,IAAA,EAAmC;AACrE,IAAA,OAAO,IAAI,cAAA,CAAc;AAAA,MACvB,IAAA,EAAM,KAAK,KAAA,CAAM,IAAA;AAAA,MACjB,OAAA,EAAS,KAAK,KAAA,CAAM,OAAA;AAAA,MACpB,MAAA;AAAA,MACA,SAAA,EAAW,KAAK,KAAA,CAAM;AAAA,KACvB,CAAA;AAAA,EACH;AACF;;;AC7CA,IAAM,gBAAA,GAAmB,2BAAA;AACzB,IAAM,kBAAA,GAAqB,GAAA;AAepB,IAAM,aAAN,MAAiB;AAAA,EAKtB,YAAY,MAAA,EAA0B;AACpC,IAAA,IAAA,CAAK,SAAS,MAAA,CAAO,MAAA;AACrB,IAAA,IAAA,CAAK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AA,OAAO,IAAA,CAAK,aAAA;AAAA,EACd;AAAA,EAEA,IAAI,SAAA,GAAuB;AACzB,IAAA,IAAI,CAAC,IAAA,CAAK,MAAA,CAAO,SAAA,EAAW;AAC1B,MAAA,MAAM,IAAI,UAAA;AAAA,QACR;AAAA,OACF;AAAA,IACF;AACA,IAAA,IAAA,CAAK,UAAA,KAAL,IAAA,CAAK,UAAA,GAAe,IAAI,SAAA,CAAU;AAAA,MAChC,MAAA,EAAQ,KAAK,MAAA,CAAO,SAAA;AAAA,MACpB,OAAA,EAAS,KAAK,MAAA,CAAO,OAAA;AAAA,MACrB,SAAA,EAAW,KAAK,MAAA,CAAO;AAAA,KACxB,CAAA,CAAA;AACD,IAAA,OAAO,IAAA,CAAK,UAAA;AAAA,EACd;AACF","file":"index.js","sourcesContent":["/**\n * Base class for all errors thrown by the Verne SDK.\n */\nexport class VerneError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'VerneError';\n }\n}\n\n/**\n * Thrown when the Verne API returns an error response.\n * Contains structured information from the API error envelope.\n */\nexport class VerneAPIError extends VerneError {\n /** Machine-readable error code (e.g. 'invalid_payload', 'unauthorized'). */\n readonly code: string;\n /** HTTP status code. */\n readonly status: number;\n /** Request ID to include when contacting support. */\n readonly requestId: string;\n\n constructor({\n code,\n message,\n status,\n requestId,\n }: {\n code: string;\n message: string;\n status: number;\n requestId: string;\n }) {\n super(message);\n this.name = 'VerneAPIError';\n this.code = code;\n this.status = status;\n this.requestId = requestId;\n }\n\n static fromResponse(status: number, body: APIErrorBody): VerneAPIError {\n return new VerneAPIError({\n code: body.error.code,\n message: body.error.message,\n status,\n requestId: body.error.request_id,\n });\n }\n}\n\n/** Shape of the API error envelope returned by all Verne services. */\nexport interface APIErrorBody {\n error: {\n code: string;\n message: string;\n request_id: string;\n };\n}\n","import { VerneAPIError, VerneError, type APIErrorBody } from './errors.js';\nimport type { RequestOptions } from './types.js';\n\nconst DEFAULT_BASE_URL = 'https://api.vernesoft.com';\nconst DEFAULT_TIMEOUT_MS = 30_000;\n\nexport interface HttpClientConfig {\n apiKey: string;\n baseUrl?: string;\n timeoutMs?: number;\n}\n\nexport interface HttpRequestOptions extends RequestOptions {\n /** When true, omit the Authorization header (used by gate.tokens.create). */\n skipAuth?: boolean;\n /** Body to send as JSON. */\n body?: unknown;\n}\n\nexport class HttpClient {\n private readonly apiKey: string;\n private readonly baseUrl: string;\n private readonly timeoutMs: number;\n\n constructor(config: HttpClientConfig) {\n this.apiKey = config.apiKey;\n this.baseUrl = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/$/, '');\n this.timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n }\n\n async get<T>(path: string, options?: HttpRequestOptions): Promise<T> {\n return this.request<T>('GET', path, options);\n }\n\n async post<T>(path: string, options?: HttpRequestOptions): Promise<T> {\n return this.request<T>('POST', path, options);\n }\n\n async put<T>(path: string, options?: HttpRequestOptions): Promise<T> {\n return this.request<T>('PUT', path, options);\n }\n\n async patch<T>(path: string, options?: HttpRequestOptions): Promise<T> {\n return this.request<T>('PATCH', path, options);\n }\n\n async delete<T>(path: string, options?: HttpRequestOptions): Promise<T> {\n return this.request<T>('DELETE', path, options);\n }\n\n private async request<T>(\n method: string,\n path: string,\n options: HttpRequestOptions = {},\n attempt = 1,\n ): Promise<T> {\n const { skipAuth, body, signal, headers: extraHeaders, timeoutMs } = options;\n\n const url = `${this.baseUrl}${path}`;\n const timeout = timeoutMs ?? this.timeoutMs;\n\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n ...extraHeaders,\n };\n\n if (!skipAuth) {\n headers['Authorization'] = `Bearer ${this.apiKey}`;\n }\n\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), timeout);\n\n // Allow external signal to also abort the request\n const combinedSignal = signal\n ? AbortSignal.any([signal, controller.signal])\n : controller.signal;\n\n let response: Response;\n try {\n response = await fetch(url, {\n method,\n headers,\n body: body !== undefined ? JSON.stringify(body) : undefined,\n signal: combinedSignal,\n });\n } catch (err) {\n clearTimeout(timeoutId);\n if (err instanceof Error && err.name === 'AbortError') {\n throw new VerneError(`Request timed out after ${timeout}ms: ${method} ${path}`);\n }\n throw new VerneError(`Network error: ${err instanceof Error ? err.message : String(err)}`);\n } finally {\n clearTimeout(timeoutId);\n }\n\n // Retry on 429 with Retry-After header (only one retry, only for send-type requests)\n if (response.status === 429 && attempt === 1 && method === 'POST') {\n const retryAfter = response.headers.get('Retry-After');\n const waitMs = retryAfter ? parseFloat(retryAfter) * 1000 : 1000;\n await sleep(waitMs);\n return this.request<T>(method, path, options, 2);\n }\n\n if (!response.ok) {\n let errorBody: APIErrorBody;\n try {\n errorBody = (await response.json()) as APIErrorBody;\n } catch {\n throw new VerneError(`HTTP ${response.status}: ${method} ${path}`);\n }\n throw VerneAPIError.fromResponse(response.status, errorBody);\n }\n\n // 204 No Content\n if (response.status === 204) {\n return undefined as T;\n }\n\n return response.json() as Promise<T>;\n }\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n","import type { HttpClient } from '../../core/http.js';\nimport type { RequestOptions } from '../../core/types.js';\nimport type { CreateDelayedJobParams, DelayedJob, Execution } from './types.js';\n\nexport class ClockworkDelayedResource {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Returns all delayed (one-shot) jobs for the current tenant.\n */\n async list(options?: RequestOptions): Promise<DelayedJob[]> {\n return this.http.get<DelayedJob[]>('/v1/clockwork/delayed', options);\n }\n\n /**\n * Schedules a new delayed job to run once at the given `run_at` time.\n *\n * @example\n * const job = await clockwork.delayed.create({\n * name: 'send-reminder',\n * run_at: '2026-01-01T09:00:00Z',\n * url: 'https://example.com/hooks/reminder',\n * });\n */\n async create(params: CreateDelayedJobParams, options?: RequestOptions): Promise<DelayedJob> {\n return this.http.post<DelayedJob>('/v1/clockwork/delayed', { body: params, ...options });\n }\n\n /**\n * Cancels a pending delayed job. Resolves on `204 No Content`.\n */\n async cancel(jobId: string, options?: RequestOptions): Promise<void> {\n return this.http.delete<void>(`/v1/clockwork/delayed/${jobId}`, options);\n }\n\n /**\n * Returns the execution history for a delayed job.\n */\n async executions(jobId: string, options?: RequestOptions): Promise<Execution[]> {\n return this.http.get<Execution[]>(`/v1/clockwork/delayed/${jobId}/executions`, options);\n }\n}\n","import type { HttpClient } from '../../core/http.js';\nimport type { RequestOptions } from '../../core/types.js';\nimport type { CreateCronJobParams, CronJob, Execution, UpdateCronJobParams } from './types.js';\n\nexport class ClockworkJobsResource {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Returns all cron jobs for the current tenant.\n */\n async list(options?: RequestOptions): Promise<CronJob[]> {\n return this.http.get<CronJob[]>('/v1/clockwork/jobs', options);\n }\n\n /**\n * Creates a new recurring cron job.\n *\n * @example\n * const job = await clockwork.jobs.create({\n * name: 'nightly-report',\n * schedule: '0 2 * * *',\n * url: 'https://example.com/hooks/report',\n * });\n */\n async create(params: CreateCronJobParams, options?: RequestOptions): Promise<CronJob> {\n return this.http.post<CronJob>('/v1/clockwork/jobs', { body: params, ...options });\n }\n\n /**\n * Partially updates an existing cron job. Only the fields you provide are changed.\n */\n async update(\n jobId: string,\n params: UpdateCronJobParams,\n options?: RequestOptions,\n ): Promise<CronJob> {\n return this.http.patch<CronJob>(`/v1/clockwork/jobs/${jobId}`, { body: params, ...options });\n }\n\n /**\n * Deletes a cron job. Resolves on `204 No Content`.\n */\n async delete(jobId: string, options?: RequestOptions): Promise<void> {\n return this.http.delete<void>(`/v1/clockwork/jobs/${jobId}`, options);\n }\n\n /**\n * Returns the execution history for a cron job (most recent runs first).\n */\n async executions(jobId: string, options?: RequestOptions): Promise<Execution[]> {\n return this.http.get<Execution[]>(`/v1/clockwork/jobs/${jobId}/executions`, options);\n }\n}\n","import { HttpClient } from '../../core/http.js';\nimport type { ServiceConfig } from '../../core/types.js';\nimport { ClockworkDelayedResource } from './delayed.js';\nimport { ClockworkJobsResource } from './jobs.js';\n\nexport class Clockwork {\n readonly jobs: ClockworkJobsResource;\n readonly delayed: ClockworkDelayedResource;\n\n private readonly http: HttpClient;\n\n constructor(config: ServiceConfig) {\n this.http = new HttpClient({\n apiKey: config.apiKey,\n baseUrl: config.baseUrl,\n timeoutMs: config.timeoutMs,\n });\n this.jobs = new ClockworkJobsResource(this.http);\n this.delayed = new ClockworkDelayedResource(this.http);\n }\n}\n","import type { HttpClient } from '../../core/http.js';\nimport type { RequestOptions } from '../../core/types.js';\nimport type { CreateIdentityParams, Identity, JsonPatchOp } from './types.js';\n\nexport class IdentitiesResource {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Creates a new identity (end-user) bound to your tenant.\n * The `traits.tenant_id` is injected automatically by the Edge Gateway.\n */\n async create(params: CreateIdentityParams, options?: RequestOptions): Promise<Identity> {\n return this.http.post<Identity>('/v1/gate/identities', { body: params, ...options });\n }\n\n /**\n * Returns an identity by ID.\n * The Gateway will reject the request if the identity does not belong to your tenant.\n */\n async get(identityId: string, options?: RequestOptions): Promise<Identity> {\n return this.http.get<Identity>(`/v1/gate/identities/${identityId}`, options);\n }\n\n /**\n * Partially updates an identity using a JSON Patch document (RFC 6902).\n *\n * @example\n * await gate.identities.patch('identity_123', [\n * { op: 'replace', path: '/traits/custom_data/role', value: 'admin' }\n * ]);\n */\n async patch(\n identityId: string,\n ops: JsonPatchOp[],\n options?: RequestOptions,\n ): Promise<Identity> {\n return this.http.patch<Identity>(`/v1/gate/identities/${identityId}`, {\n body: ops,\n ...options,\n });\n }\n\n /**\n * Deletes an identity from Kratos.\n * The Gateway will reject the request if the identity does not belong to your tenant.\n */\n async delete(identityId: string, options?: RequestOptions): Promise<void> {\n return this.http.delete<void>(`/v1/gate/identities/${identityId}`, options);\n }\n\n /**\n * Activates or deactivates an identity. An `inactive` identity cannot log in —\n * Kratos rejects its credentials automatically — until it is reactivated.\n * The identity is not deleted. Fires the `identity.state_changed` webhook event.\n *\n * @example\n * await gate.identities.setState('identity_123', 'inactive');\n */\n async setState(\n identityId: string,\n state: 'active' | 'inactive',\n options?: RequestOptions,\n ): Promise<Identity> {\n return this.http.patch<Identity>(`/v1/gate/identities/${identityId}/state`, {\n body: { state },\n ...options,\n });\n }\n\n /** Convenience wrapper for {@link setState}(identityId, 'active'). */\n async activate(identityId: string, options?: RequestOptions): Promise<Identity> {\n return this.setState(identityId, 'active', options);\n }\n\n /** Convenience wrapper for {@link setState}(identityId, 'inactive'). */\n async deactivate(identityId: string, options?: RequestOptions): Promise<Identity> {\n return this.setState(identityId, 'inactive', options);\n }\n\n /**\n * Triggers a new email verification flow for an identity — useful when the\n * original verification email expired or was never received. The user receives\n * a fresh verification email. Resolves on `204 No Content`.\n */\n async resendVerification(identityId: string, options?: RequestOptions): Promise<void> {\n return this.http.post<void>(\n `/v1/gate/identities/${identityId}/resend-verification`,\n options,\n );\n }\n}\n","import type { HttpClient } from '../../core/http.js';\nimport type { RequestOptions } from '../../core/types.js';\nimport type { OidcProvider, SecuritySettings } from './types.js';\n\nexport class SettingsResource {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Returns the tenant's security settings (passwordless / MFA).\n */\n async getSecurity(options?: RequestOptions): Promise<SecuritySettings> {\n return this.http.get<SecuritySettings>('/v1/gate/settings/security', options);\n }\n\n /**\n * Replaces the tenant's security settings. Both fields are required — the\n * update is a full replacement, not a merge.\n *\n * @example\n * await gate.settings.updateSecurity({ passwordless_enabled: true, mfa_enabled: false });\n */\n async updateSecurity(\n settings: SecuritySettings,\n options?: RequestOptions,\n ): Promise<void> {\n return this.http.put<void>('/v1/gate/settings/security', {\n body: settings,\n ...options,\n });\n }\n\n /**\n * Returns the tenant's social login (OIDC) providers and whether each is\n * enabled. Covers all providers Gate supports, regardless of state.\n */\n async getOidcProviders(options?: RequestOptions): Promise<OidcProvider[]> {\n const res = await this.http.get<{ providers: OidcProvider[] }>(\n '/v1/gate/settings/oidc-providers',\n options,\n );\n return res.providers;\n }\n\n /**\n * Sets the `enabled` flag for one or more social login providers. Any\n * provider omitted from `providers` is left unchanged. Returns the full,\n * updated provider list.\n *\n * @example\n * await gate.settings.updateOidcProviders([\n * { provider: 'github', enabled: true },\n * { provider: 'google', enabled: true },\n * ]);\n */\n async updateOidcProviders(\n providers: OidcProvider[],\n options?: RequestOptions,\n ): Promise<OidcProvider[]> {\n const res = await this.http.put<{ providers: OidcProvider[] }>(\n '/v1/gate/settings/oidc-providers',\n { body: { providers }, ...options },\n );\n return res.providers;\n }\n}\n","import type { HttpClient } from '../../core/http.js';\nimport type { RequestOptions } from '../../core/types.js';\nimport type { AccessToken, CreateTokenParams, IntrospectResult } from './types.js';\n\nexport class TokensResource {\n constructor(\n private readonly http: HttpClient,\n private readonly apiKey: string,\n ) {}\n\n /**\n * Exchanges the Gate API key for a short-lived access token.\n *\n * Note: This endpoint does not use the Authorization header — the API key\n * is passed in the request body per the Gate API specification.\n */\n async create(params: CreateTokenParams, options?: RequestOptions): Promise<AccessToken> {\n return this.http.post<AccessToken>('/v1/gate/tokens', {\n body: { api_key: this.apiKey, ...params },\n skipAuth: true,\n ...options,\n });\n }\n\n /**\n * Validates a Gate access token and returns its decoded attributes.\n */\n async introspect(accessToken: string, options?: RequestOptions): Promise<IntrospectResult> {\n return this.http.post<IntrospectResult>('/v1/gate/tokens/introspect', {\n body: { access_token: accessToken },\n ...options,\n });\n }\n}\n","import { HttpClient } from '../../core/http.js';\nimport type { RequestOptions, ServiceConfig } from '../../core/types.js';\nimport { IdentitiesResource } from './identities.js';\nimport { SettingsResource } from './settings.js';\nimport { TokensResource } from './tokens.js';\nimport type { AuthorizeParams, AuthorizeResult, LoginFlow } from './types.js';\n\nexport class Gate {\n readonly identities: IdentitiesResource;\n readonly tokens: TokensResource;\n readonly settings: SettingsResource;\n\n private readonly http: HttpClient;\n\n constructor(config: ServiceConfig) {\n this.http = new HttpClient({\n apiKey: config.apiKey,\n baseUrl: config.baseUrl,\n timeoutMs: config.timeoutMs,\n });\n this.identities = new IdentitiesResource(this.http);\n this.tokens = new TokensResource(this.http, config.apiKey);\n this.settings = new SettingsResource(this.http);\n }\n\n /**\n * Checks whether a given subject is allowed to perform an action on a resource.\n * This is the core building block for enforcing authorization in your services.\n *\n * @example\n * const result = await gate.authorize({\n * subject: 'usr_123',\n * action: 'relay.messages.read',\n * resource: 'tenant:ten_001',\n * });\n * if (!result.allowed) throw new Error('Forbidden');\n */\n async authorize(params: AuthorizeParams, options?: RequestOptions): Promise<AuthorizeResult> {\n return this.http.post<AuthorizeResult>('/v1/gate/authorize', { body: params, ...options });\n }\n\n /**\n * Returns the list of social login providers currently enabled for a tenant.\n * This is a public, unauthenticated endpoint — call it from your login /\n * registration page to decide which social buttons to render.\n *\n * @example\n * const providers = await gate.getEnabledProviders('ten_001');\n * // → ['github', 'google']\n */\n async getEnabledProviders(tenantId: string, options?: RequestOptions): Promise<string[]> {\n const res = await this.http.get<{ providers: string[] }>(\n `/public/gate/providers/${encodeURIComponent(tenantId)}`,\n { skipAuth: true, ...options },\n );\n return res.providers;\n }\n\n /**\n * Initializes a Kratos login flow using your Gate API key. Call this from\n * your server and pass the returned flow JSON to your browser-side code to\n * render social login buttons. The flow already contains only the providers\n * your tenant has enabled.\n *\n * @example\n * const flow = await gate.createLoginFlow();\n * // send `flow` to the browser as JSON\n */\n async createLoginFlow(options?: RequestOptions): Promise<LoginFlow> {\n return this.http.get<LoginFlow>('/v1/gate/auth/login', options);\n }\n}\n","import { HttpClient } from '../../core/http.js';\nimport type { RequestOptions, ServiceConfig } from '../../core/types.js';\nimport type { LoginStart, LoginStatus, TokenIntrospection } from './types.js';\n\n/**\n * Verne Passepartout — Telegram Auth-as-a-Service.\n *\n * Lets your end-users sign in with Telegram: start a login to get a deep link,\n * send the user to it, then poll for completion to receive an access token.\n */\nexport class Passepartout {\n private readonly http: HttpClient;\n\n constructor(config: ServiceConfig) {\n this.http = new HttpClient({\n apiKey: config.apiKey,\n baseUrl: config.baseUrl,\n timeoutMs: config.timeoutMs,\n });\n }\n\n /**\n * Starts a Telegram login and returns a nonce + deep link. Send the user to\n * `deep_link`, then poll {@link loginStatus} with `nonce` until it completes.\n *\n * @example\n * const { nonce, deep_link } = await passepartout.loginStart();\n * // redirect the user to `deep_link`, then poll:\n * const status = await passepartout.loginStatus(nonce);\n */\n async loginStart(options?: RequestOptions): Promise<LoginStart> {\n return this.http.post<LoginStart>('/v1/passepartout/login/start', options);\n }\n\n /**\n * Returns the current state of a login attempt. While the user hasn't\n * finished, `status` is `pending`; once done it becomes `completed` and\n * carries the `access_token` and `user`.\n */\n async loginStatus(nonce: string, options?: RequestOptions): Promise<LoginStatus> {\n return this.http.get<LoginStatus>(\n `/v1/passepartout/login/status?nonce=${encodeURIComponent(nonce)}`,\n options,\n );\n }\n\n /**\n * Validates a Passepartout access token and returns its attributes.\n * Tokens owned by another tenant are reported as `{ active: false }`.\n */\n async introspect(accessToken: string, options?: RequestOptions): Promise<TokenIntrospection> {\n return this.http.post<TokenIntrospection>('/v1/passepartout/tokens/introspect', {\n body: { access_token: accessToken },\n ...options,\n });\n }\n}\n","import type { HttpClient } from '../../core/http.js';\nimport type { RequestOptions } from '../../core/types.js';\nimport type {\n ListMessagesParams,\n ListMessagesResponse,\n Message,\n SendMessageParams,\n} from './types.js';\n\nexport class MessagesResource {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Publish an event to all endpoints subscribed to the given event_type.\n * Automatically retries once on 429 (respects Retry-After header).\n *\n * @returns The accepted message with its assigned ID and timestamp.\n */\n async send(params: SendMessageParams, options?: RequestOptions): Promise<Message> {\n return this.http.post<Message>('/v1/relay/messages', { body: params, ...options });\n }\n\n /**\n * Returns a paginated list of previously sent events for the current tenant.\n */\n async list(params?: ListMessagesParams, options?: RequestOptions): Promise<ListMessagesResponse> {\n const query = buildQuery(params);\n const path = query ? `/v1/relay/messages?${query}` : '/v1/relay/messages';\n return this.http.get<ListMessagesResponse>(path, options);\n }\n}\n\nfunction buildQuery(params?: ListMessagesParams): string {\n if (!params) return '';\n const searchParams = new URLSearchParams();\n for (const [k, v] of Object.entries(params)) {\n if (v !== undefined) searchParams.set(k, String(v));\n }\n return searchParams.toString();\n}\n","import { HttpClient } from '../../core/http.js';\nimport type { ServiceConfig } from '../../core/types.js';\nimport { MessagesResource } from './messages.js';\n\nexport class Relay {\n readonly messages: MessagesResource;\n\n constructor(config: ServiceConfig) {\n const http = new HttpClient({\n apiKey: config.apiKey,\n baseUrl: config.baseUrl,\n timeoutMs: config.timeoutMs,\n });\n this.messages = new MessagesResource(http);\n }\n}\n","import { VerneError } from './core/errors.js';\nimport type { VerneConfig } from './core/types.js';\nimport { Clockwork } from './resources/clockwork/clockwork.js';\nimport { Gate } from './resources/gate/gate.js';\nimport { Passepartout } from './resources/passepartout/passepartout.js';\nimport { Relay } from './resources/relay/relay.js';\n\nexport class Verne {\n private readonly config: VerneConfig;\n private _relay?: Relay;\n private _gate?: Gate;\n private _passepartout?: Passepartout;\n private _clockwork?: Clockwork;\n\n constructor(config: VerneConfig) {\n if (!config.relay && !config.gate && !config.passepartout && !config.clockwork) {\n throw new VerneError(\n 'At least one service key (relay, gate, passepartout, or clockwork) must be provided.',\n );\n }\n this.config = config;\n }\n\n get relay(): Relay {\n if (!this.config.relay) {\n throw new VerneError(\n 'Relay API key not provided. Pass `relay` in the Verne constructor config.',\n );\n }\n this._relay ??= new Relay({\n apiKey: this.config.relay,\n baseUrl: this.config.baseUrl,\n timeoutMs: this.config.timeoutMs,\n });\n return this._relay;\n }\n\n get gate(): Gate {\n if (!this.config.gate) {\n throw new VerneError(\n 'Gate API key not provided. Pass `gate` in the Verne constructor config.',\n );\n }\n this._gate ??= new Gate({\n apiKey: this.config.gate,\n baseUrl: this.config.baseUrl,\n timeoutMs: this.config.timeoutMs,\n });\n return this._gate;\n }\n\n get passepartout(): Passepartout {\n if (!this.config.passepartout) {\n throw new VerneError(\n 'Passepartout API key not provided. Pass `passepartout` in the Verne constructor config.',\n );\n }\n this._passepartout ??= new Passepartout({\n apiKey: this.config.passepartout,\n baseUrl: this.config.baseUrl,\n timeoutMs: this.config.timeoutMs,\n });\n return this._passepartout;\n }\n\n get clockwork(): Clockwork {\n if (!this.config.clockwork) {\n throw new VerneError(\n 'Clockwork API key not provided. Pass `clockwork` in the Verne constructor config.',\n );\n }\n this._clockwork ??= new Clockwork({\n apiKey: this.config.clockwork,\n baseUrl: this.config.baseUrl,\n timeoutMs: this.config.timeoutMs,\n });\n return this._clockwork;\n }\n}\n"]}
package/dist/index.mjs CHANGED
@@ -108,6 +108,101 @@ function sleep(ms) {
108
108
  return new Promise((resolve) => setTimeout(resolve, ms));
109
109
  }
110
110
 
111
+ // src/resources/clockwork/delayed.ts
112
+ var ClockworkDelayedResource = class {
113
+ constructor(http) {
114
+ this.http = http;
115
+ }
116
+ /**
117
+ * Returns all delayed (one-shot) jobs for the current tenant.
118
+ */
119
+ async list(options) {
120
+ return this.http.get("/v1/clockwork/delayed", options);
121
+ }
122
+ /**
123
+ * Schedules a new delayed job to run once at the given `run_at` time.
124
+ *
125
+ * @example
126
+ * const job = await clockwork.delayed.create({
127
+ * name: 'send-reminder',
128
+ * run_at: '2026-01-01T09:00:00Z',
129
+ * url: 'https://example.com/hooks/reminder',
130
+ * });
131
+ */
132
+ async create(params, options) {
133
+ return this.http.post("/v1/clockwork/delayed", { body: params, ...options });
134
+ }
135
+ /**
136
+ * Cancels a pending delayed job. Resolves on `204 No Content`.
137
+ */
138
+ async cancel(jobId, options) {
139
+ return this.http.delete(`/v1/clockwork/delayed/${jobId}`, options);
140
+ }
141
+ /**
142
+ * Returns the execution history for a delayed job.
143
+ */
144
+ async executions(jobId, options) {
145
+ return this.http.get(`/v1/clockwork/delayed/${jobId}/executions`, options);
146
+ }
147
+ };
148
+
149
+ // src/resources/clockwork/jobs.ts
150
+ var ClockworkJobsResource = class {
151
+ constructor(http) {
152
+ this.http = http;
153
+ }
154
+ /**
155
+ * Returns all cron jobs for the current tenant.
156
+ */
157
+ async list(options) {
158
+ return this.http.get("/v1/clockwork/jobs", options);
159
+ }
160
+ /**
161
+ * Creates a new recurring cron job.
162
+ *
163
+ * @example
164
+ * const job = await clockwork.jobs.create({
165
+ * name: 'nightly-report',
166
+ * schedule: '0 2 * * *',
167
+ * url: 'https://example.com/hooks/report',
168
+ * });
169
+ */
170
+ async create(params, options) {
171
+ return this.http.post("/v1/clockwork/jobs", { body: params, ...options });
172
+ }
173
+ /**
174
+ * Partially updates an existing cron job. Only the fields you provide are changed.
175
+ */
176
+ async update(jobId, params, options) {
177
+ return this.http.patch(`/v1/clockwork/jobs/${jobId}`, { body: params, ...options });
178
+ }
179
+ /**
180
+ * Deletes a cron job. Resolves on `204 No Content`.
181
+ */
182
+ async delete(jobId, options) {
183
+ return this.http.delete(`/v1/clockwork/jobs/${jobId}`, options);
184
+ }
185
+ /**
186
+ * Returns the execution history for a cron job (most recent runs first).
187
+ */
188
+ async executions(jobId, options) {
189
+ return this.http.get(`/v1/clockwork/jobs/${jobId}/executions`, options);
190
+ }
191
+ };
192
+
193
+ // src/resources/clockwork/clockwork.ts
194
+ var Clockwork = class {
195
+ constructor(config) {
196
+ this.http = new HttpClient({
197
+ apiKey: config.apiKey,
198
+ baseUrl: config.baseUrl,
199
+ timeoutMs: config.timeoutMs
200
+ });
201
+ this.jobs = new ClockworkJobsResource(this.http);
202
+ this.delayed = new ClockworkDelayedResource(this.http);
203
+ }
204
+ };
205
+
111
206
  // src/resources/gate/identities.ts
112
207
  var IdentitiesResource = class {
113
208
  constructor(http) {
@@ -326,6 +421,50 @@ var Gate = class {
326
421
  }
327
422
  };
328
423
 
424
+ // src/resources/passepartout/passepartout.ts
425
+ var Passepartout = class {
426
+ constructor(config) {
427
+ this.http = new HttpClient({
428
+ apiKey: config.apiKey,
429
+ baseUrl: config.baseUrl,
430
+ timeoutMs: config.timeoutMs
431
+ });
432
+ }
433
+ /**
434
+ * Starts a Telegram login and returns a nonce + deep link. Send the user to
435
+ * `deep_link`, then poll {@link loginStatus} with `nonce` until it completes.
436
+ *
437
+ * @example
438
+ * const { nonce, deep_link } = await passepartout.loginStart();
439
+ * // redirect the user to `deep_link`, then poll:
440
+ * const status = await passepartout.loginStatus(nonce);
441
+ */
442
+ async loginStart(options) {
443
+ return this.http.post("/v1/passepartout/login/start", options);
444
+ }
445
+ /**
446
+ * Returns the current state of a login attempt. While the user hasn't
447
+ * finished, `status` is `pending`; once done it becomes `completed` and
448
+ * carries the `access_token` and `user`.
449
+ */
450
+ async loginStatus(nonce, options) {
451
+ return this.http.get(
452
+ `/v1/passepartout/login/status?nonce=${encodeURIComponent(nonce)}`,
453
+ options
454
+ );
455
+ }
456
+ /**
457
+ * Validates a Passepartout access token and returns its attributes.
458
+ * Tokens owned by another tenant are reported as `{ active: false }`.
459
+ */
460
+ async introspect(accessToken, options) {
461
+ return this.http.post("/v1/passepartout/tokens/introspect", {
462
+ body: { access_token: accessToken },
463
+ ...options
464
+ });
465
+ }
466
+ };
467
+
329
468
  // src/resources/relay/messages.ts
330
469
  var MessagesResource = class {
331
470
  constructor(http) {
@@ -373,8 +512,10 @@ var Relay = class {
373
512
  // src/verne.ts
374
513
  var Verne = class {
375
514
  constructor(config) {
376
- if (!config.relay && !config.gate) {
377
- throw new VerneError("At least one service key (relay or gate) must be provided.");
515
+ if (!config.relay && !config.gate && !config.passepartout && !config.clockwork) {
516
+ throw new VerneError(
517
+ "At least one service key (relay, gate, passepartout, or clockwork) must be provided."
518
+ );
378
519
  }
379
520
  this.config = config;
380
521
  }
@@ -404,8 +545,34 @@ var Verne = class {
404
545
  }));
405
546
  return this._gate;
406
547
  }
548
+ get passepartout() {
549
+ if (!this.config.passepartout) {
550
+ throw new VerneError(
551
+ "Passepartout API key not provided. Pass `passepartout` in the Verne constructor config."
552
+ );
553
+ }
554
+ this._passepartout ?? (this._passepartout = new Passepartout({
555
+ apiKey: this.config.passepartout,
556
+ baseUrl: this.config.baseUrl,
557
+ timeoutMs: this.config.timeoutMs
558
+ }));
559
+ return this._passepartout;
560
+ }
561
+ get clockwork() {
562
+ if (!this.config.clockwork) {
563
+ throw new VerneError(
564
+ "Clockwork API key not provided. Pass `clockwork` in the Verne constructor config."
565
+ );
566
+ }
567
+ this._clockwork ?? (this._clockwork = new Clockwork({
568
+ apiKey: this.config.clockwork,
569
+ baseUrl: this.config.baseUrl,
570
+ timeoutMs: this.config.timeoutMs
571
+ }));
572
+ return this._clockwork;
573
+ }
407
574
  };
408
575
 
409
- export { Gate, Relay, Verne, VerneAPIError, VerneError };
576
+ export { Clockwork, Gate, Passepartout, Relay, Verne, VerneAPIError, VerneError };
410
577
  //# sourceMappingURL=index.mjs.map
411
578
  //# sourceMappingURL=index.mjs.map