@embeddable.com/sdk-core 3.12.2 → 3.12.4-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/lib/defineConfig.d.ts +3 -1
- package/lib/index.esm.js +36 -8
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +36 -8
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/defineConfig.test.ts +56 -0
- package/src/defineConfig.ts +41 -5
- package/src/push.ts +1 -1
- package/lib/src/build.d.ts +0 -2
- package/lib/src/build.test.d.ts +0 -1
- package/lib/src/buildTypes.d.ts +0 -4
- package/lib/src/buildTypes.test.d.ts +0 -1
- package/lib/src/cleanup.d.ts +0 -16
- package/lib/src/cleanup.test.d.ts +0 -1
- package/lib/src/createContext.d.ts +0 -23
- package/lib/src/credentials.d.ts +0 -2
- package/lib/src/defineConfig.d.ts +0 -65
- package/lib/src/dev.d.ts +0 -2
- package/lib/src/generate.d.ts +0 -2
- package/lib/src/globalCleanup.d.ts +0 -2
- package/lib/src/index.d.ts +0 -5
- package/lib/src/login.d.ts +0 -4
- package/lib/src/prepare.d.ts +0 -3
- package/lib/src/provideConfig.d.ts +0 -2
- package/lib/src/provideConfig.test.d.ts +0 -1
- package/lib/src/push.d.ts +0 -26
- package/lib/src/utils.d.ts +0 -25
- package/lib/src/utils.test.d.ts +0 -1
- package/lib/src/validate.d.ts +0 -8
- package/lib/src/validate.test.d.ts +0 -1
package/package.json
CHANGED
package/src/defineConfig.test.ts
CHANGED
|
@@ -79,4 +79,60 @@ describe("defineConfig", () => {
|
|
|
79
79
|
}
|
|
80
80
|
`);
|
|
81
81
|
});
|
|
82
|
+
|
|
83
|
+
describe("region configuration", () => {
|
|
84
|
+
it("uses legacy-US region by default", () => {
|
|
85
|
+
const config = defineConfig({ plugins: [] });
|
|
86
|
+
|
|
87
|
+
expect(config.pushBaseUrl).toBe("https://api.embeddable.com");
|
|
88
|
+
expect(config.audienceUrl).toBe("https://auth.embeddable.com");
|
|
89
|
+
expect(config.previewBaseUrl).toBe("https://app.embeddable.com");
|
|
90
|
+
expect(config.authDomain).toBe("auth.embeddable.com");
|
|
91
|
+
expect(config.authClientId).toBe("dygrSUmI6HmgY5ymVbEAoLDEBxIOyr1V");
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it("configures EU region correctly", () => {
|
|
95
|
+
const config = defineConfig({ plugins: [], region: "EU" });
|
|
96
|
+
|
|
97
|
+
expect(config.pushBaseUrl).toBe("https://api.eu.embeddable.com");
|
|
98
|
+
expect(config.audienceUrl).toBe("https://auth.eu.embeddable.com");
|
|
99
|
+
expect(config.previewBaseUrl).toBe("https://app.eu.embeddable.com");
|
|
100
|
+
expect(config.authDomain).toBe("auth.eu.embeddable.com");
|
|
101
|
+
expect(config.authClientId).toBe("6OGPwIQsVmtrBKhNrwAaXhz4ePb0kBGV");
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it("configures US region correctly", () => {
|
|
105
|
+
const config = defineConfig({ plugins: [], region: "US" });
|
|
106
|
+
|
|
107
|
+
expect(config.pushBaseUrl).toBe("https://api.us.embeddable.com");
|
|
108
|
+
expect(config.audienceUrl).toBe("https://auth.embeddable.com");
|
|
109
|
+
expect(config.previewBaseUrl).toBe("https://app.us.embeddable.com");
|
|
110
|
+
expect(config.authDomain).toBe("auth.embeddable.com");
|
|
111
|
+
expect(config.authClientId).toBe("dygrSUmI6HmgY5ymVbEAoLDEBxIOyr1V");
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it("allows overriding region-specific values", () => {
|
|
115
|
+
const config = defineConfig({
|
|
116
|
+
plugins: [],
|
|
117
|
+
region: "EU",
|
|
118
|
+
pushBaseUrl: "custom-push-url",
|
|
119
|
+
authClientId: "custom-client-id",
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
expect(config.pushBaseUrl).toBe("custom-push-url");
|
|
123
|
+
expect(config.authClientId).toBe("custom-client-id");
|
|
124
|
+
// Other values should still be from EU region
|
|
125
|
+
expect(config.audienceUrl).toBe("https://auth.eu.embeddable.com");
|
|
126
|
+
expect(config.previewBaseUrl).toBe("https://app.eu.embeddable.com");
|
|
127
|
+
expect(config.authDomain).toBe("auth.eu.embeddable.com");
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it("throws error for invalid region", () => {
|
|
131
|
+
expect(() =>
|
|
132
|
+
defineConfig({ plugins: [], region: "INVALID" as any }),
|
|
133
|
+
).toThrow(
|
|
134
|
+
"Unsupported region: INVALID. Supported regions are: EU, US, legacy-US",
|
|
135
|
+
);
|
|
136
|
+
});
|
|
137
|
+
});
|
|
82
138
|
});
|
package/src/defineConfig.ts
CHANGED
|
@@ -2,6 +2,8 @@ import * as path from "node:path";
|
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { RollupOptions } from "rollup";
|
|
4
4
|
|
|
5
|
+
export type Region = "EU" | "US" | "legacy-US";
|
|
6
|
+
|
|
5
7
|
export type EmbeddableConfig = {
|
|
6
8
|
plugins: (() => {
|
|
7
9
|
pluginName: string;
|
|
@@ -27,10 +29,36 @@ export type EmbeddableConfig = {
|
|
|
27
29
|
};
|
|
28
30
|
};
|
|
29
31
|
rollupOptions?: RollupOptions;
|
|
32
|
+
region?: Region;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const REGION_CONFIGS = {
|
|
36
|
+
EU: {
|
|
37
|
+
pushBaseUrl: "https://api.eu.embeddable.com",
|
|
38
|
+
audienceUrl: "https://auth.eu.embeddable.com",
|
|
39
|
+
previewBaseUrl: "https://app.eu.embeddable.com",
|
|
40
|
+
authDomain: "auth.eu.embeddable.com",
|
|
41
|
+
authClientId: "6OGPwIQsVmtrBKhNrwAaXhz4ePb0kBGV",
|
|
42
|
+
},
|
|
43
|
+
US: {
|
|
44
|
+
pushBaseUrl: "https://api.us.embeddable.com",
|
|
45
|
+
audienceUrl: "https://auth.embeddable.com",
|
|
46
|
+
previewBaseUrl: "https://app.us.embeddable.com",
|
|
47
|
+
authDomain: "auth.embeddable.com",
|
|
48
|
+
authClientId: "dygrSUmI6HmgY5ymVbEAoLDEBxIOyr1V",
|
|
49
|
+
},
|
|
50
|
+
"legacy-US": {
|
|
51
|
+
pushBaseUrl: "https://api.embeddable.com",
|
|
52
|
+
audienceUrl: "https://auth.embeddable.com",
|
|
53
|
+
previewBaseUrl: "https://app.embeddable.com",
|
|
54
|
+
authDomain: "auth.embeddable.com",
|
|
55
|
+
authClientId: "dygrSUmI6HmgY5ymVbEAoLDEBxIOyr1V",
|
|
56
|
+
},
|
|
30
57
|
};
|
|
31
58
|
|
|
32
59
|
export default ({
|
|
33
60
|
plugins,
|
|
61
|
+
region = "legacy-US",
|
|
34
62
|
pushBaseUrl,
|
|
35
63
|
audienceUrl,
|
|
36
64
|
authDomain,
|
|
@@ -46,6 +74,14 @@ export default ({
|
|
|
46
74
|
viteConfig = {},
|
|
47
75
|
rollupOptions = {},
|
|
48
76
|
}: EmbeddableConfig) => {
|
|
77
|
+
if (region && !REGION_CONFIGS[region]) {
|
|
78
|
+
throw new Error(
|
|
79
|
+
`Unsupported region: ${region}. Supported regions are: ${Object.keys(REGION_CONFIGS).join(", ")}`,
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const regionConfig = REGION_CONFIGS[region];
|
|
84
|
+
|
|
49
85
|
const coreRoot = path.resolve(__dirname, "..");
|
|
50
86
|
const clientRoot = process.cwd();
|
|
51
87
|
|
|
@@ -107,11 +143,11 @@ export default ({
|
|
|
107
143
|
outputOptions: {
|
|
108
144
|
typesEntryPointFilename: "embeddable-types-entry-point.js",
|
|
109
145
|
},
|
|
110
|
-
pushBaseUrl: pushBaseUrl ??
|
|
111
|
-
audienceUrl: audienceUrl ??
|
|
112
|
-
previewBaseUrl: previewBaseUrl ??
|
|
113
|
-
authDomain: authDomain ??
|
|
114
|
-
authClientId: authClientId ??
|
|
146
|
+
pushBaseUrl: pushBaseUrl ?? regionConfig.pushBaseUrl,
|
|
147
|
+
audienceUrl: audienceUrl ?? regionConfig.audienceUrl,
|
|
148
|
+
previewBaseUrl: previewBaseUrl ?? regionConfig.previewBaseUrl,
|
|
149
|
+
authDomain: authDomain ?? regionConfig.authDomain,
|
|
150
|
+
authClientId: authClientId ?? regionConfig.authClientId,
|
|
115
151
|
applicationEnvironment: applicationEnvironment ?? "production",
|
|
116
152
|
rollbarAccessToken:
|
|
117
153
|
rollbarAccessToken ?? "5c6028038d844bf1835a0f4db5f55d9e",
|
package/src/push.ts
CHANGED
|
@@ -82,7 +82,7 @@ export default async () => {
|
|
|
82
82
|
spinnerPushing?.fail("Publishing failed");
|
|
83
83
|
await logError({ command: "push", breadcrumbs, error });
|
|
84
84
|
await reportErrorToRollbar(error);
|
|
85
|
-
console.log(error);
|
|
85
|
+
console.log(error.response?.data || error);
|
|
86
86
|
process.exit(1);
|
|
87
87
|
}
|
|
88
88
|
};
|
package/lib/src/build.d.ts
DELETED
package/lib/src/build.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/src/buildTypes.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/src/cleanup.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
declare const _default: (ctx: any) => Promise<void>;
|
|
2
|
-
export default _default;
|
|
3
|
-
type ManifestArgs = {
|
|
4
|
-
ctx: any;
|
|
5
|
-
typesFileName: string;
|
|
6
|
-
metaFileName: string;
|
|
7
|
-
editorsMetaFileName: string;
|
|
8
|
-
stencilWrapperFileName: string;
|
|
9
|
-
};
|
|
10
|
-
export declare function createManifest({
|
|
11
|
-
ctx,
|
|
12
|
-
typesFileName,
|
|
13
|
-
metaFileName,
|
|
14
|
-
editorsMetaFileName,
|
|
15
|
-
stencilWrapperFileName,
|
|
16
|
-
}: ManifestArgs): Promise<void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
declare const _default: (
|
|
2
|
-
coreRoot: string,
|
|
3
|
-
clientRoot: string,
|
|
4
|
-
) => {
|
|
5
|
-
core: {
|
|
6
|
-
rootDir: string;
|
|
7
|
-
templatesDir: string;
|
|
8
|
-
configsDir: string;
|
|
9
|
-
};
|
|
10
|
-
client: {
|
|
11
|
-
rootDir: string;
|
|
12
|
-
buildDir: string;
|
|
13
|
-
srcDir: string;
|
|
14
|
-
tmpDir: string;
|
|
15
|
-
componentDir: string;
|
|
16
|
-
stencilBuild: string;
|
|
17
|
-
archiveFile: string;
|
|
18
|
-
};
|
|
19
|
-
outputOptions: {
|
|
20
|
-
typesEntryPointFilename: string;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
export default _default;
|
package/lib/src/credentials.d.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
export type EmbeddableConfig = {
|
|
2
|
-
plugins: (() => {
|
|
3
|
-
pluginName: string;
|
|
4
|
-
build: (config: EmbeddableConfig) => Promise<unknown>;
|
|
5
|
-
cleanup: (config: EmbeddableConfig) => Promise<unknown>;
|
|
6
|
-
validate: (config: EmbeddableConfig) => Promise<unknown>;
|
|
7
|
-
})[];
|
|
8
|
-
pushBaseUrl?: string;
|
|
9
|
-
audienceUrl?: string;
|
|
10
|
-
authDomain?: string;
|
|
11
|
-
authClientId?: string;
|
|
12
|
-
errorFallbackComponent?: string;
|
|
13
|
-
applicationEnvironment?: string;
|
|
14
|
-
rollbarAccessToken?: string;
|
|
15
|
-
previewBaseUrl?: string;
|
|
16
|
-
componentsSrc?: string;
|
|
17
|
-
modelsSrc?: string;
|
|
18
|
-
};
|
|
19
|
-
declare const _default: ({
|
|
20
|
-
plugins,
|
|
21
|
-
pushBaseUrl,
|
|
22
|
-
audienceUrl,
|
|
23
|
-
authDomain,
|
|
24
|
-
authClientId,
|
|
25
|
-
errorFallbackComponent,
|
|
26
|
-
applicationEnvironment,
|
|
27
|
-
rollbarAccessToken,
|
|
28
|
-
previewBaseUrl,
|
|
29
|
-
modelsSrc,
|
|
30
|
-
componentsSrc,
|
|
31
|
-
}: EmbeddableConfig) => {
|
|
32
|
-
core: {
|
|
33
|
-
rootDir: string;
|
|
34
|
-
templatesDir: string;
|
|
35
|
-
configsDir: string;
|
|
36
|
-
};
|
|
37
|
-
client: {
|
|
38
|
-
rootDir: string;
|
|
39
|
-
srcDir: string;
|
|
40
|
-
modelsSrc: string | undefined;
|
|
41
|
-
buildDir: string;
|
|
42
|
-
tmpDir: string;
|
|
43
|
-
componentDir: string;
|
|
44
|
-
stencilBuild: string;
|
|
45
|
-
archiveFile: string;
|
|
46
|
-
errorFallbackComponent: string | undefined;
|
|
47
|
-
};
|
|
48
|
-
outputOptions: {
|
|
49
|
-
typesEntryPointFilename: string;
|
|
50
|
-
};
|
|
51
|
-
pushBaseUrl: string;
|
|
52
|
-
audienceUrl: string;
|
|
53
|
-
previewBaseUrl: string;
|
|
54
|
-
authDomain: string;
|
|
55
|
-
authClientId: string;
|
|
56
|
-
applicationEnvironment: string;
|
|
57
|
-
rollbarAccessToken: string;
|
|
58
|
-
plugins: (() => {
|
|
59
|
-
pluginName: string;
|
|
60
|
-
build: (config: EmbeddableConfig) => Promise<unknown>;
|
|
61
|
-
cleanup: (config: EmbeddableConfig) => Promise<unknown>;
|
|
62
|
-
validate: (config: EmbeddableConfig) => Promise<unknown>;
|
|
63
|
-
})[];
|
|
64
|
-
};
|
|
65
|
-
export default _default;
|
package/lib/src/dev.d.ts
DELETED
package/lib/src/generate.d.ts
DELETED
package/lib/src/index.d.ts
DELETED
package/lib/src/login.d.ts
DELETED
package/lib/src/prepare.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/src/push.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export declare const YAML_OR_JS_FILES: RegExp;
|
|
2
|
-
declare const _default: () => Promise<void>;
|
|
3
|
-
export default _default;
|
|
4
|
-
export declare function archive(
|
|
5
|
-
ctx: any,
|
|
6
|
-
yamlFiles: [string, string][],
|
|
7
|
-
includeBuild?: boolean,
|
|
8
|
-
): Promise<unknown>;
|
|
9
|
-
export declare function sendBuildByApiKey(
|
|
10
|
-
ctx: any,
|
|
11
|
-
{ apiKey, email, message }: any,
|
|
12
|
-
): Promise<{
|
|
13
|
-
bundleId: any;
|
|
14
|
-
email: any;
|
|
15
|
-
message: any;
|
|
16
|
-
}>;
|
|
17
|
-
export declare function sendBuild(
|
|
18
|
-
ctx: any,
|
|
19
|
-
{
|
|
20
|
-
workspaceId,
|
|
21
|
-
token,
|
|
22
|
-
}: {
|
|
23
|
-
workspaceId: string;
|
|
24
|
-
token: string;
|
|
25
|
-
},
|
|
26
|
-
): Promise<void>;
|
package/lib/src/utils.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export declare const checkNodeVersion: () => Promise<boolean>;
|
|
2
|
-
/**
|
|
3
|
-
* Get the value of a process argument by key
|
|
4
|
-
* Example: getArgumentByKey("--email") or getArgumentByKey(["--email", "-e"])
|
|
5
|
-
* @param key The key to search for in the process arguments
|
|
6
|
-
* @returns
|
|
7
|
-
*/
|
|
8
|
-
export declare const getArgumentByKey: (
|
|
9
|
-
key: string | string[],
|
|
10
|
-
) => string | undefined;
|
|
11
|
-
export declare const SUCCESS_FLAG_FILE: string;
|
|
12
|
-
/**
|
|
13
|
-
* Store a flag in the credentials directory to indicate a successful build
|
|
14
|
-
* This is used to determine if the build was successful or not
|
|
15
|
-
*/
|
|
16
|
-
export declare const storeBuildSuccessFlag: () => Promise<void>;
|
|
17
|
-
/**
|
|
18
|
-
* Remove the success flag from the credentials directory
|
|
19
|
-
*/
|
|
20
|
-
export declare const removeBuildSuccessFlag: () => Promise<void>;
|
|
21
|
-
/**
|
|
22
|
-
* Check if the build was successful
|
|
23
|
-
*/
|
|
24
|
-
export declare const checkBuildSuccess: () => Promise<boolean>;
|
|
25
|
-
export declare const getPackageVersion: (packageName: string) => any;
|
package/lib/src/utils.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/src/validate.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
declare const _default: (ctx: any, exitIfInvalid?: boolean) => Promise<boolean>;
|
|
2
|
-
export default _default;
|
|
3
|
-
export declare function dataModelsValidation(
|
|
4
|
-
filesList: [string, string][],
|
|
5
|
-
): Promise<string[]>;
|
|
6
|
-
export declare function securityContextValidation(
|
|
7
|
-
filesList: [string, string][],
|
|
8
|
-
): Promise<string[]>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|