@dazn/kopytko-framework 2.1.1 → 2.1.3

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@dazn/kopytko-framework",
3
- "version": "2.1.1",
3
+ "version": "2.1.3",
4
4
  "description": "A modern Roku's Brightscript framework",
5
5
  "keywords": [
6
6
  "brightscript",
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "devDependencies": {
31
31
  "@dazn/eslint-plugin-kopytko": "^2.1.0",
32
- "@dazn/kopytko-packager": "^1.2.4",
32
+ "@dazn/kopytko-packager": "^1.2.5",
33
33
  "@dazn/kopytko-unit-testing-framework": "^2.3.1",
34
34
  "eslint": "^8.21.0"
35
35
  },
@@ -9,6 +9,7 @@
9
9
  ' @param {String} responseData.failureReason
10
10
  ' @param {Object} responseData.headers
11
11
  ' @param {Integer} responseData.httpStatusCode
12
+ ' @param {Object} responseData.rawData
12
13
  ' @param {Object} responseData.requestOptions
13
14
  ' @param {Integer} [responseData.time]
14
15
  function HttpResponse(responseData as Object) as Object
@@ -25,7 +26,7 @@ function HttpResponse(responseData as Object) as Object
25
26
  prototype._failureReason = getProperty(responseData, "failureReason", "OK")
26
27
  prototype._headers = getProperty(responseData, "headers", {})
27
28
  prototype._httpStatusCode = getProperty(responseData, "httpStatusCode", -1)
28
- prototype._rawData = getProperty(responseData, "rawData", {})
29
+ prototype._rawData = getProperty(responseData, "rawData")
29
30
  prototype._requestOptions = responseData.requestOptions
30
31
  prototype._time = DateTime().asSeconds()
31
32
 
@@ -44,6 +45,7 @@ function HttpResponse(responseData as Object) as Object
44
45
  isReusable: m.isReusable(),
45
46
  isSuccess: m._isSuccess(),
46
47
  maxAge: m.getMaxAge(),
48
+ raw: { data: m._rawData },
47
49
  rawData: m._rawData,
48
50
  requestOptions: m._requestOptions,
49
51
  })
@@ -9,7 +9,8 @@
9
9
  <field id="isReusable" type="boolean" />
10
10
  <field id="isSuccess" type="boolean" />
11
11
  <field id="maxAge" type="integer" />
12
- <field id="rawData" type="assocarray" />
12
+ <field id="raw" type="assocarray" />
13
+ <field id="rawData" type="assocarray" /> <!-- @deprecated - raw field contains data key with rawData value now - raw = { data: <rawData value>} -->
13
14
  <field id="requestOptions" type="assocarray" />
14
15
  </interface>
15
16
  </component>
@@ -6,6 +6,8 @@
6
6
  <field id="data" type="assocarray" />
7
7
  <field id="options" type="assocarray" />
8
8
  <field id="result" type="node" />
9
+ <!-- Task fields -->
10
+ <field id="control" type="string" />
9
11
  </interface>
10
12
 
11
13
  <script type="text/brightscript" uri="Request.mock.brs" />
@@ -1,8 +1,10 @@
1
+ ' @import /components/ternary.brs from @dazn/kopytko-utils
2
+
1
3
  sub initKopytkoRoot(dynamicProps as Object)
2
- m._dynamicProps = dynamicProps
4
+ m._dynamicProps = ternary(Type(dynamicProps) = "roArray", dynamicProps, [])
3
5
 
4
6
  dynamicPropsValues = {}
5
- for each prop in dynamicProps
7
+ for each prop in m._dynamicProps
6
8
  dynamicPropsValues[prop] = m.top[prop]
7
9
  end for
8
10
 
@@ -14,11 +16,14 @@ sub initKopytkoRoot(dynamicProps as Object)
14
16
  end sub
15
17
 
16
18
  sub destroyKopytkoRoot()
17
- for each prop in m._dynamicProps
18
- m.top.unobserveFieldScoped(prop)
19
- end for
19
+ if m._dynamicProps <> Invalid
20
+ for each prop in m._dynamicProps
21
+ m.top.unobserveFieldScoped(prop)
22
+ end for
23
+
24
+ m._dynamicProps = Invalid
25
+ end if
20
26
 
21
- m._dynamicProps = Invalid
22
27
  destroyKopytko()
23
28
  end sub
24
29