@pithy-sh/core 0.1.1 → 0.1.3
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/dist/address/address.d.ts +57 -0
- package/dist/address/address.d.ts.map +1 -0
- package/dist/address/address.js +71 -0
- package/dist/audit/auditEvent.d.ts +89 -0
- package/dist/audit/auditEvent.d.ts.map +1 -0
- package/dist/audit/auditEvent.js +69 -0
- package/dist/audit/recorder.d.ts +18 -0
- package/dist/audit/recorder.d.ts.map +1 -0
- package/dist/audit/recorder.js +8 -0
- package/dist/capability/bindings.d.ts +62 -0
- package/dist/capability/bindings.d.ts.map +1 -0
- package/dist/capability/bindings.js +97 -0
- package/dist/capability/capability.d.ts +501 -0
- package/dist/capability/capability.d.ts.map +1 -0
- package/dist/capability/capability.js +16 -0
- package/dist/capability/client.d.ts +70 -0
- package/dist/capability/client.d.ts.map +1 -0
- package/dist/capability/client.js +86 -0
- package/dist/capability/compose.d.ts +25 -0
- package/dist/capability/compose.d.ts.map +1 -0
- package/dist/capability/compose.js +54 -0
- package/dist/capability/composition.d.ts +26 -0
- package/dist/capability/composition.d.ts.map +1 -0
- package/dist/capability/composition.js +84 -0
- package/dist/capability/config.d.ts +7 -0
- package/dist/capability/config.d.ts.map +1 -0
- package/dist/capability/config.js +14 -0
- package/dist/capability/devSecret.d.ts +32 -0
- package/dist/capability/devSecret.d.ts.map +1 -0
- package/dist/capability/devSecret.js +28 -0
- package/dist/capability/manifest.d.ts +298 -0
- package/dist/capability/manifest.d.ts.map +1 -0
- package/dist/capability/manifest.js +356 -0
- package/dist/capability/secretOrigin.d.ts +121 -0
- package/dist/capability/secretOrigin.d.ts.map +1 -0
- package/dist/capability/secretOrigin.js +134 -0
- package/dist/capability/settings.d.ts +119 -0
- package/dist/capability/settings.d.ts.map +1 -0
- package/dist/capability/settings.js +66 -0
- package/dist/capability/validateBindings.d.ts +4 -0
- package/dist/capability/validateBindings.d.ts.map +1 -0
- package/dist/capability/validateBindings.js +34 -0
- package/dist/capability/vanishingKey.d.ts +31 -0
- package/dist/capability/vanishingKey.d.ts.map +1 -0
- package/dist/capability/vanishingKey.js +79 -0
- package/dist/controlPlane/audit/actions.d.ts +70 -0
- package/dist/controlPlane/audit/actions.d.ts.map +1 -0
- package/dist/controlPlane/audit/actions.js +76 -0
- package/dist/controlPlane/capability.d.ts +47 -0
- package/dist/controlPlane/capability.d.ts.map +1 -0
- package/dist/controlPlane/capability.js +138 -0
- package/dist/controlPlane/config/config.d.ts +19 -0
- package/dist/controlPlane/config/config.d.ts.map +1 -0
- package/dist/controlPlane/config/config.js +85 -0
- package/dist/controlPlane/context.d.ts +27 -0
- package/dist/controlPlane/context.d.ts.map +1 -0
- package/dist/controlPlane/context.js +29 -0
- package/dist/controlPlane/data/connection.d.ts +79 -0
- package/dist/controlPlane/data/connection.d.ts.map +1 -0
- package/dist/controlPlane/data/connection.js +55 -0
- package/dist/controlPlane/data/keyLifecycle.d.ts +62 -0
- package/dist/controlPlane/data/keyLifecycle.d.ts.map +1 -0
- package/dist/controlPlane/data/keyLifecycle.js +126 -0
- package/dist/controlPlane/data/replay.d.ts +18 -0
- package/dist/controlPlane/data/replay.d.ts.map +1 -0
- package/dist/controlPlane/data/replay.js +20 -0
- package/dist/controlPlane/data/tables.d.ts +34 -0
- package/dist/controlPlane/data/tables.d.ts.map +1 -0
- package/dist/controlPlane/data/tables.js +37 -0
- package/dist/controlPlane/discovery/adminRoute.d.ts +313 -0
- package/dist/controlPlane/discovery/adminRoute.d.ts.map +1 -0
- package/dist/controlPlane/discovery/adminRoute.js +136 -0
- package/dist/controlPlane/discovery/configuration.d.ts +108 -0
- package/dist/controlPlane/discovery/configuration.d.ts.map +1 -0
- package/dist/controlPlane/discovery/configuration.js +187 -0
- package/dist/controlPlane/discovery/drift.d.ts +64 -0
- package/dist/controlPlane/discovery/drift.d.ts.map +1 -0
- package/dist/controlPlane/discovery/drift.js +58 -0
- package/dist/controlPlane/discovery/health.d.ts +99 -0
- package/dist/controlPlane/discovery/health.d.ts.map +1 -0
- package/dist/controlPlane/discovery/health.js +151 -0
- package/dist/controlPlane/discovery/healthSummary.d.ts +236 -0
- package/dist/controlPlane/discovery/healthSummary.d.ts.map +1 -0
- package/dist/controlPlane/discovery/healthSummary.js +278 -0
- package/dist/controlPlane/error/errors.d.ts +67 -0
- package/dist/controlPlane/error/errors.d.ts.map +1 -0
- package/dist/controlPlane/error/errors.js +79 -0
- package/dist/controlPlane/http/cors.d.ts +112 -0
- package/dist/controlPlane/http/cors.d.ts.map +1 -0
- package/dist/controlPlane/http/cors.js +192 -0
- package/dist/controlPlane/http/guard.d.ts +77 -0
- package/dist/controlPlane/http/guard.d.ts.map +1 -0
- package/dist/controlPlane/http/guard.js +142 -0
- package/dist/controlPlane/http/handlers.d.ts +179 -0
- package/dist/controlPlane/http/handlers.d.ts.map +1 -0
- package/dist/controlPlane/http/handlers.js +245 -0
- package/dist/controlPlane/http/responses.d.ts +99 -0
- package/dist/controlPlane/http/responses.d.ts.map +1 -0
- package/dist/controlPlane/http/responses.js +63 -0
- package/dist/controlPlane/http/routes.d.ts +40 -0
- package/dist/controlPlane/http/routes.d.ts.map +1 -0
- package/dist/controlPlane/http/routes.js +83 -0
- package/dist/controlPlane/http/schemas.d.ts +39 -0
- package/dist/controlPlane/http/schemas.d.ts.map +1 -0
- package/dist/controlPlane/http/schemas.js +31 -0
- package/dist/controlPlane/http/verify.d.ts +84 -0
- package/dist/controlPlane/http/verify.d.ts.map +1 -0
- package/dist/controlPlane/http/verify.js +65 -0
- package/dist/controlPlane/migrations/0001_init.d.ts +51 -0
- package/dist/controlPlane/migrations/0001_init.d.ts.map +1 -0
- package/dist/controlPlane/migrations/0001_init.js +65 -0
- package/dist/controlPlane/replay/d1Guard.d.ts +29 -0
- package/dist/controlPlane/replay/d1Guard.d.ts.map +1 -0
- package/dist/controlPlane/replay/d1Guard.js +39 -0
- package/dist/controlPlane/replay/guard.d.ts +52 -0
- package/dist/controlPlane/replay/guard.d.ts.map +1 -0
- package/dist/controlPlane/replay/guard.js +0 -0
- package/dist/controlPlane/replay/kvGuard.d.ts +99 -0
- package/dist/controlPlane/replay/kvGuard.d.ts.map +1 -0
- package/dist/controlPlane/replay/kvGuard.js +101 -0
- package/dist/controlPlane/scope/scope.d.ts +68 -0
- package/dist/controlPlane/scope/scope.d.ts.map +1 -0
- package/dist/controlPlane/scope/scope.js +63 -0
- package/dist/controlPlane/token/base64url.d.ts +10 -0
- package/dist/controlPlane/token/base64url.d.ts.map +1 -0
- package/dist/controlPlane/token/base64url.js +48 -0
- package/dist/controlPlane/token/claims.d.ts +83 -0
- package/dist/controlPlane/token/claims.d.ts.map +1 -0
- package/dist/controlPlane/token/claims.js +86 -0
- package/dist/controlPlane/token/digest.d.ts +44 -0
- package/dist/controlPlane/token/digest.d.ts.map +1 -0
- package/dist/controlPlane/token/digest.js +56 -0
- package/dist/controlPlane/token/jws.d.ts +52 -0
- package/dist/controlPlane/token/jws.d.ts.map +1 -0
- package/dist/controlPlane/token/jws.js +65 -0
- package/dist/controlPlane/token/mint.d.ts +56 -0
- package/dist/controlPlane/token/mint.d.ts.map +1 -0
- package/dist/controlPlane/token/mint.js +55 -0
- package/dist/controlPlane/wire.d.ts +122 -0
- package/dist/controlPlane/wire.d.ts.map +1 -0
- package/dist/controlPlane/wire.js +123 -0
- package/dist/createBackend.d.ts +58 -0
- package/dist/createBackend.d.ts.map +1 -0
- package/dist/createBackend.js +170 -0
- package/dist/createEntrypoint.d.ts +53 -0
- package/dist/createEntrypoint.d.ts.map +1 -0
- package/dist/createEntrypoint.js +52 -0
- package/dist/data/boundParameters.d.ts +83 -0
- package/dist/data/boundParameters.d.ts.map +1 -0
- package/dist/data/boundParameters.js +162 -0
- package/dist/data/codecs.d.ts +34 -0
- package/dist/data/codecs.d.ts.map +1 -0
- package/dist/data/codecs.js +135 -0
- package/dist/data/cursor.d.ts +81 -0
- package/dist/data/cursor.d.ts.map +1 -0
- package/dist/data/cursor.js +104 -0
- package/dist/data/databases.d.ts +55 -0
- package/dist/data/databases.d.ts.map +1 -0
- package/dist/data/databases.js +32 -0
- package/dist/data/db.d.ts +42 -0
- package/dist/data/db.d.ts.map +1 -0
- package/dist/data/db.js +24 -0
- package/dist/data/withD1Retry.d.ts +91 -0
- package/dist/data/withD1Retry.d.ts.map +1 -0
- package/dist/data/withD1Retry.js +152 -0
- package/dist/entitlement/entitlement.d.ts +118 -0
- package/dist/entitlement/entitlement.d.ts.map +1 -0
- package/dist/entitlement/entitlement.js +59 -0
- package/dist/entitlement/gateScan.d.ts +26 -0
- package/dist/entitlement/gateScan.d.ts.map +1 -0
- package/dist/entitlement/gateScan.js +96 -0
- package/dist/entitlement/require.d.ts +12 -0
- package/dist/entitlement/require.d.ts.map +1 -0
- package/dist/entitlement/require.js +123 -0
- package/dist/env/ambient.d.ts +52 -0
- package/dist/env/ambient.d.ts.map +1 -0
- package/dist/env/ambient.js +35 -0
- package/dist/env/ci.d.ts +36 -0
- package/dist/env/ci.d.ts.map +1 -0
- package/dist/env/ci.js +40 -0
- package/dist/env/stem.d.ts +23 -0
- package/dist/env/stem.d.ts.map +1 -0
- package/dist/env/stem.js +29 -0
- package/dist/error/cause.d.ts +143 -0
- package/dist/error/cause.d.ts.map +1 -0
- package/dist/error/cause.js +192 -0
- package/dist/error/client.d.ts +35 -0
- package/dist/error/client.d.ts.map +1 -0
- package/dist/error/client.js +38 -0
- package/dist/error/extend.d.ts +101 -0
- package/dist/error/extend.d.ts.map +1 -0
- package/dist/error/extend.js +76 -0
- package/dist/error/http.d.ts +1516 -0
- package/dist/error/http.d.ts.map +1 -0
- package/dist/error/http.js +72 -0
- package/dist/error/payload.d.ts +3034 -0
- package/dist/error/payload.d.ts.map +1 -0
- package/dist/error/payload.js +1110 -0
- package/dist/error/pithyError.d.ts +154 -0
- package/dist/error/pithyError.d.ts.map +1 -0
- package/dist/error/pithyError.js +197 -0
- package/dist/error/terminal.d.ts +28 -0
- package/dist/error/terminal.d.ts.map +1 -0
- package/dist/error/terminal.js +33 -0
- package/dist/http/authContext.d.ts +21 -0
- package/dist/http/authContext.d.ts.map +1 -0
- package/dist/http/authContext.js +23 -0
- package/dist/http/routeContract.d.ts +39 -0
- package/dist/http/routeContract.d.ts.map +1 -0
- package/dist/http/routeContract.js +82 -0
- package/dist/http/sameOrigin.d.ts +47 -0
- package/dist/http/sameOrigin.d.ts.map +1 -0
- package/dist/http/sameOrigin.js +24 -0
- package/dist/http/signedWebhook.d.ts +225 -0
- package/dist/http/signedWebhook.d.ts.map +1 -0
- package/dist/http/signedWebhook.js +247 -0
- package/dist/http/validation.d.ts +37 -0
- package/dist/http/validation.d.ts.map +1 -0
- package/dist/http/validation.js +14 -0
- package/dist/http/verification.d.ts +10 -0
- package/dist/http/verification.d.ts.map +1 -0
- package/dist/http/verification.js +17 -0
- package/dist/i18n/acceptLanguage.d.ts +22 -0
- package/dist/i18n/acceptLanguage.d.ts.map +1 -0
- package/dist/i18n/acceptLanguage.js +55 -0
- package/dist/i18n/catalog.d.ts +39 -0
- package/dist/i18n/catalog.d.ts.map +1 -0
- package/dist/i18n/catalog.js +57 -0
- package/dist/i18n/locale.d.ts +74 -0
- package/dist/i18n/locale.d.ts.map +1 -0
- package/dist/i18n/locale.js +109 -0
- package/dist/i18n/localeMarker.d.ts +29 -0
- package/dist/i18n/localeMarker.d.ts.map +1 -0
- package/dist/i18n/localeMarker.js +112 -0
- package/dist/i18n/match.d.ts +26 -0
- package/dist/i18n/match.d.ts.map +1 -0
- package/dist/i18n/match.js +88 -0
- package/dist/i18n/registry.d.ts +25 -0
- package/dist/i18n/registry.d.ts.map +1 -0
- package/dist/i18n/registry.js +51 -0
- package/dist/i18n/translator.d.ts +107 -0
- package/dist/i18n/translator.d.ts.map +1 -0
- package/dist/i18n/translator.js +80 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/kv/kv.d.ts +166 -0
- package/dist/kv/kv.d.ts.map +1 -0
- package/dist/kv/kv.js +261 -0
- package/dist/kv/namespaces.d.ts +58 -0
- package/dist/kv/namespaces.d.ts.map +1 -0
- package/dist/kv/namespaces.js +40 -0
- package/dist/logger/local.d.ts +41 -0
- package/dist/logger/local.d.ts.map +1 -0
- package/dist/logger/local.js +45 -0
- package/dist/logger/logger.d.ts +56 -0
- package/dist/logger/logger.d.ts.map +1 -0
- package/dist/logger/logger.js +83 -0
- package/dist/logger/record.d.ts +919 -0
- package/dist/logger/record.d.ts.map +1 -0
- package/dist/logger/record.js +79 -0
- package/dist/logger/worker.d.ts +74 -0
- package/dist/logger/worker.d.ts.map +1 -0
- package/dist/logger/worker.js +54 -0
- package/dist/migrations/batch.d.ts +10 -0
- package/dist/migrations/batch.d.ts.map +1 -0
- package/dist/migrations/batch.js +193 -0
- package/dist/migrations/bookkeeping.d.ts +24 -0
- package/dist/migrations/bookkeeping.d.ts.map +1 -0
- package/dist/migrations/bookkeeping.js +57 -0
- package/dist/migrations/owner.d.ts +41 -0
- package/dist/migrations/owner.d.ts.map +1 -0
- package/dist/migrations/owner.js +105 -0
- package/dist/migrations/registry.d.ts +36 -0
- package/dist/migrations/registry.d.ts.map +1 -0
- package/dist/migrations/registry.js +70 -0
- package/dist/migrations/runner.d.ts +67 -0
- package/dist/migrations/runner.d.ts.map +1 -0
- package/dist/migrations/runner.js +218 -0
- package/dist/naming/domains.d.ts +108 -0
- package/dist/naming/domains.d.ts.map +1 -0
- package/dist/naming/domains.js +156 -0
- package/dist/naming/environment.d.ts +118 -0
- package/dist/naming/environment.d.ts.map +1 -0
- package/dist/naming/environment.js +190 -0
- package/dist/naming/feature.d.ts +68 -0
- package/dist/naming/feature.d.ts.map +1 -0
- package/dist/naming/feature.js +106 -0
- package/dist/naming/limits.d.ts +229 -0
- package/dist/naming/limits.d.ts.map +1 -0
- package/dist/naming/limits.js +187 -0
- package/dist/naming/provisionScope.d.ts +91 -0
- package/dist/naming/provisionScope.d.ts.map +1 -0
- package/dist/naming/provisionScope.js +65 -0
- package/dist/naming/resource.d.ts +169 -0
- package/dist/naming/resource.d.ts.map +1 -0
- package/dist/naming/resource.js +220 -0
- package/dist/naming/resourceNames.d.ts +83 -0
- package/dist/naming/resourceNames.d.ts.map +1 -0
- package/dist/naming/resourceNames.js +102 -0
- package/dist/naming/segment.d.ts +29 -0
- package/dist/naming/segment.d.ts.map +1 -0
- package/dist/naming/segment.js +31 -0
- package/dist/projection/asRead.d.ts +72 -0
- package/dist/projection/asRead.d.ts.map +1 -0
- package/dist/projection/asRead.js +169 -0
- package/dist/projection/published.d.ts +95 -0
- package/dist/projection/published.d.ts.map +1 -0
- package/dist/projection/published.js +114 -0
- package/dist/schema/describedness.d.ts +55 -0
- package/dist/schema/describedness.d.ts.map +1 -0
- package/dist/schema/describedness.js +180 -0
- package/dist/seed/compose.d.ts +41 -0
- package/dist/seed/compose.d.ts.map +1 -0
- package/dist/seed/compose.js +51 -0
- package/dist/seed/devLogin.d.ts +50 -0
- package/dist/seed/devLogin.d.ts.map +1 -0
- package/dist/seed/devLogin.js +52 -0
- package/dist/seed/exampleIdentities.d.ts +58 -0
- package/dist/seed/exampleIdentities.d.ts.map +1 -0
- package/dist/seed/exampleIdentities.js +26 -0
- package/dist/seed/metadata.d.ts +20 -0
- package/dist/seed/metadata.d.ts.map +1 -0
- package/dist/seed/metadata.js +27 -0
- package/dist/seed/seed.d.ts +264 -0
- package/dist/seed/seed.d.ts.map +1 -0
- package/dist/seed/seed.js +37 -0
- package/dist/seed/seededRows.d.ts +26 -0
- package/dist/seed/seededRows.d.ts.map +1 -0
- package/dist/seed/seededRows.js +20 -0
- package/dist/seed/writeD1.d.ts +43 -0
- package/dist/seed/writeD1.d.ts.map +1 -0
- package/dist/seed/writeD1.js +73 -0
- package/dist/seed/writeKv.d.ts +29 -0
- package/dist/seed/writeKv.d.ts.map +1 -0
- package/dist/seed/writeKv.js +63 -0
- package/dist/semver/semver.d.ts +62 -0
- package/dist/semver/semver.d.ts.map +1 -0
- package/dist/semver/semver.js +137 -0
- package/dist/text/comments.d.ts +62 -0
- package/dist/text/comments.d.ts.map +1 -0
- package/dist/text/comments.js +161 -0
- package/dist/version.generated.d.ts +5 -0
- package/dist/version.generated.d.ts.map +1 -0
- package/dist/version.generated.js +7 -0
- package/dist/worker/health.d.ts +39 -0
- package/dist/worker/health.d.ts.map +1 -0
- package/dist/worker/health.js +41 -0
- package/dist/worker/identity.d.ts +191 -0
- package/dist/worker/identity.d.ts.map +1 -0
- package/dist/worker/identity.js +162 -0
- package/dist/workflow/bindings.d.ts +41 -0
- package/dist/workflow/bindings.d.ts.map +1 -0
- package/dist/workflow/bindings.js +53 -0
- package/dist/workflow/dispatch.d.ts +98 -0
- package/dist/workflow/dispatch.d.ts.map +1 -0
- package/dist/workflow/dispatch.js +148 -0
- package/dist/workflow/dispatchRoute.d.ts +80 -0
- package/dist/workflow/dispatchRoute.d.ts.map +1 -0
- package/dist/workflow/dispatchRoute.js +134 -0
- package/dist/workflow/faults.d.ts +97 -0
- package/dist/workflow/faults.d.ts.map +1 -0
- package/dist/workflow/faults.js +111 -0
- package/dist/workflow/host.d.ts +176 -0
- package/dist/workflow/host.d.ts.map +1 -0
- package/dist/workflow/host.js +116 -0
- package/dist/workflow/hostEntry.d.ts +50 -0
- package/dist/workflow/hostEntry.d.ts.map +1 -0
- package/dist/workflow/hostEntry.js +24 -0
- package/dist/workflow/hostEnv.d.ts +143 -0
- package/dist/workflow/hostEnv.d.ts.map +1 -0
- package/dist/workflow/hostEnv.js +170 -0
- package/dist/workflow/loopback.d.ts +52 -0
- package/dist/workflow/loopback.d.ts.map +1 -0
- package/dist/workflow/loopback.js +76 -0
- package/dist/workflow/naming.d.ts +79 -0
- package/dist/workflow/naming.d.ts.map +1 -0
- package/dist/workflow/naming.js +138 -0
- package/dist/workflow/register.d.ts +19 -0
- package/dist/workflow/register.d.ts.map +1 -0
- package/dist/workflow/register.js +40 -0
- package/dist/workflow/schemas.d.ts +44 -0
- package/dist/workflow/schemas.d.ts.map +1 -0
- package/dist/workflow/schemas.js +43 -0
- package/dist/workflow/spec.d.ts +81 -0
- package/dist/workflow/spec.d.ts.map +1 -0
- package/dist/workflow/spec.js +0 -0
- package/dist/workflow/stepMessage.d.ts +122 -0
- package/dist/workflow/stepMessage.d.ts.map +1 -0
- package/dist/workflow/stepMessage.js +152 -0
- package/package.json +20 -9
- package/src/capability/manifest.ts +21 -0
- package/src/version.generated.ts +1 -1
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/semver/semver.ts
|
|
3
|
+
/**
|
|
4
|
+
* Semantic versions: one parse, one format, one order.
|
|
5
|
+
*
|
|
6
|
+
* Anything that has to *rank* versions needs semver §11.4 — order a release feed, decide what sits
|
|
7
|
+
* between installed and latest, sort a prerelease against the stable it precedes. §11.4 is short and
|
|
8
|
+
* every clause of it is a trap: numeric identifiers compare numerically and alphanumerics compare
|
|
9
|
+
* lexically, a numeric identifier ranks *below* an alphanumeric one, a longer identifier set wins when
|
|
10
|
+
* every shared identifier is equal, and a stable outranks every prerelease of the same core. Each of
|
|
11
|
+
* those is one line to get wrong, and getting one wrong shows up as a feed in the wrong order rather
|
|
12
|
+
* than as an error.
|
|
13
|
+
*
|
|
14
|
+
* So it lives here once. The kit's update notifier uses it and ignores the prerelease field, which is
|
|
15
|
+
* the narrowness it wants rather than a second implementation.
|
|
16
|
+
*
|
|
17
|
+
* **The parse is a split, not a string.** A version held as one string compares as text, and text puts
|
|
18
|
+
* `1.10.0` below `1.9.0`. Split into numbers, the core comparison is three integer comparisons — and
|
|
19
|
+
* for an adopter storing versions in SQLite, three integer columns are a row-value predicate
|
|
20
|
+
* (`(major, minor, patch) > (?, ?, ?)`) that the database orders correctly on its own. SQL cannot
|
|
21
|
+
* express prerelease precedence in that predicate, so a query built that way over-selects a stable
|
|
22
|
+
* against a prerelease of the same core and {@link compareSemver} settles it in app code.
|
|
23
|
+
*/
|
|
24
|
+
/** The largest version part that survives a round trip through a number. */
|
|
25
|
+
const MAX_PART = Number.MAX_SAFE_INTEGER;
|
|
26
|
+
/**
|
|
27
|
+
* Semver's grammar, minus what carries no order. Build metadata (`+sha`) is matched so it can be
|
|
28
|
+
* discarded: the spec excludes it from precedence, so keeping it would imply an ordering it does not
|
|
29
|
+
* have. A leading `v` is tolerated because tags and changelogs carry one.
|
|
30
|
+
*/
|
|
31
|
+
const SEMVER_PATTERN = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
|
|
32
|
+
const Semver = z.object({
|
|
33
|
+
major: z.number().int().nonnegative().describe("The major version. A breaking change increments it."),
|
|
34
|
+
minor: z.number().int().nonnegative().describe("The minor version. A backwards-compatible feature increments it."),
|
|
35
|
+
patch: z.number().int().nonnegative().describe("The patch version. A backwards-compatible fix increments it."),
|
|
36
|
+
prerelease: z.string().nullable().describe("The prerelease tag without its leading hyphen (`rc.1`), or null for a stable release. Null sorts above any prerelease of the same core.")
|
|
37
|
+
}).describe("A semantic version split into its parts. Three numbers a database can compare as a row value, plus the prerelease tag that only `compareSemver` can order.");
|
|
38
|
+
/** How far behind a version is, in each place. */
|
|
39
|
+
const SemverGap = z.object({
|
|
40
|
+
major: z.number().int().nonnegative().describe("How many major versions have been published since."),
|
|
41
|
+
minor: z.number().int().nonnegative().describe("How many minor versions have accrued within the current major."),
|
|
42
|
+
patch: z.number().int().nonnegative().describe("How many patch versions have accrued within the current minor.")
|
|
43
|
+
}).describe("How far an installed version is behind the latest one, counted in version places. Three counts and nothing else, so two versions with the same core are zero apart here however their prereleases rank — that difference is precedence, and `compareSemver` is what answers it.");
|
|
44
|
+
/** Parse a version string into its parts. Returns null for anything that is not a version. */
|
|
45
|
+
function parseSemver(value) {
|
|
46
|
+
const match = SEMVER_PATTERN.exec(value.trim());
|
|
47
|
+
if (!match) return null;
|
|
48
|
+
const [, major, minor, patch, prerelease] = match;
|
|
49
|
+
const parts = [
|
|
50
|
+
Number(major),
|
|
51
|
+
Number(minor),
|
|
52
|
+
Number(patch)
|
|
53
|
+
];
|
|
54
|
+
if (parts.some((part) => part > MAX_PART)) return null;
|
|
55
|
+
return {
|
|
56
|
+
major: parts[0],
|
|
57
|
+
minor: parts[1],
|
|
58
|
+
patch: parts[2],
|
|
59
|
+
prerelease: prerelease ?? null
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/** Render a parsed version back to its canonical string. */
|
|
63
|
+
function formatSemver(version) {
|
|
64
|
+
const core = `${version.major}.${version.minor}.${version.patch}`;
|
|
65
|
+
return version.prerelease === null ? core : `${core}-${version.prerelease}`;
|
|
66
|
+
}
|
|
67
|
+
/** Compare two dot-separated prerelease identifiers, per semver §11.4. */
|
|
68
|
+
function comparePrereleaseIdentifier(a, b) {
|
|
69
|
+
const aNumeric = /^\d+$/.test(a);
|
|
70
|
+
const bNumeric = /^\d+$/.test(b);
|
|
71
|
+
if (aNumeric && bNumeric) {
|
|
72
|
+
if (a.length !== b.length) return a.length - b.length;
|
|
73
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
74
|
+
}
|
|
75
|
+
if (aNumeric) return -1;
|
|
76
|
+
if (bNumeric) return 1;
|
|
77
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
78
|
+
}
|
|
79
|
+
/** Compare two prerelease tags. A larger set of identifiers wins when every shared one is equal. */
|
|
80
|
+
function comparePrerelease(a, b) {
|
|
81
|
+
const left = a.split(".");
|
|
82
|
+
const right = b.split(".");
|
|
83
|
+
for (let i = 0; i < Math.max(left.length, right.length); i += 1) {
|
|
84
|
+
const l = left[i];
|
|
85
|
+
const r = right[i];
|
|
86
|
+
if (l === void 0) return -1;
|
|
87
|
+
if (r === void 0) return 1;
|
|
88
|
+
const ordered = comparePrereleaseIdentifier(l, r);
|
|
89
|
+
if (ordered !== 0) return ordered;
|
|
90
|
+
}
|
|
91
|
+
return 0;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Compare two versions by semver precedence. Negative when `a` precedes `b`. Suitable as an
|
|
95
|
+
* `Array.prototype.sort` comparator, so it accepts the nulls {@link parseSemver} returns — an
|
|
96
|
+
* unparseable version sorts below every real one rather than throwing mid-sort.
|
|
97
|
+
*/
|
|
98
|
+
function compareSemver(a, b) {
|
|
99
|
+
if (a === null || b === null) return a === b ? 0 : a === null ? -1 : 1;
|
|
100
|
+
if (a.major !== b.major) return a.major - b.major;
|
|
101
|
+
if (a.minor !== b.minor) return a.minor - b.minor;
|
|
102
|
+
if (a.patch !== b.patch) return a.patch - b.patch;
|
|
103
|
+
if (a.prerelease === b.prerelease) return 0;
|
|
104
|
+
if (a.prerelease === null) return 1;
|
|
105
|
+
if (b.prerelease === null) return -1;
|
|
106
|
+
return comparePrerelease(a.prerelease, b.prerelease);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* How far `installed` is behind `latest`, per place.
|
|
110
|
+
*
|
|
111
|
+
* Each place counts only what accrued while the places above it stayed put, which is what makes the
|
|
112
|
+
* number mean something: `1.2.3` against `1.6.1` is four minors and one patch behind, not four minors
|
|
113
|
+
* and *negative two* patches. Somebody running something newer than we know about is ahead, not behind,
|
|
114
|
+
* so the gap floors at zero rather than going negative.
|
|
115
|
+
*
|
|
116
|
+
* **A zero gap is not a claim of being current.** Two versions with the same core sit zero places apart
|
|
117
|
+
* whatever their prereleases say, so `1.2.3-rc.1` against `1.2.3` measures zero even though it precedes
|
|
118
|
+
* it. That is the shape being honest about its limits rather than a bug to paper over: counting places
|
|
119
|
+
* cannot express a prerelease, {@link compareSemver} is what ranks them, and inventing a phantom patch
|
|
120
|
+
* here would put a number on screen that no release actually carries.
|
|
121
|
+
*/
|
|
122
|
+
function semverGap(installed, latest) {
|
|
123
|
+
if (compareSemver(installed, latest) >= 0) return {
|
|
124
|
+
major: 0,
|
|
125
|
+
minor: 0,
|
|
126
|
+
patch: 0
|
|
127
|
+
};
|
|
128
|
+
const major = Math.max(0, latest.major - installed.major);
|
|
129
|
+
const minor = major > 0 ? latest.minor : Math.max(0, latest.minor - installed.minor);
|
|
130
|
+
return {
|
|
131
|
+
major,
|
|
132
|
+
minor,
|
|
133
|
+
patch: major > 0 || minor > 0 ? latest.patch : Math.max(0, latest.patch - installed.patch)
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
//#endregion
|
|
137
|
+
export { Semver, SemverGap, compareSemver, formatSemver, parseSemver, semverGap };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `source` with every comment blanked — the one comment stripper this repository's gates share.
|
|
3
|
+
*
|
|
4
|
+
* A tripwire that reads source has to walk past prose, because this repository's docblocks quote the
|
|
5
|
+
* very thing their gate forbids: a paragraph explaining why a config must never read `process.env`, a
|
|
6
|
+
* header naming `@cloudflare/workers-types` in a sentence. Blanking is what makes the prose invisible
|
|
7
|
+
* without making the file shorter.
|
|
8
|
+
*
|
|
9
|
+
* **Blanked rather than deleted: every character becomes a space and every newline survives**, so the
|
|
10
|
+
* line number in a failure is the line number in the file, a caller may split on `\n` and index, and a
|
|
11
|
+
* caller may slice the blanked text at an offset it measured on the original. Deleting is the cheaper
|
|
12
|
+
* thing to write and it silently joins the code either side of a block comment onto one line, which
|
|
13
|
+
* costs the position of everything below it.
|
|
14
|
+
*
|
|
15
|
+
* **It walks the source rather than matching a pattern, because the pattern has two measured false
|
|
16
|
+
* negatives.** One `replace` over a comment pattern has no notion of a string, and a string is where a
|
|
17
|
+
* comment can be forged:
|
|
18
|
+
*
|
|
19
|
+
* - `const base = "https://api.cloudflare.com";` opens a line comment at the `//` inside the URL, and
|
|
20
|
+
* everything after it on that line is blanked — a `process.env.CLOUDFLARE_API_TOKEN` read beside it,
|
|
21
|
+
* a `D1Database` beside it, whatever the caller was looking for.
|
|
22
|
+
* - `include: ["**\/*.workers.test.ts"]` opens a block comment at the `/*` inside the glob, which runs
|
|
23
|
+
* to the next `*\/` anywhere later in the file — the next docblock will do — and blanks every line
|
|
24
|
+
* between.
|
|
25
|
+
*
|
|
26
|
+
* Both were measured against planted source, and both are silent: the scan reports nothing and passes.
|
|
27
|
+
* A prohibition that a URL can switch off is worse than no prohibition, because the file it exempts
|
|
28
|
+
* looks scanned.
|
|
29
|
+
*
|
|
30
|
+
* **Strings are stepped over, not blanked.** The job is comments, and preserving a string keeps a real
|
|
31
|
+
* read inside a template — `` `${process.env.CLOUDFLARE_API_TOKEN}` `` — visible to the caller. A string
|
|
32
|
+
* that merely *contains* the text is then a false positive, which is the direction a gate should fail in.
|
|
33
|
+
*
|
|
34
|
+
* **A regex literal is stepped over too**, because `/^["']|["']$/` is a quote a string state would open
|
|
35
|
+
* on, and a runaway string swallows every line to the next quote. Told apart from division by the last
|
|
36
|
+
* significant character: a `/` where a value may begin starts a literal, and one after an operand is a
|
|
37
|
+
* divide. An unterminated string or regex stops at the newline, so a bad guess costs one line rather
|
|
38
|
+
* than the rest of the file.
|
|
39
|
+
*
|
|
40
|
+
* ## Why it lives in `@pithy-sh/core`, of all places
|
|
41
|
+
*
|
|
42
|
+
* It was written in `@pithy-sh/cli`'s `ci/sourceFiles.ts`, beside the walk its first three callers used
|
|
43
|
+
* (#437). `packages/core/src/worker-safety.test.ts` is the caller that could not follow it there:
|
|
44
|
+
* it guards which bare specifiers core's shipped source imports, it had the naive pattern, and
|
|
45
|
+
* `@pithy-sh/core` must never depend on `@pithy-sh/cli` — core is bundled into the adopter's Worker, so
|
|
46
|
+
* its dependency set is a shipped surface and the arrow runs cli → core only (#439).
|
|
47
|
+
*
|
|
48
|
+
* The alternatives were a documented copy and a drift gate over two copies. That pattern is real here —
|
|
49
|
+
* `envIsolation.workers.test.ts` restates `CLOUDFLARE_ENV_KEYS` under exactly this constraint — and it
|
|
50
|
+
* holds for two string constants, which a gate can compare for equality. Over a hundred-line walk it
|
|
51
|
+
* degrades into comparing function text, which changes on a rename and says nothing about behavior.
|
|
52
|
+
*
|
|
53
|
+
* So the third home, and core is the only package every caller already imports: the CLI, `email`,
|
|
54
|
+
* `payments` and `ui-react` all declare it, and `worker-safety.test.ts` reaches it with a relative path.
|
|
55
|
+
* The cost is honest and small. This is source-text tooling inside the package that ships into a Worker
|
|
56
|
+
* — but core has no barrel, so a module nothing imports is never reached by an adopter's bundler at all,
|
|
57
|
+
* and the price is bytes in a tarball rather than bytes in a Worker. And it earns its keep as a Worker
|
|
58
|
+
* neighbor on its own terms: **it imports nothing and touches no Node builtin**, which is the property
|
|
59
|
+
* `worker-safety.test.ts` exists to enforce, so the gate now polices the stripper it reads with.
|
|
60
|
+
*/
|
|
61
|
+
export declare function blankComments(source: string): string;
|
|
62
|
+
//# sourceMappingURL=comments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comments.d.ts","sourceRoot":"","sources":["../../src/text/comments.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAgCpD"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
//#region src/text/comments.ts
|
|
2
|
+
/**
|
|
3
|
+
* `source` with every comment blanked — the one comment stripper this repository's gates share.
|
|
4
|
+
*
|
|
5
|
+
* A tripwire that reads source has to walk past prose, because this repository's docblocks quote the
|
|
6
|
+
* very thing their gate forbids: a paragraph explaining why a config must never read `process.env`, a
|
|
7
|
+
* header naming `@cloudflare/workers-types` in a sentence. Blanking is what makes the prose invisible
|
|
8
|
+
* without making the file shorter.
|
|
9
|
+
*
|
|
10
|
+
* **Blanked rather than deleted: every character becomes a space and every newline survives**, so the
|
|
11
|
+
* line number in a failure is the line number in the file, a caller may split on `\n` and index, and a
|
|
12
|
+
* caller may slice the blanked text at an offset it measured on the original. Deleting is the cheaper
|
|
13
|
+
* thing to write and it silently joins the code either side of a block comment onto one line, which
|
|
14
|
+
* costs the position of everything below it.
|
|
15
|
+
*
|
|
16
|
+
* **It walks the source rather than matching a pattern, because the pattern has two measured false
|
|
17
|
+
* negatives.** One `replace` over a comment pattern has no notion of a string, and a string is where a
|
|
18
|
+
* comment can be forged:
|
|
19
|
+
*
|
|
20
|
+
* - `const base = "https://api.cloudflare.com";` opens a line comment at the `//` inside the URL, and
|
|
21
|
+
* everything after it on that line is blanked — a `process.env.CLOUDFLARE_API_TOKEN` read beside it,
|
|
22
|
+
* a `D1Database` beside it, whatever the caller was looking for.
|
|
23
|
+
* - `include: ["**\/*.workers.test.ts"]` opens a block comment at the `/*` inside the glob, which runs
|
|
24
|
+
* to the next `*\/` anywhere later in the file — the next docblock will do — and blanks every line
|
|
25
|
+
* between.
|
|
26
|
+
*
|
|
27
|
+
* Both were measured against planted source, and both are silent: the scan reports nothing and passes.
|
|
28
|
+
* A prohibition that a URL can switch off is worse than no prohibition, because the file it exempts
|
|
29
|
+
* looks scanned.
|
|
30
|
+
*
|
|
31
|
+
* **Strings are stepped over, not blanked.** The job is comments, and preserving a string keeps a real
|
|
32
|
+
* read inside a template — `` `${process.env.CLOUDFLARE_API_TOKEN}` `` — visible to the caller. A string
|
|
33
|
+
* that merely *contains* the text is then a false positive, which is the direction a gate should fail in.
|
|
34
|
+
*
|
|
35
|
+
* **A regex literal is stepped over too**, because `/^["']|["']$/` is a quote a string state would open
|
|
36
|
+
* on, and a runaway string swallows every line to the next quote. Told apart from division by the last
|
|
37
|
+
* significant character: a `/` where a value may begin starts a literal, and one after an operand is a
|
|
38
|
+
* divide. An unterminated string or regex stops at the newline, so a bad guess costs one line rather
|
|
39
|
+
* than the rest of the file.
|
|
40
|
+
*
|
|
41
|
+
* ## Why it lives in `@pithy-sh/core`, of all places
|
|
42
|
+
*
|
|
43
|
+
* It was written in `@pithy-sh/cli`'s `ci/sourceFiles.ts`, beside the walk its first three callers used
|
|
44
|
+
* (#437). `packages/core/src/worker-safety.test.ts` is the caller that could not follow it there:
|
|
45
|
+
* it guards which bare specifiers core's shipped source imports, it had the naive pattern, and
|
|
46
|
+
* `@pithy-sh/core` must never depend on `@pithy-sh/cli` — core is bundled into the adopter's Worker, so
|
|
47
|
+
* its dependency set is a shipped surface and the arrow runs cli → core only (#439).
|
|
48
|
+
*
|
|
49
|
+
* The alternatives were a documented copy and a drift gate over two copies. That pattern is real here —
|
|
50
|
+
* `envIsolation.workers.test.ts` restates `CLOUDFLARE_ENV_KEYS` under exactly this constraint — and it
|
|
51
|
+
* holds for two string constants, which a gate can compare for equality. Over a hundred-line walk it
|
|
52
|
+
* degrades into comparing function text, which changes on a rename and says nothing about behavior.
|
|
53
|
+
*
|
|
54
|
+
* So the third home, and core is the only package every caller already imports: the CLI, `email`,
|
|
55
|
+
* `payments` and `ui-react` all declare it, and `worker-safety.test.ts` reaches it with a relative path.
|
|
56
|
+
* The cost is honest and small. This is source-text tooling inside the package that ships into a Worker
|
|
57
|
+
* — but core has no barrel, so a module nothing imports is never reached by an adopter's bundler at all,
|
|
58
|
+
* and the price is bytes in a tarball rather than bytes in a Worker. And it earns its keep as a Worker
|
|
59
|
+
* neighbor on its own terms: **it imports nothing and touches no Node builtin**, which is the property
|
|
60
|
+
* `worker-safety.test.ts` exists to enforce, so the gate now polices the stripper it reads with.
|
|
61
|
+
*/
|
|
62
|
+
function blankComments(source) {
|
|
63
|
+
let out = "";
|
|
64
|
+
let previous = "";
|
|
65
|
+
let index = 0;
|
|
66
|
+
while (index < source.length) {
|
|
67
|
+
const char = source[index];
|
|
68
|
+
const pair = source.slice(index, index + 2);
|
|
69
|
+
if (pair === "//" || pair === "/*") {
|
|
70
|
+
const stop = endOfComment(source, index, pair);
|
|
71
|
+
out += source.slice(index, stop).replace(/[^\n]/g, " ");
|
|
72
|
+
index = stop;
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
if (char === "\"" || char === "'" || char === "`") {
|
|
76
|
+
const stop = endOfQuoted(source, index, char, char !== "`");
|
|
77
|
+
out += source.slice(index, stop);
|
|
78
|
+
index = stop;
|
|
79
|
+
previous = char;
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
if (char === "/" && VALUE_POSITION.has(previous)) {
|
|
83
|
+
const stop = endOfRegex(source, index);
|
|
84
|
+
out += source.slice(index, stop);
|
|
85
|
+
index = stop;
|
|
86
|
+
previous = "/";
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
out += char;
|
|
90
|
+
if (!/\s/.test(char)) previous = char;
|
|
91
|
+
index += 1;
|
|
92
|
+
}
|
|
93
|
+
return out;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* After one of these, a `/` opens a regex literal; after anything else it divides. The empty string is
|
|
97
|
+
* the start of the file. A wrong guess is bounded — see {@link endOfRegex}.
|
|
98
|
+
*/
|
|
99
|
+
const VALUE_POSITION = /* @__PURE__ */ new Set([
|
|
100
|
+
"",
|
|
101
|
+
"(",
|
|
102
|
+
",",
|
|
103
|
+
"=",
|
|
104
|
+
":",
|
|
105
|
+
"[",
|
|
106
|
+
"!",
|
|
107
|
+
"&",
|
|
108
|
+
"|",
|
|
109
|
+
"?",
|
|
110
|
+
"{",
|
|
111
|
+
"}",
|
|
112
|
+
";",
|
|
113
|
+
"+",
|
|
114
|
+
"-",
|
|
115
|
+
"*",
|
|
116
|
+
"%",
|
|
117
|
+
"^",
|
|
118
|
+
"~",
|
|
119
|
+
"<",
|
|
120
|
+
">"
|
|
121
|
+
]);
|
|
122
|
+
/** Where a comment ends. An unterminated block comment runs to the end of the file, as it does for tsc. */
|
|
123
|
+
function endOfComment(source, start, pair) {
|
|
124
|
+
if (pair === "//") {
|
|
125
|
+
const newline = source.indexOf("\n", start);
|
|
126
|
+
return newline === -1 ? source.length : newline;
|
|
127
|
+
}
|
|
128
|
+
const close = source.indexOf("*/", start + 2);
|
|
129
|
+
return close === -1 ? source.length : close + 2;
|
|
130
|
+
}
|
|
131
|
+
/** Where a quoted run ends: past its closing quote, or at the newline a single-line quote cannot cross. */
|
|
132
|
+
function endOfQuoted(source, start, quote, singleLine) {
|
|
133
|
+
for (let index = start + 1; index < source.length; index += 1) {
|
|
134
|
+
const char = source[index];
|
|
135
|
+
if (char === "\\") {
|
|
136
|
+
index += 1;
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
if (char === quote) return index + 1;
|
|
140
|
+
if (char === "\n" && singleLine) return index;
|
|
141
|
+
}
|
|
142
|
+
return source.length;
|
|
143
|
+
}
|
|
144
|
+
/** Where a regex literal ends. A `/` inside a character class does not close it; a newline does. */
|
|
145
|
+
function endOfRegex(source, start) {
|
|
146
|
+
let inClass = false;
|
|
147
|
+
for (let index = start + 1; index < source.length; index += 1) {
|
|
148
|
+
const char = source[index];
|
|
149
|
+
if (char === "\\") {
|
|
150
|
+
index += 1;
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
if (char === "\n") return index;
|
|
154
|
+
if (char === "[") inClass = true;
|
|
155
|
+
else if (char === "]") inClass = false;
|
|
156
|
+
else if (char === "/" && !inClass) return index + 1;
|
|
157
|
+
}
|
|
158
|
+
return source.length;
|
|
159
|
+
}
|
|
160
|
+
//#endregion
|
|
161
|
+
export { blankComments };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** This package's npm name — the join key against a release feed. */
|
|
2
|
+
export declare const PACKAGE_NAME = "@pithy-sh/core";
|
|
3
|
+
/** This package's version, stamped from its own package.json at generation time. */
|
|
4
|
+
export declare const PACKAGE_VERSION = "0.1.3";
|
|
5
|
+
//# sourceMappingURL=version.generated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.generated.d.ts","sourceRoot":"","sources":["../src/version.generated.ts"],"names":[],"mappings":"AAWA,qEAAqE;AACrE,eAAO,MAAM,YAAY,mBAAmB,CAAC;AAE7C,oFAAoF;AACpF,eAAO,MAAM,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region src/version.generated.ts
|
|
2
|
+
/** This package's npm name — the join key against a release feed. */
|
|
3
|
+
const PACKAGE_NAME = "@pithy-sh/core";
|
|
4
|
+
/** This package's version, stamped from its own package.json at generation time. */
|
|
5
|
+
const PACKAGE_VERSION = "0.1.3";
|
|
6
|
+
//#endregion
|
|
7
|
+
export { PACKAGE_NAME, PACKAGE_VERSION };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **Where every Pithy Worker answers liveness — written once, read by everyone who needs it.**
|
|
3
|
+
*
|
|
4
|
+
* `createBackend` mounts this route, the CLI's route allowlist keeps it worker-first, `pithy deploy`
|
|
5
|
+
* probes it after a release, and the bare home screen a no-auth scaffold ships fetches it. Four sites,
|
|
6
|
+
* one path, and until #400 each of them wrote it out.
|
|
7
|
+
*
|
|
8
|
+
* The failure that earned this module is the quietest one in the front end. `home.bare.tsx` is the
|
|
9
|
+
* **only** screen a project with no auth composed gets, and its entire content is that one request. A
|
|
10
|
+
* rename here without a matching edit there renders *"The worker says: unknown."* — a 200, no error, no
|
|
11
|
+
* failed build, nothing in a log. The adopter's first screen showing a word that is not a status, for a
|
|
12
|
+
* reason nowhere on the page.
|
|
13
|
+
*
|
|
14
|
+
* A gate comparing the copies would have watched that. This removes it instead: the template imports
|
|
15
|
+
* the constant, so a rename moves the screen with it, and there is no second string left to disagree
|
|
16
|
+
* with. `docs/CONVENTIONS.md` § *Seeded files* is the general form — **removing the class beats
|
|
17
|
+
* watching it** — and #377, #366, #393 and #394 are the same move made earlier.
|
|
18
|
+
*
|
|
19
|
+
* ## Why a module of its own
|
|
20
|
+
*
|
|
21
|
+
* Because a client bundle imports it. Everything else in `@pithy-sh/core` that a route path could sit
|
|
22
|
+
* beside pulls Hono, the Workers types, or both, and the scaffolded SPA is a browser program that must
|
|
23
|
+
* import neither. This file declares one string and imports nothing, so the seeded screen can read it
|
|
24
|
+
* without dragging a server runtime into the client's program.
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* `GET /health` — public, and deliberately so.
|
|
28
|
+
*
|
|
29
|
+
* It reads nothing about the caller, so there is no session to send it. That is what makes it the one
|
|
30
|
+
* request the bare home screen can make with no auth capability in the project, and why
|
|
31
|
+
* `sameOrigin.test.ts` exempts that screen's `fetch` rather than routing it through a credentialed
|
|
32
|
+
* primitive.
|
|
33
|
+
*
|
|
34
|
+
* The leading slash is part of the value. Hono mounts it, `firstSegment` splits it, and `verifyDeploy`
|
|
35
|
+
* appends it to a declared origin — all three want the same string, and a bare `health` would make two
|
|
36
|
+
* of them concatenate wrongly in silence.
|
|
37
|
+
*/
|
|
38
|
+
export declare const HEALTH_PATH = "/health";
|
|
39
|
+
//# sourceMappingURL=health.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/worker/health.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,WAAW,YAAY,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//#region src/worker/health.ts
|
|
2
|
+
/**
|
|
3
|
+
* **Where every Pithy Worker answers liveness — written once, read by everyone who needs it.**
|
|
4
|
+
*
|
|
5
|
+
* `createBackend` mounts this route, the CLI's route allowlist keeps it worker-first, `pithy deploy`
|
|
6
|
+
* probes it after a release, and the bare home screen a no-auth scaffold ships fetches it. Four sites,
|
|
7
|
+
* one path, and until #400 each of them wrote it out.
|
|
8
|
+
*
|
|
9
|
+
* The failure that earned this module is the quietest one in the front end. `home.bare.tsx` is the
|
|
10
|
+
* **only** screen a project with no auth composed gets, and its entire content is that one request. A
|
|
11
|
+
* rename here without a matching edit there renders *"The worker says: unknown."* — a 200, no error, no
|
|
12
|
+
* failed build, nothing in a log. The adopter's first screen showing a word that is not a status, for a
|
|
13
|
+
* reason nowhere on the page.
|
|
14
|
+
*
|
|
15
|
+
* A gate comparing the copies would have watched that. This removes it instead: the template imports
|
|
16
|
+
* the constant, so a rename moves the screen with it, and there is no second string left to disagree
|
|
17
|
+
* with. `docs/CONVENTIONS.md` § *Seeded files* is the general form — **removing the class beats
|
|
18
|
+
* watching it** — and #377, #366, #393 and #394 are the same move made earlier.
|
|
19
|
+
*
|
|
20
|
+
* ## Why a module of its own
|
|
21
|
+
*
|
|
22
|
+
* Because a client bundle imports it. Everything else in `@pithy-sh/core` that a route path could sit
|
|
23
|
+
* beside pulls Hono, the Workers types, or both, and the scaffolded SPA is a browser program that must
|
|
24
|
+
* import neither. This file declares one string and imports nothing, so the seeded screen can read it
|
|
25
|
+
* without dragging a server runtime into the client's program.
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* `GET /health` — public, and deliberately so.
|
|
29
|
+
*
|
|
30
|
+
* It reads nothing about the caller, so there is no session to send it. That is what makes it the one
|
|
31
|
+
* request the bare home screen can make with no auth capability in the project, and why
|
|
32
|
+
* `sameOrigin.test.ts` exempts that screen's `fetch` rather than routing it through a credentialed
|
|
33
|
+
* primitive.
|
|
34
|
+
*
|
|
35
|
+
* The leading slash is part of the value. Hono mounts it, `firstSegment` splits it, and `verifyDeploy`
|
|
36
|
+
* appends it to a declared origin — all three want the same string, and a bare `health` would make two
|
|
37
|
+
* of them concatenate wrongly in silence.
|
|
38
|
+
*/
|
|
39
|
+
const HEALTH_PATH = "/health";
|
|
40
|
+
//#endregion
|
|
41
|
+
export { HEALTH_PATH };
|