@webstudio-is/protocol 0.273.0 → 0.274.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +1669 -0
- 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/index.d.ts +5 -0
- package/lib/types/schema.d.ts +246 -222
- package/package.json +4 -4
package/lib/index.js
CHANGED
|
@@ -5143,6 +5143,57 @@ var styleDeclRaw = z.object({
|
|
|
5143
5143
|
var styleDecl = styleDeclRaw;
|
|
5144
5144
|
var styles = z.map(z.string(), styleDecl);
|
|
5145
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
|
+
});
|
|
5196
|
+
|
|
5146
5197
|
// ../project-migrations/src/pages.ts
|
|
5147
5198
|
var serializedPages = z.object({
|
|
5148
5199
|
meta: projectMeta.optional(),
|
|
@@ -5437,6 +5488,9 @@ var importProjectBundleResult = z.object({
|
|
|
5437
5488
|
var checkProjectBuildPermissionInput = z.object({
|
|
5438
5489
|
projectId: z.string().min(1)
|
|
5439
5490
|
});
|
|
5491
|
+
var buildPatchNamespaces = builderNamespaces;
|
|
5492
|
+
var buildPatch = builderPatchSchema;
|
|
5493
|
+
var buildPatchTransaction = builderPatchTransactionSchema;
|
|
5440
5494
|
var bundleVersion = createContractVersion(publishedProjectBundle, [
|
|
5441
5495
|
wsAuthConfig
|
|
5442
5496
|
]);
|
|
@@ -5451,18 +5505,1633 @@ var getBundleVersionMismatchMessage = ({
|
|
|
5451
5505
|
ignoreVersionCheckHint,
|
|
5452
5506
|
receivedVersion
|
|
5453
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
|
+
};
|
|
5454
7112
|
export {
|
|
7113
|
+
buildPatch,
|
|
7114
|
+
buildPatchNamespaces,
|
|
7115
|
+
buildPatchTransaction,
|
|
5455
7116
|
bundleVersion,
|
|
5456
7117
|
checkProjectBuildPermissionInput,
|
|
5457
7118
|
getBundleVersion,
|
|
5458
7119
|
getBundleVersionMismatchMessage,
|
|
5459
7120
|
getMissingImportedAssetFilesMessage,
|
|
7121
|
+
getPublicApiOperation,
|
|
7122
|
+
getPublicApiOperationPath,
|
|
5460
7123
|
importProjectBundleInput,
|
|
5461
7124
|
importProjectBundleResult,
|
|
5462
7125
|
isAssetFileName,
|
|
7126
|
+
isPublicApiRemoteErrorCode,
|
|
5463
7127
|
maxProjectBundleSize,
|
|
7128
|
+
parseBuilderUrl,
|
|
5464
7129
|
parseMissingImportedAssetFilesMessage,
|
|
5465
7130
|
projectBundle,
|
|
7131
|
+
publicApiOperationDocumentation,
|
|
7132
|
+
publicApiOperationNamespaces,
|
|
7133
|
+
publicApiOperations,
|
|
7134
|
+
publicRuntimeOperationContracts,
|
|
5466
7135
|
publishedProjectBundle,
|
|
5467
7136
|
stagedUploadPath,
|
|
5468
7137
|
stagedUploadProjectIdHeader
|