@embeddable.com/sdk-core 3.13.0-next.1 → 3.13.0-next.3
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/defineConfig.d.ts +128 -1
- package/lib/index.esm.js +101 -31
- package/lib/index.esm.js.map +1 -1
- package/lib/push.d.ts +16 -5
- package/package.json +2 -2
- package/src/defineConfig.test.ts +57 -3
- package/src/defineConfig.ts +113 -22
- package/src/dev.ts +20 -8
- package/src/push.test.ts +410 -5
- package/src/push.ts +53 -26
package/lib/defineConfig.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RollupOptions } from "rollup";
|
|
2
|
+
import { z } from "zod";
|
|
2
3
|
export type Region = "EU" | "US" | "legacy-US";
|
|
3
4
|
export type EmbeddableConfig = {
|
|
4
5
|
plugins: (() => {
|
|
@@ -7,6 +8,8 @@ export type EmbeddableConfig = {
|
|
|
7
8
|
cleanup: (config: EmbeddableConfig) => Promise<unknown>;
|
|
8
9
|
validate: (config: EmbeddableConfig) => Promise<unknown>;
|
|
9
10
|
})[];
|
|
11
|
+
pushModels?: boolean;
|
|
12
|
+
pushComponents?: boolean;
|
|
10
13
|
pushBaseUrl?: string;
|
|
11
14
|
audienceUrl?: string;
|
|
12
15
|
authDomain?: string;
|
|
@@ -27,7 +30,129 @@ export type EmbeddableConfig = {
|
|
|
27
30
|
rollupOptions?: RollupOptions;
|
|
28
31
|
region?: Region;
|
|
29
32
|
};
|
|
30
|
-
|
|
33
|
+
export type ResolvedEmbeddableConfig = {
|
|
34
|
+
core: {
|
|
35
|
+
rootDir: string;
|
|
36
|
+
templatesDir: string;
|
|
37
|
+
configsDir: string;
|
|
38
|
+
};
|
|
39
|
+
client: {
|
|
40
|
+
rootDir: string;
|
|
41
|
+
srcDir: string;
|
|
42
|
+
modelsSrc?: string;
|
|
43
|
+
presetsSrc?: string;
|
|
44
|
+
buildDir: string;
|
|
45
|
+
tmpDir: string;
|
|
46
|
+
globalCss: string;
|
|
47
|
+
componentDir: string;
|
|
48
|
+
stencilBuild: string;
|
|
49
|
+
archiveFile: string;
|
|
50
|
+
errorFallbackComponent?: string;
|
|
51
|
+
bundleHash?: string;
|
|
52
|
+
viteConfig: {
|
|
53
|
+
resolve?: {
|
|
54
|
+
alias?: Record<string, string>;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
rollupOptions: RollupOptions;
|
|
58
|
+
};
|
|
59
|
+
outputOptions: {
|
|
60
|
+
typesEntryPointFilename: string;
|
|
61
|
+
};
|
|
62
|
+
pushModels: boolean;
|
|
63
|
+
pushComponents: boolean;
|
|
64
|
+
pushBaseUrl: string;
|
|
65
|
+
audienceUrl: string;
|
|
66
|
+
previewBaseUrl: string;
|
|
67
|
+
authDomain: string;
|
|
68
|
+
authClientId: string;
|
|
69
|
+
applicationEnvironment: string;
|
|
70
|
+
rollbarAccessToken: string;
|
|
71
|
+
plugins: EmbeddableConfig["plugins"];
|
|
72
|
+
};
|
|
73
|
+
export declare const embeddableConfigSchema: z.ZodObject<{
|
|
74
|
+
plugins: z.ZodArray<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>, "many">;
|
|
75
|
+
region: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"EU">, z.ZodLiteral<"US">, z.ZodLiteral<"legacy-US">]>>;
|
|
76
|
+
pushModels: z.ZodOptional<z.ZodBoolean>;
|
|
77
|
+
pushComponents: z.ZodOptional<z.ZodBoolean>;
|
|
78
|
+
pushBaseUrl: z.ZodOptional<z.ZodString>;
|
|
79
|
+
audienceUrl: z.ZodOptional<z.ZodString>;
|
|
80
|
+
authDomain: z.ZodOptional<z.ZodString>;
|
|
81
|
+
authClientId: z.ZodOptional<z.ZodString>;
|
|
82
|
+
errorFallbackComponent: z.ZodOptional<z.ZodString>;
|
|
83
|
+
applicationEnvironment: z.ZodOptional<z.ZodString>;
|
|
84
|
+
rollbarAccessToken: z.ZodOptional<z.ZodString>;
|
|
85
|
+
previewBaseUrl: z.ZodOptional<z.ZodString>;
|
|
86
|
+
modelsSrc: z.ZodOptional<z.ZodString>;
|
|
87
|
+
presetsSrc: z.ZodOptional<z.ZodString>;
|
|
88
|
+
componentsSrc: z.ZodOptional<z.ZodString>;
|
|
89
|
+
globalCss: z.ZodOptional<z.ZodString>;
|
|
90
|
+
viteConfig: z.ZodOptional<z.ZodObject<{
|
|
91
|
+
resolve: z.ZodOptional<z.ZodObject<{
|
|
92
|
+
alias: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
93
|
+
}, "strip", z.ZodTypeAny, {
|
|
94
|
+
alias: Record<string, string>;
|
|
95
|
+
}, {
|
|
96
|
+
alias: Record<string, string>;
|
|
97
|
+
}>>;
|
|
98
|
+
}, "strip", z.ZodTypeAny, {
|
|
99
|
+
resolve?: {
|
|
100
|
+
alias: Record<string, string>;
|
|
101
|
+
} | undefined;
|
|
102
|
+
}, {
|
|
103
|
+
resolve?: {
|
|
104
|
+
alias: Record<string, string>;
|
|
105
|
+
} | undefined;
|
|
106
|
+
}>>;
|
|
107
|
+
rollupOptions: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
|
|
108
|
+
}, "strict", z.ZodTypeAny, {
|
|
109
|
+
plugins: ((...args: unknown[]) => unknown)[];
|
|
110
|
+
region?: "EU" | "US" | "legacy-US" | undefined;
|
|
111
|
+
pushModels?: boolean | undefined;
|
|
112
|
+
pushComponents?: boolean | undefined;
|
|
113
|
+
pushBaseUrl?: string | undefined;
|
|
114
|
+
audienceUrl?: string | undefined;
|
|
115
|
+
authDomain?: string | undefined;
|
|
116
|
+
authClientId?: string | undefined;
|
|
117
|
+
errorFallbackComponent?: string | undefined;
|
|
118
|
+
applicationEnvironment?: string | undefined;
|
|
119
|
+
rollbarAccessToken?: string | undefined;
|
|
120
|
+
previewBaseUrl?: string | undefined;
|
|
121
|
+
modelsSrc?: string | undefined;
|
|
122
|
+
presetsSrc?: string | undefined;
|
|
123
|
+
componentsSrc?: string | undefined;
|
|
124
|
+
globalCss?: string | undefined;
|
|
125
|
+
viteConfig?: {
|
|
126
|
+
resolve?: {
|
|
127
|
+
alias: Record<string, string>;
|
|
128
|
+
} | undefined;
|
|
129
|
+
} | undefined;
|
|
130
|
+
rollupOptions?: {} | undefined;
|
|
131
|
+
}, {
|
|
132
|
+
plugins: ((...args: unknown[]) => unknown)[];
|
|
133
|
+
region?: "EU" | "US" | "legacy-US" | undefined;
|
|
134
|
+
pushModels?: boolean | undefined;
|
|
135
|
+
pushComponents?: boolean | undefined;
|
|
136
|
+
pushBaseUrl?: string | undefined;
|
|
137
|
+
audienceUrl?: string | undefined;
|
|
138
|
+
authDomain?: string | undefined;
|
|
139
|
+
authClientId?: string | undefined;
|
|
140
|
+
errorFallbackComponent?: string | undefined;
|
|
141
|
+
applicationEnvironment?: string | undefined;
|
|
142
|
+
rollbarAccessToken?: string | undefined;
|
|
143
|
+
previewBaseUrl?: string | undefined;
|
|
144
|
+
modelsSrc?: string | undefined;
|
|
145
|
+
presetsSrc?: string | undefined;
|
|
146
|
+
componentsSrc?: string | undefined;
|
|
147
|
+
globalCss?: string | undefined;
|
|
148
|
+
viteConfig?: {
|
|
149
|
+
resolve?: {
|
|
150
|
+
alias: Record<string, string>;
|
|
151
|
+
} | undefined;
|
|
152
|
+
} | undefined;
|
|
153
|
+
rollupOptions?: {} | undefined;
|
|
154
|
+
}>;
|
|
155
|
+
declare const _default: (config: EmbeddableConfig) => {
|
|
31
156
|
core: {
|
|
32
157
|
rootDir: string;
|
|
33
158
|
templatesDir: string;
|
|
@@ -56,6 +181,8 @@ declare const _default: ({ plugins, region, pushBaseUrl, audienceUrl, authDomain
|
|
|
56
181
|
outputOptions: {
|
|
57
182
|
typesEntryPointFilename: string;
|
|
58
183
|
};
|
|
184
|
+
pushModels: boolean;
|
|
185
|
+
pushComponents: boolean;
|
|
59
186
|
pushBaseUrl: string;
|
|
60
187
|
audienceUrl: string;
|
|
61
188
|
previewBaseUrl: string;
|
package/lib/index.esm.js
CHANGED
|
@@ -3,7 +3,7 @@ import { readdir, lstat } from 'node:fs/promises';
|
|
|
3
3
|
import * as path from 'node:path';
|
|
4
4
|
import path__default, { join } from 'node:path';
|
|
5
5
|
import * as vite from 'vite';
|
|
6
|
-
import ora from 'ora';
|
|
6
|
+
import ora$1 from 'ora';
|
|
7
7
|
import 'node:child_process';
|
|
8
8
|
import * as crypto from 'node:crypto';
|
|
9
9
|
import * as fs$1 from 'node:fs';
|
|
@@ -19,7 +19,8 @@ import require$$1 from 'os';
|
|
|
19
19
|
import require$$3 from 'http';
|
|
20
20
|
import require$$4 from 'https';
|
|
21
21
|
import require$$0$1 from 'url';
|
|
22
|
-
import require$$2$1
|
|
22
|
+
import * as require$$2$1 from 'fs';
|
|
23
|
+
import require$$2__default, { createReadStream } from 'fs';
|
|
23
24
|
import * as path$1 from 'path';
|
|
24
25
|
import path__default$1, { basename } from 'path';
|
|
25
26
|
import axios from 'axios';
|
|
@@ -28,11 +29,8 @@ import { select } from '@inquirer/prompts';
|
|
|
28
29
|
import * as http from 'node:http';
|
|
29
30
|
import { WebSocketServer } from 'ws';
|
|
30
31
|
import * as chokidar from 'chokidar';
|
|
31
|
-
import minimist from 'minimist';
|
|
32
32
|
import fg from 'fast-glob';
|
|
33
33
|
import * as dotenv from 'dotenv';
|
|
34
|
-
import finalhandler from 'finalhandler';
|
|
35
|
-
import serveStatic from 'serve-static';
|
|
36
34
|
import { stat } from 'fs/promises';
|
|
37
35
|
|
|
38
36
|
var findFiles = async (initialSrcDir, regex) => {
|
|
@@ -374,7 +372,7 @@ const getContentHash = (contentString) => {
|
|
|
374
372
|
const EMB_TYPE_FILE_REGEX = /^(.*)\.type\.emb\.[jt]s$/;
|
|
375
373
|
const EMB_OPTIONS_FILE_REGEX = /^(.*)\.options\.emb\.[jt]s$/;
|
|
376
374
|
var buildTypes = async (ctx) => {
|
|
377
|
-
const progress = ora("Building types...").start();
|
|
375
|
+
const progress = ora$1("Building types...").start();
|
|
378
376
|
await generate$1(ctx);
|
|
379
377
|
await build$1(ctx);
|
|
380
378
|
await cleanup$1(ctx);
|
|
@@ -563,7 +561,7 @@ const CREDENTIALS_DIR = path.resolve(os.homedir(), ".embeddable");
|
|
|
563
561
|
const CREDENTIALS_FILE = path.resolve(CREDENTIALS_DIR, "credentials");
|
|
564
562
|
|
|
565
563
|
const checkNodeVersion = async () => {
|
|
566
|
-
const spinner = ora("Checking node version...").start();
|
|
564
|
+
const spinner = ora$1("Checking node version...").start();
|
|
567
565
|
const [major, minor] = process.versions.node.split(".").map(Number);
|
|
568
566
|
let packageJson;
|
|
569
567
|
try {
|
|
@@ -4991,7 +4989,7 @@ const SECURITY_CONTEXT_FILE_REGEX = /^(.*)\.sc\.ya?ml$/;
|
|
|
4991
4989
|
const CLIENT_CONTEXT_FILE_REGEX = /^(.*)\.cc\.ya?ml$/;
|
|
4992
4990
|
var validate = async (ctx) => {
|
|
4993
4991
|
checkNodeVersion();
|
|
4994
|
-
const spinnerValidate = ora("Data model validation...").start();
|
|
4992
|
+
const spinnerValidate = ora$1("Data model validation...").start();
|
|
4995
4993
|
const cubeFilesList = await findFiles(ctx.client.modelsSrc || ctx.client.srcDir, CUBE_YAML_FILE_REGEX);
|
|
4996
4994
|
const securityContextFilesList = await findFiles(ctx.client.presetsSrc || ctx.client.srcDir, SECURITY_CONTEXT_FILE_REGEX);
|
|
4997
4995
|
const clientContextFilesList = await findFiles(ctx.client.presetsSrc || ctx.client.srcDir, CLIENT_CONTEXT_FILE_REGEX);
|
|
@@ -17914,7 +17912,7 @@ function requireStackTrace () {
|
|
|
17914
17912
|
hasRequiredStackTrace = 1;
|
|
17915
17913
|
var SourceMapConsumer = requireSourceMap().SourceMapConsumer;
|
|
17916
17914
|
var path = path__default$1;
|
|
17917
|
-
var fs = require$$
|
|
17915
|
+
var fs = require$$2__default;
|
|
17918
17916
|
|
|
17919
17917
|
/**
|
|
17920
17918
|
* Uses Node source-map to map transpiled JS stack locations to original
|
|
@@ -18122,7 +18120,7 @@ function requireParser () {
|
|
|
18122
18120
|
|
|
18123
18121
|
var logger = requireLogger();
|
|
18124
18122
|
var async = require$$0;
|
|
18125
|
-
var fs = require$$
|
|
18123
|
+
var fs = require$$2__default;
|
|
18126
18124
|
var lru = requireLruCache();
|
|
18127
18125
|
var util = require$$4$1;
|
|
18128
18126
|
var stackTrace = requireStackTrace();
|
|
@@ -21377,13 +21375,13 @@ var build = async () => {
|
|
|
21377
21375
|
}
|
|
21378
21376
|
};
|
|
21379
21377
|
|
|
21380
|
-
const oraP = import('ora');
|
|
21378
|
+
const oraP$1 = import('ora');
|
|
21381
21379
|
const openP = import('open');
|
|
21382
21380
|
var login = async () => {
|
|
21383
21381
|
var _a;
|
|
21384
21382
|
await initLogger("login");
|
|
21385
21383
|
const breadcrumbs = [];
|
|
21386
|
-
const ora = (await oraP).default;
|
|
21384
|
+
const ora = (await oraP$1).default;
|
|
21387
21385
|
const authenticationSpinner = ora("Waiting for code verification...").start();
|
|
21388
21386
|
try {
|
|
21389
21387
|
const open = (await openP).default;
|
|
@@ -21544,7 +21542,7 @@ var push = async () => {
|
|
|
21544
21542
|
}
|
|
21545
21543
|
const config = await provideConfig();
|
|
21546
21544
|
if (process.argv.includes("--api-key") || process.argv.includes("-k")) {
|
|
21547
|
-
spinnerPushing = ora("Using API key...").start();
|
|
21545
|
+
spinnerPushing = ora$1("Using API key...").start();
|
|
21548
21546
|
breadcrumbs.push("push by api key");
|
|
21549
21547
|
await pushByApiKey(config, spinnerPushing);
|
|
21550
21548
|
spinnerPushing.succeed("Published using API key");
|
|
@@ -21552,11 +21550,11 @@ var push = async () => {
|
|
|
21552
21550
|
}
|
|
21553
21551
|
breadcrumbs.push("push by standard login");
|
|
21554
21552
|
const token = await verify(config);
|
|
21555
|
-
spinnerPushing = ora()
|
|
21553
|
+
spinnerPushing = ora$1()
|
|
21556
21554
|
.start()
|
|
21557
21555
|
.info("No API Key provided. Standard login will be used.");
|
|
21558
21556
|
breadcrumbs.push("select workspace");
|
|
21559
|
-
const { workspaceId, name: workspaceName } = await selectWorkspace(ora, config, token);
|
|
21557
|
+
const { workspaceId, name: workspaceName } = await selectWorkspace(ora$1, config, token);
|
|
21560
21558
|
const workspacePreviewUrl = `${config.previewBaseUrl}/workspace/${workspaceId}`;
|
|
21561
21559
|
breadcrumbs.push("build archive");
|
|
21562
21560
|
await buildArchive(config);
|
|
@@ -21610,27 +21608,45 @@ async function verify(ctx) {
|
|
|
21610
21608
|
return token;
|
|
21611
21609
|
}
|
|
21612
21610
|
async function buildArchive(config) {
|
|
21613
|
-
const spinnerArchive = ora("Building...").start();
|
|
21614
|
-
|
|
21615
|
-
|
|
21616
|
-
|
|
21617
|
-
|
|
21618
|
-
|
|
21611
|
+
const spinnerArchive = ora$1("Building...").start();
|
|
21612
|
+
if (!config.pushModels && !config.pushComponents) {
|
|
21613
|
+
spinnerArchive.fail("Cannot push: both pushModels and pushComponents are disabled");
|
|
21614
|
+
process.exit(1);
|
|
21615
|
+
}
|
|
21616
|
+
const filesList = [];
|
|
21617
|
+
if (config.pushModels) {
|
|
21618
|
+
const cubeFilesList = await findFiles(config.client.modelsSrc || config.client.srcDir, CUBE_FILES);
|
|
21619
|
+
const contextFilesList = await findFiles(config.client.presetsSrc || config.client.srcDir, PRESET_FILES);
|
|
21620
|
+
filesList.push(...cubeFilesList.map((entry) => [
|
|
21621
|
+
path$1.basename(entry[1]),
|
|
21622
|
+
entry[1],
|
|
21623
|
+
]), ...contextFilesList.map((entry) => [
|
|
21624
|
+
path$1.basename(entry[1]),
|
|
21625
|
+
entry[1],
|
|
21626
|
+
]));
|
|
21627
|
+
}
|
|
21628
|
+
await archive({
|
|
21629
|
+
ctx: config,
|
|
21630
|
+
filesList,
|
|
21631
|
+
isDev: false,
|
|
21632
|
+
includeComponents: config.pushComponents,
|
|
21633
|
+
});
|
|
21619
21634
|
return spinnerArchive.succeed("Bundling completed");
|
|
21620
21635
|
}
|
|
21621
|
-
async function archive(
|
|
21636
|
+
async function archive(args) {
|
|
21637
|
+
const { ctx, filesList, isDev, includeComponents } = args;
|
|
21622
21638
|
const output = fs$1.createWriteStream(ctx.client.archiveFile);
|
|
21623
21639
|
const archive = archiver.create("zip", {
|
|
21624
21640
|
zlib: { level: 9 },
|
|
21625
21641
|
});
|
|
21626
21642
|
archive.pipe(output);
|
|
21627
|
-
if (!isDev) {
|
|
21643
|
+
if (!isDev && includeComponents) {
|
|
21628
21644
|
archive.directory(ctx.client.buildDir, false);
|
|
21629
21645
|
archive.file(ctx.client.globalCss, {
|
|
21630
21646
|
name: "global.css",
|
|
21631
21647
|
});
|
|
21632
21648
|
}
|
|
21633
|
-
for (const fileData of
|
|
21649
|
+
for (const fileData of filesList) {
|
|
21634
21650
|
archive.file(fileData[1], {
|
|
21635
21651
|
name: fileData[0],
|
|
21636
21652
|
});
|
|
@@ -21640,7 +21656,7 @@ async function archive(ctx, yamlFiles, isDev = false) {
|
|
|
21640
21656
|
output.on("close", resolve);
|
|
21641
21657
|
});
|
|
21642
21658
|
}
|
|
21643
|
-
async function sendBuildByApiKey(ctx, { apiKey, email, message }) {
|
|
21659
|
+
async function sendBuildByApiKey(ctx, { apiKey, email, message, }) {
|
|
21644
21660
|
var _a;
|
|
21645
21661
|
const { FormData, Blob } = await import('formdata-node');
|
|
21646
21662
|
const { fileFromPath } = await Promise.resolve().then(function () { return fileFromPath$1; });
|
|
@@ -21673,10 +21689,13 @@ async function uploadFile(formData, url, token) {
|
|
|
21673
21689
|
});
|
|
21674
21690
|
}
|
|
21675
21691
|
|
|
21692
|
+
const minimist = require("minimist");
|
|
21676
21693
|
dotenv.config();
|
|
21694
|
+
const oraP = import('ora');
|
|
21677
21695
|
let wss;
|
|
21678
21696
|
let changedFiles = [];
|
|
21679
21697
|
let browserWindow = null;
|
|
21698
|
+
let ora;
|
|
21680
21699
|
let previewWorkspace;
|
|
21681
21700
|
const SERVER_PORT = 8926;
|
|
21682
21701
|
const BUILD_DEV_DIR = ".embeddable-dev-build";
|
|
@@ -21686,6 +21705,7 @@ const buildWebComponent = async (config) => {
|
|
|
21686
21705
|
};
|
|
21687
21706
|
const addToGitingore = async () => {
|
|
21688
21707
|
try {
|
|
21708
|
+
const fs = require("fs").promises;
|
|
21689
21709
|
const gitignorePath = path$1.resolve(process.cwd(), ".gitignore");
|
|
21690
21710
|
const gitignoreContent = await fs.readFile(gitignorePath, "utf8");
|
|
21691
21711
|
if (!gitignoreContent.includes(BUILD_DEV_DIR)) {
|
|
@@ -21712,6 +21732,7 @@ var dev = async () => {
|
|
|
21712
21732
|
breadcrumbs.push("run dev");
|
|
21713
21733
|
checkNodeVersion();
|
|
21714
21734
|
addToGitingore();
|
|
21735
|
+
ora = (await oraP).default;
|
|
21715
21736
|
process.on("warning", (e) => console.warn(e.stack));
|
|
21716
21737
|
const logger = createNodeLogger();
|
|
21717
21738
|
const sys = createNodeSys({ process });
|
|
@@ -21734,6 +21755,8 @@ var dev = async () => {
|
|
|
21734
21755
|
};
|
|
21735
21756
|
breadcrumbs.push("prepare config");
|
|
21736
21757
|
await prepare(config);
|
|
21758
|
+
const finalhandler = require("finalhandler");
|
|
21759
|
+
const serveStatic = require("serve-static");
|
|
21737
21760
|
const serve = serveStatic(config.client.buildDir);
|
|
21738
21761
|
let workspacePreparation = ora("Preparing workspace...").start();
|
|
21739
21762
|
breadcrumbs.push("get preview workspace");
|
|
@@ -21753,7 +21776,7 @@ var dev = async () => {
|
|
|
21753
21776
|
}
|
|
21754
21777
|
}
|
|
21755
21778
|
workspacePreparation.succeed("Workspace is ready");
|
|
21756
|
-
const server = http.createServer(
|
|
21779
|
+
const server = http.createServer((request, res) => {
|
|
21757
21780
|
var _a;
|
|
21758
21781
|
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
21759
21782
|
res.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
|
|
@@ -21768,7 +21791,7 @@ var dev = async () => {
|
|
|
21768
21791
|
try {
|
|
21769
21792
|
if ((_a = request.url) === null || _a === void 0 ? void 0 : _a.endsWith(GLOBAL_CSS)) {
|
|
21770
21793
|
res.writeHead(200, { "Content-Type": "text/css" });
|
|
21771
|
-
res.end(
|
|
21794
|
+
res.end(require$$2$1.readFileSync(config.client.globalCss));
|
|
21772
21795
|
return;
|
|
21773
21796
|
}
|
|
21774
21797
|
}
|
|
@@ -21901,7 +21924,12 @@ const sendDataModelsAndContextsChanges = async (ctx) => {
|
|
|
21901
21924
|
"embeddable-manifest.json",
|
|
21902
21925
|
path$1.resolve(ctx.client.buildDir, "embeddable-manifest.json"),
|
|
21903
21926
|
]);
|
|
21904
|
-
await archive(
|
|
21927
|
+
await archive({
|
|
21928
|
+
ctx,
|
|
21929
|
+
filesList,
|
|
21930
|
+
isDev: true,
|
|
21931
|
+
includeComponents: false,
|
|
21932
|
+
});
|
|
21905
21933
|
await sendBuild(ctx, { workspaceId: previewWorkspace, token });
|
|
21906
21934
|
sending.succeed(`Data models and/or security context synchronized`);
|
|
21907
21935
|
sendMessage("dataModelsAndOrSecurityContextUpdateSuccess");
|
|
@@ -21985,10 +22013,50 @@ const REGION_CONFIGS = {
|
|
|
21985
22013
|
authClientId: "dygrSUmI6HmgY5ymVbEAoLDEBxIOyr1V",
|
|
21986
22014
|
},
|
|
21987
22015
|
};
|
|
21988
|
-
|
|
21989
|
-
|
|
21990
|
-
|
|
22016
|
+
const embeddableConfigSchema = z
|
|
22017
|
+
.object({
|
|
22018
|
+
plugins: z.array(z.function()),
|
|
22019
|
+
region: z
|
|
22020
|
+
.union([z.literal("EU"), z.literal("US"), z.literal("legacy-US")])
|
|
22021
|
+
.optional(),
|
|
22022
|
+
pushModels: z.boolean().optional(),
|
|
22023
|
+
pushComponents: z.boolean().optional(),
|
|
22024
|
+
pushBaseUrl: z.string().optional(),
|
|
22025
|
+
audienceUrl: z.string().optional(),
|
|
22026
|
+
authDomain: z.string().optional(),
|
|
22027
|
+
authClientId: z.string().optional(),
|
|
22028
|
+
errorFallbackComponent: z.string().optional(),
|
|
22029
|
+
applicationEnvironment: z.string().optional(),
|
|
22030
|
+
rollbarAccessToken: z.string().optional(),
|
|
22031
|
+
previewBaseUrl: z.string().optional(),
|
|
22032
|
+
modelsSrc: z.string().optional(),
|
|
22033
|
+
presetsSrc: z.string().optional(),
|
|
22034
|
+
componentsSrc: z.string().optional(),
|
|
22035
|
+
globalCss: z.string().optional(),
|
|
22036
|
+
viteConfig: z
|
|
22037
|
+
.object({
|
|
22038
|
+
resolve: z
|
|
22039
|
+
.object({
|
|
22040
|
+
alias: z.record(z.string()),
|
|
22041
|
+
})
|
|
22042
|
+
.optional(),
|
|
22043
|
+
})
|
|
22044
|
+
.optional(),
|
|
22045
|
+
rollupOptions: z.object({}).optional(),
|
|
22046
|
+
})
|
|
22047
|
+
.strict();
|
|
22048
|
+
var defineConfig = (config) => {
|
|
22049
|
+
const safeParse = embeddableConfigSchema.safeParse(config);
|
|
22050
|
+
const errors = [];
|
|
22051
|
+
if (!safeParse.success) {
|
|
22052
|
+
errorFormatter(safeParse.error.issues).forEach((error) => {
|
|
22053
|
+
errors.push(`${error}`);
|
|
22054
|
+
});
|
|
22055
|
+
}
|
|
22056
|
+
if (errors.length > 0) {
|
|
22057
|
+
throw new Error(`Invalid Embeddable Configuration: ${errors.join("\n")}}`);
|
|
21991
22058
|
}
|
|
22059
|
+
let { plugins, region = "legacy-US", pushModels = true, pushComponents = true, pushBaseUrl, audienceUrl, authDomain, authClientId, errorFallbackComponent, applicationEnvironment, rollbarAccessToken, previewBaseUrl, modelsSrc = "src", presetsSrc = "src", componentsSrc = "src", globalCss = "src/global.css", viteConfig = {}, rollupOptions = {}, } = config;
|
|
21992
22060
|
const regionConfig = REGION_CONFIGS[region];
|
|
21993
22061
|
const __dirname = import.meta.dirname;
|
|
21994
22062
|
const coreRoot = path.resolve(__dirname, "..");
|
|
@@ -22038,6 +22106,8 @@ var defineConfig = ({ plugins, region = "legacy-US", pushBaseUrl, audienceUrl, a
|
|
|
22038
22106
|
outputOptions: {
|
|
22039
22107
|
typesEntryPointFilename: "embeddable-types-entry-point.js",
|
|
22040
22108
|
},
|
|
22109
|
+
pushModels,
|
|
22110
|
+
pushComponents,
|
|
22041
22111
|
pushBaseUrl: pushBaseUrl !== null && pushBaseUrl !== undefined ? pushBaseUrl : regionConfig.pushBaseUrl,
|
|
22042
22112
|
audienceUrl: audienceUrl !== null && audienceUrl !== undefined ? audienceUrl : regionConfig.audienceUrl,
|
|
22043
22113
|
previewBaseUrl: previewBaseUrl !== null && previewBaseUrl !== undefined ? previewBaseUrl : regionConfig.previewBaseUrl,
|