@matech/thebigpos-sdk 3.3.2 → 3.4.0-stag-1921

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,56 @@
1
- /*
2
- Post-generation fixup for the generated TypeScript SDK.
1
+ /*
2
+ This script is meant to run after the SDK has been generated.
3
3
 
4
- swagger-typescript-api does not propagate the `application/json-patch+json`
5
- request content type into the generated code, so PATCH methods that use JSON
6
- Patch would otherwise go out with the wrong Content-Type. This script restores
7
- it by reading the OpenAPI spec the SDK was generated from and, for every
8
- generated PATCH method, setting:
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.
9
7
 
10
- - ContentType.JsonPatch -> when the spec's requestBody for that path
11
- advertises application/json-patch+json
12
- - ContentType.Json -> for every other PATCH method
13
- (e.g. updateLoan, which the backend declares as
14
- [Consumes("application/json")])
15
-
16
- The decision is taken entirely from the spec — there is no hard-coded list of
17
- endpoints to keep in sync. It also ensures the ContentType enum includes
18
- JsonPatch and relaxes the Operation interface `value` to accept any value.
19
-
20
- Usage (pass the SAME spec given to `swagger-typescript-api -p`):
21
- node scripts/apply-json-patch-content-type.js https://api.thebigpos.dev/swagger/<version>/swagger.json
22
- node scripts/apply-json-patch-content-type.js ./swagger.json
23
- SWAGGER_SPEC=<url-or-file> node scripts/apply-json-patch-content-type.js
24
-
25
- Design notes:
26
- - The rewrite is scoped to a single generated method block at a time
27
- (anchored on that method's own `...params,`), so it can never bleed across
28
- method boundaries.
29
- - It sets each method's content type to its target value rather than doing a
30
- conditional replace, so it is idempotent and self-healing (it also repairs
31
- a previously-seen ContentType.JsonPatchPatch double-application).
32
- - If no spec is provided (e.g. a plain commit-hook run), the content-type
33
- rewrite is skipped instead of guessing, so it can never silently corrupt
34
- the generated output.
8
+ This is necessary because the SDK generation does not currently handle these cases correctly.
35
9
  */
36
10
 
37
11
  const fs = require('fs')
38
- const nodePath = require('path')
39
12
 
40
- const SRC = nodePath.resolve(__dirname, '../src/index.ts')
13
+ const path = require('path').resolve(__dirname, '../src/index.ts')
41
14
 
42
- async function loadSpec(source) {
43
- if (!source) return null
44
- if (/^https?:\/\//i.test(source)) {
45
- const res = await fetch(source)
46
- if (!res.ok) throw new Error(`Failed to fetch spec from "${source}": HTTP ${res.status}`)
47
- return res.json()
48
- }
49
- return JSON.parse(fs.readFileSync(nodePath.resolve(source), 'utf8'))
50
- }
51
-
52
- // Collapse spec ("{id}") and generated ("${id}") path params to a common token
53
- // so generated paths can be matched against spec paths regardless of param names.
54
- function normalizePath(p) {
55
- return p.replace(/\$\{[^}]+\}/g, '{}').replace(/\{[^}]+\}/g, '{}')
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)
56
18
  }
57
-
58
- function jsonPatchPaths(spec) {
59
- const set = new Set()
60
- for (const [route, ops] of Object.entries(spec.paths || {})) {
61
- const content = ops && ops.patch && ops.patch.requestBody && ops.patch.requestBody.content
62
- if (content && Object.prototype.hasOwnProperty.call(content, 'application/json-patch+json')) {
63
- set.add(normalizePath(route))
64
- }
65
- }
66
- return set
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)
67
25
  }
68
26
 
69
- function setContentType(block, member) {
70
- const target = `type: ContentType.${member}`
71
- if (/type:\s*ContentType\.\w+/.test(block)) return block.replace(/type:\s*ContentType\.\w+/, target)
72
- if (/type:\s*"[^"]*"/.test(block)) return block.replace(/type:\s*"[^"]*"/, target)
73
- if (/\n(\s*)format:/.test(block)) return block.replace(/\n(\s*)format:/, `\n$1${target},\n$1format:`)
74
- return block.replace(/\n(\s*)\.\.\.params,/, `\n$1${target},\n$1...params,`)
75
- }
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
+ )
76
32
 
77
- function ensureJsonPatchEnum(content) {
78
- return content.replace(/export enum ContentType\s*{([\s\S]*?)}/, (match, enumBody) => {
33
+ // Ensure JsonPatch is included in the ContentType enum
34
+ content = content.replace(
35
+ /export enum ContentType\s*{([\s\S]*?)}/,
36
+ (match, enumBody) => {
79
37
  if (enumBody.includes('JsonPatch')) return match
80
- return `export enum ContentType {\n JsonPatch = "application/json-patch+json",\n ${enumBody.trim()}\n}`
81
- })
82
- }
38
+ const insertion = ` JsonPatch = "application/json-patch+json",\n `
39
+ return `export enum ContentType {\n${insertion}${enumBody.trim()}\n}`
40
+ }
41
+ )
83
42
 
84
- function relaxOperationValue(content) {
85
- return content.replace(/export interface Operation\s*{([\s\S]*?)}/, (match, body) => {
43
+ // Fix the Operation interface to allow any value
44
+ content = content.replace(
45
+ /export interface Operation\s*{([\s\S]*?)}/,
46
+ (match, body) => {
86
47
  const updated = body.replace(
87
48
  /value\?:\s*object\s*\|?\s*null?;/,
88
49
  'value?: string | number | boolean | null | object;'
89
50
  )
90
51
  return `export interface Operation {\n ${updated.trim()}\n}`
91
- })
92
- }
93
-
94
- function applyContentTypes(content, patchPaths) {
95
- // Heal any earlier double-application (ContentType.JsonPatchPatch...).
96
- content = content.replace(/ContentType\.JsonPatch(?:Patch)+\b/g, 'ContentType.JsonPatch')
97
-
98
- const METHOD_BLOCK = /[a-zA-Z0-9_]+:\s*\([\s\S]*?\)\s*=>\s*this\.request<[^>]*>\(\{[\s\S]*?\.\.\.params,/g
99
- return content.replace(METHOD_BLOCK, (block) => {
100
- if (!/method:\s*"PATCH"/.test(block)) {
101
- // Non-PATCH methods must never be JSON Patch.
102
- return /type:\s*ContentType\.JsonPatch\b/.test(block)
103
- ? block.replace(/type:\s*ContentType\.JsonPatch\b/, 'type: ContentType.Json')
104
- : block
105
- }
106
- const routeMatch = block.match(/path:\s*`([^`]*)`/)
107
- const route = routeMatch ? normalizePath(routeMatch[1]) : ''
108
- return setContentType(block, patchPaths.has(route) ? 'JsonPatch' : 'Json')
109
- })
110
- }
111
-
112
- ;(async () => {
113
- if (!fs.existsSync(SRC)) {
114
- console.error(`Error: File not found at "${SRC}". Generate the SDK first.`)
115
- process.exit(1)
116
- }
117
-
118
- const source = process.argv[2] || process.env.SWAGGER_SPEC || process.env.SWAGGER_URL
119
- let spec
120
- try {
121
- spec = await loadSpec(source)
122
- } catch (err) {
123
- console.error(`Error loading OpenAPI spec: ${err.message}`)
124
- process.exit(1)
125
52
  }
53
+ )
126
54
 
127
- let content = fs.readFileSync(SRC, 'utf8')
128
- content = ensureJsonPatchEnum(content)
129
- content = relaxOperationValue(content)
130
-
131
- if (!spec) {
132
- console.warn(
133
- 'No OpenAPI spec provided (argument / SWAGGER_SPEC / SWAGGER_URL) — skipping PATCH content-type rewrite.\n' +
134
- 'Re-run with the spec used for generation to apply it, e.g.:\n' +
135
- ' node scripts/apply-json-patch-content-type.js https://api.thebigpos.dev/swagger/<version>/swagger.json'
136
- )
137
- fs.writeFileSync(SRC, content)
138
- return
139
- }
140
-
141
- const patchPaths = jsonPatchPaths(spec)
142
- content = applyContentTypes(content, patchPaths)
143
-
144
- fs.writeFileSync(SRC, content)
145
- console.log(`SDK patch complete: PATCH content types set from the OpenAPI spec (${patchPaths.size} json-patch endpoint(s)).`)
146
- })().catch((err) => {
147
- console.error(err)
148
- process.exit(1)
149
- })
55
+ fs.writeFileSync(path, content)
56
+ console.log('SDK patch complete: All PATCH methods now use ContentType.JsonPatch.')
package/src/index.ts CHANGED
@@ -111,6 +111,13 @@ export type LoanRole =
111
111
  | "SettlementAgent"
112
112
  | "Admin";
113
113
 
114
+ export type LoanRefinancePurpose =
115
+ | "CashOutDebtConsolidation"
116
+ | "CashOutHomeImprovement"
117
+ | "CashOutOther"
118
+ | "NoCashOut"
119
+ | "LimitedCashOut";
120
+
114
121
  export type LoanRealEstateStatus = "Keep" | "Rent" | "Sell" | "PendingSale";
115
122
 
116
123
  export type LoanRealEstateOccupancyType =
@@ -530,7 +537,7 @@ export type CompanyDocumentIndexStatus =
530
537
 
531
538
  export type ClassificationSource = "Textract" | "Llm" | "Manual";
532
539
 
533
- export type BulkLoanTaskOperationType = "SetStatus";
540
+ export type BulkLoanTaskOperationType = "SetStatus" | "Delete";
534
541
 
535
542
  export type BranchType = "Mortgage" | "RealEstate";
536
543
 
@@ -986,6 +993,9 @@ export interface AiAuditLog {
986
993
  /** @format uuid */
987
994
  messageId?: string | null;
988
995
  eventType: AiAuditLogEventTypeEnum;
996
+ trigger?: string | null;
997
+ subjectTaskName?: string | null;
998
+ subjectLoanNumber?: string | null;
989
999
  modelId?: string | null;
990
1000
  /** @format int32 */
991
1001
  inputTokens?: number | null;
@@ -1668,23 +1678,6 @@ export interface BranchUserPaginated {
1668
1678
  count: number;
1669
1679
  }
1670
1680
 
1671
- export interface BulkCompleteLoanTaskFailure {
1672
- /** @format uuid */
1673
- userLoanTaskID: string;
1674
- taskName: string;
1675
- errorMessage: string;
1676
- }
1677
-
1678
- export interface BulkCompleteLoanTasks {
1679
- completed: string[];
1680
- skipped: string[];
1681
- failed: BulkCompleteLoanTaskFailure[];
1682
- }
1683
-
1684
- export interface BulkCompleteLoanTasksRequest {
1685
- userLoanTaskIDs: string[];
1686
- }
1687
-
1688
1681
  export interface BulkLoanTaskFailure {
1689
1682
  /** @format uuid */
1690
1683
  userLoanTaskID: string;
@@ -3400,6 +3393,7 @@ export interface Loan {
3400
3393
  propertyAddress?: Address | null;
3401
3394
  property?: LoanProperty | null;
3402
3395
  financial?: LoanFinancial | null;
3396
+ refinance?: LoanRefinance | null;
3403
3397
  financialTerms?: LoanFinancialTerms | null;
3404
3398
  monthlyPayment?: LoanMonthlyPayment | null;
3405
3399
  costDetails?: LoanCostDetails | null;
@@ -3427,6 +3421,7 @@ export interface LoanApplication {
3427
3421
  startDate?: string | null;
3428
3422
  property?: LoanProperty | null;
3429
3423
  financial?: LoanFinancial | null;
3424
+ refinance?: LoanRefinance | null;
3430
3425
  borrowers: LoanBorrower[];
3431
3426
  nonOwningBorrowers: LoanNonOwningBorrower[];
3432
3427
  }
@@ -3444,6 +3439,7 @@ export interface LoanApplicationRequest {
3444
3439
  companyName?: string | null;
3445
3440
  property?: LoanPropertyRequest | null;
3446
3441
  financial?: LoanFinancialRequest | null;
3442
+ refinance?: LoanRefinanceRequest | null;
3447
3443
  financialTerms?: LoanFinancialTermsRequest | null;
3448
3444
  monthlyPayment?: LoanMonthlyPaymentRequest | null;
3449
3445
  borrowers: LoanBorrowerRequest[];
@@ -3511,6 +3507,7 @@ export interface LoanBorrowerAccountAsset {
3511
3507
 
3512
3508
  export interface LoanBorrowerAccountAssetRequest {
3513
3509
  name?: string | null;
3510
+ accountNumber?: string | null;
3514
3511
  financialInstitution?: string | null;
3515
3512
  /** @format double */
3516
3513
  value?: number | null;
@@ -4953,8 +4950,55 @@ export interface LoanRecord {
4953
4950
  loanFields: Record<string, string>;
4954
4951
  }
4955
4952
 
4953
+ export interface LoanRefinance {
4954
+ /** @format uuid */
4955
+ id?: string | null;
4956
+ /** @format int32 */
4957
+ yearAcquired?: number | null;
4958
+ /** @format double */
4959
+ valueOfLot?: number | null;
4960
+ /** @format double */
4961
+ originalCost?: number | null;
4962
+ /** @format double */
4963
+ existingLiens?: number | null;
4964
+ /** @format double */
4965
+ costOfImprovements?: number | null;
4966
+ purpose?: LoanRefinancePurpose | null;
4967
+ currentLoan?: LoanRefinanceCurrentLoan | null;
4968
+ }
4969
+
4970
+ export interface LoanRefinanceCurrentLoan {
4971
+ /** @format uuid */
4972
+ id?: string | null;
4973
+ lender?: string | null;
4974
+ /** @format double */
4975
+ interestRate?: number | null;
4976
+ /** @format double */
4977
+ monthlyPayment?: number | null;
4978
+ /** @format double */
4979
+ remainingBalance?: number | null;
4980
+ loanType?: LoanType | null;
4981
+ }
4982
+
4983
+ export interface LoanRefinanceCurrentLoanRequest {
4984
+ lender?: string | null;
4985
+ /** @format double */
4986
+ interestRate?: number | null;
4987
+ loanType?: LoanType | null;
4988
+ }
4989
+
4990
+ export interface LoanRefinanceRequest {
4991
+ /** @format double */
4992
+ originalCost?: number | null;
4993
+ /** @format double */
4994
+ existingLiens?: number | null;
4995
+ purpose?: LoanRefinancePurpose | null;
4996
+ currentLoan?: LoanRefinanceCurrentLoanRequest | null;
4997
+ }
4998
+
4956
4999
  export interface LoanSearchCriteria {
4957
5000
  searchText?: string | null;
5001
+ searchTerms?: string[] | null;
4958
5002
  /** @format uuid */
4959
5003
  loanOfficerId?: string | null;
4960
5004
  loanNumber?: string | null;
@@ -7564,6 +7608,8 @@ export interface UserTableSettings {
7564
7608
  columnOrder: string[];
7565
7609
  sortColumnId?: string | null;
7566
7610
  sortDirection?: SortDirection | null;
7611
+ searchTerms: string[];
7612
+ pinnedColumnIds: string[];
7567
7613
  }
7568
7614
 
7569
7615
  export interface UserTableSettingsRequest {
@@ -7571,6 +7617,8 @@ export interface UserTableSettingsRequest {
7571
7617
  columnOrder: string[];
7572
7618
  sortColumnId?: string | null;
7573
7619
  sortDirection?: SortDirection | null;
7620
+ searchTerms: string[];
7621
+ pinnedColumnIds: string[];
7574
7622
  }
7575
7623
 
7576
7624
  export interface VerifyEmailRequest {
@@ -8575,7 +8623,7 @@ export class HttpClient<SecurityDataType = unknown> {
8575
8623
 
8576
8624
  /**
8577
8625
  * @title The Big POS API
8578
- * @version v3.3.2
8626
+ * @version v3.4.0
8579
8627
  * @termsOfService https://www.thebigpos.com/terms-of-use/
8580
8628
  * @contact Mortgage Automation Technologies <support@thebigpos.com> (https://www.thebigpos.com/terms-of-use/)
8581
8629
  */
@@ -9193,7 +9241,7 @@ export class Api<
9193
9241
  }),
9194
9242
 
9195
9243
  /**
9196
- * No description
9244
+ * @description startDate and endDate accept any ISO-8601 value. A value with no timezone designator (2026-09-01 or 2026-09-01T00:00:00) is read as UTC; a value with Z or an offset is used as the instant it names. A date-only value names the start of that day, so endDate=2026-09-01 returns nothing recorded on the 1st; to include that day send endDate=2026-09-02, or an explicit time such as 2026-09-01T23:59:59.
9197
9245
  *
9198
9246
  * @tags AiAudit
9199
9247
  * @name GetAiAuditLogs
@@ -9224,6 +9272,8 @@ export class Api<
9224
9272
  pageNumber?: number;
9225
9273
  sortBy?: string;
9226
9274
  sortDirection?: string;
9275
+ eventTypes?: AiAuditEventType[];
9276
+ trigger?: string;
9227
9277
  },
9228
9278
  params: RequestParams = {},
9229
9279
  ) =>
@@ -9264,7 +9314,7 @@ export class Api<
9264
9314
  }),
9265
9315
 
9266
9316
  /**
9267
- * No description
9317
+ * @description startDate and endDate accept any ISO-8601 value. A value with no timezone designator (2026-09-01 or 2026-09-01T00:00:00) is read as UTC; a value with Z or an offset is used as the instant it names. A date-only value names the start of that day, so endDate=2026-09-01 returns nothing recorded on the 1st; to include that day send endDate=2026-09-02, or an explicit time such as 2026-09-01T23:59:59.
9268
9318
  *
9269
9319
  * @tags AiAudit
9270
9320
  * @name GetAiAuditConversations
@@ -9301,7 +9351,7 @@ export class Api<
9301
9351
  }),
9302
9352
 
9303
9353
  /**
9304
- * No description
9354
+ * @description startDate and endDate accept any ISO-8601 value. A value with no timezone designator (2026-09-01 or 2026-09-01T00:00:00) is read as UTC; a value with Z or an offset is used as the instant it names. A date-only value names the start of that day, so endDate=2026-09-01 returns nothing recorded on the 1st; to include that day send endDate=2026-09-02, or an explicit time such as 2026-09-01T23:59:59.
9305
9355
  *
9306
9356
  * @tags AiAudit
9307
9357
  * @name GetAiStats
@@ -9331,7 +9381,7 @@ export class Api<
9331
9381
  }),
9332
9382
 
9333
9383
  /**
9334
- * No description
9384
+ * @description startDate and endDate accept any ISO-8601 value. A value with no timezone designator (2026-09-01 or 2026-09-01T00:00:00) is read as UTC; a value with Z or an offset is used as the instant it names. A date-only value names the start of that day, so endDate=2026-09-01 returns nothing recorded on the 1st; to include that day send endDate=2026-09-02, or an explicit time such as 2026-09-01T23:59:59.
9335
9385
  *
9336
9386
  * @tags AiAudit
9337
9387
  * @name GetAiConfigChanges
@@ -10442,7 +10492,7 @@ export class Api<
10442
10492
  }),
10443
10493
 
10444
10494
  /**
10445
- * No description
10495
+ * @description startDate and endDate accept any ISO-8601 value. A value with no timezone designator (2026-09-01 or 2026-09-01T00:00:00) is read as UTC; a value with Z or an offset is used as the instant it names. A date-only value names the start of that day, so endDate=2026-09-01 returns nothing recorded on the 1st; to include that day send endDate=2026-09-02, or an explicit time such as 2026-09-01T23:59:59.
10446
10496
  *
10447
10497
  * @tags AuditLog
10448
10498
  * @name SearchAuditLogs
@@ -14319,9 +14369,10 @@ export class Api<
14319
14369
  * @request POST:/api/listings
14320
14370
  * @secure
14321
14371
  * @response `201` `Listing` Created
14372
+ * @response `403` `ProblemDetails` Forbidden
14322
14373
  */
14323
14374
  createListing: (data: ListingRequest, params: RequestParams = {}) =>
14324
- this.request<Listing, any>({
14375
+ this.request<Listing, ProblemDetails>({
14325
14376
  path: `/api/listings`,
14326
14377
  method: "POST",
14327
14378
  body: data,
@@ -14378,13 +14429,14 @@ export class Api<
14378
14429
  * @request PUT:/api/listings/{id}
14379
14430
  * @secure
14380
14431
  * @response `200` `Listing` OK
14432
+ * @response `403` `ProblemDetails` Forbidden
14381
14433
  */
14382
14434
  replaceListing: (
14383
14435
  id: string,
14384
14436
  data: ListingRequest,
14385
14437
  params: RequestParams = {},
14386
14438
  ) =>
14387
- this.request<Listing, any>({
14439
+ this.request<Listing, ProblemDetails>({
14388
14440
  path: `/api/listings/${id}`,
14389
14441
  method: "PUT",
14390
14442
  body: data,
@@ -16320,36 +16372,6 @@ export class Api<
16320
16372
  ...params,
16321
16373
  }),
16322
16374
 
16323
- /**
16324
- * @description Deprecated - use POST api/loans/tasks/bulk, which reaches every status and accepts tasks from more than one loan.
16325
- *
16326
- * @tags LoanTaskBulkCompletions
16327
- * @name BulkCompleteLoanTasks
16328
- * @summary [Deprecated] Bulk complete loan tasks
16329
- * @request POST:/api/loans/{loanID}/tasks/bulk-complete
16330
- * @deprecated
16331
- * @secure
16332
- * @response `200` `BulkCompleteLoanTasks` OK
16333
- * @response `404` `ProblemDetails` Not Found
16334
- * @response `422` `UnprocessableEntity` Unprocessable Content
16335
- */
16336
- bulkCompleteLoanTasks: (
16337
- loanId: string,
16338
- data: BulkCompleteLoanTasksRequest,
16339
- params: RequestParams = {},
16340
- ) =>
16341
- this.request<BulkCompleteLoanTasks, ProblemDetails | UnprocessableEntity>(
16342
- {
16343
- path: `/api/loans/${loanId}/tasks/bulk-complete`,
16344
- method: "POST",
16345
- body: data,
16346
- secure: true,
16347
- type: "application/json",
16348
- format: "json",
16349
- ...params,
16350
- },
16351
- ),
16352
-
16353
16375
  /**
16354
16376
  * No description
16355
16377
  *
@@ -1,149 +0,0 @@
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