merchi_sdk_ts 1.7.4 → 1.7.6

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.
@@ -243,6 +243,10 @@ var Shipment = /** @class */ (function (_super) {
243
243
  Shipment.property({ arrayType: 'Reminder' }),
244
244
  __metadata("design:type", Array)
245
245
  ], Shipment.prototype, "reminders", void 0);
246
+ __decorate([
247
+ Shipment.property({ arrayType: 'ShipmentLog' }),
248
+ __metadata("design:type", Array)
249
+ ], Shipment.prototype, "logs", void 0);
246
250
  return Shipment;
247
251
  }(Entity));
248
252
  export { Shipment };
@@ -0,0 +1,75 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
17
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
19
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
20
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
21
+ };
22
+ var __metadata = (this && this.__metadata) || function (k, v) {
23
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
24
+ };
25
+ import { Entity } from '../entity.js';
26
+ import { User } from './user.js';
27
+ /**
28
+ * Runtime type tag only. The API returns `detailJson` as arbitrary JSON; the
29
+ * entity layer rejects `Object` from decorator metadata, so we use an empty
30
+ * class as the property `type` (same pattern as DraftTemplate.customisationMap).
31
+ */
32
+ var detailJsonPropertyType = /** @class */ (function () {
33
+ function detailJsonPropertyType() {
34
+ }
35
+ return detailJsonPropertyType;
36
+ }());
37
+ var ShipmentLog = /** @class */ (function (_super) {
38
+ __extends(ShipmentLog, _super);
39
+ function ShipmentLog() {
40
+ return _super !== null && _super.apply(this, arguments) || this;
41
+ }
42
+ ShipmentLog.resourceName = 'shipment_logs';
43
+ ShipmentLog.singularName = 'shipmentLog';
44
+ ShipmentLog.pluralName = 'shipmentLogs';
45
+ __decorate([
46
+ ShipmentLog.property(),
47
+ __metadata("design:type", Number)
48
+ ], ShipmentLog.prototype, "id", void 0);
49
+ __decorate([
50
+ ShipmentLog.property({ type: 'Shipment' }),
51
+ __metadata("design:type", Object)
52
+ ], ShipmentLog.prototype, "shipment", void 0);
53
+ __decorate([
54
+ ShipmentLog.property({ type: User }),
55
+ __metadata("design:type", Object)
56
+ ], ShipmentLog.prototype, "user", void 0);
57
+ __decorate([
58
+ ShipmentLog.property({ type: String }),
59
+ __metadata("design:type", String)
60
+ ], ShipmentLog.prototype, "sourceType", void 0);
61
+ __decorate([
62
+ ShipmentLog.property({ type: String }),
63
+ __metadata("design:type", String)
64
+ ], ShipmentLog.prototype, "message", void 0);
65
+ __decorate([
66
+ ShipmentLog.property({ type: detailJsonPropertyType }),
67
+ __metadata("design:type", Object)
68
+ ], ShipmentLog.prototype, "detailJson", void 0);
69
+ __decorate([
70
+ ShipmentLog.property({ type: Date }),
71
+ __metadata("design:type", Object)
72
+ ], ShipmentLog.prototype, "createdAt", void 0);
73
+ return ShipmentLog;
74
+ }(Entity));
75
+ export { ShipmentLog };
@@ -327,6 +327,10 @@ var User = /** @class */ (function (_super) {
327
327
  User.property({ arrayType: 'JobComment' }),
328
328
  __metadata("design:type", Array)
329
329
  ], User.prototype, "jobComments", void 0);
330
+ __decorate([
331
+ User.property({ arrayType: 'ShipmentLog' }),
332
+ __metadata("design:type", Array)
333
+ ], User.prototype, "shipmentLogs", void 0);
330
334
  __decorate([
331
335
  User.property({ arrayType: 'EmailAddress' }),
332
336
  __metadata("design:type", Array)
package/dist/entity.js CHANGED
@@ -760,6 +760,10 @@ var Entity = /** @class */ (function () {
760
760
  if (options.relatedJobs !== undefined) {
761
761
  fetchOptions.query.push(['related_jobs', options.relatedJobs.toString()]);
762
762
  }
763
+ if (options.relatedShipment !== undefined) {
764
+ fetchOptions.query.push(['related_shipment',
765
+ options.relatedShipment.toString()]);
766
+ }
763
767
  if (options.relatedProduct !== undefined) {
764
768
  fetchOptions.query.push(['related_product',
765
769
  options.relatedProduct.toString()]);
package/dist/index.js CHANGED
@@ -58,6 +58,7 @@ import { Reminder } from './entities/reminder.js';
58
58
  import { apiFetch, apiFetchWithProgress } from './request.js'; // eslint-disable-next-line no-unused-vars
59
59
  import { Session } from './entities/session.js';
60
60
  import { Shipment } from './entities/shipment.js';
61
+ import { ShipmentLog } from './entities/shipment_log.js';
61
62
  import { ShipmentItem } from './entities/shipment_item.js';
62
63
  import { ShipmentItemFulfillment } from './entities/shipment_item_fulfillment.js';
63
64
  import { ShipmentMethod } from './entities/shipment_method.js';
@@ -81,4 +82,4 @@ import * as constants from './constants/index.js';
81
82
  import * as request from './request.js';
82
83
  import * as util from './util/index.js';
83
84
  import { toastNotifications } from './toasts.js';
84
- export { constants, request, util, toastNotifications, Address, AgentConversation, AgentSkill, AgentSkillVersion, AgentSkillApproval, DomainChatSettings, SupportConversation, SupportMessage, Assignment, AutomaticPaymentRelationship, Bank, Cart, CartItem, CartShipmentGroup, CartShipmentQuote, Category, Company, CompanyInvitation, Component, ComponentTag, ComponentVersion, CountryTax, Discount, DiscountGroup, Domain, DomainInvitation, DomainTag, Draft, DraftComment, DraftTemplate, EmailAddress, EmailCounter, EnrolledDomain, Entity, ExchangeRate, InternalTag, Inventory, InventoryUnitVariation, Invoice, Item, Job, JobComment, MatchingInventory, Menu, MenuItem, Merchi, MerchiFile, Notification, Page, Payment, PaymentDevice, PhoneNumber, Product, ProductionComment, Quote, QuoteItem, Reminder, apiFetch, apiFetchWithProgress, Session, Shipment, ShipmentItem, ShipmentItemFulfillment, ShipmentMethod, ShipmentMethodVariation, ShortUrl, SubscriptionPlan, SupplyDomain, SystemRole, Theme, ThemeCssSetting, User, UserCompany, Variation, VariationField, VariationFieldsOption, VariationOption, VariationsGroup, generateUUID, getCookie };
85
+ export { constants, request, util, toastNotifications, Address, AgentConversation, AgentSkill, AgentSkillVersion, AgentSkillApproval, DomainChatSettings, SupportConversation, SupportMessage, Assignment, AutomaticPaymentRelationship, Bank, Cart, CartItem, CartShipmentGroup, CartShipmentQuote, Category, Company, CompanyInvitation, Component, ComponentTag, ComponentVersion, CountryTax, Discount, DiscountGroup, Domain, DomainInvitation, DomainTag, Draft, DraftComment, DraftTemplate, EmailAddress, EmailCounter, EnrolledDomain, Entity, ExchangeRate, InternalTag, Inventory, InventoryUnitVariation, Invoice, Item, Job, JobComment, MatchingInventory, Menu, MenuItem, Merchi, MerchiFile, Notification, Page, Payment, PaymentDevice, PhoneNumber, Product, ProductionComment, Quote, QuoteItem, Reminder, apiFetch, apiFetchWithProgress, Session, Shipment, ShipmentLog, ShipmentItem, ShipmentItemFulfillment, ShipmentMethod, ShipmentMethodVariation, ShortUrl, SubscriptionPlan, SupplyDomain, SystemRole, Theme, ThemeCssSetting, User, UserCompany, Variation, VariationField, VariationFieldsOption, VariationOption, VariationsGroup, generateUUID, getCookie };
package/dist/merchi.js CHANGED
@@ -31,6 +31,7 @@ import { InventoryUnitVariation } from './entities/inventory_unit_variation.js';
31
31
  import { VariationFieldsOption } from './entities/variation_fields_option.js';
32
32
  import { Bank } from './entities/bank.js';
33
33
  import { Shipment } from './entities/shipment.js';
34
+ import { ShipmentLog } from './entities/shipment_log.js';
34
35
  import { ShipmentItem } from './entities/shipment_item.js';
35
36
  import { ShipmentItemFulfillment } from './entities/shipment_item_fulfillment.js';
36
37
  import { ShipmentMethod } from './entities/shipment_method.js';
@@ -221,6 +222,7 @@ var Merchi = /** @class */ (function () {
221
222
  this.InventoryGroup = this.setupClass(InventoryGroup);
222
223
  this.Notification = this.setupClass(Notification);
223
224
  this.Shipment = this.setupClass(Shipment);
225
+ this.ShipmentLog = this.setupClass(ShipmentLog);
224
226
  this.ShipmentItem = this.setupClass(ShipmentItem);
225
227
  this.ShipmentItemFulfillment = this.setupClass(ShipmentItemFulfillment);
226
228
  this.ShipmentMethod = this.setupClass(ShipmentMethod);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "merchi_sdk_ts",
3
- "version": "1.7.4",
3
+ "version": "1.7.6",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "repository": "git@github.com:merchisdk/merchi_sdk_ts.git",
@@ -12,6 +12,7 @@ import { Job } from './job.js';
12
12
  import { MerchiFile } from './file.js';
13
13
  import { User } from './user.js';
14
14
  import { ShipmentItem } from './shipment_item.js';
15
+ import { ShipmentLog } from './shipment_log.js';
15
16
  import { ShipmentMethod } from './shipment_method.js';
16
17
 
17
18
  interface CalculateOptions {
@@ -161,6 +162,9 @@ export class Shipment extends Entity {
161
162
  @Shipment.property({arrayType: 'Reminder'})
162
163
  public reminders?: Reminder[];
163
164
 
165
+ @Shipment.property({ arrayType: 'ShipmentLog' })
166
+ public logs?: ShipmentLog[];
167
+
164
168
  public calculateSubTotal = (options?: CalculateOptions) => {
165
169
  const { strictEmbed = true } = options ? options : {};
166
170
  if (strictEmbed){
@@ -0,0 +1,37 @@
1
+ import { Entity } from '../entity.js';
2
+ import type { Shipment } from './shipment.js';
3
+ import { User } from './user.js';
4
+
5
+ /**
6
+ * Runtime type tag only. The API returns `detailJson` as arbitrary JSON; the
7
+ * entity layer rejects `Object` from decorator metadata, so we use an empty
8
+ * class as the property `type` (same pattern as DraftTemplate.customisationMap).
9
+ */
10
+ const detailJsonPropertyType = class {};
11
+
12
+ export class ShipmentLog extends Entity {
13
+ protected static resourceName = 'shipment_logs';
14
+ protected static singularName = 'shipmentLog';
15
+ protected static pluralName = 'shipmentLogs';
16
+
17
+ @ShipmentLog.property()
18
+ public id?: number;
19
+
20
+ @ShipmentLog.property({ type: 'Shipment' })
21
+ public shipment?: Shipment | null;
22
+
23
+ @ShipmentLog.property({ type: User })
24
+ public user?: User | null;
25
+
26
+ @ShipmentLog.property({ type: String })
27
+ public sourceType?: string;
28
+
29
+ @ShipmentLog.property({ type: String })
30
+ public message?: string;
31
+
32
+ @ShipmentLog.property({ type: detailJsonPropertyType })
33
+ public detailJson?: Record<string, unknown> | null;
34
+
35
+ @ShipmentLog.property({ type: Date })
36
+ public createdAt?: Date | null;
37
+ }
@@ -22,6 +22,7 @@ import { Reminder } from './reminder.js';
22
22
  import { ProductionComment } from './production_comment.js';
23
23
  import { Session } from './session.js';
24
24
  import { Shipment } from './shipment.js';
25
+ import { ShipmentLog } from './shipment_log.js';
25
26
  import { SystemRole } from './system_role.js';
26
27
  import { Theme } from './theme.js';
27
28
  import { UserCompany } from './user_company.js';
@@ -167,6 +168,9 @@ export class User extends Entity {
167
168
  @User.property({ arrayType: 'JobComment' })
168
169
  public jobComments?: JobComment[];
169
170
 
171
+ @User.property({ arrayType: 'ShipmentLog' })
172
+ public shipmentLogs?: ShipmentLog[];
173
+
170
174
  @User.property({ arrayType: 'EmailAddress' })
171
175
  public _emailAddresses?: EmailAddress[];
172
176
 
package/src/entity.ts CHANGED
@@ -138,6 +138,7 @@ interface ListOptions {
138
138
  relatedDraft?: number;
139
139
  relatedJob?: number;
140
140
  relatedJobs?: number[];
141
+ relatedShipment?: number;
141
142
  relatedProduct?: number;
142
143
  relatedUser?: number;
143
144
  savedByUser?: number;
@@ -565,6 +566,10 @@ export class Entity {
565
566
  if (options.relatedJobs !== undefined) {
566
567
  fetchOptions.query.push(['related_jobs', options.relatedJobs.toString()]);
567
568
  }
569
+ if (options.relatedShipment !== undefined) {
570
+ fetchOptions.query.push(['related_shipment',
571
+ options.relatedShipment.toString()]);
572
+ }
568
573
  if (options.relatedProduct !== undefined) {
569
574
  fetchOptions.query.push(['related_product',
570
575
  options.relatedProduct.toString()]);
package/src/index.ts CHANGED
@@ -58,6 +58,7 @@ import { Reminder } from './entities/reminder.js';
58
58
  import { RequestOptions, apiFetch, apiFetchWithProgress } from './request.js'; // eslint-disable-next-line no-unused-vars
59
59
  import { Session } from './entities/session.js';
60
60
  import { Shipment } from './entities/shipment.js';
61
+ import { ShipmentLog } from './entities/shipment_log.js';
61
62
  import { ShipmentItem } from './entities/shipment_item.js';
62
63
  import { ShipmentItemFulfillment } from './entities/shipment_item_fulfillment.js';
63
64
  import { ShipmentMethod } from './entities/shipment_method.js';
@@ -150,6 +151,7 @@ export {
150
151
  apiFetchWithProgress,
151
152
  Session,
152
153
  Shipment,
154
+ ShipmentLog,
153
155
  ShipmentItem,
154
156
  ShipmentItemFulfillment,
155
157
  ShipmentMethod,
package/src/merchi.ts CHANGED
@@ -25,6 +25,7 @@ import { InventoryUnitVariation } from './entities/inventory_unit_variation.js';
25
25
  import { VariationFieldsOption } from './entities/variation_fields_option.js';
26
26
  import { Bank } from './entities/bank.js';
27
27
  import { Shipment } from './entities/shipment.js';
28
+ import { ShipmentLog } from './entities/shipment_log.js';
28
29
  import { ShipmentItem } from './entities/shipment_item.js';
29
30
  import { ShipmentItemFulfillment } from './entities/shipment_item_fulfillment.js';
30
31
  import { ShipmentMethod } from './entities/shipment_method.js';
@@ -136,6 +137,7 @@ export class Merchi {
136
137
  public ProductionComment: typeof ProductionComment;
137
138
  public DraftComment: typeof DraftComment;
138
139
  public Shipment: typeof Shipment;
140
+ public ShipmentLog: typeof ShipmentLog;
139
141
  public ShipmentItem: typeof ShipmentItem;
140
142
  public ShipmentItemFulfillment: typeof ShipmentItemFulfillment;
141
143
  public ShipmentMethod: typeof ShipmentMethod;
@@ -278,6 +280,7 @@ export class Merchi {
278
280
  this.InventoryGroup = this.setupClass(InventoryGroup) as typeof InventoryGroup;
279
281
  this.Notification = this.setupClass(Notification) as typeof Notification;
280
282
  this.Shipment = this.setupClass(Shipment) as typeof Shipment;
283
+ this.ShipmentLog = this.setupClass(ShipmentLog) as typeof ShipmentLog;
281
284
  this.ShipmentItem = this.setupClass(ShipmentItem) as typeof ShipmentItem;
282
285
  this.ShipmentItemFulfillment = this.setupClass(
283
286
  ShipmentItemFulfillment