@spacefast/common 0.0.2
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 +42 -0
- package/dist/brand.d.ts +15 -0
- package/dist/brand.js +24 -0
- package/dist/config/domains.d.ts +30 -0
- package/dist/config/domains.js +75 -0
- package/dist/config/index.d.ts +1 -0
- package/dist/config/index.js +3 -0
- package/dist/contracts/abuse.d.ts +93 -0
- package/dist/contracts/abuse.js +50 -0
- package/dist/contracts/access.d.ts +409 -0
- package/dist/contracts/access.js +396 -0
- package/dist/contracts/account.d.ts +28 -0
- package/dist/contracts/account.js +54 -0
- package/dist/contracts/activity.d.ts +118 -0
- package/dist/contracts/activity.js +180 -0
- package/dist/contracts/analytics.d.ts +56 -0
- package/dist/contracts/analytics.js +91 -0
- package/dist/contracts/annotations.d.ts +327 -0
- package/dist/contracts/annotations.js +234 -0
- package/dist/contracts/api-keys.d.ts +517 -0
- package/dist/contracts/api-keys.js +235 -0
- package/dist/contracts/archives.d.ts +332 -0
- package/dist/contracts/archives.js +120 -0
- package/dist/contracts/auth.d.ts +86 -0
- package/dist/contracts/auth.js +82 -0
- package/dist/contracts/beta.d.ts +106 -0
- package/dist/contracts/beta.js +104 -0
- package/dist/contracts/billing.d.ts +328 -0
- package/dist/contracts/billing.js +203 -0
- package/dist/contracts/builds.d.ts +504 -0
- package/dist/contracts/builds.js +248 -0
- package/dist/contracts/channels.d.ts +49 -0
- package/dist/contracts/channels.js +51 -0
- package/dist/contracts/common.d.ts +238 -0
- package/dist/contracts/common.js +175 -0
- package/dist/contracts/deployments.d.ts +574 -0
- package/dist/contracts/deployments.js +97 -0
- package/dist/contracts/device-auth.d.ts +194 -0
- package/dist/contracts/device-auth.js +162 -0
- package/dist/contracts/domains.d.ts +6115 -0
- package/dist/contracts/domains.js +1435 -0
- package/dist/contracts/enums.d.ts +196 -0
- package/dist/contracts/enums.js +211 -0
- package/dist/contracts/error-code-meta.d.ts +1560 -0
- package/dist/contracts/error-code-meta.js +400 -0
- package/dist/contracts/error-codes.d.ts +13 -0
- package/dist/contracts/error-codes.js +416 -0
- package/dist/contracts/events.d.ts +398 -0
- package/dist/contracts/events.js +320 -0
- package/dist/contracts/fast-domain-search.d.ts +19 -0
- package/dist/contracts/fast-domain-search.js +22 -0
- package/dist/contracts/features.d.ts +240 -0
- package/dist/contracts/features.js +406 -0
- package/dist/contracts/git.d.ts +288 -0
- package/dist/contracts/git.js +116 -0
- package/dist/contracts/ids.d.ts +35 -0
- package/dist/contracts/ids.js +45 -0
- package/dist/contracts/intercom.d.ts +6 -0
- package/dist/contracts/intercom.js +5 -0
- package/dist/contracts/internal.d.ts +103 -0
- package/dist/contracts/internal.js +92 -0
- package/dist/contracts/mcp.d.ts +788 -0
- package/dist/contracts/mcp.js +161 -0
- package/dist/contracts/me.d.ts +81 -0
- package/dist/contracts/me.js +104 -0
- package/dist/contracts/oauth-resources.d.ts +30 -0
- package/dist/contracts/oauth-resources.js +61 -0
- package/dist/contracts/operations.d.ts +54 -0
- package/dist/contracts/operations.js +14 -0
- package/dist/contracts/plan-policy.d.ts +85 -0
- package/dist/contracts/plan-policy.js +75 -0
- package/dist/contracts/platform.d.ts +359 -0
- package/dist/contracts/platform.js +216 -0
- package/dist/contracts/push-new.d.ts +156 -0
- package/dist/contracts/push-new.js +52 -0
- package/dist/contracts/quotas.d.ts +16 -0
- package/dist/contracts/quotas.js +36 -0
- package/dist/contracts/repository-connections.d.ts +231 -0
- package/dist/contracts/repository-connections.js +106 -0
- package/dist/contracts/resources.d.ts +529 -0
- package/dist/contracts/resources.js +209 -0
- package/dist/contracts/routes.d.ts +45 -0
- package/dist/contracts/routes.js +31 -0
- package/dist/contracts/runtime-api.d.ts +449 -0
- package/dist/contracts/runtime-api.js +513 -0
- package/dist/contracts/sites.d.ts +393 -0
- package/dist/contracts/sites.js +121 -0
- package/dist/contracts/slugs.d.ts +31 -0
- package/dist/contracts/slugs.js +47 -0
- package/dist/contracts/space-config.d.ts +216 -0
- package/dist/contracts/space-config.js +237 -0
- package/dist/contracts/space-theme.d.ts +25 -0
- package/dist/contracts/space-theme.js +49 -0
- package/dist/contracts/spaces.d.ts +2760 -0
- package/dist/contracts/spaces.js +589 -0
- package/dist/contracts/superadmin-activity.d.ts +205 -0
- package/dist/contracts/superadmin-activity.js +107 -0
- package/dist/contracts/superadmin-emails.d.ts +212 -0
- package/dist/contracts/superadmin-emails.js +112 -0
- package/dist/contracts/superadmin-queues.d.ts +414 -0
- package/dist/contracts/superadmin-queues.js +202 -0
- package/dist/contracts/superadmin-runtime.d.ts +27 -0
- package/dist/contracts/superadmin-runtime.js +38 -0
- package/dist/contracts/superadmin-spaces.d.ts +429 -0
- package/dist/contracts/superadmin-spaces.js +82 -0
- package/dist/contracts/superadmin-tenants.d.ts +180 -0
- package/dist/contracts/superadmin-tenants.js +117 -0
- package/dist/contracts/superadmin.d.ts +654 -0
- package/dist/contracts/superadmin.js +309 -0
- package/dist/contracts/tags.d.ts +1140 -0
- package/dist/contracts/tags.js +1050 -0
- package/dist/contracts/teams.d.ts +233 -0
- package/dist/contracts/teams.js +174 -0
- package/dist/contracts/telemetry.d.ts +2 -0
- package/dist/contracts/telemetry.js +1 -0
- package/dist/contracts/transfers.d.ts +105 -0
- package/dist/contracts/transfers.js +48 -0
- package/dist/contracts/variables.d.ts +189 -0
- package/dist/contracts/variables.js +82 -0
- package/dist/contracts/webhooks.d.ts +159 -0
- package/dist/contracts/webhooks.js +59 -0
- package/dist/contracts/zero.d.ts +1538 -0
- package/dist/contracts/zero.js +755 -0
- package/dist/docs/agent-prose.d.ts +35 -0
- package/dist/docs/agent-prose.js +153 -0
- package/dist/docs/agent-setup.d.ts +6 -0
- package/dist/docs/agent-setup.js +164 -0
- package/dist/docs/agent-solutions.d.ts +110 -0
- package/dist/docs/agent-solutions.js +181 -0
- package/dist/docs/error-docs.d.ts +12 -0
- package/dist/docs/error-docs.js +1601 -0
- package/dist/docs/skill-distribution.d.ts +12 -0
- package/dist/docs/skill-distribution.js +18 -0
- package/dist/domain-exploration.d.ts +108 -0
- package/dist/domain-exploration.js +488 -0
- package/dist/domain-normalize.d.ts +1 -0
- package/dist/domain-normalize.js +14 -0
- package/dist/domain-zones.d.ts +1 -0
- package/dist/domain-zones.js +5272 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/utils/access-policy.d.ts +39 -0
- package/dist/utils/access-policy.js +232 -0
- package/dist/utils/api.d.ts +4 -0
- package/dist/utils/api.js +13 -0
- package/dist/utils/auth-redirect.d.ts +1 -0
- package/dist/utils/auth-redirect.js +48 -0
- package/dist/utils/auth.d.ts +5 -0
- package/dist/utils/auth.js +13 -0
- package/dist/utils/build-settings.d.ts +49 -0
- package/dist/utils/build-settings.js +366 -0
- package/dist/utils/claim-token.d.ts +1 -0
- package/dist/utils/claim-token.js +9 -0
- package/dist/utils/collections.d.ts +1 -0
- package/dist/utils/collections.js +5 -0
- package/dist/utils/concurrency.d.ts +1 -0
- package/dist/utils/concurrency.js +18 -0
- package/dist/utils/content-type.d.ts +10 -0
- package/dist/utils/content-type.js +145 -0
- package/dist/utils/error-display.d.ts +7 -0
- package/dist/utils/error-display.js +42 -0
- package/dist/utils/error.d.ts +1 -0
- package/dist/utils/error.js +3 -0
- package/dist/utils/generate-space-name.d.ts +14 -0
- package/dist/utils/generate-space-name.js +95 -0
- package/dist/utils/git-repository.d.ts +5 -0
- package/dist/utils/git-repository.js +99 -0
- package/dist/utils/guards.d.ts +1 -0
- package/dist/utils/guards.js +3 -0
- package/dist/utils/publish-detection.d.ts +10 -0
- package/dist/utils/publish-detection.js +118 -0
- package/dist/utils/publish-policy.d.ts +69 -0
- package/dist/utils/publish-policy.js +429 -0
- package/dist/utils/query-client.d.ts +7 -0
- package/dist/utils/query-client.js +21 -0
- package/dist/utils/query-keys.d.ts +75 -0
- package/dist/utils/query-keys.js +78 -0
- package/dist/utils/runtime-paths.d.ts +7 -0
- package/dist/utils/runtime-paths.js +28 -0
- package/dist/utils/runtime-upload.d.ts +19 -0
- package/dist/utils/runtime-upload.js +27 -0
- package/dist/utils/slug.d.ts +5 -0
- package/dist/utils/slug.js +13 -0
- package/dist/utils/space-config.d.ts +75 -0
- package/dist/utils/space-config.js +415 -0
- package/dist/utils/space-theme.d.ts +16 -0
- package/dist/utils/space-theme.js +89 -0
- package/dist/utils/static-runtime-policy.d.ts +17 -0
- package/dist/utils/static-runtime-policy.js +103 -0
- package/dist/utils/upload-session.d.ts +34 -0
- package/dist/utils/upload-session.js +69 -0
- package/dist/utils/urls.d.ts +2 -0
- package/dist/utils/urls.js +7 -0
- package/dist/utils/version-path.d.ts +6 -0
- package/dist/utils/version-path.js +51 -0
- package/dist/utils/wpcom-auth-redirects.d.ts +14 -0
- package/dist/utils/wpcom-auth-redirects.js +49 -0
- package/dist/utils/zero-realtime-signature.d.ts +12 -0
- package/dist/utils/zero-realtime-signature.js +45 -0
- package/dist/vocabulary.d.ts +230 -0
- package/dist/vocabulary.js +218 -0
- package/package.json +58 -0
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# `@spacefast/common`
|
|
2
|
+
|
|
3
|
+
Shared TypeScript contracts and utilities used by Spacefast first-party packages.
|
|
4
|
+
|
|
5
|
+
Most users should install the CLI or framework integrations instead:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
curl -fsSL https://spacefast.com/install.sh | bash
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Use this package directly only when you are building against Spacefast contracts or
|
|
12
|
+
need the same validation helpers used by the CLI and dashboard.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @spacefast/common
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Exports
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { spacePatchSchema } from "@spacefast/common/contracts/spaces";
|
|
24
|
+
import { detectSpaFromPaths } from "@spacefast/common/utils/publish-detection";
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The public exports are grouped by concern:
|
|
28
|
+
|
|
29
|
+
- `@spacefast/common/contracts/*` for shared API and CLI schemas.
|
|
30
|
+
- `@spacefast/common/utils/*` for small helpers used across Spacefast packages.
|
|
31
|
+
- `@spacefast/common/docs/*` for agent-facing setup text used by Spacefast surfaces.
|
|
32
|
+
|
|
33
|
+
This package is public so the Spacefast CLI and plugins can install cleanly from
|
|
34
|
+
npm. It is still an implementation package: prefer documented CLI and API
|
|
35
|
+
surfaces unless you need these exact contracts.
|
|
36
|
+
|
|
37
|
+
## Documentation
|
|
38
|
+
|
|
39
|
+
- [Spacefast docs](https://spacefast.com/docs)
|
|
40
|
+
- [CLI docs](https://spacefast.com/docs/cli)
|
|
41
|
+
- [API docs](https://spacefast.com/docs/api)
|
|
42
|
+
- [LLM guide](https://spacefast.com/llms.txt)
|
package/dist/brand.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const BRAND: {
|
|
2
|
+
/** Consumer product name shown on every user surface. */
|
|
3
|
+
readonly productName: "Spacefast";
|
|
4
|
+
/** Public website/docs origin (`/docs`, `/llms.txt`, install script). */
|
|
5
|
+
readonly websiteOrigin: string;
|
|
6
|
+
/** Origin agents should fetch for the canonical `/ai` setup instructions. */
|
|
7
|
+
readonly agentSetupOrigin: string;
|
|
8
|
+
/** Canonical public API origin (generated SDK/OpenAPI server, `/skill`). */
|
|
9
|
+
readonly apiOrigin: string;
|
|
10
|
+
/** Apex for default space hostnames: `{hostLabel}.<apex>` (OPEN apex decision). */
|
|
11
|
+
readonly spaceHostnameApex: "view.fast";
|
|
12
|
+
/** Apex for internal management hostnames: `{siteId}.<apex>` (OPEN apex decision). */
|
|
13
|
+
readonly managementHostnameApex: "view.fast";
|
|
14
|
+
};
|
|
15
|
+
export declare const ERROR_DOCS_BASE_URL: `${string}/docs/errors`;
|
package/dist/brand.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// The single home for brand strings. Hostnames are NOT hardcoded here: they
|
|
2
|
+
// derive from the canonical domain registry (`./config/domains`) so the whole
|
|
3
|
+
// rename to spacefast.com is a one-file edit. Consumer surfaces never hardcode
|
|
4
|
+
// these values; they import from here (and `domains` underneath).
|
|
5
|
+
import { serviceOrigin } from "./config/domains.js";
|
|
6
|
+
import { MANAGEMENT_HOSTNAME_APEX, SPACE_HOSTNAME_APEX } from "./config/domains.js";
|
|
7
|
+
export const BRAND = {
|
|
8
|
+
/** Consumer product name shown on every user surface. */
|
|
9
|
+
productName: "Spacefast",
|
|
10
|
+
/** Public website/docs origin (`/docs`, `/llms.txt`, install script). */
|
|
11
|
+
websiteOrigin: serviceOrigin("www", "prod"),
|
|
12
|
+
/** Origin agents should fetch for the canonical `/ai` setup instructions. */
|
|
13
|
+
agentSetupOrigin: serviceOrigin("www", "prod"),
|
|
14
|
+
/** Canonical public API origin (generated SDK/OpenAPI server, `/skill`). */
|
|
15
|
+
apiOrigin: serviceOrigin("api", "prod"),
|
|
16
|
+
/** Apex for default space hostnames: `{hostLabel}.<apex>` (OPEN apex decision). */
|
|
17
|
+
spaceHostnameApex: SPACE_HOSTNAME_APEX,
|
|
18
|
+
/** Apex for internal management hostnames: `{siteId}.<apex>` (OPEN apex decision). */
|
|
19
|
+
managementHostnameApex: MANAGEMENT_HOSTNAME_APEX,
|
|
20
|
+
};
|
|
21
|
+
// Mechanical error-docs derivation base (contract decision locked by the build
|
|
22
|
+
// plan: `${websiteOrigin}/docs/errors/{code}` forever). Lives next to the
|
|
23
|
+
// brand origin it derives from; `error-codes.ts` consumes it.
|
|
24
|
+
export const ERROR_DOCS_BASE_URL = `${BRAND.websiteOrigin}/docs/errors`;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Deployment environment a URL is being built for. */
|
|
2
|
+
export type DeployEnv = "dev" | "test" | "prod";
|
|
3
|
+
/** Logical services that each get their own host. */
|
|
4
|
+
export type Service = "www" | "api" | "dashboard" | "superadmin" | "cast" | "mcp" | "fieldguide";
|
|
5
|
+
export type EnvDomains = {
|
|
6
|
+
/** Apex/base origin for the marketing site (the `www` service + bare apex). */
|
|
7
|
+
readonly apex: string;
|
|
8
|
+
/** Cookie domain that scopes auth across every subdomain of this env. */
|
|
9
|
+
readonly cookieDomain: string;
|
|
10
|
+
/** Scheme used to build origins. SSL everywhere — even local (via portless). */
|
|
11
|
+
readonly protocol: "http" | "https";
|
|
12
|
+
/** Fully-qualified hostname per service. */
|
|
13
|
+
readonly hosts: Readonly<Record<Service, string>>;
|
|
14
|
+
};
|
|
15
|
+
/** The full domain map for an environment. */
|
|
16
|
+
export declare function domainsFor(env: DeployEnv): EnvDomains;
|
|
17
|
+
/** Origin (scheme + host, no trailing slash) for a service in an environment. */
|
|
18
|
+
export declare function serviceOrigin(service: Service, env: DeployEnv): string;
|
|
19
|
+
/** Cookie domain that scopes auth across all subdomains of an environment. */
|
|
20
|
+
export declare function cookieDomainFor(env: DeployEnv): string;
|
|
21
|
+
/** Domain Search Terminal (Fly.io); its web redirects to spacefast.com/domains. */
|
|
22
|
+
export declare const FAST_DOMAIN_SEARCH_APEX: "fastdomainsearch.com";
|
|
23
|
+
/** Atomic infrastructure apex used for public managed/custom domains. */
|
|
24
|
+
export declare const VIEW_FAST_APEX: "view.fast";
|
|
25
|
+
/** Apex for default space hostnames: `{hostLabel}.view.fast`. */
|
|
26
|
+
export declare const SPACE_HOSTNAME_APEX: "view.fast";
|
|
27
|
+
/** Apex for internal management hostnames: `wpc-manage-{siteId}.view.fast`. */
|
|
28
|
+
export declare const MANAGEMENT_HOSTNAME_APEX: "view.fast";
|
|
29
|
+
/** Reserved first-label prefix for the management namespace; users may not register it. */
|
|
30
|
+
export declare const MANAGEMENT_LABEL_PREFIX: "wpc-manage-";
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// THE single source of truth for Spacefast hostnames and per-service origins,
|
|
2
|
+
// across every environment. Brand strings, app URL builders, CORS allowlists,
|
|
3
|
+
// cookie scope, and redirect rules all derive from here so a domain change is a
|
|
4
|
+
// one-file edit instead of the ~100-site sweep this migration had to untangle.
|
|
5
|
+
//
|
|
6
|
+
// Env-var NAMES intentionally stay `SPACEFAST_*` (see migration plan); only the
|
|
7
|
+
// VALUES they carry are produced from this registry.
|
|
8
|
+
const PROD = {
|
|
9
|
+
apex: "spacefast.com",
|
|
10
|
+
cookieDomain: ".spacefast.com",
|
|
11
|
+
protocol: "https",
|
|
12
|
+
hosts: {
|
|
13
|
+
www: "spacefast.com",
|
|
14
|
+
api: "api.spacefast.com",
|
|
15
|
+
dashboard: "my.spacefast.com",
|
|
16
|
+
superadmin: "superadmin.spacefast.com",
|
|
17
|
+
cast: "cast.spacefast.com",
|
|
18
|
+
mcp: "mcp.spacefast.com",
|
|
19
|
+
fieldguide: "fieldguide.view.fast",
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
// Local dev runs every service under *.sf.localhost via portless (HTTPS, no
|
|
23
|
+
// ports in the URL — portless proxies the raw dev ports). `remove all other
|
|
24
|
+
// portless records` per the migration spec: sf.localhost is the only TLD.
|
|
25
|
+
const DEV = {
|
|
26
|
+
apex: "sf.localhost",
|
|
27
|
+
cookieDomain: ".sf.localhost",
|
|
28
|
+
protocol: "https",
|
|
29
|
+
hosts: {
|
|
30
|
+
www: "www.sf.localhost",
|
|
31
|
+
api: "api.sf.localhost",
|
|
32
|
+
dashboard: "my.sf.localhost",
|
|
33
|
+
superadmin: "superadmin.sf.localhost",
|
|
34
|
+
cast: "cast.sf.localhost",
|
|
35
|
+
mcp: "mcp.sf.localhost",
|
|
36
|
+
fieldguide: "fieldguide.sf.localhost",
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
// The test stack shares the sf.localhost hostname scheme but runs as its own
|
|
40
|
+
// isolated compose project on its own ports/resources (see ports config), so it
|
|
41
|
+
// can run side-by-side with dev. URL host scheme is identical to dev.
|
|
42
|
+
const TEST = DEV;
|
|
43
|
+
const BY_ENV = {
|
|
44
|
+
dev: DEV,
|
|
45
|
+
test: TEST,
|
|
46
|
+
prod: PROD,
|
|
47
|
+
};
|
|
48
|
+
/** The full domain map for an environment. */
|
|
49
|
+
export function domainsFor(env) {
|
|
50
|
+
return BY_ENV[env];
|
|
51
|
+
}
|
|
52
|
+
/** Origin (scheme + host, no trailing slash) for a service in an environment. */
|
|
53
|
+
export function serviceOrigin(service, env) {
|
|
54
|
+
const d = BY_ENV[env];
|
|
55
|
+
return `${d.protocol}://${d.hosts[service]}`;
|
|
56
|
+
}
|
|
57
|
+
/** Cookie domain that scopes auth across all subdomains of an environment. */
|
|
58
|
+
export function cookieDomainFor(env) {
|
|
59
|
+
return BY_ENV[env].cookieDomain;
|
|
60
|
+
}
|
|
61
|
+
// --- Apexes that are NOT spacefast.com subdomains -------------------------------
|
|
62
|
+
// These live outside the per-env map because they are stable infra identities.
|
|
63
|
+
/** Domain Search Terminal (Fly.io); its web redirects to spacefast.com/domains. */
|
|
64
|
+
export const FAST_DOMAIN_SEARCH_APEX = "fastdomainsearch.com";
|
|
65
|
+
/** Atomic infrastructure apex used for public managed/custom domains. */
|
|
66
|
+
export const VIEW_FAST_APEX = "view.fast";
|
|
67
|
+
// D-4 resolved 2026-06-26: default space hostnames are
|
|
68
|
+
// `{hostLabel}.view.fast`; internal management hostnames share the same apex
|
|
69
|
+
// under the reserved `wpc-manage-` label prefix and are never public space URLs.
|
|
70
|
+
/** Apex for default space hostnames: `{hostLabel}.view.fast`. */
|
|
71
|
+
export const SPACE_HOSTNAME_APEX = VIEW_FAST_APEX;
|
|
72
|
+
/** Apex for internal management hostnames: `wpc-manage-{siteId}.view.fast`. */
|
|
73
|
+
export const MANAGEMENT_HOSTNAME_APEX = VIEW_FAST_APEX;
|
|
74
|
+
/** Reserved first-label prefix for the management namespace; users may not register it. */
|
|
75
|
+
export const MANAGEMENT_LABEL_PREFIX = "wpc-manage-";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./domains.js";
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const abuseReportCategorySchema: z.ZodEnum<{
|
|
3
|
+
malware: "malware";
|
|
4
|
+
phishing: "phishing";
|
|
5
|
+
spam: "spam";
|
|
6
|
+
copyright: "copyright";
|
|
7
|
+
illegal_content: "illegal_content";
|
|
8
|
+
other: "other";
|
|
9
|
+
}>;
|
|
10
|
+
export declare const abuseReportCreateSchema: z.ZodObject<{
|
|
11
|
+
url: z.ZodString;
|
|
12
|
+
category: z.ZodEnum<{
|
|
13
|
+
malware: "malware";
|
|
14
|
+
phishing: "phishing";
|
|
15
|
+
spam: "spam";
|
|
16
|
+
copyright: "copyright";
|
|
17
|
+
illegal_content: "illegal_content";
|
|
18
|
+
other: "other";
|
|
19
|
+
}>;
|
|
20
|
+
description: z.ZodString;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
export declare const abuseReportStatusSchema: z.ZodEnum<{
|
|
23
|
+
new: "new";
|
|
24
|
+
reviewing: "reviewing";
|
|
25
|
+
actioned: "actioned";
|
|
26
|
+
closed: "closed";
|
|
27
|
+
}>;
|
|
28
|
+
export type AbuseReportStatus = z.infer<typeof abuseReportStatusSchema>;
|
|
29
|
+
export declare const ABUSE_REPORT_STATUS_TRANSITIONS: Record<AbuseReportStatus, readonly AbuseReportStatus[]>;
|
|
30
|
+
export declare const abuseReportSchema: z.ZodObject<{
|
|
31
|
+
id: z.ZodString;
|
|
32
|
+
status: z.ZodEnum<{
|
|
33
|
+
new: "new";
|
|
34
|
+
reviewing: "reviewing";
|
|
35
|
+
actioned: "actioned";
|
|
36
|
+
closed: "closed";
|
|
37
|
+
}>;
|
|
38
|
+
category: z.ZodEnum<{
|
|
39
|
+
malware: "malware";
|
|
40
|
+
phishing: "phishing";
|
|
41
|
+
spam: "spam";
|
|
42
|
+
copyright: "copyright";
|
|
43
|
+
illegal_content: "illegal_content";
|
|
44
|
+
other: "other";
|
|
45
|
+
}>;
|
|
46
|
+
url: z.ZodString;
|
|
47
|
+
spaceId: z.ZodNullable<z.ZodString>;
|
|
48
|
+
createdAt: z.ZodString;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
export declare const superadminAbuseReportSchema: z.ZodObject<{
|
|
51
|
+
id: z.ZodString;
|
|
52
|
+
status: z.ZodEnum<{
|
|
53
|
+
new: "new";
|
|
54
|
+
reviewing: "reviewing";
|
|
55
|
+
actioned: "actioned";
|
|
56
|
+
closed: "closed";
|
|
57
|
+
}>;
|
|
58
|
+
category: z.ZodEnum<{
|
|
59
|
+
malware: "malware";
|
|
60
|
+
phishing: "phishing";
|
|
61
|
+
spam: "spam";
|
|
62
|
+
copyright: "copyright";
|
|
63
|
+
illegal_content: "illegal_content";
|
|
64
|
+
other: "other";
|
|
65
|
+
}>;
|
|
66
|
+
url: z.ZodString;
|
|
67
|
+
spaceId: z.ZodNullable<z.ZodString>;
|
|
68
|
+
createdAt: z.ZodString;
|
|
69
|
+
hostname: z.ZodString;
|
|
70
|
+
tenantId: z.ZodNullable<z.ZodString>;
|
|
71
|
+
description: z.ZodString;
|
|
72
|
+
updatedAt: z.ZodString;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
export declare const superadminAbuseReportListQuerySchema: z.ZodObject<{
|
|
75
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
76
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
77
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
78
|
+
new: "new";
|
|
79
|
+
reviewing: "reviewing";
|
|
80
|
+
actioned: "actioned";
|
|
81
|
+
closed: "closed";
|
|
82
|
+
}>>;
|
|
83
|
+
}, z.core.$strip>;
|
|
84
|
+
export declare const superadminAbuseReportPatchSchema: z.ZodObject<{
|
|
85
|
+
status: z.ZodEnum<{
|
|
86
|
+
new: "new";
|
|
87
|
+
reviewing: "reviewing";
|
|
88
|
+
actioned: "actioned";
|
|
89
|
+
closed: "closed";
|
|
90
|
+
}>;
|
|
91
|
+
}, z.core.$strip>;
|
|
92
|
+
export type AbuseReport = z.infer<typeof abuseReportSchema>;
|
|
93
|
+
export type SuperadminAbuseReport = z.infer<typeof superadminAbuseReportSchema>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { cursorListQuerySchema } from "./common.js";
|
|
3
|
+
export const abuseReportCategorySchema = z
|
|
4
|
+
.enum(["malware", "phishing", "spam", "copyright", "illegal_content", "other"])
|
|
5
|
+
.describe("Reported abuse category.");
|
|
6
|
+
export const abuseReportCreateSchema = z.object({
|
|
7
|
+
url: z.string().url().describe("Full URL of the content being reported."),
|
|
8
|
+
category: abuseReportCategorySchema,
|
|
9
|
+
description: z
|
|
10
|
+
.string()
|
|
11
|
+
.trim()
|
|
12
|
+
.min(10)
|
|
13
|
+
.max(5000)
|
|
14
|
+
.describe("What the reporter saw; 10-5000 characters."),
|
|
15
|
+
});
|
|
16
|
+
export const abuseReportStatusSchema = z
|
|
17
|
+
.enum(["new", "reviewing", "actioned", "closed"])
|
|
18
|
+
.describe("Triage status of the report.");
|
|
19
|
+
// Triage state machine: reports move forward through review; `closed` reports
|
|
20
|
+
// can be reopened into `reviewing` (and only there) when new evidence lands.
|
|
21
|
+
export const ABUSE_REPORT_STATUS_TRANSITIONS = {
|
|
22
|
+
new: ["reviewing", "actioned", "closed"],
|
|
23
|
+
reviewing: ["actioned", "closed"],
|
|
24
|
+
actioned: ["closed"],
|
|
25
|
+
closed: ["reviewing"],
|
|
26
|
+
};
|
|
27
|
+
export const abuseReportSchema = z.object({
|
|
28
|
+
id: z.string().describe("Abuse report id."),
|
|
29
|
+
status: abuseReportStatusSchema,
|
|
30
|
+
category: abuseReportCategorySchema,
|
|
31
|
+
url: z.string().describe("Reported URL."),
|
|
32
|
+
spaceId: z
|
|
33
|
+
.string()
|
|
34
|
+
.nullable()
|
|
35
|
+
.describe("Space the reported hostname resolved to, when it could be resolved."),
|
|
36
|
+
createdAt: z.string().datetime().describe("When the report was filed."),
|
|
37
|
+
});
|
|
38
|
+
// Operator triage view: includes intake details the public receipt omits.
|
|
39
|
+
export const superadminAbuseReportSchema = abuseReportSchema.extend({
|
|
40
|
+
hostname: z.string().describe("Normalized hostname extracted from the reported URL."),
|
|
41
|
+
tenantId: z.string().nullable().describe("Tenant owning the resolved space, when resolved."),
|
|
42
|
+
description: z.string().describe("Reporter-supplied description."),
|
|
43
|
+
updatedAt: z.string().datetime().describe("Last triage update."),
|
|
44
|
+
});
|
|
45
|
+
export const superadminAbuseReportListQuerySchema = cursorListQuerySchema.extend({
|
|
46
|
+
status: abuseReportStatusSchema.optional().describe("Filter the triage list by status."),
|
|
47
|
+
});
|
|
48
|
+
export const superadminAbuseReportPatchSchema = z.object({
|
|
49
|
+
status: abuseReportStatusSchema.describe("New triage status; must be a valid transition from the current status."),
|
|
50
|
+
});
|