@embeddable.com/sdk-core 3.14.7-next.4 → 3.14.7-next.5
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.esm.js +14 -7
- package/lib/index.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/dev.test.ts +25 -0
- package/src/dev.ts +15 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embeddable.com/sdk-core",
|
|
3
|
-
"version": "3.14.7-next.
|
|
3
|
+
"version": "3.14.7-next.5",
|
|
4
4
|
"description": "Core Embeddable SDK module responsible for web-components bundling and publishing.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"embeddable",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"license": "MIT",
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@embeddable.com/core": "2.10.5-next.
|
|
43
|
+
"@embeddable.com/core": "2.10.5-next.2",
|
|
44
44
|
"@embeddable.com/sdk-utils": "0.8.1-next.2",
|
|
45
45
|
"@inquirer/prompts": "^7.2.1",
|
|
46
46
|
"@stencil/core": "^4.23.0",
|
package/src/dev.test.ts
CHANGED
|
@@ -391,6 +391,31 @@ describe("dev command", () => {
|
|
|
391
391
|
});
|
|
392
392
|
});
|
|
393
393
|
|
|
394
|
+
describe("sendBuildChanges error handling", () => {
|
|
395
|
+
it("should handle errors during build sending", async () => {
|
|
396
|
+
const mockWss = {
|
|
397
|
+
clients: [{ send: vi.fn() }],
|
|
398
|
+
on: vi.fn(),
|
|
399
|
+
close: vi.fn(),
|
|
400
|
+
};
|
|
401
|
+
vi.mocked(WebSocketServer).mockImplementation(() => mockWss as any);
|
|
402
|
+
vi.mocked(validate).mockResolvedValue(true);
|
|
403
|
+
const error = new Error("Archive failed");
|
|
404
|
+
vi.mocked(archive).mockRejectedValue(error);
|
|
405
|
+
|
|
406
|
+
await dev(); // To initialize wss
|
|
407
|
+
|
|
408
|
+
await sendBuildChanges(mockConfig as unknown as ResolvedEmbeddableConfig);
|
|
409
|
+
|
|
410
|
+
expect(ora().fail).toHaveBeenCalledWith(
|
|
411
|
+
`Data models and/or security context synchronization failed with error: ${error.message}`,
|
|
412
|
+
);
|
|
413
|
+
expect(mockWss.clients[0].send).toHaveBeenCalledWith(
|
|
414
|
+
JSON.stringify({ type: "dataModelsAndOrSecurityContextUpdateError" }),
|
|
415
|
+
);
|
|
416
|
+
});
|
|
417
|
+
});
|
|
418
|
+
|
|
394
419
|
describe("Plugin build coordination", () => {
|
|
395
420
|
it("should handle configs with no plugins when pushComponents is true", async () => {
|
|
396
421
|
vi.mocked(provideConfig).mockResolvedValue({
|
package/src/dev.ts
CHANGED
|
@@ -481,13 +481,21 @@ export const sendBuildChanges = async (ctx: ResolvedEmbeddableConfig) => {
|
|
|
481
481
|
filesList = [...filesList, ...cubeAndSecurityContextFileList];
|
|
482
482
|
}
|
|
483
483
|
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
484
|
+
try {
|
|
485
|
+
const token = await getToken();
|
|
486
|
+
await archive({
|
|
487
|
+
ctx,
|
|
488
|
+
filesList,
|
|
489
|
+
isDev: true,
|
|
490
|
+
});
|
|
491
|
+
await sendBuild(ctx, { workspaceId: previewWorkspace, token });
|
|
492
|
+
} catch (e: any) {
|
|
493
|
+
sending.fail(
|
|
494
|
+
`Data models and/or security context synchronization failed with error: ${e.response?.data?.errorMessage ?? e.message ?? 'Unknown error'}`
|
|
495
|
+
);
|
|
496
|
+
return sendMessage("dataModelsAndOrSecurityContextUpdateError");
|
|
497
|
+
}
|
|
498
|
+
|
|
491
499
|
sending.succeed(`Data models and/or security context synchronized`);
|
|
492
500
|
sendMessage("dataModelsAndOrSecurityContextUpdateSuccess");
|
|
493
501
|
};
|