@unito/integrations-platform-client 0.48.3 → 0.48.4

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/src/api.d.ts CHANGED
@@ -365,7 +365,7 @@ export declare function getCredentialAccount(xUnitoCredentialId: string, { xUnit
365
365
  */
366
366
  export declare function postTrack(body: {
367
367
  jwtToken: string;
368
- event: 'AUTH_START' | 'AUTH_SUBMIT' | 'AUTH_ACTION' | 'AUTH_BLOCKED' | 'AUTH_CHOOSE_CONNECTION_START' | 'AUTH_CHOOSE_CONNECTION_SUBMIT';
368
+ event: 'AUTH_START' | 'AUTH_SUBMIT' | 'AUTH_ACTION' | 'AUTH_BLOCKED' | 'USER_SUCCEEDS_CONNECTION' | 'USER_FAILED_CONNECTION';
369
369
  payload?: {
370
370
  [key: string]: any;
371
371
  };
@@ -500,3 +500,39 @@ export declare function regenerateApiKey(userId: number, opts?: Oazapfts.Request
500
500
  export declare function getUserByEmail(email: string, opts?: Oazapfts.RequestOpts): Promise<User>;
501
501
  import { HttpError } from '@oazapfts/runtime';
502
502
  export { HttpError };
503
+ import * as IntegrationApi from '@unito/integration-api';
504
+ /**
505
+ * Return true if object has the shape of an item, false otherwise.
506
+ * @param object
507
+ */
508
+ export declare function isIntegrationApiItem(object: any): object is IntegrationApi.Item;
509
+ /**
510
+ * Return true if object has the shape of an item, false otherwise.
511
+ * @param object
512
+ */
513
+ export declare function isIntegrationApiItemSummary(object: any): object is IntegrationApi.ItemSummary;
514
+ /**
515
+ * Return true if object has the shape of a collection, false otherwise.
516
+ * @param object
517
+ */
518
+ export declare function isIntegrationApiCollection(object: any): object is IntegrationApi.Collection;
519
+ export declare function getProxyGraphItem(xUnitoCredentialId: string, path: string, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
520
+ xUnitoCorrelationId?: string;
521
+ xUnitoAdditionalLoggingContext?: string;
522
+ }, opts?: Oazapfts.RequestOpts): Promise<IntegrationApi.Item>;
523
+ export declare function getProxyGraphCollection(xUnitoCredentialId: string, path: string, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
524
+ xUnitoCorrelationId?: string;
525
+ xUnitoAdditionalLoggingContext?: string;
526
+ }, opts?: Oazapfts.RequestOpts): Promise<IntegrationApi.Collection>;
527
+ export declare function patchProxyGraphItem(xUnitoCredentialId: string, path: string, body?: object, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
528
+ xUnitoCorrelationId?: string;
529
+ xUnitoAdditionalLoggingContext?: string;
530
+ }, opts?: Oazapfts.RequestOpts): Promise<IntegrationApi.Item>;
531
+ export declare function postProxyGraphCollection(xUnitoCredentialId: string, path: string, body?: object, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
532
+ xUnitoCorrelationId?: string;
533
+ xUnitoAdditionalLoggingContext?: string;
534
+ }, opts?: Oazapfts.RequestOpts): Promise<IntegrationApi.ItemSummary>;
535
+ export declare function deleteProxyGraphItem(xUnitoCredentialId: string, path: string, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
536
+ xUnitoCorrelationId?: string;
537
+ xUnitoAdditionalLoggingContext?: string;
538
+ }, opts?: Oazapfts.RequestOpts): Promise<void>;
package/dist/src/api.js CHANGED
@@ -392,5 +392,81 @@ export function getUserByEmail(email, opts) {
392
392
  ...opts,
393
393
  }));
394
394
  }
395
+ // MANUAL ADDONS
395
396
  import { HttpError } from '@oazapfts/runtime';
396
397
  export { HttpError };
398
+ /**
399
+ * Return true if object has the shape of an item, false otherwise.
400
+ * @param object
401
+ */
402
+ export function isIntegrationApiItem(object) {
403
+ return object && typeof object === 'object' && 'fields' in object && 'relations' in object;
404
+ }
405
+ /**
406
+ * Return true if object has the shape of an item, false otherwise.
407
+ * @param object
408
+ */
409
+ export function isIntegrationApiItemSummary(object) {
410
+ return object && typeof object === 'object' && 'path' in object;
411
+ }
412
+ /**
413
+ * Return true if object has the shape of a collection, false otherwise.
414
+ * @param object
415
+ */
416
+ export function isIntegrationApiCollection(object) {
417
+ return object && typeof object === 'object' && 'info' in object && 'data' in object && Array.isArray(object.data);
418
+ }
419
+ export async function getProxyGraphItem(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
420
+ const response = await getProxyGraph(xUnitoCredentialId, path, {
421
+ xUnitoCorrelationId,
422
+ xUnitoAdditionalLoggingContext,
423
+ }, opts);
424
+ if (isIntegrationApiItem(response)) {
425
+ return response;
426
+ }
427
+ else {
428
+ throw new Error(`Response does not match expected Item shape`);
429
+ }
430
+ }
431
+ export async function getProxyGraphCollection(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
432
+ const response = await getProxyGraph(xUnitoCredentialId, path, {
433
+ xUnitoCorrelationId,
434
+ xUnitoAdditionalLoggingContext,
435
+ }, opts);
436
+ if (isIntegrationApiCollection(response)) {
437
+ return response;
438
+ }
439
+ else {
440
+ throw new Error(`Response does not match expected Collection shape`);
441
+ }
442
+ }
443
+ export async function patchProxyGraphItem(xUnitoCredentialId, path, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
444
+ const response = await patchProxyGraph(xUnitoCredentialId, path, body, {
445
+ xUnitoCorrelationId,
446
+ xUnitoAdditionalLoggingContext,
447
+ }, opts);
448
+ if (isIntegrationApiItem(response)) {
449
+ return response;
450
+ }
451
+ else {
452
+ throw new Error(`Response does not match expected Item shape`);
453
+ }
454
+ }
455
+ export async function postProxyGraphCollection(xUnitoCredentialId, path, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
456
+ const response = await postProxyGraph(xUnitoCredentialId, path, body, {
457
+ xUnitoCorrelationId,
458
+ xUnitoAdditionalLoggingContext,
459
+ }, opts);
460
+ if (isIntegrationApiItemSummary(response)) {
461
+ return response;
462
+ }
463
+ else {
464
+ throw new Error(`Response does not match expected ItemSummary shape`);
465
+ }
466
+ }
467
+ export async function deleteProxyGraphItem(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
468
+ await deleteProxyGraph(xUnitoCredentialId, path, {
469
+ xUnitoCorrelationId,
470
+ xUnitoAdditionalLoggingContext,
471
+ }, opts);
472
+ }
@@ -415,6 +415,81 @@ function getUserByEmail(email, opts) {
415
415
  ...opts,
416
416
  }));
417
417
  }
418
+ /**
419
+ * Return true if object has the shape of an item, false otherwise.
420
+ * @param object
421
+ */
422
+ function isIntegrationApiItem(object) {
423
+ return object && typeof object === 'object' && 'fields' in object && 'relations' in object;
424
+ }
425
+ /**
426
+ * Return true if object has the shape of an item, false otherwise.
427
+ * @param object
428
+ */
429
+ function isIntegrationApiItemSummary(object) {
430
+ return object && typeof object === 'object' && 'path' in object;
431
+ }
432
+ /**
433
+ * Return true if object has the shape of a collection, false otherwise.
434
+ * @param object
435
+ */
436
+ function isIntegrationApiCollection(object) {
437
+ return object && typeof object === 'object' && 'info' in object && 'data' in object && Array.isArray(object.data);
438
+ }
439
+ async function getProxyGraphItem(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
440
+ const response = await getProxyGraph(xUnitoCredentialId, path, {
441
+ xUnitoCorrelationId,
442
+ xUnitoAdditionalLoggingContext,
443
+ }, opts);
444
+ if (isIntegrationApiItem(response)) {
445
+ return response;
446
+ }
447
+ else {
448
+ throw new Error(`Response does not match expected Item shape`);
449
+ }
450
+ }
451
+ async function getProxyGraphCollection(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
452
+ const response = await getProxyGraph(xUnitoCredentialId, path, {
453
+ xUnitoCorrelationId,
454
+ xUnitoAdditionalLoggingContext,
455
+ }, opts);
456
+ if (isIntegrationApiCollection(response)) {
457
+ return response;
458
+ }
459
+ else {
460
+ throw new Error(`Response does not match expected Collection shape`);
461
+ }
462
+ }
463
+ async function patchProxyGraphItem(xUnitoCredentialId, path, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
464
+ const response = await patchProxyGraph(xUnitoCredentialId, path, body, {
465
+ xUnitoCorrelationId,
466
+ xUnitoAdditionalLoggingContext,
467
+ }, opts);
468
+ if (isIntegrationApiItem(response)) {
469
+ return response;
470
+ }
471
+ else {
472
+ throw new Error(`Response does not match expected Item shape`);
473
+ }
474
+ }
475
+ async function postProxyGraphCollection(xUnitoCredentialId, path, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
476
+ const response = await postProxyGraph(xUnitoCredentialId, path, body, {
477
+ xUnitoCorrelationId,
478
+ xUnitoAdditionalLoggingContext,
479
+ }, opts);
480
+ if (isIntegrationApiItemSummary(response)) {
481
+ return response;
482
+ }
483
+ else {
484
+ throw new Error(`Response does not match expected ItemSummary shape`);
485
+ }
486
+ }
487
+ async function deleteProxyGraphItem(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
488
+ await deleteProxyGraph(xUnitoCredentialId, path, {
489
+ xUnitoCorrelationId,
490
+ xUnitoAdditionalLoggingContext,
491
+ }, opts);
492
+ }
418
493
 
419
494
  var api = {
420
495
  __proto__: null,
@@ -427,6 +502,7 @@ var api = {
427
502
  deleteCredential: deleteCredential,
428
503
  deleteIntegration: deleteIntegration,
429
504
  deleteProxyGraph: deleteProxyGraph,
505
+ deleteProxyGraphItem: deleteProxyGraphItem,
430
506
  encryptData: encryptData,
431
507
  getCredentialAccount: getCredentialAccount,
432
508
  getCredentialById: getCredentialById,
@@ -438,14 +514,21 @@ var api = {
438
514
  getIntegrations: getIntegrations,
439
515
  getProfile: getProfile,
440
516
  getProxyGraph: getProxyGraph,
517
+ getProxyGraphCollection: getProxyGraphCollection,
518
+ getProxyGraphItem: getProxyGraphItem,
441
519
  getProxyMe: getProxyMe,
442
520
  getUserByEmail: getUserByEmail,
443
521
  getUserById: getUserById,
444
522
  getUsers: getUsers,
445
523
  inviteOrganization: inviteOrganization,
446
524
  inviteUser: inviteUser,
525
+ isIntegrationApiCollection: isIntegrationApiCollection,
526
+ isIntegrationApiItem: isIntegrationApiItem,
527
+ isIntegrationApiItemSummary: isIntegrationApiItemSummary,
447
528
  patchProxyGraph: patchProxyGraph,
529
+ patchProxyGraphItem: patchProxyGraphItem,
448
530
  postProxyGraph: postProxyGraph,
531
+ postProxyGraphCollection: postProxyGraphCollection,
449
532
  postTrack: postTrack,
450
533
  publishIntegration: publishIntegration,
451
534
  reencryptData: reencryptData,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unito/integrations-platform-client",
3
- "version": "0.48.3",
3
+ "version": "0.48.4",
4
4
  "description": "The Unito Integrations Platform Client",
5
5
  "type": "module",
6
6
  "types": "./dist/src/index.d.ts",
@@ -48,6 +48,7 @@
48
48
  "typescript": "5.x"
49
49
  },
50
50
  "dependencies": {
51
- "@oazapfts/runtime": "1.x"
51
+ "@oazapfts/runtime": "1.x",
52
+ "@unito/integration-api": "0.x"
52
53
  }
53
54
  }