mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 14:30:28 -05:00
Sets a package's publish/upstream origin-control restrictions, matching AWS's documented behavior that this operation can create the package (with no versions) when it doesn't exist yet, so a caller can lock a package down before anything is ever published to it. DescribePackage now reflects a stored configuration instead of the fixed ALLOW/BLOCK defaults it previously always returned, and PublishPackageVersion rejects a publish with ConflictException once a package's origin configuration sets publish to BLOCK, the one publish path this operation can actually gate since PublishPackageVersion only ever accepts the generic format. Maven/npm/pypi publish through their own native wire protocols and are not yet gated by this setting, documented as a known limitation. The format/namespace coordinate validation shared with DescribePackage is extracted into one helper instead of being duplicated a second time. clear() (the Resettable reset path) now also clears the new store; it previously left an origin-config-only package (no versions) visible to DescribePackage after a reset that wiped everything else. DescribePackage's existence check for an origin-config-only package now short-circuits before the sidecar/generic check runs at all: for a container-backed format that check would otherwise start the real Maven/npm/pypi sidecar container just to answer a describe for a package nothing was ever actually published to. DeletePackage now agrees with DescribePackage on all of this instead of drifting from it. Its deletedPackage.originConfiguration reports the restrictions that were actually stored, not a hard-coded ALLOW/BLOCK; it clears the stored configuration as part of the delete, so a deleted package cannot resurrect as a zero-version one on the next DescribePackage; and it now recognizes an origin-config-only package (no version ever published) as something it can delete, rather than 404ing on a package DescribePackage itself reports as existing. DeletePackage's own namespace/format validation, previously a second inline copy of the same rules, now goes through the shared helper too. A rejected PutPackageOriginConfiguration now also has a test asserting an invalid/missing upstream value alone is rejected (the prior tests only exercised publish) and that a rejection, on either a package that didn't exist yet or one with a prior configuration, changes nothing. deleteRepository now also removes any packageOriginConfigs entries under that repository: unlike sidecarContainerIds, which already gets a fresh id on every creation specifically so a repository recreated under the same name never inherits the previous one's sidecar content, packageOriginConfigs was keyed purely by name, so a recreated repository would otherwise inherit a prior package's restrictions, including a publish:BLOCK the new repository's owner never set.