graphlit-client 1.0.20250710001 → 1.0.20250711001
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
CHANGED
@@ -159,6 +159,7 @@ declare class Graphlit {
|
|
159
159
|
publishText(text: string, textType: Types.TextTypes, connector: Types.ContentPublishingConnectorInput, name?: string, workflow?: Types.EntityReferenceInput, isSynchronous?: boolean, correlationId?: string): Promise<Types.PublishTextMutation>;
|
160
160
|
getContent(id: string): Promise<Types.GetContentQuery>;
|
161
161
|
lookupContents(ids: string[]): Promise<Types.LookupContentsResults>;
|
162
|
+
queryObservables(filter?: Types.ContentFilter): Promise<Types.QueryObservablesQuery>;
|
162
163
|
queryContents(filter?: Types.ContentFilter): Promise<Types.QueryContentsQuery>;
|
163
164
|
queryContentsObservations(filter?: Types.ContentFilter): Promise<Types.QueryContentsObservationsQuery>;
|
164
165
|
queryContentsFacets(filter?: Types.ContentFilter): Promise<Types.QueryContentsFacetsQuery>;
|
package/dist/client.js
CHANGED
@@ -111,6 +111,14 @@ catch (e) {
|
|
111
111
|
}
|
112
112
|
}
|
113
113
|
const DEFAULT_MAX_TOOL_ROUNDS = 1000;
|
114
|
+
// Helper function to validate GUID format
|
115
|
+
function isValidGuid(guid) {
|
116
|
+
if (!guid)
|
117
|
+
return false;
|
118
|
+
// GUID regex pattern: 8-4-4-4-12 hexadecimal characters
|
119
|
+
const guidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
120
|
+
return guidRegex.test(guid);
|
121
|
+
}
|
114
122
|
// Define the Graphlit class
|
115
123
|
class Graphlit {
|
116
124
|
client;
|
@@ -189,12 +197,25 @@ class Graphlit {
|
|
189
197
|
if (!this.organizationId) {
|
190
198
|
throw new Error("Graphlit organization identifier is required.");
|
191
199
|
}
|
200
|
+
if (!isValidGuid(this.organizationId)) {
|
201
|
+
throw new Error(`Invalid organization ID format. Expected a valid GUID, but received: '${this.organizationId}'. ` +
|
202
|
+
"A valid GUID should be in the format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
|
203
|
+
}
|
192
204
|
if (!this.environmentId) {
|
193
205
|
throw new Error("Graphlit environment identifier is required.");
|
194
206
|
}
|
207
|
+
if (!isValidGuid(this.environmentId)) {
|
208
|
+
throw new Error(`Invalid environment ID format. Expected a valid GUID, but received: '${this.environmentId}'. ` +
|
209
|
+
"A valid GUID should be in the format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
|
210
|
+
}
|
195
211
|
if (!this.jwtSecret) {
|
196
212
|
throw new Error("Graphlit environment JWT secret is required.");
|
197
213
|
}
|
214
|
+
// Validate optional userId if provided (ownerId can be any format)
|
215
|
+
if (this.userId && !isValidGuid(this.userId)) {
|
216
|
+
throw new Error(`Invalid user ID format. Expected a valid GUID, but received: '${this.userId}'. ` +
|
217
|
+
"A valid GUID should be in the format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
|
218
|
+
}
|
198
219
|
this.refreshClient();
|
199
220
|
}
|
200
221
|
refreshClient() {
|
@@ -697,6 +718,9 @@ class Graphlit {
|
|
697
718
|
async lookupContents(ids) {
|
698
719
|
return this.queryAndCheckError(Documents.LookupContents, { ids: ids });
|
699
720
|
}
|
721
|
+
async queryObservables(filter) {
|
722
|
+
return this.queryAndCheckError(Documents.QueryObservables, { filter: filter });
|
723
|
+
}
|
700
724
|
async queryContents(filter) {
|
701
725
|
return this.queryAndCheckError(Documents.QueryContents, { filter: filter });
|
702
726
|
}
|
@@ -57,6 +57,7 @@ export declare const QueryContents: import("graphql").DocumentNode;
|
|
57
57
|
export declare const QueryContentsFacets: import("graphql").DocumentNode;
|
58
58
|
export declare const QueryContentsGraph: import("graphql").DocumentNode;
|
59
59
|
export declare const QueryContentsObservations: import("graphql").DocumentNode;
|
60
|
+
export declare const QueryObservables: import("graphql").DocumentNode;
|
60
61
|
export declare const ScreenshotPage: import("graphql").DocumentNode;
|
61
62
|
export declare const SummarizeContents: import("graphql").DocumentNode;
|
62
63
|
export declare const SummarizeText: import("graphql").DocumentNode;
|
@@ -2999,6 +2999,19 @@ export const QueryContentsObservations = gql `
|
|
2999
2999
|
}
|
3000
3000
|
}
|
3001
3001
|
`;
|
3002
|
+
export const QueryObservables = gql `
|
3003
|
+
query QueryObservables($filter: ContentFilter, $correlationId: String) {
|
3004
|
+
observables(filter: $filter, correlationId: $correlationId) {
|
3005
|
+
results {
|
3006
|
+
type
|
3007
|
+
observable {
|
3008
|
+
id
|
3009
|
+
name
|
3010
|
+
}
|
3011
|
+
}
|
3012
|
+
}
|
3013
|
+
}
|
3014
|
+
`;
|
3002
3015
|
export const ScreenshotPage = gql `
|
3003
3016
|
mutation ScreenshotPage($uri: URL!, $maximumHeight: Int, $isSynchronous: Boolean, $workflow: EntityReferenceInput, $collections: [EntityReferenceInput!], $correlationId: String) {
|
3004
3017
|
screenshotPage(
|
@@ -9943,6 +9943,12 @@ export type ObservableFacet = {
|
|
9943
9943
|
/** The observed entity type. */
|
9944
9944
|
type?: Maybe<ObservableTypes>;
|
9945
9945
|
};
|
9946
|
+
/** Represents observable results. */
|
9947
|
+
export type ObservableResults = {
|
9948
|
+
__typename?: 'ObservableResults';
|
9949
|
+
/** The retrieved observables. */
|
9950
|
+
results?: Maybe<Array<Maybe<ObservationReference>>>;
|
9951
|
+
};
|
9946
9952
|
/** Observable type */
|
9947
9953
|
export declare enum ObservableTypes {
|
9948
9954
|
/** Category */
|
@@ -12099,6 +12105,8 @@ export type Query = {
|
|
12099
12105
|
notionDatabases?: Maybe<NotionDatabaseResults>;
|
12100
12106
|
/** Retrieves available Notion pages within Notion database, non-recursive. */
|
12101
12107
|
notionPages?: Maybe<NotionPageResults>;
|
12108
|
+
/** Retrieves observables from contents based on the provided filter criteria. */
|
12109
|
+
observables?: Maybe<ObservableResults>;
|
12102
12110
|
/** Lookup a observation given its ID. */
|
12103
12111
|
observation?: Maybe<Observation>;
|
12104
12112
|
/** Retrieves available OneDrive folders. */
|
@@ -12546,6 +12554,10 @@ export type QueryNotionPagesArgs = {
|
|
12546
12554
|
identifier: Scalars['String']['input'];
|
12547
12555
|
properties: NotionPagesInput;
|
12548
12556
|
};
|
12557
|
+
export type QueryObservablesArgs = {
|
12558
|
+
correlationId?: InputMaybe<Scalars['String']['input']>;
|
12559
|
+
filter?: InputMaybe<ContentFilter>;
|
12560
|
+
};
|
12549
12561
|
export type QueryObservationArgs = {
|
12550
12562
|
correlationId?: InputMaybe<Scalars['String']['input']>;
|
12551
12563
|
id: Scalars['ID']['input'];
|
@@ -18574,6 +18586,25 @@ export type QueryContentsObservationsQuery = {
|
|
18574
18586
|
} | null> | null;
|
18575
18587
|
} | null;
|
18576
18588
|
};
|
18589
|
+
export type QueryObservablesQueryVariables = Exact<{
|
18590
|
+
filter?: InputMaybe<ContentFilter>;
|
18591
|
+
correlationId?: InputMaybe<Scalars['String']['input']>;
|
18592
|
+
}>;
|
18593
|
+
export type QueryObservablesQuery = {
|
18594
|
+
__typename?: 'Query';
|
18595
|
+
observables?: {
|
18596
|
+
__typename?: 'ObservableResults';
|
18597
|
+
results?: Array<{
|
18598
|
+
__typename?: 'ObservationReference';
|
18599
|
+
type: ObservableTypes;
|
18600
|
+
observable: {
|
18601
|
+
__typename?: 'NamedEntityReference';
|
18602
|
+
id: string;
|
18603
|
+
name?: string | null;
|
18604
|
+
};
|
18605
|
+
} | null> | null;
|
18606
|
+
} | null;
|
18607
|
+
};
|
18577
18608
|
export type ScreenshotPageMutationVariables = Exact<{
|
18578
18609
|
uri: Scalars['URL']['input'];
|
18579
18610
|
maximumHeight?: InputMaybe<Scalars['Int']['input']>;
|