@sprucelabs/spruce-cli 24.1.6 → 24.1.8
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 +16 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/support/InstanceTest.txt +2 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/support/StaticTest.txt +2 -0
- package/build/tests/staticToInstanceMigration/StaticToInstanceTestFileMigrator.js +23 -18
- package/build/tests/staticToInstanceMigration/StaticToInstanceTestFileMigrator.js.map +1 -1
- package/package.json +24 -24
- package/src/__tests__/behavioral/tests/migrationToInstance/support/InstanceTest.txt +2 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/support/StaticTest.txt +2 -0
- package/src/tests/staticToInstanceMigration/StaticToInstanceTestFileMigrator.ts +25 -18
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [24.1.8](https://github.com/sprucelabsai-community/spruce-cli-workspace/compare/v24.1.7...v24.1.8) (2025-03-12)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @sprucelabs/spruce-cli
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [24.1.7](https://github.com/sprucelabsai-community/spruce-cli-workspace/compare/v24.1.6...v24.1.7) (2025-03-11)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @sprucelabs/spruce-cli
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [24.1.6](https://github.com/sprucelabsai-community/spruce-cli-workspace/compare/v24.1.5...v24.1.6) (2025-03-07)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @sprucelabs/spruce-cli
|
|
@@ -11,12 +11,14 @@ import AbstractSpruceTest, {
|
|
|
11
11
|
@suite()
|
|
12
12
|
export default class StaticTestFinderTest extends AbstractSpruceTest {
|
|
13
13
|
private responseBody = generateId()
|
|
14
|
+
private readonly test = generateId()
|
|
14
15
|
|
|
15
16
|
@test()
|
|
16
17
|
protected async throwsWithMissing() {
|
|
17
18
|
const finder = StaticTestFinder.Finder()
|
|
18
19
|
const err = await assert.doesThrowAsync(() => finder.find())
|
|
19
20
|
console.log(this.responseBody)
|
|
21
|
+
console.log(this.test)
|
|
20
22
|
errorAssert.assertError(err, 'MISSING_PARAMETERS', {
|
|
21
23
|
parameters: ['lookupDir'],
|
|
22
24
|
})
|
|
@@ -9,12 +9,14 @@ import AbstractSpruceTest, {
|
|
|
9
9
|
@fake.login()
|
|
10
10
|
export default class StaticTestFinderTest extends AbstractSpruceTest {
|
|
11
11
|
private static responseBody = generateId()
|
|
12
|
+
private static readonly test = generateId()
|
|
12
13
|
|
|
13
14
|
@test()
|
|
14
15
|
protected static async throwsWithMissing() {
|
|
15
16
|
const finder = StaticTestFinder.Finder()
|
|
16
17
|
const err = await assert.doesThrowAsync(() => finder.find())
|
|
17
18
|
console.log(this.responseBody)
|
|
19
|
+
console.log(this.test)
|
|
18
20
|
errorAssert.assertError(err, 'MISSING_PARAMETERS', {
|
|
19
21
|
parameters: ['lookupDir'],
|
|
20
22
|
})
|
|
@@ -68,15 +68,12 @@ class StaticToInstanceTestFileMigratorImpl {
|
|
|
68
68
|
}
|
|
69
69
|
removeStaticFromDeclaration(contents, name) {
|
|
70
70
|
/**
|
|
71
|
-
* 1) Remove `static` for methods/getters/setters
|
|
72
|
-
* private static async doSomething() => private async doSomething()
|
|
73
|
-
* private static get value() => private get value()
|
|
74
|
-
* private static set value(v) => private set value(v)
|
|
71
|
+
* 1) Remove `static` for methods/getters/setters
|
|
75
72
|
*/
|
|
76
|
-
const methodPattern = new RegExp(`((?:public|protected|private)?\\s+)?` + // group 1
|
|
77
|
-
`static\\s+` + // literal
|
|
78
|
-
`(?:(async)\\s+)?` + // group 2:
|
|
79
|
-
`(?:(get|set)\\s+)?` + // group 3:
|
|
73
|
+
const methodPattern = new RegExp(`((?:public|protected|private)?\\s+)?` + // group 1: optional visibility + space
|
|
74
|
+
`static\\s+` + // literal 'static '
|
|
75
|
+
`(?:(async)\\s+)?` + // group 2: 'async'?
|
|
76
|
+
`(?:(get|set)\\s+)?` + // group 3: 'get' or 'set'?
|
|
80
77
|
`(${name})\\s*\\(`, // group 4: the identifier + '('
|
|
81
78
|
'g');
|
|
82
79
|
let updated = contents.replace(methodPattern, (match, g1, g2, g3, g4) => {
|
|
@@ -86,20 +83,28 @@ class StaticToInstanceTestFileMigratorImpl {
|
|
|
86
83
|
return `${g1 ?? ''}${asyncPart}${accessorPart}${g4}(`;
|
|
87
84
|
});
|
|
88
85
|
/**
|
|
89
|
-
* 2) Remove `static` from property declarations
|
|
90
|
-
* if the property is not optional.
|
|
86
|
+
* 2) Remove `static` from property declarations, including those marked `readonly`.
|
|
91
87
|
* e.g.
|
|
92
|
-
* private static myProp
|
|
93
|
-
* private static
|
|
88
|
+
* private static myProp => private myProp!
|
|
89
|
+
* private static readonly myProp => private readonly myProp!
|
|
90
|
+
* private static myProp?: Type => private myProp?: Type
|
|
94
91
|
*/
|
|
95
|
-
const propertyPattern = new RegExp(`((?:public|protected|private)?\\s+)?` + // group 1: optional visibility
|
|
92
|
+
const propertyPattern = new RegExp(`((?:public|protected|private)?\\s+)?` + // group 1: optional visibility + space
|
|
96
93
|
`static\\s+` + // literal "static "
|
|
97
|
-
`(
|
|
98
|
-
`(
|
|
94
|
+
`(readonly\\s+)?` + // group 2: optional "readonly " (with trailing space)
|
|
95
|
+
`(${name})(\\?)?` + // group 3: property name, group 4: optional "?"
|
|
96
|
+
`(?=[\\s=:\\[;]|$)`, // lookahead
|
|
99
97
|
'g');
|
|
100
|
-
updated = updated.replace(propertyPattern, (match, g1, g2, g3) => {
|
|
101
|
-
//
|
|
102
|
-
|
|
98
|
+
updated = updated.replace(propertyPattern, (match, g1, g2, g3, g4) => {
|
|
99
|
+
// g1 => "private ", "protected ", or "public " (plus any spacing) or undefined
|
|
100
|
+
// g2 => "readonly " if present, else undefined
|
|
101
|
+
// g3 => property name (e.g. 'test')
|
|
102
|
+
// g4 => "?" if property is optional, else undefined
|
|
103
|
+
// If it's optional, keep the '?' or else add '!'
|
|
104
|
+
// (Adjust if you'd rather remove the '!' in this step. Currently we're adding it if not optional.)
|
|
105
|
+
const optionalChar = g4 ? g4 : '!';
|
|
106
|
+
// Rebuild, dropping 'static' but retaining visibility + optional "readonly " + name + '?' or '!'
|
|
107
|
+
return `${g1 ?? ''}${g2 ?? ''}${g3}${optionalChar}`;
|
|
103
108
|
});
|
|
104
109
|
return updated;
|
|
105
110
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StaticToInstanceTestFileMigrator.js","sourceRoot":"","sources":["../../../src/tests/staticToInstanceMigration/StaticToInstanceTestFileMigrator.ts"],"names":[],"mappings":";;AAAA,+CAAkD;AAElD,MAAqB,oCAAoC;IAG9C,MAAM,CAAC,KAAK,CAA6C;IAEzD,MAAM,CAAC,QAAQ;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,EAAE,CAAA;IACrC,CAAC;IAEM,OAAO,CAAC,QAAgB;QAC3B,IAAA,sBAAa,EAAC,EAAE,QAAQ,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAA;QAEzC,wEAAwE;QACxE,sCAAsC;QACtC,+DAA+D;QAC/D,uCAAuC;QACvC,MAAM,cAAc,GAChB,kEAAkE,CAAC,IAAI,CACnE,QAAQ,CACX,CAAA;QAEL,IAAI,SAAS,GAAG,cAAc;YAC1B,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,UAAU,EAAE,GAAG,CAAC;YACtC,CAAC,CAAC,QAAQ,CAAC,OAAO;YACZ,6FAA6F;YAC7F,2EAA2E,EAC3E,IAAI,CACP,CAAA;QAEP,6E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AAI,CAAC,CAAA;QAC7C,SAAS,GAAG,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;QAE7C,OAAO,SAAS,CAAA;IACpB,CAAC;IAEO,cAAc,CAAC,IAAY;QAC/B,MAAM,OAAO,GAAG,IAAI,MAAM,CACtB,yFAAyF,CAC5F,CAAA;QACD,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC7B,CAAC;IAEO,aAAa,CAAC,QAAgB;QAClC,uDAAuD;QACvD,mEAAmE;QACnE,MAAM,iBAAiB,GAAG,2CAA2C,CAAA;QACrE,MAAM,KAAK,GAAa,EAAE,CAAA;QAC1B,IAAI,KAA6B,CAAA;QAEjC,OAAO,CAAC,KAAK,GAAG,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YACzD,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;YACzB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC5B,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;YACxB,CAAC;QACL,CAAC;QAED,OAAO,KAAK,CAAA;IAChB,CAAC;IAEO,2BAA2B,CAC/B,QAAgB,EAChB,IAAY;QAEZ
|
|
1
|
+
{"version":3,"file":"StaticToInstanceTestFileMigrator.js","sourceRoot":"","sources":["../../../src/tests/staticToInstanceMigration/StaticToInstanceTestFileMigrator.ts"],"names":[],"mappings":";;AAAA,+CAAkD;AAElD,MAAqB,oCAAoC;IAG9C,MAAM,CAAC,KAAK,CAA6C;IAEzD,MAAM,CAAC,QAAQ;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,EAAE,CAAA;IACrC,CAAC;IAEM,OAAO,CAAC,QAAgB;QAC3B,IAAA,sBAAa,EAAC,EAAE,QAAQ,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAA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C5H,OAAO,OAAO,CAAA;QAClB,CAAC,CAAC,CAAA;QAEF,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAClC,CAAC;CACJ;AA5MD,uDA4MC"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "24.1.
|
|
7
|
+
"version": "24.1.8",
|
|
8
8
|
"skill": {
|
|
9
9
|
"namespace": "spruce-cli",
|
|
10
10
|
"upgradeIgnoreList": [
|
|
@@ -73,18 +73,18 @@
|
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@jest/reporters": "^29.7.0",
|
|
76
|
-
"@sprucelabs/error": "^6.0.
|
|
76
|
+
"@sprucelabs/error": "^6.0.586",
|
|
77
77
|
"@sprucelabs/globby": "^2.0.502",
|
|
78
|
-
"@sprucelabs/heartwood-view-controllers": "^117.2.
|
|
79
|
-
"@sprucelabs/jest-json-reporter": "^8.0.
|
|
80
|
-
"@sprucelabs/mercury-client": "^42.0.
|
|
81
|
-
"@sprucelabs/mercury-event-emitter": "^42.0.
|
|
82
|
-
"@sprucelabs/mercury-types": "^47.2.
|
|
83
|
-
"@sprucelabs/schema": "^31.0.
|
|
84
|
-
"@sprucelabs/spruce-core-schemas": "^40.1.
|
|
85
|
-
"@sprucelabs/spruce-event-utils": "^40.2.
|
|
86
|
-
"@sprucelabs/spruce-skill-utils": "^31.2.
|
|
87
|
-
"@sprucelabs/spruce-templates": "^24.1.
|
|
78
|
+
"@sprucelabs/heartwood-view-controllers": "^117.2.26",
|
|
79
|
+
"@sprucelabs/jest-json-reporter": "^8.0.587",
|
|
80
|
+
"@sprucelabs/mercury-client": "^42.0.749",
|
|
81
|
+
"@sprucelabs/mercury-event-emitter": "^42.0.749",
|
|
82
|
+
"@sprucelabs/mercury-types": "^47.2.48",
|
|
83
|
+
"@sprucelabs/schema": "^31.0.63",
|
|
84
|
+
"@sprucelabs/spruce-core-schemas": "^40.1.653",
|
|
85
|
+
"@sprucelabs/spruce-event-utils": "^40.2.54",
|
|
86
|
+
"@sprucelabs/spruce-skill-utils": "^31.2.68",
|
|
87
|
+
"@sprucelabs/spruce-templates": "^24.1.8",
|
|
88
88
|
"@typescript-eslint/eslint-plugin": "^7.7.1",
|
|
89
89
|
"@typescript-eslint/parser": "^7.7.1",
|
|
90
90
|
"cfonts": "^3.3.0",
|
|
@@ -110,22 +110,22 @@
|
|
|
110
110
|
"uuid": "^11.1.0"
|
|
111
111
|
},
|
|
112
112
|
"devDependencies": {
|
|
113
|
-
"@sprucelabs/data-stores": "^28.5.
|
|
114
|
-
"@sprucelabs/mercury-core-events": "^26.0.
|
|
115
|
-
"@sprucelabs/resolve-path-aliases": "^2.0.
|
|
116
|
-
"@sprucelabs/spruce-conversation-plugin": "^66.0.
|
|
117
|
-
"@sprucelabs/spruce-deploy-plugin": "^66.0.
|
|
118
|
-
"@sprucelabs/spruce-store-plugin": "^66.0.
|
|
119
|
-
"@sprucelabs/spruce-test-fixtures": "^66.0.
|
|
120
|
-
"@sprucelabs/test": "^9.0.
|
|
121
|
-
"@sprucelabs/test-utils": "^5.5.
|
|
113
|
+
"@sprucelabs/data-stores": "^28.5.79",
|
|
114
|
+
"@sprucelabs/mercury-core-events": "^26.0.31",
|
|
115
|
+
"@sprucelabs/resolve-path-aliases": "^2.0.537",
|
|
116
|
+
"@sprucelabs/spruce-conversation-plugin": "^66.0.38",
|
|
117
|
+
"@sprucelabs/spruce-deploy-plugin": "^66.0.38",
|
|
118
|
+
"@sprucelabs/spruce-store-plugin": "^66.0.38",
|
|
119
|
+
"@sprucelabs/spruce-test-fixtures": "^66.0.38",
|
|
120
|
+
"@sprucelabs/test": "^9.0.76",
|
|
121
|
+
"@sprucelabs/test-utils": "^5.5.22",
|
|
122
122
|
"@types/blessed": "^0.1.25",
|
|
123
123
|
"@types/eslint": "^9.6.1",
|
|
124
124
|
"@types/fs-extra": "^11.0.4",
|
|
125
125
|
"@types/inquirer": "^9.0.7",
|
|
126
126
|
"@types/lodash": "^4.17.16",
|
|
127
127
|
"@types/md5": "^2.3.5",
|
|
128
|
-
"@types/node": "^22.13.
|
|
128
|
+
"@types/node": "^22.13.10",
|
|
129
129
|
"@types/promise.allsettled": "^1.0.6",
|
|
130
130
|
"@types/ps-node": "^0.1.3",
|
|
131
131
|
"@types/semver": "^7.5.8",
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
"concurrently": "^9.1.2",
|
|
139
139
|
"conventional-changelog-sprucelabs": "2.0.1",
|
|
140
140
|
"dotenv": "^16.4.7",
|
|
141
|
-
"eslint": "^9.
|
|
141
|
+
"eslint": "^9.22.0",
|
|
142
142
|
"eslint-config-spruce": "^11.2.26",
|
|
143
143
|
"find-process": "^1.4.10",
|
|
144
144
|
"jest": "^29.7.0",
|
|
@@ -571,5 +571,5 @@
|
|
|
571
571
|
"open"
|
|
572
572
|
]
|
|
573
573
|
},
|
|
574
|
-
"gitHead": "
|
|
574
|
+
"gitHead": "654e0350b7d6f41a8d8e27f8cb1deb93bb67026c"
|
|
575
575
|
}
|
|
@@ -11,12 +11,14 @@ import AbstractSpruceTest, {
|
|
|
11
11
|
@suite()
|
|
12
12
|
export default class StaticTestFinderTest extends AbstractSpruceTest {
|
|
13
13
|
private responseBody = generateId()
|
|
14
|
+
private readonly test = generateId()
|
|
14
15
|
|
|
15
16
|
@test()
|
|
16
17
|
protected async throwsWithMissing() {
|
|
17
18
|
const finder = StaticTestFinder.Finder()
|
|
18
19
|
const err = await assert.doesThrowAsync(() => finder.find())
|
|
19
20
|
console.log(this.responseBody)
|
|
21
|
+
console.log(this.test)
|
|
20
22
|
errorAssert.assertError(err, 'MISSING_PARAMETERS', {
|
|
21
23
|
parameters: ['lookupDir'],
|
|
22
24
|
})
|
|
@@ -9,12 +9,14 @@ import AbstractSpruceTest, {
|
|
|
9
9
|
@fake.login()
|
|
10
10
|
export default class StaticTestFinderTest extends AbstractSpruceTest {
|
|
11
11
|
private static responseBody = generateId()
|
|
12
|
+
private static readonly test = generateId()
|
|
12
13
|
|
|
13
14
|
@test()
|
|
14
15
|
protected static async throwsWithMissing() {
|
|
15
16
|
const finder = StaticTestFinder.Finder()
|
|
16
17
|
const err = await assert.doesThrowAsync(() => finder.find())
|
|
17
18
|
console.log(this.responseBody)
|
|
19
|
+
console.log(this.test)
|
|
18
20
|
errorAssert.assertError(err, 'MISSING_PARAMETERS', {
|
|
19
21
|
parameters: ['lookupDir'],
|
|
20
22
|
})
|
|
@@ -99,16 +99,13 @@ export default class StaticToInstanceTestFileMigratorImpl
|
|
|
99
99
|
name: string
|
|
100
100
|
): string {
|
|
101
101
|
/**
|
|
102
|
-
* 1) Remove `static` for methods/getters/setters
|
|
103
|
-
* private static async doSomething() => private async doSomething()
|
|
104
|
-
* private static get value() => private get value()
|
|
105
|
-
* private static set value(v) => private set value(v)
|
|
102
|
+
* 1) Remove `static` for methods/getters/setters
|
|
106
103
|
*/
|
|
107
104
|
const methodPattern = new RegExp(
|
|
108
|
-
`((?:public|protected|private)?\\s+)?` + // group 1
|
|
109
|
-
`static\\s+` + // literal
|
|
110
|
-
`(?:(async)\\s+)?` + // group 2:
|
|
111
|
-
`(?:(get|set)\\s+)?` + // group 3:
|
|
105
|
+
`((?:public|protected|private)?\\s+)?` + // group 1: optional visibility + space
|
|
106
|
+
`static\\s+` + // literal 'static '
|
|
107
|
+
`(?:(async)\\s+)?` + // group 2: 'async'?
|
|
108
|
+
`(?:(get|set)\\s+)?` + // group 3: 'get' or 'set'?
|
|
112
109
|
`(${name})\\s*\\(`, // group 4: the identifier + '('
|
|
113
110
|
'g'
|
|
114
111
|
)
|
|
@@ -123,22 +120,32 @@ export default class StaticToInstanceTestFileMigratorImpl
|
|
|
123
120
|
)
|
|
124
121
|
|
|
125
122
|
/**
|
|
126
|
-
* 2) Remove `static` from property declarations
|
|
127
|
-
* if the property is not optional.
|
|
123
|
+
* 2) Remove `static` from property declarations, including those marked `readonly`.
|
|
128
124
|
* e.g.
|
|
129
|
-
* private static myProp
|
|
130
|
-
* private static
|
|
125
|
+
* private static myProp => private myProp!
|
|
126
|
+
* private static readonly myProp => private readonly myProp!
|
|
127
|
+
* private static myProp?: Type => private myProp?: Type
|
|
131
128
|
*/
|
|
132
129
|
const propertyPattern = new RegExp(
|
|
133
|
-
`((?:public|protected|private)?\\s+)?` + // group 1: optional visibility
|
|
130
|
+
`((?:public|protected|private)?\\s+)?` + // group 1: optional visibility + space
|
|
134
131
|
`static\\s+` + // literal "static "
|
|
135
|
-
`(
|
|
136
|
-
`(
|
|
132
|
+
`(readonly\\s+)?` + // group 2: optional "readonly " (with trailing space)
|
|
133
|
+
`(${name})(\\?)?` + // group 3: property name, group 4: optional "?"
|
|
134
|
+
`(?=[\\s=:\\[;]|$)`, // lookahead
|
|
137
135
|
'g'
|
|
138
136
|
)
|
|
139
|
-
updated = updated.replace(propertyPattern, (match, g1, g2, g3) => {
|
|
140
|
-
//
|
|
141
|
-
|
|
137
|
+
updated = updated.replace(propertyPattern, (match, g1, g2, g3, g4) => {
|
|
138
|
+
// g1 => "private ", "protected ", or "public " (plus any spacing) or undefined
|
|
139
|
+
// g2 => "readonly " if present, else undefined
|
|
140
|
+
// g3 => property name (e.g. 'test')
|
|
141
|
+
// g4 => "?" if property is optional, else undefined
|
|
142
|
+
|
|
143
|
+
// If it's optional, keep the '?' or else add '!'
|
|
144
|
+
// (Adjust if you'd rather remove the '!' in this step. Currently we're adding it if not optional.)
|
|
145
|
+
const optionalChar = g4 ? g4 : '!'
|
|
146
|
+
|
|
147
|
+
// Rebuild, dropping 'static' but retaining visibility + optional "readonly " + name + '?' or '!'
|
|
148
|
+
return `${g1 ?? ''}${g2 ?? ''}${g3}${optionalChar}`
|
|
142
149
|
})
|
|
143
150
|
|
|
144
151
|
return updated
|