@scalar/cli 2.0.1 → 2.5.1

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.
Files changed (83) hide show
  1. package/README.md +68 -24
  2. package/chunks/action-37EV4UHW.js +125 -0
  3. package/chunks/action-4XI7XJR4.js +204 -0
  4. package/chunks/action-5IU77OII.js +60 -0
  5. package/chunks/action-B3KKREWQ.js +64 -0
  6. package/chunks/action-CH24QGTE.js +86 -0
  7. package/chunks/action-F3UX5E3M.js +522 -0
  8. package/chunks/action-FDB7NEOK.js +81 -0
  9. package/chunks/action-FIXBOJEW.js +244 -0
  10. package/chunks/action-G26LSVZ7.js +40 -0
  11. package/chunks/action-H3RTILLM.js +46 -0
  12. package/chunks/action-HGBBV353.js +86 -0
  13. package/chunks/action-IUE4IOWO.js +2142 -0
  14. package/chunks/action-JZLZ7ZAD.js +110 -0
  15. package/chunks/action-LA6KVAXQ.js +374 -0
  16. package/chunks/action-M7RQKBSB.js +169 -0
  17. package/chunks/action-MSLBC2SO.js +92 -0
  18. package/chunks/action-NVSZT2ZD.js +37 -0
  19. package/chunks/action-OGQSTRMX.js +37 -0
  20. package/chunks/action-PAGJ5PWC.js +60 -0
  21. package/chunks/action-QE2ZQQX7.js +250 -0
  22. package/chunks/action-QPUSPD5M.js +54 -0
  23. package/chunks/action-R7IMFHQ5.js +147 -0
  24. package/chunks/action-SH4UUXPL.js +60 -0
  25. package/chunks/action-SNLCIBQC.js +84 -0
  26. package/chunks/action-SQG3JAII.js +150 -0
  27. package/chunks/action-UZQJNYK4.js +18 -0
  28. package/chunks/action-VC4DCVST.js +68 -0
  29. package/chunks/action-VTVFY2MP.js +181 -0
  30. package/chunks/action-WFWYGY7O.js +67 -0
  31. package/chunks/action-XMNX5ZYT.js +197 -0
  32. package/chunks/agent-HCQRMHQ5.js +132 -0
  33. package/chunks/asyncapi-QM76O55R.js +105 -0
  34. package/chunks/build.action-P7FCIMYU.js +108 -0
  35. package/chunks/chunk-24WAOKGG.js +105 -0
  36. package/chunks/chunk-3L6DLIXJ.js +25530 -0
  37. package/chunks/chunk-3MZYUBJ6.js +49 -0
  38. package/chunks/chunk-3ZJYGGAA.js +30 -0
  39. package/chunks/chunk-4NHMAG6F.js +21 -0
  40. package/chunks/chunk-4ORL4MST.js +16 -0
  41. package/chunks/chunk-4ZDQXWBT.js +26 -0
  42. package/chunks/chunk-6ZMT63IV.js +19 -0
  43. package/chunks/chunk-7AGLC7WV.js +107 -0
  44. package/chunks/chunk-AEFPCC4U.js +16 -0
  45. package/chunks/chunk-AO3F5XWR.js +3147 -0
  46. package/chunks/chunk-B2MHTD3R.js +90 -0
  47. package/chunks/chunk-CISTON3A.js +153 -0
  48. package/chunks/chunk-COBPBRQF.js +25 -0
  49. package/chunks/chunk-F467BYYR.js +568 -0
  50. package/chunks/chunk-GSGZHE26.js +352 -0
  51. package/chunks/chunk-HCPN3KNF.js +637 -0
  52. package/chunks/chunk-HPL3ZZ2P.js +1726 -0
  53. package/chunks/chunk-IKT5F47M.js +17344 -0
  54. package/chunks/chunk-JFIXNSPP.js +26 -0
  55. package/chunks/chunk-K4DTP5TV.js +32 -0
  56. package/chunks/chunk-K74E42RV.js +7311 -0
  57. package/chunks/chunk-KHDYYVYF.js +16 -0
  58. package/chunks/chunk-LFU5ZUAP.js +350 -0
  59. package/chunks/chunk-M37TP6U2.js +445 -0
  60. package/chunks/chunk-OQKDBLOZ.js +741 -0
  61. package/chunks/chunk-P7H7GY5A.js +14 -0
  62. package/chunks/chunk-PBXZN65A.js +63911 -0
  63. package/chunks/chunk-PT5TI77I.js +34 -0
  64. package/chunks/chunk-Q7DOQHZN.js +404 -0
  65. package/chunks/chunk-T5HJUAWB.js +242 -0
  66. package/chunks/chunk-T7B6WNZC.js +18 -0
  67. package/chunks/chunk-UGGNHILG.js +38 -0
  68. package/chunks/chunk-VNYE4R7N.js +499 -0
  69. package/chunks/chunk-X5T526CE.js +23 -0
  70. package/chunks/chunk-XCSR4RIT.js +210 -0
  71. package/chunks/chunk-Z2KMGFE6.js +295 -0
  72. package/chunks/create.action-HDD2WUON.js +108 -0
  73. package/chunks/delete.action-7GOZY7ID.js +88 -0
  74. package/chunks/delete.action-VE66JFDS.js +96 -0
  75. package/chunks/get.action-2745EB4N.js +86 -0
  76. package/chunks/list.action-3VTXQJRA.js +116 -0
  77. package/chunks/list.action-4QDCZLSZ.js +95 -0
  78. package/chunks/publish.action-ULQLZKWU.js +190 -0
  79. package/chunks/update.action-6QEFP7NA.js +95 -0
  80. package/chunks/update.action-OROQSP2S.js +101 -0
  81. package/docs.html +352 -250
  82. package/index.js +664 -99064
  83. package/package.json +17 -11
@@ -0,0 +1,34 @@
1
+ import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
+ import {
3
+ BaseCollections
4
+ } from "./chunk-F467BYYR.js";
5
+ import {
6
+ getDatabaseClient
7
+ } from "./chunk-Z2KMGFE6.js";
8
+ import {
9
+ publishRecordSchema
10
+ } from "./chunk-OQKDBLOZ.js";
11
+
12
+ // src/domains/project/deployments/get-deployments.ts
13
+ function orderDeployments(records) {
14
+ return records.filter((record) => !record.preview).sort((a, b) => b.createdAt - a.createdAt);
15
+ }
16
+ async function getProjectDeployments({
17
+ teamUid,
18
+ projectUid
19
+ }) {
20
+ const client = await getDatabaseClient();
21
+ const result = await client.getMany({
22
+ collectionPath: BaseCollections.PublishRecords(teamUid),
23
+ query: { projectUid },
24
+ schema: publishRecordSchema.array()
25
+ });
26
+ if (result.error) {
27
+ return { success: false, error: result.message };
28
+ }
29
+ return { success: true, deployments: orderDeployments(result.data) };
30
+ }
31
+
32
+ export {
33
+ getProjectDeployments
34
+ };
@@ -0,0 +1,404 @@
1
+ import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
+ import {
3
+ methodSchema
4
+ } from "./chunk-GSGZHE26.js";
5
+ import {
6
+ brandedUid,
7
+ docVersionSchema,
8
+ entitySchema,
9
+ external_exports,
10
+ mintUid,
11
+ namespaceSchema,
12
+ nanoidSchema,
13
+ randomManagedDocSlug,
14
+ scalarSet,
15
+ slugSchema,
16
+ timestampSchema
17
+ } from "./chunk-IKT5F47M.js";
18
+
19
+ // ../../packages/entities/dist/registry/instance.js
20
+ var contentShaSchema = external_exports.string().regex(/^[a-f0-9]{64}$/, "Content sha must be a sha-256 hex digest");
21
+ var docInstanceSourceSchema = external_exports.enum(["manual", "cli", "api", "git-sync", "url-sync", "migration"]).meta({ id: "doc-instance-source" });
22
+ var docInstanceOriginSchema = external_exports.discriminatedUnion("type", [
23
+ external_exports.object({ type: external_exports.literal("platform") }),
24
+ external_exports.object({
25
+ type: external_exports.literal("git"),
26
+ /**
27
+ * Commit that carried this content. Null when the content landed but the
28
+ * commit did not — the mirror is best-effort and can be switched off.
29
+ */
30
+ commitSha: external_exports.string().nullable().default(null),
31
+ /** Branch this content was committed on. Null for direct-to-published writes. */
32
+ branch: external_exports.string().nullable().default(null),
33
+ /**
34
+ * A platform edit to a git-sourced document that went out as a pull
35
+ * request. Open while `resolution` is null; the webhook stamps `merged`
36
+ * or `closed` when the pull request settles, so "does this document have
37
+ * an open proposal" is answerable from the log alone. The row itself is
38
+ * append-only history — a merged proposal's content re-enters the log as
39
+ * a fresh instance via the merge push.
40
+ */
41
+ draft: external_exports.object({
42
+ prNumber: external_exports.number(),
43
+ branch: external_exports.string(),
44
+ /** How the pull request settled; null while it is still open. */
45
+ resolution: external_exports.enum(["merged", "closed"]).nullable().default(null)
46
+ }).nullable().default(null)
47
+ }),
48
+ external_exports.object({
49
+ type: external_exports.literal("url"),
50
+ /** Upstream this content was fetched from. */
51
+ url: external_exports.url()
52
+ })
53
+ ]).meta({ id: "doc-instance-origin" });
54
+ var docInstanceSchema = entitySchema.extend({
55
+ /** Own uid, branded so it cannot be confused with another entity's uid */
56
+ uid: brandedUid().default(mintUid).meta({ default: "nanoid()" }),
57
+ /** Version label the content declared (info.version) or the caller supplied */
58
+ version: docVersionSchema,
59
+ /**
60
+ * SHA-256 hex digest of the serialized JSON — the single content identity.
61
+ * Blob keys for BOTH formats derive from it: `blobs/<jsonSha>.json` and
62
+ * `blobs/<jsonSha>.yaml`.
63
+ */
64
+ jsonSha: contentShaSchema,
65
+ /**
66
+ * SHA-256 hex digest of the serialized YAML twin. Integrity metadata for
67
+ * verifying served YAML bytes — never a storage key.
68
+ */
69
+ yamlSha: contentShaSchema,
70
+ /** User uid or email that produced this content. Null for system syncs. */
71
+ uploadedBy: external_exports.string().nullable().default(null),
72
+ /** The channel that triggered the write */
73
+ source: docInstanceSourceSchema,
74
+ /** Where the bytes came from; platform-native unless a git or url source supplied them */
75
+ origin: docInstanceOriginSchema.default({ type: "platform" }),
76
+ /** Free-form commit-style message supplied by the writer */
77
+ message: external_exports.string().default(""),
78
+ /**
79
+ * Lineage pointers recorded from day one so instances form a DAG. Branch
80
+ * and merge flows build on this; backfilling parents later would be far
81
+ * more expensive than stamping them now.
82
+ */
83
+ parentInstanceUid: brandedUid().nullable().default(null),
84
+ /** Second parent for merge commits */
85
+ mergeParentUid: brandedUid().nullable().default(null),
86
+ /**
87
+ * The instance this one reverts to. Set only by rollback, which appends a
88
+ * new instance carrying the target's content hashes rather than mutating
89
+ * any pointer — so history renders "reverted to X" without diffing hashes,
90
+ * and the chain stays append-only.
91
+ */
92
+ revertOf: brandedUid().nullable().default(null),
93
+ /**
94
+ * Denormalized serving eligibility, stamped false only on draft instances.
95
+ * Exists solely for the chain's unique-parent index: Mongo partial indexes
96
+ * cannot express "origin.draft is null or missing", so eligibility needs a
97
+ * stored equality field. {@link isServingEligibleInstance} (origin-derived)
98
+ * stays the read-side authority; this field is never read by resolvers.
99
+ */
100
+ servable: external_exports.boolean().default(true)
101
+ }).meta({ id: "doc-instance" });
102
+
103
+ // ../../packages/entities/dist/registry/schema.js
104
+ var RegistryAsset;
105
+ (function(RegistryAsset2) {
106
+ RegistryAsset2["Apis"] = "apis";
107
+ RegistryAsset2["Rules"] = "rules";
108
+ RegistryAsset2["Schemas"] = "schemas";
109
+ RegistryAsset2["Sdks"] = "sdks";
110
+ RegistryAsset2["Workspaces"] = "workspaces";
111
+ })(RegistryAsset || (RegistryAsset = {}));
112
+ var RegistryResourceTypes = [
113
+ RegistryAsset.Apis,
114
+ RegistryAsset.Schemas,
115
+ RegistryAsset.Rules,
116
+ RegistryAsset.Sdks,
117
+ RegistryAsset.Workspaces
118
+ ];
119
+ var registryAssetSchema = external_exports.enum(RegistryAsset).meta({ id: "registry-asset" });
120
+ var registryGitExternalSchema = external_exports.discriminatedUnion("provider", [
121
+ external_exports.object({
122
+ provider: external_exports.literal("github"),
123
+ linkedBy: external_exports.string(),
124
+ installationId: external_exports.number().int(),
125
+ id: external_exports.number().int(),
126
+ name: external_exports.string().min(2),
127
+ branch: external_exports.string().default("main"),
128
+ /** Where the canonical file lives inside the linked repo. */
129
+ path: external_exports.string().default(""),
130
+ webhookId: external_exports.string().default("")
131
+ }),
132
+ external_exports.object({
133
+ provider: external_exports.literal("bitbucket"),
134
+ linkedBy: external_exports.string(),
135
+ workspaceUuid: external_exports.string(),
136
+ workspaceSlug: external_exports.string(),
137
+ repoUuid: external_exports.string(),
138
+ repoSlug: external_exports.string(),
139
+ name: external_exports.string().min(2),
140
+ branch: external_exports.string().default("main"),
141
+ webhookUuid: external_exports.string().default("")
142
+ })
143
+ ]).meta({ id: "registry-git-external" });
144
+ var registryGitBindingSchema = external_exports.object({
145
+ forgejo: external_exports.object({
146
+ owner: external_exports.string(),
147
+ repo: external_exports.string(),
148
+ branch: external_exports.string().default("main")
149
+ }),
150
+ /** Publish when a commit lands on the tracked branch. */
151
+ publishOnPush: external_exports.boolean().default(true),
152
+ /** Publish when a pull request is merged. */
153
+ publishOnMerge: external_exports.boolean().default(false),
154
+ trackedBranch: external_exports.string().default("main"),
155
+ /** Forgejo webhook id, so it can be updated or removed. */
156
+ webhookId: external_exports.number().nullable().default(null),
157
+ external: registryGitExternalSchema.nullable().default(null),
158
+ /** The commit currently served as the published state. */
159
+ currentPublishedSha: external_exports.string().nullable().default(null),
160
+ lastPublishedAt: timestampSchema.nullable().default(null)
161
+ }).meta({ id: "registry-git-binding" });
162
+ var docSourceSchema = external_exports.discriminatedUnion("type", [
163
+ external_exports.object({ type: external_exports.literal("platform") }),
164
+ external_exports.object({
165
+ type: external_exports.literal("git"),
166
+ /** The team's linked repository this document sources from. */
167
+ repositoryUid: nanoidSchema.brand(),
168
+ /** Where the canonical file lives inside the repository. */
169
+ path: external_exports.string().min(1),
170
+ /**
171
+ * The branch publishes track and pull requests target. Null follows the
172
+ * repository's default branch.
173
+ */
174
+ branch: external_exports.string().nullable().default(null),
175
+ /** Publish when a commit lands on the tracked branch. */
176
+ publishOnPush: external_exports.boolean().default(true),
177
+ /** Publish when a pull request merges into the tracked branch. */
178
+ publishOnMerge: external_exports.boolean().default(false),
179
+ /**
180
+ * The commit currently served as the published state. Advanced by
181
+ * compare-and-swap so redelivered webhooks and racing publishes cannot
182
+ * interleave the publish log and the pointer.
183
+ */
184
+ currentPublishedSha: external_exports.string().nullable().default(null),
185
+ lastPublishedAt: timestampSchema.nullable().default(null)
186
+ }),
187
+ external_exports.object({
188
+ type: external_exports.literal("url"),
189
+ url: external_exports.url(),
190
+ linkedBy: external_exports.string(),
191
+ /** ETag from the last fetch so refreshes can use If-None-Match */
192
+ etag: external_exports.string().nullable().default(null),
193
+ lastFetchedAt: timestampSchema.nullable().default(null)
194
+ })
195
+ ]).meta({ id: "doc-source" });
196
+ var baseRegistrySchema = entitySchema.extend({
197
+ /** Team namespace - not linked by UID */
198
+ namespace: namespaceSchema,
199
+ /** UI label for registry item */
200
+ title: external_exports.string().max(100).default(""),
201
+ /** Unique configuration identifier */
202
+ slug: slugSchema.default(randomManagedDocSlug).meta({ default: "randomManagedDocSlug()" }),
203
+ /** Extended description for registry item */
204
+ description: external_exports.string().default(""),
205
+ /** Public accessibility */
206
+ isPrivate: external_exports.boolean().default(false),
207
+ /**
208
+ * Surfaced ahead of the rest of the list on the namespace's registry page.
209
+ * A record only ever belongs to one namespace, so this needs no target.
210
+ */
211
+ pinned: external_exports.boolean().default(false),
212
+ /** Grouping/identifier tags */
213
+ tags: scalarSet(external_exports.set(external_exports.string()).max(100)).default([]),
214
+ /** Access groups for private access permissions */
215
+ accessGroups: scalarSet(external_exports.set(nanoidSchema).max(50)).default([]),
216
+ /** The uid of the login portal customization object for private documents */
217
+ loginPortalUid: external_exports.string().optional(),
218
+ /** Whether the content has been scanned and confirmed to not to contain malicious content */
219
+ verifiedContent: external_exports.boolean().optional(),
220
+ /**
221
+ * Where this document's content is authored. Records written before this
222
+ * field existed omit it and read back as platform-native.
223
+ *
224
+ * Kept a plain `.default()` rather than a `.nullish().transform()` that
225
+ * would also absorb a stored `null`: the API framework drops piped fields
226
+ * from generated response types, so a transform here erases `source` from
227
+ * every registry response. Nothing writes `null`, so write it as `undefined`
228
+ * (omit the field) rather than reintroducing the pipe.
229
+ */
230
+ source: docSourceSchema.default({ type: "platform" }),
231
+ /**
232
+ * @deprecated Forgejo registry backing is being retired in favor of
233
+ * content-addressed GCS blobs + the instance log. Use `source` for the
234
+ * external-repo link. Dropped once the backfill is verified.
235
+ */
236
+ git: registryGitBindingSchema.nullable().optional()
237
+ }).meta({ id: "base-registry" });
238
+
239
+ // ../../packages/entities/dist/registry/migration.js
240
+ var registryGitMigrationResourceSchema = external_exports.object({
241
+ asset: registryAssetSchema,
242
+ namespace: namespaceSchema,
243
+ slug: slugSchema,
244
+ resourceUid: nanoidSchema,
245
+ status: external_exports.enum([
246
+ "migrated",
247
+ "already-migrated",
248
+ "partial",
249
+ "would-migrate",
250
+ "error"
251
+ ]),
252
+ versionsImported: external_exports.number().default(0),
253
+ versionsSkipped: external_exports.number().default(0),
254
+ error: external_exports.string().default("")
255
+ });
256
+ var registryGitMigrationStatusSchema = external_exports.enum([
257
+ "running",
258
+ "complete",
259
+ "partial",
260
+ "failed"
261
+ ]);
262
+ var registryGitMigrationSchema = entitySchema.extend({
263
+ teamUid: brandedUid(),
264
+ dryRun: external_exports.boolean().default(false),
265
+ status: registryGitMigrationStatusSchema,
266
+ /**
267
+ * While `running`, the unix time after which the lease is considered
268
+ * abandoned and another run may take over. Renewed as the run progresses, so
269
+ * it only lapses when the run really stopped (a crash, a killed pod) rather
270
+ * than because the work took a while. Zero once the run has finished.
271
+ */
272
+ lockedUntil: external_exports.number().default(0),
273
+ resources: registryGitMigrationResourceSchema.array().default([])
274
+ }).meta({ id: "registry-git-migration" });
275
+
276
+ // ../../packages/entities/dist/registry/publish.js
277
+ var registryPublishSourceSchema = external_exports.enum(["manual", "git-hook", "external-push", "migration"]).meta({ id: "registry-publish-source" });
278
+ var registryPublishAuthorSchema = external_exports.object({
279
+ name: external_exports.string(),
280
+ email: external_exports.string()
281
+ });
282
+ var registryPublishRecordSchema = entitySchema.extend({
283
+ resourceUid: nanoidSchema,
284
+ asset: registryAssetSchema,
285
+ namespace: namespaceSchema,
286
+ slug: slugSchema,
287
+ /** Null for unversioned resources (rules). */
288
+ version: docVersionSchema.nullable().default(null),
289
+ commitSha: external_exports.string(),
290
+ parentSha: external_exports.string().nullable().default(null),
291
+ source: registryPublishSourceSchema,
292
+ message: external_exports.string().default(""),
293
+ author: registryPublishAuthorSchema.nullable().default(null)
294
+ }).meta({ id: "registry-publish" });
295
+
296
+ // ../../packages/entities/dist/registry/version.js
297
+ var docVersionToolSchema = external_exports.object({
298
+ path: external_exports.string(),
299
+ method: methodSchema,
300
+ enabledTools: external_exports.enum(["execute-request", "get-mini-openapi-spec"]).array()
301
+ });
302
+ var docEmbedStatusSchema = external_exports.enum(["complete", "failed"]);
303
+ var docVersionRecordSchema = entitySchema.extend({
304
+ /** Own uid, branded so it cannot be confused with another entity's uid */
305
+ uid: brandedUid().default(mintUid).meta({ default: "nanoid()" }),
306
+ version: docVersionSchema,
307
+ /** OpenAPI version normalized on upload */
308
+ upgraded: external_exports.boolean().default(false),
309
+ /**
310
+ * Endpoints (path + method pairs) counted from the document at ingest.
311
+ * Null when the count is unknown: rows minted before this field existed,
312
+ * heal-path rows created without a fresh parse, and non-OpenAPI documents.
313
+ * Feeds the included-SDK-size display; measure-and-warn only.
314
+ */
315
+ endpointCount: external_exports.number().int().nullable().default(null),
316
+ embedStatus: docEmbedStatusSchema.nullable().default(null),
317
+ tags: external_exports.string().array().default([]),
318
+ /**
319
+ * Null is a legitimate stored state, not just absence: zod keeps optional
320
+ * keys explicitly passed as `undefined`, and a driver without
321
+ * `ignoreUndefined` stores those as BSON null. Records written that way
322
+ * carry `tools: null`, and rejecting it silently drops the whole record
323
+ * from egress — so null parses like "no tools configured".
324
+ */
325
+ tools: docVersionToolSchema.array().nullish()
326
+ }).meta({ id: "doc-version-record" });
327
+
328
+ // ../../packages/entities/dist/registry/pages.js
329
+ var PAGES_SCHEMA_VERSION = 1;
330
+ var pagesNavigationEntrySchema = external_exports.looseObject({
331
+ id: external_exports.string(),
332
+ title: external_exports.string().default(""),
333
+ type: external_exports.string(),
334
+ get children() {
335
+ return external_exports.array(pagesNavigationEntrySchema).optional();
336
+ }
337
+ });
338
+ var pagesEntrySchema = external_exports.object({
339
+ /** The navigation entry's `type`, e.g. `operation`, `webhook`, `model`. */
340
+ type: external_exports.string(),
341
+ method: external_exports.string().optional(),
342
+ path: external_exports.string().optional(),
343
+ /** JSON pointer the entry renders, for the entry types that carry one. */
344
+ ref: external_exports.string().optional()
345
+ }).meta({ id: "pages-entry" });
346
+ var pagesCountsSchema = external_exports.object({
347
+ operations: external_exports.number().int().min(0).default(0),
348
+ webhooks: external_exports.number().int().min(0).default(0),
349
+ models: external_exports.number().int().min(0).default(0),
350
+ tags: external_exports.number().int().min(0).default(0),
351
+ /** Objects written under `chunks/`, which is every entry with a page. */
352
+ chunks: external_exports.number().int().min(0).default(0)
353
+ }).meta({ id: "pages-counts" });
354
+ var pagesManifestSchema = external_exports.object({
355
+ schemaVersion: external_exports.literal(PAGES_SCHEMA_VERSION),
356
+ /** Content identity of the instance this sidecar was derived from. */
357
+ jsonSha: contentShaSchema,
358
+ producedAt: timestampSchema,
359
+ counts: pagesCountsSchema,
360
+ /**
361
+ * The document with its operation-bearing buckets emptied — the base every
362
+ * page starts from, before its own chunk is merged in.
363
+ */
364
+ stripped: external_exports.record(external_exports.string(), external_exports.unknown()),
365
+ /**
366
+ * The navigation tree, with the Models group's children dropped: a large
367
+ * document has thousands of them, and they are served separately by
368
+ * `pagesModels` on first expand.
369
+ */
370
+ navigation: external_exports.array(pagesNavigationEntrySchema),
371
+ /** Navigation id to what it renders, for routing without walking the tree. */
372
+ entries: external_exports.record(external_exports.string(), pagesEntrySchema)
373
+ }).meta({ id: "pages-manifest" });
374
+ var pagesPreparingSchema = external_exports.object({
375
+ jsonSha: contentShaSchema,
376
+ claimedAt: timestampSchema,
377
+ /** Which producer holds the claim, so a stale takeover is attributable. */
378
+ instance: external_exports.string().default("")
379
+ }).meta({ id: "pages-preparing" });
380
+ var pagesFailedSchema = external_exports.object({
381
+ jsonSha: contentShaSchema,
382
+ failedAt: timestampSchema,
383
+ /** Operator-facing reason; surfaced to the client only as a failure. */
384
+ error: external_exports.string().default("")
385
+ }).meta({ id: "pages-failed" });
386
+
387
+ // ../../packages/entities/dist/registry/token.js
388
+ var registryTokenPayloadSchema = external_exports.object({
389
+ /** The team whose registry documents this token may read. */
390
+ teamUid: nanoidSchema,
391
+ exp: external_exports.number().int()
392
+ }).meta({ id: "registry-token-payload" });
393
+
394
+ export {
395
+ contentShaSchema,
396
+ docInstanceSchema,
397
+ RegistryResourceTypes,
398
+ registryGitBindingSchema,
399
+ docSourceSchema,
400
+ baseRegistrySchema,
401
+ registryPublishRecordSchema,
402
+ docVersionToolSchema,
403
+ docVersionRecordSchema
404
+ };
@@ -0,0 +1,242 @@
1
+ import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
+
3
+ // src/helpers/std-out/print-table.ts
4
+ import { Table } from "console-table-printer";
5
+ var printTable = (columns, rows) => {
6
+ const table2 = new Table({ columns });
7
+ for (const row of rows) {
8
+ table2.addRow(row);
9
+ }
10
+ table2.printTable();
11
+ };
12
+
13
+ // src/helpers/std-out/output.ts
14
+ import as from "ansis";
15
+ import UpdateManager from "stdout-update";
16
+
17
+ // ../../node_modules/.pnpm/ansi-regex@6.2.2/node_modules/ansi-regex/index.js
18
+ function ansiRegex({ onlyFirst = false } = {}) {
19
+ const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
20
+ const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
21
+ const csi = "[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";
22
+ const pattern = `${osc}|${csi}`;
23
+ return new RegExp(pattern, onlyFirst ? void 0 : "g");
24
+ }
25
+
26
+ // ../../node_modules/.pnpm/strip-ansi@7.2.0/node_modules/strip-ansi/index.js
27
+ var regex = ansiRegex();
28
+ function stripAnsi(string) {
29
+ if (typeof string !== "string") {
30
+ throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
31
+ }
32
+ if (!string.includes("\x1B") && !string.includes("\x9B")) {
33
+ return string;
34
+ }
35
+ return string.replace(regex, "");
36
+ }
37
+
38
+ // src/helpers/std-out/table.ts
39
+ var table = (data, options) => {
40
+ let maxCols = 0;
41
+ data.forEach((row) => {
42
+ if (row.length > maxCols) {
43
+ maxCols = row.length;
44
+ }
45
+ });
46
+ const maxLengths = new Array(maxCols).fill(0);
47
+ for (const i of data.keys()) {
48
+ for (const j of data[i].keys()) {
49
+ if (stripAnsi(data[i][j]).length > maxLengths[j]) {
50
+ maxLengths[j] = stripAnsi(data[i][j]).length;
51
+ }
52
+ }
53
+ }
54
+ for (const row of data) {
55
+ for (const [index, col] of row.entries()) {
56
+ const lengthDiff = col.length - stripAnsi(col).length;
57
+ row[index] = col.padEnd(
58
+ maxLengths[index] + (options?.padding ?? 1) + lengthDiff
59
+ );
60
+ }
61
+ }
62
+ };
63
+
64
+ // src/helpers/std-out/output.ts
65
+ var levelColors = {
66
+ info: (s) => s,
67
+ warn: as.yellow,
68
+ error: as.red
69
+ };
70
+ var levelPrefixes = {
71
+ info: "",
72
+ warn: "[WARN]",
73
+ error: "[ERROR]"
74
+ };
75
+ var stdoutManager;
76
+ var stderrManager;
77
+ function getManager(level) {
78
+ if (level === "error") {
79
+ if (!stderrManager) {
80
+ stderrManager = new UpdateManager(process.stderr, process.stderr);
81
+ }
82
+ return stderrManager;
83
+ }
84
+ if (!stdoutManager) {
85
+ stdoutManager = new UpdateManager(
86
+ process.stdout,
87
+ process.stdout
88
+ );
89
+ }
90
+ return stdoutManager;
91
+ }
92
+ var outputFactory = (level) => (options) => {
93
+ const titlePrefix = levelPrefixes[level];
94
+ const cl = levelColors[level];
95
+ const manager = getManager(level);
96
+ const stream = level === "error" ? process.stderr : process.stdout;
97
+ const state = [];
98
+ let i = 0;
99
+ const frames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
100
+ function update(complete) {
101
+ i += 1;
102
+ manager.update(
103
+ state.map((it) => {
104
+ if (it.type === "title") {
105
+ return cl(as.bold(`${titlePrefix} ${it.content}`));
106
+ }
107
+ if (it.type === "loader") {
108
+ if (!complete) {
109
+ return cl(`${frames[i % frames.length]} ${it.content}`);
110
+ }
111
+ return it.status === "error" ? as.red(`\u2716 ${it.content}`) : cl(`\u2714 ${it.content}`);
112
+ }
113
+ if (it.type === "table") {
114
+ return it.content.map((it2) => cl(it2.join(""))).join("\n");
115
+ }
116
+ return cl(it.content);
117
+ })
118
+ );
119
+ }
120
+ manager.hook();
121
+ const interval = setInterval(() => {
122
+ update();
123
+ }, options?.frameRate ?? 100);
124
+ function end() {
125
+ update(true);
126
+ stream.write("");
127
+ manager.unhook();
128
+ clearInterval(interval);
129
+ return { state };
130
+ }
131
+ return {
132
+ /** Current list of std-out state objects */
133
+ state,
134
+ /** Display a formatted title */
135
+ title: function(title) {
136
+ state.push({
137
+ type: "title",
138
+ content: title
139
+ });
140
+ return this;
141
+ },
142
+ /** Display a new line with the provided content */
143
+ line: function(content) {
144
+ state.push({
145
+ type: "line",
146
+ content: content ?? ""
147
+ });
148
+ return this;
149
+ },
150
+ /** Display a message with a line above and below */
151
+ message: function(content) {
152
+ state.push(
153
+ {
154
+ type: "line",
155
+ content: ""
156
+ },
157
+ {
158
+ type: "line",
159
+ content: content ?? ""
160
+ },
161
+ {
162
+ type: "line",
163
+ content: ""
164
+ }
165
+ );
166
+ return this;
167
+ },
168
+ /** Display a loader with a message alongside. */
169
+ loader: function(content) {
170
+ state.push({
171
+ type: "loader",
172
+ content: content ?? ""
173
+ });
174
+ return this;
175
+ },
176
+ /**
177
+ * Update a specific line of a specific type
178
+ * Only works when animate is set to true
179
+ */
180
+ update: function(type, index, values) {
181
+ const operation = state.filter((it) => it.type === type)[index];
182
+ if (operation) {
183
+ Object.assign(operation, values);
184
+ }
185
+ if (operation.type === "table") {
186
+ table(operation.content, operation.options);
187
+ }
188
+ return this;
189
+ },
190
+ /**
191
+ * Delete a specific line of a specific type
192
+ * Only works when the animate is set to true
193
+ */
194
+ delete: function(type, index) {
195
+ let count = 0;
196
+ for (let i2 = 0; i2 < state.length; i2++) {
197
+ if (state[i2].type === type) {
198
+ if (count === index) {
199
+ state.splice(i2, 1);
200
+ return;
201
+ }
202
+ count++;
203
+ }
204
+ }
205
+ return this;
206
+ },
207
+ /** Display a table that handles padding column widths automatically */
208
+ table: function(data, opt) {
209
+ table(data, opt);
210
+ state.push({
211
+ type: "table",
212
+ content: data,
213
+ options: opt
214
+ });
215
+ return this;
216
+ },
217
+ /** Print the current state to the console */
218
+ print: end,
219
+ /**
220
+ * Finish a log block and unhook from the std-out manager
221
+ * This closes out a running animation
222
+ */
223
+ finish: end,
224
+ /** Exit the process with a success code */
225
+ exit: (code) => {
226
+ end();
227
+ return process.exit(code === "error" ? 1 : 0);
228
+ }
229
+ };
230
+ };
231
+
232
+ // src/helpers/std-out/index.ts
233
+ var output = {
234
+ error: outputFactory("error"),
235
+ warn: outputFactory("warn"),
236
+ info: outputFactory("info")
237
+ };
238
+
239
+ export {
240
+ printTable,
241
+ output
242
+ };
@@ -0,0 +1,18 @@
1
+ import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
+
3
+ // src/domains/project/resolve-project.ts
4
+ async function resolveProject(slug, apiClient) {
5
+ const githubResult = await apiClient.github.getProject(slug);
6
+ if (!githubResult.error) {
7
+ return { kind: "github", project: githubResult.data };
8
+ }
9
+ const docsResult = await apiClient.docsProject.getProject(slug);
10
+ if (!docsResult.error) {
11
+ return { kind: "docs", project: docsResult.data };
12
+ }
13
+ return { kind: "not-found" };
14
+ }
15
+
16
+ export {
17
+ resolveProject
18
+ };