@camox/api-contract 0.58.0 → 0.59.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/dist/drafts.d.ts CHANGED
@@ -25,21 +25,9 @@ export declare const PUBLISHING_DRAFT_VAR = "CAMOX_PUBLISHING_DRAFT";
25
25
  * exist yet. Its value is `"1"`.
26
26
  */
27
27
  export declare const DRAFT_CREATE_HEADER = "x-camox-draft-create";
28
- /**
29
- * The `x-camox-draft` value naming the caller's own development draft in the project a request
30
- * acts on (ADR 0006, ADR 0011). Dev mode and the CLI always send it.
31
- */
32
- export declare const DEVELOPMENT_DRAFT = "development";
33
- /**
34
- * oRPC error code for a request naming the development draft before dev mode created it: the
35
- * first dev-mode sync after login does, so the site has to run locally once first.
36
- */
37
- export declare const NO_DEVELOPMENT_DRAFT_ERROR = "NO_DEVELOPMENT_DRAFT";
38
28
  /** URL search param carrying the current draft's id in the studio and the rendered site. */
39
29
  export declare const DRAFT_SEARCH_PARAM = "camox-draft";
40
- /** A regular draft is a named set of edits; a development draft backs a dev server. */
41
- export type DraftKind = "regular" | "development";
42
- /** How a regular draft ended. */
30
+ /** How a draft ended. */
43
31
  export type DraftOutcome = "published" | "deleted";
44
32
  /** Who ended a draft, how and when, from its ended-drafts record (ADR 0009, ADR 0011). */
45
33
  export type EndedDraft = {
package/dist/drafts.js CHANGED
@@ -25,16 +25,6 @@ const PUBLISHING_DRAFT_VAR = "CAMOX_PUBLISHING_DRAFT";
25
25
  * exist yet. Its value is `"1"`.
26
26
  */
27
27
  const DRAFT_CREATE_HEADER = "x-camox-draft-create";
28
- /**
29
- * The `x-camox-draft` value naming the caller's own development draft in the project a request
30
- * acts on (ADR 0006, ADR 0011). Dev mode and the CLI always send it.
31
- */
32
- const DEVELOPMENT_DRAFT = "development";
33
- /**
34
- * oRPC error code for a request naming the development draft before dev mode created it: the
35
- * first dev-mode sync after login does, so the site has to run locally once first.
36
- */
37
- const NO_DEVELOPMENT_DRAFT_ERROR = "NO_DEVELOPMENT_DRAFT";
38
28
  /** URL search param carrying the current draft's id in the studio and the rendered site. */
39
29
  const DRAFT_SEARCH_PARAM = "camox-draft";
40
30
  /**
@@ -179,4 +169,4 @@ function isContentWrite(path) {
179
169
  }
180
170
 
181
171
  //#endregion
182
- export { CAMOX_ACTOR, CAMOX_NAME, CONFLICTS_CHANGED_ERROR, DEVELOPMENT_DRAFT, DRAFT_CREATE_HEADER, DRAFT_ENDED_ERROR_CODE, DRAFT_HEADER, DRAFT_SEARCH_PARAM, LIVE_READ_ONLY_ERROR, LOCALE_HEADER, NOT_PUBLISHED_CODES, NO_DEVELOPMENT_DRAFT_ERROR, PUBLISHING_DRAFT_HEADER, PUBLISHING_DRAFT_VAR, PUBLISH_ABORT_REASONS, PUBLISH_BLOCKED_ERROR, REVISION_CHANGED_ERROR, TRANSLATIONS_PENDING_ERROR, isContentWrite };
172
+ export { CAMOX_ACTOR, CAMOX_NAME, CONFLICTS_CHANGED_ERROR, DRAFT_CREATE_HEADER, DRAFT_ENDED_ERROR_CODE, DRAFT_HEADER, DRAFT_SEARCH_PARAM, LIVE_READ_ONLY_ERROR, LOCALE_HEADER, NOT_PUBLISHED_CODES, PUBLISHING_DRAFT_HEADER, PUBLISHING_DRAFT_VAR, PUBLISH_ABORT_REASONS, PUBLISH_BLOCKED_ERROR, REVISION_CHANGED_ERROR, TRANSLATIONS_PENDING_ERROR, isContentWrite };
@@ -10,8 +10,14 @@ export declare const RESERVED_PROJECT_SLUGS: ReadonlySet<string>;
10
10
  * made of letters, digits and inner hyphens.
11
11
  */
12
12
  export declare const projectSlugSchema: z.ZodString;
13
- /** The address a project's website is served at: its Project Slug's `camox.site` subdomain. */
14
- export declare const projectWebsiteUrl: (slug: string) => string;
13
+ /**
14
+ * The address a project's website is served at: its Custom Domain when it has one, else its
15
+ * Project Slug's `camox.site` subdomain, which then redirects to it (ADR 0028).
16
+ */
17
+ export declare const projectWebsiteUrl: (project: {
18
+ slug: string;
19
+ customDomain: string | null;
20
+ }) => string;
15
21
  /** Why a slug can't be given to a new project. */
16
22
  export type UnavailableSlugReason = "invalid" | "reserved" | "taken";
17
23
  /** What a member is told when a slug can't be used, by reason. */
package/dist/projects.js CHANGED
@@ -34,8 +34,11 @@ const RESERVED_PROJECT_SLUGS = /* @__PURE__ */ new Set([
34
34
  * made of letters, digits and inner hyphens.
35
35
  */
36
36
  const projectSlugSchema = /* @__PURE__ */ z.string().min(1, "Enter a slug").max(63, "Use at most 63 characters").regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, "Use lowercase letters, digits and hyphens, without a hyphen at either end");
37
- /** The address a project's website is served at: its Project Slug's `camox.site` subdomain. */
38
- const projectWebsiteUrl = (slug) => `https://${slug}.camox.site`;
37
+ /**
38
+ * The address a project's website is served at: its Custom Domain when it has one, else its
39
+ * Project Slug's `camox.site` subdomain, which then redirects to it (ADR 0028).
40
+ */
41
+ const projectWebsiteUrl = (project) => `https://${project.customDomain ?? `${project.slug}.camox.site`}`;
39
42
  /** What a member is told when a slug can't be used, by reason. */
40
43
  const UNAVAILABLE_SLUG_MESSAGES = {
41
44
  invalid: "Use lowercase letters, digits and hyphens, without a hyphen at either end.",