@bluecopa/core 0.1.82 → 0.1.83
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.
|
@@ -7,5 +7,14 @@ export declare const runPublishedDefinition: (props: {
|
|
|
7
7
|
};
|
|
8
8
|
variable: string;
|
|
9
9
|
inputs: object;
|
|
10
|
+
/**
|
|
11
|
+
* Pre-fetched solution bindings map. External apps fetch bindings once
|
|
12
|
+
* on context/app load via `copaUtils.fetchSolutionBindings()` and
|
|
13
|
+
* forward them on every run. Shape matches what
|
|
14
|
+
* `/api/v1/solution/bindings` returns under `bindings`. When
|
|
15
|
+
* omitted/empty, the BFF skips hydration and falls through to the
|
|
16
|
+
* original `published/run` pass-through.
|
|
17
|
+
*/
|
|
18
|
+
solutionBindings?: Record<string, unknown>;
|
|
10
19
|
source?: CancelTokenSource;
|
|
11
20
|
}) => Promise<import('axios').AxiosResponse<any, any, {}>>;
|
package/dist/config.d.ts
CHANGED
|
@@ -8,6 +8,13 @@ export interface Config {
|
|
|
8
8
|
solutionId?: string;
|
|
9
9
|
solutionBranch?: string;
|
|
10
10
|
solutionBranchType?: string;
|
|
11
|
+
/**
|
|
12
|
+
* When `true`, the SDK forwards `x-bluecopa-deployed-solution: true`
|
|
13
|
+
* on every request. Required for deployed-solution context — without
|
|
14
|
+
* it, the BFF treats the request as build mode and bindings/run calls
|
|
15
|
+
* may fail or 404 against the wrong backend.
|
|
16
|
+
*/
|
|
17
|
+
deployedSolution?: boolean;
|
|
11
18
|
websocketProvider?: IWebsocketProvider;
|
|
12
19
|
}
|
|
13
20
|
declare class ConfigSingleton {
|
package/dist/index.es.js
CHANGED
|
@@ -15,6 +15,7 @@ class ConfigSingleton {
|
|
|
15
15
|
workspaceId: "",
|
|
16
16
|
userId: "",
|
|
17
17
|
solutionId: void 0,
|
|
18
|
+
deployedSolution: void 0,
|
|
18
19
|
websocketProvider: void 0
|
|
19
20
|
};
|
|
20
21
|
}
|
|
@@ -39,6 +40,7 @@ class ConfigSingleton {
|
|
|
39
40
|
solutionId: void 0,
|
|
40
41
|
solutionBranch: void 0,
|
|
41
42
|
solutionBranchType: void 0,
|
|
43
|
+
deployedSolution: void 0,
|
|
42
44
|
websocketProvider: void 0
|
|
43
45
|
};
|
|
44
46
|
}
|
|
@@ -95,6 +97,9 @@ const createApiClient = () => {
|
|
|
95
97
|
if (copaConfig.solutionBranchType && config.headers) {
|
|
96
98
|
config.headers["x-bluecopa-solution-branch-type"] = _.trim(copaConfig.solutionBranchType);
|
|
97
99
|
}
|
|
100
|
+
if (copaConfig.deployedSolution && config.headers) {
|
|
101
|
+
config.headers["x-bluecopa-deployed-solution"] = "true";
|
|
102
|
+
}
|
|
98
103
|
return config;
|
|
99
104
|
},
|
|
100
105
|
(error) => {
|
|
@@ -365,7 +370,7 @@ const index$n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
365
370
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
366
371
|
const runPublishedDefinition = async (props) => {
|
|
367
372
|
var _a, _b;
|
|
368
|
-
const { sheet, variable, inputs, describe, source } = props;
|
|
373
|
+
const { sheet, variable, inputs, describe, solutionBindings, source } = props;
|
|
369
374
|
if (!sheet) {
|
|
370
375
|
throw { message: "Definition is null", status: 400 };
|
|
371
376
|
}
|
|
@@ -379,7 +384,10 @@ const runPublishedDefinition = async (props) => {
|
|
|
379
384
|
sheet,
|
|
380
385
|
variable,
|
|
381
386
|
inputs,
|
|
382
|
-
describe
|
|
387
|
+
describe,
|
|
388
|
+
// Only include when non-empty — empty/missing tells the BFF to
|
|
389
|
+
// skip hydration and pass through to fx_api `published/run`.
|
|
390
|
+
...solutionBindings && Object.keys(solutionBindings).length > 0 ? { solutionBindings } : {}
|
|
383
391
|
},
|
|
384
392
|
{ cancelToken: source == null ? void 0 : source.token }
|
|
385
393
|
);
|
|
@@ -9844,18 +9852,6 @@ const getUniqueDuplicateName = (name, collectionToCheckIn, suffix = "Copy", conc
|
|
|
9844
9852
|
}
|
|
9845
9853
|
return newName.trim();
|
|
9846
9854
|
};
|
|
9847
|
-
const index$k = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
9848
|
-
__proto__: null,
|
|
9849
|
-
formatDate,
|
|
9850
|
-
generatePushID,
|
|
9851
|
-
getMetricDefinition,
|
|
9852
|
-
getUniqueDuplicateName,
|
|
9853
|
-
hydrateStatement,
|
|
9854
|
-
inputTableUtils: inputTableDefinition,
|
|
9855
|
-
statementFilterConverters: filterConverters,
|
|
9856
|
-
statementFilterUtils: filterUtils,
|
|
9857
|
-
websocketUtils: websocketProviderFactory
|
|
9858
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
9859
9855
|
function resolveBinding(bindingKey, bindings) {
|
|
9860
9856
|
if (!bindings[bindingKey]) return null;
|
|
9861
9857
|
const bindingValue = bindings[bindingKey];
|
|
@@ -10002,6 +9998,32 @@ function applyWorkbookBindings(fileRead, bindings) {
|
|
|
10002
9998
|
}
|
|
10003
9999
|
return remapped;
|
|
10004
10000
|
}
|
|
10001
|
+
function applyReconBindings(fileRead, bindings) {
|
|
10002
|
+
if (!fileRead || !Array.isArray(fileRead.imports)) return fileRead;
|
|
10003
|
+
return {
|
|
10004
|
+
...fileRead,
|
|
10005
|
+
imports: fileRead.imports.map((imp) => {
|
|
10006
|
+
if (!(imp == null ? void 0 : imp.loc)) return imp;
|
|
10007
|
+
const resolved = resolveBinding(imp.loc, bindings);
|
|
10008
|
+
return resolved ? { ...imp, loc: resolved } : imp;
|
|
10009
|
+
})
|
|
10010
|
+
};
|
|
10011
|
+
}
|
|
10012
|
+
function applyDefinitionBindings(fileRead, bindings, definitionType) {
|
|
10013
|
+
if (!fileRead || !bindings || !Object.keys(bindings).length) return fileRead;
|
|
10014
|
+
switch (definitionType) {
|
|
10015
|
+
case "PIPELINE":
|
|
10016
|
+
return applyPipelineBindings(fileRead, bindings);
|
|
10017
|
+
case "SCHEDULE":
|
|
10018
|
+
return applyScheduleBindings(fileRead, bindings);
|
|
10019
|
+
case "WORKBOOK":
|
|
10020
|
+
return applyWorkbookBindings(fileRead, bindings);
|
|
10021
|
+
case "RECON":
|
|
10022
|
+
return applyReconBindings(fileRead, bindings);
|
|
10023
|
+
default:
|
|
10024
|
+
return fileRead;
|
|
10025
|
+
}
|
|
10026
|
+
}
|
|
10005
10027
|
function applyTargetedBindings(fileRead, bindings) {
|
|
10006
10028
|
if (!fileRead || !bindings || !Object.keys(bindings).length) return fileRead;
|
|
10007
10029
|
let result = { ...fileRead };
|
|
@@ -10027,8 +10049,32 @@ async function fetchSolutionBindings() {
|
|
|
10027
10049
|
}
|
|
10028
10050
|
function applyBindings(fileRead, bindings, definitionType) {
|
|
10029
10051
|
if (!fileRead || !Object.keys(bindings).length) return fileRead;
|
|
10030
|
-
return
|
|
10052
|
+
return definitionType ? applyDefinitionBindings(
|
|
10053
|
+
fileRead,
|
|
10054
|
+
bindings,
|
|
10055
|
+
definitionType
|
|
10056
|
+
) : applyTargetedBindings(fileRead, bindings);
|
|
10057
|
+
}
|
|
10058
|
+
async function applySolutionBindings(fileRead, definitionType) {
|
|
10059
|
+
if (!fileRead) return fileRead;
|
|
10060
|
+
const bindings = await fetchSolutionBindings();
|
|
10061
|
+
return applyBindings(fileRead, bindings, definitionType);
|
|
10031
10062
|
}
|
|
10063
|
+
const index$k = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
10064
|
+
__proto__: null,
|
|
10065
|
+
applyBindings,
|
|
10066
|
+
applySolutionBindings,
|
|
10067
|
+
fetchSolutionBindings,
|
|
10068
|
+
formatDate,
|
|
10069
|
+
generatePushID,
|
|
10070
|
+
getMetricDefinition,
|
|
10071
|
+
getUniqueDuplicateName,
|
|
10072
|
+
hydrateStatement,
|
|
10073
|
+
inputTableUtils: inputTableDefinition,
|
|
10074
|
+
statementFilterConverters: filterConverters,
|
|
10075
|
+
statementFilterUtils: filterUtils,
|
|
10076
|
+
websocketUtils: websocketProviderFactory
|
|
10077
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
10032
10078
|
const hydrateWorksheet = async (sheet, prefetchedBindings) => {
|
|
10033
10079
|
try {
|
|
10034
10080
|
if (!sheet) return sheet;
|