repzo 1.0.122 → 1.0.123

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/changelog.md CHANGED
@@ -9,6 +9,7 @@
9
9
  - update FullInvoice with ubl keys @maramalshen
10
10
  - add: approval-request @maramalshen
11
11
  - add: workorder-request @maramalshen
12
+ - add: approval @maramalshen
12
13
 
13
14
  ### Changed
14
15
 
package/lib/index.d.ts CHANGED
@@ -93,6 +93,7 @@ export default class Repzo {
93
93
  readonly ASSET: "asset";
94
94
  readonly ASSET_UNIT: "asset-unit";
95
95
  readonly WORKORDER_PORTAL: "workorder-portal";
96
+ readonly APPROVAL: "approvals";
96
97
  };
97
98
  private _fetch;
98
99
  private _create;
@@ -1475,4 +1476,24 @@ export default class Repzo {
1475
1476
  id: Service.WorkorderPortal.Update.ID
1476
1477
  ) => Promise<Service.WorkorderPortal.Remove.Result>;
1477
1478
  };
1479
+ approval: {
1480
+ _path: "approvals";
1481
+ find: (
1482
+ params?: Service.Approval.Find.Params
1483
+ ) => Promise<Service.Approval.Find.Result>;
1484
+ get: (
1485
+ id: Service.Approval.Get.ID,
1486
+ params?: Service.Approval.Get.Params
1487
+ ) => Promise<Service.Approval.Get.Result>;
1488
+ create: (
1489
+ body: Service.Approval.Create.Body
1490
+ ) => Promise<Service.Approval.Create.Result>;
1491
+ update: (
1492
+ id: Service.Approval.Update.ID,
1493
+ body: Service.Approval.Update.Body
1494
+ ) => Promise<Service.Approval.Update.Result>;
1495
+ remove: (
1496
+ id: Service.Approval.Remove.ID
1497
+ ) => Promise<Service.Approval.Remove.Result>;
1498
+ };
1478
1499
  }
package/lib/index.js CHANGED
@@ -82,6 +82,7 @@ export default class Repzo {
82
82
  ASSET: "asset",
83
83
  ASSET_UNIT: "asset-unit",
84
84
  WORKORDER_PORTAL: "workorder-portal",
85
+ APPROVAL: "approvals",
85
86
  };
86
87
  this.END_POINTS = this._end_points;
87
88
  this.client = {
@@ -2734,6 +2735,47 @@ export default class Repzo {
2734
2735
  return res;
2735
2736
  },
2736
2737
  };
2738
+ this.approval = {
2739
+ _path: this._end_points.APPROVAL,
2740
+ find: async (params) => {
2741
+ let res = await this._fetch(
2742
+ this.svAPIEndpoint,
2743
+ this.approval._path,
2744
+ params
2745
+ );
2746
+ return res;
2747
+ },
2748
+ get: async (id, params) => {
2749
+ return await this._fetch(
2750
+ this.svAPIEndpoint,
2751
+ this.approval._path + `/${id}`,
2752
+ params
2753
+ );
2754
+ },
2755
+ create: async (body) => {
2756
+ let res = await this._create(
2757
+ this.svAPIEndpoint,
2758
+ this.approval._path,
2759
+ body
2760
+ );
2761
+ return res;
2762
+ },
2763
+ update: async (id, body) => {
2764
+ let res = await this._update(
2765
+ this.svAPIEndpoint,
2766
+ this.approval._path + `/${id}`,
2767
+ body
2768
+ );
2769
+ return res;
2770
+ },
2771
+ remove: async (id) => {
2772
+ let res = await this._delete(
2773
+ this.svAPIEndpoint,
2774
+ this.approval._path + `/${id}`
2775
+ );
2776
+ return res;
2777
+ },
2778
+ };
2737
2779
  this.svAPIEndpoint =
2738
2780
  !options?.env || options?.env == "production"
2739
2781
  ? "https://sv.api.repzo.me"
@@ -8107,6 +8107,184 @@ export declare namespace Service {
8107
8107
  type Result = SupplierSchema;
8108
8108
  }
8109
8109
  }
8110
+ namespace Approval {
8111
+ interface Data {
8112
+ _id: StringId;
8113
+ creator: AdminCreator;
8114
+ name: string;
8115
+ disabled: boolean;
8116
+ company_namespace: string[];
8117
+ type:
8118
+ | "proforma"
8119
+ | "transfer"
8120
+ | "approval-request"
8121
+ | "receiving-material"
8122
+ | "asset-part-transfer"
8123
+ | "adjust-inventory"
8124
+ | "return-asset-part-unit"
8125
+ | "store-asset-part-unit";
8126
+ position?: number;
8127
+ description?: string;
8128
+ rules: {
8129
+ index: number;
8130
+ name: string;
8131
+ permissions: {
8132
+ can_edit: boolean;
8133
+ };
8134
+ admins: {
8135
+ _id: StringId;
8136
+ name?: string;
8137
+ type: "admin";
8138
+ }[];
8139
+ reps: {
8140
+ _id: StringId;
8141
+ name?: string;
8142
+ type: "rep";
8143
+ }[];
8144
+ append_creator?: boolean;
8145
+ append_assigned_origin_warehouse_rep?: boolean;
8146
+ append_assigned_destination_warehouse_rep?: boolean;
8147
+ send_email?: boolean;
8148
+ }[];
8149
+ filters?: {
8150
+ key: string;
8151
+ operator: "eq" | "ne" | "in" | "nin" | "gt" | "gte" | "lt" | "lte";
8152
+ value: any[];
8153
+ manipulator_function?: string;
8154
+ }[];
8155
+ createdAt: Date;
8156
+ updatedAt: Date;
8157
+ __v: number;
8158
+ }
8159
+ interface CreateBody {
8160
+ name: string;
8161
+ type:
8162
+ | "proforma"
8163
+ | "transfer"
8164
+ | "approval-request"
8165
+ | "receiving-material"
8166
+ | "asset-part-transfer"
8167
+ | "adjust-inventory"
8168
+ | "return-asset-part-unit"
8169
+ | "store-asset-part-unit";
8170
+ creator?: AdminCreator;
8171
+ disabled?: boolean;
8172
+ company_namespace?: string[];
8173
+ position?: number;
8174
+ description?: string;
8175
+ rules: {
8176
+ index: number;
8177
+ name: string;
8178
+ permissions?: {
8179
+ can_edit: boolean;
8180
+ };
8181
+ admins?: {
8182
+ _id: StringId;
8183
+ name?: string;
8184
+ type: "admin";
8185
+ }[];
8186
+ reps?: {
8187
+ _id: StringId;
8188
+ name?: string;
8189
+ type: "rep";
8190
+ }[];
8191
+ append_creator?: boolean;
8192
+ append_assigned_origin_warehouse_rep?: boolean;
8193
+ append_assigned_destination_warehouse_rep?: boolean;
8194
+ send_email?: boolean;
8195
+ }[];
8196
+ filters?: {
8197
+ key: string;
8198
+ operator: "eq" | "ne" | "in" | "nin" | "gt" | "gte" | "lt" | "lte";
8199
+ value: any[];
8200
+ manipulator_function?: string;
8201
+ }[];
8202
+ }
8203
+ interface UpdateBody {
8204
+ _id?: StringId;
8205
+ creator?: AdminCreator;
8206
+ name?: string;
8207
+ disabled?: boolean;
8208
+ company_namespace?: string[];
8209
+ type?:
8210
+ | "proforma"
8211
+ | "transfer"
8212
+ | "approval-request"
8213
+ | "receiving-material"
8214
+ | "asset-part-transfer"
8215
+ | "adjust-inventory"
8216
+ | "return-asset-part-unit"
8217
+ | "store-asset-part-unit";
8218
+ position?: number;
8219
+ description?: string;
8220
+ rules?: {
8221
+ index: number;
8222
+ name: string;
8223
+ permissions?: {
8224
+ can_edit: boolean;
8225
+ };
8226
+ admins?: {
8227
+ _id: StringId;
8228
+ name?: string;
8229
+ type: "admin";
8230
+ }[];
8231
+ reps?: {
8232
+ _id: StringId;
8233
+ name?: string;
8234
+ type: "rep";
8235
+ }[];
8236
+ append_creator?: boolean;
8237
+ append_assigned_origin_warehouse_rep?: boolean;
8238
+ append_assigned_destination_warehouse_rep?: boolean;
8239
+ send_email?: boolean;
8240
+ }[];
8241
+ filters?: {
8242
+ key: string;
8243
+ operator: "eq" | "ne" | "in" | "nin" | "gt" | "gte" | "lt" | "lte";
8244
+ value: any[];
8245
+ manipulator_function?: string;
8246
+ }[];
8247
+ createdAt?: Date;
8248
+ updatedAt?: Date;
8249
+ __v?: number;
8250
+ }
8251
+ namespace Find {
8252
+ type Params = DefaultPaginationQueryParams & {
8253
+ _id?: StringId[] | StringId;
8254
+ search?: string;
8255
+ name?: string[] | string;
8256
+ disabled?: boolean;
8257
+ sortBy?: {
8258
+ field: "_id" | "position" | "updatedAt";
8259
+ type: "asc" | "desc";
8260
+ }[];
8261
+ [key: string]: any;
8262
+ };
8263
+ interface Result extends DefaultPaginationResult {
8264
+ data: Data[];
8265
+ }
8266
+ }
8267
+ namespace Get {
8268
+ type ID = string;
8269
+ type Params = {
8270
+ [key: string]: any;
8271
+ };
8272
+ type Result = Data;
8273
+ }
8274
+ namespace Create {
8275
+ type Body = CreateBody;
8276
+ type Result = Data;
8277
+ }
8278
+ namespace Update {
8279
+ type ID = string;
8280
+ type Body = UpdateBody;
8281
+ type Result = Data;
8282
+ }
8283
+ namespace Remove {
8284
+ type ID = string;
8285
+ type Result = Data;
8286
+ }
8287
+ }
8110
8288
  namespace Cycle {
8111
8289
  type CycleStatus = "pending" | "approved" | "processing" | "rejected";
8112
8290
  export interface Schema {
@@ -12915,6 +13093,11 @@ export declare namespace Service {
12915
13093
  createdAt: Date;
12916
13094
  updatedAt: Date;
12917
13095
  }
13096
+ export type PopulatedDoc = Data & {
13097
+ cycle?: Cycle.Schema & {
13098
+ approval?: string | Approval.Data;
13099
+ };
13100
+ };
12918
13101
  export interface CreateBody {
12919
13102
  document_id?: StringId;
12920
13103
  document_type: "client" | "visit";
@@ -13119,10 +13302,12 @@ export declare namespace Service {
13119
13302
  field: "_id";
13120
13303
  type: "asc" | "desc";
13121
13304
  }[];
13305
+ withCycle?: boolean;
13306
+ populatedKeys?: ["approval"];
13122
13307
  [key: string]: any;
13123
13308
  };
13124
13309
  interface Result extends DefaultPaginationResult {
13125
- data: Data[];
13310
+ data: Data[] | PopulatedDoc[];
13126
13311
  }
13127
13312
  }
13128
13313
  export namespace Get {
@@ -13132,10 +13317,13 @@ export declare namespace Service {
13132
13317
  validityCheck?: boolean;
13133
13318
  originalDoc_populatedKeys?: PopulatedKeys[];
13134
13319
  withOriginalDoc?: boolean;
13320
+ populatedKeys?: ["approval"];
13135
13321
  [key: string]: any;
13136
13322
  };
13137
13323
  type Result = Data & {
13138
- cycle?: Cycle.Schema;
13324
+ cycle?: Cycle.Schema & {
13325
+ approval?: string | Approval.Data;
13326
+ };
13139
13327
  original_doc?: Client.ClientSchema | Visit.VisitSchema;
13140
13328
  };
13141
13329
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repzo",
3
- "version": "1.0.122",
3
+ "version": "1.0.123",
4
4
  "description": "Repzo TypeScript SDK",
5
5
  "main": "./lib/index.js",
6
6
  "type": "module",
package/src/index.ts CHANGED
@@ -117,6 +117,7 @@ export default class Repzo {
117
117
  ASSET: "asset",
118
118
  ASSET_UNIT: "asset-unit",
119
119
  WORKORDER_PORTAL: "workorder-portal",
120
+ APPROVAL: "approvals",
120
121
  } as const;
121
122
  public END_POINTS = this._end_points;
122
123
  private async _fetch(baseUrl: string, path: string, params?: Params) {
@@ -4147,6 +4148,60 @@ export default class Repzo {
4147
4148
  return res;
4148
4149
  },
4149
4150
  };
4151
+
4152
+ approval = {
4153
+ _path: this._end_points.APPROVAL,
4154
+ find: async (
4155
+ params?: Service.Approval.Find.Params
4156
+ ): Promise<Service.Approval.Find.Result> => {
4157
+ let res: Service.Approval.Find.Result = await this._fetch(
4158
+ this.svAPIEndpoint,
4159
+ this.approval._path,
4160
+ params
4161
+ );
4162
+ return res;
4163
+ },
4164
+ get: async (
4165
+ id: Service.Approval.Get.ID,
4166
+ params?: Service.Approval.Get.Params
4167
+ ): Promise<Service.Approval.Get.Result> => {
4168
+ return await this._fetch(
4169
+ this.svAPIEndpoint,
4170
+ this.approval._path + `/${id}`,
4171
+ params
4172
+ );
4173
+ },
4174
+ create: async (
4175
+ body: Service.Approval.Create.Body
4176
+ ): Promise<Service.Approval.Create.Result> => {
4177
+ let res = await this._create(
4178
+ this.svAPIEndpoint,
4179
+ this.approval._path,
4180
+ body
4181
+ );
4182
+ return res;
4183
+ },
4184
+ update: async (
4185
+ id: Service.Approval.Update.ID,
4186
+ body: Service.Approval.Update.Body
4187
+ ): Promise<Service.Approval.Update.Result> => {
4188
+ let res: Service.Approval.Update.Result = await this._update(
4189
+ this.svAPIEndpoint,
4190
+ this.approval._path + `/${id}`,
4191
+ body
4192
+ );
4193
+ return res;
4194
+ },
4195
+ remove: async (
4196
+ id: Service.Approval.Remove.ID
4197
+ ): Promise<Service.Approval.Remove.Result> => {
4198
+ let res: Service.Approval.Remove.Result = await this._delete(
4199
+ this.svAPIEndpoint,
4200
+ this.approval._path + `/${id}`
4201
+ );
4202
+ return res;
4203
+ },
4204
+ };
4150
4205
  }
4151
4206
 
4152
4207
  function normalizeParams(params: Params): { [key: string]: any } {
@@ -7986,6 +7986,155 @@ export namespace Service {
7986
7986
  }
7987
7987
  }
7988
7988
 
7989
+ export namespace Approval {
7990
+ export interface Data {
7991
+ _id: StringId;
7992
+ creator: AdminCreator;
7993
+ name: string;
7994
+ disabled: boolean;
7995
+ company_namespace: string[];
7996
+ type:
7997
+ | "proforma"
7998
+ | "transfer"
7999
+ | "approval-request"
8000
+ | "receiving-material"
8001
+ | "asset-part-transfer"
8002
+ | "adjust-inventory"
8003
+ | "return-asset-part-unit"
8004
+ | "store-asset-part-unit";
8005
+ position?: number;
8006
+ description?: string;
8007
+ rules: {
8008
+ index: number;
8009
+ name: string;
8010
+ permissions: { can_edit: boolean };
8011
+ admins: { _id: StringId; name?: string; type: "admin" }[];
8012
+ reps: { _id: StringId; name?: string; type: "rep" }[];
8013
+ append_creator?: boolean;
8014
+ append_assigned_origin_warehouse_rep?: boolean;
8015
+ append_assigned_destination_warehouse_rep?: boolean;
8016
+ send_email?: boolean;
8017
+ }[];
8018
+ filters?: {
8019
+ key: string;
8020
+ operator: "eq" | "ne" | "in" | "nin" | "gt" | "gte" | "lt" | "lte";
8021
+ value: any[];
8022
+ manipulator_function?: string;
8023
+ }[];
8024
+ createdAt: Date;
8025
+ updatedAt: Date;
8026
+ __v: number;
8027
+ }
8028
+
8029
+ export interface CreateBody {
8030
+ name: string;
8031
+ type:
8032
+ | "proforma"
8033
+ | "transfer"
8034
+ | "approval-request"
8035
+ | "receiving-material"
8036
+ | "asset-part-transfer"
8037
+ | "adjust-inventory"
8038
+ | "return-asset-part-unit"
8039
+ | "store-asset-part-unit";
8040
+ creator?: AdminCreator;
8041
+ disabled?: boolean;
8042
+ company_namespace?: string[];
8043
+ position?: number;
8044
+ description?: string;
8045
+ rules: {
8046
+ index: number;
8047
+ name: string;
8048
+ permissions?: { can_edit: boolean };
8049
+ admins?: { _id: StringId; name?: string; type: "admin" }[];
8050
+ reps?: { _id: StringId; name?: string; type: "rep" }[];
8051
+ append_creator?: boolean;
8052
+ append_assigned_origin_warehouse_rep?: boolean;
8053
+ append_assigned_destination_warehouse_rep?: boolean;
8054
+ send_email?: boolean;
8055
+ }[];
8056
+ filters?: {
8057
+ key: string;
8058
+ operator: "eq" | "ne" | "in" | "nin" | "gt" | "gte" | "lt" | "lte";
8059
+ value: any[];
8060
+ manipulator_function?: string;
8061
+ }[];
8062
+ }
8063
+ export interface UpdateBody {
8064
+ _id?: StringId;
8065
+ creator?: AdminCreator;
8066
+ name?: string;
8067
+ disabled?: boolean;
8068
+ company_namespace?: string[];
8069
+ type?:
8070
+ | "proforma"
8071
+ | "transfer"
8072
+ | "approval-request"
8073
+ | "receiving-material"
8074
+ | "asset-part-transfer"
8075
+ | "adjust-inventory"
8076
+ | "return-asset-part-unit"
8077
+ | "store-asset-part-unit";
8078
+ position?: number;
8079
+ description?: string;
8080
+ rules?: {
8081
+ index: number;
8082
+ name: string;
8083
+ permissions?: { can_edit: boolean };
8084
+ admins?: { _id: StringId; name?: string; type: "admin" }[];
8085
+ reps?: { _id: StringId; name?: string; type: "rep" }[];
8086
+ append_creator?: boolean;
8087
+ append_assigned_origin_warehouse_rep?: boolean;
8088
+ append_assigned_destination_warehouse_rep?: boolean;
8089
+ send_email?: boolean;
8090
+ }[];
8091
+ filters?: {
8092
+ key: string;
8093
+ operator: "eq" | "ne" | "in" | "nin" | "gt" | "gte" | "lt" | "lte";
8094
+ value: any[];
8095
+ manipulator_function?: string;
8096
+ }[];
8097
+ createdAt?: Date;
8098
+ updatedAt?: Date;
8099
+ __v?: number;
8100
+ }
8101
+
8102
+ export namespace Find {
8103
+ export type Params = DefaultPaginationQueryParams & {
8104
+ _id?: StringId[] | StringId;
8105
+ search?: string;
8106
+ name?: string[] | string;
8107
+ disabled?: boolean;
8108
+ sortBy?: {
8109
+ field: "_id" | "position" | "updatedAt";
8110
+ type: "asc" | "desc";
8111
+ }[];
8112
+ [key: string]: any; // integration_meta.
8113
+ };
8114
+ export interface Result extends DefaultPaginationResult {
8115
+ data: Data[];
8116
+ }
8117
+ }
8118
+ export namespace Get {
8119
+ export type ID = string;
8120
+ export type Params = { [key: string]: any };
8121
+ export type Result = Data;
8122
+ }
8123
+ export namespace Create {
8124
+ export type Body = CreateBody;
8125
+ export type Result = Data;
8126
+ }
8127
+ export namespace Update {
8128
+ export type ID = string;
8129
+ export type Body = UpdateBody;
8130
+ export type Result = Data;
8131
+ }
8132
+ export namespace Remove {
8133
+ export type ID = string;
8134
+ export type Result = Data;
8135
+ }
8136
+ }
8137
+
7989
8138
  export namespace Cycle {
7990
8139
  type CycleStatus = "pending" | "approved" | "processing" | "rejected";
7991
8140
  export interface Schema {
@@ -12451,7 +12600,9 @@ export namespace Service {
12451
12600
  createdAt: Date;
12452
12601
  updatedAt: Date;
12453
12602
  }
12454
-
12603
+ export type PopulatedDoc = Data & {
12604
+ cycle?: Cycle.Schema & { approval?: string | Approval.Data };
12605
+ };
12455
12606
  export interface CreateBody {
12456
12607
  document_id?: StringId;
12457
12608
  document_type: "client" | "visit";
@@ -12645,10 +12796,12 @@ export namespace Service {
12645
12796
  "meta.business_day": string | string[];
12646
12797
  "meta.form._id": StringId | StringId[];
12647
12798
  sortBy?: { field: "_id"; type: "asc" | "desc" }[];
12799
+ withCycle?: boolean;
12800
+ populatedKeys?: ["approval"];
12648
12801
  [key: string]: any; // integration_meta.
12649
12802
  };
12650
12803
  export interface Result extends DefaultPaginationResult {
12651
- data: Data[];
12804
+ data: Data[] | PopulatedDoc[];
12652
12805
  }
12653
12806
  }
12654
12807
  export namespace Get {
@@ -12658,10 +12811,11 @@ export namespace Service {
12658
12811
  validityCheck?: boolean;
12659
12812
  originalDoc_populatedKeys?: PopulatedKeys[];
12660
12813
  withOriginalDoc?: boolean;
12814
+ populatedKeys?: ["approval"];
12661
12815
  [key: string]: any; // integration_meta.
12662
12816
  };
12663
12817
  export type Result = Data & {
12664
- cycle?: Cycle.Schema;
12818
+ cycle?: Cycle.Schema & { approval?: string | Approval.Data };
12665
12819
  original_doc?: Client.ClientSchema | Visit.VisitSchema;
12666
12820
  };
12667
12821
  }