@withone/sdk 0.4.0 → 0.6.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.d.mts CHANGED
@@ -223,6 +223,102 @@ interface ConnectionUpdatedPayload {
223
223
  tags: string[];
224
224
  updated_at: string;
225
225
  }
226
+ type GrantCreatedPayload = {
227
+ /**
228
+ * The public `client_id` the application knows itself by, not the integer
229
+ * key.
230
+ */
231
+ client_id: string;
232
+ connect_user_id: string;
233
+ environment: string;
234
+ grant_id: string;
235
+ /**
236
+ * Which revision of this grant's reach the delivery describes. Bumped by
237
+ * every consent and every edit, so an application can tell a change it
238
+ * has already applied from one it has not.
239
+ *
240
+ * Two things it is not. It counts within one grant rather than across a
241
+ * user, so a grant created after a revocation starts at 1 again and the
242
+ * comparison has to be keyed by `grant_id`. And `grant.revoked` repeats
243
+ * the version the grant last reached rather than taking a new one,
244
+ * because revoking changes who may act and not what the grant describes -
245
+ * so it is the one event in the family that must not be discarded as
246
+ * already-seen. Deduplicate on `X-Webhook-Event-Id`, never on this.
247
+ */
248
+ version: number;
249
+ } & {
250
+ /**
251
+ * Where the user answered: the page One renders, or the connect card
252
+ * framed inside the application's own site.
253
+ */
254
+ consent_surface: string;
255
+ created_at: string;
256
+ };
257
+ type GrantRevokedPayload = {
258
+ /**
259
+ * The public `client_id` the application knows itself by, not the integer
260
+ * key.
261
+ */
262
+ client_id: string;
263
+ connect_user_id: string;
264
+ environment: string;
265
+ grant_id: string;
266
+ /**
267
+ * Which revision of this grant's reach the delivery describes. Bumped by
268
+ * every consent and every edit, so an application can tell a change it
269
+ * has already applied from one it has not.
270
+ *
271
+ * Two things it is not. It counts within one grant rather than across a
272
+ * user, so a grant created after a revocation starts at 1 again and the
273
+ * comparison has to be keyed by `grant_id`. And `grant.revoked` repeats
274
+ * the version the grant last reached rather than taking a new one,
275
+ * because revoking changes who may act and not what the grant describes -
276
+ * so it is the one event in the family that must not be discarded as
277
+ * already-seen. Deduplicate on `X-Webhook-Event-Id`, never on this.
278
+ */
279
+ version: number;
280
+ } & {
281
+ reason?: string | null;
282
+ revoked_at: string;
283
+ /**
284
+ * `user` when the person took their own access back, `developer` when the
285
+ * application's owner cut this user off. The two call for opposite
286
+ * responses, so they are one field rather than one event.
287
+ */
288
+ revoked_by: string;
289
+ };
290
+ type GrantUpdatedPayload = {
291
+ /**
292
+ * The public `client_id` the application knows itself by, not the integer
293
+ * key.
294
+ */
295
+ client_id: string;
296
+ connect_user_id: string;
297
+ environment: string;
298
+ grant_id: string;
299
+ /**
300
+ * Which revision of this grant's reach the delivery describes. Bumped by
301
+ * every consent and every edit, so an application can tell a change it
302
+ * has already applied from one it has not.
303
+ *
304
+ * Two things it is not. It counts within one grant rather than across a
305
+ * user, so a grant created after a revocation starts at 1 again and the
306
+ * comparison has to be keyed by `grant_id`. And `grant.revoked` repeats
307
+ * the version the grant last reached rather than taking a new one,
308
+ * because revoking changes who may act and not what the grant describes -
309
+ * so it is the one event in the family that must not be discarded as
310
+ * already-seen. Deduplicate on `X-Webhook-Event-Id`, never on this.
311
+ */
312
+ version: number;
313
+ } & {
314
+ /**
315
+ * `consent` when the user went through the application's flow again,
316
+ * `user_edit` when they changed it from their One dashboard. An
317
+ * application can prompt for the first and cannot for the second.
318
+ */
319
+ source: string;
320
+ updated_at: string;
321
+ };
226
322
  interface MemberAddedPayload {
227
323
  added_at: string;
228
324
  email: string;
@@ -310,7 +406,7 @@ interface ProjectUpdatedPayload {
310
406
  updated_at: string;
311
407
  }
312
408
  /** Every event a One webhook subscription can deliver. */
313
- type WebhookEventType = 'api_key.created' | 'api_key.revoked' | 'connection.created' | 'connection.deleted' | 'connection.oauth.created' | 'connection.updated' | 'member.added' | 'member.removed' | 'member.role_updated' | 'oauth.failed' | 'oauth.refreshed' | 'organization.created' | 'organization.deleted' | 'organization.updated' | 'passthrough.executed' | 'project.created' | 'project.deleted' | 'project.updated';
409
+ type WebhookEventType = 'api_key.created' | 'api_key.revoked' | 'connection.created' | 'connection.deleted' | 'connection.oauth.created' | 'connection.updated' | 'grant.created' | 'grant.revoked' | 'grant.updated' | 'member.added' | 'member.removed' | 'member.role_updated' | 'oauth.failed' | 'oauth.refreshed' | 'organization.created' | 'organization.deleted' | 'organization.updated' | 'passthrough.executed' | 'project.created' | 'project.deleted' | 'project.updated';
314
410
  /** Maps each event to the payload its deliveries carry. */
315
411
  interface WebhookPayloads {
316
412
  'api_key.created': ApiKeyCreatedPayload;
@@ -319,6 +415,9 @@ interface WebhookPayloads {
319
415
  'connection.deleted': ConnectionDeletedPayload;
320
416
  'connection.oauth.created': ConnectionOAuthCreatedPayload;
321
417
  'connection.updated': ConnectionUpdatedPayload;
418
+ 'grant.created': GrantCreatedPayload;
419
+ 'grant.revoked': GrantRevokedPayload;
420
+ 'grant.updated': GrantUpdatedPayload;
322
421
  'member.added': MemberAddedPayload;
323
422
  'member.removed': MemberRemovedPayload;
324
423
  'member.role_updated': MemberRoleUpdatedPayload;
@@ -358,6 +457,12 @@ declare class Webhooks extends WebhooksBase {
358
457
  connectionOauthCreated(handler: Handler<ConnectionOAuthCreatedPayload>): this;
359
458
  /** Registers a handler for `connection.updated`. */
360
459
  connectionUpdated(handler: Handler<ConnectionUpdatedPayload>): this;
460
+ /** Registers a handler for `grant.created`. */
461
+ grantCreated(handler: Handler<GrantCreatedPayload>): this;
462
+ /** Registers a handler for `grant.revoked`. */
463
+ grantRevoked(handler: Handler<GrantRevokedPayload>): this;
464
+ /** Registers a handler for `grant.updated`. */
465
+ grantUpdated(handler: Handler<GrantUpdatedPayload>): this;
361
466
  /** Registers a handler for `member.added`. */
362
467
  memberAdded(handler: Handler<MemberAddedPayload>): this;
363
468
  /** Registers a handler for `member.removed`. */
package/dist/index.d.ts CHANGED
@@ -223,6 +223,102 @@ interface ConnectionUpdatedPayload {
223
223
  tags: string[];
224
224
  updated_at: string;
225
225
  }
226
+ type GrantCreatedPayload = {
227
+ /**
228
+ * The public `client_id` the application knows itself by, not the integer
229
+ * key.
230
+ */
231
+ client_id: string;
232
+ connect_user_id: string;
233
+ environment: string;
234
+ grant_id: string;
235
+ /**
236
+ * Which revision of this grant's reach the delivery describes. Bumped by
237
+ * every consent and every edit, so an application can tell a change it
238
+ * has already applied from one it has not.
239
+ *
240
+ * Two things it is not. It counts within one grant rather than across a
241
+ * user, so a grant created after a revocation starts at 1 again and the
242
+ * comparison has to be keyed by `grant_id`. And `grant.revoked` repeats
243
+ * the version the grant last reached rather than taking a new one,
244
+ * because revoking changes who may act and not what the grant describes -
245
+ * so it is the one event in the family that must not be discarded as
246
+ * already-seen. Deduplicate on `X-Webhook-Event-Id`, never on this.
247
+ */
248
+ version: number;
249
+ } & {
250
+ /**
251
+ * Where the user answered: the page One renders, or the connect card
252
+ * framed inside the application's own site.
253
+ */
254
+ consent_surface: string;
255
+ created_at: string;
256
+ };
257
+ type GrantRevokedPayload = {
258
+ /**
259
+ * The public `client_id` the application knows itself by, not the integer
260
+ * key.
261
+ */
262
+ client_id: string;
263
+ connect_user_id: string;
264
+ environment: string;
265
+ grant_id: string;
266
+ /**
267
+ * Which revision of this grant's reach the delivery describes. Bumped by
268
+ * every consent and every edit, so an application can tell a change it
269
+ * has already applied from one it has not.
270
+ *
271
+ * Two things it is not. It counts within one grant rather than across a
272
+ * user, so a grant created after a revocation starts at 1 again and the
273
+ * comparison has to be keyed by `grant_id`. And `grant.revoked` repeats
274
+ * the version the grant last reached rather than taking a new one,
275
+ * because revoking changes who may act and not what the grant describes -
276
+ * so it is the one event in the family that must not be discarded as
277
+ * already-seen. Deduplicate on `X-Webhook-Event-Id`, never on this.
278
+ */
279
+ version: number;
280
+ } & {
281
+ reason?: string | null;
282
+ revoked_at: string;
283
+ /**
284
+ * `user` when the person took their own access back, `developer` when the
285
+ * application's owner cut this user off. The two call for opposite
286
+ * responses, so they are one field rather than one event.
287
+ */
288
+ revoked_by: string;
289
+ };
290
+ type GrantUpdatedPayload = {
291
+ /**
292
+ * The public `client_id` the application knows itself by, not the integer
293
+ * key.
294
+ */
295
+ client_id: string;
296
+ connect_user_id: string;
297
+ environment: string;
298
+ grant_id: string;
299
+ /**
300
+ * Which revision of this grant's reach the delivery describes. Bumped by
301
+ * every consent and every edit, so an application can tell a change it
302
+ * has already applied from one it has not.
303
+ *
304
+ * Two things it is not. It counts within one grant rather than across a
305
+ * user, so a grant created after a revocation starts at 1 again and the
306
+ * comparison has to be keyed by `grant_id`. And `grant.revoked` repeats
307
+ * the version the grant last reached rather than taking a new one,
308
+ * because revoking changes who may act and not what the grant describes -
309
+ * so it is the one event in the family that must not be discarded as
310
+ * already-seen. Deduplicate on `X-Webhook-Event-Id`, never on this.
311
+ */
312
+ version: number;
313
+ } & {
314
+ /**
315
+ * `consent` when the user went through the application's flow again,
316
+ * `user_edit` when they changed it from their One dashboard. An
317
+ * application can prompt for the first and cannot for the second.
318
+ */
319
+ source: string;
320
+ updated_at: string;
321
+ };
226
322
  interface MemberAddedPayload {
227
323
  added_at: string;
228
324
  email: string;
@@ -310,7 +406,7 @@ interface ProjectUpdatedPayload {
310
406
  updated_at: string;
311
407
  }
312
408
  /** Every event a One webhook subscription can deliver. */
313
- type WebhookEventType = 'api_key.created' | 'api_key.revoked' | 'connection.created' | 'connection.deleted' | 'connection.oauth.created' | 'connection.updated' | 'member.added' | 'member.removed' | 'member.role_updated' | 'oauth.failed' | 'oauth.refreshed' | 'organization.created' | 'organization.deleted' | 'organization.updated' | 'passthrough.executed' | 'project.created' | 'project.deleted' | 'project.updated';
409
+ type WebhookEventType = 'api_key.created' | 'api_key.revoked' | 'connection.created' | 'connection.deleted' | 'connection.oauth.created' | 'connection.updated' | 'grant.created' | 'grant.revoked' | 'grant.updated' | 'member.added' | 'member.removed' | 'member.role_updated' | 'oauth.failed' | 'oauth.refreshed' | 'organization.created' | 'organization.deleted' | 'organization.updated' | 'passthrough.executed' | 'project.created' | 'project.deleted' | 'project.updated';
314
410
  /** Maps each event to the payload its deliveries carry. */
315
411
  interface WebhookPayloads {
316
412
  'api_key.created': ApiKeyCreatedPayload;
@@ -319,6 +415,9 @@ interface WebhookPayloads {
319
415
  'connection.deleted': ConnectionDeletedPayload;
320
416
  'connection.oauth.created': ConnectionOAuthCreatedPayload;
321
417
  'connection.updated': ConnectionUpdatedPayload;
418
+ 'grant.created': GrantCreatedPayload;
419
+ 'grant.revoked': GrantRevokedPayload;
420
+ 'grant.updated': GrantUpdatedPayload;
322
421
  'member.added': MemberAddedPayload;
323
422
  'member.removed': MemberRemovedPayload;
324
423
  'member.role_updated': MemberRoleUpdatedPayload;
@@ -358,6 +457,12 @@ declare class Webhooks extends WebhooksBase {
358
457
  connectionOauthCreated(handler: Handler<ConnectionOAuthCreatedPayload>): this;
359
458
  /** Registers a handler for `connection.updated`. */
360
459
  connectionUpdated(handler: Handler<ConnectionUpdatedPayload>): this;
460
+ /** Registers a handler for `grant.created`. */
461
+ grantCreated(handler: Handler<GrantCreatedPayload>): this;
462
+ /** Registers a handler for `grant.revoked`. */
463
+ grantRevoked(handler: Handler<GrantRevokedPayload>): this;
464
+ /** Registers a handler for `grant.updated`. */
465
+ grantUpdated(handler: Handler<GrantUpdatedPayload>): this;
361
466
  /** Registers a handler for `member.added`. */
362
467
  memberAdded(handler: Handler<MemberAddedPayload>): this;
363
468
  /** Registers a handler for `member.removed`. */
package/dist/index.js CHANGED
@@ -203,6 +203,9 @@ var ALL_WEBHOOK_EVENTS = [
203
203
  "connection.deleted",
204
204
  "connection.oauth.created",
205
205
  "connection.updated",
206
+ "grant.created",
207
+ "grant.revoked",
208
+ "grant.updated",
206
209
  "member.added",
207
210
  "member.removed",
208
211
  "member.role_updated",
@@ -267,6 +270,18 @@ var Webhooks = class extends WebhooksBase {
267
270
  connectionUpdated(handler) {
268
271
  return this.register("connection.updated", null, handler);
269
272
  }
273
+ /** Registers a handler for `grant.created`. */
274
+ grantCreated(handler) {
275
+ return this.register("grant.created", null, handler);
276
+ }
277
+ /** Registers a handler for `grant.revoked`. */
278
+ grantRevoked(handler) {
279
+ return this.register("grant.revoked", null, handler);
280
+ }
281
+ /** Registers a handler for `grant.updated`. */
282
+ grantUpdated(handler) {
283
+ return this.register("grant.updated", null, handler);
284
+ }
270
285
  /** Registers a handler for `member.added`. */
271
286
  memberAdded(handler) {
272
287
  return this.register("member.added", null, handler);
package/dist/index.mjs CHANGED
@@ -203,6 +203,9 @@ var ALL_WEBHOOK_EVENTS = [
203
203
  "connection.deleted",
204
204
  "connection.oauth.created",
205
205
  "connection.updated",
206
+ "grant.created",
207
+ "grant.revoked",
208
+ "grant.updated",
206
209
  "member.added",
207
210
  "member.removed",
208
211
  "member.role_updated",
@@ -267,6 +270,18 @@ var Webhooks = class extends WebhooksBase {
267
270
  connectionUpdated(handler) {
268
271
  return this.register("connection.updated", null, handler);
269
272
  }
273
+ /** Registers a handler for `grant.created`. */
274
+ grantCreated(handler) {
275
+ return this.register("grant.created", null, handler);
276
+ }
277
+ /** Registers a handler for `grant.revoked`. */
278
+ grantRevoked(handler) {
279
+ return this.register("grant.revoked", null, handler);
280
+ }
281
+ /** Registers a handler for `grant.updated`. */
282
+ grantUpdated(handler) {
283
+ return this.register("grant.updated", null, handler);
284
+ }
270
285
  /** Registers a handler for `member.added`. */
271
286
  memberAdded(handler) {
272
287
  return this.register("member.added", null, handler);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@withone/sdk",
3
- "version": "0.4.0",
4
- "description": "The One SDK for Node — typed client over the One API.",
3
+ "version": "0.6.0",
4
+ "description": "The One SDK for Node: a typed client over the One API.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",
@@ -206,12 +206,12 @@
206
206
  "native.d.ts"
207
207
  ],
208
208
  "optionalDependencies": {
209
- "@withone/sdk-linux-x64-gnu": "0.4.0",
210
- "@withone/sdk-linux-arm64-gnu": "0.4.0",
211
- "@withone/sdk-linux-x64-musl": "0.4.0",
212
- "@withone/sdk-darwin-x64": "0.4.0",
213
- "@withone/sdk-darwin-arm64": "0.4.0",
214
- "@withone/sdk-win32-x64-msvc": "0.4.0"
209
+ "@withone/sdk-linux-x64-gnu": "0.6.0",
210
+ "@withone/sdk-linux-arm64-gnu": "0.6.0",
211
+ "@withone/sdk-linux-x64-musl": "0.6.0",
212
+ "@withone/sdk-darwin-x64": "0.6.0",
213
+ "@withone/sdk-darwin-arm64": "0.6.0",
214
+ "@withone/sdk-win32-x64-msvc": "0.6.0"
215
215
  },
216
216
  "scripts": {
217
217
  "build:native": "napi build --platform --release --js native.js --dts native.d.ts --dts-header \"export type JsonValue = string | number | boolean | null | { [key: string]: JsonValue } | JsonValue[];\n\"",
@@ -230,5 +230,10 @@
230
230
  "tsx": "^4.19.2",
231
231
  "typescript": "^5.7.2"
232
232
  },
233
- "sideEffects": false
233
+ "sideEffects": false,
234
+ "pnpm": {
235
+ "overrides": {
236
+ "esbuild@>=0.27.3 <0.28.1": "^0.28.1"
237
+ }
238
+ }
234
239
  }