@marktiderman/genesis-cli 1.5.0 → 1.7.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/README.md +224 -3
- package/dist/cli.js +4602 -1549
- package/dist/cli.js.map +1 -1
- package/dist/{config-Ci-_Ue-1.d.ts → config-CrZbM3jD.d.ts} +73 -4
- package/dist/doctor.d.ts +31 -4
- package/dist/doctor.js +976 -30
- package/dist/doctor.js.map +1 -1
- package/dist/expo.d.ts +91 -8
- package/dist/expo.js +207 -14
- package/dist/expo.js.map +1 -1
- package/dist/genesis-catalog.json +502 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +987 -38
- package/dist/index.js.map +1 -1
- package/dist/scaffolder.d.ts +1 -1
- package/dist/scaffolder.js +9 -6
- package/dist/scaffolder.js.map +1 -1
- package/dist/starter/.eas/scripts/rollout-health.mjs +85 -0
- package/dist/starter/.eas/workflows/deploy-production.yml +149 -0
- package/dist/starter/.eas/workflows/e2e.yml +77 -0
- package/dist/starter/.eas/workflows/pr-preview.yml +117 -0
- package/dist/starter/.eas/workflows/rollout.yml +120 -0
- package/dist/starter/.env.example +11 -0
- package/dist/starter/.fingerprintignore +7 -0
- package/dist/starter/.maestro/README.md +38 -0
- package/dist/starter/.maestro/config.yaml +5 -0
- package/dist/starter/.maestro/flows/deep-link.yaml +22 -0
- package/dist/starter/.maestro/flows/launch.yaml +17 -0
- package/dist/starter/.maestro/flows/settings-version.yaml +28 -0
- package/dist/starter/.maestro/flows/sign-in-screen.yaml +17 -0
- package/dist/starter/.maestro/subflows/sign-in.yaml +20 -0
- package/dist/starter/README.md +314 -0
- package/dist/starter/__tests__/app-config.test.ts +51 -0
- package/dist/starter/__tests__/check-in-photos.test.ts +57 -0
- package/dist/starter/__tests__/components/css-stub.js +2 -0
- package/dist/starter/__tests__/components/fake-supabase.ts +136 -0
- package/dist/starter/__tests__/components/links.test.ts +25 -0
- package/dist/starter/__tests__/components/render-app.ts +22 -0
- package/dist/starter/__tests__/components/reports.ts +10 -0
- package/dist/starter/__tests__/components/resolver.js +12 -0
- package/dist/starter/__tests__/components/root-layout.test.tsx +55 -0
- package/dist/starter/__tests__/components/session-storage.test.tsx +81 -0
- package/dist/starter/__tests__/components/settings.test.tsx +134 -0
- package/dist/starter/__tests__/components/setup.ts +69 -0
- package/dist/starter/__tests__/components/sign-in.test.tsx +90 -0
- package/dist/starter/__tests__/components/tabs-feature-off.test.tsx +19 -0
- package/dist/starter/__tests__/components/tabs.test.tsx +43 -0
- package/dist/starter/__tests__/components/tabs.ts +12 -0
- package/dist/starter/__tests__/entry.test.ts +28 -0
- package/dist/starter/__tests__/inline-copy.ts +59 -0
- package/dist/starter/__tests__/starter.test.ts +319 -0
- package/dist/starter/_gitignore +13 -0
- package/dist/starter/app.config.ts +44 -0
- package/dist/starter/babel.config.js +9 -0
- package/dist/starter/eas.json +47 -0
- package/dist/starter/eslint.config.js +5 -0
- package/dist/starter/genesis.config.json +12 -0
- package/dist/starter/global.css +3 -0
- package/dist/starter/index.ts +14 -0
- package/dist/starter/jest.config.js +36 -0
- package/dist/starter/metro.config.js +38 -0
- package/dist/starter/package.json +93 -0
- package/dist/starter/pnpm-workspace.yaml +73 -0
- package/dist/starter/src/app/(app)/(home)/_layout.tsx +6 -0
- package/dist/starter/src/app/(app)/(home)/check-in.tsx +41 -0
- package/dist/starter/src/app/(app)/(home)/index.tsx +34 -0
- package/dist/starter/src/app/(app)/_layout.tsx +27 -0
- package/dist/starter/src/app/(app)/notifications/_layout.tsx +6 -0
- package/dist/starter/src/app/(app)/notifications/index.tsx +36 -0
- package/dist/starter/src/app/(app)/settings/_layout.tsx +6 -0
- package/dist/starter/src/app/(app)/settings/index.tsx +96 -0
- package/dist/starter/src/app/(app)/settings/notifications.tsx +16 -0
- package/dist/starter/src/app/(app)/settings/support/[id].tsx +23 -0
- package/dist/starter/src/app/(app)/settings/support/ideas.tsx +20 -0
- package/dist/starter/src/app/(app)/settings/support/index.tsx +20 -0
- package/dist/starter/src/app/(app)/settings/support/new.tsx +35 -0
- package/dist/starter/src/app/(app)/settings/support/shipped.tsx +20 -0
- package/dist/starter/src/app/+native-intent.ts +11 -0
- package/dist/starter/src/app/_layout.tsx +20 -0
- package/dist/starter/src/app/sign-in.tsx +69 -0
- package/dist/starter/src/copy.ts +118 -0
- package/dist/starter/src/forms/check-in.json +121 -0
- package/dist/starter/src/lib/account.ts +42 -0
- package/dist/starter/src/lib/app.ts +52 -0
- package/dist/starter/src/lib/auth.ts +80 -0
- package/dist/starter/src/lib/check-in-photos.ts +66 -0
- package/dist/starter/src/lib/check-in.ts +85 -0
- package/dist/starter/src/lib/define-starter.ts +148 -0
- package/dist/starter/src/lib/devtools-overlay.ts +34 -0
- package/dist/starter/src/lib/devtools.ts +23 -0
- package/dist/starter/src/lib/env.ts +33 -0
- package/dist/starter/src/lib/google-signin.ts +23 -0
- package/dist/starter/src/lib/links.ts +40 -0
- package/dist/starter/src/lib/native-modules.ts +27 -0
- package/dist/starter/src/lib/notifications.ts +15 -0
- package/dist/starter/src/lib/observability.ts +45 -0
- package/dist/starter/src/lib/push.ts +49 -0
- package/dist/starter/src/lib/supabase.ts +65 -0
- package/dist/starter/src/lib/support.ts +44 -0
- package/dist/starter/src/lib/updates.ts +61 -0
- package/dist/starter/starter.config.ts +37 -0
- package/dist/starter/supabase/config.toml +26 -0
- package/dist/starter/supabase/functions/genesis-apple-revoke/apple.ts +237 -0
- package/dist/starter/supabase/functions/genesis-apple-revoke/handler.ts +227 -0
- package/dist/starter/supabase/functions/genesis-apple-revoke/index.ts +55 -0
- package/dist/starter/supabase/functions/genesis-push-send/expo.ts +117 -0
- package/dist/starter/supabase/functions/genesis-push-send/handler.ts +462 -0
- package/dist/starter/supabase/functions/genesis-push-send/index.ts +54 -0
- package/dist/starter/supabase/migrations/20261024000000_genesis_account_deletion.sql +133 -0
- package/dist/starter/supabase/migrations/20261024000100_genesis_app_release_policy.sql +82 -0
- package/dist/starter/supabase/migrations/20261024000200_genesis_apple_token_revocation.sql +205 -0
- package/dist/starter/supabase/migrations/20261024000400_genesis_push.sql +524 -0
- package/dist/starter/supabase/migrations/20261024000600_genesis_support.sql +846 -0
- package/dist/starter/supabase/tests/database/genesis_account_deletion.test.sql +138 -0
- package/dist/starter/supabase/tests/database/genesis_app_release_policy.test.sql +148 -0
- package/dist/starter/supabase/tests/database/genesis_apple_token_revocation.test.sql +230 -0
- package/dist/starter/supabase/tests/database/genesis_push.test.sql +407 -0
- package/dist/starter/supabase/tests/database/genesis_support.test.sql +552 -0
- package/dist/starter/tailwind.config.mjs +15 -0
- package/dist/starter/tsconfig.json +14 -0
- package/dist/starter/vitest.config.mts +7 -0
- package/dist/templates/ci/app-ci.yml +17 -0
- package/dist/templates/ci/genesis-upgrade.yml +21 -0
- package/dist/templates/ci/supabase-ci.yml +20 -0
- package/dist/templates/eas/eas.json +47 -0
- package/dist/templates/eas/scripts/rollout-health.mjs +85 -0
- package/dist/templates/eas/workflows/deploy-production.yml +149 -0
- package/dist/templates/eas/workflows/e2e.yml +77 -0
- package/dist/templates/eas/workflows/pr-preview.yml +117 -0
- package/dist/templates/eas/workflows/rollout.yml +120 -0
- package/dist/templates/maestro/config.yaml +5 -0
- package/dist/templates/maestro/flows/deep-link.yaml +22 -0
- package/dist/templates/maestro/flows/launch.yaml +17 -0
- package/dist/templates/maestro/flows/settings-version.yaml +28 -0
- package/dist/templates/maestro/flows/sign-in-screen.yaml +17 -0
- package/dist/templates/maestro/subflows/sign-in.yaml +20 -0
- package/dist/vite.js +975 -29
- package/dist/vite.js.map +1 -1
- package/package.json +4 -4
package/dist/expo.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ConfigPlugin } from '@expo/config-plugins';
|
|
2
2
|
import { ExpoConfig } from '@expo/config-types';
|
|
3
|
-
import { G as GenesisLinks } from './config-
|
|
4
|
-
export {
|
|
3
|
+
import { G as GenesisDataUse, a as GenesisPrivacy, b as GenesisLinks } from './config-CrZbM3jD.js';
|
|
4
|
+
export { c as GenesisConfigError, P as PRIVACY_DATA_TYPES, d as PRIVACY_PURPOSES, p as privacyDataType, r as readGenesisConfig, v as validateLinks, e as validatePrivacy } from './config-CrZbM3jD.js';
|
|
5
5
|
|
|
6
6
|
declare const APP_VARIANTS: readonly ["development", "preview", "production"];
|
|
7
7
|
type AppVariant = (typeof APP_VARIANTS)[number];
|
|
@@ -10,6 +10,8 @@ interface VariantSuffix {
|
|
|
10
10
|
id: string;
|
|
11
11
|
/** Appended to `name`, e.g. ` (Dev)`. */
|
|
12
12
|
name: string;
|
|
13
|
+
/** Appended to each `scheme`, e.g. `-dev` (`myapp-dev://`). */
|
|
14
|
+
scheme: string;
|
|
13
15
|
}
|
|
14
16
|
/** A required-reason API category and the reasons for it, as in PrivacyInfo.xcprivacy. */
|
|
15
17
|
interface PrivacyApi {
|
|
@@ -22,10 +24,19 @@ interface WithGenesisOptions {
|
|
|
22
24
|
* leaves it out and sets `APP_VARIANT` per build profile in eas.json.
|
|
23
25
|
*/
|
|
24
26
|
variant?: AppVariant;
|
|
25
|
-
/** Suffixes per non-production variant. Default `.dev` / ` (Dev)` and `.preview` / ` (Preview)`. */
|
|
27
|
+
/** Suffixes per non-production variant. Default `.dev` / ` (Dev)` / `-dev` and `.preview` / ` (Preview)` / `-preview`. */
|
|
26
28
|
variants?: Partial<Record<Exclude<AppVariant, "production">, Partial<VariantSuffix>>>;
|
|
27
29
|
/** Where genesis.config.json and package.json live. Default: the Expo project root. */
|
|
28
30
|
projectRoot?: string;
|
|
31
|
+
/**
|
|
32
|
+
* The manifest's collected data types, overriding genesis.config.json
|
|
33
|
+
* `privacy` key by key (`blocks` here replaces the file's `blocks`; a
|
|
34
|
+
* `collects` list, from either place, replaces every block's list). An app
|
|
35
|
+
* passes `blocks` from its own feature switches, so a block turned off
|
|
36
|
+
* declares nothing. Without `privacy` in either place, the blocks are found
|
|
37
|
+
* from package.json and a warning says the app's own data isn't in the list.
|
|
38
|
+
*/
|
|
39
|
+
privacy?: GenesisPrivacy;
|
|
29
40
|
/** Turn single steps off. Every step is on by default. */
|
|
30
41
|
links?: boolean;
|
|
31
42
|
privacyManifest?: boolean;
|
|
@@ -35,14 +46,69 @@ interface WithGenesisOptions {
|
|
|
35
46
|
declare const DEFAULT_VARIANT_SUFFIXES: Record<Exclude<AppVariant, "production">, VariantSuffix>;
|
|
36
47
|
/**
|
|
37
48
|
* The required-reason APIs each package needs the app to declare, copied from
|
|
38
|
-
* the package's own PrivacyInfo.xcprivacy
|
|
39
|
-
* app's package.json lists
|
|
49
|
+
* the package's own PrivacyInfo.xcprivacy (read from the SDK 58 versions the
|
|
50
|
+
* starter installs). A package is matched when the app's package.json lists
|
|
51
|
+
* it in `dependencies`. CocoaPods also merges these manifests into the app's
|
|
52
|
+
* at `pod install` (React Native's privacy manifest aggregation); declaring
|
|
53
|
+
* them here keeps the app's manifest whole when that is off, or for a pod
|
|
54
|
+
* that doesn't ship one.
|
|
55
|
+
*
|
|
56
|
+
* - react-native 0.88 (`React/Resources`, `ReactCommon/cxxreact`,
|
|
57
|
+
* `ReactCommon/react/timing` and the boost, glog and RCT-Folly podspecs):
|
|
58
|
+
* FileTimestamp C617.1, UserDefaults CA92.1, SystemBootTime 35F9.1.
|
|
59
|
+
* - expo 58, for what it always installs: expo-file-system (FileTimestamp
|
|
60
|
+
* 0A2A.1 and 3B52.1, DiskSpace E174.1 and 85F4.1) and expo-constants
|
|
61
|
+
* (UserDefaults CA92.1).
|
|
62
|
+
* - expo-updates, through expo-eas-client: UserDefaults CA92.1.
|
|
63
|
+
* - expo-application: FileTimestamp C617.1.
|
|
64
|
+
* - expo-notifications: UserDefaults CA92.1.
|
|
65
|
+
* - async-storage 2.2.0: FileTimestamp C617.1.
|
|
40
66
|
*
|
|
41
|
-
* -
|
|
67
|
+
* - @sentry/react-native: UserDefaults CA92.1, SystemBootTime 35F9.1,
|
|
68
|
+
* FileTimestamp C617.1, as Sentry's "Apple Privacy Manifest" guide for
|
|
69
|
+
* React Native lists (sentry-cocoa ships in a pod, not in node_modules).
|
|
42
70
|
*
|
|
43
|
-
*
|
|
71
|
+
* Not listed, because their packages ship no required-reason API: expo-secure-store
|
|
72
|
+
* (the Keychain is not one), expo-crypto, expo-haptics, expo-linking,
|
|
73
|
+
* expo-apple-authentication, expo-router, netinfo, reanimated and the other
|
|
74
|
+
* starter dependencies with no PrivacyInfo.xcprivacy.
|
|
44
75
|
*/
|
|
45
76
|
declare const PRIVACY_APIS: Record<string, PrivacyApi[]>;
|
|
77
|
+
/** A Genesis block's collected data, and the packages that mean the app uses it. */
|
|
78
|
+
interface PrivacyBlock {
|
|
79
|
+
/** The block is on when the app's `dependencies` list every one of these. */
|
|
80
|
+
packages: string[];
|
|
81
|
+
collects: GenesisDataUse[];
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* What each Genesis block collects, mirroring its `defineBlock`
|
|
85
|
+
* `privacy.collects` (the blocks themselves are React Native code, which a
|
|
86
|
+
* config plugin can't load). "Collected" is Apple's sense: sent off the
|
|
87
|
+
* phone, to the app's own backend or a vendor. Purposes follow Apple's
|
|
88
|
+
* definitions: crash and performance data that keep the app working are app
|
|
89
|
+
* functionality ("minimize app crashes, improve scalability and
|
|
90
|
+
* performance"); analytics is the typed product events.
|
|
91
|
+
*
|
|
92
|
+
* - `account` (`@marktiderman/genesis-supabase` `accountBlock`): the
|
|
93
|
+
* sign-in email, the account id, and the name (Sign in with Apple's, or
|
|
94
|
+
* one typed in).
|
|
95
|
+
* - `observability` (`@marktiderman/genesis-native` `createObservability`
|
|
96
|
+
* with `events`, reporting through Sentry): crash and performance data,
|
|
97
|
+
* and the other diagnostic data Sentry sends with them (device and OS
|
|
98
|
+
* details, breadcrumbs, sessions), the three Sentry's own privacy-manifest
|
|
99
|
+
* guide lists; the user id; and the typed analytics events (product
|
|
100
|
+
* interaction), all linked because the sink sets the user id. Found by
|
|
101
|
+
* `@sentry/react-native`; an app that never sets a DSN sends nothing and
|
|
102
|
+
* should leave this block out.
|
|
103
|
+
* - `push` (`@marktiderman/genesis-native` `createPush`): the device's push
|
|
104
|
+
* token against the person (a device-level id).
|
|
105
|
+
* - `support` (`@marktiderman/genesis-support` `supportContributions`):
|
|
106
|
+
* feedback and support requests the person sends, with their text, an
|
|
107
|
+
* optional screenshot, the account id and basic device facts.
|
|
108
|
+
*
|
|
109
|
+
* Tests keep each entry equal to its block's own list.
|
|
110
|
+
*/
|
|
111
|
+
declare const PRIVACY_BLOCKS: Record<string, PrivacyBlock>;
|
|
46
112
|
/** The variant from options, else `APP_VARIANT`, else production. An unknown value throws. */
|
|
47
113
|
declare function resolveVariant(given?: string): AppVariant;
|
|
48
114
|
declare function applyVariant(config: ExpoConfig, variant: AppVariant, options?: WithGenesisOptions["variants"]): ExpoConfig;
|
|
@@ -51,9 +117,26 @@ declare function applyLinks(config: ExpoConfig, links: GenesisLinks | undefined)
|
|
|
51
117
|
declare function privacyApisFor(dependencies: Record<string, unknown>): PrivacyApi[];
|
|
52
118
|
/** Merge required-reason APIs into `ios.privacyManifests`, keeping every entry and reason the app declares. */
|
|
53
119
|
declare function applyPrivacyApis(config: ExpoConfig, apis: PrivacyApi[]): ExpoConfig;
|
|
120
|
+
/** The Genesis blocks whose packages are all in `dependencies`. */
|
|
121
|
+
declare function privacyBlocksFor(dependencies: Record<string, unknown>): string[];
|
|
122
|
+
/**
|
|
123
|
+
* The data the app collects: `privacy.collects` when given, else the union of
|
|
124
|
+
* the blocks' (`privacy.blocks`, else those found in `dependencies`). A type
|
|
125
|
+
* two blocks collect appears once, with every purpose either gives, linked or
|
|
126
|
+
* tracking if either says so. An unknown block id throws.
|
|
127
|
+
*/
|
|
128
|
+
declare function collectedDataFor(privacy: GenesisPrivacy, dependencies: Record<string, unknown>): GenesisDataUse[];
|
|
129
|
+
/**
|
|
130
|
+
* Write the collected data types and `NSPrivacyTracking` into
|
|
131
|
+
* `ios.privacyManifests`. The app's own entries win: a type it already lists
|
|
132
|
+
* is left as it wrote it, and an `NSPrivacyTracking` it set stays. Tracking
|
|
133
|
+
* defaults to whether any entry tracks; an entry that tracks with tracking
|
|
134
|
+
* set false throws, since the manifest would contradict itself.
|
|
135
|
+
*/
|
|
136
|
+
declare function applyPrivacyData(config: ExpoConfig, uses: GenesisDataUse[], tracking?: boolean): ExpoConfig;
|
|
54
137
|
declare function applyExportCompliance(config: ExpoConfig): ExpoConfig;
|
|
55
138
|
declare function applyFingerprint(config: ExpoConfig): ExpoConfig;
|
|
56
139
|
/** The Genesis config plugin. Use it in `plugins` or call it directly in app.config.ts. */
|
|
57
140
|
declare const withGenesis: ConfigPlugin<WithGenesisOptions | void>;
|
|
58
141
|
|
|
59
|
-
export { APP_VARIANTS, type AppVariant, DEFAULT_VARIANT_SUFFIXES, GenesisLinks, PRIVACY_APIS, type PrivacyApi, type VariantSuffix, type WithGenesisOptions, applyExportCompliance, applyFingerprint, applyLinks, applyPrivacyApis, applyVariant, withGenesis as default, privacyApisFor, resolveVariant, withGenesis };
|
|
142
|
+
export { APP_VARIANTS, type AppVariant, DEFAULT_VARIANT_SUFFIXES, GenesisDataUse, GenesisLinks, GenesisPrivacy, PRIVACY_APIS, PRIVACY_BLOCKS, type PrivacyApi, type PrivacyBlock, type VariantSuffix, type WithGenesisOptions, applyExportCompliance, applyFingerprint, applyLinks, applyPrivacyApis, applyPrivacyData, applyVariant, collectedDataFor, withGenesis as default, privacyApisFor, privacyBlocksFor, resolveVariant, withGenesis };
|
package/dist/expo.js
CHANGED
|
@@ -8,6 +8,54 @@ var GenesisConfigError = class extends Error {
|
|
|
8
8
|
var DoctorConfigError = class extends GenesisConfigError {
|
|
9
9
|
name = "DoctorConfigError";
|
|
10
10
|
};
|
|
11
|
+
var PRIVACY_DATA_TYPES = {
|
|
12
|
+
name: "NSPrivacyCollectedDataTypeName",
|
|
13
|
+
"email address": "NSPrivacyCollectedDataTypeEmailAddress",
|
|
14
|
+
"phone number": "NSPrivacyCollectedDataTypePhoneNumber",
|
|
15
|
+
"physical address": "NSPrivacyCollectedDataTypePhysicalAddress",
|
|
16
|
+
"other user contact info": "NSPrivacyCollectedDataTypeOtherUserContactInfo",
|
|
17
|
+
health: "NSPrivacyCollectedDataTypeHealth",
|
|
18
|
+
fitness: "NSPrivacyCollectedDataTypeFitness",
|
|
19
|
+
"payment info": "NSPrivacyCollectedDataTypePaymentInfo",
|
|
20
|
+
"credit info": "NSPrivacyCollectedDataTypeCreditInfo",
|
|
21
|
+
"other financial info": "NSPrivacyCollectedDataTypeOtherFinancialInfo",
|
|
22
|
+
"precise location": "NSPrivacyCollectedDataTypePreciseLocation",
|
|
23
|
+
"coarse location": "NSPrivacyCollectedDataTypeCoarseLocation",
|
|
24
|
+
"sensitive info": "NSPrivacyCollectedDataTypeSensitiveInfo",
|
|
25
|
+
contacts: "NSPrivacyCollectedDataTypeContacts",
|
|
26
|
+
"emails or text messages": "NSPrivacyCollectedDataTypeEmailsOrTextMessages",
|
|
27
|
+
"photos or videos": "NSPrivacyCollectedDataTypePhotosorVideos",
|
|
28
|
+
"audio data": "NSPrivacyCollectedDataTypeAudioData",
|
|
29
|
+
"gameplay content": "NSPrivacyCollectedDataTypeGameplayContent",
|
|
30
|
+
"customer support": "NSPrivacyCollectedDataTypeCustomerSupport",
|
|
31
|
+
"other user content": "NSPrivacyCollectedDataTypeOtherUserContent",
|
|
32
|
+
"browsing history": "NSPrivacyCollectedDataTypeBrowsingHistory",
|
|
33
|
+
"search history": "NSPrivacyCollectedDataTypeSearchHistory",
|
|
34
|
+
"user id": "NSPrivacyCollectedDataTypeUserID",
|
|
35
|
+
"device id": "NSPrivacyCollectedDataTypeDeviceID",
|
|
36
|
+
"purchase history": "NSPrivacyCollectedDataTypePurchaseHistory",
|
|
37
|
+
"product interaction": "NSPrivacyCollectedDataTypeProductInteraction",
|
|
38
|
+
"advertising data": "NSPrivacyCollectedDataTypeAdvertisingData",
|
|
39
|
+
"other usage data": "NSPrivacyCollectedDataTypeOtherUsageData",
|
|
40
|
+
"crash data": "NSPrivacyCollectedDataTypeCrashData",
|
|
41
|
+
"performance data": "NSPrivacyCollectedDataTypePerformanceData",
|
|
42
|
+
"other diagnostic data": "NSPrivacyCollectedDataTypeOtherDiagnosticData",
|
|
43
|
+
"environment scanning": "NSPrivacyCollectedDataTypeEnvironmentScanning",
|
|
44
|
+
hands: "NSPrivacyCollectedDataTypeHands",
|
|
45
|
+
head: "NSPrivacyCollectedDataTypeHead",
|
|
46
|
+
"other data types": "NSPrivacyCollectedDataTypeOtherDataTypes"
|
|
47
|
+
};
|
|
48
|
+
function privacyDataType(type) {
|
|
49
|
+
return PRIVACY_DATA_TYPES[type.toLowerCase()];
|
|
50
|
+
}
|
|
51
|
+
var PRIVACY_PURPOSES = {
|
|
52
|
+
"app functionality": "NSPrivacyCollectedDataTypePurposeAppFunctionality",
|
|
53
|
+
analytics: "NSPrivacyCollectedDataTypePurposeAnalytics",
|
|
54
|
+
"product personalization": "NSPrivacyCollectedDataTypePurposeProductPersonalization",
|
|
55
|
+
"developer advertising": "NSPrivacyCollectedDataTypePurposeDeveloperAdvertising",
|
|
56
|
+
"third-party advertising": "NSPrivacyCollectedDataTypePurposeThirdPartyAdvertising",
|
|
57
|
+
other: "NSPrivacyCollectedDataTypePurposeOther"
|
|
58
|
+
};
|
|
11
59
|
function readJson(file) {
|
|
12
60
|
try {
|
|
13
61
|
return JSON.parse(readFileSync(file, "utf8"));
|
|
@@ -20,8 +68,48 @@ function readGenesisConfig(root) {
|
|
|
20
68
|
if (!existsSync(file)) return null;
|
|
21
69
|
const raw = readJson(file);
|
|
22
70
|
if (!isObject(raw)) throw new GenesisConfigError(`${file}: the config must be a JSON object`);
|
|
23
|
-
const
|
|
24
|
-
|
|
71
|
+
const out = { raw };
|
|
72
|
+
if (raw.links !== void 0) out.links = validateLinks(raw.links, file);
|
|
73
|
+
if (raw.privacy !== void 0) out.privacy = validatePrivacy(raw.privacy, file);
|
|
74
|
+
return out;
|
|
75
|
+
}
|
|
76
|
+
var PRIVACY_KEYS = /* @__PURE__ */ new Set(["blocks", "collects", "tracking"]);
|
|
77
|
+
var DATA_USE_KEYS = /* @__PURE__ */ new Set(["type", "purposes", "linked", "tracking"]);
|
|
78
|
+
function validatePrivacy(raw, source = "config") {
|
|
79
|
+
const fail = (msg) => {
|
|
80
|
+
throw new GenesisConfigError(`${source}: ${msg}`);
|
|
81
|
+
};
|
|
82
|
+
if (!isObject(raw)) fail(`"privacy" must be an object`);
|
|
83
|
+
const c = raw;
|
|
84
|
+
for (const key of Object.keys(c)) if (!PRIVACY_KEYS.has(key)) fail(`privacy: unknown setting "${key}"`);
|
|
85
|
+
const out = {};
|
|
86
|
+
if (c.blocks !== void 0) {
|
|
87
|
+
if (!isStringList(c.blocks)) fail(`privacy.blocks must be a list of block ids`);
|
|
88
|
+
out.blocks = [...new Set(c.blocks)];
|
|
89
|
+
}
|
|
90
|
+
if (c.tracking !== void 0) {
|
|
91
|
+
if (typeof c.tracking !== "boolean") fail(`privacy.tracking must be true or false`);
|
|
92
|
+
out.tracking = c.tracking;
|
|
93
|
+
}
|
|
94
|
+
if (c.collects !== void 0) {
|
|
95
|
+
if (!Array.isArray(c.collects)) fail(`privacy.collects must be a list`);
|
|
96
|
+
out.collects = c.collects.map((entry, i) => {
|
|
97
|
+
const where = `privacy.collects[${i}]`;
|
|
98
|
+
if (!isObject(entry)) return fail(`${where} must be an object`);
|
|
99
|
+
for (const key of Object.keys(entry)) if (!DATA_USE_KEYS.has(key)) fail(`${where}: unknown setting "${key}"`);
|
|
100
|
+
if (typeof entry.type !== "string" || !privacyDataType(entry.type)) {
|
|
101
|
+
fail(`${where}.type "${String(entry.type)}" is not one of ${Object.keys(PRIVACY_DATA_TYPES).join(", ")}`);
|
|
102
|
+
}
|
|
103
|
+
if (!isStringList(entry.purposes) || entry.purposes.length === 0) fail(`${where}.purposes must be a non-empty list`);
|
|
104
|
+
for (const p of entry.purposes) {
|
|
105
|
+
if (!(p in PRIVACY_PURPOSES)) fail(`${where}.purposes: "${p}" is not one of ${Object.keys(PRIVACY_PURPOSES).join(", ")}`);
|
|
106
|
+
}
|
|
107
|
+
if (typeof entry.linked !== "boolean") fail(`${where}.linked must be true or false`);
|
|
108
|
+
if (typeof entry.tracking !== "boolean") fail(`${where}.tracking must be true or false`);
|
|
109
|
+
return { type: entry.type, purposes: [...new Set(entry.purposes)], linked: entry.linked, tracking: entry.tracking };
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
return out;
|
|
25
113
|
}
|
|
26
114
|
var LINK_KEYS = /* @__PURE__ */ new Set(["hosts", "paths", "webcredentials"]);
|
|
27
115
|
var HOST = /^(?=.{1,253}$)(\*\.)?([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/;
|
|
@@ -62,13 +150,57 @@ function isStringList(v) {
|
|
|
62
150
|
// src/expo.ts
|
|
63
151
|
var APP_VARIANTS = ["development", "preview", "production"];
|
|
64
152
|
var DEFAULT_VARIANT_SUFFIXES = {
|
|
65
|
-
development: { id: ".dev", name: " (Dev)" },
|
|
66
|
-
preview: { id: ".preview", name: " (Preview)" }
|
|
153
|
+
development: { id: ".dev", name: " (Dev)", scheme: "-dev" },
|
|
154
|
+
preview: { id: ".preview", name: " (Preview)", scheme: "-preview" }
|
|
67
155
|
};
|
|
156
|
+
var api = (category, ...reasons) => ({
|
|
157
|
+
NSPrivacyAccessedAPIType: `NSPrivacyAccessedAPICategory${category}`,
|
|
158
|
+
NSPrivacyAccessedAPITypeReasons: reasons
|
|
159
|
+
});
|
|
68
160
|
var PRIVACY_APIS = {
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
]
|
|
161
|
+
"react-native": [api("FileTimestamp", "C617.1"), api("UserDefaults", "CA92.1"), api("SystemBootTime", "35F9.1")],
|
|
162
|
+
expo: [api("FileTimestamp", "0A2A.1", "3B52.1"), api("DiskSpace", "E174.1", "85F4.1"), api("UserDefaults", "CA92.1")],
|
|
163
|
+
"expo-updates": [api("UserDefaults", "CA92.1")],
|
|
164
|
+
"expo-application": [api("FileTimestamp", "C617.1")],
|
|
165
|
+
"expo-notifications": [api("UserDefaults", "CA92.1")],
|
|
166
|
+
"@react-native-async-storage/async-storage": [api("FileTimestamp", "C617.1")],
|
|
167
|
+
"@sentry/react-native": [api("UserDefaults", "CA92.1"), api("SystemBootTime", "35F9.1"), api("FileTimestamp", "C617.1")]
|
|
168
|
+
};
|
|
169
|
+
var appFunctionality = (type, ...more) => ({
|
|
170
|
+
type,
|
|
171
|
+
purposes: ["app functionality", ...more],
|
|
172
|
+
linked: true,
|
|
173
|
+
tracking: false
|
|
174
|
+
});
|
|
175
|
+
var PRIVACY_BLOCKS = {
|
|
176
|
+
account: {
|
|
177
|
+
packages: ["@marktiderman/genesis-supabase"],
|
|
178
|
+
collects: [appFunctionality("email address"), appFunctionality("user id"), appFunctionality("name")]
|
|
179
|
+
},
|
|
180
|
+
observability: {
|
|
181
|
+
packages: ["@marktiderman/genesis-native", "@sentry/react-native"],
|
|
182
|
+
collects: [
|
|
183
|
+
appFunctionality("crash data"),
|
|
184
|
+
appFunctionality("performance data"),
|
|
185
|
+
appFunctionality("other diagnostic data"),
|
|
186
|
+
appFunctionality("user id", "analytics"),
|
|
187
|
+
{ type: "product interaction", purposes: ["analytics"], linked: true, tracking: false }
|
|
188
|
+
]
|
|
189
|
+
},
|
|
190
|
+
push: {
|
|
191
|
+
packages: ["@marktiderman/genesis-native", "expo-notifications"],
|
|
192
|
+
collects: [appFunctionality("device ID")]
|
|
193
|
+
},
|
|
194
|
+
support: {
|
|
195
|
+
packages: ["@marktiderman/genesis-support"],
|
|
196
|
+
collects: [
|
|
197
|
+
appFunctionality("user id"),
|
|
198
|
+
appFunctionality("customer support"),
|
|
199
|
+
appFunctionality("other user content"),
|
|
200
|
+
appFunctionality("photos or videos"),
|
|
201
|
+
appFunctionality("other diagnostic data")
|
|
202
|
+
]
|
|
203
|
+
}
|
|
72
204
|
};
|
|
73
205
|
function resolveVariant(given) {
|
|
74
206
|
const value = given ?? process.env.APP_VARIANT ?? "production";
|
|
@@ -84,6 +216,8 @@ function applyVariant(config, variant, options = {}) {
|
|
|
84
216
|
const next = { ...config, name: add(config.name, suffix.name) };
|
|
85
217
|
if (config.ios?.bundleIdentifier) next.ios = { ...config.ios, bundleIdentifier: add(config.ios.bundleIdentifier, suffix.id) };
|
|
86
218
|
if (config.android?.package) next.android = { ...config.android, package: add(config.android.package, suffix.id) };
|
|
219
|
+
if (typeof config.scheme === "string") next.scheme = add(config.scheme, suffix.scheme);
|
|
220
|
+
else if (Array.isArray(config.scheme)) next.scheme = config.scheme.map((scheme) => add(scheme, suffix.scheme));
|
|
87
221
|
return next;
|
|
88
222
|
}
|
|
89
223
|
function applyLinks(config, links) {
|
|
@@ -110,13 +244,61 @@ function applyPrivacyApis(config, apis) {
|
|
|
110
244
|
if (apis.length === 0) return config;
|
|
111
245
|
const manifests = config.ios?.privacyManifests ?? {};
|
|
112
246
|
const types = (manifests.NSPrivacyAccessedAPITypes ?? []).map((t) => ({ ...t, NSPrivacyAccessedAPITypeReasons: [...t.NSPrivacyAccessedAPITypeReasons] }));
|
|
113
|
-
for (const
|
|
114
|
-
const found = types.find((t) => t.NSPrivacyAccessedAPIType ===
|
|
115
|
-
if (found) found.NSPrivacyAccessedAPITypeReasons = union(found.NSPrivacyAccessedAPITypeReasons,
|
|
116
|
-
else types.push({ ...
|
|
247
|
+
for (const api2 of apis) {
|
|
248
|
+
const found = types.find((t) => t.NSPrivacyAccessedAPIType === api2.NSPrivacyAccessedAPIType);
|
|
249
|
+
if (found) found.NSPrivacyAccessedAPITypeReasons = union(found.NSPrivacyAccessedAPITypeReasons, api2.NSPrivacyAccessedAPITypeReasons);
|
|
250
|
+
else types.push({ ...api2, NSPrivacyAccessedAPITypeReasons: [...api2.NSPrivacyAccessedAPITypeReasons] });
|
|
117
251
|
}
|
|
118
252
|
return { ...config, ios: { ...config.ios, privacyManifests: { ...manifests, NSPrivacyAccessedAPITypes: types } } };
|
|
119
253
|
}
|
|
254
|
+
function privacyBlocksFor(dependencies) {
|
|
255
|
+
return Object.keys(PRIVACY_BLOCKS).filter((id) => PRIVACY_BLOCKS[id].packages.every((pkg) => pkg in dependencies));
|
|
256
|
+
}
|
|
257
|
+
function collectedDataFor(privacy, dependencies) {
|
|
258
|
+
if (privacy.collects) return mergeDataUses(privacy.collects);
|
|
259
|
+
const blocks = privacy.blocks ?? privacyBlocksFor(dependencies);
|
|
260
|
+
const unknown = blocks.filter((id) => !(id in PRIVACY_BLOCKS));
|
|
261
|
+
if (unknown.length) {
|
|
262
|
+
throw new GenesisConfigError(`privacy.blocks: ${unknown.map((id) => `"${id}"`).join(", ")} not one of ${Object.keys(PRIVACY_BLOCKS).join(", ")}; list other data in privacy.collects`);
|
|
263
|
+
}
|
|
264
|
+
return mergeDataUses(blocks.flatMap((id) => PRIVACY_BLOCKS[id].collects));
|
|
265
|
+
}
|
|
266
|
+
function mergeDataUses(uses) {
|
|
267
|
+
const byType = /* @__PURE__ */ new Map();
|
|
268
|
+
for (const use of uses) {
|
|
269
|
+
const key = privacyDataType(use.type) ?? use.type;
|
|
270
|
+
const seen = byType.get(key);
|
|
271
|
+
byType.set(
|
|
272
|
+
key,
|
|
273
|
+
seen ? { type: use.type, purposes: union(seen.purposes, use.purposes), linked: seen.linked || use.linked, tracking: seen.tracking || use.tracking } : { ...use, purposes: [...use.purposes] }
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
return [...byType.values()];
|
|
277
|
+
}
|
|
278
|
+
function applyPrivacyData(config, uses, tracking) {
|
|
279
|
+
const manifests = config.ios?.privacyManifests ?? {};
|
|
280
|
+
if (tracking !== void 0 && manifests.NSPrivacyTracking !== void 0 && tracking !== manifests.NSPrivacyTracking) {
|
|
281
|
+
throw new GenesisConfigError(`privacy.tracking is ${tracking} but app.config sets ios.privacyManifests.NSPrivacyTracking to ${manifests.NSPrivacyTracking}; set it in one place`);
|
|
282
|
+
}
|
|
283
|
+
const tracks = uses.some((u) => u.tracking);
|
|
284
|
+
const NSPrivacyTracking = manifests.NSPrivacyTracking ?? tracking ?? tracks;
|
|
285
|
+
if (tracks && NSPrivacyTracking === false) {
|
|
286
|
+
const which = uses.filter((u) => u.tracking).map((u) => u.type);
|
|
287
|
+
throw new GenesisConfigError(`privacy: ${which.join(", ")} is used for tracking but NSPrivacyTracking is false; set privacy.tracking to true and list NSPrivacyTrackingDomains`);
|
|
288
|
+
}
|
|
289
|
+
const existing = (manifests.NSPrivacyCollectedDataTypes ?? []).map((t) => ({ ...t, NSPrivacyCollectedDataTypePurposes: [...t.NSPrivacyCollectedDataTypePurposes] }));
|
|
290
|
+
const listed = new Set(existing.map((t) => t.NSPrivacyCollectedDataType));
|
|
291
|
+
const added = uses.map((u) => ({
|
|
292
|
+
NSPrivacyCollectedDataType: privacyDataType(u.type),
|
|
293
|
+
NSPrivacyCollectedDataTypeLinked: u.linked,
|
|
294
|
+
NSPrivacyCollectedDataTypeTracking: u.tracking,
|
|
295
|
+
NSPrivacyCollectedDataTypePurposes: u.purposes.map((p) => PRIVACY_PURPOSES[p])
|
|
296
|
+
})).filter((t) => !listed.has(t.NSPrivacyCollectedDataType));
|
|
297
|
+
return {
|
|
298
|
+
...config,
|
|
299
|
+
ios: { ...config.ios, privacyManifests: { ...manifests, NSPrivacyTracking, NSPrivacyCollectedDataTypes: [...existing, ...added] } }
|
|
300
|
+
};
|
|
301
|
+
}
|
|
120
302
|
function applyExportCompliance(config) {
|
|
121
303
|
if (config.ios?.config?.usesNonExemptEncryption !== void 0) return config;
|
|
122
304
|
return { ...config, ios: { ...config.ios, config: { ...config.ios?.config, usesNonExemptEncryption: false } } };
|
|
@@ -131,8 +313,19 @@ var withGenesis = (config, props) => {
|
|
|
131
313
|
const options = props ?? {};
|
|
132
314
|
const root = options.projectRoot ?? config._internal?.projectRoot ?? process.cwd();
|
|
133
315
|
let next = applyVariant(config, resolveVariant(options.variant), options.variants);
|
|
134
|
-
|
|
135
|
-
if (options.
|
|
316
|
+
const file = options.links !== false || options.privacyManifest !== false ? readGenesisConfig(root) : null;
|
|
317
|
+
if (options.links !== false) next = applyLinks(next, file?.links);
|
|
318
|
+
if (options.privacyManifest !== false) {
|
|
319
|
+
const dependencies = readDependencies(root);
|
|
320
|
+
const privacy = { ...file?.privacy, ...options.privacy ? validatePrivacy(options.privacy, "withGenesis({ privacy })") : {} };
|
|
321
|
+
next = applyPrivacyApis(next, privacyApisFor(dependencies));
|
|
322
|
+
if (!privacy.blocks && !privacy.collects && !config.ios?.privacyManifests?.NSPrivacyCollectedDataTypes) {
|
|
323
|
+
console.warn(
|
|
324
|
+
`[genesis] privacy manifest: collected data types are only those of the Genesis blocks found in package.json (${privacyBlocksFor(dependencies).join(", ") || "none"}). If the app sends anything else, list everything it collects in genesis.config.json privacy.collects; to keep this list, set privacy.blocks.`
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
next = applyPrivacyData(next, collectedDataFor(privacy, dependencies), privacy.tracking);
|
|
328
|
+
}
|
|
136
329
|
if (options.exportCompliance !== false) next = applyExportCompliance(next);
|
|
137
330
|
if (options.fingerprint !== false) next = applyFingerprint(next);
|
|
138
331
|
return next;
|
|
@@ -152,6 +345,6 @@ function union(a, b) {
|
|
|
152
345
|
return [.../* @__PURE__ */ new Set([...a, ...b])];
|
|
153
346
|
}
|
|
154
347
|
|
|
155
|
-
export { APP_VARIANTS, DEFAULT_VARIANT_SUFFIXES, GenesisConfigError, PRIVACY_APIS, applyExportCompliance, applyFingerprint, applyLinks, applyPrivacyApis, applyVariant, expo_default as default, privacyApisFor, readGenesisConfig, resolveVariant, validateLinks, withGenesis };
|
|
348
|
+
export { APP_VARIANTS, DEFAULT_VARIANT_SUFFIXES, GenesisConfigError, PRIVACY_APIS, PRIVACY_BLOCKS, PRIVACY_DATA_TYPES, PRIVACY_PURPOSES, applyExportCompliance, applyFingerprint, applyLinks, applyPrivacyApis, applyPrivacyData, applyVariant, collectedDataFor, expo_default as default, privacyApisFor, privacyBlocksFor, privacyDataType, readGenesisConfig, resolveVariant, validateLinks, validatePrivacy, withGenesis };
|
|
156
349
|
//# sourceMappingURL=expo.js.map
|
|
157
350
|
//# sourceMappingURL=expo.js.map
|