Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate XSU policy definition to PZSchema
Summary: Finally, the big kahuna. This diff migrates our third PZ2 policy definition to PZSchema - for schema `PZXSUSchema`. To do this, we: 1/ Configure the policy on `PZXSUSchema`, in line with its configuration in `PZ2XSUPolicy`. ``` <<__Override>> protected function configure(this::TConfig $config)[write_props]: void { $config->metadata() ->policyKindID(PZPolicyKindID::XSU); $config->policy() ->pz2() ->graphWithUnion() ->outputClosure() ->withManualTrait() ->states(self::getPolicyStates()) ->flows(self::getPolicyFlows()); } private static function getPolicyStates()[]: dict<string, int> { return dict[ 'NONE' => 0, 'ALL' => 1, 'FACEBOOK' => 2, 'INSTAGRAM' => 3, 'WHATSAPP' => 4, 'UNKNOWN' => 6, 'THREADS' => 16, 'MIXED' => 18, 'DELIVERY' => 19, 'MEASUREMENT' => 20, ]; } private static function getPolicyFlows()[]: dict<string, keyset<string>> { return dict[ 'NONE' => keyset[ 'DELIVERY', 'FACEBOOK', 'INSTAGRAM', 'THREADS', 'WHATSAPP', 'UNKNOWN', ], 'FACEBOOK' => keyset['MIXED'], 'INSTAGRAM' => keyset['MIXED'], 'THREADS' => keyset['MIXED'], 'WHATSAPP' => keyset['MIXED'], 'UNKNOWN' => keyset['ALL'], 'MIXED' => keyset['ALL'], 'DELIVERY' => keyset['MEASUREMENT'], 'MEASUREMENT' => keyset['ALL'], ]; } ``` 2/ Run codegen: `pz`. 3/ Find-and-replace: ``` s/PZ2XSUPolicy/PZXSUPolicy/g s/PZ2XSUStates/PZXSUPolicyState/g ``` 4/ Move manual code from `PZ2XSUPolicy` into `PZXSUPolicyManualSection`. 4/ Delete the now defunct manual policy + state code. Differential Revision: D68216513 fbshipit-source-id: a772e9b7772a977b6026a81d19361593fb0160cf
- Loading branch information