@sigmacomputing/embed-sdk 0.1.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.mts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +45 -0
- package/dist/index.mjs +19 -0
- package/package.json +22 -0
package/dist/index.d.mts
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
interface WorkbookLoadedEvent {
|
2
|
+
type: "workbook:loaded";
|
3
|
+
workbook: {
|
4
|
+
variables: Record<string, string>;
|
5
|
+
};
|
6
|
+
}
|
7
|
+
interface WorkbookErrorEvent {
|
8
|
+
type: "workbook:error";
|
9
|
+
code: string;
|
10
|
+
message: string;
|
11
|
+
}
|
12
|
+
declare const workbookLoadedListener: (event: MessageEvent, iframe: HTMLIFrameElement, onLoaded: (event: WorkbookLoadedEvent) => void) => void;
|
13
|
+
declare const workbookErrorListener: (event: MessageEvent, iframe: HTMLIFrameElement, onError: (event: WorkbookErrorEvent) => void) => void;
|
14
|
+
|
15
|
+
export { type WorkbookErrorEvent, type WorkbookLoadedEvent, workbookErrorListener, workbookLoadedListener };
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
interface WorkbookLoadedEvent {
|
2
|
+
type: "workbook:loaded";
|
3
|
+
workbook: {
|
4
|
+
variables: Record<string, string>;
|
5
|
+
};
|
6
|
+
}
|
7
|
+
interface WorkbookErrorEvent {
|
8
|
+
type: "workbook:error";
|
9
|
+
code: string;
|
10
|
+
message: string;
|
11
|
+
}
|
12
|
+
declare const workbookLoadedListener: (event: MessageEvent, iframe: HTMLIFrameElement, onLoaded: (event: WorkbookLoadedEvent) => void) => void;
|
13
|
+
declare const workbookErrorListener: (event: MessageEvent, iframe: HTMLIFrameElement, onError: (event: WorkbookErrorEvent) => void) => void;
|
14
|
+
|
15
|
+
export { type WorkbookErrorEvent, type WorkbookLoadedEvent, workbookErrorListener, workbookLoadedListener };
|
package/dist/index.js
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
+
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
|
20
|
+
// src/index.ts
|
21
|
+
var src_exports = {};
|
22
|
+
__export(src_exports, {
|
23
|
+
workbookErrorListener: () => workbookErrorListener,
|
24
|
+
workbookLoadedListener: () => workbookLoadedListener
|
25
|
+
});
|
26
|
+
module.exports = __toCommonJS(src_exports);
|
27
|
+
var workbookLoadedListener = (event, iframe, onLoaded) => {
|
28
|
+
if (event.source === iframe.contentWindow && event.origin === "https://staging.sigmacomputing.io") {
|
29
|
+
if (event.data.type === "workbook:loaded") {
|
30
|
+
onLoaded(event.data);
|
31
|
+
}
|
32
|
+
}
|
33
|
+
};
|
34
|
+
var workbookErrorListener = (event, iframe, onError) => {
|
35
|
+
if (event.source === iframe.contentWindow && event.origin === "https://staging.sigmacomputing.io") {
|
36
|
+
if (event.data.type === "workbook:error") {
|
37
|
+
onError(event.data);
|
38
|
+
}
|
39
|
+
}
|
40
|
+
};
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
42
|
+
0 && (module.exports = {
|
43
|
+
workbookErrorListener,
|
44
|
+
workbookLoadedListener
|
45
|
+
});
|
package/dist/index.mjs
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
// src/index.ts
|
2
|
+
var workbookLoadedListener = (event, iframe, onLoaded) => {
|
3
|
+
if (event.source === iframe.contentWindow && event.origin === "https://staging.sigmacomputing.io") {
|
4
|
+
if (event.data.type === "workbook:loaded") {
|
5
|
+
onLoaded(event.data);
|
6
|
+
}
|
7
|
+
}
|
8
|
+
};
|
9
|
+
var workbookErrorListener = (event, iframe, onError) => {
|
10
|
+
if (event.source === iframe.contentWindow && event.origin === "https://staging.sigmacomputing.io") {
|
11
|
+
if (event.data.type === "workbook:error") {
|
12
|
+
onError(event.data);
|
13
|
+
}
|
14
|
+
}
|
15
|
+
};
|
16
|
+
export {
|
17
|
+
workbookErrorListener,
|
18
|
+
workbookLoadedListener
|
19
|
+
};
|
package/package.json
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
{
|
2
|
+
"name": "@sigmacomputing/embed-sdk",
|
3
|
+
"version": "0.1.0",
|
4
|
+
"description": "JavaScript SDK to interact with Sigma Computing's Embed API",
|
5
|
+
"scripts": {
|
6
|
+
"prepublish": "npm run build",
|
7
|
+
"build": "tsup",
|
8
|
+
"watch": "tsup --watch",
|
9
|
+
"typecheck": "tsc --noEmit",
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
11
|
+
},
|
12
|
+
"author": "sigmacomputing",
|
13
|
+
"license": "ISC",
|
14
|
+
"exports": {
|
15
|
+
"import": "./dist/index.mjs",
|
16
|
+
"require": "./dist/index.js",
|
17
|
+
"types": "./dist/index.d.ts"
|
18
|
+
},
|
19
|
+
"files": [
|
20
|
+
"dist"
|
21
|
+
]
|
22
|
+
}
|