@octostar/platform-api 0.5.30 → 0.5.32
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/apis.d.ts +12 -0
- package/dist/apis.d.ts.map +1 -1
- package/dist/apis.js +7 -1
- package/dist/apis.js.map +1 -1
- package/dist/factory.d.ts +127 -0
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +445 -137
- package/dist/factory.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/RemoteDevManager.d.ts +79 -0
- package/dist/lib/RemoteDevManager.d.ts.map +1 -0
- package/dist/lib/RemoteDevManager.js +218 -0
- package/dist/lib/RemoteDevManager.js.map +1 -0
- package/dist/octostar-platform-api.js +854 -190
- package/dist/utils.js +3 -3
- package/dist/utils.js.map +1 -1
- package/package.json +4 -4
package/dist/apis.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Desktop, Ontology, ExtrasApi, RemoteAppApi, SavedSearchAPIInterface } from '@octostar/platform-types';
|
|
2
|
+
import { getOctostarConnectionManager, type OctostarConnectionManager } from './factory';
|
|
2
3
|
import type { ContextApi, EnsureMethodsReturnPromise } from './types';
|
|
3
4
|
/**
|
|
4
5
|
* @beta
|
|
@@ -36,4 +37,15 @@ export declare const getOntologyApi: () => Promise<EnsureMethodsReturnPromise<On
|
|
|
36
37
|
* Get the context API asynchronously.
|
|
37
38
|
*/
|
|
38
39
|
export declare const getContextApi: () => Promise<EnsureMethodsReturnPromise<ContextApi<unknown>>>;
|
|
40
|
+
/**
|
|
41
|
+
* @beta
|
|
42
|
+
* Gets the singleton instance of OctostarConnectionManager.
|
|
43
|
+
* This is the primary way to access connection management functionality.
|
|
44
|
+
*/
|
|
45
|
+
export { getOctostarConnectionManager };
|
|
46
|
+
/**
|
|
47
|
+
* @beta
|
|
48
|
+
* Type for OctostarConnectionManager class.
|
|
49
|
+
*/
|
|
50
|
+
export type { OctostarConnectionManager };
|
|
39
51
|
//# sourceMappingURL=apis.d.ts.map
|
package/dist/apis.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apis.d.ts","sourceRoot":"","sources":["../src/apis.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"apis.d.ts","sourceRoot":"","sources":["../src/apis.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAEpH,OAAO,EAGL,4BAA4B,EAC5B,KAAK,yBAAyB,EAC/B,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,UAAU,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAsCtE;;;;GAIG;AACH,eAAO,MAAM,UAAU,2CAAsE,CAAC;AAE9F,eAAO,MAAM,SAAS,6CAAqE,CAAC;AAE5F,eAAO,MAAM,YAAY,gDAAwE,CAAC;AAElG,eAAO,MAAM,cAAc,2DAA0E,CAAC;AAEtG;;;;GAIG;AACH,eAAO,MAAM,WAAW,4CAAuE,CAAC;AAEhG;;;;GAIG;AACH,eAAO,MAAM,UAAU,uDAAsE,CAAC;AAE9F;;;GAGG;AACH,eAAO,MAAM,aAAa,oDAA2D,CAAC;AAEtF;;;GAGG;AACH,eAAO,MAAM,cAAc,qDAA6D,CAAC;AAEzF;;;GAGG;AACH,eAAO,MAAM,aAAa,gEAA2D,CAAC;AAEtF;;;;GAIG;AACH,OAAO,EAAE,4BAA4B,EAAE,CAAC;AAExC;;;GAGG;AACH,YAAY,EAAE,yBAAyB,EAAE,CAAC"}
|
package/dist/apis.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AsyncServiceLocator } from './lib/AsyncServiceLocator';
|
|
2
|
-
import { forwardCallsToFutureObject, createRemoteApiHandle } from './factory';
|
|
2
|
+
import { forwardCallsToFutureObject, createRemoteApiHandle, getOctostarConnectionManager, } from './factory';
|
|
3
3
|
import { apiNames } from './constants';
|
|
4
4
|
const apisLocator = AsyncServiceLocator.getInstance('platform-api', {
|
|
5
5
|
cache: false,
|
|
@@ -60,4 +60,10 @@ export const getOntologyApi = async () => apisLocator.getService('ontology');
|
|
|
60
60
|
* Get the context API asynchronously.
|
|
61
61
|
*/
|
|
62
62
|
export const getContextApi = async () => apisLocator.getService('context');
|
|
63
|
+
/**
|
|
64
|
+
* @beta
|
|
65
|
+
* Gets the singleton instance of OctostarConnectionManager.
|
|
66
|
+
* This is the primary way to access connection management functionality.
|
|
67
|
+
*/
|
|
68
|
+
export { getOctostarConnectionManager };
|
|
63
69
|
//# sourceMappingURL=apis.js.map
|
package/dist/apis.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apis.js","sourceRoot":"","sources":["../src/apis.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,
|
|
1
|
+
{"version":3,"file":"apis.js","sourceRoot":"","sources":["../src/apis.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,EACrB,4BAA4B,GAE7B,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,WAAW,GAAG,mBAAmB,CAAC,WAAW,CAAC,cAAc,EAAE;IAClE,KAAK,EAAE,KAAK;CACb,CAAC;KACC,eAAe,CAAC,SAAS,EAAE,GAAG,EAAE,CAC/B,qBAAqB,CAAsC;IACzD,IAAI,EAAE,QAAQ,CAAC,OAAO;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AAC,CAAC,CAAC;AAEhG;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,0BAA0B,CAAC,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;AAE9F;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,IAAI,EAAE,CAAC,WAAW,CAAC,UAAU,CAAY,SAAS,CAAC,CAAC;AAEtF;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,IAAI,EAAE,CAAC,WAAW,CAAC,UAAU,CAAa,UAAU,CAAC,CAAC;AAEzF;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,IAAI,EAAE,CAAC,WAAW,CAAC,UAAU,CAAY,SAAS,CAAC,CAAC;AAEtF;;;;GAIG;AACH,OAAO,EAAE,4BAA4B,EAAE,CAAC"}
|
package/dist/factory.d.ts
CHANGED
|
@@ -1,4 +1,131 @@
|
|
|
1
1
|
import type { GetRemoteApiParams } from './types';
|
|
2
|
+
type ChannelIdChangeCallback = (channelId: string) => void;
|
|
3
|
+
/**
|
|
4
|
+
* Manages Octostar connection state, including remote dev mode, channel IDs, window references,
|
|
5
|
+
* and connection lifecycle. This is a singleton class accessed via getOctostarConnectionManager().
|
|
6
|
+
*/
|
|
7
|
+
export declare class OctostarConnectionManager {
|
|
8
|
+
private resolvedMode;
|
|
9
|
+
private remoteDevWindow;
|
|
10
|
+
private channelIdSubscribers;
|
|
11
|
+
private hasParent;
|
|
12
|
+
private getParentOctostarWindow;
|
|
13
|
+
private tryFetchingFromAttributes;
|
|
14
|
+
private traverseForChannelId;
|
|
15
|
+
private clearConnectionHistory;
|
|
16
|
+
private notifyChannelIdChanged;
|
|
17
|
+
private handlePostResponse;
|
|
18
|
+
private createObjectProxy;
|
|
19
|
+
/**
|
|
20
|
+
* Sets the remote dev window reference.
|
|
21
|
+
* This should be called when opening a remote dev window from a React component.
|
|
22
|
+
*/
|
|
23
|
+
setWindow(window: Window | null): void;
|
|
24
|
+
/**
|
|
25
|
+
* Gets the remote dev window reference.
|
|
26
|
+
*/
|
|
27
|
+
getWindow(): Window | null;
|
|
28
|
+
/**
|
|
29
|
+
* Gets or creates a remote dev channel ID.
|
|
30
|
+
* If a channel ID already exists in sessionStorage, returns it.
|
|
31
|
+
* Otherwise, generates a new one and stores it.
|
|
32
|
+
*/
|
|
33
|
+
getOrCreateChannelId(): string;
|
|
34
|
+
/**
|
|
35
|
+
* Checks if a remote dev channel ID exists without creating one.
|
|
36
|
+
* Used to determine if a connection attempt has been made.
|
|
37
|
+
*/
|
|
38
|
+
hasChannelId(): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Subscribe to remote dev channel ID changes.
|
|
41
|
+
* Returns an unsubscribe function.
|
|
42
|
+
*/
|
|
43
|
+
onChannelIdChanged(callback: ChannelIdChangeCallback): () => void;
|
|
44
|
+
/**
|
|
45
|
+
* Marks that a successful remote dev connection was established.
|
|
46
|
+
* This is called when a connection is successfully made (e.g., ping succeeds).
|
|
47
|
+
*/
|
|
48
|
+
markConnectionSuccess(): void;
|
|
49
|
+
/**
|
|
50
|
+
* Marks whether the remote dev connection was intentionally disconnected.
|
|
51
|
+
* @param intentionallyDisconnected - true if user clicked Disconnect/Reset, false if user is trying to connect
|
|
52
|
+
*/
|
|
53
|
+
markIntentionallyDisconnected(intentionallyDisconnected: boolean): void;
|
|
54
|
+
/**
|
|
55
|
+
* Returns whether a successful remote dev connection was ever established in this session.
|
|
56
|
+
* This persists across component remounts and page refreshes (within the same session).
|
|
57
|
+
* Only returns true if a channel ID exists (fixes initial load bug).
|
|
58
|
+
*/
|
|
59
|
+
wasEverConnected(): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Returns whether the remote dev connection was intentionally disconnected.
|
|
62
|
+
* This is used to determine whether to show "Connect" vs "Reconnect" button.
|
|
63
|
+
*/
|
|
64
|
+
wasIntentionallyDisconnected(): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Gets the remote dev URL from sessionStorage.
|
|
67
|
+
* Returns empty string if not set.
|
|
68
|
+
*/
|
|
69
|
+
getUrl(): string;
|
|
70
|
+
/**
|
|
71
|
+
* Sets the remote dev URL in sessionStorage.
|
|
72
|
+
*/
|
|
73
|
+
setUrl(url: string): void;
|
|
74
|
+
/**
|
|
75
|
+
* Returns true when the app is not in connected iframe mode (no octostarChannelId found in URL or
|
|
76
|
+
* iframe chain), i.e. running in remote dev mode. Returns false when running inside an Octostar
|
|
77
|
+
* iframe (embedded).
|
|
78
|
+
*/
|
|
79
|
+
isRemoteDevMode(): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Clears resolvedMode if the channel ID has changed.
|
|
82
|
+
* This is called when SET_CHANNEL_ID message is received to ensure
|
|
83
|
+
* createRemoteApiHandle re-resolves with the new channel ID.
|
|
84
|
+
* @param newChannelId - The new channel ID that was set
|
|
85
|
+
*/
|
|
86
|
+
clearResolvedModeIfChannelChanged(newChannelId: string): void;
|
|
87
|
+
/**
|
|
88
|
+
* Resets the remote dev connection state.
|
|
89
|
+
* This clears the resolved mode and window reference, allowing the connection to be re-established.
|
|
90
|
+
* Should be called when connection is lost and user wants to reconnect.
|
|
91
|
+
*/
|
|
92
|
+
resetConnection(): void;
|
|
93
|
+
/**
|
|
94
|
+
* Resets remote dev mode by closing the window and clearing all connection state.
|
|
95
|
+
* This puts the app back into a disconnected startup state.
|
|
96
|
+
* A new channel ID will be generated automatically when the user clicks Connect.
|
|
97
|
+
*/
|
|
98
|
+
resetMode(): void;
|
|
99
|
+
/**
|
|
100
|
+
* Opens a remote dev window with the given URL.
|
|
101
|
+
* This function:
|
|
102
|
+
* - Validates the URL
|
|
103
|
+
* - Saves it to sessionStorage
|
|
104
|
+
* - Gets or creates a channel ID
|
|
105
|
+
* - Adds remoteDevChannelId as a URL parameter
|
|
106
|
+
* - Opens the window and stores the reference
|
|
107
|
+
* - Returns the window or null if popup was blocked
|
|
108
|
+
*/
|
|
109
|
+
openWindow(url: string): Window | null;
|
|
110
|
+
/**
|
|
111
|
+
* Creates a remote API handle for communicating with Octostar.
|
|
112
|
+
* This resolves the connection mode (iframe vs remote dev) and sets up post-robot communication.
|
|
113
|
+
*/
|
|
114
|
+
createRemoteApiHandle<T extends object>(params: GetRemoteApiParams): Promise<T>;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Gets the singleton instance of OctostarConnectionManager.
|
|
118
|
+
* Creates a new instance if one doesn't exist.
|
|
119
|
+
*/
|
|
120
|
+
export declare function getOctostarConnectionManager(): OctostarConnectionManager;
|
|
121
|
+
/**
|
|
122
|
+
* Creates a remote API handle. This is a convenience function that delegates to the manager.
|
|
123
|
+
* @deprecated Use getOctostarConnectionManager().createRemoteApiHandle() instead
|
|
124
|
+
*/
|
|
2
125
|
export declare const createRemoteApiHandle: <T extends object>(params: GetRemoteApiParams) => Promise<T>;
|
|
126
|
+
/**
|
|
127
|
+
* Forwards calls to a future object. Used for creating proxies that forward to promises.
|
|
128
|
+
*/
|
|
3
129
|
export declare const forwardCallsToFutureObject: <T>(chain: Promise<T>) => T;
|
|
130
|
+
export {};
|
|
4
131
|
//# sourceMappingURL=factory.d.ts.map
|
package/dist/factory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAA2C,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAA2C,MAAM,SAAS,CAAC;AAI3F,KAAK,uBAAuB,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;AAM3D;;;GAGG;AACH,qBAAa,yBAAyB;IACpC,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,eAAe,CAAuB;IAC9C,OAAO,CAA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