@matech/thebigpos-sdk 2.38.2 → 2.38.3-rc0

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,149 +1,149 @@
1
- # Publishing the POS Typescript SDK
2
-
3
- ## Prerequisites
4
-
5
- 1. Clone the repository (if you haven't already):
6
-
7
- ```bash
8
- git clone https://github.com/MortgageAutomationTechnologies/thebigpos-sdk-typescript
9
- cd thebigpos-sdk-typescript
10
- ```
11
-
12
- 2. Install swagger-typescript-api globally:
13
-
14
- ```bash
15
- npm i -g swagger-typescript-api
16
- ```
17
-
18
- 3. Connect to the MAT VPN
19
-
20
- ## Step 1: Create a release branch
21
-
22
- Create a new branch for the version you're releasing:
23
-
24
- ```bash
25
- git checkout develop
26
- git pull origin develop
27
- git checkout -b release/X.Y.Z
28
- ```
29
-
30
- ## Step 2: Generate the SDK
31
-
32
- Replace `{version}` with the target API version (e.g., `v2.31.0`):
33
-
34
- ```bash
35
- npx swagger-typescript-api generate -p https://api.thebigpos.dev/swagger/{version}/swagger.json -o ./src -n index.ts -r true --axios --enum-names-as-values --generate-union-enums
36
- ```
37
-
38
- > **Note:** If generating locally, use `http://localhost:5212/swagger/{version}/swagger.json` due to self-signed cert issues with https.
39
-
40
- ## Step 3: Apply post-generation fixes
41
-
42
- Run the script to fix PATCH methods content type and Operation interface:
43
-
44
- ```bash
45
- node scripts/apply-json-patch-content-type.js
46
- ```
47
-
48
- This script:
49
- - Sets all PATCH methods to use `ContentType.JsonPatch`
50
- - Adds `JsonPatch` to the `ContentType` enum
51
- - Fixes the `Operation` interface to allow any value type
52
-
53
- ## Step 4: Update the version
54
-
55
- Use npm's version command to update the version in `package.json`:
56
-
57
- ```bash
58
- npm version X.Y.Z
59
- ```
60
-
61
- **Version conventions:**
62
-
63
- - Match the SDK version to the API version being released
64
- - For release candidates (pre-release), use: `npm version X.Y.Z-rc.N --preid=rc`
65
- - For patch increments: `npm version patch`
66
- - For minor increments: `npm version minor`
67
-
68
- ## Step 5: Build the SDK
69
-
70
- ```bash
71
- npm run build
72
- ```
73
-
74
- Ensure there are no TypeScript compilation errors.
75
-
76
- ## Step 6: Merge develop (if needed)
77
-
78
- If there are changes in develop that need to be included:
79
-
80
- ```bash
81
- git fetch origin develop
82
- git merge origin/develop
83
- ```
84
-
85
- If there are conflicts in `src/index.ts` or `dist/*`, regenerate the SDK (Step 2), apply fixes (Step 3), and rebuild (Step 5) to resolve them.
86
-
87
- ## Step 7: Commit and push
88
-
89
- ```bash
90
- git add .
91
- git commit -m "X.Y.Z"
92
- git push -u origin release/X.Y.Z
93
- ```
94
-
95
- ## Step 8: Publish to NPM
96
-
97
- ### Authentication
98
-
99
- NPM requires a granular access token with publish permissions and 2FA bypass enabled.
100
-
101
- 1. Go to [npmjs.com](https://www.npmjs.com) > Access Tokens > Generate New Token
102
- 2. Select "Granular Access Token"
103
- 3. Enable "Bypass 2FA for automation"
104
- 4. Set permissions to publish to `@matech/thebigpos-sdk`
105
-
106
- Configure the token:
107
-
108
- ```bash
109
- npm config set //registry.npmjs.org/:_authToken YOUR_TOKEN
110
- ```
111
-
112
- ### Publish
113
-
114
- **To latest (stable release):**
115
-
116
- ```bash
117
- npm publish --access public
118
- ```
119
-
120
- **To next (pre-release):**
121
-
122
- ```bash
123
- npm publish --tag next
124
- ```
125
-
126
- **To a feature tag (for testing):**
127
-
128
- ```bash
129
- npm publish --tag feature-name
130
- ```
131
-
132
- ### Installing the SDK
133
-
134
- ```bash
135
- # Latest stable
136
- yarn add @matech/thebigpos-sdk
137
-
138
- # Next pre-release
139
- yarn add @matech/thebigpos-sdk@next
140
-
141
- # Specific version
142
- yarn add @matech/thebigpos-sdk@X.Y.Z
143
- ```
144
-
145
- ## Step 9: Clean up
146
-
147
- 1. **Revoke the NPM token** after publishing for security
148
- 2. **Create a Pull Request** from `release/X.Y.Z` to `develop` and `main`
149
- 3. **Create a GitHub Release** with release notes
1
+ # Publishing the POS Typescript SDK
2
+
3
+ ## Prerequisites
4
+
5
+ 1. Clone the repository (if you haven't already):
6
+
7
+ ```bash
8
+ git clone https://github.com/MortgageAutomationTechnologies/thebigpos-sdk-typescript
9
+ cd thebigpos-sdk-typescript
10
+ ```
11
+
12
+ 2. Install swagger-typescript-api globally:
13
+
14
+ ```bash
15
+ npm i -g swagger-typescript-api
16
+ ```
17
+
18
+ 3. Connect to the MAT VPN
19
+
20
+ ## Step 1: Create a release branch
21
+
22
+ Create a new branch for the version you're releasing:
23
+
24
+ ```bash
25
+ git checkout develop
26
+ git pull origin develop
27
+ git checkout -b release/X.Y.Z
28
+ ```
29
+
30
+ ## Step 2: Generate the SDK
31
+
32
+ Replace `{version}` with the target API version (e.g., `v2.31.0`):
33
+
34
+ ```bash
35
+ npx swagger-typescript-api generate -p https://api.thebigpos.dev/swagger/{version}/swagger.json -o ./src -n index.ts -r true --axios --enum-names-as-values --generate-union-enums
36
+ ```
37
+
38
+ > **Note:** If generating locally, use `http://localhost:5212/swagger/{version}/swagger.json` due to self-signed cert issues with https.
39
+
40
+ ## Step 3: Apply post-generation fixes
41
+
42
+ Run the script to fix PATCH methods content type and Operation interface:
43
+
44
+ ```bash
45
+ node scripts/apply-json-patch-content-type.js
46
+ ```
47
+
48
+ This script:
49
+ - Sets all PATCH methods to use `ContentType.JsonPatch`
50
+ - Adds `JsonPatch` to the `ContentType` enum
51
+ - Fixes the `Operation` interface to allow any value type
52
+
53
+ ## Step 4: Update the version
54
+
55
+ Use npm's version command to update the version in `package.json`:
56
+
57
+ ```bash
58
+ npm version X.Y.Z
59
+ ```
60
+
61
+ **Version conventions:**
62
+
63
+ - Match the SDK version to the API version being released
64
+ - For release candidates (pre-release), use: `npm version X.Y.Z-rc.N --preid=rc`
65
+ - For patch increments: `npm version patch`
66
+ - For minor increments: `npm version minor`
67
+
68
+ ## Step 5: Build the SDK
69
+
70
+ ```bash
71
+ npm run build
72
+ ```
73
+
74
+ Ensure there are no TypeScript compilation errors.
75
+
76
+ ## Step 6: Merge develop (if needed)
77
+
78
+ If there are changes in develop that need to be included:
79
+
80
+ ```bash
81
+ git fetch origin develop
82
+ git merge origin/develop
83
+ ```
84
+
85
+ If there are conflicts in `src/index.ts` or `dist/*`, regenerate the SDK (Step 2), apply fixes (Step 3), and rebuild (Step 5) to resolve them.
86
+
87
+ ## Step 7: Commit and push
88
+
89
+ ```bash
90
+ git add .
91
+ git commit -m "X.Y.Z"
92
+ git push -u origin release/X.Y.Z
93
+ ```
94
+
95
+ ## Step 8: Publish to NPM
96
+
97
+ ### Authentication
98
+
99
+ NPM requires a granular access token with publish permissions and 2FA bypass enabled.
100
+
101
+ 1. Go to [npmjs.com](https://www.npmjs.com) > Access Tokens > Generate New Token
102
+ 2. Select "Granular Access Token"
103
+ 3. Enable "Bypass 2FA for automation"
104
+ 4. Set permissions to publish to `@matech/thebigpos-sdk`
105
+
106
+ Configure the token:
107
+
108
+ ```bash
109
+ npm config set //registry.npmjs.org/:_authToken YOUR_TOKEN
110
+ ```
111
+
112
+ ### Publish
113
+
114
+ **To latest (stable release):**
115
+
116
+ ```bash
117
+ npm publish --access public
118
+ ```
119
+
120
+ **To next (pre-release):**
121
+
122
+ ```bash
123
+ npm publish --tag next
124
+ ```
125
+
126
+ **To a feature tag (for testing):**
127
+
128
+ ```bash
129
+ npm publish --tag feature-name
130
+ ```
131
+
132
+ ### Installing the SDK
133
+
134
+ ```bash
135
+ # Latest stable
136
+ yarn add @matech/thebigpos-sdk
137
+
138
+ # Next pre-release
139
+ yarn add @matech/thebigpos-sdk@next
140
+
141
+ # Specific version
142
+ yarn add @matech/thebigpos-sdk@X.Y.Z
143
+ ```
144
+
145
+ ## Step 9: Clean up
146
+
147
+ 1. **Revoke the NPM token** after publishing for security
148
+ 2. **Create a Pull Request** from `release/X.Y.Z` to `develop` and `main`
149
+ 3. **Create a GitHub Release** with release notes
package/package.json CHANGED
@@ -1,43 +1,43 @@
1
- {
2
- "name": "@matech/thebigpos-sdk",
3
- "version": "2.38.2",
4
- "description": "The Big POS Typescript SDK",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "scripts": {
8
- "build": "rimraf dist && tsc",
9
- "test": "mocha -r ts-node/register 'src/api_test.spec.ts' --exit",
10
- "browserify": "tsc && esbuild dist/index.js --bundle --minify --sourcemap --global-name=thebigpos --outfile=dist/thebigpos.min.js",
11
- "prepare": "husky"
12
- },
13
- "repository": {
14
- "type": "git",
15
- "url": "git+https://github.com/MortgageAutomationTechnologies/thebigpos-sdk-typescript.git"
16
- },
17
- "keywords": [
18
- "pos",
19
- "loans",
20
- "mortgage",
21
- "automation"
22
- ],
23
- "author": "Mortgage Automation Technologies",
24
- "license": "MIT",
25
- "bugs": {
26
- "url": "https://github.com/MortgageAutomationTechnologies/thebigpos-sdk-typescript/issues"
27
- },
28
- "homepage": "https://github.com/MortgageAutomationTechnologies/thebigpos-sdk-typescript#readme",
29
- "dependencies": {
30
- "axios": "^1.13.5"
31
- },
32
- "devDependencies": {
33
- "esbuild": "^0.27.0",
34
- "husky": "^9.1.5",
35
- "rimraf": "6.1.3",
36
- "ts-node": "^10.9.2",
37
- "typescript": "^5.5.4"
38
- },
39
- "resolutions": {
40
- "diff": "^4.0.4",
41
- "brace-expansion": "^5.0.5"
42
- }
43
- }
1
+ {
2
+ "name": "@matech/thebigpos-sdk",
3
+ "version": "2.38.3-rc0",
4
+ "description": "The Big POS Typescript SDK",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "rimraf dist && tsc",
9
+ "test": "mocha -r ts-node/register 'src/api_test.spec.ts' --exit",
10
+ "browserify": "tsc && esbuild dist/index.js --bundle --minify --sourcemap --global-name=thebigpos --outfile=dist/thebigpos.min.js",
11
+ "prepare": "husky"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/MortgageAutomationTechnologies/thebigpos-sdk-typescript.git"
16
+ },
17
+ "keywords": [
18
+ "pos",
19
+ "loans",
20
+ "mortgage",
21
+ "automation"
22
+ ],
23
+ "author": "Mortgage Automation Technologies",
24
+ "license": "MIT",
25
+ "bugs": {
26
+ "url": "https://github.com/MortgageAutomationTechnologies/thebigpos-sdk-typescript/issues"
27
+ },
28
+ "homepage": "https://github.com/MortgageAutomationTechnologies/thebigpos-sdk-typescript#readme",
29
+ "dependencies": {
30
+ "axios": "^1.15.0"
31
+ },
32
+ "devDependencies": {
33
+ "esbuild": "^0.27.0",
34
+ "husky": "^9.1.5",
35
+ "rimraf": "6.1.3",
36
+ "ts-node": "^10.9.2",
37
+ "typescript": "^5.5.4"
38
+ },
39
+ "resolutions": {
40
+ "diff": "^4.0.4",
41
+ "brace-expansion": "^5.0.5"
42
+ }
43
+ }
@@ -1,56 +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\b(?!Patch)/g,
30
- '$1ContentType.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.')
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\b(?!Patch)/g,
30
+ '$1ContentType.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.')