@matech/thebigpos-sdk 3.26.0-pr-6013-8261 → 3.26.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/package.json CHANGED
@@ -1,19 +1,12 @@
1
1
  {
2
2
  "name": "@matech/thebigpos-sdk",
3
- "version": "3.26.0-pr-6013-8261",
3
+ "version": "3.26.0",
4
4
  "description": "The Big POS Typescript SDK",
5
- "main": "dist/index.cjs",
6
- "module": "dist/index.js",
7
- "react-native": "dist/index.js",
5
+ "main": "dist/index.js",
8
6
  "types": "dist/index.d.ts",
9
- "files": [
10
- "dist",
11
- "src",
12
- "index.js"
13
- ],
14
7
  "scripts": {
15
- "build": "rimraf dist && tsc && esbuild dist/index.js --format=cjs --platform=node --packages=external --sourcemap --outfile=dist/index.cjs",
16
- "postbuild": "node -e \"if (typeof require('./').Api !== 'function') { console.error('Smoke check failed: the CommonJS entry does not export Api'); process.exit(1) }\"",
8
+ "build": "rimraf dist && tsc",
9
+ "test": "mocha -r ts-node/register 'src/api_test.spec.ts' --exit",
17
10
  "browserify": "tsc && esbuild dist/index.js --bundle --minify --sourcemap --global-name=thebigpos --outfile=dist/thebigpos.min.js",
18
11
  "prepare": "husky"
19
12
  },
@@ -33,22 +26,15 @@
33
26
  "url": "https://github.com/MortgageAutomationTechnologies/thebigpos-sdk-typescript/issues"
34
27
  },
35
28
  "homepage": "https://github.com/MortgageAutomationTechnologies/thebigpos-sdk-typescript#readme",
36
- "engines": {
37
- "node": ">=18"
38
- },
39
- "peerDependencies": {
40
- "axios": "^1"
29
+ "dependencies": {
30
+ "axios": "^1.7.7"
41
31
  },
42
32
  "devDependencies": {
43
- "axios": "^1.20.0",
44
- "esbuild": "^0.28.1",
33
+ "esbuild": "^0.27.0",
45
34
  "husky": "^9.1.5",
46
- "rimraf": "6.1.3",
35
+ "rimraf": "6.1.1",
36
+ "ts-node": "^10.9.2",
47
37
  "typescript": "^5.5.4"
48
38
  },
49
- "resolutions": {
50
- "brace-expansion": "^5.0.12",
51
- "follow-redirects": "^1.16.1"
52
- },
53
- "swaggerSha256": "48b2954b6be2a61499f06a42fc784bc7cc131fa7c1bf6831621c5f612fdecf85"
39
+ "swaggerSha256": "1b9a12511f5e1d48d13a62145ba27118cc62f8043083bc09e835fe986be53ddb"
54
40
  }
@@ -0,0 +1,56 @@
1
+ /*
2
+ This script is meant to run after the SDK has been generated.
3
+
4
+ - It updates the generated code to ensure that all PATCH methods use ContentType.JsonPatch.
5
+ - It also ensures that the ContentType enum includes JsonPatch and modifies the Operation interface
6
+ to allow any value for the `value` property instead of just object or null.
7
+
8
+ This is necessary because the SDK generation does not currently handle these cases correctly.
9
+ */
10
+
11
+ const fs = require('fs')
12
+
13
+ const path = require('path').resolve(__dirname, '../src/index.ts')
14
+
15
+ if (!fs.existsSync(path)) {
16
+ console.error(`Error: File not found at path "${path}". Please ensure the SDK has been generated.`)
17
+ process.exit(1)
18
+ }
19
+ let content
20
+ try {
21
+ content = fs.readFileSync(path, 'utf8')
22
+ } catch (err) {
23
+ console.error(`Error: Unable to read file at path "${path}". Details: ${err.message}`)
24
+ process.exit(1)
25
+ }
26
+
27
+ // Update PATCH methods to use ContentType.JsonPatch
28
+ content = content.replace(
29
+ /(method:\s*"PATCH"[\s\S]+?)type:\s*ContentType\.Json/g,
30
+ (match) => match.replace('ContentType.Json', 'ContentType.JsonPatch')
31
+ )
32
+
33
+ // Ensure JsonPatch is included in the ContentType enum
34
+ content = content.replace(
35
+ /export enum ContentType\s*{([\s\S]*?)}/,
36
+ (match, enumBody) => {
37
+ if (enumBody.includes('JsonPatch')) return match
38
+ const insertion = ` JsonPatch = "application/json-patch+json",\n `
39
+ return `export enum ContentType {\n${insertion}${enumBody.trim()}\n}`
40
+ }
41
+ )
42
+
43
+ // Fix the Operation interface to allow any value
44
+ content = content.replace(
45
+ /export interface Operation\s*{([\s\S]*?)}/,
46
+ (match, body) => {
47
+ const updated = body.replace(
48
+ /value\?:\s*object\s*\|?\s*null?;/,
49
+ 'value?: string | number | boolean | null | object;'
50
+ )
51
+ return `export interface Operation {\n ${updated.trim()}\n}`
52
+ }
53
+ )
54
+
55
+ fs.writeFileSync(path, content)
56
+ console.log('SDK patch complete: All PATCH methods now use ContentType.JsonPatch.')
package/src/index.ts CHANGED
@@ -6318,6 +6318,8 @@ export interface MyPartner {
6318
6318
  email: string;
6319
6319
  phone?: string | null;
6320
6320
  tier: MyPartnerTierEnum;
6321
+ isOnLoanOfficerList: boolean;
6322
+ isFromPartnerSite: boolean;
6321
6323
  /** @format date-time */
6322
6324
  createdAt: string;
6323
6325
  }
@@ -6702,6 +6704,18 @@ export interface ProblemDetails {
6702
6704
  [key: string]: any;
6703
6705
  }
6704
6706
 
6707
+ export interface PromotePartner {
6708
+ /** @format uuid */
6709
+ partnerProfileID: string;
6710
+ }
6711
+
6712
+ export interface PromotePartnerRequest {
6713
+ /** @format uuid */
6714
+ userID?: string | null;
6715
+ /** @format uuid */
6716
+ inviteID?: string | null;
6717
+ }
6718
+
6705
6719
  export type RecentLoansWidgetConfig = UtilRequiredKeys<
6706
6720
  BaseCanvasWidgetConfig,
6707
6721
  "type"
@@ -10138,15 +10152,7 @@ export class HttpClient<SecurityDataType = unknown> {
10138
10152
  property instanceof Array ? property : [property];
10139
10153
 
10140
10154
  for (const formItem of propertyContent) {
10141
- // React Native files are plain { uri, name, type } objects, not Blob/File.
10142
- const isReactNativeFile =
10143
- !!formItem &&
10144
- typeof formItem === "object" &&
10145
- "uri" in formItem &&
10146
- "name" in formItem &&
10147
- "type" in formItem;
10148
- const isFileType =
10149
- isReactNativeFile || formItem instanceof Blob || formItem instanceof File;
10155
+ const isFileType = formItem instanceof Blob || formItem instanceof File;
10150
10156
  formData.append(
10151
10157
  key,
10152
10158
  isFileType ? formItem : this.stringifyFormItem(formItem),
@@ -23097,7 +23103,7 @@ export class Api<
23097
23103
  }),
23098
23104
 
23099
23105
  /**
23100
- * @description The partners on the loan officer's list and the loan officer's portal relations, plus the open partner invites the loan officer sent
23106
+ * @description The partner profiles on the loan officer's list, pending partners who have not signed up yet included, and the loan officer's portal relations
23101
23107
  *
23102
23108
  * @tags UsersMe
23103
23109
  * @name GetMyPartners
@@ -23117,45 +23123,73 @@ export class Api<
23117
23123
  }),
23118
23124
 
23119
23125
  /**
23120
- * No description
23126
+ * @description Adds a partner, by partner profile ID, to the loan officer's list; a pending partner can be added too
23121
23127
  *
23122
23128
  * @tags UsersMe
23123
23129
  * @name AddMyPartner
23124
23130
  * @summary Add My Partner
23125
- * @request POST:/api/users/me/partners/{partnerId}
23131
+ * @request POST:/api/users/me/partners/{partnerProfileId}
23126
23132
  * @secure
23127
23133
  * @response `204` `void` No Content
23128
23134
  * @response `403` `ProblemDetails` Forbidden
23129
23135
  * @response `404` `ProblemDetails` Not Found
23130
23136
  */
23131
- addMyPartner: (partnerId: string, params: RequestParams = {}) =>
23137
+ addMyPartner: (partnerProfileId: string, params: RequestParams = {}) =>
23132
23138
  this.request<void, ProblemDetails>({
23133
- path: `/api/users/me/partners/${partnerId}`,
23139
+ path: `/api/users/me/partners/${partnerProfileId}`,
23134
23140
  method: "POST",
23135
23141
  secure: true,
23136
23142
  ...params,
23137
23143
  }),
23138
23144
 
23139
23145
  /**
23140
- * No description
23146
+ * @description Takes a partner, by partner profile ID, off the loan officer's own list
23141
23147
  *
23142
23148
  * @tags UsersMe
23143
23149
  * @name RemoveMyPartner
23144
23150
  * @summary Remove My Partner
23145
- * @request DELETE:/api/users/me/partners/{partnerId}
23151
+ * @request DELETE:/api/users/me/partners/{partnerProfileId}
23146
23152
  * @secure
23147
23153
  * @response `204` `void` No Content
23148
23154
  * @response `403` `ProblemDetails` Forbidden
23149
23155
  * @response `404` `ProblemDetails` Not Found
23150
23156
  */
23151
- removeMyPartner: (partnerId: string, params: RequestParams = {}) =>
23157
+ removeMyPartner: (partnerProfileId: string, params: RequestParams = {}) =>
23152
23158
  this.request<void, ProblemDetails>({
23153
- path: `/api/users/me/partners/${partnerId}`,
23159
+ path: `/api/users/me/partners/${partnerProfileId}`,
23154
23160
  method: "DELETE",
23155
23161
  secure: true,
23156
23162
  ...params,
23157
23163
  }),
23158
23164
 
23165
+ /**
23166
+ * @description Makes a settlement agent, by user ID or by an open invite's ID, a partner on the loan officer's list
23167
+ *
23168
+ * @tags UsersMe
23169
+ * @name PromoteMyPartner
23170
+ * @summary Promote To My Partner
23171
+ * @request POST:/api/users/me/partners/promotions
23172
+ * @secure
23173
+ * @response `200` `PromotePartner` OK
23174
+ * @response `400` `ProblemDetails` Bad Request
23175
+ * @response `403` `ProblemDetails` Forbidden
23176
+ * @response `404` `ProblemDetails` Not Found
23177
+ * @response `422` `ProblemDetails` Unprocessable Content
23178
+ */
23179
+ promoteMyPartner: (
23180
+ data: PromotePartnerRequest,
23181
+ params: RequestParams = {},
23182
+ ) =>
23183
+ this.request<PromotePartner, ProblemDetails>({
23184
+ path: `/api/users/me/partners/promotions`,
23185
+ method: "POST",
23186
+ body: data,
23187
+ secure: true,
23188
+ type: "application/json",
23189
+ format: "json",
23190
+ ...params,
23191
+ }),
23192
+
23159
23193
  /**
23160
23194
  * @description The links that attribute an application to the partner, on the site of each loan officer the partner works with
23161
23195
  *
package/tsconfig.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es6",
4
+ "module": "esnext",
5
+ "allowJs": true,
6
+ "sourceMap": true,
7
+ "outDir": "./dist",
8
+ "strict": true,
9
+ "moduleResolution": "node",
10
+ "baseUrl": "./",
11
+ "declaration": true,
12
+ "paths": {
13
+ "*": [
14
+ "node_modules/*"
15
+ ]
16
+ },
17
+ "typeRoots": [
18
+ "./node_modules/@types"
19
+ ],
20
+ "esModuleInterop": true,
21
+ "skipLibCheck": true,
22
+ "forceConsistentCasingInFileNames": true,
23
+ "resolveJsonModule": true
24
+ },
25
+ "include": ["./src/**/*"],
26
+ "exclude": ["./dist"]
27
+ }