graphlit-client 1.0.20250529001 → 1.0.20250531001
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.d.ts +2 -1
- package/dist/client.js +10 -3
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
@@ -7,8 +7,9 @@ declare class Graphlit {
|
|
7
7
|
private organizationId;
|
8
8
|
private environmentId;
|
9
9
|
private ownerId;
|
10
|
+
private userId;
|
10
11
|
private jwtSecret;
|
11
|
-
constructor(organizationId?: string, environmentId?: string, jwtSecret?: string, ownerId?: string, apiUri?: string);
|
12
|
+
constructor(organizationId?: string, environmentId?: string, jwtSecret?: string, ownerId?: string, userId?: string, apiUri?: string);
|
12
13
|
refreshClient(): void;
|
13
14
|
private generateToken;
|
14
15
|
getProject(): Promise<Types.GetProjectQuery>;
|
package/dist/client.js
CHANGED
@@ -49,7 +49,7 @@ const Documents = __importStar(require("./generated/graphql-documents.js"));
|
|
49
49
|
const dotenv = __importStar(require("dotenv"));
|
50
50
|
// Define the Graphlit class
|
51
51
|
class Graphlit {
|
52
|
-
constructor(organizationId, environmentId, jwtSecret, ownerId, apiUri) {
|
52
|
+
constructor(organizationId, environmentId, jwtSecret, ownerId, userId, apiUri) {
|
53
53
|
this.apiUri = apiUri || "https://data-scus.graphlit.io/api/v1/graphql";
|
54
54
|
if (typeof process !== "undefined") {
|
55
55
|
dotenv.config();
|
@@ -59,6 +59,7 @@ class Graphlit {
|
|
59
59
|
this.jwtSecret = jwtSecret || process.env.GRAPHLIT_JWT_SECRET;
|
60
60
|
// optional: for multi-tenant support
|
61
61
|
this.ownerId = ownerId || process.env.GRAPHLIT_OWNER_ID;
|
62
|
+
this.userId = userId || process.env.GRAPHLIT_USER_ID;
|
62
63
|
}
|
63
64
|
else {
|
64
65
|
this.organizationId = organizationId;
|
@@ -66,6 +67,7 @@ class Graphlit {
|
|
66
67
|
this.jwtSecret = jwtSecret;
|
67
68
|
// optional: for multi-tenant support
|
68
69
|
this.ownerId = ownerId;
|
70
|
+
this.userId = userId;
|
69
71
|
}
|
70
72
|
if (!this.organizationId) {
|
71
73
|
throw new Error("Graphlit organization identifier is required.");
|
@@ -117,7 +119,7 @@ class Graphlit {
|
|
117
119
|
}
|
118
120
|
const expiration = Math.floor(Date.now() / 1000) + 24 * 60 * 60; // one day from now
|
119
121
|
const payload = {
|
120
|
-
"https://graphlit.io/jwt/claims": Object.assign(Object.assign({ "x-graphlit-organization-id": this.organizationId, "x-graphlit-environment-id": this.environmentId }, (this.ownerId && { "x-graphlit-owner-id": this.ownerId })), { "x-graphlit-role": "Owner" }),
|
122
|
+
"https://graphlit.io/jwt/claims": Object.assign(Object.assign(Object.assign({ "x-graphlit-organization-id": this.organizationId, "x-graphlit-environment-id": this.environmentId }, (this.ownerId && { "x-graphlit-owner-id": this.ownerId })), (this.userId && { "x-graphlit-user-id": this.userId })), { "x-graphlit-role": "Owner" }),
|
121
123
|
exp: expiration,
|
122
124
|
iss: "graphlit",
|
123
125
|
aud: "https://portal.graphlit.io",
|
@@ -533,7 +535,12 @@ class Graphlit {
|
|
533
535
|
}
|
534
536
|
queryContentsGraph(filter) {
|
535
537
|
return __awaiter(this, void 0, void 0, function* () {
|
536
|
-
return this.queryAndCheckError(Documents.QueryContentsGraph, {
|
538
|
+
return this.queryAndCheckError(Documents.QueryContentsGraph, {
|
539
|
+
filter: filter,
|
540
|
+
graph: {
|
541
|
+
/* return everything */
|
542
|
+
},
|
543
|
+
});
|
537
544
|
});
|
538
545
|
}
|
539
546
|
countContents(filter) {
|