rivet-design 0.18.2 → 0.18.4
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 +1 -1
- package/README.npm.md +1 -1
- package/dist/agent-variants/SessionStore.d.ts.map +1 -1
- package/dist/agent-variants/SessionStore.js +7 -0
- package/dist/agent-variants/SessionStore.js.map +1 -1
- package/dist/agent-variants/WorktreeOrchestrator.d.ts +5 -1
- package/dist/agent-variants/WorktreeOrchestrator.d.ts.map +1 -1
- package/dist/agent-variants/WorktreeOrchestrator.js +193 -39
- package/dist/agent-variants/WorktreeOrchestrator.js.map +1 -1
- package/dist/cli/client.d.ts.map +1 -1
- package/dist/cli/client.js +11 -3
- package/dist/cli/client.js.map +1 -1
- package/dist/cli/commands/generationPreflight.d.ts +12 -0
- package/dist/cli/commands/generationPreflight.d.ts.map +1 -0
- package/dist/cli/commands/generationPreflight.js +40 -0
- package/dist/cli/commands/generationPreflight.js.map +1 -0
- package/dist/cli/commands/libraryOpen.d.ts.map +1 -1
- package/dist/cli/commands/libraryOpen.js +5 -1
- package/dist/cli/commands/libraryOpen.js.map +1 -1
- package/dist/cli/commands/mcpServe.d.ts.map +1 -1
- package/dist/cli/commands/mcpServe.js +54 -12
- package/dist/cli/commands/mcpServe.js.map +1 -1
- package/dist/cli/commands/open.d.ts.map +1 -1
- package/dist/cli/commands/open.js +110 -76
- package/dist/cli/commands/open.js.map +1 -1
- package/dist/cli/commands/profile.d.ts.map +1 -1
- package/dist/cli/commands/profile.js +81 -12
- package/dist/cli/commands/profile.js.map +1 -1
- package/dist/cli/commands/serve.d.ts.map +1 -1
- package/dist/cli/commands/serve.js +20 -0
- package/dist/cli/commands/serve.js.map +1 -1
- package/dist/cli/commands/shared.d.ts.map +1 -1
- package/dist/cli/commands/shared.js +2 -2
- package/dist/cli/commands/shared.js.map +1 -1
- package/dist/cli/commands/stop.d.ts.map +1 -1
- package/dist/cli/commands/stop.js +29 -5
- package/dist/cli/commands/stop.js.map +1 -1
- package/dist/cli/commands/variants.d.ts +8 -1
- package/dist/cli/commands/variants.d.ts.map +1 -1
- package/dist/cli/commands/variants.js +13 -4
- package/dist/cli/commands/variants.js.map +1 -1
- package/dist/cli/referenceOnboarding.d.ts +3 -0
- package/dist/cli/referenceOnboarding.d.ts.map +1 -0
- package/dist/cli/referenceOnboarding.js +82 -0
- package/dist/cli/referenceOnboarding.js.map +1 -0
- package/dist/cli/router.d.ts.map +1 -1
- package/dist/cli/router.js +7 -7
- package/dist/cli/router.js.map +1 -1
- package/dist/cli/serverHandshake.d.ts +5 -4
- package/dist/cli/serverHandshake.d.ts.map +1 -1
- package/dist/cli/serverHandshake.js +66 -57
- package/dist/cli/serverHandshake.js.map +1 -1
- package/dist/cli/serverShutdown.d.ts +4 -0
- package/dist/cli/serverShutdown.d.ts.map +1 -0
- package/dist/cli/serverShutdown.js +20 -0
- package/dist/cli/serverShutdown.js.map +1 -0
- package/dist/cli/serverUnavailable.d.ts +1 -1
- package/dist/cli/serverUnavailable.d.ts.map +1 -1
- package/dist/cli/serverUnavailable.js +4 -0
- package/dist/cli/serverUnavailable.js.map +1 -1
- package/dist/cli/serverVersion.d.ts +1 -1
- package/dist/cli/serverVersion.d.ts.map +1 -1
- package/dist/cli/serverVersion.js +5 -23
- package/dist/cli/serverVersion.js.map +1 -1
- package/dist/install/codexSkill.d.ts +13 -0
- package/dist/install/codexSkill.d.ts.map +1 -0
- package/dist/install/codexSkill.js +64 -0
- package/dist/install/codexSkill.js.map +1 -0
- package/dist/install/harnesses.d.ts.map +1 -1
- package/dist/install/harnesses.js +25 -4
- package/dist/install/harnesses.js.map +1 -1
- package/dist/library/HubClient.d.ts +9 -1
- package/dist/library/HubClient.d.ts.map +1 -1
- package/dist/library/HubClient.js +40 -11
- package/dist/library/HubClient.js.map +1 -1
- package/dist/routes/agentVariants.d.ts +2 -1
- package/dist/routes/agentVariants.d.ts.map +1 -1
- package/dist/routes/agentVariants.js +26 -28
- package/dist/routes/agentVariants.js.map +1 -1
- package/dist/routes/cli.d.ts +3 -0
- package/dist/routes/cli.d.ts.map +1 -1
- package/dist/routes/cli.js +66 -9
- package/dist/routes/cli.js.map +1 -1
- package/dist/routes/library/index.d.ts.map +1 -1
- package/dist/routes/library/index.js +2 -0
- package/dist/routes/library/index.js.map +1 -1
- package/dist/routes/library/profiles.d.ts.map +1 -1
- package/dist/routes/library/profiles.js +2 -0
- package/dist/routes/library/profiles.js.map +1 -1
- package/dist/routes/library/referenceOnboarding.d.ts +4 -0
- package/dist/routes/library/referenceOnboarding.d.ts.map +1 -0
- package/dist/routes/library/referenceOnboarding.js +94 -0
- package/dist/routes/library/referenceOnboarding.js.map +1 -0
- package/dist/routes/runtimeAdmission.d.ts +13 -0
- package/dist/routes/runtimeAdmission.d.ts.map +1 -0
- package/dist/routes/runtimeAdmission.js +42 -0
- package/dist/routes/runtimeAdmission.js.map +1 -0
- package/dist/server.d.ts +1 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +7 -4
- package/dist/server.js.map +1 -1
- package/dist/services/IntegrationsClient.d.ts +77 -0
- package/dist/services/IntegrationsClient.d.ts.map +1 -1
- package/dist/services/IntegrationsClient.js +123 -6
- package/dist/services/IntegrationsClient.js.map +1 -1
- package/dist/services/ProjectImport.d.ts.map +1 -1
- package/dist/services/ProjectImport.js +5 -12
- package/dist/services/ProjectImport.js.map +1 -1
- package/dist/services/RuntimeAdmission.d.ts +31 -0
- package/dist/services/RuntimeAdmission.d.ts.map +1 -0
- package/dist/services/RuntimeAdmission.js +77 -0
- package/dist/services/RuntimeAdmission.js.map +1 -0
- package/dist/services/TelemetryService.d.ts +1 -1
- package/dist/services/TelemetryService.d.ts.map +1 -1
- package/dist/services/TelemetryService.js.map +1 -1
- package/dist/services/TreeStore.d.ts +7 -0
- package/dist/services/TreeStore.d.ts.map +1 -1
- package/dist/services/TreeStore.js +18 -0
- package/dist/services/TreeStore.js.map +1 -1
- package/dist/services/profiles/DesignProfiles.d.ts +231 -16
- package/dist/services/profiles/DesignProfiles.d.ts.map +1 -1
- package/dist/services/profiles/DesignProfiles.js +140 -0
- package/dist/services/profiles/DesignProfiles.js.map +1 -1
- package/dist/services/profiles/ProfileImports.d.ts +3 -3
- package/dist/services/profiles/ProfileImports.d.ts.map +1 -1
- package/dist/services/profiles/ProfileImports.js +25 -1
- package/dist/services/profiles/ProfileImports.js.map +1 -1
- package/dist/services/profiles/ProfilePlanning.d.ts +96 -0
- package/dist/services/profiles/ProfilePlanning.d.ts.map +1 -0
- package/dist/services/profiles/ProfilePlanning.js +187 -0
- package/dist/services/profiles/ProfilePlanning.js.map +1 -0
- package/dist/services/profiles/ReferenceReader.d.ts +75 -0
- package/dist/services/profiles/ReferenceReader.d.ts.map +1 -0
- package/dist/services/profiles/ReferenceReader.js +97 -0
- package/dist/services/profiles/ReferenceReader.js.map +1 -0
- package/dist/services/profiles/analysisBatch.js +1 -1
- package/dist/services/profiles/analysisBatch.js.map +1 -1
- package/dist/services/profiles/boardPage.d.ts +2 -1
- package/dist/services/profiles/boardPage.d.ts.map +1 -1
- package/dist/services/profiles/boardPage.js.map +1 -1
- package/dist/services/profiles/cosmosPage.d.ts +10 -0
- package/dist/services/profiles/cosmosPage.d.ts.map +1 -0
- package/dist/services/profiles/cosmosPage.js +104 -0
- package/dist/services/profiles/cosmosPage.js.map +1 -0
- package/dist/services/runtimeActivity.d.ts +3 -0
- package/dist/services/runtimeActivity.d.ts.map +1 -0
- package/dist/services/runtimeActivity.js +70 -0
- package/dist/services/runtimeActivity.js.map +1 -0
- package/dist/services/runtimeVersion.d.ts +4 -0
- package/dist/services/runtimeVersion.d.ts.map +1 -0
- package/dist/services/runtimeVersion.js +30 -0
- package/dist/services/runtimeVersion.js.map +1 -0
- package/dist/storage/library/ProjectRuntimeRecords.d.ts +15 -0
- package/dist/storage/library/ProjectRuntimeRecords.d.ts.map +1 -0
- package/dist/storage/library/ProjectRuntimeRecords.js +66 -0
- package/dist/storage/library/ProjectRuntimeRecords.js.map +1 -0
- package/dist/storage/library/migrations.d.ts +1 -0
- package/dist/storage/library/migrations.d.ts.map +1 -1
- package/dist/storage/library/migrations.js +9 -1
- package/dist/storage/library/migrations.js.map +1 -1
- package/dist/storage/library/schema/projectRuntime.d.ts +72 -0
- package/dist/storage/library/schema/projectRuntime.d.ts.map +1 -0
- package/dist/storage/library/schema/projectRuntime.js +16 -0
- package/dist/storage/library/schema/projectRuntime.js.map +1 -0
- package/dist/storage/profiles/ProfilePlans.d.ts +320 -0
- package/dist/storage/profiles/ProfilePlans.d.ts.map +1 -0
- package/dist/storage/profiles/ProfilePlans.js +256 -0
- package/dist/storage/profiles/ProfilePlans.js.map +1 -0
- package/dist/storage/profiles/ProfileRecords.d.ts +71 -10
- package/dist/storage/profiles/ProfileRecords.d.ts.map +1 -1
- package/dist/storage/profiles/ProfileRecords.js +152 -62
- package/dist/storage/profiles/ProfileRecords.js.map +1 -1
- package/dist/storage/profiles/migrations.d.ts +2 -2
- package/dist/storage/profiles/migrations.d.ts.map +1 -1
- package/dist/storage/profiles/migrations.js +14 -0
- package/dist/storage/profiles/migrations.js.map +1 -1
- package/dist/storage/profiles/planSchema.d.ts +347 -0
- package/dist/storage/profiles/planSchema.d.ts.map +1 -0
- package/dist/storage/profiles/planSchema.js +34 -0
- package/dist/storage/profiles/planSchema.js.map +1 -0
- package/dist/storage/profiles/schema.d.ts +59 -4
- package/dist/storage/profiles/schema.d.ts.map +1 -1
- package/dist/storage/profiles/schema.js +14 -1
- package/dist/storage/profiles/schema.js.map +1 -1
- package/dist/types/cosmos-profile.d.ts +130 -0
- package/dist/types/cosmos-profile.d.ts.map +1 -0
- package/dist/types/cosmos-profile.js +27 -0
- package/dist/types/cosmos-profile.js.map +1 -0
- package/dist/types/cosmos.d.ts +330 -0
- package/dist/types/cosmos.d.ts.map +1 -0
- package/dist/types/cosmos.js +157 -0
- package/dist/types/cosmos.js.map +1 -0
- package/dist/types/design-profile.d.ts +21 -16
- package/dist/types/design-profile.d.ts.map +1 -1
- package/dist/types/design-profile.js +6 -1
- package/dist/types/design-profile.js.map +1 -1
- package/dist/types/reference-connectors.d.ts +226 -0
- package/dist/types/reference-connectors.d.ts.map +1 -0
- package/dist/types/reference-connectors.js +92 -0
- package/dist/types/reference-connectors.js.map +1 -0
- package/dist/types/reference-onboarding.d.ts +1065 -0
- package/dist/types/reference-onboarding.d.ts.map +1 -0
- package/dist/types/reference-onboarding.js +108 -0
- package/dist/types/reference-onboarding.js.map +1 -0
- package/dist/types/reference-pages.d.ts +168 -0
- package/dist/types/reference-pages.d.ts.map +1 -0
- package/dist/types/reference-pages.js +26 -0
- package/dist/types/reference-pages.js.map +1 -0
- package/dist/types/x-bookmarks.d.ts +8 -8
- package/dist/utils/skills/cli-guidance.d.ts +1 -1
- package/dist/utils/skills/cli-guidance.d.ts.map +1 -1
- package/dist/utils/skills/cli-guidance.js +6 -2
- package/dist/utils/skills/cli-guidance.js.map +1 -1
- package/dist/utils/skills/codex-skill.d.ts +3 -0
- package/dist/utils/skills/codex-skill.d.ts.map +1 -0
- package/dist/utils/skills/codex-skill.js +30 -0
- package/dist/utils/skills/codex-skill.js.map +1 -0
- package/package.json +2 -1
- package/src/ui/dist/assets/{LibraryApp-NAzSe5xc.js → LibraryApp-Cxdyy4oV.js} +1 -1
- package/src/ui/dist/assets/main-B-LY2LQB.css +1 -0
- package/src/ui/dist/assets/{main-D7LJLJwW.js → main-CPHvvBUN.js} +79 -79
- package/src/ui/dist/index.html +2 -2
- package/src/ui/dist/assets/main-f2uWt6ZY.css +0 -1
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const CosmosProfileSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodEffects<z.ZodString, string, string>;
|
|
4
|
+
username: z.ZodString;
|
|
5
|
+
title: z.ZodString;
|
|
6
|
+
url: z.ZodEffects<z.ZodString, string, string>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
id: string;
|
|
9
|
+
url: string;
|
|
10
|
+
title: string;
|
|
11
|
+
username: string;
|
|
12
|
+
}, {
|
|
13
|
+
id: string;
|
|
14
|
+
url: string;
|
|
15
|
+
title: string;
|
|
16
|
+
username: string;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const CosmosProfileCollectionSchema: z.ZodObject<{
|
|
19
|
+
id: z.ZodEffects<z.ZodString, string, string>;
|
|
20
|
+
title: z.ZodString;
|
|
21
|
+
description: z.ZodNullable<z.ZodString>;
|
|
22
|
+
url: z.ZodEffects<z.ZodString, string, string>;
|
|
23
|
+
total: z.ZodNumber;
|
|
24
|
+
parentId: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
|
|
25
|
+
children: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
id: string;
|
|
28
|
+
url: string;
|
|
29
|
+
title: string;
|
|
30
|
+
description: string | null;
|
|
31
|
+
children: string[];
|
|
32
|
+
total: number;
|
|
33
|
+
parentId: string | null;
|
|
34
|
+
}, {
|
|
35
|
+
id: string;
|
|
36
|
+
url: string;
|
|
37
|
+
title: string;
|
|
38
|
+
description: string | null;
|
|
39
|
+
children: string[];
|
|
40
|
+
total: number;
|
|
41
|
+
parentId: string | null;
|
|
42
|
+
}>;
|
|
43
|
+
export declare const CosmosProfilePageSchema: z.ZodObject<{
|
|
44
|
+
profile: z.ZodObject<{
|
|
45
|
+
id: z.ZodEffects<z.ZodString, string, string>;
|
|
46
|
+
username: z.ZodString;
|
|
47
|
+
title: z.ZodString;
|
|
48
|
+
url: z.ZodEffects<z.ZodString, string, string>;
|
|
49
|
+
}, "strip", z.ZodTypeAny, {
|
|
50
|
+
id: string;
|
|
51
|
+
url: string;
|
|
52
|
+
title: string;
|
|
53
|
+
username: string;
|
|
54
|
+
}, {
|
|
55
|
+
id: string;
|
|
56
|
+
url: string;
|
|
57
|
+
title: string;
|
|
58
|
+
username: string;
|
|
59
|
+
}>;
|
|
60
|
+
collections: z.ZodArray<z.ZodObject<{
|
|
61
|
+
id: z.ZodEffects<z.ZodString, string, string>;
|
|
62
|
+
title: z.ZodString;
|
|
63
|
+
description: z.ZodNullable<z.ZodString>;
|
|
64
|
+
url: z.ZodEffects<z.ZodString, string, string>;
|
|
65
|
+
total: z.ZodNumber;
|
|
66
|
+
parentId: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
|
|
67
|
+
children: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
69
|
+
id: string;
|
|
70
|
+
url: string;
|
|
71
|
+
title: string;
|
|
72
|
+
description: string | null;
|
|
73
|
+
children: string[];
|
|
74
|
+
total: number;
|
|
75
|
+
parentId: string | null;
|
|
76
|
+
}, {
|
|
77
|
+
id: string;
|
|
78
|
+
url: string;
|
|
79
|
+
title: string;
|
|
80
|
+
description: string | null;
|
|
81
|
+
children: string[];
|
|
82
|
+
total: number;
|
|
83
|
+
parentId: string | null;
|
|
84
|
+
}>, "many">;
|
|
85
|
+
total: z.ZodNumber;
|
|
86
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
87
|
+
}, "strip", z.ZodTypeAny, {
|
|
88
|
+
total: number;
|
|
89
|
+
nextCursor: string | null;
|
|
90
|
+
collections: {
|
|
91
|
+
id: string;
|
|
92
|
+
url: string;
|
|
93
|
+
title: string;
|
|
94
|
+
description: string | null;
|
|
95
|
+
children: string[];
|
|
96
|
+
total: number;
|
|
97
|
+
parentId: string | null;
|
|
98
|
+
}[];
|
|
99
|
+
profile: {
|
|
100
|
+
id: string;
|
|
101
|
+
url: string;
|
|
102
|
+
title: string;
|
|
103
|
+
username: string;
|
|
104
|
+
};
|
|
105
|
+
}, {
|
|
106
|
+
total: number;
|
|
107
|
+
nextCursor: string | null;
|
|
108
|
+
collections: {
|
|
109
|
+
id: string;
|
|
110
|
+
url: string;
|
|
111
|
+
title: string;
|
|
112
|
+
description: string | null;
|
|
113
|
+
children: string[];
|
|
114
|
+
total: number;
|
|
115
|
+
parentId: string | null;
|
|
116
|
+
}[];
|
|
117
|
+
profile: {
|
|
118
|
+
id: string;
|
|
119
|
+
url: string;
|
|
120
|
+
title: string;
|
|
121
|
+
username: string;
|
|
122
|
+
};
|
|
123
|
+
}>;
|
|
124
|
+
export type CosmosProfilePage = z.infer<typeof CosmosProfilePageSchema>;
|
|
125
|
+
export interface CosmosDiscoveryInput {
|
|
126
|
+
url: string;
|
|
127
|
+
cursor?: string;
|
|
128
|
+
signal?: AbortSignal;
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=cosmos-profile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cosmos-profile.d.ts","sourceRoot":"","sources":["../../src/types/cosmos-profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;EAK9B,CAAC;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;EAQxC,CAAC;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CosmosProfilePageSchema = exports.CosmosProfileCollectionSchema = exports.CosmosProfileSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const cosmos_1 = require("./cosmos");
|
|
6
|
+
exports.CosmosProfileSchema = zod_1.z.object({
|
|
7
|
+
id: cosmos_1.CosmosIdSchema,
|
|
8
|
+
username: zod_1.z.string().min(1).max(100),
|
|
9
|
+
title: zod_1.z.string().max(500),
|
|
10
|
+
url: zod_1.z.string().transform((url) => (0, cosmos_1.parseCosmosProfileUrl)(url).url),
|
|
11
|
+
});
|
|
12
|
+
exports.CosmosProfileCollectionSchema = zod_1.z.object({
|
|
13
|
+
id: cosmos_1.CosmosIdSchema,
|
|
14
|
+
title: zod_1.z.string().min(1).max(500),
|
|
15
|
+
description: zod_1.z.string().max(10_000).nullable(),
|
|
16
|
+
url: zod_1.z.string().transform((url) => (0, cosmos_1.parseCosmosUrl)(url).url),
|
|
17
|
+
total: zod_1.z.number().int().nonnegative(),
|
|
18
|
+
parentId: cosmos_1.CosmosIdSchema.nullable(),
|
|
19
|
+
children: zod_1.z.array(cosmos_1.CosmosIdSchema).max(10_000),
|
|
20
|
+
});
|
|
21
|
+
exports.CosmosProfilePageSchema = zod_1.z.object({
|
|
22
|
+
profile: exports.CosmosProfileSchema,
|
|
23
|
+
collections: zod_1.z.array(exports.CosmosProfileCollectionSchema),
|
|
24
|
+
total: zod_1.z.number().int().nonnegative(),
|
|
25
|
+
nextCursor: cosmos_1.CosmosCursorSchema.nullable(),
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=cosmos-profile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cosmos-profile.js","sourceRoot":"","sources":["../../src/types/cosmos-profile.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,qCAKkB;AAEL,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC1C,EAAE,EAAE,uBAAc;IAClB,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC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ema: z.ZodEffects<z.ZodString, string, string>;
|
|
3
|
+
export declare const CosmosCursorSchema: z.ZodString;
|
|
4
|
+
export declare const parseCosmosProfileUrl: (value: string) => {
|
|
5
|
+
username: string;
|
|
6
|
+
url: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const CosmosProfileUrlSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
9
|
+
export declare const parseCosmosUrl: (value: string) => {
|
|
10
|
+
ownerUsername: string;
|
|
11
|
+
slug: string;
|
|
12
|
+
subcollectionSlug: string;
|
|
13
|
+
url: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const CosmosMediaUrlSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
16
|
+
export declare const CosmosCollectionSchema: z.ZodObject<{
|
|
17
|
+
id: z.ZodEffects<z.ZodString, string, string>;
|
|
18
|
+
title: z.ZodString;
|
|
19
|
+
url: z.ZodEffects<z.ZodString, string, string>;
|
|
20
|
+
children: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
id: string;
|
|
23
|
+
url: string;
|
|
24
|
+
title: string;
|
|
25
|
+
children: string[];
|
|
26
|
+
}, {
|
|
27
|
+
id: string;
|
|
28
|
+
url: string;
|
|
29
|
+
title: string;
|
|
30
|
+
children: string[];
|
|
31
|
+
}>;
|
|
32
|
+
export declare const CosmosElementSchema: z.ZodObject<{
|
|
33
|
+
id: z.ZodEffects<z.ZodString, string, string>;
|
|
34
|
+
url: z.ZodString;
|
|
35
|
+
title: z.ZodString;
|
|
36
|
+
text: z.ZodString;
|
|
37
|
+
author: z.ZodNullable<z.ZodString>;
|
|
38
|
+
owner: z.ZodNullable<z.ZodString>;
|
|
39
|
+
sourceUrl: z.ZodNullable<z.ZodString>;
|
|
40
|
+
images: z.ZodArray<z.ZodObject<{
|
|
41
|
+
url: z.ZodEffects<z.ZodString, string, string>;
|
|
42
|
+
representation: z.ZodEnum<["image", "video-cover"]>;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
url: string;
|
|
45
|
+
representation: "image" | "video-cover";
|
|
46
|
+
}, {
|
|
47
|
+
url: string;
|
|
48
|
+
representation: "image" | "video-cover";
|
|
49
|
+
}>, "many">;
|
|
50
|
+
unsupportedReason: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
id: string;
|
|
53
|
+
text: string;
|
|
54
|
+
owner: string | null;
|
|
55
|
+
url: string;
|
|
56
|
+
title: string;
|
|
57
|
+
images: {
|
|
58
|
+
url: string;
|
|
59
|
+
representation: "image" | "video-cover";
|
|
60
|
+
}[];
|
|
61
|
+
author: string | null;
|
|
62
|
+
sourceUrl: string | null;
|
|
63
|
+
unsupportedReason?: string | undefined;
|
|
64
|
+
}, {
|
|
65
|
+
id: string;
|
|
66
|
+
text: string;
|
|
67
|
+
owner: string | null;
|
|
68
|
+
url: string;
|
|
69
|
+
title: string;
|
|
70
|
+
images: {
|
|
71
|
+
url: string;
|
|
72
|
+
representation: "image" | "video-cover";
|
|
73
|
+
}[];
|
|
74
|
+
author: string | null;
|
|
75
|
+
sourceUrl: string | null;
|
|
76
|
+
unsupportedReason?: string | undefined;
|
|
77
|
+
}>;
|
|
78
|
+
export declare const CosmosPageSchema: z.ZodObject<{
|
|
79
|
+
collection: z.ZodObject<{
|
|
80
|
+
id: z.ZodEffects<z.ZodString, string, string>;
|
|
81
|
+
title: z.ZodString;
|
|
82
|
+
url: z.ZodEffects<z.ZodString, string, string>;
|
|
83
|
+
children: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
|
|
84
|
+
}, "strip", z.ZodTypeAny, {
|
|
85
|
+
id: string;
|
|
86
|
+
url: string;
|
|
87
|
+
title: string;
|
|
88
|
+
children: string[];
|
|
89
|
+
}, {
|
|
90
|
+
id: string;
|
|
91
|
+
url: string;
|
|
92
|
+
title: string;
|
|
93
|
+
children: string[];
|
|
94
|
+
}>;
|
|
95
|
+
elements: z.ZodArray<z.ZodObject<{
|
|
96
|
+
id: z.ZodEffects<z.ZodString, string, string>;
|
|
97
|
+
url: z.ZodString;
|
|
98
|
+
title: z.ZodString;
|
|
99
|
+
text: z.ZodString;
|
|
100
|
+
author: z.ZodNullable<z.ZodString>;
|
|
101
|
+
owner: z.ZodNullable<z.ZodString>;
|
|
102
|
+
sourceUrl: z.ZodNullable<z.ZodString>;
|
|
103
|
+
images: z.ZodArray<z.ZodObject<{
|
|
104
|
+
url: z.ZodEffects<z.ZodString, string, string>;
|
|
105
|
+
representation: z.ZodEnum<["image", "video-cover"]>;
|
|
106
|
+
}, "strip", z.ZodTypeAny, {
|
|
107
|
+
url: string;
|
|
108
|
+
representation: "image" | "video-cover";
|
|
109
|
+
}, {
|
|
110
|
+
url: string;
|
|
111
|
+
representation: "image" | "video-cover";
|
|
112
|
+
}>, "many">;
|
|
113
|
+
unsupportedReason: z.ZodOptional<z.ZodString>;
|
|
114
|
+
}, "strip", z.ZodTypeAny, {
|
|
115
|
+
id: string;
|
|
116
|
+
text: string;
|
|
117
|
+
owner: string | null;
|
|
118
|
+
url: string;
|
|
119
|
+
title: string;
|
|
120
|
+
images: {
|
|
121
|
+
url: string;
|
|
122
|
+
representation: "image" | "video-cover";
|
|
123
|
+
}[];
|
|
124
|
+
author: string | null;
|
|
125
|
+
sourceUrl: string | null;
|
|
126
|
+
unsupportedReason?: string | undefined;
|
|
127
|
+
}, {
|
|
128
|
+
id: string;
|
|
129
|
+
text: string;
|
|
130
|
+
owner: string | null;
|
|
131
|
+
url: string;
|
|
132
|
+
title: string;
|
|
133
|
+
images: {
|
|
134
|
+
url: string;
|
|
135
|
+
representation: "image" | "video-cover";
|
|
136
|
+
}[];
|
|
137
|
+
author: string | null;
|
|
138
|
+
sourceUrl: string | null;
|
|
139
|
+
unsupportedReason?: string | undefined;
|
|
140
|
+
}>, "many">;
|
|
141
|
+
total: z.ZodNumber;
|
|
142
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
143
|
+
}, "strip", z.ZodTypeAny, {
|
|
144
|
+
collection: {
|
|
145
|
+
id: string;
|
|
146
|
+
url: string;
|
|
147
|
+
title: string;
|
|
148
|
+
children: string[];
|
|
149
|
+
};
|
|
150
|
+
elements: {
|
|
151
|
+
id: string;
|
|
152
|
+
text: string;
|
|
153
|
+
owner: string | null;
|
|
154
|
+
url: string;
|
|
155
|
+
title: string;
|
|
156
|
+
images: {
|
|
157
|
+
url: string;
|
|
158
|
+
representation: "image" | "video-cover";
|
|
159
|
+
}[];
|
|
160
|
+
author: string | null;
|
|
161
|
+
sourceUrl: string | null;
|
|
162
|
+
unsupportedReason?: string | undefined;
|
|
163
|
+
}[];
|
|
164
|
+
total: number;
|
|
165
|
+
nextCursor: string | null;
|
|
166
|
+
}, {
|
|
167
|
+
collection: {
|
|
168
|
+
id: string;
|
|
169
|
+
url: string;
|
|
170
|
+
title: string;
|
|
171
|
+
children: string[];
|
|
172
|
+
};
|
|
173
|
+
elements: {
|
|
174
|
+
id: string;
|
|
175
|
+
text: string;
|
|
176
|
+
owner: string | null;
|
|
177
|
+
url: string;
|
|
178
|
+
title: string;
|
|
179
|
+
images: {
|
|
180
|
+
url: string;
|
|
181
|
+
representation: "image" | "video-cover";
|
|
182
|
+
}[];
|
|
183
|
+
author: string | null;
|
|
184
|
+
sourceUrl: string | null;
|
|
185
|
+
unsupportedReason?: string | undefined;
|
|
186
|
+
}[];
|
|
187
|
+
total: number;
|
|
188
|
+
nextCursor: string | null;
|
|
189
|
+
}>;
|
|
190
|
+
export declare const CosmosResultSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
|
|
191
|
+
collection: z.ZodObject<{
|
|
192
|
+
id: z.ZodEffects<z.ZodString, string, string>;
|
|
193
|
+
title: z.ZodString;
|
|
194
|
+
url: z.ZodEffects<z.ZodString, string, string>;
|
|
195
|
+
children: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
|
|
196
|
+
}, "strip", z.ZodTypeAny, {
|
|
197
|
+
id: string;
|
|
198
|
+
url: string;
|
|
199
|
+
title: string;
|
|
200
|
+
children: string[];
|
|
201
|
+
}, {
|
|
202
|
+
id: string;
|
|
203
|
+
url: string;
|
|
204
|
+
title: string;
|
|
205
|
+
children: string[];
|
|
206
|
+
}>;
|
|
207
|
+
elements: z.ZodArray<z.ZodObject<{
|
|
208
|
+
id: z.ZodEffects<z.ZodString, string, string>;
|
|
209
|
+
url: z.ZodString;
|
|
210
|
+
title: z.ZodString;
|
|
211
|
+
text: z.ZodString;
|
|
212
|
+
author: z.ZodNullable<z.ZodString>;
|
|
213
|
+
owner: z.ZodNullable<z.ZodString>;
|
|
214
|
+
sourceUrl: z.ZodNullable<z.ZodString>;
|
|
215
|
+
images: z.ZodArray<z.ZodObject<{
|
|
216
|
+
url: z.ZodEffects<z.ZodString, string, string>;
|
|
217
|
+
representation: z.ZodEnum<["image", "video-cover"]>;
|
|
218
|
+
}, "strip", z.ZodTypeAny, {
|
|
219
|
+
url: string;
|
|
220
|
+
representation: "image" | "video-cover";
|
|
221
|
+
}, {
|
|
222
|
+
url: string;
|
|
223
|
+
representation: "image" | "video-cover";
|
|
224
|
+
}>, "many">;
|
|
225
|
+
unsupportedReason: z.ZodOptional<z.ZodString>;
|
|
226
|
+
}, "strip", z.ZodTypeAny, {
|
|
227
|
+
id: string;
|
|
228
|
+
text: string;
|
|
229
|
+
owner: string | null;
|
|
230
|
+
url: string;
|
|
231
|
+
title: string;
|
|
232
|
+
images: {
|
|
233
|
+
url: string;
|
|
234
|
+
representation: "image" | "video-cover";
|
|
235
|
+
}[];
|
|
236
|
+
author: string | null;
|
|
237
|
+
sourceUrl: string | null;
|
|
238
|
+
unsupportedReason?: string | undefined;
|
|
239
|
+
}, {
|
|
240
|
+
id: string;
|
|
241
|
+
text: string;
|
|
242
|
+
owner: string | null;
|
|
243
|
+
url: string;
|
|
244
|
+
title: string;
|
|
245
|
+
images: {
|
|
246
|
+
url: string;
|
|
247
|
+
representation: "image" | "video-cover";
|
|
248
|
+
}[];
|
|
249
|
+
author: string | null;
|
|
250
|
+
sourceUrl: string | null;
|
|
251
|
+
unsupportedReason?: string | undefined;
|
|
252
|
+
}>, "many">;
|
|
253
|
+
total: z.ZodNumber;
|
|
254
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
255
|
+
} & {
|
|
256
|
+
status: z.ZodLiteral<"ok">;
|
|
257
|
+
}, "strip", z.ZodTypeAny, {
|
|
258
|
+
status: "ok";
|
|
259
|
+
collection: {
|
|
260
|
+
id: string;
|
|
261
|
+
url: string;
|
|
262
|
+
title: string;
|
|
263
|
+
children: string[];
|
|
264
|
+
};
|
|
265
|
+
elements: {
|
|
266
|
+
id: string;
|
|
267
|
+
text: string;
|
|
268
|
+
owner: string | null;
|
|
269
|
+
url: string;
|
|
270
|
+
title: string;
|
|
271
|
+
images: {
|
|
272
|
+
url: string;
|
|
273
|
+
representation: "image" | "video-cover";
|
|
274
|
+
}[];
|
|
275
|
+
author: string | null;
|
|
276
|
+
sourceUrl: string | null;
|
|
277
|
+
unsupportedReason?: string | undefined;
|
|
278
|
+
}[];
|
|
279
|
+
total: number;
|
|
280
|
+
nextCursor: string | null;
|
|
281
|
+
}, {
|
|
282
|
+
status: "ok";
|
|
283
|
+
collection: {
|
|
284
|
+
id: string;
|
|
285
|
+
url: string;
|
|
286
|
+
title: string;
|
|
287
|
+
children: string[];
|
|
288
|
+
};
|
|
289
|
+
elements: {
|
|
290
|
+
id: string;
|
|
291
|
+
text: string;
|
|
292
|
+
owner: string | null;
|
|
293
|
+
url: string;
|
|
294
|
+
title: string;
|
|
295
|
+
images: {
|
|
296
|
+
url: string;
|
|
297
|
+
representation: "image" | "video-cover";
|
|
298
|
+
}[];
|
|
299
|
+
author: string | null;
|
|
300
|
+
sourceUrl: string | null;
|
|
301
|
+
unsupportedReason?: string | undefined;
|
|
302
|
+
}[];
|
|
303
|
+
total: number;
|
|
304
|
+
nextCursor: string | null;
|
|
305
|
+
}>, z.ZodObject<{
|
|
306
|
+
status: z.ZodLiteral<"error">;
|
|
307
|
+
message: z.ZodString;
|
|
308
|
+
reason: z.ZodOptional<z.ZodEnum<["rate_limited", "provider_unavailable", "collection_unavailable"]>>;
|
|
309
|
+
retryAfterMs: z.ZodOptional<z.ZodNumber>;
|
|
310
|
+
}, "strip", z.ZodTypeAny, {
|
|
311
|
+
message: string;
|
|
312
|
+
status: "error";
|
|
313
|
+
reason?: "rate_limited" | "provider_unavailable" | "collection_unavailable" | undefined;
|
|
314
|
+
retryAfterMs?: number | undefined;
|
|
315
|
+
}, {
|
|
316
|
+
message: string;
|
|
317
|
+
status: "error";
|
|
318
|
+
reason?: "rate_limited" | "provider_unavailable" | "collection_unavailable" | undefined;
|
|
319
|
+
retryAfterMs?: number | undefined;
|
|
320
|
+
}>]>;
|
|
321
|
+
export type CosmosPage = z.infer<typeof CosmosPageSchema>;
|
|
322
|
+
export type CosmosResult = z.infer<typeof CosmosResultSchema>;
|
|
323
|
+
export type CosmosElement = z.infer<typeof CosmosElementSchema>;
|
|
324
|
+
export interface CosmosFetchInput {
|
|
325
|
+
url: string;
|
|
326
|
+
collectionId?: string;
|
|
327
|
+
cursor?: string;
|
|
328
|
+
signal?: AbortSignal;
|
|
329
|
+
}
|
|
330
|
+
//# sourceMappingURL=cosmos.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cosmos.d.ts","sourceRoot":"","sources":["../../src/types/cosmos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,cAAc,2CAG8B,CAAC;AAC1D,eAAO,MAAM,kBAAkB,aAA8B,CAAC;AAC9D,eAAO,MAAM,qBAAqB,GAAI,OAAO,MAAM;;;CA8ClD,CAAC;AACF,eAAO,MAAM,sBAAsB,2CAc/B,CAAC;AACL,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM;;;;;CA0C3C,CAAC;AACF,eAAO,MAAM,oBAAoB,2CAY7B,CAAC;AACL,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;EAQjC,CAAC;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiB9B,CAAC;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAK3B,CAAC;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAU7B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CosmosResultSchema = exports.CosmosPageSchema = exports.CosmosElementSchema = exports.CosmosCollectionSchema = exports.CosmosMediaUrlSchema = exports.parseCosmosUrl = exports.CosmosProfileUrlSchema = exports.parseCosmosProfileUrl = exports.CosmosCursorSchema = exports.CosmosIdSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.CosmosIdSchema = zod_1.z
|
|
6
|
+
.string()
|
|
7
|
+
.regex(/^[1-9]\d{0,15}$/)
|
|
8
|
+
.refine((value) => Number.isSafeInteger(Number(value)));
|
|
9
|
+
exports.CosmosCursorSchema = zod_1.z.string().min(1).max(4096);
|
|
10
|
+
const parseCosmosProfileUrl = (value) => {
|
|
11
|
+
const fail = () => new Error('Use an HTTPS Cosmos profile URL such as https://www.cosmos.so/username');
|
|
12
|
+
let url;
|
|
13
|
+
try {
|
|
14
|
+
url = new URL(value);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
throw fail();
|
|
18
|
+
}
|
|
19
|
+
const segments = url.pathname.split('/').filter(Boolean);
|
|
20
|
+
if (url.protocol !== 'https:' ||
|
|
21
|
+
url.username ||
|
|
22
|
+
url.password ||
|
|
23
|
+
url.port ||
|
|
24
|
+
!['cosmos.so', 'www.cosmos.so'].includes(url.hostname) ||
|
|
25
|
+
segments.length !== 1)
|
|
26
|
+
throw fail();
|
|
27
|
+
let username;
|
|
28
|
+
try {
|
|
29
|
+
username = decodeURIComponent(segments[0]);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
throw fail();
|
|
33
|
+
}
|
|
34
|
+
if (!/^[a-zA-Z0-9_.-]{1,100}$/.test(username) ||
|
|
35
|
+
[
|
|
36
|
+
'e',
|
|
37
|
+
'login',
|
|
38
|
+
'signup',
|
|
39
|
+
'explore',
|
|
40
|
+
'search',
|
|
41
|
+
'collections',
|
|
42
|
+
'settings',
|
|
43
|
+
'api',
|
|
44
|
+
'profile',
|
|
45
|
+
].includes(username.toLowerCase()))
|
|
46
|
+
throw fail();
|
|
47
|
+
return {
|
|
48
|
+
username,
|
|
49
|
+
url: `https://www.cosmos.so/${encodeURIComponent(username)}`,
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
exports.parseCosmosProfileUrl = parseCosmosProfileUrl;
|
|
53
|
+
exports.CosmosProfileUrlSchema = zod_1.z
|
|
54
|
+
.string()
|
|
55
|
+
.max(2048)
|
|
56
|
+
.transform((value, context) => {
|
|
57
|
+
try {
|
|
58
|
+
return (0, exports.parseCosmosProfileUrl)(value).url;
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
context.addIssue({
|
|
62
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
63
|
+
message: error instanceof Error ? error.message : 'Invalid Cosmos profile URL',
|
|
64
|
+
});
|
|
65
|
+
return zod_1.z.NEVER;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
const parseCosmosUrl = (value) => {
|
|
69
|
+
const fail = () => new Error('Use an HTTPS Cosmos collection URL such as https://www.cosmos.so/owner/collection');
|
|
70
|
+
let url;
|
|
71
|
+
try {
|
|
72
|
+
url = new URL(value);
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
throw fail();
|
|
76
|
+
}
|
|
77
|
+
const segments = url.pathname.split('/').filter(Boolean);
|
|
78
|
+
if (url.protocol !== 'https:' ||
|
|
79
|
+
url.username ||
|
|
80
|
+
url.password ||
|
|
81
|
+
url.port ||
|
|
82
|
+
!['cosmos.so', 'www.cosmos.so'].includes(url.hostname) ||
|
|
83
|
+
segments.length < 2 ||
|
|
84
|
+
segments.length > 3 ||
|
|
85
|
+
segments[0] === 'e')
|
|
86
|
+
throw fail();
|
|
87
|
+
let decoded;
|
|
88
|
+
try {
|
|
89
|
+
decoded = segments.map((segment) => decodeURIComponent(segment));
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
throw fail();
|
|
93
|
+
}
|
|
94
|
+
if (decoded.some((segment) => !segment.length || segment.length > 300 || /[/\\\p{Cc}]/u.test(segment)))
|
|
95
|
+
throw fail();
|
|
96
|
+
return {
|
|
97
|
+
ownerUsername: decoded[0],
|
|
98
|
+
slug: decoded[1],
|
|
99
|
+
subcollectionSlug: decoded[2],
|
|
100
|
+
url: `https://www.cosmos.so/${decoded.map(encodeURIComponent).join('/')}`,
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
exports.parseCosmosUrl = parseCosmosUrl;
|
|
104
|
+
exports.CosmosMediaUrlSchema = zod_1.z
|
|
105
|
+
.string()
|
|
106
|
+
.url()
|
|
107
|
+
.refine((value) => {
|
|
108
|
+
const url = new URL(value);
|
|
109
|
+
return (url.protocol === 'https:' &&
|
|
110
|
+
url.hostname === 'cdn.cosmos.so' &&
|
|
111
|
+
!url.username &&
|
|
112
|
+
!url.password &&
|
|
113
|
+
!url.port);
|
|
114
|
+
});
|
|
115
|
+
exports.CosmosCollectionSchema = zod_1.z.object({
|
|
116
|
+
id: exports.CosmosIdSchema,
|
|
117
|
+
title: zod_1.z.string().min(1).max(500),
|
|
118
|
+
url: zod_1.z
|
|
119
|
+
.string()
|
|
120
|
+
.url()
|
|
121
|
+
.transform((value) => (0, exports.parseCosmosUrl)(value).url),
|
|
122
|
+
children: zod_1.z.array(exports.CosmosIdSchema),
|
|
123
|
+
});
|
|
124
|
+
exports.CosmosElementSchema = zod_1.z.object({
|
|
125
|
+
id: exports.CosmosIdSchema,
|
|
126
|
+
url: zod_1.z.string().url(),
|
|
127
|
+
title: zod_1.z.string().max(1000),
|
|
128
|
+
text: zod_1.z.string().max(100_000),
|
|
129
|
+
author: zod_1.z.string().nullable(),
|
|
130
|
+
owner: zod_1.z.string().nullable(),
|
|
131
|
+
sourceUrl: zod_1.z.string().url().nullable(),
|
|
132
|
+
images: zod_1.z
|
|
133
|
+
.array(zod_1.z.object({
|
|
134
|
+
url: exports.CosmosMediaUrlSchema,
|
|
135
|
+
representation: zod_1.z.enum(['image', 'video-cover']),
|
|
136
|
+
}))
|
|
137
|
+
.max(100),
|
|
138
|
+
unsupportedReason: zod_1.z.string().optional(),
|
|
139
|
+
});
|
|
140
|
+
exports.CosmosPageSchema = zod_1.z.object({
|
|
141
|
+
collection: exports.CosmosCollectionSchema,
|
|
142
|
+
elements: zod_1.z.array(exports.CosmosElementSchema),
|
|
143
|
+
total: zod_1.z.number().int().nonnegative(),
|
|
144
|
+
nextCursor: exports.CosmosCursorSchema.nullable(),
|
|
145
|
+
});
|
|
146
|
+
exports.CosmosResultSchema = zod_1.z.discriminatedUnion('status', [
|
|
147
|
+
exports.CosmosPageSchema.extend({ status: zod_1.z.literal('ok') }),
|
|
148
|
+
zod_1.z.object({
|
|
149
|
+
status: zod_1.z.literal('error'),
|
|
150
|
+
message: zod_1.z.string(),
|
|
151
|
+
reason: zod_1.z
|
|
152
|
+
.enum(['rate_limited', 'provider_unavailable', 'collection_unavailable'])
|
|
153
|
+
.optional(),
|
|
154
|
+
retryAfterMs: zod_1.z.number().nonnegative().optional(),
|
|
155
|
+
}),
|
|
156
|
+
]);
|
|
157
|
+
//# sourceMappingURL=cosmos.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cosmos.js","sourceRoot":"","sources":["../../src/types/cosmos.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAEX,QAAA,cAAc,GAAG,OAAC;KAC5B,MAAM,EAAE;KACR,KAAK,CAAC,iBAAiB,CAAC;KACxB,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC7C,QAAA,kBAAkB,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACvD,MAAM,qBAAqB,GAAG,CAAC,KAAa,EAAE,EAAE;IACrD,MAAM,IAAI,GAAG,GAAG,EAAE,CAChB,IAAI,KAAK,CACP,wEAAwE,CACzE,CAAC;IACJ,IAAI,GAAQ,CAAC;IACb,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,EAAE,CAAC;IACf,CAAC;IACD,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