graphlit-client 1.0.20240418009 → 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.
Files changed (2) hide show
  1. package/dist/client.js +15 -7
  2. package/package.json +1 -1
package/dist/client.js CHANGED
@@ -37,17 +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
- dotenv.config();
42
40
  // Define the Graphlit class
43
41
  class Graphlit {
44
42
  constructor(organizationId, environmentId, jwtSecret, ownerId, apiUri, correlationId) {
45
43
  this.apiUri = apiUri || "https://data-scus.graphlit.io/api/v1";
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;
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
+ }
51
59
  // optional: for billing correlation of multiple operations
52
60
  this.correlationId = correlationId || undefined;
53
61
  if (!this.organizationId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphlit-client",
3
- "version": "1.0.20240418009",
3
+ "version": "1.0.20240418011",
4
4
  "description": "Graphlit API TypeScript Client",
5
5
  "main": "dist/client.js",
6
6
  "types": "dist/client.d.ts",