@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.
- package/README.md +68 -24
- package/chunks/action-37EV4UHW.js +125 -0
- package/chunks/action-4XI7XJR4.js +204 -0
- package/chunks/action-5IU77OII.js +60 -0
- package/chunks/action-B3KKREWQ.js +64 -0
- package/chunks/action-CH24QGTE.js +86 -0
- package/chunks/action-F3UX5E3M.js +522 -0
- package/chunks/action-FDB7NEOK.js +81 -0
- package/chunks/action-FIXBOJEW.js +244 -0
- package/chunks/action-G26LSVZ7.js +40 -0
- package/chunks/action-H3RTILLM.js +46 -0
- package/chunks/action-HGBBV353.js +86 -0
- package/chunks/action-IUE4IOWO.js +2142 -0
- package/chunks/action-JZLZ7ZAD.js +110 -0
- package/chunks/action-LA6KVAXQ.js +374 -0
- package/chunks/action-M7RQKBSB.js +169 -0
- package/chunks/action-MSLBC2SO.js +92 -0
- package/chunks/action-NVSZT2ZD.js +37 -0
- package/chunks/action-OGQSTRMX.js +37 -0
- package/chunks/action-PAGJ5PWC.js +60 -0
- package/chunks/action-QE2ZQQX7.js +250 -0
- package/chunks/action-QPUSPD5M.js +54 -0
- package/chunks/action-R7IMFHQ5.js +147 -0
- package/chunks/action-SH4UUXPL.js +60 -0
- package/chunks/action-SNLCIBQC.js +84 -0
- package/chunks/action-SQG3JAII.js +150 -0
- package/chunks/action-UZQJNYK4.js +18 -0
- package/chunks/action-VC4DCVST.js +68 -0
- package/chunks/action-VTVFY2MP.js +181 -0
- package/chunks/action-WFWYGY7O.js +67 -0
- package/chunks/action-XMNX5ZYT.js +197 -0
- package/chunks/agent-HCQRMHQ5.js +132 -0
- package/chunks/asyncapi-QM76O55R.js +105 -0
- package/chunks/build.action-P7FCIMYU.js +108 -0
- package/chunks/chunk-24WAOKGG.js +105 -0
- package/chunks/chunk-3L6DLIXJ.js +25530 -0
- package/chunks/chunk-3MZYUBJ6.js +49 -0
- package/chunks/chunk-3ZJYGGAA.js +30 -0
- package/chunks/chunk-4NHMAG6F.js +21 -0
- package/chunks/chunk-4ORL4MST.js +16 -0
- package/chunks/chunk-4ZDQXWBT.js +26 -0
- package/chunks/chunk-6ZMT63IV.js +19 -0
- package/chunks/chunk-7AGLC7WV.js +107 -0
- package/chunks/chunk-AEFPCC4U.js +16 -0
- package/chunks/chunk-AO3F5XWR.js +3147 -0
- package/chunks/chunk-B2MHTD3R.js +90 -0
- package/chunks/chunk-CISTON3A.js +153 -0
- package/chunks/chunk-COBPBRQF.js +25 -0
- package/chunks/chunk-F467BYYR.js +568 -0
- package/chunks/chunk-GSGZHE26.js +352 -0
- package/chunks/chunk-HCPN3KNF.js +637 -0
- package/chunks/chunk-HPL3ZZ2P.js +1726 -0
- package/chunks/chunk-IKT5F47M.js +17344 -0
- package/chunks/chunk-JFIXNSPP.js +26 -0
- package/chunks/chunk-K4DTP5TV.js +32 -0
- package/chunks/chunk-K74E42RV.js +7311 -0
- package/chunks/chunk-KHDYYVYF.js +16 -0
- package/chunks/chunk-LFU5ZUAP.js +350 -0
- package/chunks/chunk-M37TP6U2.js +445 -0
- package/chunks/chunk-OQKDBLOZ.js +741 -0
- package/chunks/chunk-P7H7GY5A.js +14 -0
- package/chunks/chunk-PBXZN65A.js +63911 -0
- package/chunks/chunk-PT5TI77I.js +34 -0
- package/chunks/chunk-Q7DOQHZN.js +404 -0
- package/chunks/chunk-T5HJUAWB.js +242 -0
- package/chunks/chunk-T7B6WNZC.js +18 -0
- package/chunks/chunk-UGGNHILG.js +38 -0
- package/chunks/chunk-VNYE4R7N.js +499 -0
- package/chunks/chunk-X5T526CE.js +23 -0
- package/chunks/chunk-XCSR4RIT.js +210 -0
- package/chunks/chunk-Z2KMGFE6.js +295 -0
- package/chunks/create.action-HDD2WUON.js +108 -0
- package/chunks/delete.action-7GOZY7ID.js +88 -0
- package/chunks/delete.action-VE66JFDS.js +96 -0
- package/chunks/get.action-2745EB4N.js +86 -0
- package/chunks/list.action-3VTXQJRA.js +116 -0
- package/chunks/list.action-4QDCZLSZ.js +95 -0
- package/chunks/publish.action-ULQLZKWU.js +190 -0
- package/chunks/update.action-6QEFP7NA.js +95 -0
- package/chunks/update.action-OROQSP2S.js +101 -0
- package/docs.html +352 -250
- package/index.js +664 -99064
- package/package.json +17 -11
|
@@ -0,0 +1,568 @@
|
|
|
1
|
+
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
accessGroupSchema,
|
|
4
|
+
identityProviderRecordSchema,
|
|
5
|
+
loginPortalSchema,
|
|
6
|
+
managedSchema,
|
|
7
|
+
workspaceSchema
|
|
8
|
+
} from "./chunk-HCPN3KNF.js";
|
|
9
|
+
import {
|
|
10
|
+
userSchema
|
|
11
|
+
} from "./chunk-B2MHTD3R.js";
|
|
12
|
+
import {
|
|
13
|
+
sdkSchema
|
|
14
|
+
} from "./chunk-3L6DLIXJ.js";
|
|
15
|
+
import {
|
|
16
|
+
teamSchema
|
|
17
|
+
} from "./chunk-VNYE4R7N.js";
|
|
18
|
+
import {
|
|
19
|
+
activeDeploymentSchema,
|
|
20
|
+
publishRecordSchema,
|
|
21
|
+
themeSchema
|
|
22
|
+
} from "./chunk-OQKDBLOZ.js";
|
|
23
|
+
import {
|
|
24
|
+
managedDocSchema,
|
|
25
|
+
ruleSchema
|
|
26
|
+
} from "./chunk-CISTON3A.js";
|
|
27
|
+
import {
|
|
28
|
+
docVersionRecordSchema
|
|
29
|
+
} from "./chunk-Q7DOQHZN.js";
|
|
30
|
+
import {
|
|
31
|
+
emailSchema,
|
|
32
|
+
entitySchema,
|
|
33
|
+
external_exports,
|
|
34
|
+
nanoidSchema,
|
|
35
|
+
zod_default
|
|
36
|
+
} from "./chunk-IKT5F47M.js";
|
|
37
|
+
|
|
38
|
+
// ../../packages/entities/dist/admins/index.js
|
|
39
|
+
var scalarAdminSchema = entitySchema.extend({
|
|
40
|
+
email: zod_default.string().email(),
|
|
41
|
+
name: zod_default.string().min(2).max(100),
|
|
42
|
+
role: zod_default.enum(["admin", "super-admin"])
|
|
43
|
+
}).meta({ id: "scalar-admin" });
|
|
44
|
+
|
|
45
|
+
// ../../packages/entities/dist/publish/publish.js
|
|
46
|
+
var headingRecordSchema = external_exports.object({
|
|
47
|
+
slug: external_exports.string(),
|
|
48
|
+
name: external_exports.string(),
|
|
49
|
+
level: external_exports.coerce.number().int(),
|
|
50
|
+
uid: nanoidSchema,
|
|
51
|
+
parent: external_exports.string().optional(),
|
|
52
|
+
isPageTitle: external_exports.boolean().optional()
|
|
53
|
+
}).meta({ id: "heading-record" });
|
|
54
|
+
var publishAssetSchema = external_exports.object({
|
|
55
|
+
path: external_exports.string(),
|
|
56
|
+
data: external_exports.string()
|
|
57
|
+
}).meta({ id: "publish-asset" });
|
|
58
|
+
var typesenseConfigSchema = external_exports.object({
|
|
59
|
+
keyId: external_exports.number(),
|
|
60
|
+
keyValue: external_exports.string(),
|
|
61
|
+
collectionName: external_exports.string()
|
|
62
|
+
}).meta({ id: "typesense-config" });
|
|
63
|
+
|
|
64
|
+
// ../../packages/entities/dist/deploys/deploy.js
|
|
65
|
+
var subpathSchema = external_exports.object({
|
|
66
|
+
subpath: external_exports.string(),
|
|
67
|
+
projectUid: external_exports.string(),
|
|
68
|
+
/**
|
|
69
|
+
* The project's own title, for labelling it in cross-project search.
|
|
70
|
+
* Written on publish, so it is absent until the project next publishes.
|
|
71
|
+
*/
|
|
72
|
+
name: external_exports.string().optional(),
|
|
73
|
+
/**
|
|
74
|
+
* The project's active publish, used to cache-bust its search index the
|
|
75
|
+
* way a project already busts its own. Absent until it next publishes.
|
|
76
|
+
*/
|
|
77
|
+
publishUid: external_exports.string().optional(),
|
|
78
|
+
/**
|
|
79
|
+
* Present only for sites still served by Typesense. Builds on the jsonl
|
|
80
|
+
* search backend omit it; federated search fetches `${subpath}/search-entries.jsonl`.
|
|
81
|
+
*/
|
|
82
|
+
typesenseConfig: typesenseConfigSchema.optional().nullable()
|
|
83
|
+
}).meta({ id: "subpath" });
|
|
84
|
+
var cloudflareHttpTokenSchema = external_exports.object({
|
|
85
|
+
/** URL path, e.g. `/.well-known/pki-validation/ca3-<id>.txt` */
|
|
86
|
+
path: external_exports.string(),
|
|
87
|
+
/** Plain-text response body the token path must answer with */
|
|
88
|
+
body: external_exports.string()
|
|
89
|
+
}).meta({ id: "cloudflare-http-token" });
|
|
90
|
+
var cloudflareHostnameStateSchema = external_exports.object({
|
|
91
|
+
/** Custom hostname id in the Cloudflare zone */
|
|
92
|
+
hostnameId: external_exports.string(),
|
|
93
|
+
/** Hostname ownership status reported by Cloudflare (pending, active, …) */
|
|
94
|
+
status: external_exports.string(),
|
|
95
|
+
/** Certificate status reported by Cloudflare (pending_validation, active, …) */
|
|
96
|
+
sslStatus: external_exports.string(),
|
|
97
|
+
httpTokens: cloudflareHttpTokenSchema.array().default([]),
|
|
98
|
+
/** Unix seconds of the reconciler run that last wrote this state */
|
|
99
|
+
syncedAt: external_exports.number()
|
|
100
|
+
}).meta({ id: "cloudflare-hostname-state" });
|
|
101
|
+
var siteDeploySchema = entitySchema.extend({
|
|
102
|
+
domain: external_exports.string(),
|
|
103
|
+
teamUid: nanoidSchema,
|
|
104
|
+
projectUid: nanoidSchema,
|
|
105
|
+
/**
|
|
106
|
+
* Title of the project mounted at the domain root.
|
|
107
|
+
*
|
|
108
|
+
* The root project is deliberately not one of `subpaths` — both request
|
|
109
|
+
* matchers resolve by longest path prefix, so a '/' entry would become a
|
|
110
|
+
* catch-all that every request matched. It is denormalized here instead so
|
|
111
|
+
* search can name and scope it without a second lookup.
|
|
112
|
+
*/
|
|
113
|
+
rootName: external_exports.string().optional(),
|
|
114
|
+
subpaths: subpathSchema.array().default([]),
|
|
115
|
+
cloudflare: cloudflareHostnameStateSchema.optional().nullable()
|
|
116
|
+
}).meta({ id: "site-deploy" });
|
|
117
|
+
var searchConfigRootSchema = external_exports.object({
|
|
118
|
+
projectUid: external_exports.string(),
|
|
119
|
+
name: external_exports.string().optional()
|
|
120
|
+
}).meta({ id: "search-config-root" });
|
|
121
|
+
var searchConfigResponseSchema = external_exports.object({
|
|
122
|
+
subpaths: subpathSchema.array(),
|
|
123
|
+
root: searchConfigRootSchema.optional()
|
|
124
|
+
}).meta({ id: "search-config-response" });
|
|
125
|
+
|
|
126
|
+
// ../../packages/entities/dist/user/ban.js
|
|
127
|
+
var bannedUserSchema = entitySchema.extend({
|
|
128
|
+
email: emailSchema,
|
|
129
|
+
reason: zod_default.string(),
|
|
130
|
+
bannedBy: emailSchema
|
|
131
|
+
}).meta({ id: "banned-user" });
|
|
132
|
+
|
|
133
|
+
// ../../packages/entities/dist/database/collections.js
|
|
134
|
+
var BaseCollections = {
|
|
135
|
+
Users: "users",
|
|
136
|
+
ScalarAdmins: "admin-users",
|
|
137
|
+
SignupMeta: "signup-meta",
|
|
138
|
+
ExchangeTokens: "exchange-tokens",
|
|
139
|
+
HostingExchange: "hosting-exchange",
|
|
140
|
+
HostingLoginTokens: "hosting-login-tokens",
|
|
141
|
+
HostingOauthStates: "hosting-oauth-states",
|
|
142
|
+
Passwords: "passwords",
|
|
143
|
+
SignupOtp: "signup-otp",
|
|
144
|
+
GithubUsers: "github-users",
|
|
145
|
+
BitbucketUsers: "bitbucket-users",
|
|
146
|
+
RefreshTokens: "refresh-tokens",
|
|
147
|
+
LoginAttempts: "login-attempts",
|
|
148
|
+
Teams: "team",
|
|
149
|
+
Deploys: "deploys",
|
|
150
|
+
SamlStates: "saml-states",
|
|
151
|
+
SignupData: "signup-data",
|
|
152
|
+
Projects: (teamUid) => `team/${teamUid}/projects`,
|
|
153
|
+
GithubProjects: (teamUid) => `team/${teamUid}/projects-github`,
|
|
154
|
+
DocsProjects: (teamUid) => `team/${teamUid}/docs`,
|
|
155
|
+
Themes: (teamUid) => `team/${teamUid}/themes`,
|
|
156
|
+
PublishRecords: (teamUid) => `team/${teamUid}/publish`,
|
|
157
|
+
ManagedDocs: (teamUid) => `team/${teamUid}/managed-docs`,
|
|
158
|
+
ManagedDocInstances: (teamUid, docUid) => `team/${teamUid}/managed-docs/${docUid}/instances`,
|
|
159
|
+
ManagedDocVersions: (teamUid, docUid) => `team/${teamUid}/managed-docs/${docUid}/versions`,
|
|
160
|
+
ManagedSchemas: (teamUid) => `team/${teamUid}/managed-schemas`,
|
|
161
|
+
ManagedSchemaInstances: (teamUid, schemaUid) => `team/${teamUid}/managed-schemas/${schemaUid}/instances`,
|
|
162
|
+
ManagedSchemaVersions: (teamUid, schemaUid) => `team/${teamUid}/managed-schemas/${schemaUid}/versions`,
|
|
163
|
+
Rules: (teamUid) => `team/${teamUid}/rules`,
|
|
164
|
+
RuleInstances: (teamUid, ruleUid) => `team/${teamUid}/rules/${ruleUid}/instances`,
|
|
165
|
+
RegistryPublishes: (teamUid) => `team/${teamUid}/registry-publishes`,
|
|
166
|
+
LinkedRepositories: (teamUid) => `team/${teamUid}/repositories`,
|
|
167
|
+
RegistryGitMigrations: "registry-git-migrations",
|
|
168
|
+
AccessGroups: (teamUid) => `team/${teamUid}/access-groups`,
|
|
169
|
+
LoginPortals: (teamUid) => `team/${teamUid}/login-portals`,
|
|
170
|
+
Sdks: (teamUid) => `team/${teamUid}/sdks`,
|
|
171
|
+
SdkBuilds: (teamUid) => `team/${teamUid}/sdk-builds`,
|
|
172
|
+
SdkBuildLogs: (teamUid) => `team/${teamUid}/sdk-build-logs`,
|
|
173
|
+
PersonalTokens: (userUid) => `user/${userUid}/personal-tokens`,
|
|
174
|
+
IdentityProviders: (teamUid) => `team/${teamUid}/identity-providers`,
|
|
175
|
+
Workspaces: (teamUid) => `team/${teamUid}/workspaces`,
|
|
176
|
+
WebhookSubscriptions: (teamUid) => `team/${teamUid}/webhook-subscriptions`,
|
|
177
|
+
WebhookDeliveries: (teamUid) => `team/${teamUid}/webhook-deliveries`,
|
|
178
|
+
WebhookSecrets: (teamUid) => `team/${teamUid}/webhook-secrets`,
|
|
179
|
+
WebhookEventClaims: "webhook-event-claims",
|
|
180
|
+
OauthStates: "oauth-states",
|
|
181
|
+
Waitlist: "waitlist",
|
|
182
|
+
BannedUsers: "banned-users"
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
// ../../packages/entities/dist/database/edge-cache.js
|
|
186
|
+
var requiredUid = { uid: nanoidSchema };
|
|
187
|
+
var entityExtension = {
|
|
188
|
+
...requiredUid,
|
|
189
|
+
_path: external_exports.string(),
|
|
190
|
+
_registryPath: external_exports.string().default("")
|
|
191
|
+
};
|
|
192
|
+
var registryRequiredFields = {
|
|
193
|
+
uid: true,
|
|
194
|
+
title: true,
|
|
195
|
+
slug: true,
|
|
196
|
+
namespace: true,
|
|
197
|
+
loginPortalUid: true,
|
|
198
|
+
isPrivate: true,
|
|
199
|
+
accessGroups: true
|
|
200
|
+
};
|
|
201
|
+
function generateRegistryPath(entity) {
|
|
202
|
+
entity._registryPath = `${entity.namespace}/${entity.slug}`;
|
|
203
|
+
return entity;
|
|
204
|
+
}
|
|
205
|
+
function teamUidFromPath(path) {
|
|
206
|
+
return path.split("/").at(1) ?? "";
|
|
207
|
+
}
|
|
208
|
+
var edgeCacheDeploySchema = siteDeploySchema.omit({ cloudflare: true }).extend(requiredUid);
|
|
209
|
+
var edgeCacheProjectSchema = external_exports.object({
|
|
210
|
+
...requiredUid,
|
|
211
|
+
loginPortalUid: external_exports.string().default(""),
|
|
212
|
+
accessGroups: external_exports.array(external_exports.string()).default([]),
|
|
213
|
+
identityProviders: external_exports.string().array().default([]),
|
|
214
|
+
isPrivate: external_exports.boolean().default(false),
|
|
215
|
+
/**
|
|
216
|
+
* The customer's docs-analytics opt-out. It defaults to true, so a cache
|
|
217
|
+
* that omits the field silently opts an opted-out customer back in — the
|
|
218
|
+
* hosting proxy projects it on every project collection for this reason.
|
|
219
|
+
*/
|
|
220
|
+
analyticsEnabled: external_exports.boolean().default(true),
|
|
221
|
+
activeDeployment: activeDeploymentSchema.nullable().optional(),
|
|
222
|
+
_path: external_exports.string()
|
|
223
|
+
});
|
|
224
|
+
var edgeCacheGithubProjectSchema = edgeCacheProjectSchema;
|
|
225
|
+
var edgeCacheDocsProjectSchema = edgeCacheProjectSchema;
|
|
226
|
+
var PROJECT_TABLE = "project";
|
|
227
|
+
var edgeCachePublishRecordSchema = publishRecordSchema.pick({ uid: true, projectUid: true, agentToken: true }).extend(requiredUid).transform(({ uid, projectUid, agentToken }) => ({
|
|
228
|
+
uid,
|
|
229
|
+
projectUid,
|
|
230
|
+
agentToken,
|
|
231
|
+
_publishPath: `${uid.toLowerCase()}/${projectUid}`
|
|
232
|
+
}));
|
|
233
|
+
var edgeCacheApiSchema = managedDocSchema.pick({
|
|
234
|
+
...registryRequiredFields,
|
|
235
|
+
theme: true,
|
|
236
|
+
version: true,
|
|
237
|
+
latestVersion: true,
|
|
238
|
+
agentEnabled: true
|
|
239
|
+
}).extend(entityExtension).transform(generateRegistryPath);
|
|
240
|
+
var edgeCacheSchemaSchema = managedSchema.pick({ ...registryRequiredFields, version: true }).extend(entityExtension).transform(generateRegistryPath);
|
|
241
|
+
var edgeCacheDocVersionSchema = docVersionRecordSchema.pick({
|
|
242
|
+
uid: true,
|
|
243
|
+
version: true,
|
|
244
|
+
upgraded: true
|
|
245
|
+
}).extend({ ...requiredUid, _path: external_exports.string() });
|
|
246
|
+
var edgeCacheRuleSchema = ruleSchema.pick(registryRequiredFields).extend(entityExtension).transform(generateRegistryPath);
|
|
247
|
+
var edgeCacheSdkSchema = sdkSchema.pick({ ...registryRequiredFields, versions: true, targets: true }).extend(entityExtension).transform(generateRegistryPath);
|
|
248
|
+
var edgeCacheWorkspaceSchema = workspaceSchema.pick({ ...registryRequiredFields, version: true, versions: true }).extend(entityExtension).transform(generateRegistryPath);
|
|
249
|
+
var edgeCacheTeamSchema = teamSchema.pick({
|
|
250
|
+
uid: true,
|
|
251
|
+
users: true,
|
|
252
|
+
externalAccess: true
|
|
253
|
+
}).extend(requiredUid);
|
|
254
|
+
var edgeCacheUserSchema = userSchema.pick({
|
|
255
|
+
uid: true,
|
|
256
|
+
email: true
|
|
257
|
+
}).extend(requiredUid);
|
|
258
|
+
var edgeCacheLoginPortalSchema = loginPortalSchema.extend(requiredUid);
|
|
259
|
+
var edgeCacheAccessGroupSchema = accessGroupSchema.extend(requiredUid);
|
|
260
|
+
var edgeCacheThemeSchema = themeSchema.pick({ uid: true, theme: true, slug: true }).extend({ ...requiredUid, _path: external_exports.string() });
|
|
261
|
+
var edgeCacheIdentityProviderSchema = identityProviderRecordSchema.extend({ _path: external_exports.string() }).pick({
|
|
262
|
+
uid: true,
|
|
263
|
+
name: true,
|
|
264
|
+
provider: true,
|
|
265
|
+
consumerOnly: true,
|
|
266
|
+
_path: true
|
|
267
|
+
}).extend(requiredUid).transform(({ uid, name, provider, consumerOnly, _path }) => ({
|
|
268
|
+
uid,
|
|
269
|
+
name,
|
|
270
|
+
provider,
|
|
271
|
+
consumerOnly,
|
|
272
|
+
teamUid: teamUidFromPath(_path),
|
|
273
|
+
_path
|
|
274
|
+
}));
|
|
275
|
+
var SAFE_SQL_IDENTIFIER = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
276
|
+
function assertSafeIdentifier(value, context) {
|
|
277
|
+
if (!SAFE_SQL_IDENTIFIER.test(value)) {
|
|
278
|
+
throw new Error(`Unsafe SQL identifier for edge-cache ${context}: ${JSON.stringify(value)}`);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
function defineCollection(config) {
|
|
282
|
+
assertSafeIdentifier(config.tableName, `tableName "${config.tableName}"`);
|
|
283
|
+
for (const field of config.indexFields) {
|
|
284
|
+
assertSafeIdentifier(field, `indexField "${field}" on "${config.tableName}"`);
|
|
285
|
+
}
|
|
286
|
+
if (config.source !== void 0) {
|
|
287
|
+
assertSafeIdentifier(config.source, `source "${config.source}" on "${config.tableName}"`);
|
|
288
|
+
}
|
|
289
|
+
return config;
|
|
290
|
+
}
|
|
291
|
+
var edgeCacheCollections = {
|
|
292
|
+
deploy: defineCollection({
|
|
293
|
+
schema: edgeCacheDeploySchema,
|
|
294
|
+
indexFields: ["domain"],
|
|
295
|
+
tableName: "deploy",
|
|
296
|
+
mongoCollection: BaseCollections.Deploys
|
|
297
|
+
}),
|
|
298
|
+
project: defineCollection({
|
|
299
|
+
schema: edgeCacheProjectSchema,
|
|
300
|
+
indexFields: [],
|
|
301
|
+
tableName: PROJECT_TABLE,
|
|
302
|
+
mongoCollection: BaseCollections.Projects,
|
|
303
|
+
source: "project",
|
|
304
|
+
priority: 2,
|
|
305
|
+
projection: {
|
|
306
|
+
uid: 1,
|
|
307
|
+
loginPortalUid: 1,
|
|
308
|
+
accessGroups: 1,
|
|
309
|
+
identityProviders: 1,
|
|
310
|
+
isPrivate: 1,
|
|
311
|
+
analyticsEnabled: 1,
|
|
312
|
+
activeDeployment: 1,
|
|
313
|
+
_path: 1
|
|
314
|
+
}
|
|
315
|
+
}),
|
|
316
|
+
githubProject: defineCollection({
|
|
317
|
+
schema: edgeCacheGithubProjectSchema,
|
|
318
|
+
indexFields: [],
|
|
319
|
+
tableName: PROJECT_TABLE,
|
|
320
|
+
mongoCollection: BaseCollections.GithubProjects,
|
|
321
|
+
source: "github",
|
|
322
|
+
priority: 1,
|
|
323
|
+
projection: {
|
|
324
|
+
uid: 1,
|
|
325
|
+
loginPortalUid: 1,
|
|
326
|
+
accessGroups: 1,
|
|
327
|
+
identityProviders: 1,
|
|
328
|
+
isPrivate: 1,
|
|
329
|
+
analyticsEnabled: 1,
|
|
330
|
+
activeDeployment: 1,
|
|
331
|
+
_path: 1
|
|
332
|
+
}
|
|
333
|
+
}),
|
|
334
|
+
docsProject: defineCollection({
|
|
335
|
+
schema: edgeCacheDocsProjectSchema,
|
|
336
|
+
indexFields: [],
|
|
337
|
+
tableName: PROJECT_TABLE,
|
|
338
|
+
mongoCollection: BaseCollections.DocsProjects,
|
|
339
|
+
source: "docs",
|
|
340
|
+
priority: 3,
|
|
341
|
+
projection: {
|
|
342
|
+
uid: 1,
|
|
343
|
+
loginPortalUid: 1,
|
|
344
|
+
accessGroups: 1,
|
|
345
|
+
identityProviders: 1,
|
|
346
|
+
isPrivate: 1,
|
|
347
|
+
analyticsEnabled: 1,
|
|
348
|
+
activeDeployment: 1,
|
|
349
|
+
_path: 1
|
|
350
|
+
}
|
|
351
|
+
}),
|
|
352
|
+
publishRecord: defineCollection({
|
|
353
|
+
schema: edgeCachePublishRecordSchema,
|
|
354
|
+
indexFields: ["_publishPath"],
|
|
355
|
+
tableName: "publishRecord",
|
|
356
|
+
mongoCollection: BaseCollections.PublishRecords,
|
|
357
|
+
projection: { uid: 1, projectUid: 1, agentToken: 1 }
|
|
358
|
+
}),
|
|
359
|
+
api: defineCollection({
|
|
360
|
+
schema: edgeCacheApiSchema,
|
|
361
|
+
indexFields: ["_registryPath"],
|
|
362
|
+
tableName: "api",
|
|
363
|
+
mongoCollection: BaseCollections.ManagedDocs,
|
|
364
|
+
projection: {
|
|
365
|
+
uid: 1,
|
|
366
|
+
title: 1,
|
|
367
|
+
slug: 1,
|
|
368
|
+
namespace: 1,
|
|
369
|
+
loginPortalUid: 1,
|
|
370
|
+
isPrivate: 1,
|
|
371
|
+
accessGroups: 1,
|
|
372
|
+
theme: 1,
|
|
373
|
+
_path: 1,
|
|
374
|
+
_registryPath: 1,
|
|
375
|
+
version: 1,
|
|
376
|
+
latestVersion: 1,
|
|
377
|
+
agentEnabled: 1
|
|
378
|
+
}
|
|
379
|
+
}),
|
|
380
|
+
schema: defineCollection({
|
|
381
|
+
schema: edgeCacheSchemaSchema,
|
|
382
|
+
indexFields: ["_registryPath"],
|
|
383
|
+
tableName: "schema",
|
|
384
|
+
mongoCollection: BaseCollections.ManagedSchemas,
|
|
385
|
+
projection: {
|
|
386
|
+
uid: 1,
|
|
387
|
+
title: 1,
|
|
388
|
+
slug: 1,
|
|
389
|
+
namespace: 1,
|
|
390
|
+
loginPortalUid: 1,
|
|
391
|
+
isPrivate: 1,
|
|
392
|
+
accessGroups: 1,
|
|
393
|
+
version: 1,
|
|
394
|
+
_path: 1,
|
|
395
|
+
_registryPath: 1
|
|
396
|
+
}
|
|
397
|
+
}),
|
|
398
|
+
// The versions collections are pseudo-nested under each document, so their
|
|
399
|
+
// physical Mongo collection names carry two uid placeholders (see
|
|
400
|
+
// collectionNameFromPath in mongobase) — written as static patterns here
|
|
401
|
+
// because the config's function form substitutes only the first uid.
|
|
402
|
+
apiVersion: defineCollection({
|
|
403
|
+
schema: edgeCacheDocVersionSchema,
|
|
404
|
+
indexFields: ["_path", "version"],
|
|
405
|
+
tableName: "docVersion",
|
|
406
|
+
mongoCollection: "team/<uid-0>/managed-docs/<uid-1>/versions",
|
|
407
|
+
source: "api",
|
|
408
|
+
priority: 2,
|
|
409
|
+
projection: {
|
|
410
|
+
uid: 1,
|
|
411
|
+
version: 1,
|
|
412
|
+
upgraded: 1,
|
|
413
|
+
_path: 1
|
|
414
|
+
}
|
|
415
|
+
}),
|
|
416
|
+
schemaVersion: defineCollection({
|
|
417
|
+
schema: edgeCacheDocVersionSchema,
|
|
418
|
+
indexFields: ["_path", "version"],
|
|
419
|
+
tableName: "docVersion",
|
|
420
|
+
mongoCollection: "team/<uid-0>/managed-schemas/<uid-1>/versions",
|
|
421
|
+
source: "schema",
|
|
422
|
+
priority: 1,
|
|
423
|
+
projection: {
|
|
424
|
+
uid: 1,
|
|
425
|
+
version: 1,
|
|
426
|
+
upgraded: 1,
|
|
427
|
+
_path: 1
|
|
428
|
+
}
|
|
429
|
+
}),
|
|
430
|
+
rule: defineCollection({
|
|
431
|
+
schema: edgeCacheRuleSchema,
|
|
432
|
+
indexFields: ["_registryPath"],
|
|
433
|
+
tableName: "rule",
|
|
434
|
+
mongoCollection: BaseCollections.Rules,
|
|
435
|
+
projection: {
|
|
436
|
+
uid: 1,
|
|
437
|
+
title: 1,
|
|
438
|
+
slug: 1,
|
|
439
|
+
namespace: 1,
|
|
440
|
+
loginPortalUid: 1,
|
|
441
|
+
isPrivate: 1,
|
|
442
|
+
accessGroups: 1,
|
|
443
|
+
_path: 1,
|
|
444
|
+
_registryPath: 1
|
|
445
|
+
}
|
|
446
|
+
}),
|
|
447
|
+
sdk: defineCollection({
|
|
448
|
+
schema: edgeCacheSdkSchema,
|
|
449
|
+
indexFields: ["_registryPath"],
|
|
450
|
+
tableName: "sdk",
|
|
451
|
+
mongoCollection: BaseCollections.Sdks,
|
|
452
|
+
projection: {
|
|
453
|
+
uid: 1,
|
|
454
|
+
title: 1,
|
|
455
|
+
slug: 1,
|
|
456
|
+
namespace: 1,
|
|
457
|
+
loginPortalUid: 1,
|
|
458
|
+
isPrivate: 1,
|
|
459
|
+
accessGroups: 1,
|
|
460
|
+
versions: 1,
|
|
461
|
+
targets: 1,
|
|
462
|
+
_path: 1,
|
|
463
|
+
_registryPath: 1
|
|
464
|
+
}
|
|
465
|
+
}),
|
|
466
|
+
workspace: defineCollection({
|
|
467
|
+
schema: edgeCacheWorkspaceSchema,
|
|
468
|
+
indexFields: ["_registryPath"],
|
|
469
|
+
tableName: "workspace",
|
|
470
|
+
mongoCollection: BaseCollections.Workspaces,
|
|
471
|
+
projection: {
|
|
472
|
+
uid: 1,
|
|
473
|
+
title: 1,
|
|
474
|
+
slug: 1,
|
|
475
|
+
namespace: 1,
|
|
476
|
+
loginPortalUid: 1,
|
|
477
|
+
isPrivate: 1,
|
|
478
|
+
accessGroups: 1,
|
|
479
|
+
version: 1,
|
|
480
|
+
versions: 1,
|
|
481
|
+
_registryPath: 1,
|
|
482
|
+
_path: 1
|
|
483
|
+
}
|
|
484
|
+
}),
|
|
485
|
+
team: defineCollection({
|
|
486
|
+
schema: edgeCacheTeamSchema,
|
|
487
|
+
indexFields: [],
|
|
488
|
+
tableName: "team",
|
|
489
|
+
mongoCollection: BaseCollections.Teams,
|
|
490
|
+
projection: { uid: 1, users: 1, externalAccess: 1 }
|
|
491
|
+
}),
|
|
492
|
+
user: defineCollection({
|
|
493
|
+
schema: edgeCacheUserSchema,
|
|
494
|
+
indexFields: ["email"],
|
|
495
|
+
tableName: "user",
|
|
496
|
+
mongoCollection: BaseCollections.Users,
|
|
497
|
+
projection: { uid: 1, email: 1 }
|
|
498
|
+
}),
|
|
499
|
+
loginPortal: defineCollection({
|
|
500
|
+
schema: edgeCacheLoginPortalSchema,
|
|
501
|
+
indexFields: [],
|
|
502
|
+
tableName: "loginPortal",
|
|
503
|
+
mongoCollection: BaseCollections.LoginPortals
|
|
504
|
+
}),
|
|
505
|
+
accessGroup: defineCollection({
|
|
506
|
+
schema: edgeCacheAccessGroupSchema,
|
|
507
|
+
indexFields: [],
|
|
508
|
+
tableName: "accessGroup",
|
|
509
|
+
mongoCollection: BaseCollections.AccessGroups
|
|
510
|
+
}),
|
|
511
|
+
theme: defineCollection({
|
|
512
|
+
schema: edgeCacheThemeSchema,
|
|
513
|
+
indexFields: [],
|
|
514
|
+
tableName: "theme",
|
|
515
|
+
mongoCollection: BaseCollections.Themes,
|
|
516
|
+
projection: { uid: 1, theme: 1, slug: 1, _path: 1 }
|
|
517
|
+
}),
|
|
518
|
+
identityProvider: defineCollection({
|
|
519
|
+
schema: edgeCacheIdentityProviderSchema,
|
|
520
|
+
indexFields: ["teamUid"],
|
|
521
|
+
tableName: "identityProvider",
|
|
522
|
+
mongoCollection: BaseCollections.IdentityProviders,
|
|
523
|
+
projection: { uid: 1, name: 1, provider: 1, consumerOnly: 1, _path: 1 }
|
|
524
|
+
})
|
|
525
|
+
};
|
|
526
|
+
var sharedTables = new Set(Object.values(edgeCacheCollections).map((config) => config.tableName).filter((table, index, all) => all.indexOf(table) !== index));
|
|
527
|
+
for (const [key, config] of Object.entries(edgeCacheCollections)) {
|
|
528
|
+
const shared = sharedTables.has(config.tableName);
|
|
529
|
+
if (shared && !config.source) {
|
|
530
|
+
throw new Error(`Edge-cache collection "${key}" shares table "${config.tableName}" but declares no source.`);
|
|
531
|
+
}
|
|
532
|
+
if (!shared && config.source) {
|
|
533
|
+
throw new Error(`Edge-cache collection "${key}" declares source "${config.source}" but no other collection uses table "${config.tableName}".`);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
var sourcesByTable = /* @__PURE__ */ new Map();
|
|
537
|
+
for (const [key, config] of Object.entries(edgeCacheCollections)) {
|
|
538
|
+
if (!config.source)
|
|
539
|
+
continue;
|
|
540
|
+
const seen = sourcesByTable.get(`${config.tableName}:${config.source}`);
|
|
541
|
+
if (seen) {
|
|
542
|
+
throw new Error(`Edge-cache collections "${seen}" and "${key}" both use source "${config.source}" on table "${config.tableName}".`);
|
|
543
|
+
}
|
|
544
|
+
sourcesByTable.set(`${config.tableName}:${config.source}`, key);
|
|
545
|
+
}
|
|
546
|
+
var prioritiesByTable = /* @__PURE__ */ new Map();
|
|
547
|
+
for (const [key, config] of Object.entries(edgeCacheCollections)) {
|
|
548
|
+
const shared = sharedTables.has(config.tableName);
|
|
549
|
+
if (shared && config.priority === void 0) {
|
|
550
|
+
throw new Error(`Edge-cache collection "${key}" shares table "${config.tableName}" but declares no priority.`);
|
|
551
|
+
}
|
|
552
|
+
if (!shared && config.priority !== void 0) {
|
|
553
|
+
throw new Error(`Edge-cache collection "${key}" declares a priority but does not share table "${config.tableName}".`);
|
|
554
|
+
}
|
|
555
|
+
if (config.priority === void 0)
|
|
556
|
+
continue;
|
|
557
|
+
const taken = prioritiesByTable.get(config.tableName) ?? /* @__PURE__ */ new Map();
|
|
558
|
+
const holder = taken.get(config.priority);
|
|
559
|
+
if (holder) {
|
|
560
|
+
throw new Error(`Edge-cache collections "${holder}" and "${key}" both use priority ${config.priority} on table "${config.tableName}".`);
|
|
561
|
+
}
|
|
562
|
+
taken.set(config.priority, key);
|
|
563
|
+
prioritiesByTable.set(config.tableName, taken);
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
export {
|
|
567
|
+
BaseCollections
|
|
568
|
+
};
|