@chipmobilesdk/rn-camera 0.3.0 → 0.5.0
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 +152 -0
- package/README.md +47 -14
- package/lib/commonjs/config/types.js +54 -0
- package/lib/commonjs/config/types.js.map +1 -0
- package/lib/commonjs/core/capabilities.js +45 -0
- package/lib/commonjs/core/capabilities.js.map +1 -0
- package/lib/commonjs/core/captureController.js +107 -0
- package/lib/commonjs/core/captureController.js.map +1 -0
- package/lib/commonjs/core/contract.js +16 -0
- package/lib/commonjs/core/contract.js.map +1 -0
- package/lib/commonjs/core/controller.js +452 -0
- package/lib/commonjs/core/controller.js.map +1 -0
- package/lib/commonjs/core/sessionMachine.js +116 -0
- package/lib/commonjs/core/sessionMachine.js.map +1 -0
- package/lib/commonjs/core/sessionRuntime.js +218 -0
- package/lib/commonjs/core/sessionRuntime.js.map +1 -0
- package/lib/commonjs/diagnostics/errors.js +86 -0
- package/lib/commonjs/diagnostics/errors.js.map +1 -0
- package/lib/commonjs/diagnostics/logger.js +40 -0
- package/lib/commonjs/diagnostics/logger.js.map +1 -0
- package/lib/commonjs/geometry/coordinateMapping.js +156 -0
- package/lib/commonjs/geometry/coordinateMapping.js.map +1 -0
- package/lib/commonjs/index.js +130 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/native/cameraEngine.js +86 -0
- package/lib/commonjs/native/cameraEngine.js.map +1 -0
- package/lib/commonjs/native/visionCameraPeer.js +28 -0
- package/lib/commonjs/native/visionCameraPeer.js.map +1 -0
- package/lib/commonjs/native/visionSurface.js +38 -0
- package/lib/commonjs/native/visionSurface.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/permissions/permissionPort.js +105 -0
- package/lib/commonjs/permissions/permissionPort.js.map +1 -0
- package/lib/commonjs/react/CameraPreview.js +136 -0
- package/lib/commonjs/react/CameraPreview.js.map +1 -0
- package/lib/commonjs/react/VisionCameraFeed.js +196 -0
- package/lib/commonjs/react/VisionCameraFeed.js.map +1 -0
- package/lib/commonjs/react/hooks.js +50 -0
- package/lib/commonjs/react/hooks.js.map +1 -0
- package/lib/commonjs/storage/artifactStore.js +98 -0
- package/lib/commonjs/storage/artifactStore.js.map +1 -0
- package/lib/commonjs/testing/conformance.js +109 -0
- package/lib/commonjs/testing/conformance.js.map +1 -0
- package/lib/commonjs/testing/index.js +50 -0
- package/lib/commonjs/testing/index.js.map +1 -0
- package/lib/commonjs/testing/testCameraAdapter.js +191 -0
- package/lib/commonjs/testing/testCameraAdapter.js.map +1 -0
- package/lib/module/config/types.js +49 -0
- package/lib/module/config/types.js.map +1 -0
- package/lib/module/core/capabilities.js +37 -0
- package/lib/module/core/capabilities.js.map +1 -0
- package/lib/module/core/captureController.js +98 -0
- package/lib/module/core/captureController.js.map +1 -0
- package/lib/module/core/contract.js +12 -0
- package/lib/module/core/contract.js.map +1 -0
- package/lib/module/core/controller.js +442 -0
- package/lib/module/core/controller.js.map +1 -0
- package/lib/module/core/sessionMachine.js +109 -0
- package/lib/module/core/sessionMachine.js.map +1 -0
- package/lib/module/core/sessionRuntime.js +215 -0
- package/lib/module/core/sessionRuntime.js.map +1 -0
- package/lib/module/diagnostics/errors.js +79 -0
- package/lib/module/diagnostics/errors.js.map +1 -0
- package/lib/module/diagnostics/logger.js +35 -0
- package/lib/module/diagnostics/logger.js.map +1 -0
- package/lib/module/geometry/coordinateMapping.js +149 -0
- package/lib/module/geometry/coordinateMapping.js.map +1 -0
- package/lib/module/index.js +44 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/native/cameraEngine.js +83 -0
- package/lib/module/native/cameraEngine.js.map +1 -0
- package/lib/module/native/visionCameraPeer.js +24 -0
- package/lib/module/native/visionCameraPeer.js.map +1 -0
- package/lib/module/native/visionSurface.js +34 -0
- package/lib/module/native/visionSurface.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/permissions/permissionPort.js +101 -0
- package/lib/module/permissions/permissionPort.js.map +1 -0
- package/lib/module/react/CameraPreview.js +130 -0
- package/lib/module/react/CameraPreview.js.map +1 -0
- package/lib/module/react/VisionCameraFeed.js +190 -0
- package/lib/module/react/VisionCameraFeed.js.map +1 -0
- package/lib/module/react/hooks.js +45 -0
- package/lib/module/react/hooks.js.map +1 -0
- package/lib/module/storage/artifactStore.js +94 -0
- package/lib/module/storage/artifactStore.js.map +1 -0
- package/lib/module/testing/conformance.js +102 -0
- package/lib/module/testing/conformance.js.map +1 -0
- package/lib/module/testing/index.js +13 -0
- package/lib/module/testing/index.js.map +1 -0
- package/lib/module/testing/testCameraAdapter.js +185 -0
- package/lib/module/testing/testCameraAdapter.js.map +1 -0
- package/lib/typescript/commonjs/config/types.d.ts +122 -0
- package/lib/typescript/commonjs/config/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/capabilities.d.ts +16 -0
- package/lib/typescript/commonjs/core/capabilities.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/captureController.d.ts +48 -0
- package/lib/typescript/commonjs/core/captureController.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/contract.d.ts +92 -0
- package/lib/typescript/commonjs/core/contract.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/controller.d.ts +15 -0
- package/lib/typescript/commonjs/core/controller.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/sessionMachine.d.ts +46 -0
- package/lib/typescript/commonjs/core/sessionMachine.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/sessionRuntime.d.ts +64 -0
- package/lib/typescript/commonjs/core/sessionRuntime.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/errors.d.ts +24 -0
- package/lib/typescript/commonjs/diagnostics/errors.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/logger.d.ts +24 -0
- package/lib/typescript/commonjs/diagnostics/logger.d.ts.map +1 -0
- package/lib/typescript/commonjs/geometry/coordinateMapping.d.ts +23 -0
- package/lib/typescript/commonjs/geometry/coordinateMapping.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +32 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/native/cameraEngine.d.ts +50 -0
- package/lib/typescript/commonjs/native/cameraEngine.d.ts.map +1 -0
- package/lib/typescript/commonjs/native/visionCameraPeer.d.ts +2 -0
- package/lib/typescript/commonjs/native/visionCameraPeer.d.ts.map +1 -0
- package/lib/typescript/commonjs/native/visionSurface.d.ts +41 -0
- package/lib/typescript/commonjs/native/visionSurface.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/permissions/permissionPort.d.ts +24 -0
- package/lib/typescript/commonjs/permissions/permissionPort.d.ts.map +1 -0
- package/lib/typescript/commonjs/react/CameraPreview.d.ts +25 -0
- package/lib/typescript/commonjs/react/CameraPreview.d.ts.map +1 -0
- package/lib/typescript/commonjs/react/VisionCameraFeed.d.ts +31 -0
- package/lib/typescript/commonjs/react/VisionCameraFeed.d.ts.map +1 -0
- package/lib/typescript/commonjs/react/hooks.d.ts +12 -0
- package/lib/typescript/commonjs/react/hooks.d.ts.map +1 -0
- package/lib/typescript/commonjs/storage/artifactStore.d.ts +54 -0
- package/lib/typescript/commonjs/storage/artifactStore.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/conformance.d.ts +37 -0
- package/lib/typescript/commonjs/testing/conformance.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/index.d.ts +12 -0
- package/lib/typescript/commonjs/testing/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/testCameraAdapter.d.ts +61 -0
- package/lib/typescript/commonjs/testing/testCameraAdapter.d.ts.map +1 -0
- package/lib/typescript/module/config/types.d.ts +122 -0
- package/lib/typescript/module/config/types.d.ts.map +1 -0
- package/lib/typescript/module/core/capabilities.d.ts +16 -0
- package/lib/typescript/module/core/capabilities.d.ts.map +1 -0
- package/lib/typescript/module/core/captureController.d.ts +48 -0
- package/lib/typescript/module/core/captureController.d.ts.map +1 -0
- package/lib/typescript/module/core/contract.d.ts +92 -0
- package/lib/typescript/module/core/contract.d.ts.map +1 -0
- package/lib/typescript/module/core/controller.d.ts +15 -0
- package/lib/typescript/module/core/controller.d.ts.map +1 -0
- package/lib/typescript/module/core/sessionMachine.d.ts +46 -0
- package/lib/typescript/module/core/sessionMachine.d.ts.map +1 -0
- package/lib/typescript/module/core/sessionRuntime.d.ts +64 -0
- package/lib/typescript/module/core/sessionRuntime.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/errors.d.ts +24 -0
- package/lib/typescript/module/diagnostics/errors.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/logger.d.ts +24 -0
- package/lib/typescript/module/diagnostics/logger.d.ts.map +1 -0
- package/lib/typescript/module/geometry/coordinateMapping.d.ts +23 -0
- package/lib/typescript/module/geometry/coordinateMapping.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +32 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/native/cameraEngine.d.ts +50 -0
- package/lib/typescript/module/native/cameraEngine.d.ts.map +1 -0
- package/lib/typescript/module/native/visionCameraPeer.d.ts +2 -0
- package/lib/typescript/module/native/visionCameraPeer.d.ts.map +1 -0
- package/lib/typescript/module/native/visionSurface.d.ts +41 -0
- package/lib/typescript/module/native/visionSurface.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/permissions/permissionPort.d.ts +24 -0
- package/lib/typescript/module/permissions/permissionPort.d.ts.map +1 -0
- package/lib/typescript/module/react/CameraPreview.d.ts +25 -0
- package/lib/typescript/module/react/CameraPreview.d.ts.map +1 -0
- package/lib/typescript/module/react/VisionCameraFeed.d.ts +31 -0
- package/lib/typescript/module/react/VisionCameraFeed.d.ts.map +1 -0
- package/lib/typescript/module/react/hooks.d.ts +12 -0
- package/lib/typescript/module/react/hooks.d.ts.map +1 -0
- package/lib/typescript/module/storage/artifactStore.d.ts +54 -0
- package/lib/typescript/module/storage/artifactStore.d.ts.map +1 -0
- package/lib/typescript/module/testing/conformance.d.ts +37 -0
- package/lib/typescript/module/testing/conformance.d.ts.map +1 -0
- package/lib/typescript/module/testing/index.d.ts +12 -0
- package/lib/typescript/module/testing/index.d.ts.map +1 -0
- package/lib/typescript/module/testing/testCameraAdapter.d.ts +61 -0
- package/lib/typescript/module/testing/testCameraAdapter.d.ts.map +1 -0
- package/package.json +49 -13
- package/skills/sdk-rn-camera/SKILL.md +25 -6
- package/src/config/types.ts +8 -0
- package/src/core/captureController.ts +11 -1
- package/src/core/contract.ts +109 -0
- package/src/core/controller.ts +96 -148
- package/src/core/sessionRuntime.ts +242 -0
- package/src/index.ts +7 -13
- package/src/native/cameraEngine.ts +28 -8
- package/src/native/visionSurface.ts +43 -18
- package/src/react/CameraPreview.tsx +40 -7
- package/src/react/VisionCameraFeed.tsx +61 -5
- package/src/react/hooks.ts +1 -1
- package/src/storage/artifactStore.ts +9 -2
- package/src/testing/testCameraAdapter.ts +29 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,157 @@
|
|
|
1
1
|
# @chipmobilesdk/rn-camera
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- The test adapter is only at `@chipmobilesdk/rn-camera/testing`. `createTestCamera`,
|
|
8
|
+
`createMemoryFileSystem`, `DEFAULT_TEST_CAPABILITIES` and their configuration and handle
|
|
9
|
+
types are gone from the main entrypoint, which had re-exported them since FR-041. That
|
|
10
|
+
re-export put the fake camera in the module graph of every app that imported the
|
|
11
|
+
package, and Metro does not tree-shake it back out, so a production bundle shipped a
|
|
12
|
+
camera nobody could use (PERF-14, TOOL-09). ([#21](https://github.com/operationd8979/chip-mobile-sdk/pull/21))
|
|
13
|
+
|
|
14
|
+
**Migration:** one line in a test — `from '@chipmobilesdk/rn-camera'` becomes
|
|
15
|
+
`from '@chipmobilesdk/rn-camera/testing'`. The subpath has existed since 0.3.0 and the
|
|
16
|
+
exports are identical; nothing about the adapter itself changed. The README said the
|
|
17
|
+
main entrypoint would keep them "until the next major release": this is that move,
|
|
18
|
+
brought forward into a minor because the package is pre-1.0 and the cost was a bundle,
|
|
19
|
+
not an API.
|
|
20
|
+
|
|
21
|
+
The layer table's exception for `index.ts` importing `./testing/testCameraAdapter` is
|
|
22
|
+
gone with it, so the `sdk/boundaries` rule now holds the same line here as everywhere
|
|
23
|
+
else: test doubles stay out of production code, and the package's own contract test
|
|
24
|
+
reaches the adapter the way a consumer's test does.
|
|
25
|
+
|
|
26
|
+
- Every package now ships built JavaScript with declaration files, instead of asking the
|
|
27
|
+
app to compile its TypeScript. ([#22](https://github.com/operationd8979/chip-mobile-sdk/pull/22))
|
|
28
|
+
|
|
29
|
+
Each tarball carries `lib/commonjs`, `lib/module` and `lib/typescript` (built with
|
|
30
|
+
`react-native-builder-bob`), and `src/` alongside them. What that changes for a
|
|
31
|
+
consumer:
|
|
32
|
+
|
|
33
|
+
- **Nothing to add to `transformIgnorePatterns`.** `require` resolves to the CommonJS
|
|
34
|
+
build, so an app's Jest loads this package without being told to transform it. That
|
|
35
|
+
was the one thing every consuming app had to know about us (DEP-04).
|
|
36
|
+
- **Typechecking reads our `.d.ts`** rather than compiling our source under our
|
|
37
|
+
`tsconfig`. A consumer's stricter — or looser — settings no longer meet our code.
|
|
38
|
+
- **`import` resolves to ESM**, so a bundler can tree-shake what it does not use.
|
|
39
|
+
|
|
40
|
+
No exported name changed, and no subpath moved: `.`, `./testing`, `./push`,
|
|
41
|
+
`./advanced`, `./app-auth`, `./keychain` and rn-core's twelve subpaths resolve exactly
|
|
42
|
+
as before, each now with its own declarations for both module systems. publint and
|
|
43
|
+
`attw --profile node16` pass on all twelve packages, which they could not before.
|
|
44
|
+
|
|
45
|
+
Inside the monorepo nothing changed either, and that is deliberate: every subpath also
|
|
46
|
+
declares a private `chipmobilesdk-source` condition pointing at its TypeScript, and
|
|
47
|
+
Metro, Jest and `tsc` here ask for that condition first. The demo app bundles 371
|
|
48
|
+
modules straight from `packages/*/src`, so editing a package still changes the app with
|
|
49
|
+
no build step, and coverage is still measured on the source. The condition is named for
|
|
50
|
+
this organization rather than using the conventional `source` because third-party
|
|
51
|
+
packages declare that one too — `@dr.pogodin/react-native-fs` does — and asking for it
|
|
52
|
+
pulled their sources into our stricter compile.
|
|
53
|
+
|
|
54
|
+
`npm run build:packages` builds everything, `prepack` rebuilds before any `npm pack`,
|
|
55
|
+
and `lib/` is git-ignored: the published bytes are produced by the release, never
|
|
56
|
+
committed. `npm run check:manifests` now fails a package whose `main`, `module`,
|
|
57
|
+
`types`, `source` condition, `files`, build script or `prepack` do not match this shape.
|
|
58
|
+
|
|
59
|
+
### Patch Changes
|
|
60
|
+
|
|
61
|
+
- Every peer range has an upper bound, and no package declares a peer it does not use. ([#21](https://github.com/operationd8979/chip-mobile-sdk/pull/21))
|
|
62
|
+
|
|
63
|
+
A peer range is now a caret, a tilde or an explicit `<`, except for `react` and
|
|
64
|
+
`react-native`: an app brings exactly one of each, so a floor is the only useful thing
|
|
65
|
+
to say about them. Every other peer is a library the app installs beside us, and an
|
|
66
|
+
open `>=` was a promise about versions nobody had run — mmkv 3→4 lost entitlements and
|
|
67
|
+
pending purchases exactly that way.
|
|
68
|
+
|
|
69
|
+
**Four of the new ceilings exclude a version that is already published**, so an app
|
|
70
|
+
that took the open range at its word may now see a peer warning. The new bound is the
|
|
71
|
+
major this release is tested against, which is the thing the old range failed to say:
|
|
72
|
+
|
|
73
|
+
| Peer | Was | Now | Published above the ceiling |
|
|
74
|
+
|---|---|---|---|
|
|
75
|
+
| `react-native-app-auth` (rn-auth) | `>=8` | `^8.0.0` | 9.0.0 |
|
|
76
|
+
| `react-native-keychain` (rn-auth) | `>=10` | `^10.0.0` | 11.0.0 |
|
|
77
|
+
| `@op-engineering/op-sqlite` (rn-local-db) | `>=17.1.0` | `^17.1.0` | 18.x, 19.x |
|
|
78
|
+
| `@react-native-firebase/messaging` (rn-notification) | `>=26.0.0` | `^26.0.0` | 27.x |
|
|
79
|
+
|
|
80
|
+
The others — `react-native-vision-camera` `^5.1.1`, `react-native-svg` `^15.15.0`,
|
|
81
|
+
`react-native-unistyles` `^3.2.0`, `@dr.pogodin/react-native-fs` `^2.39.2`,
|
|
82
|
+
`react-native-quick-crypto` `^1.0.0`, `react-native-notify-kit` `^10.5.0`,
|
|
83
|
+
`react-native-localize` `^3.7.0`, `react-native-mmkv` `^4.0.0` — exclude nothing that
|
|
84
|
+
exists today. rn-payment's mmkv range was already bounded (`>=4.0.0 <5`) and is now
|
|
85
|
+
written as the caret that means the same thing.
|
|
86
|
+
|
|
87
|
+
Peers nothing imports are gone. `rn-theme`, `rn-local-db` and `rn-notification` asked
|
|
88
|
+
for `react` without having a component or a hook between them; `rn-auth`, `rn-ai` and
|
|
89
|
+
`rn-i18n` asked for `react-native` without touching a React Native API (rn-auth reaches
|
|
90
|
+
both native modules through `lazyPeer`, rn-i18n formats on `Intl`); `rn-notification`
|
|
91
|
+
asked for `@react-native-firebase/app`, which messaging declares itself. `rn-ai` no
|
|
92
|
+
longer peers on `@chipmobilesdk/rn-auth` at all — it asks for a `TokenProvider`, a
|
|
93
|
+
two-method interface rn-auth's `auth` satisfies, so an app with its own token source
|
|
94
|
+
installs nothing extra. An app that enables push or signs in through rn-auth installs
|
|
95
|
+
the same packages as before; it is the manifest that stopped overstating.
|
|
96
|
+
|
|
97
|
+
`react-native-localize` is declared optional, which is what the code already did: the
|
|
98
|
+
time-zone reader goes through `lazyPeer` and falls back to `Intl` without it. The
|
|
99
|
+
`peerDependenciesMeta` entries that said `optional: false` are gone — that is npm's
|
|
100
|
+
default, and writing it down only invited the question of which peers were undecided.
|
|
101
|
+
|
|
102
|
+
`npm run check:manifests` now fails on an unbounded peer range, a peer nothing in
|
|
103
|
+
`src/` imports, and a `peerDependenciesMeta` entry for either, so the policy holds
|
|
104
|
+
without anyone remembering it.
|
|
105
|
+
|
|
106
|
+
- Each package's public API and its weight are now recorded in the repository, so a change
|
|
107
|
+
to either is reviewed rather than discovered. ([#23](https://github.com/operationd8979/chip-mobile-sdk/pull/23))
|
|
108
|
+
|
|
109
|
+
`packages/<pkg>/etc/*.api.md` is an api-extractor report per entrypoint — twenty-seven
|
|
110
|
+
of them, generated from the declarations the package publishes and committed. A renamed
|
|
111
|
+
type, a widened union, one more optional field: all of it shows up in a pull request's
|
|
112
|
+
diff. `npm run check:api` fails when a report is out of date and `npm run api:update`
|
|
113
|
+
rewrites them.
|
|
114
|
+
|
|
115
|
+
A report that moves now needs a **minor or major** changeset for that package.
|
|
116
|
+
`check:changesets` enforces it, because the report is generated from what the package
|
|
117
|
+
publishes, and a patch release that moves the public surface is how a consumer's build
|
|
118
|
+
breaks on `npm update`. A report added for the first time is a baseline, not a change.
|
|
119
|
+
`./testing` deliberately has no report: test doubles are not a surface a release is
|
|
120
|
+
gated on.
|
|
121
|
+
|
|
122
|
+
`npm run check:size` holds every entrypoint to a budget in `.size-limit.json`, measured
|
|
123
|
+
on the ESM build with peers and rn-core treated as external — they are what an app
|
|
124
|
+
installs beside us, not our weight. Each budget started at today's measurement plus five
|
|
125
|
+
per cent, so growth becomes a decision someone makes instead of a drift nobody sees. The
|
|
126
|
+
current figures run from 500 B (`rn-core/lazy`) to 19 kB (rn-notification).
|
|
127
|
+
|
|
128
|
+
No behaviour or API changed in this release; the entry is here so the changelog records
|
|
129
|
+
when the reports and the budgets began.
|
|
130
|
+
- Updated dependencies ([#22](https://github.com/operationd8979/chip-mobile-sdk/pull/22), [#23](https://github.com/operationd8979/chip-mobile-sdk/pull/23)):
|
|
131
|
+
- @chipmobilesdk/rn-core@0.2.0
|
|
132
|
+
|
|
133
|
+
## 0.4.0
|
|
134
|
+
|
|
135
|
+
### Minor Changes
|
|
136
|
+
|
|
137
|
+
- `start()` resolves when the preview is producing frames. With the VisionCamera adapter the session belongs to the `<Camera>` view, so the controller now waits for that view to report instead of calling the session active as soon as the request was made — `capture()` straight after `start()` used to fail with `notReady`. A camera that never produces a frame fails the start after `startTimeoutMs` (8 s by default) rather than leaving the session in `starting` forever, and the native session errors the preview reports map to `cameraInUse`, `cameraBlocked`, `permissionDenied`, `cameraUnavailable` or `interrupted`. ([#19](https://github.com/operationd8979/chip-mobile-sdk/pull/19))
|
|
138
|
+
|
|
139
|
+
`pause()` keeps the preview surface mounted and stops the camera, so `resume()` no longer rebuilds the device, the session and the photo output — the whole first-frame cost was paid on every resume, with a black flash to go with it.
|
|
140
|
+
|
|
141
|
+
Geometry comes from the camera. `onGeometryChange` fires again with the selected format's pixel size, the device's orientation and the position of the device that actually mounted, as soon as the surface reports them; the same values are published as `state.surface`. Mapping a rectangle on a portrait phone was being done against a nominal landscape 1920×1080 image.
|
|
142
|
+
|
|
143
|
+
`capture({ cameraPosition })` must name the camera that is running, and is refused with `notReady` otherwise: the photo came from the device the preview had mounted while the metadata claimed the camera that was asked for. `start({ cameraPosition })` switches.
|
|
144
|
+
|
|
145
|
+
A failed `requestPermission()` leaves a state the app can retry from rather than `requesting` forever. An engine can report that the camera was taken away (`subscribeToInterruptions`), and the session fails with that code instead of showing a frozen preview; `createTestCamera()` simulates it with `emitInterruption(code?)` and a failing permission request with `emitPermissionRequestFailure(true)`.
|
|
146
|
+
|
|
147
|
+
The preview surface belongs to its engine (`attachSurface`, `createSurfaceRegistry`), not to a module-level slot two controllers shared — a capture from one screen could run through another screen's surface. `engine` and `permissions` are required by `CameraControllerOptions` (as they always were at runtime), the unused `EngineOptions` type is gone, and the artifact store reports a typed `CameraError` rather than a bare `Error`.
|
|
148
|
+
|
|
149
|
+
### Patch Changes
|
|
150
|
+
|
|
151
|
+
- Internal: no module in these packages is over 500 lines any more. The camera controller's session I/O moved to `sessionRuntime` and its contract to `contract.ts`; the Play adapter's shape translation to `iapShapes`; the purchase flow's failure mapping and its receipt-validation hook to modules of their own; the AI client's quota request to `quotaRequest`; the in-memory adapter's attachments and the fake ads engine's clock likewise. Behaviour is unchanged — the splits are by responsibility, and every package's suite passes as it stood. ([#19](https://github.com/operationd8979/chip-mobile-sdk/pull/19))
|
|
152
|
+
|
|
153
|
+
The repository also measures what it promised: `npm run perf` prints the median of nine runs of the deterministic hot paths against written budgets (recurrence expansion, theme construction, translation lookup, chart geometry, filter compilation), the demo app has a Performance screen reporting startup phases, time to interactive and the same benchmarks on Hermes, and `npm run check:file-size` keeps the limit from drifting. The budgets and the measured figures are recorded in `docs/standards.md` §VI.
|
|
154
|
+
|
|
3
155
|
## 0.3.0
|
|
4
156
|
|
|
5
157
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ The package is **infrastructure, not a feature**. It contains no business logic,
|
|
|
19
19
|
| React Native | >= 0.85 |
|
|
20
20
|
| Android | `minSdkVersion` **24**, `targetSdkVersion` 36 |
|
|
21
21
|
| iOS | 15.1+ |
|
|
22
|
-
| `react-native-vision-camera` | 5.1.
|
|
22
|
+
| `react-native-vision-camera` | `^5.1.1` |
|
|
23
23
|
|
|
24
24
|
> **Android `minSdkVersion` stays at 24.** Secondary sources claim VisionCamera v5 requires 26. That is wrong for 5.1.1: its `gradle.properties` declares `VisionCamera_minSdkVersion=23` and its `build.gradle` resolves `rootProject.ext.minSdkVersion` first. Bumping to 26 would drop Android 7.0 and 7.1 devices for no reason.
|
|
25
25
|
|
|
@@ -213,11 +213,39 @@ const inImageSpace = mapRectToImage(myGuideFrame, geometry);
|
|
|
213
213
|
```
|
|
214
214
|
|
|
215
215
|
The pure mapping functions account for scale, letterbox or crop, orientation,
|
|
216
|
-
and front-camera mirroring using the geometry you supply.
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
216
|
+
and front-camera mirroring using the geometry you supply.
|
|
217
|
+
|
|
218
|
+
`onGeometryChange` fires first with nominal dimensions (`1920 × 1080`,
|
|
219
|
+
orientation `0`) because the preview has been measured before the camera has,
|
|
220
|
+
and again with the real ones as soon as the surface reports: the selected
|
|
221
|
+
format's pixel size, the device's orientation, and the position of the device
|
|
222
|
+
that actually mounted. The same values are on `state.surface`, which is `null`
|
|
223
|
+
until then — map coordinates once it is set, or a rectangle will be mapped
|
|
224
|
+
against a landscape image on a portrait phone.
|
|
225
|
+
|
|
226
|
+
### Starting, pausing, and what "active" means
|
|
227
|
+
|
|
228
|
+
`start()` resolves when the preview is producing frames, not when the request
|
|
229
|
+
was made: with the VisionCamera adapter the session belongs to the `<Camera>`
|
|
230
|
+
view, so the controller waits for it to report and `capture()` straight after
|
|
231
|
+
`start()` works. A camera that never produces a frame fails the start after
|
|
232
|
+
`startTimeoutMs` (8 s by default) instead of leaving the session in `starting`.
|
|
233
|
+
|
|
234
|
+
`pause()` keeps the surface mounted and stops the camera; `resume()` therefore
|
|
235
|
+
does not rebuild the device, the session and the photo output. The surface is
|
|
236
|
+
unmounted only when the session stops, fails, or loses permission.
|
|
237
|
+
|
|
238
|
+
An engine can report that the camera was taken away — another app, an incoming
|
|
239
|
+
call, a disconnected device — through `subscribeToInterruptions`. The session
|
|
240
|
+
fails with that code rather than showing a frozen preview; `createTestCamera()`
|
|
241
|
+
simulates it with `emitInterruption(code?)`.
|
|
242
|
+
|
|
243
|
+
### Which camera a capture comes from
|
|
244
|
+
|
|
245
|
+
`capture({ cameraPosition })` must name the camera that is running: a photo
|
|
246
|
+
comes from the device the preview mounted, so a request for the other one is
|
|
247
|
+
refused with `notReady` rather than returning an image labelled with a camera
|
|
248
|
+
that did not take it. Call `start({ cameraPosition })` to switch first.
|
|
221
249
|
|
|
222
250
|
### Quality and dimensions
|
|
223
251
|
|
|
@@ -232,7 +260,8 @@ or quality is required.
|
|
|
232
260
|
`createTestCamera()` returns real implementations of the same published ports the production adapters implement — not a parallel mock, so it cannot drift from the contract without a compile error.
|
|
233
261
|
|
|
234
262
|
```ts
|
|
235
|
-
import { createCameraController
|
|
263
|
+
import { createCameraController } from '@chipmobilesdk/rn-camera';
|
|
264
|
+
import { createTestCamera } from '@chipmobilesdk/rn-camera/testing';
|
|
236
265
|
|
|
237
266
|
const camera = createTestCamera({ permission: 'granted' });
|
|
238
267
|
const controller = createCameraController({
|
|
@@ -277,9 +306,11 @@ expectConformance(
|
|
|
277
306
|
);
|
|
278
307
|
```
|
|
279
308
|
|
|
280
|
-
`createTestCamera` and its helpers
|
|
281
|
-
|
|
282
|
-
|
|
309
|
+
`createTestCamera` and its helpers live at `@chipmobilesdk/rn-camera/testing`, and only
|
|
310
|
+
there as of 0.4.0 — on the main entrypoint the fake camera joined the module graph of
|
|
311
|
+
every app that imported the package, which Metro does not tree-shake back out. A test
|
|
312
|
+
that imported it from `@chipmobilesdk/rn-camera` changes that one line and nothing else.
|
|
313
|
+
`camera.prompts()` counts how often `request()` showed the system prompt.
|
|
283
314
|
|
|
284
315
|
Add a module mapping so an accidental import of the native module resolves in Jest:
|
|
285
316
|
|
|
@@ -359,16 +390,18 @@ Everything is exported from `@chipmobilesdk/rn-camera`, test doubles and conform
|
|
|
359
390
|
`CameraState`, `AppStatus`, `DEFAULT_TEMPORARY_TTL_MS`
|
|
360
391
|
- Preview and capture: `CameraPreview`, `CameraPreviewProps`, `CaptureRequest`,
|
|
361
392
|
`CapturedImage`, `StartOptions` and the camera/session/capability types
|
|
362
|
-
- Ports and adapters: `CameraEngine`, `
|
|
363
|
-
`
|
|
393
|
+
- Ports and adapters: `CameraEngine`, `createVisionCameraEngine`,
|
|
394
|
+
`VisionSurface`, `SurfaceInfo`, `SurfaceRegistry`, `createSurfaceRegistry`,
|
|
395
|
+
`PermissionPort`,
|
|
364
396
|
`createVisionCameraPermissions`, `ArtifactStore`, `FileSystemBridge`,
|
|
365
397
|
`StoreOptions`, `createCacheArtifactStore`, `createArtifactStore`
|
|
366
398
|
- Mapping: `mapPointToImage`, `mapPointToPreview`, `mapRectToImage`,
|
|
367
399
|
`mapRectToPreview`, plus `Point`, `Rect`, and `PreviewGeometry`
|
|
368
400
|
- Diagnostics: `CameraError`, `CameraErrorCode`, `isCameraError`, `redact`, and
|
|
369
401
|
the logger event/type contracts
|
|
370
|
-
- Testing
|
|
371
|
-
`DEFAULT_TEST_CAPABILITIES`, and their
|
|
402
|
+
- Testing, from `@chipmobilesdk/rn-camera/testing` rather than the main entrypoint:
|
|
403
|
+
`createTestCamera`, `createMemoryFileSystem`, `DEFAULT_TEST_CAPABILITIES`, and their
|
|
404
|
+
configuration/handle types
|
|
372
405
|
- Metadata helpers: `known`, `unavailable`, `Known`, `Unavailable`, `Maybe`
|
|
373
406
|
|
|
374
407
|
Stable for semver: types, controller, preview, mapping, errors. Experimental and may change in a minor: the diagnostics logger shape and the test adapter configuration.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.known = known;
|
|
7
|
+
exports.unavailable = unavailable;
|
|
8
|
+
/**
|
|
9
|
+
* Public type contract for @chipmobilesdk/rn-camera.
|
|
10
|
+
*
|
|
11
|
+
* Every type here is re-exported from `src/index.ts` (LIB-002/LIB-003). See
|
|
12
|
+
* `specs/006-rn-camera-package/contracts/public-api.md` for the authoritative
|
|
13
|
+
* contract and `data-model.md` for the rules behind each field.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** Camera authorization status. Seven distinguishable outcomes (FR-004). */
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A metadata field the platform could not determine (FR-022). Distinct from an
|
|
20
|
+
* absent property so consumers can tell "not reported" from "not asked for".
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
function known(value) {
|
|
24
|
+
return {
|
|
25
|
+
available: true,
|
|
26
|
+
value
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function unavailable() {
|
|
30
|
+
return {
|
|
31
|
+
available: false
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** What this device and platform actually support (FR-033). */
|
|
36
|
+
|
|
37
|
+
/** Instruction to take one still photo. Carries no business context (FR-002). */
|
|
38
|
+
|
|
39
|
+
/** Result of one successful capture. Always a file reference (FR-021/FR-021a). */
|
|
40
|
+
|
|
41
|
+
/** Options accepted when starting a session. */
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Relationship between captured-image space and on-screen preview space.
|
|
45
|
+
* Consumed by the pure mapping functions in `geometry/coordinateMapping`.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/** Aggregate observable state exposed by the controller. */
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Structural view of a CameraError, kept here so `CameraState` does not create
|
|
52
|
+
* a circular import with the diagnostics module.
|
|
53
|
+
*/
|
|
54
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["known","value","available","unavailable"],"sourceRoot":"../../../src","sources":["config/types.ts"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAoBA;AACA;AACA;AACA;;AAYO,SAASA,KAAKA,CAAIC,KAAQ,EAAY;EAC5C,OAAO;IAAEC,SAAS,EAAE,IAAI;IAAED;EAAM,CAAC;AAClC;AAEO,SAASE,WAAWA,CAAA,EAAgB;EAC1C,OAAO;IAAED,SAAS,EAAE;EAAM,CAAC;AAC5B;;AAEA;;AASA;;AAgBA;;AAgBA;;AAKA;AACA;AACA;AACA;;AAwBA;;AAkBA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.EMPTY_CAPABILITIES = void 0;
|
|
7
|
+
exports.assertSupported = assertSupported;
|
|
8
|
+
exports.supportsFlashMode = supportsFlashMode;
|
|
9
|
+
exports.supportsPosition = supportsPosition;
|
|
10
|
+
exports.supportsTorch = supportsTorch;
|
|
11
|
+
var _errors = require("../diagnostics/errors.js");
|
|
12
|
+
/**
|
|
13
|
+
* Capability gating (FR-033, FR-034).
|
|
14
|
+
*
|
|
15
|
+
* An unsupported capability must produce an `unsupportedCapability` result, not
|
|
16
|
+
* an unexpected failure — that is what lets an app hide a control instead of
|
|
17
|
+
* discovering at tap time that the device has no flash.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
const EMPTY_CAPABILITIES = exports.EMPTY_CAPABILITIES = {
|
|
21
|
+
availablePositions: [],
|
|
22
|
+
hasFlash: false,
|
|
23
|
+
hasTorch: false,
|
|
24
|
+
supportsOrientationChange: false,
|
|
25
|
+
hasCameraHardware: false
|
|
26
|
+
};
|
|
27
|
+
function supportsPosition(profile, position) {
|
|
28
|
+
return profile?.availablePositions.includes(position) ?? false;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** `off` is always legal — it is the absence of flash, not a use of it. */
|
|
32
|
+
function supportsFlashMode(profile, mode) {
|
|
33
|
+
return mode === 'off' ? true : profile?.hasFlash === true;
|
|
34
|
+
}
|
|
35
|
+
function supportsTorch(profile) {
|
|
36
|
+
return profile?.hasTorch === true;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Throws the uniform unsupported error so every gate reads the same way. */
|
|
40
|
+
function assertSupported(supported, what) {
|
|
41
|
+
if (!supported) {
|
|
42
|
+
throw new _errors.CameraError('unsupportedCapability', `Not supported on this device: ${what}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=capabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_errors","require","EMPTY_CAPABILITIES","exports","availablePositions","hasFlash","hasTorch","supportsOrientationChange","hasCameraHardware","supportsPosition","profile","position","includes","supportsFlashMode","mode","supportsTorch","assertSupported","supported","what","CameraError"],"sourceRoot":"../../../src","sources":["core/capabilities.ts"],"mappings":";;;;;;;;;;AASA,IAAAA,OAAA,GAAAC,OAAA;AATA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKO,MAAMC,kBAAqC,GAAAC,OAAA,CAAAD,kBAAA,GAAG;EACpDE,kBAAkB,EAAE,EAAE;EACtBC,QAAQ,EAAE,KAAK;EACfC,QAAQ,EAAE,KAAK;EACfC,yBAAyB,EAAE,KAAK;EAChCC,iBAAiB,EAAE;AACpB,CAAC;AAEM,SAASC,gBAAgBA,CAC/BC,OAAiC,EACjCC,QAAwB,EACd;EACV,OAAOD,OAAO,EAAEN,kBAAkB,CAACQ,QAAQ,CAACD,QAAQ,CAAC,IAAI,KAAK;AAC/D;;AAEA;AACO,SAASE,iBAAiBA,CAACH,OAAiC,EAAEI,IAAe,EAAW;EAC9F,OAAOA,IAAI,KAAK,KAAK,GAAG,IAAI,GAAGJ,OAAO,EAAEL,QAAQ,KAAK,IAAI;AAC1D;AAEO,SAASU,aAAaA,CAACL,OAAiC,EAAW;EACzE,OAAOA,OAAO,EAAEJ,QAAQ,KAAK,IAAI;AAClC;;AAEA;AACO,SAASU,eAAeA,CAACC,SAAkB,EAAEC,IAAY,EAAQ;EACvE,IAAI,CAACD,SAAS,EAAE;IACf,MAAM,IAAIE,mBAAW,CAAC,uBAAuB,EAAE,iCAAiCD,IAAI,EAAE,CAAC;EACxF;AACD","ignoreList":[]}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SingleFlight = exports.DEFAULT_QUALITY = void 0;
|
|
7
|
+
exports.assertCaptureAllowed = assertCaptureAllowed;
|
|
8
|
+
exports.clampMaxDimension = clampMaxDimension;
|
|
9
|
+
exports.clampQuality = clampQuality;
|
|
10
|
+
exports.finalizeResult = finalizeResult;
|
|
11
|
+
var _types = require("../config/types.js");
|
|
12
|
+
var _errors = require("../diagnostics/errors.js");
|
|
13
|
+
var _capabilities = require("./capabilities.js");
|
|
14
|
+
var _sessionMachine = require("./sessionMachine.js");
|
|
15
|
+
/**
|
|
16
|
+
* Capture guards, single-flight enforcement, and metadata assembly
|
|
17
|
+
* (FR-020..FR-026b).
|
|
18
|
+
*
|
|
19
|
+
* The single-flight guard rejects rather than queues or coalesces. A queue
|
|
20
|
+
* turns a double-tapped shutter into two photos the user never asked for, and
|
|
21
|
+
* coalescing hides a deliberate second capture behind an accidental one — so a
|
|
22
|
+
* fast, explicit `captureInProgress` error is the only option that lets the app
|
|
23
|
+
* decide (clarification session 2026-07-26).
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
const DEFAULT_QUALITY = exports.DEFAULT_QUALITY = 0.9;
|
|
27
|
+
function clampQuality(quality) {
|
|
28
|
+
if (quality === undefined || Number.isNaN(quality)) {
|
|
29
|
+
return DEFAULT_QUALITY;
|
|
30
|
+
}
|
|
31
|
+
return Math.min(1, Math.max(0, quality));
|
|
32
|
+
}
|
|
33
|
+
function clampMaxDimension(maxDimension) {
|
|
34
|
+
if (maxDimension === undefined || !Number.isFinite(maxDimension) || maxDimension <= 0) {
|
|
35
|
+
return (0, _types.unavailable)();
|
|
36
|
+
}
|
|
37
|
+
return (0, _types.known)(Math.floor(maxDimension));
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Validates a capture request against permission, readiness, and capability.
|
|
41
|
+
* Throws before any artifact could be created, so a rejected capture never
|
|
42
|
+
* leaves a file behind (FR-020).
|
|
43
|
+
*/
|
|
44
|
+
function assertCaptureAllowed(context, request) {
|
|
45
|
+
if (!context.permissionGranted) {
|
|
46
|
+
throw new _errors.CameraError('permissionDenied', 'Camera permission is not granted');
|
|
47
|
+
}
|
|
48
|
+
if (!(0, _sessionMachine.canCapture)(context.sessionStatus)) {
|
|
49
|
+
throw new _errors.CameraError('notReady', `Camera is not ready (session: ${context.sessionStatus})`);
|
|
50
|
+
}
|
|
51
|
+
const flashMode = request.flashMode ?? context.flashMode;
|
|
52
|
+
(0, _capabilities.assertSupported)((0, _capabilities.supportsFlashMode)(context.capabilities, flashMode), `flash mode "${flashMode}"`);
|
|
53
|
+
const position = request.cameraPosition ?? context.cameraPosition;
|
|
54
|
+
(0, _capabilities.assertSupported)((0, _capabilities.supportsPosition)(context.capabilities, position), `${position} camera`);
|
|
55
|
+
if (position !== context.cameraPosition) {
|
|
56
|
+
// The photo would come from the camera that is running, while the
|
|
57
|
+
// metadata said it came from the one that was asked for (CAM-06).
|
|
58
|
+
throw new _errors.CameraError('notReady', `The ${context.cameraPosition} camera is running. Call start({ cameraPosition: ` + `'${position}' }) before capturing with the ${position} camera.`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Normalizes whatever the engine returned into the published contract, filling
|
|
64
|
+
* in effective hint values and marking undeterminable fields explicitly
|
|
65
|
+
* unavailable rather than guessing them (FR-022, FR-023).
|
|
66
|
+
*/
|
|
67
|
+
function finalizeResult(raw, request, context) {
|
|
68
|
+
const ownership = request.destination ? 'appOwned' : 'packageTemporary';
|
|
69
|
+
return {
|
|
70
|
+
...raw,
|
|
71
|
+
ownership,
|
|
72
|
+
// The camera that took it, which the guard above has made the running one.
|
|
73
|
+
cameraPosition: raw.cameraPosition ?? context.cameraPosition,
|
|
74
|
+
timestamp: raw.timestamp ?? Date.now(),
|
|
75
|
+
effectiveQuality: raw.effectiveQuality ?? clampQuality(request.quality),
|
|
76
|
+
effectiveMaxDimension: raw.effectiveMaxDimension ?? clampMaxDimension(request.maxDimension),
|
|
77
|
+
fileSize: raw.fileSize ?? (0, _types.unavailable)(),
|
|
78
|
+
orientation: raw.orientation ?? (0, _types.unavailable)()
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Serializes captures. The slot is taken synchronously, before the operation
|
|
84
|
+
* runs, so two calls in the same tick cannot both pass the check — and the
|
|
85
|
+
* operation's own first `emit()` already sees `busy`. Holding the operation's
|
|
86
|
+
* promise instead set the slot only after that first emit, so `capturing: true`
|
|
87
|
+
* was never published at all.
|
|
88
|
+
*/
|
|
89
|
+
class SingleFlight {
|
|
90
|
+
active = false;
|
|
91
|
+
get busy() {
|
|
92
|
+
return this.active;
|
|
93
|
+
}
|
|
94
|
+
async run(operation) {
|
|
95
|
+
if (this.active) {
|
|
96
|
+
throw new _errors.CameraError('captureInProgress', 'A capture is already in progress');
|
|
97
|
+
}
|
|
98
|
+
this.active = true;
|
|
99
|
+
try {
|
|
100
|
+
return await operation();
|
|
101
|
+
} finally {
|
|
102
|
+
this.active = false;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.SingleFlight = SingleFlight;
|
|
107
|
+
//# sourceMappingURL=captureController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_types","require","_errors","_capabilities","_sessionMachine","DEFAULT_QUALITY","exports","clampQuality","quality","undefined","Number","isNaN","Math","min","max","clampMaxDimension","maxDimension","isFinite","unavailable","known","floor","assertCaptureAllowed","context","request","permissionGranted","CameraError","canCapture","sessionStatus","flashMode","assertSupported","supportsFlashMode","capabilities","position","cameraPosition","supportsPosition","finalizeResult","raw","ownership","destination","timestamp","Date","now","effectiveQuality","effectiveMaxDimension","fileSize","orientation","SingleFlight","active","busy","run","operation"],"sourceRoot":"../../../src","sources":["core/captureController.ts"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DEFAULT_TEMPORARY_TTL_MS = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* What a camera controller is, for the app that drives it.
|
|
9
|
+
*
|
|
10
|
+
* The contract lives apart from the orchestration in `controller.ts`: it is
|
|
11
|
+
* what a consumer reads, and what a test double has to satisfy, while the file
|
|
12
|
+
* next to it is how this package happens to satisfy it.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const DEFAULT_TEMPORARY_TTL_MS = exports.DEFAULT_TEMPORARY_TTL_MS = 24 * 60 * 60 * 1000;
|
|
16
|
+
//# sourceMappingURL=contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DEFAULT_TEMPORARY_TTL_MS","exports"],"sourceRoot":"../../../src","sources":["core/contract.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkBO,MAAMA,wBAAwB,GAAAC,OAAA,CAAAD,wBAAA,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI","ignoreList":[]}
|