@kohost/api-client 3.8.3 → 3.9.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.
@@ -0,0 +1,35 @@
1
+ // Create the Vendor Model
2
+ const schemas = require("../utils/schema");
3
+ const schema = require("../schemas/vendor.json");
4
+ const Entity = require("./Entity");
5
+
6
+ schemas.add(schema);
7
+ const validator = schemas.compile(schema);
8
+
9
+ class Vendor extends Entity {
10
+ /**
11
+ * @typedef {import("../schemas/VendorSchema").Vendor} VendorType
12
+ * Create a Product instance.
13
+ * @constructor
14
+ * @param {Vendor} vendor - The vendor object of type Vendor.
15
+ */
16
+ constructor(vendor) {
17
+ super(vendor);
18
+ }
19
+ }
20
+
21
+ Object.defineProperty(Vendor.prototype, "schema", {
22
+ value: schema,
23
+ });
24
+
25
+ Object.defineProperty(Vendor.prototype, "validator", {
26
+ get: function () {
27
+ return validator;
28
+ },
29
+ });
30
+
31
+ Object.defineProperty(Vendor, "validProperties", {
32
+ value: Object.keys(schema.properties),
33
+ });
34
+
35
+ module.exports = Vendor;
@@ -33,6 +33,7 @@ const EmailMessage = require("./EmailMessage");
33
33
  const Announcement = require("./Announcement");
34
34
  const TimeSheet = require("./TimeSheet");
35
35
  const Issue = require("./Issue");
36
+ const Vendor = require("./Vendor");
36
37
 
37
38
  const Property = require("./Property");
38
39
  const Organization = require("./Organization");
@@ -78,4 +79,5 @@ module.exports = {
78
79
  TimeSheet,
79
80
  Policy,
80
81
  Issue,
82
+ Vendor,
81
83
  };
@@ -28,6 +28,9 @@
28
28
  "userId": {
29
29
  "type": "string"
30
30
  },
31
+ "vendorId": {
32
+ "type": "string"
33
+ },
31
34
  "priority": {
32
35
  "$ref": "ticket.json#/properties/priority"
33
36
  },
@@ -35,6 +35,12 @@
35
35
  "userName": {
36
36
  "type": "string"
37
37
  },
38
+ "vendorId": {
39
+ "type": "string"
40
+ },
41
+ "vendorName": {
42
+ "type": "string"
43
+ },
38
44
  "systemId": {
39
45
  "type": "string"
40
46
  },
@@ -64,6 +70,9 @@
64
70
  },
65
71
  {
66
72
  "required": ["id", "systemId", "timestamp", "body"]
73
+ },
74
+ {
75
+ "required": ["id", "vendorId", "timestamp", "body"]
67
76
  }
68
77
  ]
69
78
  }
@@ -141,6 +150,19 @@
141
150
  { "type": "null" },
142
151
  { "type": "string" }
143
152
  ]
153
+ },
154
+ "vendorId": {
155
+ "type": "string"
156
+ },
157
+ "vendorName": {
158
+ "type": "string"
159
+ },
160
+ "vendorPhoto": {
161
+ "anyOf": [
162
+ { "$ref": "mediaFile.json" },
163
+ { "type": "null" },
164
+ { "type": "string" }
165
+ ]
144
166
  }
145
167
  }
146
168
  },
@@ -3,7 +3,7 @@
3
3
  "$id": "vendor.json",
4
4
  "title": "Vendor",
5
5
  "type": "object",
6
- "required": ["name", "lastName"],
6
+ "required": ["name", "email"],
7
7
  "properties": {
8
8
  "id": {
9
9
  "$ref": "definitions.json#/definitions/id"
@@ -76,6 +76,8 @@ module.exports = function entityFactory(type) {
76
76
  return Models.Organization;
77
77
  case "issue":
78
78
  return Models.Issue;
79
+ case "vendor":
80
+ return Models.Vendor;
79
81
  default:
80
82
  throw new Error("Unknown entity type: " + type);
81
83
  }
@@ -11272,6 +11272,12 @@ var require_ticket = __commonJS({
11272
11272
  userName: {
11273
11273
  type: "string"
11274
11274
  },
11275
+ vendorId: {
11276
+ type: "string"
11277
+ },
11278
+ vendorName: {
11279
+ type: "string"
11280
+ },
11275
11281
  systemId: {
11276
11282
  type: "string"
11277
11283
  },
@@ -11301,6 +11307,9 @@ var require_ticket = __commonJS({
11301
11307
  },
11302
11308
  {
11303
11309
  required: ["id", "systemId", "timestamp", "body"]
11310
+ },
11311
+ {
11312
+ required: ["id", "vendorId", "timestamp", "body"]
11304
11313
  }
11305
11314
  ]
11306
11315
  }
@@ -11377,6 +11386,19 @@ var require_ticket = __commonJS({
11377
11386
  { type: "null" },
11378
11387
  { type: "string" }
11379
11388
  ]
11389
+ },
11390
+ vendorId: {
11391
+ type: "string"
11392
+ },
11393
+ vendorName: {
11394
+ type: "string"
11395
+ },
11396
+ vendorPhoto: {
11397
+ anyOf: [
11398
+ { $ref: "mediaFile.json" },
11399
+ { type: "null" },
11400
+ { type: "string" }
11401
+ ]
11380
11402
  }
11381
11403
  }
11382
11404
  },
@@ -12995,6 +13017,9 @@ var require_issue = __commonJS({
12995
13017
  userId: {
12996
13018
  type: "string"
12997
13019
  },
13020
+ vendorId: {
13021
+ type: "string"
13022
+ },
12998
13023
  priority: {
12999
13024
  $ref: "ticket.json#/properties/priority"
13000
13025
  },
@@ -13049,6 +13074,89 @@ var require_Issue = __commonJS({
13049
13074
  }
13050
13075
  });
13051
13076
 
13077
+ // src/schemas/vendor.json
13078
+ var require_vendor = __commonJS({
13079
+ "src/schemas/vendor.json"(exports, module) {
13080
+ module.exports = {
13081
+ $schema: "http://json-schema.org/draft-07/schema",
13082
+ $id: "vendor.json",
13083
+ title: "Vendor",
13084
+ type: "object",
13085
+ required: ["name", "email"],
13086
+ properties: {
13087
+ id: {
13088
+ $ref: "definitions.json#/definitions/id"
13089
+ },
13090
+ type: {
13091
+ type: "string",
13092
+ default: "vendor",
13093
+ enum: ["vendor"]
13094
+ },
13095
+ name: {
13096
+ type: "string"
13097
+ },
13098
+ phone: {
13099
+ type: ["string", "null"],
13100
+ pattern: "^\\+[0-9]{1,14}$"
13101
+ },
13102
+ email: {
13103
+ type: ["string", "null"],
13104
+ format: "email"
13105
+ },
13106
+ address: {
13107
+ $ref: "definitions.json#/definitions/address"
13108
+ },
13109
+ photo: {
13110
+ $ref: "mediaFile.json#"
13111
+ },
13112
+ createdAt: {
13113
+ $ref: "definitions.json#/definitions/createdAt"
13114
+ },
13115
+ updatedAt: {
13116
+ $ref: "definitions.json#/definitions/updatedAt"
13117
+ }
13118
+ }
13119
+ };
13120
+ }
13121
+ });
13122
+
13123
+ // src/Models/Vendor.js
13124
+ var require_Vendor = __commonJS({
13125
+ "src/Models/Vendor.js"(exports, module) {
13126
+ var schemas = require_schema();
13127
+ var schema = require_vendor();
13128
+ var Entity = require_Entity();
13129
+ schemas.add(schema);
13130
+ var validator = schemas.compile(schema);
13131
+ var Vendor = class extends Entity {
13132
+ static {
13133
+ __name(this, "Vendor");
13134
+ }
13135
+ /**
13136
+ * @typedef {import("../schemas/VendorSchema").Vendor} VendorType
13137
+ * Create a Product instance.
13138
+ * @constructor
13139
+ * @param {Vendor} vendor - The vendor object of type Vendor.
13140
+ */
13141
+ constructor(vendor) {
13142
+ super(vendor);
13143
+ }
13144
+ };
13145
+ Object.defineProperty(Vendor.prototype, "schema", {
13146
+ value: schema
13147
+ });
13148
+ Object.defineProperty(Vendor.prototype, "validator", {
13149
+ get: /* @__PURE__ */ __name(function() {
13150
+ return validator;
13151
+ }, "get")
13152
+ });
13153
+ Object.defineProperty(Vendor, "validProperties", {
13154
+ value: Object.keys(schema.properties)
13155
+ });
13156
+ module.exports = Vendor;
13157
+ }
13158
+ });
13159
+
13052
13160
  // src/schemas/property.json
13053
13161
  var require_property = __commonJS({
13054
13162
  "src/schemas/property.json"(exports, module) {
@@ -13755,6 +13863,7 @@ var require_Models = __commonJS({
13755
13863
  var Announcement = require_Announcement();
13756
13864
  var TimeSheet = require_TimeSheet();
13757
13865
  var Issue = require_Issue();
13866
+ var Vendor = require_Vendor();
13758
13867
  var Property = require_Property();
13759
13868
  var Organization = require_Organization();
13760
13869
  var Entity = require_Entity();
@@ -13796,7 +13905,8 @@ var require_Models = __commonJS({
13796
13905
  Announcement,
13797
13906
  TimeSheet,
13798
13907
  Policy,
13799
- Issue
13908
+ Issue,
13909
+ Vendor
13800
13910
  };
13801
13911
  }
13802
13912
  });