@superblocksteam/library 2.0.42-next.9 → 2.0.43-next.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/dist/index.d.ts +17 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +312 -306
- package/dist/index.js.map +1 -1
- package/dist/{logs-ivxzrJPP.js → logs-DDh7Anxs.js} +10 -11
- package/dist/{logs-ivxzrJPP.js.map → logs-DDh7Anxs.js.map} +1 -1
- package/dist/root-store-4FotQ8o2.js +4 -0
- package/dist/{root-store-mvrXQD3h.js → root-store-DSXdJ9lh.js} +193 -45
- package/dist/root-store-DSXdJ9lh.js.map +1 -0
- package/package.json +3 -3
- package/dist/root-store-DbFURfA3.js +0 -4
- package/dist/root-store-mvrXQD3h.js.map +0 -1
|
@@ -10,17 +10,16 @@ function initLibraryLoggerProvider(context) {
|
|
|
10
10
|
url: context.windowOriginUrl + "/api/v1/logs",
|
|
11
11
|
headers: { "Content-Type": "application/json" }
|
|
12
12
|
});
|
|
13
|
-
const resource = resourceFromAttributes({
|
|
14
|
-
[ATTR_SERVICE_NAME]: "superblocks-ui-framework",
|
|
15
|
-
"user-id": context.userId,
|
|
16
|
-
"user-email": context.userEmail,
|
|
17
|
-
"organization-id": context.orgId,
|
|
18
|
-
"organization-name": context.orgName,
|
|
19
|
-
"application-id": context.appId,
|
|
20
|
-
"deployment.environment": context.environment
|
|
21
|
-
});
|
|
22
13
|
const otelLogger = new LoggerProvider({
|
|
23
|
-
resource
|
|
14
|
+
resource: resourceFromAttributes({
|
|
15
|
+
[ATTR_SERVICE_NAME]: "superblocks-ui-framework",
|
|
16
|
+
"user-id": context.userId,
|
|
17
|
+
"user-email": context.userEmail,
|
|
18
|
+
"organization-id": context.orgId,
|
|
19
|
+
"organization-name": context.orgName,
|
|
20
|
+
"application-id": context.appId,
|
|
21
|
+
"deployment.environment": context.environment
|
|
22
|
+
}),
|
|
24
23
|
processors: [new BatchLogRecordProcessor(logExporter)]
|
|
25
24
|
}).getLogger("superblocks-ui-framework", "1.0.0");
|
|
26
25
|
early_console_buffer_default.getInstance().enableOpenTelemetry(otelLogger);
|
|
@@ -28,4 +27,4 @@ function initLibraryLoggerProvider(context) {
|
|
|
28
27
|
|
|
29
28
|
//#endregion
|
|
30
29
|
export { initLibraryLoggerProvider };
|
|
31
|
-
//# sourceMappingURL=logs-
|
|
30
|
+
//# sourceMappingURL=logs-DDh7Anxs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logs-
|
|
1
|
+
{"version":3,"file":"logs-DDh7Anxs.js","names":[],"sources":["../src/lib/tracing/logs.ts"],"sourcesContent":["import { OTLPLogExporter } from \"@opentelemetry/exporter-logs-otlp-http\";\nimport { resourceFromAttributes } from \"@opentelemetry/resources\";\nimport {\n BatchLogRecordProcessor,\n LoggerProvider,\n} from \"@opentelemetry/sdk-logs\";\nimport { ATTR_SERVICE_NAME } from \"@opentelemetry/semantic-conventions\";\nimport LibraryEarlyConsoleBuffer from \"./early-console-buffer.js\";\n\ninterface LoggingContext {\n windowOriginUrl: string;\n environment: string;\n appId: string;\n userId?: string;\n userEmail?: string;\n orgId: string;\n orgName?: string;\n}\n\nexport function initLibraryLoggerProvider(context: LoggingContext) {\n const logExporter = new OTLPLogExporter({\n url: context.windowOriginUrl + \"/api/v1/logs\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n });\n\n const resource = resourceFromAttributes({\n [ATTR_SERVICE_NAME]: \"superblocks-ui-framework\",\n \"user-id\": context.userId,\n \"user-email\": context.userEmail,\n \"organization-id\": context.orgId,\n \"organization-name\": context.orgName,\n \"application-id\": context.appId,\n \"deployment.environment\": context.environment,\n });\n\n const loggerProvider = new LoggerProvider({\n resource,\n processors: [new BatchLogRecordProcessor(logExporter)],\n });\n\n const otelLogger = loggerProvider.getLogger(\n \"superblocks-ui-framework\",\n \"1.0.0\",\n );\n\n // Enable buffered console logs with rich context\n LibraryEarlyConsoleBuffer.getInstance().enableOpenTelemetry(otelLogger);\n}\n"],"mappings":";;;;;;;AAmBA,SAAgB,0BAA0B,SAAyB;CACjE,MAAM,cAAc,IAAI,gBAAgB;EACtC,KAAK,QAAQ,kBAAkB;EAC/B,SAAS,EACP,gBAAgB,oBACjB;EACF,CAAC;CAiBF,MAAM,aALiB,IAAI,eAAe;EACxC,UAXe,uBAAuB;IACrC,oBAAoB;GACrB,WAAW,QAAQ;GACnB,cAAc,QAAQ;GACtB,mBAAmB,QAAQ;GAC3B,qBAAqB,QAAQ;GAC7B,kBAAkB,QAAQ;GAC1B,0BAA0B,QAAQ;GACnC,CAAC;EAIA,YAAY,CAAC,IAAI,wBAAwB,YAAY,CAAC;EACvD,CAAC,CAEgC,UAChC,4BACA,QACD;AAGD,8BAA0B,aAAa,CAAC,oBAAoB,WAAW"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getTracer } from "./utils-CCBWAYIM.js";
|
|
2
2
|
import { NotificationPosition, SbEntityType, TriggerStepType, isValidStepDef } from "@superblocksteam/library-shared/types";
|
|
3
|
-
import _, { get, isEmpty, isNumber, isObject, isString, isUndefined, pick, set, throttle, toNumber, toString } from "lodash";
|
|
3
|
+
import _, { cloneDeep, get, isEmpty, isNumber, isObject, isString, isUndefined, pick, set, throttle, toNumber, toString } from "lodash";
|
|
4
4
|
import * as React$1 from "react";
|
|
5
5
|
import React, { Suspense } from "react";
|
|
6
6
|
import styled from "styled-components";
|
|
@@ -743,9 +743,8 @@ function interceptWindowClicks(navigation$1) {
|
|
|
743
743
|
function clickCallback(ev, aEl) {
|
|
744
744
|
if (!(ev.button === 0 && !ev.defaultPrevented && !ev.metaKey && !ev.altKey && !ev.ctrlKey && !ev.shiftKey)) return;
|
|
745
745
|
const targetUrl = new URL(aEl.href, window.location.origin);
|
|
746
|
-
const isSameDocument = targetUrl.origin === window.location.origin && targetUrl.pathname === window.location.pathname;
|
|
747
746
|
const navigationEvent = new NavigationEvent({
|
|
748
|
-
isSameDocument,
|
|
747
|
+
isSameDocument: targetUrl.origin === window.location.origin && targetUrl.pathname === window.location.pathname,
|
|
749
748
|
targetUrl: aEl.href,
|
|
750
749
|
isBlob: targetUrl.protocol === "blob:",
|
|
751
750
|
newWindow: aEl.target === "_blank",
|
|
@@ -756,10 +755,9 @@ function interceptWindowClicks(navigation$1) {
|
|
|
756
755
|
function submitCallback(ev, form) {
|
|
757
756
|
if (ev.defaultPrevented) return;
|
|
758
757
|
if ((ev.submitter && "formMethod" in ev.submitter && ev.submitter.formMethod ? ev.submitter.formMethod : form.method) === "dialog") return;
|
|
759
|
-
const action$1 = ev.submitter && "formAction" in ev.submitter && ev.submitter.formAction ? ev.submitter.formAction : form.action;
|
|
760
758
|
const navigationEvent = new NavigationEvent({
|
|
761
759
|
isSameDocument: false,
|
|
762
|
-
targetUrl: action
|
|
760
|
+
targetUrl: ev.submitter && "formAction" in ev.submitter && ev.submitter.formAction ? ev.submitter.formAction : form.action,
|
|
763
761
|
formData: new FormData(form)
|
|
764
762
|
});
|
|
765
763
|
navigation$1.dispatchEvent(navigationEvent);
|
|
@@ -993,7 +991,7 @@ var registry_default = EventRegistry;
|
|
|
993
991
|
|
|
994
992
|
//#endregion
|
|
995
993
|
//#region src/lib/triggers/run-event-handlers.ts
|
|
996
|
-
const getRootStore = () => import("./root-store-
|
|
994
|
+
const getRootStore = () => import("./root-store-4FotQ8o2.js").then((module) => module.default);
|
|
997
995
|
const runEventHandlers = async ({ flow, name, scopeId, additionalContext }) => {
|
|
998
996
|
const context$1 = {
|
|
999
997
|
scopeId,
|
|
@@ -1004,8 +1002,7 @@ const runEventHandlers = async ({ flow, name, scopeId, additionalContext }) => {
|
|
|
1004
1002
|
const steps = flow?.build() ?? [];
|
|
1005
1003
|
for (const step of steps) {
|
|
1006
1004
|
if (!isValidStepDef(step)) continue;
|
|
1007
|
-
const
|
|
1008
|
-
const trigger = registry_default[stepType];
|
|
1005
|
+
const trigger = registry_default[step.type];
|
|
1009
1006
|
if (trigger) await trigger.execute(context$1, step);
|
|
1010
1007
|
else console.error(`Trigger ${step.type} not found`);
|
|
1011
1008
|
}
|
|
@@ -1796,14 +1793,11 @@ function traverseProps(sections, onProp, parentPath = "") {
|
|
|
1796
1793
|
props: prop.shared,
|
|
1797
1794
|
parentPath: fullPath
|
|
1798
1795
|
});
|
|
1799
|
-
for (const variant of prop.variants) {
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
parentPath: fullPath
|
|
1805
|
-
});
|
|
1806
|
-
}
|
|
1796
|
+
for (const variant of prop.variants) processProps({
|
|
1797
|
+
sectionName,
|
|
1798
|
+
props: Object.fromEntries(Object.entries(variant).filter(([key]) => !sharedKeys.includes(key))),
|
|
1799
|
+
parentPath: fullPath
|
|
1800
|
+
});
|
|
1807
1801
|
} else if (prop instanceof Prop) onProp(prop, fullPath, name, parentDefault, sectionName);
|
|
1808
1802
|
else console.warn("Invalid prop type", {
|
|
1809
1803
|
name,
|
|
@@ -2211,8 +2205,7 @@ const transformBindings = (value) => {
|
|
|
2211
2205
|
return new Function(`return ${body}`);
|
|
2212
2206
|
};
|
|
2213
2207
|
const toEvalFunc = ([prop, binding]) => {
|
|
2214
|
-
|
|
2215
|
-
return [prop, func];
|
|
2208
|
+
return [prop, transformBindings(binding)];
|
|
2216
2209
|
};
|
|
2217
2210
|
const stringToJS = (string) => {
|
|
2218
2211
|
if (string === void 0 || string === "") return "''";
|
|
@@ -2424,10 +2417,7 @@ var EntityManager = class {
|
|
|
2424
2417
|
getState(scopeId, options) {
|
|
2425
2418
|
const scope = this.getScope(scopeId);
|
|
2426
2419
|
const useSuspense = options?.useSuspense ?? false;
|
|
2427
|
-
if (options?.includeParentScopes ?? false)
|
|
2428
|
-
const allScopes = this.getAccessibleScopes(scopeId);
|
|
2429
|
-
return createScopeProxy(allScopes, useSuspense);
|
|
2430
|
-
}
|
|
2420
|
+
if (options?.includeParentScopes ?? false) return createScopeProxy(this.getAccessibleScopes(scopeId), useSuspense);
|
|
2431
2421
|
return createScopeProxy([scope], useSuspense);
|
|
2432
2422
|
}
|
|
2433
2423
|
getScopeName(scopeId) {
|
|
@@ -2450,10 +2440,7 @@ var EntityManager = class {
|
|
|
2450
2440
|
if (isNameBasedEntity) entities[name] = entity;
|
|
2451
2441
|
else entities[id] = entity;
|
|
2452
2442
|
}
|
|
2453
|
-
for (const childScopeId of scope.childScopes)
|
|
2454
|
-
const childScope = this.getScope(childScopeId);
|
|
2455
|
-
processScope(childScope);
|
|
2456
|
-
}
|
|
2443
|
+
for (const childScopeId of scope.childScopes) processScope(this.getScope(childScopeId));
|
|
2457
2444
|
};
|
|
2458
2445
|
processScope(this.state);
|
|
2459
2446
|
return entities;
|
|
@@ -2464,8 +2451,7 @@ var EntityManager = class {
|
|
|
2464
2451
|
const isDescendant = (scope, scopeId$1) => {
|
|
2465
2452
|
if (scope.id === scopeId$1) return true;
|
|
2466
2453
|
return Array.from(scope.childScopes).some((childScopeId) => {
|
|
2467
|
-
|
|
2468
|
-
return isDescendant(childScope, scopeId$1);
|
|
2454
|
+
return isDescendant(this.getScope(childScopeId), scopeId$1);
|
|
2469
2455
|
});
|
|
2470
2456
|
};
|
|
2471
2457
|
while (currentScope) {
|
|
@@ -3257,6 +3243,145 @@ function sendNotification({ message, description, duration, key = getKey("succes
|
|
|
3257
3243
|
});
|
|
3258
3244
|
}
|
|
3259
3245
|
|
|
3246
|
+
//#endregion
|
|
3247
|
+
//#region src/lib/internal-details/lib/evaluator/file-utils.ts
|
|
3248
|
+
var FileManagerClass = class FileManagerClass {
|
|
3249
|
+
static instance;
|
|
3250
|
+
storage = {};
|
|
3251
|
+
constructor() {}
|
|
3252
|
+
static getInstance() {
|
|
3253
|
+
if (!FileManagerClass.instance) FileManagerClass.instance = new FileManagerClass();
|
|
3254
|
+
return FileManagerClass.instance;
|
|
3255
|
+
}
|
|
3256
|
+
store(componentName, file) {
|
|
3257
|
+
const fileId = getFileUploadId(file);
|
|
3258
|
+
if (!this.storage[componentName]) this.storage[componentName] = {};
|
|
3259
|
+
this.storage[componentName][fileId] = file;
|
|
3260
|
+
}
|
|
3261
|
+
get(componentName, fileId) {
|
|
3262
|
+
return this.storage[componentName]?.[fileId];
|
|
3263
|
+
}
|
|
3264
|
+
remove(componentName, file) {
|
|
3265
|
+
const fileId = getFileUploadId(file);
|
|
3266
|
+
if (this.storage[componentName]) delete this.storage[componentName][fileId];
|
|
3267
|
+
}
|
|
3268
|
+
clearComponent(componentName) {
|
|
3269
|
+
delete this.storage[componentName];
|
|
3270
|
+
}
|
|
3271
|
+
clear() {
|
|
3272
|
+
this.storage = {};
|
|
3273
|
+
}
|
|
3274
|
+
};
|
|
3275
|
+
const FileManager = FileManagerClass.getInstance();
|
|
3276
|
+
function getFileUploadId(file) {
|
|
3277
|
+
return `${file.name.replace(/[^a-zA-Z0-9.-]/g, "_")}-${file.size}-${file.lastModified}`;
|
|
3278
|
+
}
|
|
3279
|
+
/**
|
|
3280
|
+
* Check if the given object is a light readable file.
|
|
3281
|
+
* Meaning it has a $superblocksId property.
|
|
3282
|
+
*
|
|
3283
|
+
* Compare to `isReadableFile` which checks if the object is a full superblocks readable file object.
|
|
3284
|
+
*/
|
|
3285
|
+
const isLightReadableFile = (f) => {
|
|
3286
|
+
if (!f || typeof f !== "object" || Array.isArray(f)) return false;
|
|
3287
|
+
if (Object.entries(f).length === 0) return false;
|
|
3288
|
+
return "$superblocksId" in f;
|
|
3289
|
+
};
|
|
3290
|
+
function getFilePaths(root, path = []) {
|
|
3291
|
+
const paths = [];
|
|
3292
|
+
if (!root || !(typeof root === "object")) return paths;
|
|
3293
|
+
if (Array.isArray(root) || isObservableArray(root)) {
|
|
3294
|
+
root.forEach((v, i) => {
|
|
3295
|
+
paths.push(...getFilePaths(v, [...path, i.toString()]));
|
|
3296
|
+
});
|
|
3297
|
+
return paths;
|
|
3298
|
+
}
|
|
3299
|
+
if (isLightReadableFile(root)) return [path];
|
|
3300
|
+
Object.entries(root).forEach(([key, value]) => {
|
|
3301
|
+
if (isLightReadableFile(value)) paths.push([...path, key]);
|
|
3302
|
+
else if (value && (Array.isArray(value) || isObservableArray(value))) value.forEach((v, i) => {
|
|
3303
|
+
paths.push(...getFilePaths(v, [
|
|
3304
|
+
...path,
|
|
3305
|
+
key,
|
|
3306
|
+
i.toString()
|
|
3307
|
+
]));
|
|
3308
|
+
});
|
|
3309
|
+
else if (value && typeof value === "object") paths.push(...getFilePaths(value, [...path, key]));
|
|
3310
|
+
});
|
|
3311
|
+
return paths;
|
|
3312
|
+
}
|
|
3313
|
+
/**
|
|
3314
|
+
* Extract Files and path to files from entities.
|
|
3315
|
+
* Used to retrieve files that are in an entity's state which is bound in a Backend API.
|
|
3316
|
+
* @param entities - The entities to extract files from
|
|
3317
|
+
* @returns
|
|
3318
|
+
*/
|
|
3319
|
+
function extractFilesFromEntities(entities) {
|
|
3320
|
+
const files = {};
|
|
3321
|
+
const pathToFiles = [];
|
|
3322
|
+
Object.entries(entities).forEach(([entityName, entityValue]) => {
|
|
3323
|
+
getFilePaths(entityValue).forEach((path) => {
|
|
3324
|
+
const fileObj = get(entityValue, path);
|
|
3325
|
+
if (isLightReadableFile(fileObj)) {
|
|
3326
|
+
const fileId = fileObj.$superblocksId;
|
|
3327
|
+
const file = FileManager.get(entityName, fileId);
|
|
3328
|
+
if (file) {
|
|
3329
|
+
files[fileId] = file;
|
|
3330
|
+
pathToFiles.push([entityName, ...path]);
|
|
3331
|
+
}
|
|
3332
|
+
}
|
|
3333
|
+
});
|
|
3334
|
+
});
|
|
3335
|
+
return {
|
|
3336
|
+
files,
|
|
3337
|
+
paths: pathToFiles
|
|
3338
|
+
};
|
|
3339
|
+
}
|
|
3340
|
+
async function formatFilesForRequest(files) {
|
|
3341
|
+
const entries$1 = Object.entries(files);
|
|
3342
|
+
return await Promise.all(entries$1.map(async ([fileId, file]) => {
|
|
3343
|
+
try {
|
|
3344
|
+
return {
|
|
3345
|
+
originalName: fileId,
|
|
3346
|
+
buffer: await new Promise((resolve, reject) => {
|
|
3347
|
+
const reader = new FileReader();
|
|
3348
|
+
reader.onload = () => resolve(reader.result.split(",")[1]);
|
|
3349
|
+
reader.onerror = () => reject(new Error(reader.error?.message || "Unknown error reading file"));
|
|
3350
|
+
reader.readAsDataURL(file);
|
|
3351
|
+
}),
|
|
3352
|
+
encoding: "base64",
|
|
3353
|
+
mimetype: "text/plain"
|
|
3354
|
+
};
|
|
3355
|
+
} catch (error) {
|
|
3356
|
+
console.warn(`Failed to encode file ${file.name} (ID: ${fileId}):`, error);
|
|
3357
|
+
throw error;
|
|
3358
|
+
}
|
|
3359
|
+
}));
|
|
3360
|
+
}
|
|
3361
|
+
function getFileWithUploadId(f) {
|
|
3362
|
+
const uploadId = getFileUploadId(f);
|
|
3363
|
+
Object.defineProperty(f, "$superblocksId", {
|
|
3364
|
+
value: uploadId,
|
|
3365
|
+
writable: false,
|
|
3366
|
+
enumerable: true,
|
|
3367
|
+
configurable: false
|
|
3368
|
+
});
|
|
3369
|
+
return f;
|
|
3370
|
+
}
|
|
3371
|
+
function getFileMetadata(f) {
|
|
3372
|
+
const superblocksId = getFileUploadId(f);
|
|
3373
|
+
const nameParts = f.name.split(".");
|
|
3374
|
+
const extension = nameParts.length > 1 ? nameParts.pop() || "" : "";
|
|
3375
|
+
return {
|
|
3376
|
+
$superblocksId: superblocksId,
|
|
3377
|
+
name: f.name,
|
|
3378
|
+
extension,
|
|
3379
|
+
type: f.type,
|
|
3380
|
+
size: f.size,
|
|
3381
|
+
encoding: "text"
|
|
3382
|
+
};
|
|
3383
|
+
}
|
|
3384
|
+
|
|
3260
3385
|
//#endregion
|
|
3261
3386
|
//#region src/lib/internal-details/lib/evaluator/binding-extraction.ts
|
|
3262
3387
|
function getApiDeps(entitiesState, scopeId, apiDepCandidates) {
|
|
@@ -3274,7 +3399,32 @@ function getApiDeps(entitiesState, scopeId, apiDepCandidates) {
|
|
|
3274
3399
|
candidates[name] = stringifySplitPaths(parts.slice(0, i - 1));
|
|
3275
3400
|
} else candidates[name] = rest;
|
|
3276
3401
|
});
|
|
3277
|
-
|
|
3402
|
+
const entities = Object.fromEntries(Object.entries(candidates).map(([candidateName, path]) => [candidateName, buildEntityByPath(path, entitiesState.getEntity(scopeId, getName(candidateName), { includeParentScopes: true }))]).filter(([_$1, entity]) => !!entity));
|
|
3403
|
+
const { files, paths } = extractFilesFromEntities(entities);
|
|
3404
|
+
/**
|
|
3405
|
+
* Update entities data payload that rely on files,
|
|
3406
|
+
* to honor the FilePrivateMetadata type
|
|
3407
|
+
* which is checked on runtime in the backend.
|
|
3408
|
+
*/
|
|
3409
|
+
const clonedEntities = /* @__PURE__ */ new Set();
|
|
3410
|
+
paths.forEach((path) => {
|
|
3411
|
+
const fileProps = get(entities, path);
|
|
3412
|
+
if (isLightReadableFile(fileProps)) {
|
|
3413
|
+
const file = FileManager.get(path[0], fileProps.$superblocksId);
|
|
3414
|
+
if (file) {
|
|
3415
|
+
const entityName = path[0];
|
|
3416
|
+
if (!clonedEntities.has(entityName)) {
|
|
3417
|
+
entities[entityName] = cloneDeep(entities[entityName]);
|
|
3418
|
+
clonedEntities.add(entityName);
|
|
3419
|
+
}
|
|
3420
|
+
set(entities, path, getFileMetadata(file));
|
|
3421
|
+
}
|
|
3422
|
+
}
|
|
3423
|
+
});
|
|
3424
|
+
return {
|
|
3425
|
+
entities,
|
|
3426
|
+
files
|
|
3427
|
+
};
|
|
3278
3428
|
}
|
|
3279
3429
|
function buildEntityByPath(path, entity) {
|
|
3280
3430
|
if (!isObject(entity) || path === "") return entity;
|
|
@@ -3359,9 +3509,8 @@ const generateId = () => {
|
|
|
3359
3509
|
|
|
3360
3510
|
//#endregion
|
|
3361
3511
|
//#region src/lib/internal-details/lib/features/api-utils.ts
|
|
3362
|
-
const SUPERBLOCKS_UI_EXECUTE_API_TIMEOUT_MS = 1e3 * 60 * 10;
|
|
3363
3512
|
async function executeV2Api(params) {
|
|
3364
|
-
const { body, api, notifyOnSystemError, eventType, onMessage, processStreamEvents, responseType, abortController, baseUrl,
|
|
3513
|
+
const { body, controlFlowOnlyFiles, api, notifyOnSystemError, eventType, onMessage, processStreamEvents, responseType, abortController, baseUrl, viewMode, accessToken, token, traceHeaders } = params;
|
|
3365
3514
|
let parentContext = context.active();
|
|
3366
3515
|
if (traceHeaders) parentContext = getContextFromTraceHeaders(traceHeaders);
|
|
3367
3516
|
let applicationId = "unknown";
|
|
@@ -3380,15 +3529,14 @@ async function executeV2Api(params) {
|
|
|
3380
3529
|
} catch {
|
|
3381
3530
|
cleanedBody = structuredClone(body);
|
|
3382
3531
|
}
|
|
3532
|
+
if (controlFlowOnlyFiles && controlFlowOnlyFiles.length > 0) cleanedBody = {
|
|
3533
|
+
...cleanedBody,
|
|
3534
|
+
files: controlFlowOnlyFiles
|
|
3535
|
+
};
|
|
3383
3536
|
const traceContextHeaders = getTraceContextHeadersFromSpan(span);
|
|
3384
3537
|
const init = {
|
|
3385
3538
|
method: HttpMethod.Post,
|
|
3386
3539
|
body: JSON.stringify(cleanedBody),
|
|
3387
|
-
timeout: Number(SUPERBLOCKS_UI_EXECUTE_API_TIMEOUT_MS),
|
|
3388
|
-
baseUrl,
|
|
3389
|
-
responseType,
|
|
3390
|
-
query: { eventType },
|
|
3391
|
-
agents,
|
|
3392
3540
|
signal: abortController?.signal,
|
|
3393
3541
|
headers: {
|
|
3394
3542
|
[SUPERBLOCKS_AUTHORIZATION_HEADER]: `Bearer ${accessToken}`,
|
|
@@ -3739,7 +3887,9 @@ var ApiManager = class {
|
|
|
3739
3887
|
error: "No application ID was found"
|
|
3740
3888
|
};
|
|
3741
3889
|
}
|
|
3742
|
-
const
|
|
3890
|
+
const apiDepCandidates = this.apiNameToDepCandidates[scopeId]?.[apiName] ?? [];
|
|
3891
|
+
const { entities: inputs, files } = getApiDeps(this.rootStore.entityManager, scopeId, apiDepCandidates);
|
|
3892
|
+
const controlFlowOnlyFiles = await formatFilesForRequest(files);
|
|
3743
3893
|
if (!this.agentUrls.length) {
|
|
3744
3894
|
editorBridge.setApiResponse(apiName, {
|
|
3745
3895
|
status: "STATUS_COMPLETED",
|
|
@@ -3795,6 +3945,7 @@ var ApiManager = class {
|
|
|
3795
3945
|
includeResolved: editMode$1
|
|
3796
3946
|
}
|
|
3797
3947
|
},
|
|
3948
|
+
controlFlowOnlyFiles,
|
|
3798
3949
|
api,
|
|
3799
3950
|
environment: profileKey,
|
|
3800
3951
|
eventType: "api",
|
|
@@ -4012,10 +4163,8 @@ function startEditorSync(options) {
|
|
|
4012
4163
|
name: `editor-sync(${storeId})`
|
|
4013
4164
|
};
|
|
4014
4165
|
let initialState;
|
|
4015
|
-
if (keys)
|
|
4016
|
-
|
|
4017
|
-
initialState = sanitizedToJS(p);
|
|
4018
|
-
} else if (projection) initialState = sanitizedToJS(projection(store));
|
|
4166
|
+
if (keys) initialState = sanitizedToJS(pick(store, Object.keys(keys)));
|
|
4167
|
+
else if (projection) initialState = sanitizedToJS(projection(store));
|
|
4019
4168
|
else initialState = sanitizedToJS(store);
|
|
4020
4169
|
editorBridge.initializeEditorSyncedStore({
|
|
4021
4170
|
storeId,
|
|
@@ -4027,8 +4176,7 @@ function startEditorSync(options) {
|
|
|
4027
4176
|
const createDisposer = (key) => {
|
|
4028
4177
|
let lastValue;
|
|
4029
4178
|
return reaction(() => {
|
|
4030
|
-
|
|
4031
|
-
return sanitizedToJS(currentProjection[key]);
|
|
4179
|
+
return sanitizedToJS(projection(store)[key]);
|
|
4032
4180
|
}, (value) => {
|
|
4033
4181
|
const diffs = microPatches(lastValue, value, key);
|
|
4034
4182
|
lastValue = value;
|
|
@@ -4559,5 +4707,5 @@ var RootStore = class {
|
|
|
4559
4707
|
var root_store_default = new RootStore();
|
|
4560
4708
|
|
|
4561
4709
|
//#endregion
|
|
4562
|
-
export { CLASS_NAMES, DEFAULT_ANONYMOUS_SOURCE_ID, DevTools, EventFlow, GLOBAL_SCOPE_ID, LazyFunction, NavigationEvent, Prop, PropsPanelCategory, RecordProp, Section, VALIDATORS, addNewPromise, colors, createInternalPropsList, createManagedPropsList, createPropertiesPanelDefinition, editorBridge, generateId, getEditStore, getName, iframeMessageHandler, isEditMode, isEmbeddedBySuperblocksFirstParty, isLocalLink, isName, isNameEqual, navigation, rejectById, resolveById, root_store_default, run_event_handlers_default, sendNotification, startEditorSync, system_error_default };
|
|
4563
|
-
//# sourceMappingURL=root-store-
|
|
4710
|
+
export { CLASS_NAMES, DEFAULT_ANONYMOUS_SOURCE_ID, DevTools, EventFlow, FileManager, GLOBAL_SCOPE_ID, LazyFunction, NavigationEvent, Prop, PropsPanelCategory, RecordProp, Section, VALIDATORS, addNewPromise, colors, createInternalPropsList, createManagedPropsList, createPropertiesPanelDefinition, editorBridge, generateId, getEditStore, getFileWithUploadId, getName, iframeMessageHandler, isEditMode, isEmbeddedBySuperblocksFirstParty, isLocalLink, isName, isNameEqual, navigation, rejectById, resolveById, root_store_default, run_event_handlers_default, sendNotification, startEditorSync, system_error_default };
|
|
4711
|
+
//# sourceMappingURL=root-store-DSXdJ9lh.js.map
|