@webstudio-is/sdk 0.168.0 → 0.174.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/index.js CHANGED
@@ -322,6 +322,12 @@ var Prop = z6.union([
322
322
  // data source id
323
323
  value: z6.string()
324
324
  }),
325
+ z6.object({
326
+ ...baseProp,
327
+ type: z6.literal("resource"),
328
+ // resource id
329
+ value: z6.string()
330
+ }),
325
331
  z6.object({
326
332
  ...baseProp,
327
333
  type: z6.literal("expression"),
@@ -410,10 +416,19 @@ var Styles = z10.map(z10.string(), StyleDecl);
410
416
 
411
417
  // src/schema/deployment.ts
412
418
  import { z as z11 } from "zod";
413
- var Deployment = z11.object({
414
- domains: z11.array(z11.string()),
415
- projectDomain: z11.string()
416
- });
419
+ var Deployment = z11.union([
420
+ z11.object({
421
+ destination: z11.literal("static"),
422
+ name: z11.string(),
423
+ assetsDomain: z11.string(),
424
+ templates: z11.array(z11.string())
425
+ }),
426
+ z11.object({
427
+ destination: z11.literal("saas").optional(),
428
+ domains: z11.array(z11.string()),
429
+ projectDomain: z11.string()
430
+ })
431
+ ]);
417
432
 
418
433
  // src/schema/webstudio.ts
419
434
  import { z as z12 } from "zod";
@@ -827,7 +842,7 @@ var getStaticSiteMapXml = (pages, updatedAt) => {
827
842
  };
828
843
 
829
844
  // src/scope.ts
830
- var normalizeName = (name) => {
845
+ var normalizeJsName = (name) => {
831
846
  name = name.replaceAll(/[^\w$]/g, "");
832
847
  if (name.length === 0) {
833
848
  return "_";
@@ -837,7 +852,7 @@ var normalizeName = (name) => {
837
852
  }
838
853
  return name;
839
854
  };
840
- var createScope = (occupiedIdentifiers = []) => {
855
+ var createScope = (occupiedIdentifiers = [], normalizeName = normalizeJsName, separator = "_") => {
841
856
  const freeIndexByPreferredName = /* @__PURE__ */ new Map();
842
857
  const scopedNameByIdMap = /* @__PURE__ */ new Map();
843
858
  for (const identifier of occupiedIdentifiers) {
@@ -853,7 +868,7 @@ var createScope = (occupiedIdentifiers = []) => {
853
868
  freeIndexByPreferredName.set(preferredName, (index ?? 0) + 1);
854
869
  let scopedName = preferredName;
855
870
  if (index !== void 0) {
856
- scopedName = `${preferredName}_${index}`;
871
+ scopedName = `${preferredName}${separator}${index}`;
857
872
  }
858
873
  scopedNameByIdMap.set(id, scopedName);
859
874
  return scopedName;
@@ -864,8 +879,8 @@ var createScope = (occupiedIdentifiers = []) => {
864
879
  };
865
880
 
866
881
  // src/resource-loader.ts
867
- var loadResource = async (customFetch, resourceData) => {
868
- const { url, method, headers, body } = resourceData;
882
+ var loadResource = async (customFetch, resourceRequest) => {
883
+ const { url, method, headers, body } = resourceRequest;
869
884
  const requestHeaders = new Headers(
870
885
  headers.map(({ name, value }) => [name, value])
871
886
  );
@@ -885,12 +900,13 @@ var loadResource = async (customFetch, resourceData) => {
885
900
  const response = await customFetch(url.trim(), requestInit);
886
901
  let data;
887
902
  if (response.ok && // accept json by default and when specified explicitly
888
- (requestHeaders.has("accept") === false || requestHeaders.get("accept") === "application/json")) {
903
+ (response.headers.has("content-type") === false || response.headers.get("content-type")?.includes("application/json"))) {
889
904
  data = await response.json();
890
905
  } else {
891
906
  data = await response.text();
892
907
  }
893
908
  return {
909
+ ok: response.ok,
894
910
  data,
895
911
  status: response.status,
896
912
  statusText: response.statusText
@@ -898,108 +914,87 @@ var loadResource = async (customFetch, resourceData) => {
898
914
  } catch (error) {
899
915
  const message = error.message;
900
916
  return {
917
+ ok: false,
901
918
  data: void 0,
902
919
  status: 500,
903
920
  statusText: message
904
921
  };
905
922
  }
906
923
  };
907
-
908
- // src/forms-generator.ts
909
- var generateFormsProperties = (props) => {
910
- const formsProperties = /* @__PURE__ */ new Map();
911
- for (const prop of props.values()) {
912
- if (prop.type === "string") {
913
- if (prop.name === "action" || prop.name === "method") {
914
- let properties = formsProperties.get(prop.instanceId);
915
- if (properties === void 0) {
916
- properties = {};
917
- }
918
- properties[prop.name] = prop.value;
919
- formsProperties.set(prop.instanceId, properties);
920
- }
921
- }
922
- }
923
- const entriesString = JSON.stringify(Array.from(formsProperties.entries()));
924
- let generated = "";
925
- generated += `type FormProperties = { method?: string, action?: string }
926
- `;
927
- generated += `export const formsProperties = new Map<string, FormProperties>(${entriesString})
928
- `;
929
- return generated;
924
+ var loadResources = async (customFetch, requests) => {
925
+ return Object.fromEntries(
926
+ await Promise.all(
927
+ Array.from(
928
+ requests,
929
+ async ([name, request]) => [name, await loadResource(customFetch, request)]
930
+ )
931
+ )
932
+ );
930
933
  };
931
934
 
932
935
  // src/resources-generator.ts
933
- var generateResourcesLoader = ({
936
+ var generateResources = ({
934
937
  scope,
935
938
  page,
936
939
  dataSources,
940
+ props,
937
941
  resources
938
942
  }) => {
939
- let generatedOutput = "";
940
- let generatedLoaders = "";
941
- let hasResources = false;
942
943
  const usedDataSources = /* @__PURE__ */ new Map();
943
- for (const dataSource of dataSources.values()) {
944
- if (dataSource.type === "resource") {
945
- const resource = resources.get(dataSource.resourceId);
946
- if (resource === void 0) {
947
- continue;
948
- }
949
- hasResources = true;
950
- const resourceName = scope.getName(resource.id, dataSource.name);
951
- generatedOutput += `${resourceName},
944
+ let generatedRequests = "";
945
+ for (const resource of resources.values()) {
946
+ let generatedRequest = "";
947
+ const resourceName = scope.getName(resource.id, resource.name);
948
+ generatedRequest += ` const ${resourceName}: ResourceRequest = {
952
949
  `;
953
- generatedLoaders += `loadResource(customFetch, {
950
+ generatedRequest += ` id: "${resource.id}",
951
+ `;
952
+ generatedRequest += ` name: ${JSON.stringify(resource.name)},
953
+ `;
954
+ const url = generateExpression({
955
+ expression: resource.url,
956
+ dataSources,
957
+ usedDataSources,
958
+ scope
959
+ });
960
+ generatedRequest += ` url: ${url},
954
961
  `;
955
- generatedLoaders += `id: "${resource.id}",
962
+ generatedRequest += ` method: "${resource.method}",
956
963
  `;
957
- generatedLoaders += `name: ${JSON.stringify(resource.name)},
964
+ generatedRequest += ` headers: [
958
965
  `;
959
- const url = generateExpression({
960
- expression: resource.url,
966
+ for (const header of resource.headers) {
967
+ const value = generateExpression({
968
+ expression: header.value,
961
969
  dataSources,
962
970
  usedDataSources,
963
971
  scope
964
972
  });
965
- generatedLoaders += `url: ${url},
966
- `;
967
- generatedLoaders += `method: "${resource.method}",
968
- `;
969
- generatedLoaders += `headers: [
970
- `;
971
- for (const header of resource.headers) {
972
- const value = generateExpression({
973
- expression: header.value,
974
- dataSources,
975
- usedDataSources,
976
- scope
977
- });
978
- generatedLoaders += `{ name: "${header.name}", value: ${value} },
973
+ generatedRequest += ` { name: "${header.name}", value: ${value} },
979
974
  `;
980
- }
981
- generatedLoaders += `],
982
- `;
983
- if (resource.body !== void 0 && resource.body.length > 0) {
984
- const body = generateExpression({
985
- expression: resource.body,
986
- dataSources,
987
- usedDataSources,
988
- scope
989
- });
990
- generatedLoaders += `body: ${body},
975
+ }
976
+ generatedRequest += ` ],
991
977
  `;
992
- }
993
- generatedLoaders += `}),
978
+ if (resource.body !== void 0 && resource.body.length > 0) {
979
+ const body = generateExpression({
980
+ expression: resource.body,
981
+ dataSources,
982
+ usedDataSources,
983
+ scope
984
+ });
985
+ generatedRequest += ` body: ${body},
994
986
  `;
995
987
  }
988
+ generatedRequest += ` }
989
+ `;
990
+ generatedRequests += generatedRequest;
996
991
  }
997
992
  let generatedVariables = "";
998
993
  for (const dataSource of usedDataSources.values()) {
999
994
  if (dataSource.type === "variable") {
1000
995
  const name = scope.getName(dataSource.id, dataSource.name);
1001
996
  const value = JSON.stringify(dataSource.value.value);
1002
- generatedVariables += `let ${name} = ${value}
997
+ generatedVariables += ` let ${name} = ${value}
1003
998
  `;
1004
999
  }
1005
1000
  if (dataSource.type === "parameter") {
@@ -1007,61 +1002,108 @@ var generateResourcesLoader = ({
1007
1002
  continue;
1008
1003
  }
1009
1004
  const name = scope.getName(dataSource.id, dataSource.name);
1010
- generatedVariables += `const ${name} = _props.system
1005
+ generatedVariables += ` const ${name} = _props.system
1011
1006
  `;
1012
1007
  }
1013
1008
  }
1014
1009
  let generated = "";
1015
- generated += `import { loadResource, isLocalResource, type System } from "@webstudio-is/sdk";
1016
- `;
1017
- if (hasResources) {
1018
- generated += `import { sitemap } from "./$resources.sitemap.xml";
1010
+ generated += `import type { System, ResourceRequest } from "@webstudio-is/sdk";
1019
1011
  `;
1020
- }
1021
- generated += `export const loadResources = async (_props: { system: System }) => {
1012
+ generated += `export const getResources = (_props: { system: System }) => {
1022
1013
  `;
1023
1014
  generated += generatedVariables;
1024
- if (hasResources) {
1025
- generated += `
1026
- const customFetch: typeof fetch = (input, init) => {
1027
- if (typeof input !== "string") {
1028
- return fetch(input, init);
1029
- }
1030
-
1031
- if (isLocalResource(input, "sitemap.xml")) {
1032
- // @todo: dynamic import sitemap ???
1033
- const response = new Response(JSON.stringify(sitemap));
1034
- response.headers.set('content-type', 'application/json; charset=utf-8');
1035
- return Promise.resolve(response);
1036
- }
1037
-
1038
- return fetch(input, init);
1039
- };
1040
- `;
1041
- generated += `const [
1015
+ generated += generatedRequests;
1016
+ generated += ` const _data = new Map<string, ResourceRequest>([
1042
1017
  `;
1043
- generated += generatedOutput;
1044
- generated += `] = await Promise.all([
1018
+ for (const dataSource of dataSources.values()) {
1019
+ if (dataSource.type === "resource") {
1020
+ const name = scope.getName(dataSource.resourceId, dataSource.name);
1021
+ generated += ` ["${name}", ${name}],
1045
1022
  `;
1046
- generated += generatedLoaders;
1047
- generated += `])
1023
+ }
1024
+ }
1025
+ generated += ` ])
1048
1026
  `;
1027
+ generated += ` const _action = new Map<string, ResourceRequest>([
1028
+ `;
1029
+ for (const prop of props.values()) {
1030
+ if (prop.type === "resource") {
1031
+ const name = scope.getName(prop.value, prop.name);
1032
+ generated += ` ["${name}", ${name}],
1033
+ `;
1034
+ }
1049
1035
  }
1050
- generated += `return {
1036
+ generated += ` ])
1051
1037
  `;
1052
- generated += generatedOutput;
1053
- generated += `} as Record<string, unknown>
1038
+ generated += ` return { data: _data, action: _action }
1054
1039
  `;
1055
1040
  generated += `}
1056
1041
  `;
1057
1042
  return generated;
1058
1043
  };
1044
+ var getMethod = (value) => {
1045
+ switch (value?.toLowerCase()) {
1046
+ case "get":
1047
+ return "get";
1048
+ case "delete":
1049
+ return "delete";
1050
+ case "put":
1051
+ return "put";
1052
+ default:
1053
+ return "post";
1054
+ }
1055
+ };
1056
+ var replaceFormActionsWithResources = ({
1057
+ props,
1058
+ instances,
1059
+ resources
1060
+ }) => {
1061
+ const formProps = /* @__PURE__ */ new Map();
1062
+ for (const prop of props.values()) {
1063
+ if (prop.name === "method" && prop.type === "string" && instances.get(prop.instanceId)?.component === "Form") {
1064
+ let data = formProps.get(prop.instanceId);
1065
+ if (data === void 0) {
1066
+ data = {};
1067
+ formProps.set(prop.instanceId, data);
1068
+ }
1069
+ data.method = prop.value;
1070
+ props.delete(prop.id);
1071
+ }
1072
+ if (prop.name === "action" && prop.type === "string" && prop.value && instances.get(prop.instanceId)?.component === "Form") {
1073
+ let data = formProps.get(prop.instanceId);
1074
+ if (data === void 0) {
1075
+ data = {};
1076
+ formProps.set(prop.instanceId, data);
1077
+ }
1078
+ data.action = prop.value;
1079
+ props.set(prop.id, {
1080
+ id: prop.id,
1081
+ instanceId: prop.instanceId,
1082
+ name: prop.name,
1083
+ type: "resource",
1084
+ value: prop.instanceId
1085
+ });
1086
+ }
1087
+ }
1088
+ for (const [instanceId, { action, method }] of formProps) {
1089
+ if (action) {
1090
+ resources.set(instanceId, {
1091
+ id: instanceId,
1092
+ name: "action",
1093
+ method: getMethod(method),
1094
+ url: JSON.stringify(action),
1095
+ headers: []
1096
+ });
1097
+ }
1098
+ }
1099
+ };
1059
1100
 
1060
1101
  // src/page-meta-generator.ts
1061
1102
  var generatePageMeta = ({
1062
1103
  globalScope,
1063
1104
  page,
1064
- dataSources
1105
+ dataSources,
1106
+ assets
1065
1107
  }) => {
1066
1108
  const localScope = createScope(["system", "resources"]);
1067
1109
  const usedDataSources = /* @__PURE__ */ new Map();
@@ -1089,8 +1131,8 @@ var generatePageMeta = ({
1089
1131
  usedDataSources,
1090
1132
  scope: localScope
1091
1133
  });
1092
- const socialImageAssetIdExpression = JSON.stringify(
1093
- page.meta.socialImageAssetId
1134
+ const socialImageAssetNameExpression = JSON.stringify(
1135
+ page.meta.socialImageAssetId ? assets.get(page.meta.socialImageAssetId)?.name : void 0
1094
1136
  );
1095
1137
  const socialImageUrlExpression = generateExpression({
1096
1138
  expression: page.meta.socialImageUrl ?? "undefined",
@@ -1186,7 +1228,7 @@ var generatePageMeta = ({
1186
1228
  `;
1187
1229
  generated += ` language: ${languageExpression},
1188
1230
  `;
1189
- generated += ` socialImageAssetId: ${socialImageAssetIdExpression},
1231
+ generated += ` socialImageAssetName: ${socialImageAssetNameExpression},
1190
1232
  `;
1191
1233
  generated += ` socialImageUrl: ${socialImageUrlExpression},
1192
1234
  `;
@@ -1253,10 +1295,9 @@ export {
1253
1295
  findTreeInstanceIds,
1254
1296
  findTreeInstanceIdsExcludingSlotDescendants,
1255
1297
  generateExpression,
1256
- generateFormsProperties,
1257
1298
  generateObjectExpression,
1258
1299
  generatePageMeta,
1259
- generateResourcesLoader,
1300
+ generateResources,
1260
1301
  getExpressionIdentifiers,
1261
1302
  getPagePath,
1262
1303
  getStaticSiteMapXml,
@@ -1268,9 +1309,11 @@ export {
1268
1309
  isRoot,
1269
1310
  lintExpression,
1270
1311
  loadResource,
1312
+ loadResources,
1271
1313
  matchPathnameParams,
1272
1314
  parseComponentName,
1273
1315
  parseObjectExpression,
1316
+ replaceFormActionsWithResources,
1274
1317
  sitemapResourceUrl,
1275
1318
  transpileExpression
1276
1319
  };
@@ -15,7 +15,6 @@ export * from "./page-utils";
15
15
  export * from "./scope";
16
16
  export * from "./resource-loader";
17
17
  export * from "./expression";
18
- export * from "./forms-generator";
19
18
  export * from "./resources-generator";
20
19
  export * from "./page-meta-generator";
21
20
  export * from "./url-pattern";
@@ -1,36 +1,4 @@
1
- import type { Instance } from "./schema/instances";
2
- export declare const findTreeInstanceIds: (instances: Map<string, {
3
- type: "instance";
4
- id: string;
5
- children: ({
6
- value: string;
7
- type: "text";
8
- placeholder?: boolean | undefined;
9
- } | {
10
- value: string;
11
- type: "id";
12
- } | {
13
- value: string;
14
- type: "expression";
15
- })[];
16
- component: string;
17
- label?: string | undefined;
18
- }>, rootInstanceId: Instance["id"]) => Set<string>;
19
- export declare const findTreeInstanceIdsExcludingSlotDescendants: (instances: Map<string, {
20
- type: "instance";
21
- id: string;
22
- children: ({
23
- value: string;
24
- type: "text";
25
- placeholder?: boolean | undefined;
26
- } | {
27
- value: string;
28
- type: "id";
29
- } | {
30
- value: string;
31
- type: "expression";
32
- })[];
33
- component: string;
34
- label?: string | undefined;
35
- }>, rootInstanceId: Instance["id"]) => Set<string>;
1
+ import type { Instance, Instances } from "./schema/instances";
2
+ export declare const findTreeInstanceIds: (instances: Instances, rootInstanceId: Instance["id"]) => Set<string>;
3
+ export declare const findTreeInstanceIdsExcludingSlotDescendants: (instances: Instances, rootInstanceId: Instance["id"]) => Set<string>;
36
4
  export declare const parseComponentName: (componentName: string) => readonly [string | undefined, string];
@@ -0,0 +1,151 @@
1
+ import type { ReactNode } from "react";
2
+ export declare class ExpressionValue {
3
+ value: string;
4
+ constructor(expression: string);
5
+ }
6
+ export declare class ParameterValue {
7
+ value: string;
8
+ constructor(dataSourceID: string);
9
+ }
10
+ export declare class ResourceValue {
11
+ value: string;
12
+ constructor(resourceId: string);
13
+ }
14
+ export declare class ActionValue {
15
+ value: {
16
+ type: "execute";
17
+ args: string[];
18
+ code: string;
19
+ };
20
+ constructor(args: string[], code: string);
21
+ }
22
+ export declare class AssetValue {
23
+ value: string;
24
+ constructor(assetId: string);
25
+ }
26
+ export declare class PageValue {
27
+ value: string | {
28
+ pageId: string;
29
+ instanceId: string;
30
+ };
31
+ constructor(pageId: string, instanceId?: string);
32
+ }
33
+ export declare const renderJsx: (root: JSX.Element) => {
34
+ instances: Map<string, {
35
+ type: "instance";
36
+ id: string;
37
+ children: ({
38
+ value: string;
39
+ type: "text";
40
+ placeholder?: boolean | undefined;
41
+ } | {
42
+ value: string;
43
+ type: "id";
44
+ } | {
45
+ value: string;
46
+ type: "expression";
47
+ })[];
48
+ component: string;
49
+ label?: string | undefined;
50
+ }>;
51
+ props: Map<string, {
52
+ value: number;
53
+ type: "number";
54
+ id: string;
55
+ name: string;
56
+ instanceId: string;
57
+ required?: boolean | undefined;
58
+ } | {
59
+ value: string;
60
+ type: "string";
61
+ id: string;
62
+ name: string;
63
+ instanceId: string;
64
+ required?: boolean | undefined;
65
+ } | {
66
+ value: boolean;
67
+ type: "boolean";
68
+ id: string;
69
+ name: string;
70
+ instanceId: string;
71
+ required?: boolean | undefined;
72
+ } | {
73
+ type: "json";
74
+ id: string;
75
+ name: string;
76
+ instanceId: string;
77
+ value?: unknown;
78
+ required?: boolean | undefined;
79
+ } | {
80
+ value: string;
81
+ type: "asset";
82
+ id: string;
83
+ name: string;
84
+ instanceId: string;
85
+ required?: boolean | undefined;
86
+ } | {
87
+ value: (string | {
88
+ instanceId: string;
89
+ pageId: string;
90
+ }) & (string | {
91
+ instanceId: string;
92
+ pageId: string;
93
+ } | undefined);
94
+ type: "page";
95
+ id: string;
96
+ name: string;
97
+ instanceId: string;
98
+ required?: boolean | undefined;
99
+ } | {
100
+ value: string[];
101
+ type: "string[]";
102
+ id: string;
103
+ name: string;
104
+ instanceId: string;
105
+ required?: boolean | undefined;
106
+ } | {
107
+ value: string;
108
+ type: "parameter";
109
+ id: string;
110
+ name: string;
111
+ instanceId: string;
112
+ required?: boolean | undefined;
113
+ } | {
114
+ value: string;
115
+ type: "resource";
116
+ id: string;
117
+ name: string;
118
+ instanceId: string;
119
+ required?: boolean | undefined;
120
+ } | {
121
+ value: string;
122
+ type: "expression";
123
+ id: string;
124
+ name: string;
125
+ instanceId: string;
126
+ required?: boolean | undefined;
127
+ } | {
128
+ value: {
129
+ code: string;
130
+ type: "execute";
131
+ args: string[];
132
+ }[];
133
+ type: "action";
134
+ id: string;
135
+ name: string;
136
+ instanceId: string;
137
+ required?: boolean | undefined;
138
+ }>;
139
+ };
140
+ type ComponentProps = Record<string, unknown> & Record<`${string}:expression`, string> & {
141
+ "ws:id"?: string;
142
+ "ws:label"?: string;
143
+ children?: ReactNode;
144
+ };
145
+ type Component = {
146
+ displayName: string;
147
+ } & ((props: ComponentProps) => ReactNode);
148
+ export declare const createProxy: (prefix: string) => Record<string, Component>;
149
+ export declare const $: Record<string, Component>;
150
+ export declare const ws: Record<string, Component>;
151
+ export {};
@@ -1,4 +1,4 @@
1
- import type { Asset } from "./schema/assets";
1
+ import type { Asset, Assets } from "./schema/assets";
2
2
  import type { DataSources } from "./schema/data-sources";
3
3
  import type { Page } from "./schema/pages";
4
4
  import { type Scope } from "./scope";
@@ -7,7 +7,7 @@ export type PageMeta = {
7
7
  description?: string;
8
8
  excludePageFromSearch?: boolean;
9
9
  language?: string;
10
- socialImageAssetId?: Asset["id"];
10
+ socialImageAssetName?: Asset["name"];
11
11
  socialImageUrl?: string;
12
12
  status?: number;
13
13
  redirect?: string;
@@ -16,8 +16,9 @@ export type PageMeta = {
16
16
  content: string;
17
17
  }>;
18
18
  };
19
- export declare const generatePageMeta: ({ globalScope, page, dataSources, }: {
19
+ export declare const generatePageMeta: ({ globalScope, page, dataSources, assets, }: {
20
20
  globalScope: Scope;
21
21
  page: Page;
22
22
  dataSources: DataSources;
23
+ assets: Assets;
23
24
  }) => string;
@@ -1,6 +1,15 @@
1
1
  import type { ResourceRequest } from "./schema/resources";
2
- export declare const loadResource: (customFetch: typeof fetch, resourceData: ResourceRequest) => Promise<{
2
+ export declare const loadResource: (customFetch: typeof fetch, resourceRequest: ResourceRequest) => Promise<{
3
+ ok: boolean;
3
4
  data: any;
4
5
  status: number;
5
6
  statusText: string;
6
7
  }>;
8
+ export declare const loadResources: (customFetch: typeof fetch, requests: Map<string, ResourceRequest>) => Promise<{
9
+ [k: string]: {
10
+ ok: boolean;
11
+ data: any;
12
+ status: number;
13
+ statusText: string;
14
+ };
15
+ }>;
@@ -1,10 +1,22 @@
1
1
  import type { DataSources } from "./schema/data-sources";
2
2
  import type { Page } from "./schema/pages";
3
3
  import type { Resources } from "./schema/resources";
4
+ import type { Props } from "./schema/props";
5
+ import type { Instances } from "./schema/instances";
4
6
  import type { Scope } from "./scope";
5
- export declare const generateResourcesLoader: ({ scope, page, dataSources, resources, }: {
7
+ export declare const generateResources: ({ scope, page, dataSources, props, resources, }: {
6
8
  scope: Scope;
7
9
  page: Page;
8
10
  dataSources: DataSources;
11
+ props: Props;
9
12
  resources: Resources;
10
13
  }) => string;
14
+ /**
15
+ * migrate webhook forms to resource action
16
+ * @todo move to client migrations eventually
17
+ */
18
+ export declare const replaceFormActionsWithResources: ({ props, instances, resources, }: {
19
+ props: Props;
20
+ instances: Instances;
21
+ resources: Resources;
22
+ }) => void;