repzo 1.0.6 → 1.0.9

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.
@@ -1 +1 @@
1
- export {};
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repzo",
3
- "version": "1.0.6",
3
+ "version": "1.0.9",
4
4
  "description": "Repzo TypeScript SDK",
5
5
  "main": "./lib/index.js",
6
6
  "type": "module",
package/src/index.ts CHANGED
@@ -1433,6 +1433,69 @@ export default class Repzo {
1433
1433
  },
1434
1434
  };
1435
1435
 
1436
+ integrationApp = {
1437
+ _path: "/integration-app",
1438
+ find: async (
1439
+ params?: Service.App.Find.Params
1440
+ ): Promise<Service.App.Find.Result> => {
1441
+ let res: Service.App.Find.Result = await this._fetch(
1442
+ this.svAPIEndpoint,
1443
+ this.integrationApp._path,
1444
+ params
1445
+ );
1446
+ return res;
1447
+ },
1448
+
1449
+ get: async (
1450
+ id: Service.App.Get.ID,
1451
+ params?: Service.App.Find.Params
1452
+ ): Promise<Service.App.Get.Result> => {
1453
+ return await this._fetch(
1454
+ this.svAPIEndpoint,
1455
+ this.integrationApp._path + `/${id}`,
1456
+ params
1457
+ );
1458
+ },
1459
+
1460
+ create: async (
1461
+ body: Service.App.Create.Body
1462
+ ): Promise<Service.App.Create.Result> => {
1463
+ let res = await this._create(
1464
+ this.svAPIEndpoint,
1465
+ this.integrationApp._path,
1466
+ body
1467
+ );
1468
+ return res;
1469
+ },
1470
+
1471
+ update: async (
1472
+ id: Service.App.Update.ID,
1473
+ body: Service.App.Update.Body
1474
+ ): Promise<Service.App.Update.Result> => {
1475
+ let res: Service.App.Update.Result = await this._update(
1476
+ this.svAPIEndpoint,
1477
+ this.integrationApp._path + `/${id}`,
1478
+ body
1479
+ );
1480
+ return res;
1481
+ },
1482
+ };
1483
+
1484
+ joinActionsWebHook = {
1485
+ _path: "/svix-integration",
1486
+ update: async (
1487
+ id: null,
1488
+ body: Service.JoinActionsWeHook.Data
1489
+ ): Promise<Service.JoinActionsWeHook.Result> => {
1490
+ let res: Service.JoinActionsWeHook.Result = await this._update(
1491
+ this.svAPIEndpoint,
1492
+ this.joinActionsWebHook._path,
1493
+ body
1494
+ );
1495
+ return res;
1496
+ },
1497
+ };
1498
+
1436
1499
  static ActionLogs = class {
1437
1500
  _path: string = "/integration-action-log";
1438
1501
  available_app_name: string = "";
@@ -1487,7 +1550,7 @@ export default class Repzo {
1487
1550
 
1488
1551
  return this;
1489
1552
  }
1490
- async setStatus(status: Service.ActionLogs.Status, error?: any) {
1553
+ setStatus(status: Service.ActionLogs.Status, error?: any) {
1491
1554
  this.details.push({
1492
1555
  timestamp: Date.now(),
1493
1556
  content: `status was changed from ${this.status} to ${status}`,
@@ -1535,11 +1598,12 @@ export default class Repzo {
1535
1598
  }
1536
1599
  return this;
1537
1600
  }
1538
- addDetail(detail: string, meta: any) {
1601
+ addDetail(detail: string, meta?: any) {
1539
1602
  let d: Service.ActionLogs.Detail = {
1540
1603
  timestamp: Date.now(),
1541
1604
  content: detail,
1542
1605
  };
1606
+ this.message = detail;
1543
1607
  if (meta) d.meta = meta;
1544
1608
  this.details.push(d);
1545
1609
  return this;
@@ -1726,6 +1790,7 @@ export default class Repzo {
1726
1790
  timestamp: Date.now(),
1727
1791
  content: detail,
1728
1792
  };
1793
+ this.message = detail;
1729
1794
  if (meta) d.meta = meta;
1730
1795
  this.details.push(d);
1731
1796
  return this;
@@ -2065,6 +2065,70 @@ export namespace Service {
2065
2065
  export type Result = CustomStatusSchema;
2066
2066
  }
2067
2067
  }
2068
+
2069
+ export namespace ReturnReason {
2070
+ export interface Schema {
2071
+ _id: string;
2072
+ name: string;
2073
+ local_name?: string;
2074
+ disabled?: boolean;
2075
+ integration_meta?: { [key: string]: any };
2076
+ company_namespace: string[];
2077
+ createdAt: string;
2078
+ updatedAt: string;
2079
+ __v: number;
2080
+ }
2081
+ export interface Data {
2082
+ name?: string;
2083
+ local_name?: string;
2084
+ disabled?: boolean;
2085
+ integration_meta?: { [key: string]: any };
2086
+ company_namespace?: string[];
2087
+ }
2088
+
2089
+ export namespace Find {
2090
+ export type Params = DefaultPaginationQueryParams & {
2091
+ _id?: string[] | string;
2092
+ search?: string;
2093
+ name?: string[] | string;
2094
+ local_name?: string[] | string;
2095
+ disabled?: boolean;
2096
+ [key: string]: any; // integration_meta.
2097
+ };
2098
+ export interface Result extends DefaultPaginationResult {
2099
+ data: Schema[];
2100
+ }
2101
+ }
2102
+
2103
+ export namespace Get {
2104
+ export type ID = string;
2105
+ export type Result = Schema;
2106
+ }
2107
+
2108
+ export namespace Create {
2109
+ export interface Body extends Data {
2110
+ name: string;
2111
+ }
2112
+ export type Result = Schema;
2113
+ }
2114
+
2115
+ export namespace Update {
2116
+ export type ID = string;
2117
+ export interface Body extends Data {
2118
+ _id?: string;
2119
+ createdAt?: string;
2120
+ updatedAt?: string;
2121
+ __v?: number;
2122
+ }
2123
+ export type Result = Schema;
2124
+ }
2125
+
2126
+ export namespace Remove {
2127
+ export type ID = string;
2128
+ export type Result = Schema;
2129
+ }
2130
+ }
2131
+
2068
2132
  export namespace Promotion {
2069
2133
  interface CompoundSchema {
2070
2134
  manual_allocation?: boolean;
@@ -2289,6 +2353,7 @@ export namespace Service {
2289
2353
  company_namespace: string[];
2290
2354
  class: "invoice" | "return";
2291
2355
  note?: string;
2356
+ return_reason?: string;
2292
2357
  }
2293
2358
  export interface Body {
2294
2359
  variant: Item_Variant;
@@ -2341,7 +2406,7 @@ export namespace Service {
2341
2406
  }
2342
2407
 
2343
2408
  export namespace FullInvoice {
2344
- interface InvoiceSchema {
2409
+ export interface InvoiceSchema {
2345
2410
  _id: string;
2346
2411
  items: Item.Schema[];
2347
2412
  return_items: Item.Schema[];
@@ -2692,6 +2757,7 @@ export namespace Service {
2692
2757
  lineTotalAfterDeduction?: number;
2693
2758
  company_namespace?: string[];
2694
2759
  note?: string;
2760
+ return_reason?: string | ReturnReason.Schema;
2695
2761
  }[];
2696
2762
  integration_meta?: { [key: string]: any };
2697
2763
  external_serial_number?: string;
@@ -2817,7 +2883,11 @@ export namespace Service {
2817
2883
  };
2818
2884
 
2819
2885
  type InvoiceStatus = "paid" | "unpaid" | "partially_paid";
2820
- type PopulatedKeys = "client" | "tax_number" | "custom_status";
2886
+ type PopulatedKeys =
2887
+ | "client"
2888
+ | "tax_number"
2889
+ | "custom_status"
2890
+ | "return_reason";
2821
2891
  type SortingKeys =
2822
2892
  | "line_total"
2823
2893
  | "product_name"
@@ -3257,7 +3327,7 @@ export namespace Service {
3257
3327
  }
3258
3328
 
3259
3329
  export namespace Payment {
3260
- interface PaymentSchema {
3330
+ export interface PaymentSchema {
3261
3331
  _id: string;
3262
3332
  status: PaymentStatus;
3263
3333
  remainder: number;
@@ -3976,7 +4046,22 @@ export namespace Service {
3976
4046
  export type Result = Schema;
3977
4047
  }
3978
4048
  }
3979
-
4049
+ export namespace JoinActionsWeHook {
4050
+ interface JoinData {
4051
+ app: string;
4052
+ action: string;
4053
+ event: string;
4054
+ join: boolean;
4055
+ }
4056
+ export interface Result {
4057
+ data: JoinData[];
4058
+ status?: "success" | "failure";
4059
+ error?: any;
4060
+ }
4061
+ export interface Data {
4062
+ data: JoinData[];
4063
+ }
4064
+ }
3980
4065
  export namespace App {
3981
4066
  export interface Schema {
3982
4067
  _id: string;
@@ -3984,6 +4069,7 @@ export namespace Service {
3984
4069
  disabled?: boolean;
3985
4070
  available_app: string;
3986
4071
  formData: any;
4072
+ options_formData?: any;
3987
4073
  company_namespace: string[];
3988
4074
  createdAt: string;
3989
4075
  updatedAt: string;
@@ -3995,11 +4081,64 @@ export namespace Service {
3995
4081
  disabled?: boolean;
3996
4082
  available_app: AvailableApp;
3997
4083
  formData: any;
4084
+ options_formData?: any;
3998
4085
  company_namespace: string[];
3999
4086
  createdAt: string;
4000
4087
  updatedAt: string;
4001
4088
  __v: number;
4002
4089
  }
4090
+
4091
+ type PopulatedKeys = "available_app";
4092
+
4093
+ export interface AppBody {
4094
+ name?: string;
4095
+ disabled?: boolean;
4096
+ available_app?: string;
4097
+ formData?: any;
4098
+ options_formData?: any;
4099
+ company_namespace?: string[];
4100
+ }
4101
+
4102
+ export namespace Find {
4103
+ export type Params = DefaultPaginationQueryParams & {
4104
+ _id?: string[] | string;
4105
+ search?: string;
4106
+ name?: string[] | string;
4107
+ disabled?: boolean;
4108
+ populatedKeys?: PopulatedKeys[];
4109
+ };
4110
+ export interface Result extends DefaultPaginationResult {
4111
+ data: (Schema | Schema_with_populated_AvailableApp)[];
4112
+ }
4113
+ }
4114
+
4115
+ export namespace Get {
4116
+ export type ID = string;
4117
+ export interface Params {
4118
+ populatedKeys?: PopulatedKeys[];
4119
+ }
4120
+ export type Result = Schema | Schema_with_populated_AvailableApp;
4121
+ }
4122
+
4123
+ export namespace Create {
4124
+ export interface Body extends AppBody {
4125
+ name: string;
4126
+ available_app: string;
4127
+ formData: any;
4128
+ }
4129
+ export type Result = Schema;
4130
+ }
4131
+
4132
+ export namespace Update {
4133
+ export type ID = string;
4134
+ export interface Body extends AppBody {
4135
+ _id?: string;
4136
+ createdAt?: string;
4137
+ updatedAt?: string;
4138
+ __v?: number;
4139
+ }
4140
+ export type Result = Schema;
4141
+ }
4003
4142
  }
4004
4143
 
4005
4144
  export interface AvailableApp {
package/test.ts CHANGED
@@ -1,8 +1,8 @@
1
- import Repzo from "./src/index.js";
2
- let repzo = new Repzo("");
3
- let clients = repzo.client.find({ search: "Mecca" });
4
- console.log(clients);
5
- repzo.client.create({ name: "kf" });
6
- repzo.headers["ho"] = "faf";
7
- repzo.client.update("", {});
8
- // repzo.
1
+ import Repzo from "./src/index.js";
2
+ let repzo = new Repzo("");
3
+ let clients = repzo.client.find({ search: "Mecca" });
4
+ console.log(clients);
5
+ repzo.client.create({ name: "kf" });
6
+ repzo.headers["ho"] = "faf";
7
+ repzo.client.update("", {});
8
+ // repzo.
package/tsconfig.json CHANGED
@@ -1,17 +1,17 @@
1
- {
2
- "compilerOptions": {
3
- "outDir": "./lib",
4
- "allowJs": true,
5
- "target": "ES2020",
6
- "module": "ES2020",
7
- "esModuleInterop": true,
8
- "moduleResolution": "Node",
9
- "resolveJsonModule": true,
10
- "noImplicitThis": false,
11
- "strict": true,
12
- "declaration": true
13
- },
14
- "ts-node": { "esm": true },
15
- "include": ["src/**/*"],
16
- "exclude": ["node_modules", "test/**/*", "**/*.spec.ts"]
17
- }
1
+ {
2
+ "compilerOptions": {
3
+ "outDir": "./lib",
4
+ "allowJs": true,
5
+ "target": "ES2020",
6
+ "module": "ES2020",
7
+ "esModuleInterop": true,
8
+ "moduleResolution": "Node",
9
+ "resolveJsonModule": true,
10
+ "noImplicitThis": false,
11
+ "strict": true,
12
+ "declaration": true
13
+ },
14
+ "ts-node": { "esm": true },
15
+ "include": ["src/**/*"],
16
+ "exclude": ["node_modules", "test/**/*", "**/*.spec.ts"]
17
+ }