@storyshelf/core 0.9.0-next-d2cc082 → 0.9.0-next-c3504b0
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/capture/db-queue/index.mjs +1 -1
- package/dist/models/design-health.d.mts +9 -1
- package/dist/models/design-health.mjs +13 -1
- package/dist/models/design-health.mjs.map +1 -1
- package/dist/models.d.mts +2 -2
- package/dist/models.mjs +2 -2
- package/dist/urls.d.mts +4 -2
- package/dist/urls.mjs +2 -1
- package/dist/urls.mjs.map +1 -1
- package/package.json +3 -3
|
@@ -24,7 +24,7 @@ import { hostname } from "node:os";
|
|
|
24
24
|
/** What the database queue reports about itself; hosts show it before the queue is built. */
|
|
25
25
|
const DATABASE_QUEUE_METADATA = {
|
|
26
26
|
name: "Database Queue",
|
|
27
|
-
version: "0.9.0-next-
|
|
27
|
+
version: "0.9.0-next-c3504b0",
|
|
28
28
|
description: "Capture queue on the app database (capture_jobs)",
|
|
29
29
|
kind: "database",
|
|
30
30
|
category: "capture-queue"
|
|
@@ -5,6 +5,14 @@ import { DesignNode } from "../schema/design.mjs";
|
|
|
5
5
|
declare const DESIGN_TTL_MS: number;
|
|
6
6
|
/** True when the design changed after the baseline it is compared with was approved. */
|
|
7
7
|
declare function isDesignStale(node: Pick<DesignNode, "state" | "lastModified"> | null | undefined, baselineVersion: string | null | undefined): boolean;
|
|
8
|
+
/** Where a linked design stands against its component's approved baseline. */
|
|
9
|
+
type DesignDrift = "deleted" | "stale" | "current" | "unknown";
|
|
10
|
+
/**
|
|
11
|
+
* Classify a cached design node: `deleted` (the node no longer exists), `stale` (changed after the
|
|
12
|
+
* baseline was approved), `current`, or `unknown` (nothing cached, the provider refused, there is no baseline
|
|
13
|
+
* or either timestamp is unreadable, so the state cannot be told). Reads only what was stored; never calls a provider.
|
|
14
|
+
*/
|
|
15
|
+
declare function designDrift(node: Pick<DesignNode, "state" | "lastModified"> | null | undefined, baselineVersion: string | null | undefined): DesignDrift;
|
|
8
16
|
/** What happened to a design after its baseline was approved. */
|
|
9
17
|
type DesignChangeKind = "modified-after-approval" | "deleted";
|
|
10
18
|
/** A design change to tell people about, with the identity it is de-duplicated on. */
|
|
@@ -25,5 +33,5 @@ declare function designChange(node: Pick<DesignNode, "state" | "version" | "last
|
|
|
25
33
|
* past). `issuedAt` is when the credential was set or replaced — never a status write.
|
|
26
34
|
*/
|
|
27
35
|
declare function credentialDaysLeft(issuedAt: string, maxAgeDays: number, now?: Date): number;
|
|
28
|
-
export { DESIGN_TTL_MS, DesignChange, DesignChangeKind, credentialDaysLeft, designChange, isDesignStale };
|
|
36
|
+
export { DESIGN_TTL_MS, DesignChange, DesignChangeKind, DesignDrift, credentialDaysLeft, designChange, designDrift, isDesignStale };
|
|
29
37
|
//# sourceMappingURL=design-health.d.mts.map
|
|
@@ -12,6 +12,18 @@ function isDesignStale(node, baselineVersion) {
|
|
|
12
12
|
return Number.isFinite(modified) && Number.isFinite(approved) && modified > approved;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
+
* Classify a cached design node: `deleted` (the node no longer exists), `stale` (changed after the
|
|
16
|
+
* baseline was approved), `current`, or `unknown` (nothing cached, the provider refused, there is no baseline
|
|
17
|
+
* or either timestamp is unreadable, so the state cannot be told). Reads only what was stored; never calls a provider.
|
|
18
|
+
*/
|
|
19
|
+
function designDrift(node, baselineVersion) {
|
|
20
|
+
if (node?.state === "deleted") return "deleted";
|
|
21
|
+
if (isDesignStale(node, baselineVersion)) return "stale";
|
|
22
|
+
const modified = node?.lastModified ? Date.parse(node.lastModified) : NaN;
|
|
23
|
+
const approved = baselineVersion ? Date.parse(baselineVersion) : NaN;
|
|
24
|
+
return node?.state === "ok" && Number.isFinite(modified) && Number.isFinite(approved) ? "current" : "unknown";
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
15
27
|
* The change worth a `design:changed` notification, or null. A deleted node always counts; a
|
|
16
28
|
* modified one only when it moved after `baselineVersion` (see {@link isDesignStale}).
|
|
17
29
|
*/
|
|
@@ -38,6 +50,6 @@ function credentialDaysLeft(issuedAt, maxAgeDays, now = /* @__PURE__ */ new Date
|
|
|
38
50
|
const ageDays = (now.getTime() - Date.parse(issuedAt)) / 864e5;
|
|
39
51
|
return Math.ceil(maxAgeDays - ageDays);
|
|
40
52
|
}
|
|
41
|
-
export { DESIGN_TTL_MS, credentialDaysLeft, designChange, isDesignStale };
|
|
53
|
+
export { DESIGN_TTL_MS, credentialDaysLeft, designChange, designDrift, isDesignStale };
|
|
42
54
|
|
|
43
55
|
//# sourceMappingURL=design-health.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"design-health.mjs","names":[],"sources":["../../src/models/design-health.ts"],"sourcesContent":["/** Design cache freshness, staleness and credential-age rules (provider-neutral). */\nimport type { DesignNode } from \"../schema/design.ts\";\n\n/** Cached metadata younger than this is served without a refetch. */\nexport const DESIGN_TTL_MS = 15 * 60_000;\n\n/** True when the design changed after the baseline it is compared with was approved. */\nexport function isDesignStale(\n node: Pick<DesignNode, \"state\" | \"lastModified\"> | null | undefined,\n baselineVersion: string | null | undefined,\n): boolean {\n if (node?.state !== \"ok\" || !node.lastModified || !baselineVersion) return false;\n const modified = Date.parse(node.lastModified);\n const approved = Date.parse(baselineVersion);\n return Number.isFinite(modified) && Number.isFinite(approved) && modified > approved;\n}\n\n/** What happened to a design after its baseline was approved. */\nexport type DesignChangeKind = \"modified-after-approval\" | \"deleted\";\n\n/** A design change to tell people about, with the identity it is de-duplicated on. */\nexport interface DesignChange {\n change: DesignChangeKind;\n /** `<change>:<version>`: one notification per design version and kind of change. */\n key: string;\n /** The design's version when it changed (a deleted node keeps its last known one). */\n designVersion: string | null;\n}\n\n/**\n * The change worth a `design:changed` notification, or null. A deleted node always counts; a\n * modified one only when it moved after `baselineVersion` (see {@link isDesignStale}).\n */\nexport function designChange(\n node: Pick<DesignNode, \"state\" | \"version\" | \"lastModified\"> | null | undefined,\n baselineVersion: string | null | undefined,\n): DesignChange | null {\n if (!node) return null;\n const designVersion = node.version ?? node.lastModified;\n if (node.state === \"deleted\") {\n return { change: \"deleted\", key: `deleted:${designVersion ?? \"\"}`, designVersion };\n }\n if (!isDesignStale(node, baselineVersion)) return null;\n return {\n change: \"modified-after-approval\",\n key: `modified-after-approval:${designVersion ?? \"\"}`,\n designVersion,\n };\n}\n\n/**\n * Days until a credential passes its provider's maximum lifetime (negative once\n * past). `issuedAt` is when the credential was set or replaced — never a status write.\n */\nexport function credentialDaysLeft(\n issuedAt: string,\n maxAgeDays: number,\n now: Date = new Date(),\n): number {\n const ageDays = (now.getTime() - Date.parse(issuedAt)) / 86_400_000;\n return Math.ceil(maxAgeDays - ageDays);\n}\n"],"mappings":";;;;;AAIA,MAAa,gBAAgB;;AAG7B,SAAgB,cACd,MACA,iBACS;CACT,IAAI,MAAM,UAAU,QAAQ,CAAC,KAAK,gBAAgB,CAAC,iBAAiB,OAAO;CAC3E,MAAM,WAAW,KAAK,MAAM,KAAK,YAAY;CAC7C,MAAM,WAAW,KAAK,MAAM,eAAe;CAC3C,OAAO,OAAO,SAAS,QAAQ,KAAK,OAAO,SAAS,QAAQ,KAAK,WAAW;AAC9E;;;;;AAkBA,SAAgB,aACd,MACA,iBACqB;CACrB,IAAI,CAAC,MAAM,OAAO;CAClB,MAAM,gBAAgB,KAAK,WAAW,KAAK;CAC3C,IAAI,KAAK,UAAU,WACjB,OAAO;EAAE,QAAQ;EAAW,KAAK,WAAW,iBAAiB;EAAM;CAAc;CAEnF,IAAI,CAAC,cAAc,MAAM,eAAe,GAAG,OAAO;CAClD,OAAO;EACL,QAAQ;EACR,KAAK,2BAA2B,iBAAiB;EACjD;CACF;AACF;;;;;AAMA,SAAgB,mBACd,UACA,YACA,sBAAY,IAAI,KAAK,GACb;CACR,MAAM,WAAW,IAAI,QAAQ,IAAI,KAAK,MAAM,QAAQ,KAAK;CACzD,OAAO,KAAK,KAAK,aAAa,OAAO;AACvC"}
|
|
1
|
+
{"version":3,"file":"design-health.mjs","names":[],"sources":["../../src/models/design-health.ts"],"sourcesContent":["/** Design cache freshness, staleness and credential-age rules (provider-neutral). */\nimport type { DesignNode } from \"../schema/design.ts\";\n\n/** Cached metadata younger than this is served without a refetch. */\nexport const DESIGN_TTL_MS = 15 * 60_000;\n\n/** True when the design changed after the baseline it is compared with was approved. */\nexport function isDesignStale(\n node: Pick<DesignNode, \"state\" | \"lastModified\"> | null | undefined,\n baselineVersion: string | null | undefined,\n): boolean {\n if (node?.state !== \"ok\" || !node.lastModified || !baselineVersion) return false;\n const modified = Date.parse(node.lastModified);\n const approved = Date.parse(baselineVersion);\n return Number.isFinite(modified) && Number.isFinite(approved) && modified > approved;\n}\n\n/** Where a linked design stands against its component's approved baseline. */\nexport type DesignDrift = \"deleted\" | \"stale\" | \"current\" | \"unknown\";\n\n/**\n * Classify a cached design node: `deleted` (the node no longer exists), `stale` (changed after the\n * baseline was approved), `current`, or `unknown` (nothing cached, the provider refused, there is no baseline\n * or either timestamp is unreadable, so the state cannot be told). Reads only what was stored; never calls a provider.\n */\nexport function designDrift(\n node: Pick<DesignNode, \"state\" | \"lastModified\"> | null | undefined,\n baselineVersion: string | null | undefined,\n): DesignDrift {\n if (node?.state === \"deleted\") return \"deleted\";\n if (isDesignStale(node, baselineVersion)) return \"stale\";\n const modified = node?.lastModified ? Date.parse(node.lastModified) : Number.NaN;\n const approved = baselineVersion ? Date.parse(baselineVersion) : Number.NaN;\n return node?.state === \"ok\" && Number.isFinite(modified) && Number.isFinite(approved)\n ? \"current\"\n : \"unknown\";\n}\n\n/** What happened to a design after its baseline was approved. */\nexport type DesignChangeKind = \"modified-after-approval\" | \"deleted\";\n\n/** A design change to tell people about, with the identity it is de-duplicated on. */\nexport interface DesignChange {\n change: DesignChangeKind;\n /** `<change>:<version>`: one notification per design version and kind of change. */\n key: string;\n /** The design's version when it changed (a deleted node keeps its last known one). */\n designVersion: string | null;\n}\n\n/**\n * The change worth a `design:changed` notification, or null. A deleted node always counts; a\n * modified one only when it moved after `baselineVersion` (see {@link isDesignStale}).\n */\nexport function designChange(\n node: Pick<DesignNode, \"state\" | \"version\" | \"lastModified\"> | null | undefined,\n baselineVersion: string | null | undefined,\n): DesignChange | null {\n if (!node) return null;\n const designVersion = node.version ?? node.lastModified;\n if (node.state === \"deleted\") {\n return { change: \"deleted\", key: `deleted:${designVersion ?? \"\"}`, designVersion };\n }\n if (!isDesignStale(node, baselineVersion)) return null;\n return {\n change: \"modified-after-approval\",\n key: `modified-after-approval:${designVersion ?? \"\"}`,\n designVersion,\n };\n}\n\n/**\n * Days until a credential passes its provider's maximum lifetime (negative once\n * past). `issuedAt` is when the credential was set or replaced — never a status write.\n */\nexport function credentialDaysLeft(\n issuedAt: string,\n maxAgeDays: number,\n now: Date = new Date(),\n): number {\n const ageDays = (now.getTime() - Date.parse(issuedAt)) / 86_400_000;\n return Math.ceil(maxAgeDays - ageDays);\n}\n"],"mappings":";;;;;AAIA,MAAa,gBAAgB;;AAG7B,SAAgB,cACd,MACA,iBACS;CACT,IAAI,MAAM,UAAU,QAAQ,CAAC,KAAK,gBAAgB,CAAC,iBAAiB,OAAO;CAC3E,MAAM,WAAW,KAAK,MAAM,KAAK,YAAY;CAC7C,MAAM,WAAW,KAAK,MAAM,eAAe;CAC3C,OAAO,OAAO,SAAS,QAAQ,KAAK,OAAO,SAAS,QAAQ,KAAK,WAAW;AAC9E;;;;;;AAUA,SAAgB,YACd,MACA,iBACa;CACb,IAAI,MAAM,UAAU,WAAW,OAAO;CACtC,IAAI,cAAc,MAAM,eAAe,GAAG,OAAO;CACjD,MAAM,WAAW,MAAM,eAAe,KAAK,MAAM,KAAK,YAAY,IAAI;CACtE,MAAM,WAAW,kBAAkB,KAAK,MAAM,eAAe,IAAI;CACjE,OAAO,MAAM,UAAU,QAAQ,OAAO,SAAS,QAAQ,KAAK,OAAO,SAAS,QAAQ,IAChF,YACA;AACN;;;;;AAkBA,SAAgB,aACd,MACA,iBACqB;CACrB,IAAI,CAAC,MAAM,OAAO;CAClB,MAAM,gBAAgB,KAAK,WAAW,KAAK;CAC3C,IAAI,KAAK,UAAU,WACjB,OAAO;EAAE,QAAQ;EAAW,KAAK,WAAW,iBAAiB;EAAM;CAAc;CAEnF,IAAI,CAAC,cAAc,MAAM,eAAe,GAAG,OAAO;CAClD,OAAO;EACL,QAAQ;EACR,KAAK,2BAA2B,iBAAiB;EACjD;CACF;AACF;;;;;AAMA,SAAgB,mBACd,UACA,YACA,sBAAY,IAAI,KAAK,GACb;CACR,MAAM,WAAW,IAAI,QAAQ,IAAI,KAAK,MAAM,QAAQ,KAAK;CACzD,OAAO,KAAK,KAAK,aAAa,OAAO;AACvC"}
|
package/dist/models.d.mts
CHANGED
|
@@ -31,7 +31,7 @@ import { ConnectionModel, ConnectionTables } from "./models/connections.mjs";
|
|
|
31
31
|
import { DesignModel, DesignTables } from "./models/design.mjs";
|
|
32
32
|
import { DesignCredentialStatus, DesignResolution, DesignSource, normalizeImportPath, resolveDesigns } from "./models/design-resolve.mjs";
|
|
33
33
|
import { DesignCredentialModel, DesignCredentialTables, PROJECT_SCOPE } from "./models/design-credentials.mjs";
|
|
34
|
-
import { DESIGN_TTL_MS, DesignChange, DesignChangeKind, credentialDaysLeft, designChange, isDesignStale } from "./models/design-health.mjs";
|
|
34
|
+
import { DESIGN_TTL_MS, DesignChange, DesignChangeKind, DesignDrift, credentialDaysLeft, designChange, designDrift, isDesignStale } from "./models/design-health.mjs";
|
|
35
35
|
import { DesignNodeModel, DesignNodeTables, RefreshOptions } from "./models/design-nodes.mjs";
|
|
36
36
|
import { LabelModel } from "./models/label.mjs";
|
|
37
37
|
import { PackageUsageInput, PackageUsageModel, PackageUsageTables, UpstreamStory, matchUpstreamStory } from "./models/usage.mjs";
|
|
@@ -45,4 +45,4 @@ import { ContentRefModel } from "./models/content-ref.mjs";
|
|
|
45
45
|
import { CredentialProbe, ReencryptResult, UnreadableCredential, probeCredentials, reencryptCredentials } from "./models/credentials.mjs";
|
|
46
46
|
import { SiteSettingsModel, SiteSettingsTables } from "./models/site-settings.mjs";
|
|
47
47
|
import { PUBLIC_ORIGIN_KEY, PublicOriginOptions, PublicOriginResolver, PublicOriginSource, ResolvedPublicOrigin, StoredPublicOrigin, createPublicOriginResolver } from "./models/public-origin.mjs";
|
|
48
|
-
export { AiBudgetAlertModel, type AiBudgetAlertTables, type AiUsageInput, AiUsageModel, type AiUsageTables, type AttemptClaim, type AttemptLogRecorder, BASELINE_ARCHIVE_FORMAT, BASELINE_ARCHIVE_LIMITS, BASELINE_ARCHIVE_VERSION, BaselineApprovalConflict, BaselineArchiveError, type BaselineExportOptions, type BaselineImportResult, type BaselineManifest, type BaselineManifestEntry, BaselineModel, type BaselineOriginReader, type BaselineStatus, BaselineTransferModel, BaselineWriteConflict, type BuildChangeset, type BuildComponentInput, BuildComponentModel, type BuildComponentTables, type BuildCreateInput, type BuildListFilter, BuildModel, BuildReviewModel, type BuildReviewTables, CaptureAttemptModel, type CaptureAttemptTables, CaptureJobModel, type CaptureJobTables, CaptureLogModel, type CaptureLogTables, CaptureShardModel, type CaptureShardTables, type ChangedComponent, type Changeset, type ChangesetComponent, type ChannelValidation, type CommentCreateInput, CommentModel, type ComponentHistoryRow, type ComponentPresence, ConnectionModel, type ConnectionTables, ContentRefModel, type CredentialProbe, DESIGN_TTL_MS, type DesignChange, type DesignChangeKind, DesignCredentialModel, type DesignCredentialStatus, type DesignCredentialTables, DesignModel, DesignNodeModel, type DesignNodeTables, type DesignResolution, type DesignSource, type DesignTables, type InheritedRatio, InsightModel, type InsightResultInput, type InsightStartInput, type InsightStartResult, type InsightTables, LabelModel, MemberModel, NO_BASELINE, type NewCaptureJob, type NotificationChannelCreateInput, NotificationChannelModel, type NotificationChannelTables, type NotificationSubscriptionInput, NotificationSubscriptionModel, type NotificationSubscriptionTables, PROJECT_SCOPE, PUBLIC_ORIGIN_KEY, type PackageUsageInput, PackageUsageModel, type PackageUsageTables, type ProjectCreateInput, ProjectGroupMappingModel, ProjectModel, type PublicOriginOptions, type PublicOriginResolver, type PublicOriginSource, RECENT_BUILDS_FOR_INHERITED_RATIO, type ReencryptResult, type RefreshOptions, type ResolvedPublicOrigin, type ReviewStatusInput, SiteSettingsModel, type SiteSettingsTables, type SnapshotCreateInput, SnapshotModel, type StoredPublicOrigin, TERMINAL_JOB_STATUSES, TokenModel, type UnreadableCredential, type UpstreamStory, UserModel, type WebhookCreateInput, WebhookModel, acceptPendingWithoutWork, attemptRowId, averageInheritedRatio, baselineStatus, changesetOf, componentHistory, componentPresence, computeChangeset, createPublicOriginResolver, credentialDaysLeft, deriveReviewStatus, designChange, emitAttemptLog, findChangesetBaseline, isBaselineDrifted, isDesignStale, isPublicBuild, isTerminalJob, latestVerdicts, matchUpstreamStory, normalizeImportPath, parseAttemptRowId, probeCredentials, reencryptCredentials, resolveBaselineOrigin, resolveDesigns, worstStatus };
|
|
48
|
+
export { AiBudgetAlertModel, type AiBudgetAlertTables, type AiUsageInput, AiUsageModel, type AiUsageTables, type AttemptClaim, type AttemptLogRecorder, BASELINE_ARCHIVE_FORMAT, BASELINE_ARCHIVE_LIMITS, BASELINE_ARCHIVE_VERSION, BaselineApprovalConflict, BaselineArchiveError, type BaselineExportOptions, type BaselineImportResult, type BaselineManifest, type BaselineManifestEntry, BaselineModel, type BaselineOriginReader, type BaselineStatus, BaselineTransferModel, BaselineWriteConflict, type BuildChangeset, type BuildComponentInput, BuildComponentModel, type BuildComponentTables, type BuildCreateInput, type BuildListFilter, BuildModel, BuildReviewModel, type BuildReviewTables, CaptureAttemptModel, type CaptureAttemptTables, CaptureJobModel, type CaptureJobTables, CaptureLogModel, type CaptureLogTables, CaptureShardModel, type CaptureShardTables, type ChangedComponent, type Changeset, type ChangesetComponent, type ChannelValidation, type CommentCreateInput, CommentModel, type ComponentHistoryRow, type ComponentPresence, ConnectionModel, type ConnectionTables, ContentRefModel, type CredentialProbe, DESIGN_TTL_MS, type DesignChange, type DesignChangeKind, DesignCredentialModel, type DesignCredentialStatus, type DesignCredentialTables, type DesignDrift, DesignModel, DesignNodeModel, type DesignNodeTables, type DesignResolution, type DesignSource, type DesignTables, type InheritedRatio, InsightModel, type InsightResultInput, type InsightStartInput, type InsightStartResult, type InsightTables, LabelModel, MemberModel, NO_BASELINE, type NewCaptureJob, type NotificationChannelCreateInput, NotificationChannelModel, type NotificationChannelTables, type NotificationSubscriptionInput, NotificationSubscriptionModel, type NotificationSubscriptionTables, PROJECT_SCOPE, PUBLIC_ORIGIN_KEY, type PackageUsageInput, PackageUsageModel, type PackageUsageTables, type ProjectCreateInput, ProjectGroupMappingModel, ProjectModel, type PublicOriginOptions, type PublicOriginResolver, type PublicOriginSource, RECENT_BUILDS_FOR_INHERITED_RATIO, type ReencryptResult, type RefreshOptions, type ResolvedPublicOrigin, type ReviewStatusInput, SiteSettingsModel, type SiteSettingsTables, type SnapshotCreateInput, SnapshotModel, type StoredPublicOrigin, TERMINAL_JOB_STATUSES, TokenModel, type UnreadableCredential, type UpstreamStory, UserModel, type WebhookCreateInput, WebhookModel, acceptPendingWithoutWork, attemptRowId, averageInheritedRatio, baselineStatus, changesetOf, componentHistory, componentPresence, computeChangeset, createPublicOriginResolver, credentialDaysLeft, deriveReviewStatus, designChange, designDrift, emitAttemptLog, findChangesetBaseline, isBaselineDrifted, isDesignStale, isPublicBuild, isTerminalJob, latestVerdicts, matchUpstreamStory, normalizeImportPath, parseAttemptRowId, probeCredentials, reencryptCredentials, resolveBaselineOrigin, resolveDesigns, worstStatus };
|
package/dist/models.mjs
CHANGED
|
@@ -34,7 +34,7 @@ import { componentHistory, componentPresence, worstStatus } from "./models/compo
|
|
|
34
34
|
import { ConnectionModel } from "./models/connections.mjs";
|
|
35
35
|
import { DesignModel } from "./models/design.mjs";
|
|
36
36
|
import { DesignCredentialModel, PROJECT_SCOPE } from "./models/design-credentials.mjs";
|
|
37
|
-
import { DESIGN_TTL_MS, credentialDaysLeft, designChange, isDesignStale } from "./models/design-health.mjs";
|
|
37
|
+
import { DESIGN_TTL_MS, credentialDaysLeft, designChange, designDrift, isDesignStale } from "./models/design-health.mjs";
|
|
38
38
|
import { DesignNodeModel } from "./models/design-nodes.mjs";
|
|
39
39
|
import { LabelModel } from "./models/label.mjs";
|
|
40
40
|
import { PackageUsageModel, matchUpstreamStory } from "./models/usage.mjs";
|
|
@@ -45,4 +45,4 @@ import { TokenModel } from "./models/token.mjs";
|
|
|
45
45
|
import { UserModel } from "./models/user.mjs";
|
|
46
46
|
import { ContentRefModel } from "./models/content-ref.mjs";
|
|
47
47
|
import { probeCredentials, reencryptCredentials } from "./models/credentials.mjs";
|
|
48
|
-
export { AiBudgetAlertModel, AiUsageModel, BASELINE_ARCHIVE_FORMAT, BASELINE_ARCHIVE_LIMITS, BASELINE_ARCHIVE_VERSION, BaselineApprovalConflict, BaselineArchiveError, BaselineModel, BaselineTransferModel, BaselineWriteConflict, BuildComponentModel, BuildModel, BuildReviewModel, CaptureAttemptModel, CaptureJobModel, CaptureLogModel, CaptureShardModel, CommentModel, ConnectionModel, ContentRefModel, DESIGN_TTL_MS, DesignCredentialModel, DesignModel, DesignNodeModel, InsightModel, LabelModel, MemberModel, NO_BASELINE, NotificationChannelModel, NotificationSubscriptionModel, PROJECT_SCOPE, PUBLIC_ORIGIN_KEY, PackageUsageModel, ProjectGroupMappingModel, ProjectModel, RECENT_BUILDS_FOR_INHERITED_RATIO, SiteSettingsModel, SnapshotModel, TERMINAL_JOB_STATUSES, TokenModel, UserModel, WebhookModel, acceptPendingWithoutWork, attemptRowId, averageInheritedRatio, baselineStatus, changesetOf, componentHistory, componentPresence, computeChangeset, createPublicOriginResolver, credentialDaysLeft, deriveReviewStatus, designChange, emitAttemptLog, findChangesetBaseline, isBaselineDrifted, isDesignStale, isPublicBuild, isTerminalJob, latestVerdicts, matchUpstreamStory, normalizeImportPath, parseAttemptRowId, probeCredentials, reencryptCredentials, resolveBaselineOrigin, resolveDesigns, worstStatus };
|
|
48
|
+
export { AiBudgetAlertModel, AiUsageModel, BASELINE_ARCHIVE_FORMAT, BASELINE_ARCHIVE_LIMITS, BASELINE_ARCHIVE_VERSION, BaselineApprovalConflict, BaselineArchiveError, BaselineModel, BaselineTransferModel, BaselineWriteConflict, BuildComponentModel, BuildModel, BuildReviewModel, CaptureAttemptModel, CaptureJobModel, CaptureLogModel, CaptureShardModel, CommentModel, ConnectionModel, ContentRefModel, DESIGN_TTL_MS, DesignCredentialModel, DesignModel, DesignNodeModel, InsightModel, LabelModel, MemberModel, NO_BASELINE, NotificationChannelModel, NotificationSubscriptionModel, PROJECT_SCOPE, PUBLIC_ORIGIN_KEY, PackageUsageModel, ProjectGroupMappingModel, ProjectModel, RECENT_BUILDS_FOR_INHERITED_RATIO, SiteSettingsModel, SnapshotModel, TERMINAL_JOB_STATUSES, TokenModel, UserModel, WebhookModel, acceptPendingWithoutWork, attemptRowId, averageInheritedRatio, baselineStatus, changesetOf, componentHistory, componentPresence, computeChangeset, createPublicOriginResolver, credentialDaysLeft, deriveReviewStatus, designChange, designDrift, emitAttemptLog, findChangesetBaseline, isBaselineDrifted, isDesignStale, isPublicBuild, isTerminalJob, latestVerdicts, matchUpstreamStory, normalizeImportPath, parseAttemptRowId, probeCredentials, reencryptCredentials, resolveBaselineOrigin, resolveDesigns, worstStatus };
|
package/dist/urls.d.mts
CHANGED
|
@@ -12,11 +12,13 @@ interface UrlBuilder {
|
|
|
12
12
|
/** Review page of one snapshot: the build's diff page with that snapshot selected. */
|
|
13
13
|
snapshot(slug: string, buildId: string, snapshotId: string): string;
|
|
14
14
|
library(slug: string): string;
|
|
15
|
+
/** Design coverage page: stories vs design links vs drift. */
|
|
16
|
+
designCoverage(slug: string): string;
|
|
15
17
|
jobs(slug: string): string;
|
|
16
18
|
labels(slug: string): string;
|
|
17
19
|
label(slug: string, key: string, value: string): string;
|
|
18
|
-
/** Stable component page, keyed by the story file's import path. */
|
|
19
|
-
component(slug: string, importPath: string): string;
|
|
20
|
+
/** Stable component page, keyed by the story file's import path; `tab` selects one of its tabs. */
|
|
21
|
+
component(slug: string, importPath: string, tab?: string): string;
|
|
20
22
|
storybook(slug: string): string;
|
|
21
23
|
storybookLabel(slug: string, key: string, value: string): string;
|
|
22
24
|
storybookBuild(slug: string, buildId: string): string;
|
package/dist/urls.mjs
CHANGED
|
@@ -21,10 +21,11 @@ function createUrlBuilder(baseUrl, publishedBaseDomain) {
|
|
|
21
21
|
buildDiff: (slug, buildId) => `${root}/projects/${slug}/builds/${buildId}/diff`,
|
|
22
22
|
snapshot: (slug, buildId, snapshotId) => `${root}/projects/${slug}/builds/${buildId}/diff?snapshot=${encodeURIComponent(snapshotId)}`,
|
|
23
23
|
library: (slug) => `${root}/projects/${slug}/library`,
|
|
24
|
+
designCoverage: (slug) => `${root}/projects/${slug}/design/coverage`,
|
|
24
25
|
jobs: (slug) => `${root}/projects/${slug}/jobs`,
|
|
25
26
|
labels: (slug) => `${root}/projects/${slug}/labels`,
|
|
26
27
|
label: (slug, key, value) => `${root}/projects/${slug}/labels/${encodeURIComponent(key)}/${encodePath(value)}`,
|
|
27
|
-
component: (slug, importPath) => `${root}/projects/${slug}/components/${encodePath(importPath.replace(/^(?:\.\/)+/u, ""))}`,
|
|
28
|
+
component: (slug, importPath, tab) => `${root}/projects/${slug}/components/${encodePath(importPath.replace(/^(?:\.\/)+/u, ""))}${tab === void 0 ? "" : `?tab=${encodeURIComponent(tab)}`}`,
|
|
28
29
|
storybook: (slug) => publishedBaseDomain ? `https://${slug}.${publishedBaseDomain}` : `${root}/projects/${slug}/storybook`,
|
|
29
30
|
storybookLabel: (slug, key, value) => `${root}/projects/${slug}/storybook/${encodeURIComponent(key)}/${encodePath(value)}`,
|
|
30
31
|
storybookBuild: (slug, buildId) => publishedBaseDomain ? `https://${buildId}.${slug}.${publishedBaseDomain}` : `${root}/projects/${slug}/storybook/build/${buildId}`,
|
package/dist/urls.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"urls.mjs","names":[],"sources":["../src/urls.ts"],"sourcesContent":["/** Type-safe URL builder for project pages and published Storybooks. */\nexport interface UrlBuilder {\n projectsList(): string;\n projects(): string;\n project(slug: string): string;\n projectsNew(): string;\n buildsList(slug: string): string;\n build(slug: string, buildId: string): string;\n buildDiff(slug: string, buildId: string): string;\n /** Review page of one snapshot: the build's diff page with that snapshot selected. */\n snapshot(slug: string, buildId: string, snapshotId: string): string;\n library(slug: string): string;\n jobs(slug: string): string;\n labels(slug: string): string;\n label(slug: string, key: string, value: string): string;\n /** Stable component page, keyed by the story file's import path. */\n component(slug: string, importPath: string): string;\n storybook(slug: string): string;\n storybookLabel(slug: string, key: string, value: string): string;\n storybookBuild(slug: string, buildId: string): string;\n settings(slug: string): string;\n short(id: string): string;\n}\n\n/**\n * Create a URL builder rooted at the given base URL.\n *\n * @param baseUrl - Public root URL of the shelf server.\n * @param publishedBaseDomain - Optional wildcard domain for published Storybooks.\n * @returns The URL builder.\n */\nexport function createUrlBuilder(baseUrl: string, publishedBaseDomain?: string): UrlBuilder {\n const root = baseUrl.replace(/\\/+$/u, \"\");\n\n return {\n projectsList: () => root || \"/\",\n projects: () => `${root}/projects`,\n project: (slug) => `${root}/projects/${slug}`,\n projectsNew: () => `${root}/projects/new`,\n buildsList: (slug) => `${root}/projects/${slug}/builds`,\n build: (slug, buildId) => `${root}/projects/${slug}/builds/${buildId}`,\n buildDiff: (slug, buildId) => `${root}/projects/${slug}/builds/${buildId}/diff`,\n snapshot: (slug, buildId, snapshotId) =>\n `${root}/projects/${slug}/builds/${buildId}/diff?snapshot=${encodeURIComponent(snapshotId)}`,\n library: (slug) => `${root}/projects/${slug}/library`,\n jobs: (slug) => `${root}/projects/${slug}/jobs`,\n labels: (slug) => `${root}/projects/${slug}/labels`,\n label: (slug, key, value) =>\n `${root}/projects/${slug}/labels/${encodeURIComponent(key)}/${encodePath(value)}`,\n component: (slug, importPath) =>\n `${root}/projects/${slug}/components/${encodePath(importPath.replace(/^(?:\\.\\/)+/u, \"\"))}`,\n storybook: (slug) =>\n publishedBaseDomain\n ? `https://${slug}.${publishedBaseDomain}`\n : `${root}/projects/${slug}/storybook`,\n storybookLabel: (slug, key, value) =>\n `${root}/projects/${slug}/storybook/${encodeURIComponent(key)}/${encodePath(value)}`,\n storybookBuild: (slug, buildId) =>\n publishedBaseDomain\n ? `https://${buildId}.${slug}.${publishedBaseDomain}`\n : `${root}/projects/${slug}/storybook/build/${buildId}`,\n settings: (slug) => `${root}/projects/${slug}/settings`,\n short: (id) => `${root}/_/${id}/`,\n };\n}\n\n/**\n * Embeddable image URL check for IdP-supplied avatars: `https:` and\n * app-relative paths only, so `javascript:`/`data:` payloads fall back.\n */\nexport function safeImageUrl(value: string | undefined): string | null {\n if (!value) {\n return null;\n }\n if (value.startsWith(\"/\") && !value.startsWith(\"//\")) {\n return value;\n }\n try {\n const url = new URL(value);\n return url.protocol === \"https:\" ? value : null;\n } catch {\n return null;\n }\n}\n\n/**\n * Encode a value that may hold slashes (a label value, a branch, an import path) as URL path\n * segments: each segment is escaped (`?`, `#` and `%` included), the slashes stay.\n */\nfunction encodePath(value: string): string {\n return value\n .split(\"/\")\n .map((segment) => encodeURIComponent(segment))\n .join(\"/\");\n}\n"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"urls.mjs","names":[],"sources":["../src/urls.ts"],"sourcesContent":["/** Type-safe URL builder for project pages and published Storybooks. */\nexport interface UrlBuilder {\n projectsList(): string;\n projects(): string;\n project(slug: string): string;\n projectsNew(): string;\n buildsList(slug: string): string;\n build(slug: string, buildId: string): string;\n buildDiff(slug: string, buildId: string): string;\n /** Review page of one snapshot: the build's diff page with that snapshot selected. */\n snapshot(slug: string, buildId: string, snapshotId: string): string;\n library(slug: string): string;\n /** Design coverage page: stories vs design links vs drift. */\n designCoverage(slug: string): string;\n jobs(slug: string): string;\n labels(slug: string): string;\n label(slug: string, key: string, value: string): string;\n /** Stable component page, keyed by the story file's import path; `tab` selects one of its tabs. */\n component(slug: string, importPath: string, tab?: string): string;\n storybook(slug: string): string;\n storybookLabel(slug: string, key: string, value: string): string;\n storybookBuild(slug: string, buildId: string): string;\n settings(slug: string): string;\n short(id: string): string;\n}\n\n/**\n * Create a URL builder rooted at the given base URL.\n *\n * @param baseUrl - Public root URL of the shelf server.\n * @param publishedBaseDomain - Optional wildcard domain for published Storybooks.\n * @returns The URL builder.\n */\nexport function createUrlBuilder(baseUrl: string, publishedBaseDomain?: string): UrlBuilder {\n const root = baseUrl.replace(/\\/+$/u, \"\");\n\n return {\n projectsList: () => root || \"/\",\n projects: () => `${root}/projects`,\n project: (slug) => `${root}/projects/${slug}`,\n projectsNew: () => `${root}/projects/new`,\n buildsList: (slug) => `${root}/projects/${slug}/builds`,\n build: (slug, buildId) => `${root}/projects/${slug}/builds/${buildId}`,\n buildDiff: (slug, buildId) => `${root}/projects/${slug}/builds/${buildId}/diff`,\n snapshot: (slug, buildId, snapshotId) =>\n `${root}/projects/${slug}/builds/${buildId}/diff?snapshot=${encodeURIComponent(snapshotId)}`,\n library: (slug) => `${root}/projects/${slug}/library`,\n designCoverage: (slug) => `${root}/projects/${slug}/design/coverage`,\n jobs: (slug) => `${root}/projects/${slug}/jobs`,\n labels: (slug) => `${root}/projects/${slug}/labels`,\n label: (slug, key, value) =>\n `${root}/projects/${slug}/labels/${encodeURIComponent(key)}/${encodePath(value)}`,\n component: (slug, importPath, tab) =>\n `${root}/projects/${slug}/components/${encodePath(importPath.replace(/^(?:\\.\\/)+/u, \"\"))}${\n tab === undefined ? \"\" : `?tab=${encodeURIComponent(tab)}`\n }`,\n storybook: (slug) =>\n publishedBaseDomain\n ? `https://${slug}.${publishedBaseDomain}`\n : `${root}/projects/${slug}/storybook`,\n storybookLabel: (slug, key, value) =>\n `${root}/projects/${slug}/storybook/${encodeURIComponent(key)}/${encodePath(value)}`,\n storybookBuild: (slug, buildId) =>\n publishedBaseDomain\n ? `https://${buildId}.${slug}.${publishedBaseDomain}`\n : `${root}/projects/${slug}/storybook/build/${buildId}`,\n settings: (slug) => `${root}/projects/${slug}/settings`,\n short: (id) => `${root}/_/${id}/`,\n };\n}\n\n/**\n * Embeddable image URL check for IdP-supplied avatars: `https:` and\n * app-relative paths only, so `javascript:`/`data:` payloads fall back.\n */\nexport function safeImageUrl(value: string | undefined): string | null {\n if (!value) {\n return null;\n }\n if (value.startsWith(\"/\") && !value.startsWith(\"//\")) {\n return value;\n }\n try {\n const url = new URL(value);\n return url.protocol === \"https:\" ? value : null;\n } catch {\n return null;\n }\n}\n\n/**\n * Encode a value that may hold slashes (a label value, a branch, an import path) as URL path\n * segments: each segment is escaped (`?`, `#` and `%` included), the slashes stay.\n */\nfunction encodePath(value: string): string {\n return value\n .split(\"/\")\n .map((segment) => encodeURIComponent(segment))\n .join(\"/\");\n}\n"],"mappings":";;;;;;;;;;;AAiCA,SAAgB,iBAAiB,SAAiB,qBAA0C;CAC1F,MAAM,OAAO,QAAQ,QAAQ,SAAS,EAAE;CAExC,OAAO;EACL,oBAAoB,QAAQ;EAC5B,gBAAgB,GAAG,KAAK;EACxB,UAAU,SAAS,GAAG,KAAK,YAAY;EACvC,mBAAmB,GAAG,KAAK;EAC3B,aAAa,SAAS,GAAG,KAAK,YAAY,KAAK;EAC/C,QAAQ,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,UAAU;EAC7D,YAAY,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,UAAU,QAAQ;EACzE,WAAW,MAAM,SAAS,eACxB,GAAG,KAAK,YAAY,KAAK,UAAU,QAAQ,iBAAiB,mBAAmB,UAAU;EAC3F,UAAU,SAAS,GAAG,KAAK,YAAY,KAAK;EAC5C,iBAAiB,SAAS,GAAG,KAAK,YAAY,KAAK;EACnD,OAAO,SAAS,GAAG,KAAK,YAAY,KAAK;EACzC,SAAS,SAAS,GAAG,KAAK,YAAY,KAAK;EAC3C,QAAQ,MAAM,KAAK,UACjB,GAAG,KAAK,YAAY,KAAK,UAAU,mBAAmB,GAAG,EAAE,GAAG,WAAW,KAAK;EAChF,YAAY,MAAM,YAAY,QAC5B,GAAG,KAAK,YAAY,KAAK,cAAc,WAAW,WAAW,QAAQ,eAAe,EAAE,CAAC,IACrF,QAAQ,KAAA,IAAY,KAAK,QAAQ,mBAAmB,GAAG;EAE3D,YAAY,SACV,sBACI,WAAW,KAAK,GAAG,wBACnB,GAAG,KAAK,YAAY,KAAK;EAC/B,iBAAiB,MAAM,KAAK,UAC1B,GAAG,KAAK,YAAY,KAAK,aAAa,mBAAmB,GAAG,EAAE,GAAG,WAAW,KAAK;EACnF,iBAAiB,MAAM,YACrB,sBACI,WAAW,QAAQ,GAAG,KAAK,GAAG,wBAC9B,GAAG,KAAK,YAAY,KAAK,mBAAmB;EAClD,WAAW,SAAS,GAAG,KAAK,YAAY,KAAK;EAC7C,QAAQ,OAAO,GAAG,KAAK,KAAK,GAAG;CACjC;AACF;;;;;AAMA,SAAgB,aAAa,OAA0C;CACrE,IAAI,CAAC,OACH,OAAO;CAET,IAAI,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,WAAW,IAAI,GACjD,OAAO;CAET,IAAI;EAEF,OAAO,IADS,IAAI,KACX,CAAC,CAAC,aAAa,WAAW,QAAQ;CAC7C,QAAQ;EACN,OAAO;CACT;AACF;;;;;AAMA,SAAS,WAAW,OAAuB;CACzC,OAAO,MACJ,MAAM,GAAG,CAAC,CACV,KAAK,YAAY,mBAAmB,OAAO,CAAC,CAAC,CAC7C,KAAK,GAAG;AACb"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storyshelf/core",
|
|
3
|
-
"version": "0.9.0-next-
|
|
3
|
+
"version": "0.9.0-next-c3504b0",
|
|
4
4
|
"description": "StoryShelf core: adapter interfaces, models, capture pipeline, diff, and retention (no HTTP).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chromatic-alternative",
|
|
@@ -202,8 +202,8 @@
|
|
|
202
202
|
},
|
|
203
203
|
"dependencies": {
|
|
204
204
|
"@opentelemetry/api": "^1.9.0",
|
|
205
|
-
"@storyshelf/affected": "0.9.0-next-
|
|
206
|
-
"@storyshelf/image": "0.9.0-next-
|
|
205
|
+
"@storyshelf/affected": "0.9.0-next-c3504b0",
|
|
206
|
+
"@storyshelf/image": "0.9.0-next-c3504b0",
|
|
207
207
|
"axe-core": "4.13.0",
|
|
208
208
|
"drizzle-orm": "^0.45.4",
|
|
209
209
|
"pino": "^10.3.1",
|