@kingstinct/react-native-healthkit 7.0.4 → 7.0.5
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/ios/ReactNativeHealthkit.swift +3 -2
- package/lib/commonjs/utils/getMostRecentCategorySample.js +1 -1
- package/lib/commonjs/utils/getMostRecentCategorySample.js.map +1 -1
- package/lib/commonjs/utils/getMostRecentQuantitySample.js +5 -1
- package/lib/commonjs/utils/getMostRecentQuantitySample.js.map +1 -1
- package/lib/module/utils/getMostRecentCategorySample.js +1 -1
- package/lib/module/utils/getMostRecentCategorySample.js.map +1 -1
- package/lib/module/utils/getMostRecentQuantitySample.js +5 -1
- package/lib/module/utils/getMostRecentQuantitySample.js.map +1 -1
- package/lib/typescript/src/utils/getMostRecentCategorySample.d.ts +2 -1
- package/lib/typescript/src/utils/getMostRecentQuantitySample.d.ts +2 -1
- package/package.json +1 -1
- package/src/utils/getMostRecentCategorySample.ts +3 -2
- package/src/utils/getMostRecentQuantitySample.ts +9 -2
|
@@ -121,8 +121,9 @@ class ReactNativeHealthkit: RCTEventEmitter {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
do {
|
|
124
|
-
let dateOfBirth = try store.
|
|
125
|
-
|
|
124
|
+
let dateOfBirth = try store.dateOfBirthComponents()
|
|
125
|
+
|
|
126
|
+
resolve(_dateFormatter.string(from: dateOfBirth.date!))
|
|
126
127
|
} catch {
|
|
127
128
|
reject(GENERIC_ERROR, error.localizedDescription, error)
|
|
128
129
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_queryCategorySamples","_interopRequireDefault","require","obj","__esModule","default","getMostRecentCategorySample","identifier","samples","queryCategorySamples","limit","ascending","_default","exports"],"sources":["getMostRecentCategorySample.ts"],"sourcesContent":["import queryCategorySamples from './queryCategorySamples'\n\nimport type { HKCategoryTypeIdentifier } from '../native-types'\n\nasync function getMostRecentCategorySample<\n T extends HKCategoryTypeIdentifier\n>(\n identifier: T,\n) {\n const samples = await queryCategorySamples(identifier, {\n limit: 1,\n ascending: false,\n })\n\n return samples[0]
|
|
1
|
+
{"version":3,"names":["_queryCategorySamples","_interopRequireDefault","require","obj","__esModule","default","getMostRecentCategorySample","identifier","samples","queryCategorySamples","limit","ascending","_default","exports"],"sources":["getMostRecentCategorySample.ts"],"sourcesContent":["import queryCategorySamples from './queryCategorySamples'\n\nimport type { HKCategoryTypeIdentifier } from '../native-types'\nimport type { HKCategorySample } from '../types'\n\nasync function getMostRecentCategorySample<\n T extends HKCategoryTypeIdentifier\n>(\n identifier: T,\n): Promise<HKCategorySample<T> | null> {\n const samples = await queryCategorySamples(identifier, {\n limit: 1,\n ascending: false,\n })\n\n return samples[0] ?? null\n}\n\nexport default getMostRecentCategorySample\n"],"mappings":";;;;;;AAAA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAyD,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAKzD,eAAeG,2BAA2BA,CAGxCC,UAAa,EACwB;EACrC,MAAMC,OAAO,GAAG,MAAM,IAAAC,6BAAoB,EAACF,UAAU,EAAE;IACrDG,KAAK,EAAE,CAAC;IACRC,SAAS,EAAE;EACb,CAAC,CAAC;EAEF,OAAOH,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI;AAC3B;AAAC,IAAAI,QAAA,GAEcN,2BAA2B;AAAAO,OAAA,CAAAR,OAAA,GAAAO,QAAA"}
|
|
@@ -11,7 +11,11 @@ async function getMostRecentQuantitySample(identifier, unit) {
|
|
|
11
11
|
limit: 1,
|
|
12
12
|
unit
|
|
13
13
|
});
|
|
14
|
-
|
|
14
|
+
const lastSample = samples[0];
|
|
15
|
+
if (lastSample) {
|
|
16
|
+
return lastSample;
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
15
19
|
}
|
|
16
20
|
var _default = getMostRecentQuantitySample;
|
|
17
21
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_queryQuantitySamples","_interopRequireDefault","require","obj","__esModule","default","getMostRecentQuantitySample","identifier","unit","samples","queryQuantitySamples","limit","_default","exports"],"sources":["getMostRecentQuantitySample.ts"],"sourcesContent":["import queryQuantitySamples from './queryQuantitySamples'\n\nimport type { HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types'\n\nasync function getMostRecentQuantitySample<\n TIdentifier extends HKQuantityTypeIdentifier,\n TUnit extends UnitForIdentifier<TIdentifier>\n>(\n identifier: TIdentifier,\n unit: TUnit,\n) {\n const samples = await queryQuantitySamples(identifier, {\n limit: 1,\n unit,\n })\n
|
|
1
|
+
{"version":3,"names":["_queryQuantitySamples","_interopRequireDefault","require","obj","__esModule","default","getMostRecentQuantitySample","identifier","unit","samples","queryQuantitySamples","limit","lastSample","_default","exports"],"sources":["getMostRecentQuantitySample.ts"],"sourcesContent":["import queryQuantitySamples from './queryQuantitySamples'\n\nimport type { HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types'\nimport type { HKQuantitySample } from '../types'\n\nasync function getMostRecentQuantitySample<\n TIdentifier extends HKQuantityTypeIdentifier,\n TUnit extends UnitForIdentifier<TIdentifier>\n>(\n identifier: TIdentifier,\n unit: TUnit,\n): Promise<HKQuantitySample<TIdentifier, TUnit> | null> {\n const samples = await queryQuantitySamples(identifier, {\n limit: 1,\n unit,\n })\n\n const lastSample = samples[0]\n\n if (lastSample) {\n return lastSample as HKQuantitySample<TIdentifier, TUnit>\n }\n return null\n}\n\nexport default getMostRecentQuantitySample\n"],"mappings":";;;;;;AAAA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAyD,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAKzD,eAAeG,2BAA2BA,CAIxCC,UAAuB,EACvBC,IAAW,EAC2C;EACtD,MAAMC,OAAO,GAAG,MAAM,IAAAC,6BAAoB,EAACH,UAAU,EAAE;IACrDI,KAAK,EAAE,CAAC;IACRH;EACF,CAAC,CAAC;EAEF,MAAMI,UAAU,GAAGH,OAAO,CAAC,CAAC,CAAC;EAE7B,IAAIG,UAAU,EAAE;IACd,OAAOA,UAAU;EACnB;EACA,OAAO,IAAI;AACb;AAAC,IAAAC,QAAA,GAEcP,2BAA2B;AAAAQ,OAAA,CAAAT,OAAA,GAAAQ,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["queryCategorySamples","getMostRecentCategorySample","identifier","samples","limit","ascending"],"sources":["getMostRecentCategorySample.ts"],"sourcesContent":["import queryCategorySamples from './queryCategorySamples'\n\nimport type { HKCategoryTypeIdentifier } from '../native-types'\n\nasync function getMostRecentCategorySample<\n T extends HKCategoryTypeIdentifier\n>(\n identifier: T,\n) {\n const samples = await queryCategorySamples(identifier, {\n limit: 1,\n ascending: false,\n })\n\n return samples[0]
|
|
1
|
+
{"version":3,"names":["queryCategorySamples","getMostRecentCategorySample","identifier","samples","limit","ascending"],"sources":["getMostRecentCategorySample.ts"],"sourcesContent":["import queryCategorySamples from './queryCategorySamples'\n\nimport type { HKCategoryTypeIdentifier } from '../native-types'\nimport type { HKCategorySample } from '../types'\n\nasync function getMostRecentCategorySample<\n T extends HKCategoryTypeIdentifier\n>(\n identifier: T,\n): Promise<HKCategorySample<T> | null> {\n const samples = await queryCategorySamples(identifier, {\n limit: 1,\n ascending: false,\n })\n\n return samples[0] ?? null\n}\n\nexport default getMostRecentCategorySample\n"],"mappings":"AAAA,OAAOA,oBAAoB,MAAM,wBAAwB;AAKzD,eAAeC,2BAA2BA,CAGxCC,UAAa,EACwB;EACrC,MAAMC,OAAO,GAAG,MAAMH,oBAAoB,CAACE,UAAU,EAAE;IACrDE,KAAK,EAAE,CAAC;IACRC,SAAS,EAAE;EACb,CAAC,CAAC;EAEF,OAAOF,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI;AAC3B;AAEA,eAAeF,2BAA2B"}
|
|
@@ -4,7 +4,11 @@ async function getMostRecentQuantitySample(identifier, unit) {
|
|
|
4
4
|
limit: 1,
|
|
5
5
|
unit
|
|
6
6
|
});
|
|
7
|
-
|
|
7
|
+
const lastSample = samples[0];
|
|
8
|
+
if (lastSample) {
|
|
9
|
+
return lastSample;
|
|
10
|
+
}
|
|
11
|
+
return null;
|
|
8
12
|
}
|
|
9
13
|
export default getMostRecentQuantitySample;
|
|
10
14
|
//# sourceMappingURL=getMostRecentQuantitySample.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["queryQuantitySamples","getMostRecentQuantitySample","identifier","unit","samples","limit"],"sources":["getMostRecentQuantitySample.ts"],"sourcesContent":["import queryQuantitySamples from './queryQuantitySamples'\n\nimport type { HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types'\n\nasync function getMostRecentQuantitySample<\n TIdentifier extends HKQuantityTypeIdentifier,\n TUnit extends UnitForIdentifier<TIdentifier>\n>(\n identifier: TIdentifier,\n unit: TUnit,\n) {\n const samples = await queryQuantitySamples(identifier, {\n limit: 1,\n unit,\n })\n
|
|
1
|
+
{"version":3,"names":["queryQuantitySamples","getMostRecentQuantitySample","identifier","unit","samples","limit","lastSample"],"sources":["getMostRecentQuantitySample.ts"],"sourcesContent":["import queryQuantitySamples from './queryQuantitySamples'\n\nimport type { HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types'\nimport type { HKQuantitySample } from '../types'\n\nasync function getMostRecentQuantitySample<\n TIdentifier extends HKQuantityTypeIdentifier,\n TUnit extends UnitForIdentifier<TIdentifier>\n>(\n identifier: TIdentifier,\n unit: TUnit,\n): Promise<HKQuantitySample<TIdentifier, TUnit> | null> {\n const samples = await queryQuantitySamples(identifier, {\n limit: 1,\n unit,\n })\n\n const lastSample = samples[0]\n\n if (lastSample) {\n return lastSample as HKQuantitySample<TIdentifier, TUnit>\n }\n return null\n}\n\nexport default getMostRecentQuantitySample\n"],"mappings":"AAAA,OAAOA,oBAAoB,MAAM,wBAAwB;AAKzD,eAAeC,2BAA2BA,CAIxCC,UAAuB,EACvBC,IAAW,EAC2C;EACtD,MAAMC,OAAO,GAAG,MAAMJ,oBAAoB,CAACE,UAAU,EAAE;IACrDG,KAAK,EAAE,CAAC;IACRF;EACF,CAAC,CAAC;EAEF,MAAMG,UAAU,GAAGF,OAAO,CAAC,CAAC,CAAC;EAE7B,IAAIE,UAAU,EAAE;IACd,OAAOA,UAAU;EACnB;EACA,OAAO,IAAI;AACb;AAEA,eAAeL,2BAA2B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { HKCategoryTypeIdentifier } from '../native-types';
|
|
2
|
-
|
|
2
|
+
import type { HKCategorySample } from '../types';
|
|
3
|
+
declare function getMostRecentCategorySample<T extends HKCategoryTypeIdentifier>(identifier: T): Promise<HKCategorySample<T> | null>;
|
|
3
4
|
export default getMostRecentCategorySample;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types';
|
|
2
|
-
|
|
2
|
+
import type { HKQuantitySample } from '../types';
|
|
3
|
+
declare function getMostRecentQuantitySample<TIdentifier extends HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TIdentifier>>(identifier: TIdentifier, unit: TUnit): Promise<HKQuantitySample<TIdentifier, TUnit> | null>;
|
|
3
4
|
export default getMostRecentQuantitySample;
|
package/package.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import queryCategorySamples from './queryCategorySamples'
|
|
2
2
|
|
|
3
3
|
import type { HKCategoryTypeIdentifier } from '../native-types'
|
|
4
|
+
import type { HKCategorySample } from '../types'
|
|
4
5
|
|
|
5
6
|
async function getMostRecentCategorySample<
|
|
6
7
|
T extends HKCategoryTypeIdentifier
|
|
7
8
|
>(
|
|
8
9
|
identifier: T,
|
|
9
|
-
) {
|
|
10
|
+
): Promise<HKCategorySample<T> | null> {
|
|
10
11
|
const samples = await queryCategorySamples(identifier, {
|
|
11
12
|
limit: 1,
|
|
12
13
|
ascending: false,
|
|
13
14
|
})
|
|
14
15
|
|
|
15
|
-
return samples[0]
|
|
16
|
+
return samples[0] ?? null
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
export default getMostRecentCategorySample
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import queryQuantitySamples from './queryQuantitySamples'
|
|
2
2
|
|
|
3
3
|
import type { HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types'
|
|
4
|
+
import type { HKQuantitySample } from '../types'
|
|
4
5
|
|
|
5
6
|
async function getMostRecentQuantitySample<
|
|
6
7
|
TIdentifier extends HKQuantityTypeIdentifier,
|
|
@@ -8,12 +9,18 @@ async function getMostRecentQuantitySample<
|
|
|
8
9
|
>(
|
|
9
10
|
identifier: TIdentifier,
|
|
10
11
|
unit: TUnit,
|
|
11
|
-
) {
|
|
12
|
+
): Promise<HKQuantitySample<TIdentifier, TUnit> | null> {
|
|
12
13
|
const samples = await queryQuantitySamples(identifier, {
|
|
13
14
|
limit: 1,
|
|
14
15
|
unit,
|
|
15
16
|
})
|
|
16
|
-
|
|
17
|
+
|
|
18
|
+
const lastSample = samples[0]
|
|
19
|
+
|
|
20
|
+
if (lastSample) {
|
|
21
|
+
return lastSample as HKQuantitySample<TIdentifier, TUnit>
|
|
22
|
+
}
|
|
23
|
+
return null
|
|
17
24
|
}
|
|
18
25
|
|
|
19
26
|
export default getMostRecentQuantitySample
|