@granular-software/sdk 0.3.4 → 0.4.1

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.
@@ -5,13 +5,19 @@
5
5
  /**
6
6
  * Configuration for the Granular client
7
7
  */
8
+ type AccessTokenProvider = () => Promise<string | null | undefined> | string | null | undefined;
9
+ type EndpointMode = 'auto' | 'local' | 'production';
8
10
  interface GranularOptions {
9
11
  /** Your Granular API key (for service/CLI auth; use with GRANULAR_API_KEY) */
10
12
  apiKey?: string;
11
13
  /** Application/session JWT (for user-context auth; use from simulator or getAccessToken) */
12
14
  token?: string;
15
+ /** Optional provider used to refresh JWT before WebSocket (re)connect attempts */
16
+ tokenProvider?: AccessTokenProvider;
13
17
  /** Optional API URL (for on-prem or testing) */
14
18
  apiUrl?: string;
19
+ /** Optional endpoint mode when apiUrl is not explicitly provided */
20
+ endpointMode?: EndpointMode;
15
21
  /** Optional WebSocket constructor (for Node.js environments) */
16
22
  WebSocketCtor?: any;
17
23
  /**
@@ -429,6 +435,7 @@ interface WSClientOptions {
429
435
  url: string;
430
436
  sessionId: string;
431
437
  token: string;
438
+ tokenProvider?: AccessTokenProvider;
432
439
  WebSocketCtor?: any;
433
440
  onUnexpectedClose?: (info: WSDisconnectInfo) => void;
434
441
  onReconnectError?: (info: WSReconnectErrorInfo) => void;
@@ -662,4 +669,4 @@ interface DeleteResponse {
662
669
  deleted: boolean;
663
670
  }
664
671
 
665
- export type { ManifestPropertySpec as $, AssignmentListResponse as A, BuildPolicy as B, ConnectOptions as C, DomainState as D, EnvironmentData as E, BuildListResponse as F, GranularOptions as G, JobStatus as H, InstanceToolHandler as I, Job as J, JobSubmitResult as K, Prompt as L, ModelRef as M, WSDisconnectInfo as N, WSReconnectErrorInfo as O, PublishToolsResult as P, RPCRequest as Q, RecordUserOptions as R, SandboxListResponse as S, ToolWithHandler as T, User as U, RPCResponse as V, WSClientOptions as W, SyncMessage as X, RPCRequestFromServer as Y, ToolInvokeParams as Z, ToolResultParams as _, ToolHandler as a, ManifestRelationshipDef as a0, ManifestOperation as a1, ManifestImport as a2, ManifestVolume as a3, APIError as a4, ToolInfo as b, ToolsChangedEvent as c, GraphQLResult as d, DefineRelationshipOptions as e, RelationshipInfo as f, ManifestContent as g, RecordObjectOptions as h, RecordObjectResult as i, Sandbox as j, CreateSandboxData as k, DeleteResponse as l, PermissionProfile as m, CreatePermissionProfileData as n, CreateEnvironmentData as o, Subject as p, ToolSchema as q, GranularAuth as r, PermissionRules as s, PermissionProfileListResponse as t, Assignment as u, EnvironmentListResponse as v, Manifest as w, ManifestListResponse as x, BuildStatus as y, Build as z };
672
+ export type { ToolInvokeParams as $, AssignmentListResponse as A, BuildPolicy as B, ConnectOptions as C, DomainState as D, EnvironmentData as E, BuildStatus as F, GranularOptions as G, Build as H, InstanceToolHandler as I, Job as J, BuildListResponse as K, JobStatus as L, ModelRef as M, JobSubmitResult as N, Prompt as O, PublishToolsResult as P, WSDisconnectInfo as Q, RecordUserOptions as R, SandboxListResponse as S, ToolWithHandler as T, User as U, WSReconnectErrorInfo as V, WSClientOptions as W, RPCRequest as X, RPCResponse as Y, SyncMessage as Z, RPCRequestFromServer as _, ToolHandler as a, ToolResultParams as a0, ManifestPropertySpec as a1, ManifestRelationshipDef as a2, ManifestOperation as a3, ManifestImport as a4, ManifestVolume as a5, APIError as a6, ToolInfo as b, ToolsChangedEvent as c, GraphQLResult as d, DefineRelationshipOptions as e, RelationshipInfo as f, ManifestContent as g, RecordObjectOptions as h, RecordObjectResult as i, Sandbox as j, CreateSandboxData as k, DeleteResponse as l, PermissionProfile as m, CreatePermissionProfileData as n, CreateEnvironmentData as o, Subject as p, ToolSchema as q, AccessTokenProvider as r, EndpointMode as s, GranularAuth as t, PermissionRules as u, PermissionProfileListResponse as v, Assignment as w, EnvironmentListResponse as x, Manifest as y, ManifestListResponse as z };
@@ -5,13 +5,19 @@
5
5
  /**
6
6
  * Configuration for the Granular client
7
7
  */
8
+ type AccessTokenProvider = () => Promise<string | null | undefined> | string | null | undefined;
9
+ type EndpointMode = 'auto' | 'local' | 'production';
8
10
  interface GranularOptions {
9
11
  /** Your Granular API key (for service/CLI auth; use with GRANULAR_API_KEY) */
10
12
  apiKey?: string;
11
13
  /** Application/session JWT (for user-context auth; use from simulator or getAccessToken) */
12
14
  token?: string;
15
+ /** Optional provider used to refresh JWT before WebSocket (re)connect attempts */
16
+ tokenProvider?: AccessTokenProvider;
13
17
  /** Optional API URL (for on-prem or testing) */
14
18
  apiUrl?: string;
19
+ /** Optional endpoint mode when apiUrl is not explicitly provided */
20
+ endpointMode?: EndpointMode;
15
21
  /** Optional WebSocket constructor (for Node.js environments) */
16
22
  WebSocketCtor?: any;
17
23
  /**
@@ -429,6 +435,7 @@ interface WSClientOptions {
429
435
  url: string;
430
436
  sessionId: string;
431
437
  token: string;
438
+ tokenProvider?: AccessTokenProvider;
432
439
  WebSocketCtor?: any;
433
440
  onUnexpectedClose?: (info: WSDisconnectInfo) => void;
434
441
  onReconnectError?: (info: WSReconnectErrorInfo) => void;
@@ -662,4 +669,4 @@ interface DeleteResponse {
662
669
  deleted: boolean;
663
670
  }
664
671
 
665
- export type { ManifestPropertySpec as $, AssignmentListResponse as A, BuildPolicy as B, ConnectOptions as C, DomainState as D, EnvironmentData as E, BuildListResponse as F, GranularOptions as G, JobStatus as H, InstanceToolHandler as I, Job as J, JobSubmitResult as K, Prompt as L, ModelRef as M, WSDisconnectInfo as N, WSReconnectErrorInfo as O, PublishToolsResult as P, RPCRequest as Q, RecordUserOptions as R, SandboxListResponse as S, ToolWithHandler as T, User as U, RPCResponse as V, WSClientOptions as W, SyncMessage as X, RPCRequestFromServer as Y, ToolInvokeParams as Z, ToolResultParams as _, ToolHandler as a, ManifestRelationshipDef as a0, ManifestOperation as a1, ManifestImport as a2, ManifestVolume as a3, APIError as a4, ToolInfo as b, ToolsChangedEvent as c, GraphQLResult as d, DefineRelationshipOptions as e, RelationshipInfo as f, ManifestContent as g, RecordObjectOptions as h, RecordObjectResult as i, Sandbox as j, CreateSandboxData as k, DeleteResponse as l, PermissionProfile as m, CreatePermissionProfileData as n, CreateEnvironmentData as o, Subject as p, ToolSchema as q, GranularAuth as r, PermissionRules as s, PermissionProfileListResponse as t, Assignment as u, EnvironmentListResponse as v, Manifest as w, ManifestListResponse as x, BuildStatus as y, Build as z };
672
+ export type { ToolInvokeParams as $, AssignmentListResponse as A, BuildPolicy as B, ConnectOptions as C, DomainState as D, EnvironmentData as E, BuildStatus as F, GranularOptions as G, Build as H, InstanceToolHandler as I, Job as J, BuildListResponse as K, JobStatus as L, ModelRef as M, JobSubmitResult as N, Prompt as O, PublishToolsResult as P, WSDisconnectInfo as Q, RecordUserOptions as R, SandboxListResponse as S, ToolWithHandler as T, User as U, WSReconnectErrorInfo as V, WSClientOptions as W, RPCRequest as X, RPCResponse as Y, SyncMessage as Z, RPCRequestFromServer as _, ToolHandler as a, ToolResultParams as a0, ManifestPropertySpec as a1, ManifestRelationshipDef as a2, ManifestOperation as a3, ManifestImport as a4, ManifestVolume as a5, APIError as a6, ToolInfo as b, ToolsChangedEvent as c, GraphQLResult as d, DefineRelationshipOptions as e, RelationshipInfo as f, ManifestContent as g, RecordObjectOptions as h, RecordObjectResult as i, Sandbox as j, CreateSandboxData as k, DeleteResponse as l, PermissionProfile as m, CreatePermissionProfileData as n, CreateEnvironmentData as o, Subject as p, ToolSchema as q, AccessTokenProvider as r, EndpointMode as s, GranularAuth as t, PermissionRules as u, PermissionProfileListResponse as v, Assignment as w, EnvironmentListResponse as x, Manifest as y, ManifestListResponse as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@granular-software/sdk",
3
- "version": "0.3.4",
3
+ "version": "0.4.1",
4
4
  "description": "TypeScript SDK and CLI for Granular - define, build, and deploy AI sandboxes",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",