graphlit-client 1.0.20240418010 → 1.0.20240418011
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/client.js +15 -9
- package/package.json +1 -1
package/dist/client.js
CHANGED
@@ -37,19 +37,25 @@ const jose_1 = require("jose");
|
|
37
37
|
const core_1 = require("@apollo/client/core");
|
38
38
|
const Documents = __importStar(require("./generated/graphql-documents"));
|
39
39
|
const dotenv = __importStar(require("dotenv"));
|
40
|
-
// Initialize dotenv to use environment variables
|
41
|
-
if (process)
|
42
|
-
dotenv.config();
|
43
40
|
// Define the Graphlit class
|
44
41
|
class Graphlit {
|
45
42
|
constructor(organizationId, environmentId, jwtSecret, ownerId, apiUri, correlationId) {
|
46
|
-
var _a, _b, _c, _d;
|
47
43
|
this.apiUri = apiUri || "https://data-scus.graphlit.io/api/v1";
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
44
|
+
if (typeof process !== 'undefined') {
|
45
|
+
dotenv.config();
|
46
|
+
this.organizationId = organizationId || process.env.GRAPHLIT_ORGANIZATION_ID;
|
47
|
+
this.environmentId = environmentId || process.env.GRAPHLIT_ENVIRONMENT_ID;
|
48
|
+
this.jwtSecret = jwtSecret || process.env.GRAPHLIT_JWT_SECRET;
|
49
|
+
// optional: for multi-tenant support
|
50
|
+
this.ownerId = ownerId || process.env.GRAPHLIT_OWNER_ID;
|
51
|
+
}
|
52
|
+
else {
|
53
|
+
this.organizationId = organizationId;
|
54
|
+
this.environmentId = environmentId;
|
55
|
+
this.jwtSecret = jwtSecret;
|
56
|
+
// optional: for multi-tenant support
|
57
|
+
this.ownerId = ownerId;
|
58
|
+
}
|
53
59
|
// optional: for billing correlation of multiple operations
|
54
60
|
this.correlationId = correlationId || undefined;
|
55
61
|
if (!this.organizationId) {
|