@webstudio-is/protocol 0.272.0 → 0.274.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/fixtures.js +343 -384
- package/lib/index.js +2027 -377
- package/lib/types/builder-api/errors.d.ts +4 -0
- package/lib/types/builder-api/operation-docs.d.ts +7 -0
- package/lib/types/builder-api/operations.d.ts +506 -0
- package/lib/types/builder-api/runtime-contracts.d.ts +11 -0
- package/lib/types/builder-api/url.d.ts +7 -0
- package/lib/types/contract-version.d.ts +1 -1
- package/lib/types/index.d.ts +5 -0
- package/lib/types/schema.d.ts +714 -290
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -862,11 +862,11 @@ function datetimeRegex(args) {
|
|
|
862
862
|
regex = `${regex}(${opts.join("|")})`;
|
|
863
863
|
return new RegExp(`^${regex}$`);
|
|
864
864
|
}
|
|
865
|
-
function isValidIP(ip,
|
|
866
|
-
if ((
|
|
865
|
+
function isValidIP(ip, version) {
|
|
866
|
+
if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
|
|
867
867
|
return true;
|
|
868
868
|
}
|
|
869
|
-
if ((
|
|
869
|
+
if ((version === "v6" || !version) && ipv6Regex.test(ip)) {
|
|
870
870
|
return true;
|
|
871
871
|
}
|
|
872
872
|
return false;
|
|
@@ -889,11 +889,11 @@ function isValidJWT(jwt, alg) {
|
|
|
889
889
|
return false;
|
|
890
890
|
}
|
|
891
891
|
}
|
|
892
|
-
function isValidCidr(ip,
|
|
893
|
-
if ((
|
|
892
|
+
function isValidCidr(ip, version) {
|
|
893
|
+
if ((version === "v4" || !version) && ipv4CidrRegex.test(ip)) {
|
|
894
894
|
return true;
|
|
895
895
|
}
|
|
896
|
-
if ((
|
|
896
|
+
if ((version === "v6" || !version) && ipv6CidrRegex.test(ip)) {
|
|
897
897
|
return true;
|
|
898
898
|
}
|
|
899
899
|
return false;
|
|
@@ -4068,12 +4068,12 @@ var FONT_MIME_TYPES = Array.from(FONT_FORMATS.keys()).map((format) => `.${format
|
|
|
4068
4068
|
var FONT_STYLES = ["normal", "italic", "oblique"];
|
|
4069
4069
|
|
|
4070
4070
|
// ../fonts/src/schema.ts
|
|
4071
|
-
var
|
|
4071
|
+
var fontFormat = z.union([
|
|
4072
4072
|
z.literal("ttf"),
|
|
4073
4073
|
z.literal("woff"),
|
|
4074
4074
|
z.literal("woff2")
|
|
4075
4075
|
]);
|
|
4076
|
-
var
|
|
4076
|
+
var axisName = z.enum([
|
|
4077
4077
|
"wght",
|
|
4078
4078
|
"wdth",
|
|
4079
4079
|
"slnt",
|
|
@@ -4089,8 +4089,8 @@ var AxisName = z.enum([
|
|
|
4089
4089
|
"YTDE",
|
|
4090
4090
|
"YTFI"
|
|
4091
4091
|
]);
|
|
4092
|
-
var
|
|
4093
|
-
|
|
4092
|
+
var variationAxes = z.record(
|
|
4093
|
+
axisName,
|
|
4094
4094
|
z.object({
|
|
4095
4095
|
name: z.string(),
|
|
4096
4096
|
min: z.number(),
|
|
@@ -4098,21 +4098,21 @@ var VariationAxes = z.record(
|
|
|
4098
4098
|
max: z.number()
|
|
4099
4099
|
})
|
|
4100
4100
|
);
|
|
4101
|
-
var
|
|
4101
|
+
var fontMetaStatic = z.object({
|
|
4102
4102
|
family: z.string(),
|
|
4103
4103
|
style: z.enum(FONT_STYLES),
|
|
4104
4104
|
weight: z.number()
|
|
4105
4105
|
});
|
|
4106
|
-
var
|
|
4106
|
+
var fontMetaVariable = z.object({
|
|
4107
4107
|
family: z.string(),
|
|
4108
|
-
variationAxes
|
|
4108
|
+
variationAxes
|
|
4109
4109
|
});
|
|
4110
|
-
var
|
|
4110
|
+
var fontMeta = z.union([fontMetaStatic, fontMetaVariable]);
|
|
4111
4111
|
|
|
4112
4112
|
// ../sdk/src/schema/assets.ts
|
|
4113
|
-
var
|
|
4113
|
+
var assetId = z.string();
|
|
4114
4114
|
var baseAsset = {
|
|
4115
|
-
id:
|
|
4115
|
+
id: assetId,
|
|
4116
4116
|
projectId: z.string(),
|
|
4117
4117
|
size: z.number(),
|
|
4118
4118
|
name: z.string(),
|
|
@@ -4120,35 +4120,36 @@ var baseAsset = {
|
|
|
4120
4120
|
description: z.union([z.string().optional(), z.null()]),
|
|
4121
4121
|
createdAt: z.string()
|
|
4122
4122
|
};
|
|
4123
|
-
var
|
|
4123
|
+
var assetType = z.enum(["font", "image", "file"]);
|
|
4124
|
+
var fontAsset = z.object({
|
|
4124
4125
|
...baseAsset,
|
|
4125
|
-
format:
|
|
4126
|
-
meta:
|
|
4127
|
-
type: z.literal(
|
|
4126
|
+
format: fontFormat,
|
|
4127
|
+
meta: fontMeta,
|
|
4128
|
+
type: z.literal(assetType.enum.font)
|
|
4128
4129
|
});
|
|
4129
|
-
var
|
|
4130
|
+
var imageMeta = z.object({
|
|
4130
4131
|
width: z.number(),
|
|
4131
4132
|
height: z.number()
|
|
4132
4133
|
});
|
|
4133
|
-
var
|
|
4134
|
+
var imageAsset = z.object({
|
|
4134
4135
|
...baseAsset,
|
|
4135
4136
|
format: z.string(),
|
|
4136
|
-
meta:
|
|
4137
|
-
type: z.literal(
|
|
4137
|
+
meta: imageMeta,
|
|
4138
|
+
type: z.literal(assetType.enum.image)
|
|
4138
4139
|
});
|
|
4139
|
-
var
|
|
4140
|
+
var fileAsset = z.object({
|
|
4140
4141
|
...baseAsset,
|
|
4141
4142
|
format: z.string(),
|
|
4142
4143
|
meta: z.object({}),
|
|
4143
|
-
type: z.literal(
|
|
4144
|
+
type: z.literal(assetType.enum.file)
|
|
4144
4145
|
});
|
|
4145
|
-
var
|
|
4146
|
-
var
|
|
4146
|
+
var asset = z.union([fontAsset, imageAsset, fileAsset]);
|
|
4147
|
+
var assets = z.map(assetId, asset);
|
|
4147
4148
|
|
|
4148
4149
|
// ../sdk/src/schema/breakpoints.ts
|
|
4149
|
-
var
|
|
4150
|
-
var
|
|
4151
|
-
id:
|
|
4150
|
+
var breakpointId = z.string();
|
|
4151
|
+
var breakpoint = z.object({
|
|
4152
|
+
id: breakpointId,
|
|
4152
4153
|
label: z.string(),
|
|
4153
4154
|
minWidth: z.number().optional(),
|
|
4154
4155
|
maxWidth: z.number().optional(),
|
|
@@ -4167,11 +4168,11 @@ var Breakpoint = z.object({
|
|
|
4167
4168
|
}
|
|
4168
4169
|
return true;
|
|
4169
4170
|
}, "Width-based (minWidth/maxWidth) and condition are mutually exclusive, and minWidth must be less than maxWidth");
|
|
4170
|
-
var
|
|
4171
|
+
var breakpoints = z.map(breakpointId, breakpoint);
|
|
4171
4172
|
|
|
4172
4173
|
// ../sdk/src/schema/data-sources.ts
|
|
4173
|
-
var
|
|
4174
|
-
var
|
|
4174
|
+
var dataSourceId = z.string();
|
|
4175
|
+
var dataSourceVariableValue = z.union([
|
|
4175
4176
|
z.object({
|
|
4176
4177
|
type: z.literal("number"),
|
|
4177
4178
|
// initial value of variable store
|
|
@@ -4194,10 +4195,10 @@ var DataSourceVariableValue = z.union([
|
|
|
4194
4195
|
value: z.unknown()
|
|
4195
4196
|
})
|
|
4196
4197
|
]);
|
|
4197
|
-
var
|
|
4198
|
+
var dataSource = z.union([
|
|
4198
4199
|
z.object({
|
|
4199
4200
|
type: z.literal("variable"),
|
|
4200
|
-
id:
|
|
4201
|
+
id: dataSourceId,
|
|
4201
4202
|
// The instance should always be specified for variables,
|
|
4202
4203
|
// however, there was a bug in the embed template
|
|
4203
4204
|
// which produced variables without an instance
|
|
@@ -4205,26 +4206,26 @@ var DataSource = z.union([
|
|
|
4205
4206
|
// if we make it required
|
|
4206
4207
|
scopeInstanceId: z.string().optional(),
|
|
4207
4208
|
name: z.string(),
|
|
4208
|
-
value:
|
|
4209
|
+
value: dataSourceVariableValue
|
|
4209
4210
|
}),
|
|
4210
4211
|
z.object({
|
|
4211
4212
|
type: z.literal("parameter"),
|
|
4212
|
-
id:
|
|
4213
|
+
id: dataSourceId,
|
|
4213
4214
|
scopeInstanceId: z.string().optional(),
|
|
4214
4215
|
name: z.string()
|
|
4215
4216
|
}),
|
|
4216
4217
|
z.object({
|
|
4217
4218
|
type: z.literal("resource"),
|
|
4218
|
-
id:
|
|
4219
|
+
id: dataSourceId,
|
|
4219
4220
|
scopeInstanceId: z.string().optional(),
|
|
4220
4221
|
name: z.string(),
|
|
4221
4222
|
resourceId: z.string()
|
|
4222
4223
|
})
|
|
4223
4224
|
]);
|
|
4224
|
-
var
|
|
4225
|
+
var dataSources = z.map(dataSourceId, dataSource);
|
|
4225
4226
|
|
|
4226
4227
|
// ../sdk/src/schema/deployment.ts
|
|
4227
|
-
var
|
|
4228
|
+
var templates = z.enum([
|
|
4228
4229
|
"docker",
|
|
4229
4230
|
"vercel",
|
|
4230
4231
|
"netlify",
|
|
@@ -4232,13 +4233,13 @@ var Templates = z.enum([
|
|
|
4232
4233
|
"ssg-netlify",
|
|
4233
4234
|
"ssg-vercel"
|
|
4234
4235
|
]);
|
|
4235
|
-
var
|
|
4236
|
+
var deployment = z.union([
|
|
4236
4237
|
z.object({
|
|
4237
4238
|
destination: z.literal("static"),
|
|
4238
4239
|
name: z.string(),
|
|
4239
4240
|
assetsDomain: z.string(),
|
|
4240
4241
|
// Must be validated very strictly
|
|
4241
|
-
templates: z.array(
|
|
4242
|
+
templates: z.array(templates)
|
|
4242
4243
|
}),
|
|
4243
4244
|
z.object({
|
|
4244
4245
|
destination: z.literal("saas").optional(),
|
|
@@ -4253,30 +4254,30 @@ var Deployment = z.union([
|
|
|
4253
4254
|
]);
|
|
4254
4255
|
|
|
4255
4256
|
// ../sdk/src/schema/instances.ts
|
|
4256
|
-
var
|
|
4257
|
+
var textChild = z.object({
|
|
4257
4258
|
type: z.literal("text"),
|
|
4258
4259
|
value: z.string(),
|
|
4259
4260
|
placeholder: z.boolean().optional()
|
|
4260
4261
|
});
|
|
4261
|
-
var
|
|
4262
|
-
var
|
|
4262
|
+
var instanceId = z.string();
|
|
4263
|
+
var idChild = z.object({
|
|
4263
4264
|
type: z.literal("id"),
|
|
4264
|
-
value:
|
|
4265
|
+
value: instanceId
|
|
4265
4266
|
});
|
|
4266
|
-
var
|
|
4267
|
+
var expressionChild = z.object({
|
|
4267
4268
|
type: z.literal("expression"),
|
|
4268
4269
|
value: z.string()
|
|
4269
4270
|
});
|
|
4270
|
-
var
|
|
4271
|
-
var
|
|
4271
|
+
var instanceChild = z.union([idChild, textChild, expressionChild]);
|
|
4272
|
+
var instance = z.object({
|
|
4272
4273
|
type: z.literal("instance"),
|
|
4273
|
-
id:
|
|
4274
|
+
id: instanceId,
|
|
4274
4275
|
component: z.string(),
|
|
4275
4276
|
tag: z.string().optional(),
|
|
4276
4277
|
label: z.string().optional(),
|
|
4277
|
-
children: z.array(
|
|
4278
|
+
children: z.array(instanceChild)
|
|
4278
4279
|
});
|
|
4279
|
-
var
|
|
4280
|
+
var instances = z.map(instanceId, instance);
|
|
4280
4281
|
|
|
4281
4282
|
// ../wsauth/src/index.ts
|
|
4282
4283
|
var basicLoginErrors = (login) => {
|
|
@@ -4336,26 +4337,26 @@ var validateBasicAuth = ({
|
|
|
4336
4337
|
|
|
4337
4338
|
// ../sdk/src/schema/pages.ts
|
|
4338
4339
|
var MIN_TITLE_LENGTH = 2;
|
|
4339
|
-
var
|
|
4340
|
-
var
|
|
4341
|
-
var
|
|
4342
|
-
var
|
|
4340
|
+
var pageId = z.string();
|
|
4341
|
+
var folderId = z.string();
|
|
4342
|
+
var folderName = z.string().refine((value) => value.trim() !== "", "Can't be empty");
|
|
4343
|
+
var slug = z.string().refine(
|
|
4343
4344
|
(path) => /^[-a-z0-9]*$/.test(path),
|
|
4344
4345
|
"Only a-z, 0-9 and - are allowed"
|
|
4345
4346
|
);
|
|
4346
|
-
var
|
|
4347
|
-
id:
|
|
4348
|
-
name:
|
|
4349
|
-
slug
|
|
4350
|
-
children: z.array(z.union([
|
|
4347
|
+
var folder = z.object({
|
|
4348
|
+
id: folderId,
|
|
4349
|
+
name: folderName,
|
|
4350
|
+
slug,
|
|
4351
|
+
children: z.array(z.union([folderId, pageId]))
|
|
4351
4352
|
});
|
|
4352
|
-
var
|
|
4353
|
-
var
|
|
4353
|
+
var pageName = z.string().refine((value) => value.trim() !== "", "Can't be empty");
|
|
4354
|
+
var pageTitle = z.string().refine(
|
|
4354
4355
|
(val) => val.length >= MIN_TITLE_LENGTH,
|
|
4355
4356
|
`Minimum ${MIN_TITLE_LENGTH} characters required`
|
|
4356
4357
|
);
|
|
4357
4358
|
var documentTypes = ["html", "xml", "text"];
|
|
4358
|
-
var
|
|
4359
|
+
var basicAuthFields = {
|
|
4359
4360
|
login: z.string(),
|
|
4360
4361
|
password: z.string()
|
|
4361
4362
|
};
|
|
@@ -4371,23 +4372,23 @@ var validateBasicAuthFields = ({
|
|
|
4371
4372
|
});
|
|
4372
4373
|
}
|
|
4373
4374
|
};
|
|
4374
|
-
var
|
|
4375
|
+
var pageBasicAuth = z.object({
|
|
4375
4376
|
method: z.literal("basic"),
|
|
4376
|
-
...
|
|
4377
|
+
...basicAuthFields
|
|
4377
4378
|
}).superRefine(validateBasicAuthFields);
|
|
4378
|
-
var
|
|
4379
|
+
var legacyPageBasicAuth = z.object({
|
|
4379
4380
|
type: z.literal("basic"),
|
|
4380
|
-
...
|
|
4381
|
+
...basicAuthFields
|
|
4381
4382
|
}).superRefine(validateBasicAuthFields).transform(({ login, password }) => ({
|
|
4382
4383
|
method: "basic",
|
|
4383
4384
|
login,
|
|
4384
4385
|
password
|
|
4385
4386
|
}));
|
|
4386
|
-
var
|
|
4387
|
+
var pageAuth = z.union([pageBasicAuth, legacyPageBasicAuth]);
|
|
4387
4388
|
var commonPageFields = {
|
|
4388
|
-
id:
|
|
4389
|
-
name:
|
|
4390
|
-
title:
|
|
4389
|
+
id: pageId,
|
|
4390
|
+
name: pageName,
|
|
4391
|
+
title: pageTitle,
|
|
4391
4392
|
history: z.optional(z.array(z.string())),
|
|
4392
4393
|
rootInstanceId: z.string(),
|
|
4393
4394
|
systemDataSourceId: z.string().optional(),
|
|
@@ -4402,7 +4403,7 @@ var commonPageFields = {
|
|
|
4402
4403
|
redirect: z.string().optional(),
|
|
4403
4404
|
documentType: z.optional(z.enum(documentTypes)),
|
|
4404
4405
|
content: z.string().optional(),
|
|
4405
|
-
auth:
|
|
4406
|
+
auth: pageAuth.optional(),
|
|
4406
4407
|
custom: z.array(
|
|
4407
4408
|
z.object({
|
|
4408
4409
|
property: z.string(),
|
|
@@ -4418,8 +4419,8 @@ var commonPageFields = {
|
|
|
4418
4419
|
})
|
|
4419
4420
|
)
|
|
4420
4421
|
};
|
|
4421
|
-
var
|
|
4422
|
-
var
|
|
4422
|
+
var homePagePath = z.string().refine((path) => path === "", "Home page path must be empty");
|
|
4423
|
+
var defaultPagePath = z.string().refine((path) => path !== "", "Can't be empty").refine((path) => path !== "/", "Can't be just a /").refine((path) => path.endsWith("/") === false, "Can't end with a /").refine((path) => path.includes("//") === false, "Can't contain repeating /").refine(
|
|
4423
4424
|
(path) => /^[-_a-z0-9*:?\\/.]*$/.test(path),
|
|
4424
4425
|
"Only a-z, 0-9, -, _, /, :, ?, . and * are allowed"
|
|
4425
4426
|
).refine(
|
|
@@ -4432,7 +4433,7 @@ var DefaultPagePage = z.string().refine((path) => path !== "", "Can't be empty")
|
|
|
4432
4433
|
(path) => path !== "/build" && path.startsWith("/build/") === false,
|
|
4433
4434
|
"/build prefix is reserved for the system"
|
|
4434
4435
|
).refine((path) => path.length <= 255, "Path can't exceed 255 characters");
|
|
4435
|
-
var
|
|
4436
|
+
var redirectSourcePath = z.string().refine((path) => path !== "", "Can't be empty").refine((path) => path !== "/", "Can't be just a /").refine(
|
|
4436
4437
|
(path) => path.startsWith("/") && path.startsWith("//") === false,
|
|
4437
4438
|
"Must start with a /"
|
|
4438
4439
|
).refine((path) => {
|
|
@@ -4452,23 +4453,23 @@ var RedirectSourcePath = z.string().refine((path) => path !== "", "Can't be empt
|
|
|
4452
4453
|
(path) => path !== "/build" && path.startsWith("/build/") === false,
|
|
4453
4454
|
"/build prefix is reserved for the system"
|
|
4454
4455
|
);
|
|
4455
|
-
var
|
|
4456
|
+
var pagePath = defaultPagePath.refine(
|
|
4456
4457
|
(path) => path === "" || path.startsWith("/"),
|
|
4457
4458
|
"Must start with a / or a full URL e.g. https://website.org"
|
|
4458
4459
|
);
|
|
4459
|
-
var
|
|
4460
|
+
var page = z.object({
|
|
4460
4461
|
...commonPageFields,
|
|
4461
|
-
path: z.union([
|
|
4462
|
+
path: z.union([homePagePath, pagePath])
|
|
4462
4463
|
});
|
|
4463
|
-
var
|
|
4464
|
-
id:
|
|
4465
|
-
name:
|
|
4466
|
-
title:
|
|
4464
|
+
var pageTemplate = z.object({
|
|
4465
|
+
id: pageId,
|
|
4466
|
+
name: pageName,
|
|
4467
|
+
title: pageTitle,
|
|
4467
4468
|
rootInstanceId: z.string(),
|
|
4468
4469
|
systemDataSourceId: z.string().optional(),
|
|
4469
4470
|
meta: commonPageFields.meta
|
|
4470
4471
|
});
|
|
4471
|
-
var
|
|
4472
|
+
var projectMeta = z.object({
|
|
4472
4473
|
// All fields are optional to ensure consistency and allow for the addition of new fields without requiring migration
|
|
4473
4474
|
siteName: z.string().optional(),
|
|
4474
4475
|
contactEmail: z.string().optional(),
|
|
@@ -4476,7 +4477,7 @@ var ProjectMeta = z.object({
|
|
|
4476
4477
|
code: z.string().optional(),
|
|
4477
4478
|
auth: z.string().optional()
|
|
4478
4479
|
});
|
|
4479
|
-
var
|
|
4480
|
+
var projectNewRedirectPath = z.string().min(1, "Path is required").refine((data) => {
|
|
4480
4481
|
try {
|
|
4481
4482
|
new URL(data, "http://url.com");
|
|
4482
4483
|
return true;
|
|
@@ -4484,27 +4485,27 @@ var ProjectNewRedirectPath = z.string().min(1, "Path is required").refine((data)
|
|
|
4484
4485
|
return false;
|
|
4485
4486
|
}
|
|
4486
4487
|
}, "Must be a valid URL");
|
|
4487
|
-
var
|
|
4488
|
-
old:
|
|
4489
|
-
new:
|
|
4488
|
+
var pageRedirect = z.object({
|
|
4489
|
+
old: redirectSourcePath,
|
|
4490
|
+
new: projectNewRedirectPath,
|
|
4490
4491
|
status: z.enum(["301", "302"]).optional()
|
|
4491
4492
|
});
|
|
4492
|
-
var
|
|
4493
|
+
var compilerSettings = z.object({
|
|
4493
4494
|
// All fields are optional to ensure consistency and allow for the addition of new fields without requiring migration
|
|
4494
4495
|
atomicStyles: z.boolean().optional()
|
|
4495
4496
|
});
|
|
4496
|
-
var
|
|
4497
|
-
meta:
|
|
4498
|
-
compiler:
|
|
4499
|
-
redirects: z.array(
|
|
4500
|
-
homePageId:
|
|
4501
|
-
rootFolderId:
|
|
4502
|
-
pages: z.map(
|
|
4503
|
-
pageTemplates: z.map(
|
|
4504
|
-
folders: z.map(
|
|
4505
|
-
}).superRefine((
|
|
4506
|
-
const homePage =
|
|
4507
|
-
const rootFolder =
|
|
4497
|
+
var pages = z.object({
|
|
4498
|
+
meta: projectMeta.optional(),
|
|
4499
|
+
compiler: compilerSettings.optional(),
|
|
4500
|
+
redirects: z.array(pageRedirect).optional(),
|
|
4501
|
+
homePageId: pageId,
|
|
4502
|
+
rootFolderId: folderId,
|
|
4503
|
+
pages: z.map(pageId, page),
|
|
4504
|
+
pageTemplates: z.map(pageId, pageTemplate).optional(),
|
|
4505
|
+
folders: z.map(folderId, folder).refine((folders) => folders.size > 0, "Folders can't be empty")
|
|
4506
|
+
}).superRefine((pages2, context) => {
|
|
4507
|
+
const homePage = pages2.pages.get(pages2.homePageId);
|
|
4508
|
+
const rootFolder = pages2.folders.get(pages2.rootFolderId);
|
|
4508
4509
|
if (homePage === void 0) {
|
|
4509
4510
|
context.addIssue({
|
|
4510
4511
|
code: z.ZodIssueCode.custom,
|
|
@@ -4522,27 +4523,27 @@ var Pages = z.object({
|
|
|
4522
4523
|
if (homePage !== void 0 && homePage.path !== "") {
|
|
4523
4524
|
context.addIssue({
|
|
4524
4525
|
code: z.ZodIssueCode.custom,
|
|
4525
|
-
path: ["pages",
|
|
4526
|
+
path: ["pages", pages2.homePageId, "path"],
|
|
4526
4527
|
message: "Home page path must be empty"
|
|
4527
4528
|
});
|
|
4528
4529
|
}
|
|
4529
|
-
for (const [
|
|
4530
|
-
if (
|
|
4530
|
+
for (const [pageId2, page2] of pages2.pages) {
|
|
4531
|
+
if (page2.id !== pageId2) {
|
|
4531
4532
|
context.addIssue({
|
|
4532
4533
|
code: z.ZodIssueCode.custom,
|
|
4533
|
-
path: ["pages",
|
|
4534
|
+
path: ["pages", pageId2, "id"],
|
|
4534
4535
|
message: "Page id must match its record key"
|
|
4535
4536
|
});
|
|
4536
4537
|
}
|
|
4537
|
-
if (
|
|
4538
|
+
if (pageId2 !== pages2.homePageId && page2.path === "") {
|
|
4538
4539
|
context.addIssue({
|
|
4539
4540
|
code: z.ZodIssueCode.custom,
|
|
4540
|
-
path: ["pages",
|
|
4541
|
+
path: ["pages", pageId2, "path"],
|
|
4541
4542
|
message: "Page path can't be empty"
|
|
4542
4543
|
});
|
|
4543
4544
|
}
|
|
4544
4545
|
}
|
|
4545
|
-
for (const [templateId, template] of
|
|
4546
|
+
for (const [templateId, template] of pages2.pageTemplates ?? []) {
|
|
4546
4547
|
if (template.id !== templateId) {
|
|
4547
4548
|
context.addIssue({
|
|
4548
4549
|
code: z.ZodIssueCode.custom,
|
|
@@ -4550,7 +4551,7 @@ var Pages = z.object({
|
|
|
4550
4551
|
message: "Page template id must match its record key"
|
|
4551
4552
|
});
|
|
4552
4553
|
}
|
|
4553
|
-
if (
|
|
4554
|
+
if (pages2.pages.has(templateId)) {
|
|
4554
4555
|
context.addIssue({
|
|
4555
4556
|
code: z.ZodIssueCode.custom,
|
|
4556
4557
|
path: ["pageTemplates", templateId, "id"],
|
|
@@ -4558,75 +4559,75 @@ var Pages = z.object({
|
|
|
4558
4559
|
});
|
|
4559
4560
|
}
|
|
4560
4561
|
}
|
|
4561
|
-
for (const [
|
|
4562
|
-
if (
|
|
4562
|
+
for (const [folderId2, folder2] of pages2.folders) {
|
|
4563
|
+
if (folder2.id !== folderId2) {
|
|
4563
4564
|
context.addIssue({
|
|
4564
4565
|
code: z.ZodIssueCode.custom,
|
|
4565
|
-
path: ["folders",
|
|
4566
|
+
path: ["folders", folderId2, "id"],
|
|
4566
4567
|
message: "Folder id must match its record key"
|
|
4567
4568
|
});
|
|
4568
4569
|
}
|
|
4569
|
-
for (const [index, childId] of
|
|
4570
|
-
if (
|
|
4570
|
+
for (const [index, childId] of folder2.children.entries()) {
|
|
4571
|
+
if (pages2.pages.has(childId) === false && pages2.folders.has(childId) === false) {
|
|
4571
4572
|
context.addIssue({
|
|
4572
4573
|
code: z.ZodIssueCode.custom,
|
|
4573
|
-
path: ["folders",
|
|
4574
|
+
path: ["folders", folderId2, "children", index],
|
|
4574
4575
|
message: "Folder child must reference an existing page or folder"
|
|
4575
4576
|
});
|
|
4576
4577
|
}
|
|
4577
|
-
if (childId ===
|
|
4578
|
+
if (childId === pages2.rootFolderId) {
|
|
4578
4579
|
context.addIssue({
|
|
4579
4580
|
code: z.ZodIssueCode.custom,
|
|
4580
|
-
path: ["folders",
|
|
4581
|
+
path: ["folders", folderId2, "children", index],
|
|
4581
4582
|
message: "Root folder can't be nested"
|
|
4582
4583
|
});
|
|
4583
4584
|
}
|
|
4584
4585
|
}
|
|
4585
4586
|
}
|
|
4586
|
-
if (rootFolder !== void 0 && rootFolder.children[0] !==
|
|
4587
|
+
if (rootFolder !== void 0 && rootFolder.children[0] !== pages2.homePageId) {
|
|
4587
4588
|
context.addIssue({
|
|
4588
4589
|
code: z.ZodIssueCode.custom,
|
|
4589
|
-
path: ["folders",
|
|
4590
|
+
path: ["folders", pages2.rootFolderId, "children"],
|
|
4590
4591
|
message: "Root folder must start with the home page"
|
|
4591
4592
|
});
|
|
4592
4593
|
}
|
|
4593
4594
|
const childParents = /* @__PURE__ */ new Map();
|
|
4594
|
-
for (const [
|
|
4595
|
-
for (const [index, childId] of
|
|
4595
|
+
for (const [folderId2, folder2] of pages2.folders) {
|
|
4596
|
+
for (const [index, childId] of folder2.children.entries()) {
|
|
4596
4597
|
const parentId = childParents.get(childId);
|
|
4597
4598
|
if (parentId !== void 0) {
|
|
4598
4599
|
context.addIssue({
|
|
4599
4600
|
code: z.ZodIssueCode.custom,
|
|
4600
|
-
path: ["folders",
|
|
4601
|
+
path: ["folders", folderId2, "children", index],
|
|
4601
4602
|
message: `Child is already registered in folder "${parentId}"`
|
|
4602
4603
|
});
|
|
4603
4604
|
continue;
|
|
4604
4605
|
}
|
|
4605
|
-
childParents.set(childId,
|
|
4606
|
+
childParents.set(childId, folderId2);
|
|
4606
4607
|
}
|
|
4607
4608
|
}
|
|
4608
|
-
const hasFolderCycle = (
|
|
4609
|
-
if (path.has(
|
|
4609
|
+
const hasFolderCycle = (folderId2, path = /* @__PURE__ */ new Set()) => {
|
|
4610
|
+
if (path.has(folderId2)) {
|
|
4610
4611
|
return true;
|
|
4611
4612
|
}
|
|
4612
|
-
const
|
|
4613
|
-
if (
|
|
4613
|
+
const folder2 = pages2.folders.get(folderId2);
|
|
4614
|
+
if (folder2 === void 0) {
|
|
4614
4615
|
return false;
|
|
4615
4616
|
}
|
|
4616
|
-
path.add(
|
|
4617
|
-
for (const childId of
|
|
4618
|
-
if (
|
|
4617
|
+
path.add(folderId2);
|
|
4618
|
+
for (const childId of folder2.children) {
|
|
4619
|
+
if (pages2.folders.has(childId) && hasFolderCycle(childId, path)) {
|
|
4619
4620
|
return true;
|
|
4620
4621
|
}
|
|
4621
4622
|
}
|
|
4622
|
-
path.delete(
|
|
4623
|
+
path.delete(folderId2);
|
|
4623
4624
|
return false;
|
|
4624
4625
|
};
|
|
4625
|
-
for (const
|
|
4626
|
-
if (hasFolderCycle(
|
|
4626
|
+
for (const folderId2 of pages2.folders.keys()) {
|
|
4627
|
+
if (hasFolderCycle(folderId2)) {
|
|
4627
4628
|
context.addIssue({
|
|
4628
4629
|
code: z.ZodIssueCode.custom,
|
|
4629
|
-
path: ["folders",
|
|
4630
|
+
path: ["folders", folderId2, "children"],
|
|
4630
4631
|
message: "Folders can't contain cycles"
|
|
4631
4632
|
});
|
|
4632
4633
|
}
|
|
@@ -4634,31 +4635,31 @@ var Pages = z.object({
|
|
|
4634
4635
|
});
|
|
4635
4636
|
|
|
4636
4637
|
// ../css-engine/src/schema.ts
|
|
4637
|
-
var
|
|
4638
|
-
var
|
|
4638
|
+
var unit = z.string();
|
|
4639
|
+
var unitValue = z.object({
|
|
4639
4640
|
type: z.literal("unit"),
|
|
4640
|
-
unit
|
|
4641
|
+
unit,
|
|
4641
4642
|
value: z.number(),
|
|
4642
4643
|
hidden: z.boolean().optional()
|
|
4643
4644
|
});
|
|
4644
|
-
var
|
|
4645
|
+
var keywordValue = z.object({
|
|
4645
4646
|
type: z.literal("keyword"),
|
|
4646
4647
|
// @todo use exact type
|
|
4647
4648
|
value: z.string(),
|
|
4648
4649
|
hidden: z.boolean().optional()
|
|
4649
4650
|
});
|
|
4650
|
-
var
|
|
4651
|
+
var unparsedValue = z.object({
|
|
4651
4652
|
type: z.literal("unparsed"),
|
|
4652
4653
|
value: z.string(),
|
|
4653
4654
|
// For the builder we want to be able to hide background-image
|
|
4654
4655
|
hidden: z.boolean().optional()
|
|
4655
4656
|
});
|
|
4656
|
-
var
|
|
4657
|
+
var fontFamilyValue = z.object({
|
|
4657
4658
|
type: z.literal("fontFamily"),
|
|
4658
4659
|
value: z.array(z.string()),
|
|
4659
4660
|
hidden: z.boolean().optional()
|
|
4660
4661
|
});
|
|
4661
|
-
var
|
|
4662
|
+
var rgbValue = z.object({
|
|
4662
4663
|
type: z.literal("rgb"),
|
|
4663
4664
|
r: z.number(),
|
|
4664
4665
|
g: z.number(),
|
|
@@ -4666,7 +4667,7 @@ var RgbValue = z.object({
|
|
|
4666
4667
|
alpha: z.number(),
|
|
4667
4668
|
hidden: z.boolean().optional()
|
|
4668
4669
|
});
|
|
4669
|
-
var
|
|
4670
|
+
var colorValue = z.object({
|
|
4670
4671
|
type: z.literal("color"),
|
|
4671
4672
|
// all these color spaces are defined by design tokens specification
|
|
4672
4673
|
colorSpace: z.union([
|
|
@@ -4687,16 +4688,16 @@ var ColorValue = z.object({
|
|
|
4687
4688
|
z.literal("xyz-d50")
|
|
4688
4689
|
]),
|
|
4689
4690
|
components: z.tuple([z.number(), z.number(), z.number()]),
|
|
4690
|
-
alpha: z.union([z.number(), z.lazy(() =>
|
|
4691
|
+
alpha: z.union([z.number(), z.lazy(() => varValue)]),
|
|
4691
4692
|
hidden: z.boolean().optional()
|
|
4692
4693
|
});
|
|
4693
|
-
var
|
|
4694
|
+
var functionValue = z.object({
|
|
4694
4695
|
type: z.literal("function"),
|
|
4695
4696
|
name: z.string(),
|
|
4696
|
-
args: z.lazy(() =>
|
|
4697
|
+
args: z.lazy(() => styleValue),
|
|
4697
4698
|
hidden: z.boolean().optional()
|
|
4698
4699
|
});
|
|
4699
|
-
var
|
|
4700
|
+
var imageValue = z.object({
|
|
4700
4701
|
type: z.literal("image"),
|
|
4701
4702
|
value: z.union([
|
|
4702
4703
|
z.object({ type: z.literal("asset"), value: z.string() }),
|
|
@@ -4707,92 +4708,92 @@ var ImageValue = z.object({
|
|
|
4707
4708
|
// For the builder we want to be able to hide images
|
|
4708
4709
|
hidden: z.boolean().optional()
|
|
4709
4710
|
});
|
|
4710
|
-
var
|
|
4711
|
+
var guaranteedInvalidValue = z.object({
|
|
4711
4712
|
type: z.literal("guaranteedInvalid"),
|
|
4712
4713
|
hidden: z.boolean().optional()
|
|
4713
4714
|
});
|
|
4714
|
-
var
|
|
4715
|
+
var invalidValue = z.object({
|
|
4715
4716
|
type: z.literal("invalid"),
|
|
4716
4717
|
value: z.string(),
|
|
4717
4718
|
hidden: z.boolean().optional()
|
|
4718
4719
|
});
|
|
4719
|
-
var
|
|
4720
|
+
var unsetValue = z.object({
|
|
4720
4721
|
type: z.literal("unset"),
|
|
4721
4722
|
value: z.literal(""),
|
|
4722
4723
|
hidden: z.boolean().optional()
|
|
4723
4724
|
});
|
|
4724
|
-
var
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4725
|
+
var varFallback = z.union([
|
|
4726
|
+
unparsedValue,
|
|
4727
|
+
keywordValue,
|
|
4728
|
+
unitValue,
|
|
4729
|
+
colorValue,
|
|
4730
|
+
rgbValue
|
|
4730
4731
|
]);
|
|
4731
|
-
var
|
|
4732
|
+
var varValue = z.object({
|
|
4732
4733
|
type: z.literal("var"),
|
|
4733
4734
|
value: z.string(),
|
|
4734
|
-
fallback:
|
|
4735
|
+
fallback: varFallback.optional(),
|
|
4735
4736
|
hidden: z.boolean().optional()
|
|
4736
4737
|
});
|
|
4737
|
-
var
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4738
|
+
var tupleValueItem = z.union([
|
|
4739
|
+
unitValue,
|
|
4740
|
+
keywordValue,
|
|
4741
|
+
unparsedValue,
|
|
4742
|
+
imageValue,
|
|
4743
|
+
colorValue,
|
|
4744
|
+
rgbValue,
|
|
4745
|
+
functionValue,
|
|
4746
|
+
varValue
|
|
4746
4747
|
]);
|
|
4747
|
-
var
|
|
4748
|
+
var tupleValue = z.object({
|
|
4748
4749
|
type: z.literal("tuple"),
|
|
4749
|
-
value: z.array(
|
|
4750
|
+
value: z.array(tupleValueItem),
|
|
4750
4751
|
hidden: z.boolean().optional()
|
|
4751
4752
|
});
|
|
4752
|
-
var
|
|
4753
|
+
var shadowValue = z.object({
|
|
4753
4754
|
type: z.literal("shadow"),
|
|
4754
4755
|
hidden: z.boolean().optional(),
|
|
4755
4756
|
position: z.union([z.literal("inset"), z.literal("outset")]),
|
|
4756
|
-
offsetX: z.union([
|
|
4757
|
-
offsetY: z.union([
|
|
4758
|
-
blur: z.union([
|
|
4759
|
-
spread: z.union([
|
|
4760
|
-
color: z.union([
|
|
4757
|
+
offsetX: z.union([unitValue, varValue]),
|
|
4758
|
+
offsetY: z.union([unitValue, varValue]),
|
|
4759
|
+
blur: z.union([unitValue, varValue]).optional(),
|
|
4760
|
+
spread: z.union([unitValue, varValue]).optional(),
|
|
4761
|
+
color: z.union([colorValue, rgbValue, keywordValue, varValue]).optional()
|
|
4761
4762
|
});
|
|
4762
|
-
var
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4763
|
+
var layerValueItem = z.union([
|
|
4764
|
+
unitValue,
|
|
4765
|
+
keywordValue,
|
|
4766
|
+
unparsedValue,
|
|
4767
|
+
imageValue,
|
|
4768
|
+
tupleValue,
|
|
4769
|
+
shadowValue,
|
|
4770
|
+
colorValue,
|
|
4771
|
+
rgbValue,
|
|
4772
|
+
invalidValue,
|
|
4773
|
+
functionValue,
|
|
4774
|
+
varValue
|
|
4774
4775
|
]);
|
|
4775
|
-
var
|
|
4776
|
+
var layersValue = z.object({
|
|
4776
4777
|
type: z.literal("layers"),
|
|
4777
|
-
value: z.array(
|
|
4778
|
+
value: z.array(layerValueItem),
|
|
4778
4779
|
hidden: z.boolean().optional()
|
|
4779
4780
|
});
|
|
4780
|
-
var
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4781
|
+
var styleValue = z.union([
|
|
4782
|
+
imageValue,
|
|
4783
|
+
layersValue,
|
|
4784
|
+
unitValue,
|
|
4785
|
+
keywordValue,
|
|
4786
|
+
fontFamilyValue,
|
|
4787
|
+
colorValue,
|
|
4788
|
+
rgbValue,
|
|
4789
|
+
unparsedValue,
|
|
4790
|
+
tupleValue,
|
|
4791
|
+
functionValue,
|
|
4792
|
+
guaranteedInvalidValue,
|
|
4793
|
+
invalidValue,
|
|
4794
|
+
unsetValue,
|
|
4795
|
+
varValue,
|
|
4796
|
+
shadowValue
|
|
4796
4797
|
]);
|
|
4797
4798
|
|
|
4798
4799
|
// ../sdk/src/schema/animation-schema.ts
|
|
@@ -4843,12 +4844,12 @@ var RANGE_UNITS = [
|
|
|
4843
4844
|
"lvmax",
|
|
4844
4845
|
"dvmax"
|
|
4845
4846
|
];
|
|
4846
|
-
var
|
|
4847
|
-
var
|
|
4847
|
+
var rangeUnit = literalUnion(RANGE_UNITS);
|
|
4848
|
+
var rangeUnitValue = z.union([
|
|
4848
4849
|
z.object({
|
|
4849
4850
|
type: z.literal("unit"),
|
|
4850
4851
|
value: z.number(),
|
|
4851
|
-
unit:
|
|
4852
|
+
unit: rangeUnit
|
|
4852
4853
|
}),
|
|
4853
4854
|
z.object({
|
|
4854
4855
|
type: z.literal("unparsed"),
|
|
@@ -4860,32 +4861,32 @@ var rangeUnitValueSchema = z.union([
|
|
|
4860
4861
|
})
|
|
4861
4862
|
]);
|
|
4862
4863
|
var TIME_UNITS = ["ms", "s"];
|
|
4863
|
-
var
|
|
4864
|
-
var
|
|
4864
|
+
var timeUnit = literalUnion(TIME_UNITS);
|
|
4865
|
+
var durationUnitValue = z.union([
|
|
4865
4866
|
z.object({
|
|
4866
4867
|
type: z.literal("unit"),
|
|
4867
4868
|
value: z.number(),
|
|
4868
|
-
unit:
|
|
4869
|
+
unit: timeUnit
|
|
4869
4870
|
}),
|
|
4870
4871
|
z.object({
|
|
4871
4872
|
type: z.literal("var"),
|
|
4872
4873
|
value: z.string()
|
|
4873
4874
|
})
|
|
4874
4875
|
]);
|
|
4875
|
-
var
|
|
4876
|
-
var
|
|
4877
|
-
|
|
4876
|
+
var iterationsUnitValue = z.union([z.number(), z.literal("infinite")]);
|
|
4877
|
+
var insetUnitValue = z.union([
|
|
4878
|
+
rangeUnitValue,
|
|
4878
4879
|
z.object({
|
|
4879
4880
|
type: z.literal("keyword"),
|
|
4880
4881
|
value: z.literal("auto")
|
|
4881
4882
|
})
|
|
4882
4883
|
]);
|
|
4883
|
-
var
|
|
4884
|
-
var
|
|
4884
|
+
var keyframeStyles = z.record(styleValue);
|
|
4885
|
+
var animationKeyframe = z.object({
|
|
4885
4886
|
offset: z.number().optional(),
|
|
4886
|
-
styles:
|
|
4887
|
+
styles: keyframeStyles
|
|
4887
4888
|
});
|
|
4888
|
-
var
|
|
4889
|
+
var keyframeEffectOptions = z.object({
|
|
4889
4890
|
easing: z.string().optional(),
|
|
4890
4891
|
fill: z.union([
|
|
4891
4892
|
z.literal("none"),
|
|
@@ -4894,29 +4895,23 @@ var keyframeEffectOptionsSchema = z.object({
|
|
|
4894
4895
|
z.literal("both")
|
|
4895
4896
|
]).optional(),
|
|
4896
4897
|
// FillMode
|
|
4897
|
-
duration:
|
|
4898
|
-
delay:
|
|
4899
|
-
iterations:
|
|
4898
|
+
duration: durationUnitValue.optional(),
|
|
4899
|
+
delay: durationUnitValue.optional(),
|
|
4900
|
+
iterations: iterationsUnitValue.optional()
|
|
4900
4901
|
});
|
|
4901
|
-
var
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
scrollNamedRangeSchema,
|
|
4907
|
-
rangeUnitValueSchema
|
|
4908
|
-
]);
|
|
4909
|
-
var scrollRangeOptionsSchema = z.object({
|
|
4910
|
-
rangeStart: scrollRangeValueSchema.optional(),
|
|
4911
|
-
rangeEnd: scrollRangeValueSchema.optional()
|
|
4902
|
+
var scrollNamedRange = z.union([z.literal("start"), z.literal("end")]);
|
|
4903
|
+
var scrollRangeValue = z.tuple([scrollNamedRange, rangeUnitValue]);
|
|
4904
|
+
var scrollRangeOptions = z.object({
|
|
4905
|
+
rangeStart: scrollRangeValue.optional(),
|
|
4906
|
+
rangeEnd: scrollRangeValue.optional()
|
|
4912
4907
|
});
|
|
4913
|
-
var
|
|
4908
|
+
var animationAxis = z.union([
|
|
4914
4909
|
z.literal("block"),
|
|
4915
4910
|
z.literal("inline"),
|
|
4916
4911
|
z.literal("x"),
|
|
4917
4912
|
z.literal("y")
|
|
4918
4913
|
]);
|
|
4919
|
-
var
|
|
4914
|
+
var viewNamedRange = z.union([
|
|
4920
4915
|
z.literal("contain"),
|
|
4921
4916
|
z.literal("cover"),
|
|
4922
4917
|
z.literal("entry"),
|
|
@@ -4924,62 +4919,59 @@ var viewNamedRangeSchema = z.union([
|
|
|
4924
4919
|
z.literal("entry-crossing"),
|
|
4925
4920
|
z.literal("exit-crossing")
|
|
4926
4921
|
]);
|
|
4927
|
-
var
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
var viewRangeOptionsSchema = z.object({
|
|
4932
|
-
rangeStart: viewRangeValueSchema.optional(),
|
|
4933
|
-
rangeEnd: viewRangeValueSchema.optional()
|
|
4922
|
+
var viewRangeValue = z.tuple([viewNamedRange, rangeUnitValue]);
|
|
4923
|
+
var viewRangeOptions = z.object({
|
|
4924
|
+
rangeStart: viewRangeValue.optional(),
|
|
4925
|
+
rangeEnd: viewRangeValue.optional()
|
|
4934
4926
|
});
|
|
4935
4927
|
var baseAnimation = z.object({
|
|
4936
4928
|
name: z.string().optional(),
|
|
4937
4929
|
description: z.string().optional(),
|
|
4938
4930
|
enabled: z.array(z.tuple([z.string().describe("breakpointId"), z.boolean()])).optional(),
|
|
4939
|
-
keyframes: z.array(
|
|
4931
|
+
keyframes: z.array(animationKeyframe)
|
|
4940
4932
|
});
|
|
4941
|
-
var
|
|
4933
|
+
var scrollAnimation = baseAnimation.merge(
|
|
4942
4934
|
z.object({
|
|
4943
|
-
timing:
|
|
4935
|
+
timing: keyframeEffectOptions.merge(scrollRangeOptions)
|
|
4944
4936
|
})
|
|
4945
4937
|
);
|
|
4946
|
-
var
|
|
4938
|
+
var scrollAction = z.object({
|
|
4947
4939
|
type: z.literal("scroll"),
|
|
4948
4940
|
source: z.union([z.literal("closest"), z.literal("nearest"), z.literal("root")]).optional(),
|
|
4949
|
-
axis:
|
|
4950
|
-
animations: z.array(
|
|
4941
|
+
axis: animationAxis.optional(),
|
|
4942
|
+
animations: z.array(scrollAnimation),
|
|
4951
4943
|
isPinned: z.boolean().optional(),
|
|
4952
4944
|
debug: z.boolean().optional()
|
|
4953
4945
|
});
|
|
4954
|
-
var
|
|
4946
|
+
var viewAnimation = baseAnimation.merge(
|
|
4955
4947
|
z.object({
|
|
4956
|
-
timing:
|
|
4948
|
+
timing: keyframeEffectOptions.merge(viewRangeOptions)
|
|
4957
4949
|
})
|
|
4958
4950
|
);
|
|
4959
|
-
var
|
|
4951
|
+
var viewAction = z.object({
|
|
4960
4952
|
type: z.literal("view"),
|
|
4961
4953
|
subject: z.string().optional(),
|
|
4962
|
-
axis:
|
|
4963
|
-
animations: z.array(
|
|
4964
|
-
insetStart:
|
|
4965
|
-
insetEnd:
|
|
4954
|
+
axis: animationAxis.optional(),
|
|
4955
|
+
animations: z.array(viewAnimation),
|
|
4956
|
+
insetStart: insetUnitValue.optional(),
|
|
4957
|
+
insetEnd: insetUnitValue.optional(),
|
|
4966
4958
|
isPinned: z.boolean().optional(),
|
|
4967
4959
|
debug: z.boolean().optional()
|
|
4968
4960
|
});
|
|
4969
|
-
var
|
|
4970
|
-
|
|
4971
|
-
|
|
4961
|
+
var animationAction = z.discriminatedUnion("type", [
|
|
4962
|
+
scrollAction,
|
|
4963
|
+
viewAction
|
|
4972
4964
|
]);
|
|
4973
4965
|
|
|
4974
4966
|
// ../sdk/src/schema/props.ts
|
|
4975
|
-
var
|
|
4967
|
+
var propId = z.string();
|
|
4976
4968
|
var baseProp = {
|
|
4977
|
-
id:
|
|
4969
|
+
id: propId,
|
|
4978
4970
|
instanceId: z.string(),
|
|
4979
4971
|
name: z.string(),
|
|
4980
4972
|
required: z.optional(z.boolean())
|
|
4981
4973
|
};
|
|
4982
|
-
var
|
|
4974
|
+
var prop = z.union([
|
|
4983
4975
|
z.object({
|
|
4984
4976
|
...baseProp,
|
|
4985
4977
|
type: z.literal("number"),
|
|
@@ -5055,24 +5047,24 @@ var Prop = z.union([
|
|
|
5055
5047
|
z.object({
|
|
5056
5048
|
...baseProp,
|
|
5057
5049
|
type: z.literal("animationAction"),
|
|
5058
|
-
value:
|
|
5050
|
+
value: animationAction
|
|
5059
5051
|
})
|
|
5060
5052
|
]);
|
|
5061
|
-
var
|
|
5053
|
+
var props = z.map(propId, prop);
|
|
5062
5054
|
|
|
5063
5055
|
// ../sdk/src/schema/resources.ts
|
|
5064
|
-
var
|
|
5065
|
-
var
|
|
5056
|
+
var resourceId = z.string();
|
|
5057
|
+
var method = z.union([
|
|
5066
5058
|
z.literal("get"),
|
|
5067
5059
|
z.literal("post"),
|
|
5068
5060
|
z.literal("put"),
|
|
5069
5061
|
z.literal("delete")
|
|
5070
5062
|
]);
|
|
5071
|
-
var
|
|
5072
|
-
id:
|
|
5063
|
+
var resource = z.object({
|
|
5064
|
+
id: resourceId,
|
|
5073
5065
|
name: z.string(),
|
|
5074
5066
|
control: z.optional(z.union([z.literal("system"), z.literal("graphql")])),
|
|
5075
|
-
method
|
|
5067
|
+
method,
|
|
5076
5068
|
// expression
|
|
5077
5069
|
url: z.string(),
|
|
5078
5070
|
searchParams: z.array(
|
|
@@ -5092,9 +5084,9 @@ var Resource = z.object({
|
|
|
5092
5084
|
// expression
|
|
5093
5085
|
body: z.optional(z.string())
|
|
5094
5086
|
});
|
|
5095
|
-
var
|
|
5087
|
+
var resourceRequest = z.object({
|
|
5096
5088
|
name: z.string(),
|
|
5097
|
-
method
|
|
5089
|
+
method,
|
|
5098
5090
|
url: z.string(),
|
|
5099
5091
|
searchParams: z.array(
|
|
5100
5092
|
z.object({
|
|
@@ -5112,80 +5104,131 @@ var ResourceRequest = z.object({
|
|
|
5112
5104
|
),
|
|
5113
5105
|
body: z.optional(z.unknown())
|
|
5114
5106
|
});
|
|
5115
|
-
var
|
|
5107
|
+
var resources = z.map(resourceId, resource);
|
|
5116
5108
|
|
|
5117
5109
|
// ../sdk/src/schema/style-source-selections.ts
|
|
5118
|
-
var
|
|
5119
|
-
var
|
|
5120
|
-
var
|
|
5121
|
-
instanceId:
|
|
5122
|
-
values: z.array(
|
|
5110
|
+
var instanceId2 = z.string();
|
|
5111
|
+
var styleSourceId = z.string();
|
|
5112
|
+
var styleSourceSelection = z.object({
|
|
5113
|
+
instanceId: instanceId2,
|
|
5114
|
+
values: z.array(styleSourceId)
|
|
5123
5115
|
});
|
|
5124
|
-
var
|
|
5116
|
+
var styleSourceSelections = z.map(instanceId2, styleSourceSelection);
|
|
5125
5117
|
|
|
5126
5118
|
// ../sdk/src/schema/style-sources.ts
|
|
5127
|
-
var
|
|
5128
|
-
var
|
|
5119
|
+
var styleSourceId2 = z.string();
|
|
5120
|
+
var styleSourceToken = z.object({
|
|
5129
5121
|
type: z.literal("token"),
|
|
5130
|
-
id:
|
|
5122
|
+
id: styleSourceId2,
|
|
5131
5123
|
name: z.string(),
|
|
5132
5124
|
locked: z.boolean().optional()
|
|
5133
5125
|
});
|
|
5134
|
-
var
|
|
5126
|
+
var styleSourceLocal = z.object({
|
|
5135
5127
|
type: z.literal("local"),
|
|
5136
|
-
id:
|
|
5128
|
+
id: styleSourceId2
|
|
5137
5129
|
});
|
|
5138
|
-
var
|
|
5139
|
-
var
|
|
5130
|
+
var styleSource = z.union([styleSourceToken, styleSourceLocal]);
|
|
5131
|
+
var styleSources = z.map(styleSourceId2, styleSource);
|
|
5140
5132
|
|
|
5141
5133
|
// ../sdk/src/schema/styles.ts
|
|
5142
|
-
var
|
|
5134
|
+
var styleDeclRaw = z.object({
|
|
5143
5135
|
styleSourceId: z.string(),
|
|
5144
5136
|
breakpointId: z.string(),
|
|
5145
5137
|
state: z.optional(z.string()),
|
|
5146
5138
|
// @todo can't figure out how to make property to be enum
|
|
5147
5139
|
property: z.string(),
|
|
5148
|
-
value:
|
|
5140
|
+
value: styleValue,
|
|
5149
5141
|
listed: z.boolean().optional().describe("Whether the style is from the Advanced panel")
|
|
5150
5142
|
});
|
|
5151
|
-
var
|
|
5152
|
-
var
|
|
5143
|
+
var styleDecl = styleDeclRaw;
|
|
5144
|
+
var styles = z.map(z.string(), styleDecl);
|
|
5145
|
+
|
|
5146
|
+
// ../project-build/src/contracts/namespaces.ts
|
|
5147
|
+
var builderNamespaces = [
|
|
5148
|
+
"pages",
|
|
5149
|
+
"instances",
|
|
5150
|
+
"props",
|
|
5151
|
+
"styles",
|
|
5152
|
+
"styleSources",
|
|
5153
|
+
"styleSourceSelections",
|
|
5154
|
+
"dataSources",
|
|
5155
|
+
"resources",
|
|
5156
|
+
"assets",
|
|
5157
|
+
"breakpoints",
|
|
5158
|
+
"marketplaceProduct"
|
|
5159
|
+
];
|
|
5160
|
+
|
|
5161
|
+
// ../project-build/src/contracts/patch.ts
|
|
5162
|
+
var builderPatchPath = z.array(z.union([z.string(), z.number()]));
|
|
5163
|
+
var requireBuilderPatchValue = (patch, context) => {
|
|
5164
|
+
if (Object.hasOwn(patch, "value") === false) {
|
|
5165
|
+
context.addIssue({
|
|
5166
|
+
code: z.ZodIssueCode.custom,
|
|
5167
|
+
path: ["value"],
|
|
5168
|
+
message: "Required"
|
|
5169
|
+
});
|
|
5170
|
+
}
|
|
5171
|
+
};
|
|
5172
|
+
var builderPatchSchema = z.union([
|
|
5173
|
+
z.object({
|
|
5174
|
+
op: z.literal("add"),
|
|
5175
|
+
path: builderPatchPath,
|
|
5176
|
+
value: z.unknown()
|
|
5177
|
+
}).superRefine(requireBuilderPatchValue),
|
|
5178
|
+
z.object({
|
|
5179
|
+
op: z.literal("replace"),
|
|
5180
|
+
path: builderPatchPath,
|
|
5181
|
+
value: z.unknown()
|
|
5182
|
+
}).superRefine(requireBuilderPatchValue),
|
|
5183
|
+
z.object({
|
|
5184
|
+
op: z.literal("remove"),
|
|
5185
|
+
path: builderPatchPath
|
|
5186
|
+
})
|
|
5187
|
+
]).transform((patch) => patch);
|
|
5188
|
+
var builderPatchChangeSchema = z.object({
|
|
5189
|
+
namespace: z.enum(builderNamespaces),
|
|
5190
|
+
patches: z.array(builderPatchSchema)
|
|
5191
|
+
});
|
|
5192
|
+
var builderPatchTransactionSchema = z.object({
|
|
5193
|
+
id: z.string().min(1),
|
|
5194
|
+
payload: z.array(builderPatchChangeSchema)
|
|
5195
|
+
});
|
|
5153
5196
|
|
|
5154
5197
|
// ../project-migrations/src/pages.ts
|
|
5155
|
-
var
|
|
5156
|
-
meta:
|
|
5157
|
-
compiler:
|
|
5158
|
-
redirects: z.array(
|
|
5198
|
+
var serializedPages = z.object({
|
|
5199
|
+
meta: projectMeta.optional(),
|
|
5200
|
+
compiler: compilerSettings.optional(),
|
|
5201
|
+
redirects: z.array(pageRedirect).optional(),
|
|
5159
5202
|
homePageId: z.string(),
|
|
5160
5203
|
rootFolderId: z.string(),
|
|
5161
|
-
pages: z.array(
|
|
5162
|
-
pageTemplates: z.union([z.array(
|
|
5163
|
-
folders: z.array(
|
|
5204
|
+
pages: z.array(page),
|
|
5205
|
+
pageTemplates: z.union([z.array(pageTemplate), z.record(pageTemplate)]).optional(),
|
|
5206
|
+
folders: z.array(folder)
|
|
5164
5207
|
});
|
|
5165
5208
|
|
|
5166
5209
|
// ../project-build/src/schema.ts
|
|
5167
|
-
var
|
|
5210
|
+
var entry = (value) => z.tuple([z.string(), value]);
|
|
5168
5211
|
var serializedBuildShape = {
|
|
5169
5212
|
id: z.string(),
|
|
5170
5213
|
projectId: z.string(),
|
|
5171
5214
|
version: z.number(),
|
|
5172
5215
|
createdAt: z.string(),
|
|
5173
5216
|
updatedAt: z.string(),
|
|
5174
|
-
pages:
|
|
5175
|
-
breakpoints: z.array(
|
|
5176
|
-
styles: z.array(
|
|
5177
|
-
styleSources: z.array(
|
|
5178
|
-
styleSourceSelections: z.array(
|
|
5179
|
-
props: z.array(
|
|
5180
|
-
instances: z.array(
|
|
5181
|
-
dataSources: z.array(
|
|
5182
|
-
resources: z.array(
|
|
5183
|
-
deployment:
|
|
5217
|
+
pages: serializedPages,
|
|
5218
|
+
breakpoints: z.array(entry(breakpoint)),
|
|
5219
|
+
styles: z.array(entry(styleDecl)),
|
|
5220
|
+
styleSources: z.array(entry(styleSource)),
|
|
5221
|
+
styleSourceSelections: z.array(entry(styleSourceSelection)),
|
|
5222
|
+
props: z.array(entry(prop)),
|
|
5223
|
+
instances: z.array(entry(instance)),
|
|
5224
|
+
dataSources: z.array(entry(dataSource)),
|
|
5225
|
+
resources: z.array(entry(resource)),
|
|
5226
|
+
deployment: deployment.optional()
|
|
5184
5227
|
};
|
|
5185
|
-
var
|
|
5228
|
+
var serializedBuild = z.object(serializedBuildShape);
|
|
5186
5229
|
|
|
5187
5230
|
// ../wsauth/src/schema.ts
|
|
5188
|
-
var
|
|
5231
|
+
var basicAuthInput = z.union([
|
|
5189
5232
|
z.object({
|
|
5190
5233
|
method: z.literal("basic"),
|
|
5191
5234
|
login: z.string(),
|
|
@@ -5197,14 +5240,11 @@ var basicAuthInputSchema = z.union([
|
|
|
5197
5240
|
password: z.string()
|
|
5198
5241
|
})
|
|
5199
5242
|
]);
|
|
5200
|
-
var
|
|
5243
|
+
var wsAuthConfig = z.object({
|
|
5201
5244
|
version: z.literal(1),
|
|
5202
|
-
routes: z.record(
|
|
5245
|
+
routes: z.record(basicAuthInput)
|
|
5203
5246
|
});
|
|
5204
5247
|
|
|
5205
|
-
// package.json
|
|
5206
|
-
var version = "0.272.0";
|
|
5207
|
-
|
|
5208
5248
|
// src/contract-version.ts
|
|
5209
5249
|
var getFunctionContract = (value) => {
|
|
5210
5250
|
if (typeof value !== "function") {
|
|
@@ -5379,8 +5419,7 @@ var stableStringify = (value) => {
|
|
|
5379
5419
|
}
|
|
5380
5420
|
return JSON.stringify(value);
|
|
5381
5421
|
};
|
|
5382
|
-
var createContractVersion = (schema,
|
|
5383
|
-
const bundlePackageVersion = version2.replace(/-webstudio-version$/, "");
|
|
5422
|
+
var createContractVersion = (schema, additionalSchemas = []) => {
|
|
5384
5423
|
let hash = 2166136261;
|
|
5385
5424
|
for (const char of stableStringify({
|
|
5386
5425
|
additionalSchemas: additionalSchemas.map(
|
|
@@ -5391,98 +5430,1709 @@ var createContractVersion = (schema, version2, additionalSchemas = []) => {
|
|
|
5391
5430
|
hash ^= char.charCodeAt(0);
|
|
5392
5431
|
hash = Math.imul(hash, 16777619);
|
|
5393
5432
|
}
|
|
5394
|
-
return `bundle-${
|
|
5433
|
+
return `bundle-${(hash >>> 0).toString(16).padStart(8, "0")}`;
|
|
5395
5434
|
};
|
|
5396
5435
|
|
|
5397
5436
|
// src/schema.ts
|
|
5398
|
-
var
|
|
5399
|
-
var
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5437
|
+
var maxProjectBundleSize = 20 * 1024 * 1024;
|
|
5438
|
+
var stagedUploadPath = "/rest/staged-upload";
|
|
5439
|
+
var stagedUploadProjectIdHeader = "x-webstudio-project-id";
|
|
5440
|
+
var assetFileName = z.string().min(1).regex(/^(?!\.{1,2}$)[^/\\]+$/);
|
|
5441
|
+
var isAssetFileName = (value) => assetFileName.safeParse(value).success;
|
|
5442
|
+
var missingImportedAssetFilesPrefix = "Imported asset files are missing: ";
|
|
5443
|
+
var getMissingImportedAssetFilesMessage = (assetNames) => `${missingImportedAssetFilesPrefix}${JSON.stringify(assetNames)}`;
|
|
5444
|
+
var parseMissingImportedAssetFilesMessage = (error) => {
|
|
5445
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
5446
|
+
const start = message.indexOf(missingImportedAssetFilesPrefix);
|
|
5447
|
+
if (start === -1) {
|
|
5448
|
+
return;
|
|
5405
5449
|
}
|
|
5406
|
-
const
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
if (isAssetFileDataString(value)) {
|
|
5412
|
-
return;
|
|
5413
|
-
}
|
|
5414
|
-
context.addIssue({
|
|
5415
|
-
code: z.ZodIssueCode.custom,
|
|
5416
|
-
message: "Invalid asset file data"
|
|
5417
|
-
});
|
|
5418
|
-
},
|
|
5419
|
-
{
|
|
5420
|
-
contract: {
|
|
5421
|
-
encoding: "base64",
|
|
5422
|
-
length: "multiple-of-4",
|
|
5423
|
-
padding: "only-last-two-characters",
|
|
5424
|
-
pattern: assetFileDataPattern
|
|
5450
|
+
const data = message.slice(start + missingImportedAssetFilesPrefix.length);
|
|
5451
|
+
try {
|
|
5452
|
+
const names = JSON.parse(data);
|
|
5453
|
+
if (Array.isArray(names) && names.every((name) => typeof name === "string")) {
|
|
5454
|
+
return names;
|
|
5425
5455
|
}
|
|
5456
|
+
} catch {
|
|
5426
5457
|
}
|
|
5427
|
-
);
|
|
5428
|
-
|
|
5429
|
-
var
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
var projectBundleSchema = z.object({
|
|
5435
|
-
page: Page,
|
|
5436
|
-
pages: z.array(Page),
|
|
5437
|
-
build: SerializedBuildSchema,
|
|
5438
|
-
assets: z.array(Asset),
|
|
5458
|
+
return data.split(",").map((name) => name.trim()).filter((name) => name !== "");
|
|
5459
|
+
};
|
|
5460
|
+
var projectBundle = z.object({
|
|
5461
|
+
page,
|
|
5462
|
+
pages: z.array(page),
|
|
5463
|
+
build: serializedBuild,
|
|
5464
|
+
assets: z.array(asset),
|
|
5439
5465
|
origin: z.string().optional()
|
|
5440
5466
|
});
|
|
5441
|
-
var
|
|
5467
|
+
var publishedProjectBundle = projectBundle.extend({
|
|
5442
5468
|
bundleVersion: z.union([z.string(), z.number()]).optional(),
|
|
5443
5469
|
user: z.object({ email: z.string().nullable() }).optional(),
|
|
5444
5470
|
projectDomain: z.string(),
|
|
5445
5471
|
projectTitle: z.string()
|
|
5446
5472
|
});
|
|
5447
|
-
var
|
|
5448
|
-
projectId: z.string(),
|
|
5449
|
-
data:
|
|
5450
|
-
|
|
5473
|
+
var importProjectBundleInput = z.object({
|
|
5474
|
+
projectId: z.string().min(1),
|
|
5475
|
+
data: publishedProjectBundle.optional(),
|
|
5476
|
+
uploadId: z.string().min(1).optional(),
|
|
5451
5477
|
ignoreVersionCheck: z.boolean().optional()
|
|
5452
|
-
})
|
|
5453
|
-
|
|
5478
|
+
}).refine(
|
|
5479
|
+
({ data, uploadId }) => data === void 0 !== (uploadId === void 0),
|
|
5480
|
+
{
|
|
5481
|
+
message: "Provide either project bundle data or an upload id",
|
|
5482
|
+
path: ["data"]
|
|
5483
|
+
}
|
|
5484
|
+
);
|
|
5485
|
+
var importProjectBundleResult = z.object({
|
|
5454
5486
|
version: z.number()
|
|
5455
5487
|
});
|
|
5456
|
-
var
|
|
5457
|
-
projectId: z.string()
|
|
5488
|
+
var checkProjectBuildPermissionInput = z.object({
|
|
5489
|
+
projectId: z.string().min(1)
|
|
5458
5490
|
});
|
|
5459
|
-
var
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5491
|
+
var buildPatchNamespaces = builderNamespaces;
|
|
5492
|
+
var buildPatch = builderPatchSchema;
|
|
5493
|
+
var buildPatchTransaction = builderPatchTransactionSchema;
|
|
5494
|
+
var bundleVersion = createContractVersion(publishedProjectBundle, [
|
|
5495
|
+
wsAuthConfig
|
|
5496
|
+
]);
|
|
5464
5497
|
var getBundleVersion = (data) => {
|
|
5465
5498
|
if (typeof data !== "object" || data === null) {
|
|
5466
5499
|
return;
|
|
5467
5500
|
}
|
|
5468
|
-
const
|
|
5469
|
-
return typeof
|
|
5501
|
+
const version = data.bundleVersion;
|
|
5502
|
+
return typeof version === "number" || typeof version === "string" ? version : void 0;
|
|
5470
5503
|
};
|
|
5471
5504
|
var getBundleVersionMismatchMessage = ({
|
|
5472
5505
|
ignoreVersionCheckHint,
|
|
5473
5506
|
receivedVersion
|
|
5474
5507
|
}) => `Project bundle format is incompatible. Expected version ${bundleVersion}, received ${receivedVersion ?? "missing"}. Sync with a compatible API/CLI version and retry, or ${ignoreVersionCheckHint}.`;
|
|
5508
|
+
|
|
5509
|
+
// src/builder-api/operation-docs.ts
|
|
5510
|
+
var publicApiOperationDocumentation = [
|
|
5511
|
+
{
|
|
5512
|
+
command: "whoami",
|
|
5513
|
+
description: "Identify the configured API share-link token",
|
|
5514
|
+
examples: ["webstudio whoami --json"]
|
|
5515
|
+
},
|
|
5516
|
+
{
|
|
5517
|
+
command: "permissions",
|
|
5518
|
+
description: "Show API, role, publish, and domain capabilities for the configured share-link token",
|
|
5519
|
+
examples: ["webstudio permissions --json"]
|
|
5520
|
+
},
|
|
5521
|
+
{
|
|
5522
|
+
command: "inspect",
|
|
5523
|
+
description: "Show project metadata and latest dev build version",
|
|
5524
|
+
examples: ["webstudio inspect --json"]
|
|
5525
|
+
},
|
|
5526
|
+
{
|
|
5527
|
+
command: "snapshot",
|
|
5528
|
+
description: "Read selected raw build namespaces",
|
|
5529
|
+
examples: [
|
|
5530
|
+
"webstudio snapshot --include pages,instances,props,styles --json"
|
|
5531
|
+
]
|
|
5532
|
+
},
|
|
5533
|
+
{
|
|
5534
|
+
command: "apply-patch",
|
|
5535
|
+
description: "Apply Builder build patch transactions to the configured project",
|
|
5536
|
+
requiredOptions: ["base-version", "input", "json"],
|
|
5537
|
+
examples: [
|
|
5538
|
+
"webstudio apply-patch --base-version 42 --input patch.json --json"
|
|
5539
|
+
]
|
|
5540
|
+
},
|
|
5541
|
+
{
|
|
5542
|
+
command: "list-pages",
|
|
5543
|
+
description: "List site pages",
|
|
5544
|
+
examples: [
|
|
5545
|
+
"webstudio list-pages --json",
|
|
5546
|
+
"webstudio list-pages --include-folders --json"
|
|
5547
|
+
]
|
|
5548
|
+
},
|
|
5549
|
+
{
|
|
5550
|
+
command: "get-page",
|
|
5551
|
+
description: "Show one page by page id",
|
|
5552
|
+
requiredOptions: ["page", "json"],
|
|
5553
|
+
examples: ["webstudio get-page --page page-id --json"]
|
|
5554
|
+
},
|
|
5555
|
+
{
|
|
5556
|
+
command: "get-page-by-path",
|
|
5557
|
+
description: "Show one page by URL path",
|
|
5558
|
+
requiredOptions: ["path", "json"],
|
|
5559
|
+
examples: ["webstudio get-page-by-path --path /pricing --json"]
|
|
5560
|
+
},
|
|
5561
|
+
{
|
|
5562
|
+
command: "create-page",
|
|
5563
|
+
description: "Create a page in the configured project",
|
|
5564
|
+
requiredOptions: ["name", "path", "json"],
|
|
5565
|
+
examples: ["webstudio create-page --name Pricing --path /pricing --json"]
|
|
5566
|
+
},
|
|
5567
|
+
{
|
|
5568
|
+
command: "update-page",
|
|
5569
|
+
description: "Update page settings and metadata",
|
|
5570
|
+
requiredOptions: ["page", "json"],
|
|
5571
|
+
examples: [
|
|
5572
|
+
'webstudio update-page --page page-id --title Pricing --description "Pricing plans" --json'
|
|
5573
|
+
]
|
|
5574
|
+
},
|
|
5575
|
+
{
|
|
5576
|
+
command: "get-project-settings",
|
|
5577
|
+
description: "Show project site metadata, compiler settings, and redirects",
|
|
5578
|
+
examples: ["webstudio get-project-settings --json"]
|
|
5579
|
+
},
|
|
5580
|
+
{
|
|
5581
|
+
command: "update-project-settings",
|
|
5582
|
+
description: "Update project site metadata and compiler settings from JSON",
|
|
5583
|
+
requiredOptions: ["input", "json"],
|
|
5584
|
+
examples: [
|
|
5585
|
+
"webstudio update-project-settings --input project-settings.json --json"
|
|
5586
|
+
]
|
|
5587
|
+
},
|
|
5588
|
+
{
|
|
5589
|
+
command: "list-redirects",
|
|
5590
|
+
description: "List project redirects",
|
|
5591
|
+
examples: ["webstudio list-redirects --json"]
|
|
5592
|
+
},
|
|
5593
|
+
{
|
|
5594
|
+
command: "create-redirect",
|
|
5595
|
+
description: "Create a project redirect",
|
|
5596
|
+
requiredOptions: ["old", "new", "json"],
|
|
5597
|
+
examples: [
|
|
5598
|
+
"webstudio create-redirect --old /old --new /new --status 301 --json"
|
|
5599
|
+
]
|
|
5600
|
+
},
|
|
5601
|
+
{
|
|
5602
|
+
command: "update-redirect",
|
|
5603
|
+
description: "Update a project redirect selected by its old path",
|
|
5604
|
+
requiredOptions: ["old", "json"],
|
|
5605
|
+
examples: [
|
|
5606
|
+
"webstudio update-redirect --old /old --new /newer --status 302 --json",
|
|
5607
|
+
"webstudio update-redirect --old /old --clear-status --json"
|
|
5608
|
+
]
|
|
5609
|
+
},
|
|
5610
|
+
{
|
|
5611
|
+
command: "delete-redirect",
|
|
5612
|
+
description: "Delete a project redirect selected by its old path",
|
|
5613
|
+
requiredOptions: ["old", "json"],
|
|
5614
|
+
examples: ["webstudio delete-redirect --old /old --json"]
|
|
5615
|
+
},
|
|
5616
|
+
{
|
|
5617
|
+
command: "list-breakpoints",
|
|
5618
|
+
description: "List responsive and custom-condition breakpoints",
|
|
5619
|
+
examples: ["webstudio list-breakpoints --json"]
|
|
5620
|
+
},
|
|
5621
|
+
{
|
|
5622
|
+
command: "create-breakpoint",
|
|
5623
|
+
description: "Create a breakpoint with width limits or a custom media condition",
|
|
5624
|
+
requiredOptions: ["breakpoint", "label", "json"],
|
|
5625
|
+
examples: [
|
|
5626
|
+
"webstudio create-breakpoint --breakpoint tablet --label Tablet --max-width 991 --json"
|
|
5627
|
+
]
|
|
5628
|
+
},
|
|
5629
|
+
{
|
|
5630
|
+
command: "update-breakpoint",
|
|
5631
|
+
description: "Update breakpoint label, width limits, or media condition",
|
|
5632
|
+
requiredOptions: ["breakpoint", "json"],
|
|
5633
|
+
examples: [
|
|
5634
|
+
"webstudio update-breakpoint --breakpoint tablet --label Tablet --max-width 1023 --json",
|
|
5635
|
+
"webstudio update-breakpoint --breakpoint tablet --clear-condition --min-width 768 --json",
|
|
5636
|
+
"webstudio update-breakpoint --breakpoint tablet --clear-min-width --clear-max-width --condition '(hover: hover)' --json"
|
|
5637
|
+
]
|
|
5638
|
+
},
|
|
5639
|
+
{
|
|
5640
|
+
command: "delete-breakpoint",
|
|
5641
|
+
description: "Delete a breakpoint and all style declarations assigned to it",
|
|
5642
|
+
requiredOptions: ["breakpoint", "confirm", "json"],
|
|
5643
|
+
examples: [
|
|
5644
|
+
"webstudio delete-breakpoint --breakpoint tablet --confirm --json"
|
|
5645
|
+
]
|
|
5646
|
+
},
|
|
5647
|
+
{
|
|
5648
|
+
command: "delete-page",
|
|
5649
|
+
description: "Delete a page and its page content",
|
|
5650
|
+
requiredOptions: ["page", "json"],
|
|
5651
|
+
examples: ["webstudio delete-page --page page-id --json"]
|
|
5652
|
+
},
|
|
5653
|
+
{
|
|
5654
|
+
command: "duplicate-page",
|
|
5655
|
+
description: "Duplicate a page and its page content",
|
|
5656
|
+
requiredOptions: ["page", "json"],
|
|
5657
|
+
examples: [
|
|
5658
|
+
'webstudio duplicate-page --page page-id --name "Pricing Copy" --path /pricing-copy --json'
|
|
5659
|
+
]
|
|
5660
|
+
},
|
|
5661
|
+
{
|
|
5662
|
+
command: "list-page-templates",
|
|
5663
|
+
description: "List reusable page templates in the configured project",
|
|
5664
|
+
examples: ["webstudio list-page-templates --json"]
|
|
5665
|
+
},
|
|
5666
|
+
{
|
|
5667
|
+
command: "create-page-from-template",
|
|
5668
|
+
description: "Create a page by copying a reusable page template",
|
|
5669
|
+
requiredOptions: ["template", "name", "path", "json"],
|
|
5670
|
+
examples: [
|
|
5671
|
+
'webstudio create-page-from-template --template template-id --name "Landing" --path /landing --json'
|
|
5672
|
+
]
|
|
5673
|
+
},
|
|
5674
|
+
{
|
|
5675
|
+
command: "list-folders",
|
|
5676
|
+
description: "List page folders",
|
|
5677
|
+
examples: [
|
|
5678
|
+
"webstudio list-folders --json",
|
|
5679
|
+
"webstudio list-folders --include-pages --json"
|
|
5680
|
+
]
|
|
5681
|
+
},
|
|
5682
|
+
{
|
|
5683
|
+
command: "create-folder",
|
|
5684
|
+
description: "Create a page folder in the configured project",
|
|
5685
|
+
requiredOptions: ["name", "slug", "json"],
|
|
5686
|
+
examples: ["webstudio create-folder --name Blog --slug blog --json"]
|
|
5687
|
+
},
|
|
5688
|
+
{
|
|
5689
|
+
command: "update-folder",
|
|
5690
|
+
description: "Update page folder settings",
|
|
5691
|
+
requiredOptions: ["folder", "json"],
|
|
5692
|
+
examples: [
|
|
5693
|
+
"webstudio update-folder --folder folder-id --name Blog --slug blog --json"
|
|
5694
|
+
]
|
|
5695
|
+
},
|
|
5696
|
+
{
|
|
5697
|
+
command: "delete-folder",
|
|
5698
|
+
description: "Delete a folder with its child folders and pages",
|
|
5699
|
+
requiredOptions: ["folder", "json"],
|
|
5700
|
+
examples: ["webstudio delete-folder --folder folder-id --json"]
|
|
5701
|
+
},
|
|
5702
|
+
{
|
|
5703
|
+
command: "list-instances",
|
|
5704
|
+
description: "List element instances in the build tree",
|
|
5705
|
+
examples: ["webstudio list-instances --path / --max-depth 2 --json"]
|
|
5706
|
+
},
|
|
5707
|
+
{
|
|
5708
|
+
command: "inspect-instance",
|
|
5709
|
+
description: "Show details for one element instance",
|
|
5710
|
+
requiredOptions: ["instance", "json"],
|
|
5711
|
+
examples: [
|
|
5712
|
+
"webstudio inspect-instance --instance instance-id --include props,styles,children --json"
|
|
5713
|
+
]
|
|
5714
|
+
},
|
|
5715
|
+
{
|
|
5716
|
+
command: "append-instance",
|
|
5717
|
+
description: "Append, prepend, or replace child element instances",
|
|
5718
|
+
requiredOptions: ["parent", "input", "json"],
|
|
5719
|
+
examples: [
|
|
5720
|
+
"webstudio append-instance --parent parent-id --input children.json --json"
|
|
5721
|
+
]
|
|
5722
|
+
},
|
|
5723
|
+
{
|
|
5724
|
+
command: "move-instance",
|
|
5725
|
+
description: "Move element instances to another parent or position",
|
|
5726
|
+
requiredOptions: ["input", "json"],
|
|
5727
|
+
examples: ["webstudio move-instance --input moves.json --json"]
|
|
5728
|
+
},
|
|
5729
|
+
{
|
|
5730
|
+
command: "clone-instance",
|
|
5731
|
+
description: "Clone an element instance subtree",
|
|
5732
|
+
requiredOptions: ["source", "json"],
|
|
5733
|
+
examples: [
|
|
5734
|
+
"webstudio clone-instance --source instance-id --parent parent-id --json"
|
|
5735
|
+
]
|
|
5736
|
+
},
|
|
5737
|
+
{
|
|
5738
|
+
command: "delete-instance",
|
|
5739
|
+
description: "Delete element instance subtrees",
|
|
5740
|
+
requiredOptions: ["instance", "json"],
|
|
5741
|
+
examples: ["webstudio delete-instance --instance instance-id --json"]
|
|
5742
|
+
},
|
|
5743
|
+
{
|
|
5744
|
+
command: "update-props",
|
|
5745
|
+
description: "Create or update element props; editor tokens are limited to content-mode props",
|
|
5746
|
+
requiredOptions: ["input", "json"],
|
|
5747
|
+
examples: ["webstudio update-props --input props.json --json"]
|
|
5748
|
+
},
|
|
5749
|
+
{
|
|
5750
|
+
command: "delete-props",
|
|
5751
|
+
description: "Delete element props by instance and prop name; editor tokens are limited to content-mode props",
|
|
5752
|
+
requiredOptions: ["input", "json"],
|
|
5753
|
+
examples: ["webstudio delete-props --input props.json --json"]
|
|
5754
|
+
},
|
|
5755
|
+
{
|
|
5756
|
+
command: "bind-props",
|
|
5757
|
+
description: "Bind element props to expressions, parameters, resources, or actions",
|
|
5758
|
+
requiredOptions: ["input", "json"],
|
|
5759
|
+
examples: ["webstudio bind-props --input bindings.json --json"]
|
|
5760
|
+
},
|
|
5761
|
+
{
|
|
5762
|
+
command: "list-texts",
|
|
5763
|
+
description: "List text and expression children",
|
|
5764
|
+
examples: ["webstudio list-texts --contains headline --json"]
|
|
5765
|
+
},
|
|
5766
|
+
{
|
|
5767
|
+
command: "update-text",
|
|
5768
|
+
description: "Update a text or expression child on an element instance; editor tokens are limited to content-mode text",
|
|
5769
|
+
requiredOptions: ["instance", "child-index", "text", "json"],
|
|
5770
|
+
examples: [
|
|
5771
|
+
'webstudio update-text --instance instance-id --child-index 0 --text "Launch faster" --json'
|
|
5772
|
+
]
|
|
5773
|
+
},
|
|
5774
|
+
{
|
|
5775
|
+
command: "get-styles",
|
|
5776
|
+
description: "List style declarations",
|
|
5777
|
+
examples: ["webstudio get-styles --instance instance-id --json"]
|
|
5778
|
+
},
|
|
5779
|
+
{
|
|
5780
|
+
command: "update-styles",
|
|
5781
|
+
description: "Create or update local style declarations",
|
|
5782
|
+
requiredOptions: ["input", "json"],
|
|
5783
|
+
examples: ["webstudio update-styles --input styles.json --json"]
|
|
5784
|
+
},
|
|
5785
|
+
{
|
|
5786
|
+
command: "delete-styles",
|
|
5787
|
+
description: "Delete local style declarations",
|
|
5788
|
+
requiredOptions: ["input", "json"],
|
|
5789
|
+
examples: ["webstudio delete-styles --input styles.json --json"]
|
|
5790
|
+
},
|
|
5791
|
+
{
|
|
5792
|
+
command: "replace-styles",
|
|
5793
|
+
description: "Replace matching local style values",
|
|
5794
|
+
requiredOptions: ["input", "json"],
|
|
5795
|
+
examples: ["webstudio replace-styles --input replace.json --json"]
|
|
5796
|
+
},
|
|
5797
|
+
{
|
|
5798
|
+
command: "list-design-tokens",
|
|
5799
|
+
description: "List reusable style tokens",
|
|
5800
|
+
examples: ["webstudio list-design-tokens --with-usage --json"]
|
|
5801
|
+
},
|
|
5802
|
+
{
|
|
5803
|
+
command: "create-design-token",
|
|
5804
|
+
description: "Create reusable style tokens",
|
|
5805
|
+
requiredOptions: ["input", "json"],
|
|
5806
|
+
examples: ["webstudio create-design-token --input tokens.json --json"]
|
|
5807
|
+
},
|
|
5808
|
+
{
|
|
5809
|
+
command: "update-design-token-styles",
|
|
5810
|
+
description: "Create or update declarations on a reusable style token",
|
|
5811
|
+
requiredOptions: ["design-token", "input", "json"],
|
|
5812
|
+
examples: [
|
|
5813
|
+
"webstudio update-design-token-styles --design-token token-id --input styles.json --json"
|
|
5814
|
+
]
|
|
5815
|
+
},
|
|
5816
|
+
{
|
|
5817
|
+
command: "delete-design-token-styles",
|
|
5818
|
+
description: "Delete declarations from a reusable style token",
|
|
5819
|
+
requiredOptions: ["design-token", "input", "json"],
|
|
5820
|
+
examples: [
|
|
5821
|
+
"webstudio delete-design-token-styles --design-token token-id --input styles.json --json"
|
|
5822
|
+
]
|
|
5823
|
+
},
|
|
5824
|
+
{
|
|
5825
|
+
command: "attach-design-token",
|
|
5826
|
+
description: "Attach a reusable style token to element instances",
|
|
5827
|
+
requiredOptions: ["design-token", "input", "json"],
|
|
5828
|
+
examples: [
|
|
5829
|
+
"webstudio attach-design-token --design-token token-id --input instances.json --json"
|
|
5830
|
+
]
|
|
5831
|
+
},
|
|
5832
|
+
{
|
|
5833
|
+
command: "detach-design-token",
|
|
5834
|
+
description: "Detach a reusable style token from element instances",
|
|
5835
|
+
requiredOptions: ["design-token", "input", "json"],
|
|
5836
|
+
examples: [
|
|
5837
|
+
"webstudio detach-design-token --design-token token-id --input instances.json --json"
|
|
5838
|
+
]
|
|
5839
|
+
},
|
|
5840
|
+
{
|
|
5841
|
+
command: "extract-design-token",
|
|
5842
|
+
description: "Create a reusable style token from local instance styles",
|
|
5843
|
+
requiredOptions: ["input", "json"],
|
|
5844
|
+
examples: ["webstudio extract-design-token --input token.json --json"]
|
|
5845
|
+
},
|
|
5846
|
+
{
|
|
5847
|
+
command: "list-css-variables",
|
|
5848
|
+
description: "List CSS custom property definitions",
|
|
5849
|
+
examples: ["webstudio list-css-variables --with-usage --json"]
|
|
5850
|
+
},
|
|
5851
|
+
{
|
|
5852
|
+
command: "define-css-variable",
|
|
5853
|
+
description: "Define project-level CSS custom properties",
|
|
5854
|
+
requiredOptions: ["input", "json"],
|
|
5855
|
+
examples: ["webstudio define-css-variable --input vars.json --json"]
|
|
5856
|
+
},
|
|
5857
|
+
{
|
|
5858
|
+
command: "delete-css-variable",
|
|
5859
|
+
description: "Delete CSS custom property definitions",
|
|
5860
|
+
requiredOptions: ["input", "confirm", "json"],
|
|
5861
|
+
examples: [
|
|
5862
|
+
"webstudio delete-css-variable --input names.json --confirm --json"
|
|
5863
|
+
]
|
|
5864
|
+
},
|
|
5865
|
+
{
|
|
5866
|
+
command: "rewrite-css-variable-refs",
|
|
5867
|
+
description: "Rewrite var() references to CSS custom properties",
|
|
5868
|
+
requiredOptions: ["input", "json"],
|
|
5869
|
+
examples: [
|
|
5870
|
+
"webstudio rewrite-css-variable-refs --input variables.json --json"
|
|
5871
|
+
]
|
|
5872
|
+
},
|
|
5873
|
+
{
|
|
5874
|
+
command: "list-variables",
|
|
5875
|
+
description: "List data variables",
|
|
5876
|
+
examples: ["webstudio list-variables --json"]
|
|
5877
|
+
},
|
|
5878
|
+
{
|
|
5879
|
+
command: "create-variable",
|
|
5880
|
+
description: "Create a data variable scoped to an element instance",
|
|
5881
|
+
requiredOptions: [
|
|
5882
|
+
"scope-instance",
|
|
5883
|
+
"name",
|
|
5884
|
+
"value-type",
|
|
5885
|
+
"value",
|
|
5886
|
+
"json"
|
|
5887
|
+
],
|
|
5888
|
+
examples: [
|
|
5889
|
+
'webstudio create-variable --scope-instance body-id --name title --value-type string --value "Hello" --json'
|
|
5890
|
+
]
|
|
5891
|
+
},
|
|
5892
|
+
{
|
|
5893
|
+
command: "update-variable",
|
|
5894
|
+
description: "Update a data variable name, value, or scope",
|
|
5895
|
+
requiredOptions: ["variable", "json"],
|
|
5896
|
+
examples: [
|
|
5897
|
+
`webstudio update-variable --variable variable-id --value-type json --value '{"count":1}' --json`
|
|
5898
|
+
]
|
|
5899
|
+
},
|
|
5900
|
+
{
|
|
5901
|
+
command: "delete-variable",
|
|
5902
|
+
description: "Delete a data variable",
|
|
5903
|
+
requiredOptions: ["variable", "json"],
|
|
5904
|
+
examples: ["webstudio delete-variable --variable variable-id --json"]
|
|
5905
|
+
},
|
|
5906
|
+
{
|
|
5907
|
+
command: "list-resources",
|
|
5908
|
+
description: "List data resources",
|
|
5909
|
+
examples: ["webstudio list-resources --json"]
|
|
5910
|
+
},
|
|
5911
|
+
{
|
|
5912
|
+
command: "create-resource",
|
|
5913
|
+
description: "Create a data resource and optionally expose it as a variable",
|
|
5914
|
+
requiredOptions: ["name", "method", "url", "json"],
|
|
5915
|
+
examples: [
|
|
5916
|
+
'webstudio create-resource --name Posts --method get --url "\\"https://api.example.com/posts\\"" --json'
|
|
5917
|
+
]
|
|
5918
|
+
},
|
|
5919
|
+
{
|
|
5920
|
+
command: "update-resource",
|
|
5921
|
+
description: "Update data resource request fields",
|
|
5922
|
+
requiredOptions: ["resource", "json"],
|
|
5923
|
+
examples: [
|
|
5924
|
+
'webstudio update-resource --resource resource-id --url "\\"https://api.example.com/posts\\"" --json'
|
|
5925
|
+
]
|
|
5926
|
+
},
|
|
5927
|
+
{
|
|
5928
|
+
command: "delete-resource",
|
|
5929
|
+
description: "Delete a data resource and its exposed data variable",
|
|
5930
|
+
requiredOptions: ["resource", "json"],
|
|
5931
|
+
examples: ["webstudio delete-resource --resource resource-id --json"]
|
|
5932
|
+
},
|
|
5933
|
+
{
|
|
5934
|
+
command: "publish",
|
|
5935
|
+
description: "Publish the configured project to staging or production. Uses the project domain by default and, for production, active verified custom domains. If local development cannot contact the deployment backend, the JSON response includes warning while still returning the local publish job id.",
|
|
5936
|
+
requiredOptions: ["target", "json"],
|
|
5937
|
+
examples: [
|
|
5938
|
+
"webstudio publish --target production --json",
|
|
5939
|
+
"webstudio publish --target production --domain example.com --json"
|
|
5940
|
+
]
|
|
5941
|
+
},
|
|
5942
|
+
{
|
|
5943
|
+
command: "list-publishes",
|
|
5944
|
+
description: "List production publish builds for the configured project",
|
|
5945
|
+
examples: ["webstudio list-publishes --json"]
|
|
5946
|
+
},
|
|
5947
|
+
{
|
|
5948
|
+
command: "get-publish-job",
|
|
5949
|
+
description: "Show the status and domains for a publish job returned by publish",
|
|
5950
|
+
requiredOptions: ["job", "json"],
|
|
5951
|
+
examples: ["webstudio get-publish-job --job build-id --json"]
|
|
5952
|
+
},
|
|
5953
|
+
{
|
|
5954
|
+
command: "unpublish",
|
|
5955
|
+
description: "Remove staging or production deployment records for selected domains",
|
|
5956
|
+
requiredOptions: ["target", "confirm", "json"],
|
|
5957
|
+
examples: ["webstudio unpublish --target production --confirm --json"]
|
|
5958
|
+
},
|
|
5959
|
+
{
|
|
5960
|
+
command: "list-domains",
|
|
5961
|
+
description: "List custom domains linked to the configured project",
|
|
5962
|
+
examples: ["webstudio list-domains --json"]
|
|
5963
|
+
},
|
|
5964
|
+
{
|
|
5965
|
+
command: "create-domain",
|
|
5966
|
+
description: "Create and link a custom domain to the configured project",
|
|
5967
|
+
requiredOptions: ["domain", "json"],
|
|
5968
|
+
examples: ["webstudio create-domain --domain example.com --json"]
|
|
5969
|
+
},
|
|
5970
|
+
{
|
|
5971
|
+
command: "update-domain",
|
|
5972
|
+
description: "Update a linked custom domain",
|
|
5973
|
+
requiredOptions: ["domain-id", "json"],
|
|
5974
|
+
examples: [
|
|
5975
|
+
"webstudio update-domain --domain-id domain-id --domain www.example.com --json",
|
|
5976
|
+
"webstudio update-domain --domain-id domain-id --input domain.json --json"
|
|
5977
|
+
]
|
|
5978
|
+
},
|
|
5979
|
+
{
|
|
5980
|
+
command: "delete-domain",
|
|
5981
|
+
description: "Remove a custom domain from the configured project",
|
|
5982
|
+
requiredOptions: ["domain-id", "confirm", "json"],
|
|
5983
|
+
examples: [
|
|
5984
|
+
"webstudio delete-domain --domain-id domain-id --confirm --json"
|
|
5985
|
+
]
|
|
5986
|
+
},
|
|
5987
|
+
{
|
|
5988
|
+
command: "verify-domain",
|
|
5989
|
+
description: "Verify a linked custom domain after DNS records are set",
|
|
5990
|
+
requiredOptions: ["domain-id", "json"],
|
|
5991
|
+
examples: ["webstudio verify-domain --domain-id domain-id --json"]
|
|
5992
|
+
},
|
|
5993
|
+
{
|
|
5994
|
+
command: "list-assets",
|
|
5995
|
+
description: "List project assets",
|
|
5996
|
+
examples: ["webstudio list-assets --type image --with-usage --json"]
|
|
5997
|
+
},
|
|
5998
|
+
{
|
|
5999
|
+
command: "upload-asset",
|
|
6000
|
+
description: "Upload one local asset file from an asset descriptor",
|
|
6001
|
+
requiredOptions: ["input", "json"],
|
|
6002
|
+
examples: [
|
|
6003
|
+
"webstudio upload-asset --input asset.json --assets-dir .webstudio/assets --json"
|
|
6004
|
+
]
|
|
6005
|
+
},
|
|
6006
|
+
{
|
|
6007
|
+
command: "upload-assets",
|
|
6008
|
+
description: "Upload local asset files from asset descriptors",
|
|
6009
|
+
requiredOptions: ["input", "json"],
|
|
6010
|
+
examples: [
|
|
6011
|
+
"webstudio upload-assets --input assets.json --assets-dir .webstudio/assets --json"
|
|
6012
|
+
]
|
|
6013
|
+
},
|
|
6014
|
+
{
|
|
6015
|
+
command: "find-asset-usage",
|
|
6016
|
+
description: "Find where an asset is referenced in the project",
|
|
6017
|
+
requiredOptions: ["asset", "json"],
|
|
6018
|
+
examples: ["webstudio find-asset-usage --asset asset-id --json"]
|
|
6019
|
+
},
|
|
6020
|
+
{
|
|
6021
|
+
command: "replace-asset",
|
|
6022
|
+
description: "Replace asset references and delete the old asset",
|
|
6023
|
+
requiredOptions: ["from", "to", "confirm", "json"],
|
|
6024
|
+
examples: [
|
|
6025
|
+
"webstudio replace-asset --from old-asset-id --to new-asset-id --confirm --json"
|
|
6026
|
+
]
|
|
6027
|
+
},
|
|
6028
|
+
{
|
|
6029
|
+
command: "delete-asset",
|
|
6030
|
+
description: "Delete asset records by id or id prefix",
|
|
6031
|
+
requiredOptions: ["asset", "confirm", "json"],
|
|
6032
|
+
examples: ["webstudio delete-asset --asset asset-id --confirm --json"]
|
|
6033
|
+
}
|
|
6034
|
+
];
|
|
6035
|
+
|
|
6036
|
+
// src/builder-api/errors.ts
|
|
6037
|
+
var publicApiRemoteErrorCodes = [
|
|
6038
|
+
"BAD_REQUEST",
|
|
6039
|
+
"CONFLICT",
|
|
6040
|
+
"FORBIDDEN",
|
|
6041
|
+
"INTERNAL_SERVER_ERROR",
|
|
6042
|
+
"NOT_FOUND",
|
|
6043
|
+
"UNAUTHORIZED"
|
|
6044
|
+
];
|
|
6045
|
+
var publicApiRemoteErrorCodeSet = new Set(publicApiRemoteErrorCodes);
|
|
6046
|
+
var isPublicApiRemoteErrorCode = (code) => publicApiRemoteErrorCodeSet.has(code);
|
|
6047
|
+
|
|
6048
|
+
// ../project-build/src/contracts/builder-runtime.ts
|
|
6049
|
+
var pageNamespaces = ["pages", "instances"];
|
|
6050
|
+
var instanceReadNamespaces = ["pages", "instances", "props"];
|
|
6051
|
+
var styleNamespaces = [
|
|
6052
|
+
"styles",
|
|
6053
|
+
"styleSources",
|
|
6054
|
+
"styleSourceSelections"
|
|
6055
|
+
];
|
|
6056
|
+
var dataNamespaces = ["dataSources", "resources"];
|
|
6057
|
+
var treeMutationNamespaces = [
|
|
6058
|
+
"pages",
|
|
6059
|
+
"instances",
|
|
6060
|
+
"props",
|
|
6061
|
+
...dataNamespaces,
|
|
6062
|
+
...styleNamespaces
|
|
6063
|
+
];
|
|
6064
|
+
var assetUsageNamespaces = [
|
|
6065
|
+
"assets",
|
|
6066
|
+
"pages",
|
|
6067
|
+
"props",
|
|
6068
|
+
"styles",
|
|
6069
|
+
"resources",
|
|
6070
|
+
"dataSources"
|
|
6071
|
+
];
|
|
6072
|
+
var pageCopyNamespaces = [
|
|
6073
|
+
"pages",
|
|
6074
|
+
"assets",
|
|
6075
|
+
"dataSources",
|
|
6076
|
+
"resources",
|
|
6077
|
+
"instances",
|
|
6078
|
+
"props",
|
|
6079
|
+
"breakpoints",
|
|
6080
|
+
"styles",
|
|
6081
|
+
"styleSources",
|
|
6082
|
+
"styleSourceSelections"
|
|
6083
|
+
];
|
|
6084
|
+
var read = (id, readNamespaces) => ({
|
|
6085
|
+
id,
|
|
6086
|
+
kind: "read",
|
|
6087
|
+
readNamespaces,
|
|
6088
|
+
writeNamespaces: [],
|
|
6089
|
+
invalidatesNamespaces: [],
|
|
6090
|
+
retryOnConflict: false
|
|
6091
|
+
});
|
|
6092
|
+
var mutation = (id, {
|
|
6093
|
+
readNamespaces,
|
|
6094
|
+
writeNamespaces,
|
|
6095
|
+
invalidatesNamespaces = writeNamespaces,
|
|
6096
|
+
retryOnConflict = false
|
|
6097
|
+
}) => ({
|
|
6098
|
+
id,
|
|
6099
|
+
kind: "mutation",
|
|
6100
|
+
readNamespaces,
|
|
6101
|
+
writeNamespaces,
|
|
6102
|
+
invalidatesNamespaces,
|
|
6103
|
+
retryOnConflict
|
|
6104
|
+
});
|
|
6105
|
+
var runtimeOperationContracts = [
|
|
6106
|
+
read("pages.list", ["pages"]),
|
|
6107
|
+
read("pages.get", pageNamespaces),
|
|
6108
|
+
read("pages.getByPath", pageNamespaces),
|
|
6109
|
+
mutation("pages.create", {
|
|
6110
|
+
readNamespaces: ["pages"],
|
|
6111
|
+
writeNamespaces: pageNamespaces
|
|
6112
|
+
}),
|
|
6113
|
+
mutation("pages.update", {
|
|
6114
|
+
readNamespaces: ["pages"],
|
|
6115
|
+
writeNamespaces: ["pages"],
|
|
6116
|
+
retryOnConflict: true
|
|
6117
|
+
}),
|
|
6118
|
+
read("projectSettings.get", ["pages"]),
|
|
6119
|
+
mutation("projectSettings.update", {
|
|
6120
|
+
readNamespaces: ["pages"],
|
|
6121
|
+
writeNamespaces: ["pages"],
|
|
6122
|
+
retryOnConflict: true
|
|
6123
|
+
}),
|
|
6124
|
+
read("redirects.list", ["pages"]),
|
|
6125
|
+
mutation("redirects.create", {
|
|
6126
|
+
readNamespaces: ["pages"],
|
|
6127
|
+
writeNamespaces: ["pages"],
|
|
6128
|
+
retryOnConflict: true
|
|
6129
|
+
}),
|
|
6130
|
+
mutation("redirects.update", {
|
|
6131
|
+
readNamespaces: ["pages"],
|
|
6132
|
+
writeNamespaces: ["pages"],
|
|
6133
|
+
retryOnConflict: true
|
|
6134
|
+
}),
|
|
6135
|
+
mutation("redirects.delete", {
|
|
6136
|
+
readNamespaces: ["pages"],
|
|
6137
|
+
writeNamespaces: ["pages"],
|
|
6138
|
+
retryOnConflict: true
|
|
6139
|
+
}),
|
|
6140
|
+
read("breakpoints.list", ["breakpoints"]),
|
|
6141
|
+
mutation("breakpoints.create", {
|
|
6142
|
+
readNamespaces: ["breakpoints"],
|
|
6143
|
+
writeNamespaces: ["breakpoints"],
|
|
6144
|
+
retryOnConflict: true
|
|
6145
|
+
}),
|
|
6146
|
+
mutation("breakpoints.update", {
|
|
6147
|
+
readNamespaces: ["breakpoints"],
|
|
6148
|
+
writeNamespaces: ["breakpoints"],
|
|
6149
|
+
retryOnConflict: true
|
|
6150
|
+
}),
|
|
6151
|
+
mutation("breakpoints.delete", {
|
|
6152
|
+
readNamespaces: ["breakpoints", "styles"],
|
|
6153
|
+
writeNamespaces: ["breakpoints", "styles"],
|
|
6154
|
+
retryOnConflict: true
|
|
6155
|
+
}),
|
|
6156
|
+
mutation("pages.delete", {
|
|
6157
|
+
readNamespaces: treeMutationNamespaces,
|
|
6158
|
+
writeNamespaces: treeMutationNamespaces
|
|
6159
|
+
}),
|
|
6160
|
+
mutation("pages.duplicate", {
|
|
6161
|
+
readNamespaces: pageCopyNamespaces,
|
|
6162
|
+
writeNamespaces: pageCopyNamespaces
|
|
6163
|
+
}),
|
|
6164
|
+
read("pageTemplates.list", ["pages"]),
|
|
6165
|
+
mutation("pageTemplates.createPage", {
|
|
6166
|
+
readNamespaces: pageCopyNamespaces,
|
|
6167
|
+
writeNamespaces: pageCopyNamespaces
|
|
6168
|
+
}),
|
|
6169
|
+
read("folders.list", ["pages"]),
|
|
6170
|
+
mutation("folders.create", {
|
|
6171
|
+
readNamespaces: ["pages"],
|
|
6172
|
+
writeNamespaces: ["pages"]
|
|
6173
|
+
}),
|
|
6174
|
+
mutation("folders.update", {
|
|
6175
|
+
readNamespaces: ["pages"],
|
|
6176
|
+
writeNamespaces: ["pages"],
|
|
6177
|
+
retryOnConflict: true
|
|
6178
|
+
}),
|
|
6179
|
+
mutation("folders.delete", {
|
|
6180
|
+
readNamespaces: treeMutationNamespaces,
|
|
6181
|
+
writeNamespaces: treeMutationNamespaces
|
|
6182
|
+
}),
|
|
6183
|
+
read("instances.list", instanceReadNamespaces),
|
|
6184
|
+
read("instances.inspect", [
|
|
6185
|
+
"instances",
|
|
6186
|
+
"props",
|
|
6187
|
+
"styles",
|
|
6188
|
+
"styleSources",
|
|
6189
|
+
"styleSourceSelections"
|
|
6190
|
+
]),
|
|
6191
|
+
mutation("instances.append", {
|
|
6192
|
+
readNamespaces: treeMutationNamespaces,
|
|
6193
|
+
writeNamespaces: treeMutationNamespaces
|
|
6194
|
+
}),
|
|
6195
|
+
mutation("instances.move", {
|
|
6196
|
+
readNamespaces: ["instances"],
|
|
6197
|
+
writeNamespaces: ["instances"]
|
|
6198
|
+
}),
|
|
6199
|
+
mutation("instances.clone", {
|
|
6200
|
+
readNamespaces: treeMutationNamespaces,
|
|
6201
|
+
writeNamespaces: treeMutationNamespaces
|
|
6202
|
+
}),
|
|
6203
|
+
mutation("instances.delete", {
|
|
6204
|
+
readNamespaces: treeMutationNamespaces,
|
|
6205
|
+
writeNamespaces: treeMutationNamespaces
|
|
6206
|
+
}),
|
|
6207
|
+
mutation("instances.updateProps", {
|
|
6208
|
+
readNamespaces: ["instances", "props"],
|
|
6209
|
+
writeNamespaces: ["props"]
|
|
6210
|
+
}),
|
|
6211
|
+
mutation("instances.deleteProps", {
|
|
6212
|
+
readNamespaces: ["instances", "props"],
|
|
6213
|
+
writeNamespaces: ["props", "resources"]
|
|
6214
|
+
}),
|
|
6215
|
+
mutation("instances.bindProps", {
|
|
6216
|
+
readNamespaces: ["instances", "props", ...dataNamespaces],
|
|
6217
|
+
writeNamespaces: ["props"]
|
|
6218
|
+
}),
|
|
6219
|
+
read("instances.listTexts", ["pages", "instances"]),
|
|
6220
|
+
mutation("instances.updateText", {
|
|
6221
|
+
readNamespaces: ["instances"],
|
|
6222
|
+
writeNamespaces: ["instances"],
|
|
6223
|
+
retryOnConflict: true
|
|
6224
|
+
}),
|
|
6225
|
+
read("styles.getDeclarations", [
|
|
6226
|
+
"instances",
|
|
6227
|
+
...styleNamespaces,
|
|
6228
|
+
"breakpoints"
|
|
6229
|
+
]),
|
|
6230
|
+
mutation("styles.updateDeclarations", {
|
|
6231
|
+
readNamespaces: ["instances", ...styleNamespaces, "breakpoints"],
|
|
6232
|
+
writeNamespaces: ["styles", "styleSources", "styleSourceSelections"]
|
|
6233
|
+
}),
|
|
6234
|
+
mutation("styles.deleteDeclarations", {
|
|
6235
|
+
readNamespaces: ["instances", ...styleNamespaces, "breakpoints"],
|
|
6236
|
+
writeNamespaces: ["styles"]
|
|
6237
|
+
}),
|
|
6238
|
+
mutation("styles.replaceValues", {
|
|
6239
|
+
readNamespaces: ["pages", "instances", ...styleNamespaces],
|
|
6240
|
+
writeNamespaces: ["styles"]
|
|
6241
|
+
}),
|
|
6242
|
+
read("designTokens.list", styleNamespaces),
|
|
6243
|
+
mutation("designTokens.create", {
|
|
6244
|
+
readNamespaces: [...styleNamespaces, "breakpoints"],
|
|
6245
|
+
writeNamespaces: ["styleSources", "styles"]
|
|
6246
|
+
}),
|
|
6247
|
+
mutation("designTokens.updateStyles", {
|
|
6248
|
+
readNamespaces: [...styleNamespaces, "breakpoints"],
|
|
6249
|
+
writeNamespaces: ["styles", "styleSources"]
|
|
6250
|
+
}),
|
|
6251
|
+
mutation("designTokens.deleteStyles", {
|
|
6252
|
+
readNamespaces: [...styleNamespaces, "breakpoints"],
|
|
6253
|
+
writeNamespaces: ["styles"]
|
|
6254
|
+
}),
|
|
6255
|
+
mutation("designTokens.attach", {
|
|
6256
|
+
readNamespaces: ["instances", ...styleNamespaces],
|
|
6257
|
+
writeNamespaces: ["styleSourceSelections"]
|
|
6258
|
+
}),
|
|
6259
|
+
mutation("designTokens.detach", {
|
|
6260
|
+
readNamespaces: ["instances", ...styleNamespaces],
|
|
6261
|
+
writeNamespaces: ["styleSourceSelections"]
|
|
6262
|
+
}),
|
|
6263
|
+
mutation("designTokens.extract", {
|
|
6264
|
+
readNamespaces: ["instances", ...styleNamespaces],
|
|
6265
|
+
writeNamespaces: ["styles", "styleSources", "styleSourceSelections"]
|
|
6266
|
+
}),
|
|
6267
|
+
read("cssVariables.list", [...styleNamespaces, "props"]),
|
|
6268
|
+
mutation("cssVariables.define", {
|
|
6269
|
+
readNamespaces: ["pages", ...styleNamespaces, "breakpoints"],
|
|
6270
|
+
writeNamespaces: ["styles", "styleSources", "styleSourceSelections"]
|
|
6271
|
+
}),
|
|
6272
|
+
mutation("cssVariables.delete", {
|
|
6273
|
+
readNamespaces: [...styleNamespaces, "props"],
|
|
6274
|
+
writeNamespaces: ["styles"]
|
|
6275
|
+
}),
|
|
6276
|
+
mutation("cssVariables.rewriteRefs", {
|
|
6277
|
+
readNamespaces: [...styleNamespaces, "props"],
|
|
6278
|
+
writeNamespaces: ["styles", "props"]
|
|
6279
|
+
}),
|
|
6280
|
+
read("variables.list", ["dataSources"]),
|
|
6281
|
+
mutation("variables.create", {
|
|
6282
|
+
readNamespaces: ["dataSources", "instances"],
|
|
6283
|
+
writeNamespaces: ["dataSources"]
|
|
6284
|
+
}),
|
|
6285
|
+
mutation("variables.update", {
|
|
6286
|
+
readNamespaces: ["dataSources"],
|
|
6287
|
+
writeNamespaces: ["dataSources"],
|
|
6288
|
+
retryOnConflict: true
|
|
6289
|
+
}),
|
|
6290
|
+
mutation("variables.delete", {
|
|
6291
|
+
readNamespaces: ["pages", "instances", "props", ...dataNamespaces],
|
|
6292
|
+
writeNamespaces: ["pages", "instances", "props", ...dataNamespaces]
|
|
6293
|
+
}),
|
|
6294
|
+
read("resources.list", dataNamespaces),
|
|
6295
|
+
mutation("resources.create", {
|
|
6296
|
+
readNamespaces: [
|
|
6297
|
+
"pages",
|
|
6298
|
+
"instances",
|
|
6299
|
+
"props",
|
|
6300
|
+
...dataNamespaces,
|
|
6301
|
+
...styleNamespaces,
|
|
6302
|
+
"breakpoints"
|
|
6303
|
+
],
|
|
6304
|
+
writeNamespaces: [
|
|
6305
|
+
"pages",
|
|
6306
|
+
"instances",
|
|
6307
|
+
"props",
|
|
6308
|
+
...dataNamespaces,
|
|
6309
|
+
...styleNamespaces,
|
|
6310
|
+
"breakpoints"
|
|
6311
|
+
]
|
|
6312
|
+
}),
|
|
6313
|
+
mutation("resources.update", {
|
|
6314
|
+
readNamespaces: [
|
|
6315
|
+
"pages",
|
|
6316
|
+
"instances",
|
|
6317
|
+
"props",
|
|
6318
|
+
...dataNamespaces,
|
|
6319
|
+
...styleNamespaces,
|
|
6320
|
+
"breakpoints"
|
|
6321
|
+
],
|
|
6322
|
+
writeNamespaces: [
|
|
6323
|
+
"pages",
|
|
6324
|
+
"instances",
|
|
6325
|
+
"props",
|
|
6326
|
+
...dataNamespaces,
|
|
6327
|
+
...styleNamespaces,
|
|
6328
|
+
"breakpoints"
|
|
6329
|
+
]
|
|
6330
|
+
}),
|
|
6331
|
+
mutation("resources.delete", {
|
|
6332
|
+
readNamespaces: [...dataNamespaces, "props"],
|
|
6333
|
+
writeNamespaces: [...dataNamespaces, "props"]
|
|
6334
|
+
}),
|
|
6335
|
+
read("assets.list", assetUsageNamespaces),
|
|
6336
|
+
read("assets.findUsage", assetUsageNamespaces),
|
|
6337
|
+
mutation("assets.replace", {
|
|
6338
|
+
readNamespaces: assetUsageNamespaces,
|
|
6339
|
+
writeNamespaces: ["pages", "props", "styles", "assets"]
|
|
6340
|
+
}),
|
|
6341
|
+
mutation("assets.delete", {
|
|
6342
|
+
readNamespaces: assetUsageNamespaces,
|
|
6343
|
+
writeNamespaces: ["assets"]
|
|
6344
|
+
})
|
|
6345
|
+
];
|
|
6346
|
+
|
|
6347
|
+
// src/builder-api/runtime-contracts.ts
|
|
6348
|
+
var publicApiOperationNamespaces = builderNamespaces;
|
|
6349
|
+
var publicRuntimeOperationContracts = runtimeOperationContracts.map(
|
|
6350
|
+
({
|
|
6351
|
+
id,
|
|
6352
|
+
readNamespaces,
|
|
6353
|
+
writeNamespaces,
|
|
6354
|
+
invalidatesNamespaces,
|
|
6355
|
+
retryOnConflict
|
|
6356
|
+
}) => ({
|
|
6357
|
+
id,
|
|
6358
|
+
readNamespaces,
|
|
6359
|
+
writeNamespaces,
|
|
6360
|
+
invalidatesNamespaces,
|
|
6361
|
+
retryOnConflict
|
|
6362
|
+
})
|
|
6363
|
+
);
|
|
6364
|
+
|
|
6365
|
+
// src/builder-api/operations.ts
|
|
6366
|
+
var runtimeOperationById = new Map(
|
|
6367
|
+
publicRuntimeOperationContracts.map((contract) => [contract.id, contract])
|
|
6368
|
+
);
|
|
6369
|
+
var documentationByCommand = new Map(
|
|
6370
|
+
publicApiOperationDocumentation.map((documentation) => [
|
|
6371
|
+
documentation.command,
|
|
6372
|
+
documentation
|
|
6373
|
+
])
|
|
6374
|
+
);
|
|
6375
|
+
var inputFieldsByCommand = {
|
|
6376
|
+
snapshot: ["include", "version"],
|
|
6377
|
+
"list-pages": ["includeFolders"],
|
|
6378
|
+
"get-page": ["pageId"],
|
|
6379
|
+
"get-page-by-path": ["path"],
|
|
6380
|
+
"create-page": ["pageId", "name", "path", "title", "parentFolderId", "meta"],
|
|
6381
|
+
"update-page": ["pageId", "values"],
|
|
6382
|
+
"update-project-settings": ["meta", "compiler"],
|
|
6383
|
+
"create-redirect": ["old", "new", "status"],
|
|
6384
|
+
"update-redirect": ["old", "values"],
|
|
6385
|
+
"delete-redirect": ["old"],
|
|
6386
|
+
"create-breakpoint": ["id", "label", "minWidth", "maxWidth", "condition"],
|
|
6387
|
+
"update-breakpoint": ["breakpointId", "values"],
|
|
6388
|
+
"delete-breakpoint": ["breakpointId"],
|
|
6389
|
+
"delete-page": ["pageId"],
|
|
6390
|
+
"duplicate-page": ["pageId", "parentFolderId", "name", "path"],
|
|
6391
|
+
"create-page-from-template": ["templateId", "parentFolderId", "name", "path"],
|
|
6392
|
+
"list-folders": ["includePages"],
|
|
6393
|
+
"create-folder": ["folderId", "name", "slug", "parentFolderId"],
|
|
6394
|
+
"update-folder": ["folderId", "values"],
|
|
6395
|
+
"delete-folder": ["folderId"],
|
|
6396
|
+
"list-instances": [
|
|
6397
|
+
"pageId",
|
|
6398
|
+
"pagePath",
|
|
6399
|
+
"rootInstanceId",
|
|
6400
|
+
"maxDepth",
|
|
6401
|
+
"topLevelOnly",
|
|
6402
|
+
"component",
|
|
6403
|
+
"tag",
|
|
6404
|
+
"labelContains"
|
|
6405
|
+
],
|
|
6406
|
+
"inspect-instance": ["instanceId", "include", "childDepth"],
|
|
6407
|
+
"append-instance": ["parentInstanceId", "mode", "insertIndex", "children"],
|
|
6408
|
+
"move-instance": ["moves"],
|
|
6409
|
+
"clone-instance": [
|
|
6410
|
+
"sourceInstanceId",
|
|
6411
|
+
"targetParentInstanceId",
|
|
6412
|
+
"insertIndex"
|
|
6413
|
+
],
|
|
6414
|
+
"delete-instance": ["instanceIds"],
|
|
6415
|
+
"update-props": ["updates"],
|
|
6416
|
+
"delete-props": ["deletions"],
|
|
6417
|
+
"bind-props": ["bindings"],
|
|
6418
|
+
"list-texts": [
|
|
6419
|
+
"pageId",
|
|
6420
|
+
"pagePath",
|
|
6421
|
+
"instanceId",
|
|
6422
|
+
"mode",
|
|
6423
|
+
"contains",
|
|
6424
|
+
"maxValueLength"
|
|
6425
|
+
],
|
|
6426
|
+
"update-text": ["instanceId", "childIndex", "text", "mode"],
|
|
6427
|
+
"get-styles": [
|
|
6428
|
+
"instanceIds",
|
|
6429
|
+
"pageId",
|
|
6430
|
+
"pagePath",
|
|
6431
|
+
"breakpoint",
|
|
6432
|
+
"state",
|
|
6433
|
+
"property",
|
|
6434
|
+
"propertyFilter",
|
|
6435
|
+
"includeTokens"
|
|
6436
|
+
],
|
|
6437
|
+
"update-styles": ["updates"],
|
|
6438
|
+
"delete-styles": ["deletions"],
|
|
6439
|
+
"replace-styles": ["property", "fromValue", "toValue", "pageId", "pagePath"],
|
|
6440
|
+
"list-design-tokens": ["filter", "withUsage", "sort"],
|
|
6441
|
+
"create-design-token": ["tokens"],
|
|
6442
|
+
"update-design-token-styles": ["designTokenId", "updates"],
|
|
6443
|
+
"delete-design-token-styles": ["designTokenId", "deletions"],
|
|
6444
|
+
"attach-design-token": ["designTokenId", "instanceIds", "position"],
|
|
6445
|
+
"detach-design-token": ["designTokenId", "instanceIds"],
|
|
6446
|
+
"extract-design-token": ["instanceIds", "name", "removeLocalProps"],
|
|
6447
|
+
"list-css-variables": ["filter", "withUsage"],
|
|
6448
|
+
"define-css-variable": ["vars", "overwrite"],
|
|
6449
|
+
"delete-css-variable": ["names", "force"],
|
|
6450
|
+
"rewrite-css-variable-refs": ["map", "scopeRegex"],
|
|
6451
|
+
"list-variables": ["scopeInstanceId"],
|
|
6452
|
+
"create-variable": ["dataSourceId", "scopeInstanceId", "name", "value"],
|
|
6453
|
+
"update-variable": ["dataSourceId", "values"],
|
|
6454
|
+
"delete-variable": ["dataSourceId"],
|
|
6455
|
+
"list-resources": ["scopeInstanceId"],
|
|
6456
|
+
"create-resource": [
|
|
6457
|
+
"resourceId",
|
|
6458
|
+
"resource",
|
|
6459
|
+
"dataSourceId",
|
|
6460
|
+
"scopeInstanceId",
|
|
6461
|
+
"dataSourceName"
|
|
6462
|
+
],
|
|
6463
|
+
"update-resource": [
|
|
6464
|
+
"resourceId",
|
|
6465
|
+
"values",
|
|
6466
|
+
"dataSourceName",
|
|
6467
|
+
"scopeInstanceId"
|
|
6468
|
+
],
|
|
6469
|
+
"delete-resource": ["resourceId", "force"],
|
|
6470
|
+
publish: ["target", "domains", "message", "idempotencyKey"],
|
|
6471
|
+
"get-publish-job": ["jobId"],
|
|
6472
|
+
unpublish: ["target", "domains", "message", "idempotencyKey"],
|
|
6473
|
+
"create-domain": ["domain"],
|
|
6474
|
+
"update-domain": ["domainId", "updates"],
|
|
6475
|
+
"delete-domain": ["domainId"],
|
|
6476
|
+
"verify-domain": ["domainId"],
|
|
6477
|
+
"list-assets": ["type", "sort", "withUsage", "cursor", "limit"],
|
|
6478
|
+
"find-asset-usage": ["assetId"],
|
|
6479
|
+
"replace-asset": ["fromAssetId", "toAssetId"],
|
|
6480
|
+
"delete-asset": ["assetIdsOrPrefixes", "force"]
|
|
6481
|
+
};
|
|
6482
|
+
var inputFieldsLookup = inputFieldsByCommand;
|
|
6483
|
+
var isRuntimeOperationId = (id) => runtimeOperationById.has(id);
|
|
6484
|
+
var withDefaultPermit = (operation) => {
|
|
6485
|
+
const documentation = documentationByCommand.get(operation.command);
|
|
6486
|
+
if (documentation === void 0) {
|
|
6487
|
+
throw new Error(
|
|
6488
|
+
`Missing public API operation documentation for "${operation.command}".`
|
|
6489
|
+
);
|
|
6490
|
+
}
|
|
6491
|
+
const runtimeOperationId = isRuntimeOperationId(operation.id) ? operation.id : void 0;
|
|
6492
|
+
const runtimeOperation = runtimeOperationId === void 0 ? void 0 : runtimeOperationById.get(runtimeOperationId);
|
|
6493
|
+
return {
|
|
6494
|
+
...operation,
|
|
6495
|
+
permit: operation.permit ?? (operation.method === "query" ? "view" : "build"),
|
|
6496
|
+
description: documentation.description,
|
|
6497
|
+
inputFields: inputFieldsLookup[operation.command] ?? [],
|
|
6498
|
+
requiredOptions: documentation.requiredOptions,
|
|
6499
|
+
examples: documentation.examples,
|
|
6500
|
+
localCapable: runtimeOperation !== void 0,
|
|
6501
|
+
serverOnly: runtimeOperation === void 0,
|
|
6502
|
+
runtimeOperationId,
|
|
6503
|
+
readNamespaces: runtimeOperation?.readNamespaces ?? [],
|
|
6504
|
+
writeNamespaces: runtimeOperation?.writeNamespaces ?? [],
|
|
6505
|
+
invalidatesNamespaces: runtimeOperation?.invalidatesNamespaces ?? operation.invalidatesNamespaces ?? [],
|
|
6506
|
+
retryOnConflict: runtimeOperation?.retryOnConflict ?? false
|
|
6507
|
+
};
|
|
6508
|
+
};
|
|
6509
|
+
var publicApiOperationInputs = [
|
|
6510
|
+
{
|
|
6511
|
+
command: "whoami",
|
|
6512
|
+
id: "auth.me",
|
|
6513
|
+
method: "query",
|
|
6514
|
+
path: "api.auth.me",
|
|
6515
|
+
client: "getApiTokenInfo",
|
|
6516
|
+
permit: "view"
|
|
6517
|
+
},
|
|
6518
|
+
{
|
|
6519
|
+
command: "permissions",
|
|
6520
|
+
id: "projects.permissions",
|
|
6521
|
+
method: "query",
|
|
6522
|
+
path: "api.projects.permissions",
|
|
6523
|
+
client: "getProjectPermissions"
|
|
6524
|
+
},
|
|
6525
|
+
{
|
|
6526
|
+
command: "inspect",
|
|
6527
|
+
id: "projects.get",
|
|
6528
|
+
method: "query",
|
|
6529
|
+
path: "api.projects.get",
|
|
6530
|
+
client: "getProjectInfo"
|
|
6531
|
+
},
|
|
6532
|
+
{
|
|
6533
|
+
command: "snapshot",
|
|
6534
|
+
id: "build.get",
|
|
6535
|
+
method: "query",
|
|
6536
|
+
path: "api.build.get",
|
|
6537
|
+
client: "getBuildSnapshot"
|
|
6538
|
+
},
|
|
6539
|
+
{
|
|
6540
|
+
command: "apply-patch",
|
|
6541
|
+
id: "build.patch",
|
|
6542
|
+
method: "mutation",
|
|
6543
|
+
path: "api.build.patch",
|
|
6544
|
+
client: "applyBuildPatch",
|
|
6545
|
+
invalidatesNamespaces: publicApiOperationNamespaces
|
|
6546
|
+
},
|
|
6547
|
+
{
|
|
6548
|
+
command: "list-pages",
|
|
6549
|
+
id: "pages.list",
|
|
6550
|
+
method: "query",
|
|
6551
|
+
path: "api.pages.list",
|
|
6552
|
+
client: "listPages"
|
|
6553
|
+
},
|
|
6554
|
+
{
|
|
6555
|
+
command: "get-page",
|
|
6556
|
+
id: "pages.get",
|
|
6557
|
+
method: "query",
|
|
6558
|
+
path: "api.pages.get",
|
|
6559
|
+
client: "getPage"
|
|
6560
|
+
},
|
|
6561
|
+
{
|
|
6562
|
+
command: "get-page-by-path",
|
|
6563
|
+
id: "pages.getByPath",
|
|
6564
|
+
method: "query",
|
|
6565
|
+
path: "api.pages.getByPath",
|
|
6566
|
+
client: "getPageByPath"
|
|
6567
|
+
},
|
|
6568
|
+
{
|
|
6569
|
+
command: "create-page",
|
|
6570
|
+
id: "pages.create",
|
|
6571
|
+
method: "mutation",
|
|
6572
|
+
path: "api.pages.create",
|
|
6573
|
+
client: "createPage"
|
|
6574
|
+
},
|
|
6575
|
+
{
|
|
6576
|
+
command: "update-page",
|
|
6577
|
+
id: "pages.update",
|
|
6578
|
+
method: "mutation",
|
|
6579
|
+
path: "api.pages.update",
|
|
6580
|
+
client: "updatePage"
|
|
6581
|
+
},
|
|
6582
|
+
{
|
|
6583
|
+
command: "get-project-settings",
|
|
6584
|
+
id: "projectSettings.get",
|
|
6585
|
+
method: "query",
|
|
6586
|
+
path: "api.projectSettings.get",
|
|
6587
|
+
client: "getProjectSettings"
|
|
6588
|
+
},
|
|
6589
|
+
{
|
|
6590
|
+
command: "update-project-settings",
|
|
6591
|
+
id: "projectSettings.update",
|
|
6592
|
+
method: "mutation",
|
|
6593
|
+
path: "api.projectSettings.update",
|
|
6594
|
+
client: "updateProjectSettings"
|
|
6595
|
+
},
|
|
6596
|
+
{
|
|
6597
|
+
command: "list-redirects",
|
|
6598
|
+
id: "redirects.list",
|
|
6599
|
+
method: "query",
|
|
6600
|
+
path: "api.redirects.list",
|
|
6601
|
+
client: "listRedirects"
|
|
6602
|
+
},
|
|
6603
|
+
{
|
|
6604
|
+
command: "create-redirect",
|
|
6605
|
+
id: "redirects.create",
|
|
6606
|
+
method: "mutation",
|
|
6607
|
+
path: "api.redirects.create",
|
|
6608
|
+
client: "createRedirect"
|
|
6609
|
+
},
|
|
6610
|
+
{
|
|
6611
|
+
command: "update-redirect",
|
|
6612
|
+
id: "redirects.update",
|
|
6613
|
+
method: "mutation",
|
|
6614
|
+
path: "api.redirects.update",
|
|
6615
|
+
client: "updateRedirect"
|
|
6616
|
+
},
|
|
6617
|
+
{
|
|
6618
|
+
command: "delete-redirect",
|
|
6619
|
+
id: "redirects.delete",
|
|
6620
|
+
method: "mutation",
|
|
6621
|
+
path: "api.redirects.delete",
|
|
6622
|
+
client: "deleteRedirect"
|
|
6623
|
+
},
|
|
6624
|
+
{
|
|
6625
|
+
command: "list-breakpoints",
|
|
6626
|
+
id: "breakpoints.list",
|
|
6627
|
+
method: "query",
|
|
6628
|
+
path: "api.breakpoints.list",
|
|
6629
|
+
client: "listBreakpoints"
|
|
6630
|
+
},
|
|
6631
|
+
{
|
|
6632
|
+
command: "create-breakpoint",
|
|
6633
|
+
id: "breakpoints.create",
|
|
6634
|
+
method: "mutation",
|
|
6635
|
+
path: "api.breakpoints.create",
|
|
6636
|
+
client: "createBreakpoint"
|
|
6637
|
+
},
|
|
6638
|
+
{
|
|
6639
|
+
command: "update-breakpoint",
|
|
6640
|
+
id: "breakpoints.update",
|
|
6641
|
+
method: "mutation",
|
|
6642
|
+
path: "api.breakpoints.update",
|
|
6643
|
+
client: "updateBreakpoint"
|
|
6644
|
+
},
|
|
6645
|
+
{
|
|
6646
|
+
command: "delete-breakpoint",
|
|
6647
|
+
id: "breakpoints.delete",
|
|
6648
|
+
method: "mutation",
|
|
6649
|
+
path: "api.breakpoints.delete",
|
|
6650
|
+
client: "deleteBreakpoint"
|
|
6651
|
+
},
|
|
6652
|
+
{
|
|
6653
|
+
command: "delete-page",
|
|
6654
|
+
id: "pages.delete",
|
|
6655
|
+
method: "mutation",
|
|
6656
|
+
path: "api.pages.delete",
|
|
6657
|
+
client: "deletePage"
|
|
6658
|
+
},
|
|
6659
|
+
{
|
|
6660
|
+
command: "duplicate-page",
|
|
6661
|
+
id: "pages.duplicate",
|
|
6662
|
+
method: "mutation",
|
|
6663
|
+
path: "api.pages.duplicate",
|
|
6664
|
+
client: "duplicatePage"
|
|
6665
|
+
},
|
|
6666
|
+
{
|
|
6667
|
+
command: "list-page-templates",
|
|
6668
|
+
id: "pageTemplates.list",
|
|
6669
|
+
method: "query",
|
|
6670
|
+
path: "api.pageTemplates.list",
|
|
6671
|
+
client: "listPageTemplates"
|
|
6672
|
+
},
|
|
6673
|
+
{
|
|
6674
|
+
command: "create-page-from-template",
|
|
6675
|
+
id: "pageTemplates.createPage",
|
|
6676
|
+
method: "mutation",
|
|
6677
|
+
path: "api.pageTemplates.createPage",
|
|
6678
|
+
client: "createPageFromTemplate"
|
|
6679
|
+
},
|
|
6680
|
+
{
|
|
6681
|
+
command: "list-folders",
|
|
6682
|
+
id: "folders.list",
|
|
6683
|
+
method: "query",
|
|
6684
|
+
path: "api.folders.list",
|
|
6685
|
+
client: "listFolders"
|
|
6686
|
+
},
|
|
6687
|
+
{
|
|
6688
|
+
command: "create-folder",
|
|
6689
|
+
id: "folders.create",
|
|
6690
|
+
method: "mutation",
|
|
6691
|
+
path: "api.folders.create",
|
|
6692
|
+
client: "createFolder"
|
|
6693
|
+
},
|
|
6694
|
+
{
|
|
6695
|
+
command: "update-folder",
|
|
6696
|
+
id: "folders.update",
|
|
6697
|
+
method: "mutation",
|
|
6698
|
+
path: "api.folders.update",
|
|
6699
|
+
client: "updateFolder"
|
|
6700
|
+
},
|
|
6701
|
+
{
|
|
6702
|
+
command: "delete-folder",
|
|
6703
|
+
id: "folders.delete",
|
|
6704
|
+
method: "mutation",
|
|
6705
|
+
path: "api.folders.delete",
|
|
6706
|
+
client: "deleteFolder"
|
|
6707
|
+
},
|
|
6708
|
+
{
|
|
6709
|
+
command: "list-instances",
|
|
6710
|
+
id: "instances.list",
|
|
6711
|
+
method: "query",
|
|
6712
|
+
path: "api.instances.list",
|
|
6713
|
+
client: "listInstances"
|
|
6714
|
+
},
|
|
6715
|
+
{
|
|
6716
|
+
command: "inspect-instance",
|
|
6717
|
+
id: "instances.inspect",
|
|
6718
|
+
method: "query",
|
|
6719
|
+
path: "api.instances.inspect",
|
|
6720
|
+
client: "inspectInstance"
|
|
6721
|
+
},
|
|
6722
|
+
{
|
|
6723
|
+
command: "append-instance",
|
|
6724
|
+
id: "instances.append",
|
|
6725
|
+
method: "mutation",
|
|
6726
|
+
path: "api.instances.append",
|
|
6727
|
+
client: "appendInstance"
|
|
6728
|
+
},
|
|
6729
|
+
{
|
|
6730
|
+
command: "move-instance",
|
|
6731
|
+
id: "instances.move",
|
|
6732
|
+
method: "mutation",
|
|
6733
|
+
path: "api.instances.move",
|
|
6734
|
+
client: "moveInstance"
|
|
6735
|
+
},
|
|
6736
|
+
{
|
|
6737
|
+
command: "clone-instance",
|
|
6738
|
+
id: "instances.clone",
|
|
6739
|
+
method: "mutation",
|
|
6740
|
+
path: "api.instances.clone",
|
|
6741
|
+
client: "cloneInstance"
|
|
6742
|
+
},
|
|
6743
|
+
{
|
|
6744
|
+
command: "delete-instance",
|
|
6745
|
+
id: "instances.delete",
|
|
6746
|
+
method: "mutation",
|
|
6747
|
+
path: "api.instances.delete",
|
|
6748
|
+
client: "deleteInstance"
|
|
6749
|
+
},
|
|
6750
|
+
{
|
|
6751
|
+
command: "update-props",
|
|
6752
|
+
id: "instances.updateProps",
|
|
6753
|
+
method: "mutation",
|
|
6754
|
+
path: "api.instances.updateProps",
|
|
6755
|
+
client: "updateProps",
|
|
6756
|
+
permit: "edit"
|
|
6757
|
+
},
|
|
6758
|
+
{
|
|
6759
|
+
command: "delete-props",
|
|
6760
|
+
id: "instances.deleteProps",
|
|
6761
|
+
method: "mutation",
|
|
6762
|
+
path: "api.instances.deleteProps",
|
|
6763
|
+
client: "deleteProps",
|
|
6764
|
+
permit: "edit"
|
|
6765
|
+
},
|
|
6766
|
+
{
|
|
6767
|
+
command: "bind-props",
|
|
6768
|
+
id: "instances.bindProps",
|
|
6769
|
+
method: "mutation",
|
|
6770
|
+
path: "api.instances.bindProps",
|
|
6771
|
+
client: "bindProps"
|
|
6772
|
+
},
|
|
6773
|
+
{
|
|
6774
|
+
command: "list-texts",
|
|
6775
|
+
id: "instances.listTexts",
|
|
6776
|
+
method: "query",
|
|
6777
|
+
path: "api.instances.listTexts",
|
|
6778
|
+
client: "listTexts"
|
|
6779
|
+
},
|
|
6780
|
+
{
|
|
6781
|
+
command: "update-text",
|
|
6782
|
+
id: "instances.updateText",
|
|
6783
|
+
method: "mutation",
|
|
6784
|
+
path: "api.instances.updateText",
|
|
6785
|
+
client: "updateText",
|
|
6786
|
+
permit: "edit"
|
|
6787
|
+
},
|
|
6788
|
+
{
|
|
6789
|
+
command: "get-styles",
|
|
6790
|
+
id: "styles.getDeclarations",
|
|
6791
|
+
method: "query",
|
|
6792
|
+
path: "api.styles.getDeclarations",
|
|
6793
|
+
client: "getStyleDeclarations"
|
|
6794
|
+
},
|
|
6795
|
+
{
|
|
6796
|
+
command: "update-styles",
|
|
6797
|
+
id: "styles.updateDeclarations",
|
|
6798
|
+
method: "mutation",
|
|
6799
|
+
path: "api.styles.updateDeclarations",
|
|
6800
|
+
client: "updateStyleDeclarations"
|
|
6801
|
+
},
|
|
6802
|
+
{
|
|
6803
|
+
command: "delete-styles",
|
|
6804
|
+
id: "styles.deleteDeclarations",
|
|
6805
|
+
method: "mutation",
|
|
6806
|
+
path: "api.styles.deleteDeclarations",
|
|
6807
|
+
client: "deleteStyleDeclarations"
|
|
6808
|
+
},
|
|
6809
|
+
{
|
|
6810
|
+
command: "replace-styles",
|
|
6811
|
+
id: "styles.replaceValues",
|
|
6812
|
+
method: "mutation",
|
|
6813
|
+
path: "api.styles.replaceValues",
|
|
6814
|
+
client: "replaceStyleValues"
|
|
6815
|
+
},
|
|
6816
|
+
{
|
|
6817
|
+
command: "list-design-tokens",
|
|
6818
|
+
id: "designTokens.list",
|
|
6819
|
+
method: "query",
|
|
6820
|
+
path: "api.designTokens.list",
|
|
6821
|
+
client: "listDesignTokens"
|
|
6822
|
+
},
|
|
6823
|
+
{
|
|
6824
|
+
command: "create-design-token",
|
|
6825
|
+
id: "designTokens.create",
|
|
6826
|
+
method: "mutation",
|
|
6827
|
+
path: "api.designTokens.create",
|
|
6828
|
+
client: "createDesignTokens"
|
|
6829
|
+
},
|
|
6830
|
+
{
|
|
6831
|
+
command: "update-design-token-styles",
|
|
6832
|
+
id: "designTokens.updateStyles",
|
|
6833
|
+
method: "mutation",
|
|
6834
|
+
path: "api.designTokens.updateStyles",
|
|
6835
|
+
client: "updateDesignTokenStyles"
|
|
6836
|
+
},
|
|
6837
|
+
{
|
|
6838
|
+
command: "delete-design-token-styles",
|
|
6839
|
+
id: "designTokens.deleteStyles",
|
|
6840
|
+
method: "mutation",
|
|
6841
|
+
path: "api.designTokens.deleteStyles",
|
|
6842
|
+
client: "deleteDesignTokenStyles"
|
|
6843
|
+
},
|
|
6844
|
+
{
|
|
6845
|
+
command: "attach-design-token",
|
|
6846
|
+
id: "designTokens.attach",
|
|
6847
|
+
method: "mutation",
|
|
6848
|
+
path: "api.designTokens.attach",
|
|
6849
|
+
client: "attachDesignToken"
|
|
6850
|
+
},
|
|
6851
|
+
{
|
|
6852
|
+
command: "detach-design-token",
|
|
6853
|
+
id: "designTokens.detach",
|
|
6854
|
+
method: "mutation",
|
|
6855
|
+
path: "api.designTokens.detach",
|
|
6856
|
+
client: "detachDesignToken"
|
|
6857
|
+
},
|
|
6858
|
+
{
|
|
6859
|
+
command: "extract-design-token",
|
|
6860
|
+
id: "designTokens.extract",
|
|
6861
|
+
method: "mutation",
|
|
6862
|
+
path: "api.designTokens.extract",
|
|
6863
|
+
client: "extractDesignToken"
|
|
6864
|
+
},
|
|
6865
|
+
{
|
|
6866
|
+
command: "list-css-variables",
|
|
6867
|
+
id: "cssVariables.list",
|
|
6868
|
+
method: "query",
|
|
6869
|
+
path: "api.cssVariables.list",
|
|
6870
|
+
client: "listCssVariables"
|
|
6871
|
+
},
|
|
6872
|
+
{
|
|
6873
|
+
command: "define-css-variable",
|
|
6874
|
+
id: "cssVariables.define",
|
|
6875
|
+
method: "mutation",
|
|
6876
|
+
path: "api.cssVariables.define",
|
|
6877
|
+
client: "defineCssVariables"
|
|
6878
|
+
},
|
|
6879
|
+
{
|
|
6880
|
+
command: "delete-css-variable",
|
|
6881
|
+
id: "cssVariables.delete",
|
|
6882
|
+
method: "mutation",
|
|
6883
|
+
path: "api.cssVariables.delete",
|
|
6884
|
+
client: "deleteCssVariables"
|
|
6885
|
+
},
|
|
6886
|
+
{
|
|
6887
|
+
command: "rewrite-css-variable-refs",
|
|
6888
|
+
id: "cssVariables.rewriteRefs",
|
|
6889
|
+
method: "mutation",
|
|
6890
|
+
path: "api.cssVariables.rewriteRefs",
|
|
6891
|
+
client: "rewriteCssVariableRefs"
|
|
6892
|
+
},
|
|
6893
|
+
{
|
|
6894
|
+
command: "list-variables",
|
|
6895
|
+
id: "variables.list",
|
|
6896
|
+
method: "query",
|
|
6897
|
+
path: "api.variables.list",
|
|
6898
|
+
client: "listVariables"
|
|
6899
|
+
},
|
|
6900
|
+
{
|
|
6901
|
+
command: "create-variable",
|
|
6902
|
+
id: "variables.create",
|
|
6903
|
+
method: "mutation",
|
|
6904
|
+
path: "api.variables.create",
|
|
6905
|
+
client: "createVariable"
|
|
6906
|
+
},
|
|
6907
|
+
{
|
|
6908
|
+
command: "update-variable",
|
|
6909
|
+
id: "variables.update",
|
|
6910
|
+
method: "mutation",
|
|
6911
|
+
path: "api.variables.update",
|
|
6912
|
+
client: "updateVariable"
|
|
6913
|
+
},
|
|
6914
|
+
{
|
|
6915
|
+
command: "delete-variable",
|
|
6916
|
+
id: "variables.delete",
|
|
6917
|
+
method: "mutation",
|
|
6918
|
+
path: "api.variables.delete",
|
|
6919
|
+
client: "deleteVariable"
|
|
6920
|
+
},
|
|
6921
|
+
{
|
|
6922
|
+
command: "list-resources",
|
|
6923
|
+
id: "resources.list",
|
|
6924
|
+
method: "query",
|
|
6925
|
+
path: "api.resources.list",
|
|
6926
|
+
client: "listResources"
|
|
6927
|
+
},
|
|
6928
|
+
{
|
|
6929
|
+
command: "create-resource",
|
|
6930
|
+
id: "resources.create",
|
|
6931
|
+
method: "mutation",
|
|
6932
|
+
path: "api.resources.create",
|
|
6933
|
+
client: "createResource"
|
|
6934
|
+
},
|
|
6935
|
+
{
|
|
6936
|
+
command: "update-resource",
|
|
6937
|
+
id: "resources.update",
|
|
6938
|
+
method: "mutation",
|
|
6939
|
+
path: "api.resources.update",
|
|
6940
|
+
client: "updateResource"
|
|
6941
|
+
},
|
|
6942
|
+
{
|
|
6943
|
+
command: "delete-resource",
|
|
6944
|
+
id: "resources.delete",
|
|
6945
|
+
method: "mutation",
|
|
6946
|
+
path: "api.resources.delete",
|
|
6947
|
+
client: "deleteResource"
|
|
6948
|
+
},
|
|
6949
|
+
{
|
|
6950
|
+
command: "publish",
|
|
6951
|
+
id: "publish.create",
|
|
6952
|
+
method: "mutation",
|
|
6953
|
+
path: "api.publish.create",
|
|
6954
|
+
client: "publish",
|
|
6955
|
+
permit: "edit"
|
|
6956
|
+
},
|
|
6957
|
+
{
|
|
6958
|
+
command: "list-publishes",
|
|
6959
|
+
id: "publish.list",
|
|
6960
|
+
method: "query",
|
|
6961
|
+
path: "api.publish.list",
|
|
6962
|
+
client: "listPublishes"
|
|
6963
|
+
},
|
|
6964
|
+
{
|
|
6965
|
+
command: "get-publish-job",
|
|
6966
|
+
id: "publish.getJob",
|
|
6967
|
+
method: "query",
|
|
6968
|
+
path: "api.publish.getJob",
|
|
6969
|
+
client: "getPublishJob"
|
|
6970
|
+
},
|
|
6971
|
+
{
|
|
6972
|
+
command: "unpublish",
|
|
6973
|
+
id: "publish.unpublish",
|
|
6974
|
+
method: "mutation",
|
|
6975
|
+
path: "api.publish.unpublish",
|
|
6976
|
+
client: "unpublish",
|
|
6977
|
+
permit: "edit"
|
|
6978
|
+
},
|
|
6979
|
+
{
|
|
6980
|
+
command: "list-domains",
|
|
6981
|
+
id: "domains.list",
|
|
6982
|
+
method: "query",
|
|
6983
|
+
path: "api.domains.list",
|
|
6984
|
+
client: "listDomains"
|
|
6985
|
+
},
|
|
6986
|
+
{
|
|
6987
|
+
command: "create-domain",
|
|
6988
|
+
id: "domains.create",
|
|
6989
|
+
method: "mutation",
|
|
6990
|
+
path: "api.domains.create",
|
|
6991
|
+
client: "createDomain",
|
|
6992
|
+
permit: "admin"
|
|
6993
|
+
},
|
|
6994
|
+
{
|
|
6995
|
+
command: "update-domain",
|
|
6996
|
+
id: "domains.update",
|
|
6997
|
+
method: "mutation",
|
|
6998
|
+
path: "api.domains.update",
|
|
6999
|
+
client: "updateDomain",
|
|
7000
|
+
permit: "admin"
|
|
7001
|
+
},
|
|
7002
|
+
{
|
|
7003
|
+
command: "delete-domain",
|
|
7004
|
+
id: "domains.delete",
|
|
7005
|
+
method: "mutation",
|
|
7006
|
+
path: "api.domains.delete",
|
|
7007
|
+
client: "deleteDomain",
|
|
7008
|
+
permit: "admin"
|
|
7009
|
+
},
|
|
7010
|
+
{
|
|
7011
|
+
command: "verify-domain",
|
|
7012
|
+
id: "domains.verify",
|
|
7013
|
+
method: "mutation",
|
|
7014
|
+
path: "api.domains.verify",
|
|
7015
|
+
client: "verifyDomain",
|
|
7016
|
+
permit: "admin"
|
|
7017
|
+
},
|
|
7018
|
+
{
|
|
7019
|
+
command: "list-assets",
|
|
7020
|
+
id: "assets.list",
|
|
7021
|
+
method: "query",
|
|
7022
|
+
path: "api.assets.list",
|
|
7023
|
+
client: "listAssets"
|
|
7024
|
+
},
|
|
7025
|
+
{
|
|
7026
|
+
command: "upload-asset",
|
|
7027
|
+
id: "assets.upload",
|
|
7028
|
+
method: "mutation",
|
|
7029
|
+
client: "uploadProjectAsset",
|
|
7030
|
+
invalidatesNamespaces: ["assets"]
|
|
7031
|
+
},
|
|
7032
|
+
{
|
|
7033
|
+
command: "upload-assets",
|
|
7034
|
+
id: "assets.uploadMany",
|
|
7035
|
+
method: "mutation",
|
|
7036
|
+
client: "uploadProjectAssets",
|
|
7037
|
+
invalidatesNamespaces: ["assets"]
|
|
7038
|
+
},
|
|
7039
|
+
{
|
|
7040
|
+
command: "find-asset-usage",
|
|
7041
|
+
id: "assets.findUsage",
|
|
7042
|
+
method: "query",
|
|
7043
|
+
path: "api.assets.findUsage",
|
|
7044
|
+
client: "findAssetUsage"
|
|
7045
|
+
},
|
|
7046
|
+
{
|
|
7047
|
+
command: "replace-asset",
|
|
7048
|
+
id: "assets.replace",
|
|
7049
|
+
method: "mutation",
|
|
7050
|
+
path: "api.assets.replace",
|
|
7051
|
+
client: "replaceAsset"
|
|
7052
|
+
},
|
|
7053
|
+
{
|
|
7054
|
+
command: "delete-asset",
|
|
7055
|
+
id: "assets.delete",
|
|
7056
|
+
method: "mutation",
|
|
7057
|
+
path: "api.assets.delete",
|
|
7058
|
+
client: "deleteAssets"
|
|
7059
|
+
}
|
|
7060
|
+
];
|
|
7061
|
+
var publicApiOperations = publicApiOperationInputs.map(withDefaultPermit);
|
|
7062
|
+
var publicApiOperationByCommand = new Map(
|
|
7063
|
+
publicApiOperations.map((operation) => [operation.command, operation])
|
|
7064
|
+
);
|
|
7065
|
+
var getPublicApiOperation = (command) => {
|
|
7066
|
+
const operation = publicApiOperationByCommand.get(command);
|
|
7067
|
+
if (operation === void 0) {
|
|
7068
|
+
throw new Error(`Unknown public API operation "${command}".`);
|
|
7069
|
+
}
|
|
7070
|
+
return operation;
|
|
7071
|
+
};
|
|
7072
|
+
var getPublicApiOperationPath = (command) => {
|
|
7073
|
+
const operation = getPublicApiOperation(command);
|
|
7074
|
+
const path = "path" in operation ? operation.path : void 0;
|
|
7075
|
+
if (path === void 0) {
|
|
7076
|
+
throw new Error(`Public API operation "${command}" has no tRPC path.`);
|
|
7077
|
+
}
|
|
7078
|
+
return path;
|
|
7079
|
+
};
|
|
7080
|
+
|
|
7081
|
+
// src/builder-api/url.ts
|
|
7082
|
+
var buildProjectDomainPrefix = "p-";
|
|
7083
|
+
var parseBuilderUrl = (urlStr) => {
|
|
7084
|
+
const url = new URL(urlStr);
|
|
7085
|
+
const fragments = url.host.split(".");
|
|
7086
|
+
const re = /^(?<prefix>[a-z-]+)(?<uuid>[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})(-dot-(?<branch>.*))?/;
|
|
7087
|
+
const match = fragments[0].match(re);
|
|
7088
|
+
const prefix = match?.groups?.prefix;
|
|
7089
|
+
const projectId = match?.groups?.uuid;
|
|
7090
|
+
const branch = match?.groups?.branch;
|
|
7091
|
+
if (prefix !== buildProjectDomainPrefix) {
|
|
7092
|
+
return {
|
|
7093
|
+
projectId: void 0,
|
|
7094
|
+
sourceOrigin: url.origin
|
|
7095
|
+
};
|
|
7096
|
+
}
|
|
7097
|
+
if (projectId === void 0) {
|
|
7098
|
+
return {
|
|
7099
|
+
projectId: void 0,
|
|
7100
|
+
sourceOrigin: url.origin
|
|
7101
|
+
};
|
|
7102
|
+
}
|
|
7103
|
+
fragments[0] = fragments[0].replace(re, branch ?? "");
|
|
7104
|
+
const sourceUrl = new URL(url.origin);
|
|
7105
|
+
sourceUrl.protocol = "https";
|
|
7106
|
+
sourceUrl.host = fragments.filter(Boolean).join(".");
|
|
7107
|
+
return {
|
|
7108
|
+
projectId,
|
|
7109
|
+
sourceOrigin: sourceUrl.origin
|
|
7110
|
+
};
|
|
7111
|
+
};
|
|
5475
7112
|
export {
|
|
5476
|
-
|
|
5477
|
-
|
|
7113
|
+
buildPatch,
|
|
7114
|
+
buildPatchNamespaces,
|
|
7115
|
+
buildPatchTransaction,
|
|
5478
7116
|
bundleVersion,
|
|
5479
|
-
|
|
7117
|
+
checkProjectBuildPermissionInput,
|
|
5480
7118
|
getBundleVersion,
|
|
5481
7119
|
getBundleVersionMismatchMessage,
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
7120
|
+
getMissingImportedAssetFilesMessage,
|
|
7121
|
+
getPublicApiOperation,
|
|
7122
|
+
getPublicApiOperationPath,
|
|
7123
|
+
importProjectBundleInput,
|
|
7124
|
+
importProjectBundleResult,
|
|
5485
7125
|
isAssetFileName,
|
|
5486
|
-
|
|
5487
|
-
|
|
7126
|
+
isPublicApiRemoteErrorCode,
|
|
7127
|
+
maxProjectBundleSize,
|
|
7128
|
+
parseBuilderUrl,
|
|
7129
|
+
parseMissingImportedAssetFilesMessage,
|
|
7130
|
+
projectBundle,
|
|
7131
|
+
publicApiOperationDocumentation,
|
|
7132
|
+
publicApiOperationNamespaces,
|
|
7133
|
+
publicApiOperations,
|
|
7134
|
+
publicRuntimeOperationContracts,
|
|
7135
|
+
publishedProjectBundle,
|
|
7136
|
+
stagedUploadPath,
|
|
7137
|
+
stagedUploadProjectIdHeader
|
|
5488
7138
|
};
|