autoinspector 2.0.3-beta.2 → 2.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/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autoinspector",
3
- "version": "2.0.3-beta.2",
3
+ "version": "2.2.0",
4
4
  "description": "Autoinspector API wrapper",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -4,6 +4,7 @@ import { Inspections } from './Inspections';
4
4
  import { OAuth } from './OAuth';
5
5
  import { Template } from './Template';
6
6
  import { Webhooks } from './Webhooks';
7
+ export * from '../types/webhooks';
7
8
  /**
8
9
  * @classdesc Represents the Autoinspector SDK. It allows the user to make every call to the API with a single function.
9
10
  * @class
@@ -1,4 +1,14 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
2
12
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
13
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
14
  };
@@ -12,6 +22,7 @@ const Inspections_1 = require("./Inspections");
12
22
  const OAuth_1 = require("./OAuth");
13
23
  const Template_1 = require("./Template");
14
24
  const Webhooks_1 = require("./Webhooks");
25
+ __exportStar(require("../types/webhooks"), exports);
15
26
  /**
16
27
  * @classdesc Represents the Autoinspector SDK. It allows the user to make every call to the API with a single function.
17
28
  * @class
@@ -1,4 +1,4 @@
1
- import { IWebhook } from '../types/webhooks';
1
+ import { AutoinspectorWebhook } from '../types/webhooks';
2
2
  export declare class Webhooks {
3
- constructEvent(body: any, requestSignature: string, webhookSecret: string): IWebhook;
3
+ constructEvent(body: any, requestSignature: string, webhookSecret: string): AutoinspectorWebhook;
4
4
  }
@@ -1,5 +1,5 @@
1
1
  import { IConsumer } from './consumer';
2
- import { IImageDamage, InspectionStatus, InspectionVeredict, IProduct, IValidation } from './inspection';
2
+ import { IImageDamage, InspectionStatus, InspectionType, InspectionVeredict, IProduct, IValidation } from './inspection';
3
3
  export declare type IWebhookEvents = 'inspection_started' | 'image_processed' | 'inspection_blocked' | 'inspection_completed' | 'inspection_reviewed';
4
4
  export interface IWebhookProducer {
5
5
  companyId: string;
@@ -8,6 +8,8 @@ export interface IWebhookProducer {
8
8
  export interface IWebhookEvent<P, E extends IWebhookEvents> {
9
9
  event: E;
10
10
  payload: {
11
+ type: InspectionType;
12
+ _id: string;
11
13
  producer: IWebhookProducer;
12
14
  metadata: {
13
15
  [key: string]: string;
@@ -47,6 +49,11 @@ export interface IWebhookInspectionBlocked extends IWebhookEvent<{
47
49
  }, 'inspection_blocked'> {
48
50
  }
49
51
  export interface IWebhookInspectionCompleted extends IWebhookEvent<{
52
+ template: {
53
+ name: string;
54
+ _id: string;
55
+ type: string;
56
+ };
50
57
  status: 'completed';
51
58
  products: IProduct[];
52
59
  identity: IConsumer & {
@@ -60,4 +67,4 @@ export interface IWebhookInspectionCompleted extends IWebhookEvent<{
60
67
  veredict: InspectionVeredict;
61
68
  }, 'inspection_completed'> {
62
69
  }
63
- export declare type IWebhook = IWebhookInspectionStarted | IWebhookImageProcessed | IWebhookInspectionBlocked | IWebhookInspectionCompleted;
70
+ export declare type AutoinspectorWebhook = IWebhookInspectionStarted | IWebhookImageProcessed | IWebhookInspectionBlocked | IWebhookInspectionCompleted;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autoinspector",
3
- "version": "2.0.3-beta.2",
3
+ "version": "2.2.0",
4
4
  "description": "Autoinspector API wrapper",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/.env DELETED
@@ -1,6 +0,0 @@
1
- AUTOINSPECTOR_API_BASE_URL=http://localhost:9001/api
2
- AUTOINSPECTOR_API_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI2MTQ3ODQzYmI5YTcwODAwNTUxODc4YmQiLCJpYXQiOjE2NDAyODI5NjcsImV4cCI6MzMxNjYzMjUzNjd9.Ikc2kIZRja8WBQ3QzWo7ztMAgFk-EFNyifjw_58sg3g
3
- CI_CAR_TEMPLATE_ID=627157f565b79931f3d1dbac
4
- CI_MACHINERY_TEMPLATE_ID=6274475b1996d60ec2803218
5
- CI_PEOPLE_TEMPLATE_ID=6274475b1996d60ec2803218
6
- CI_MOTO_TEMPLATE_ID=6274475b1996d60ec2803218