@adminide-stack/core 13.0.2-alpha.9 → 13.0.4-alpha.10
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/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{NATS_HEMERA_ADMINIDE_WORKSPACE,NATS_HEMERA_ADMINIDE_WORKSPACE_UPDATER}from'./constants/constants.js';export{DEFAULT_CPU,DEFAULT_HDD,DEFAULT_RAM}from'./constants/default-workspace-config.js';export{DEFAULT_CONTRIBUTION_TENANT_ID,DEFAULT_TENANT_ID,GLOBAL_CONFIGURATION_FILE,OVERRIDE_IDENTIFIER_PATTERN,OVERRIDE_PATTERN_WITH_SUBSTITUTION,OVERRIDE_PROPERTY,OVERRIDE_PROPERTY_PATTERN,SETTINGS_OVERRRIDE_NODE_ID,USER_CONFIGURATION_FILE}from'./constants/configuration.js';export{ASANA_WEBHOOK_ENDPOINT,ORG_BASE_PATH,ORG_STD_ROUTES}from'./constants/urls.js';export{IntegrationConfigurationRoute,hasOrganizationContext}from'./constants/routes.js';export{BillingPlan}from'./constants/billing-plan.js';export{DEFAULT_ANONYMOUS_ACCOUNT_ID,DEFAULT_ANONYMOUS_EMAIL,DEFAULT_ANONYMOUS_USERNAME,DEFAULT_APP_ID,DEFAULT_APP_TENANT_ID,DEFAULT_ENVIRONMENT_TAG_TYPE_ID,DEFAULT_SYSTEM_ACCOUNT_ID,DEFAULT_SYSTEM_EMAIL,DEFAULT_SYSTEM_USERNAME,VAULT_DEFAULT_DIR}from'./constants/defaultIds.js';export{LOCAL_MACHINE_SCOPES,ORGANIZATION_SCOPES,REMOTE_MACHINE_SCOPES,RESOURCE_SCOPES,USER_SCOPES}from'./interfaces/configuration/configuration.js';export{ApplicationState,IOrganizationContext,IOrganizationResource}from'./interfaces/organization/organization-context.js';export{Extensions}from'@workbench-stack/core/lib/constants/extensions.js';export{LifecyclePhase,ShutdownReason,StartupKind}from'@workbench-stack/core/lib/interfaces/lifecycle/lifecycle.js';export{PermissionBehavior}from'./interfaces/permissions.js';export*from'common/lib/generated/generated-models.js';export{getFilteredRoutes,getFilteredTabs,getTtl}from'./utils/utils.js';export{configureForCurrentBranch,configureForUpcomingBranch,convertToResourceUri,createDirectResourceUri,createStandardResourceUri,generateHashId,normalizeResourceUri,resourcePath,setupResourceUriConfiguration,strictConvertToResourceUri}from'./utils/resourceUriConversion.js';export{generateApplicationUri,generateMachineUri,generateOrgUri,generateOrgUriById,generateProxyUserUri,generateResourceUri,generateUri,generateUserUri}from'./utils/generate-uri.js';export{RESERVED_CDECODE_PARAMS,determineConfigurationTarget,generateCdecodeUri,isReservedCdecodeParam,parseCdecodeUri,validateUserQueryParams}from'./utils/cdecodeUri.js';export{generateApplicationRoleResource,generateRegisteredRoleURI}from'./utils/roles-utils.js';export{getScopes}from'./utils/configuration-utils.js';export{omitDeep}from'./utils/omit-deep.js';export{generateSettingsId}from'./utils/generated-settings-id.js';export{validateEmail}from'./utils/validations.js';export{toMilliSeconds}from'./utils/date-utils.js';export{expand,flatten,flattenObject}from'./utils/flatten-utils.js';export{generateUserAlias}from'./utils/generateUserAlias.js';export{getUserAlias}from'./utils/getUserAlias.js';export{getLogger}from'./utils/getLogger.js';export{getDefaultSettingsURI,getEditableSettingsURI,getOpenSettings,parseExtensionFromDefaultSettingsUri}from'./utils/preferenceUri.js';export{reviveUri}from'./utils/reviveUri.js';export{buildExtensionNodeContext,buildExtensionSettingsNodeContext,buildNodeContext,buildPermissionNodeContext,buildPolicyNodeContext,buildRoleNodeContext,buildUiLayoutNodeContext,isSystemContribution}from'./utils/nodeContext.js';export{splitCdecodeUri,splitOrgUri}from'./utils/splitCdecodeUri.js';export{generatePath}from'./utils/generatePath.js';export{SLUG_REGEX,SLUG_VALIDATION_MESSAGE,SLUG_VALIDATOR_CONFIG,getSlugValidationMessage,isValidSlug,slugValidator,slugify}from'./utils/slug-utils.js';export{Disposable,DisposableCollection}from'./core/disposable.js';export{BaseDisposable}from'./core/BaseDisposable.js';export{Emitter,Event,WaitUntilEvent}from'./core/event.js';export{Path}from'./core/path.js';export{OrganizationContext,OrganizationResource,toOrganizationResource,toOrganizationResources,toUri}from'./core/organization/organization.js';export{OrganizationConfiguration}from'./core/organization/configuration.js';export{isOrganizationIdentifier,isRawFileOrganizationResource,isRawUriOrganizationResource,isSingleResourceOrganizationIdentifier,isSingleResourceOrganizationInitializationPayload}from'./core/organization/helpers/organization-helpers.js';export{ConfigurationTargetConfigurationMapper,ConfigurationTargetToString,SettingsTypeToConfiguraitonTarget,addToValueTree,getConfigurationValue,getMigratedSettingValue,isConfigurationOverrides,keyFromOverrideIdentifier,merge,overrideIdentifierFromKey,removeFromValueTree,toValuesTree}from'./core/configurations/helpers/configuration.js';export{ConfigurationModel}from'./core/configurations/models/ConfigurationModel.js';export{EnhancedConfigurationModel}from'./core/configurations/models/ConfigurationModelWrapper.js';export{Configuration,OVERRIDE_PROPERTY_REGEX,compare,overrideIdentifiersFromKey}from'./core/configurations/configuration.js';export{ConfigurationChangeEvent}from'./core/configurations/events/ConfigurationChangeEvent.js';export{parseConfiguration}from'./core/configurations/parser/configurationParser.js';export{createConfigurationModel,extractConfiguration,extractConfigurationWithModel,extractIdentifiersFromKey,getBaseKeys,getOverrideByIdentifier,getOverrideKeys,hasOverrides,isBracketKey,removeOverrideKeys}from'./core/configurations/utils/configurationExtractor.js';export{CdeCodeProvider}from'./core/in-memory-providers/cde-code-provider.js';export{AuthError}from'./errors/auth-error.js';export{AbstractOrganizationContextService}from'./services/abstract-organization-context-service.js';export{AbstractOrganizationConfigurationClientService}from'./services/abstract-configuration.js';export{PreDefineAccountPermissions}from'./modules/account-api/enums/index.js';export{BillingModules,PreDefineBillingPermissions}from'./modules/billing-api/enums/index.js';export{URI,uriToFsPath}from'@vscode-alt/monaco-editor/esm/vs/base/common/uri.js';export{ConfigurationScope}from'common';//# sourceMappingURL=index.js.map
|
|
1
|
+
export{NATS_HEMERA_ADMINIDE_WORKSPACE,NATS_HEMERA_ADMINIDE_WORKSPACE_UPDATER}from'./constants/constants.js';export{DEFAULT_CPU,DEFAULT_HDD,DEFAULT_RAM}from'./constants/default-workspace-config.js';export{DEFAULT_CONTRIBUTION_TENANT_ID,DEFAULT_TENANT_ID,GLOBAL_CONFIGURATION_FILE,OVERRIDE_IDENTIFIER_PATTERN,OVERRIDE_PATTERN_WITH_SUBSTITUTION,OVERRIDE_PROPERTY,OVERRIDE_PROPERTY_PATTERN,SETTINGS_OVERRRIDE_NODE_ID,USER_CONFIGURATION_FILE}from'./constants/configuration.js';export{ASANA_WEBHOOK_ENDPOINT,ORG_BASE_PATH,ORG_STD_ROUTES}from'./constants/urls.js';export{IntegrationConfigurationRoute,hasOrganizationContext}from'./constants/routes.js';export{BillingPlan}from'./constants/billing-plan.js';export{DEFAULT_ANONYMOUS_ACCOUNT_ID,DEFAULT_ANONYMOUS_EMAIL,DEFAULT_ANONYMOUS_USERNAME,DEFAULT_APP_ID,DEFAULT_APP_TENANT_ID,DEFAULT_ENVIRONMENT_TAG_TYPE_ID,DEFAULT_SYSTEM_ACCOUNT_ID,DEFAULT_SYSTEM_EMAIL,DEFAULT_SYSTEM_USERNAME,VAULT_DEFAULT_DIR}from'./constants/defaultIds.js';export{LOCAL_MACHINE_SCOPES,ORGANIZATION_SCOPES,REMOTE_MACHINE_SCOPES,RESOURCE_SCOPES,USER_SCOPES}from'./interfaces/configuration/configuration.js';export{ApplicationState,IOrganizationContext,IOrganizationResource}from'./interfaces/organization/organization-context.js';export{Extensions}from'@workbench-stack/core/lib/constants/extensions.js';export{LifecyclePhase,ShutdownReason,StartupKind}from'@workbench-stack/core/lib/interfaces/lifecycle/lifecycle.js';export{PermissionBehavior}from'./interfaces/permissions.js';export*from'common/lib/generated/generated-models.js';export{getFilteredRoutes,getFilteredTabs,getTtl}from'./utils/utils.js';export{configureForCurrentBranch,configureForUpcomingBranch,convertToResourceUri,createDirectResourceUri,createStandardResourceUri,generateHashId,normalizeResourceUri,resourcePath,setupResourceUriConfiguration,strictConvertToResourceUri}from'./utils/resourceUriConversion.js';export{generateApplicationUri,generateMachineUri,generateOrgUri,generateOrgUriById,generateProxyUserUri,generateResourceUri,generateUri,generateUserUri}from'./utils/generate-uri.js';export{RESERVED_CDECODE_PARAMS,determineConfigurationTarget,generateCdecodeUri,isReservedCdecodeParam,parseCdecodeUri,validateUserQueryParams}from'./utils/cdecodeUri.js';export{generateApplicationRoleResource,generateRegisteredRoleURI}from'./utils/roles-utils.js';export{getScopes}from'./utils/configuration-utils.js';export{omitDeep}from'./utils/omit-deep.js';export{generateSettingsId}from'./utils/generated-settings-id.js';export{validateEmail}from'./utils/validations.js';export{toMilliSeconds}from'./utils/date-utils.js';export{expand,flatten,flattenObject}from'./utils/flatten-utils.js';export{generateUserAlias}from'./utils/generateUserAlias.js';export{getUserAlias}from'./utils/getUserAlias.js';export{getLogger}from'./utils/getLogger.js';export{getDefaultSettingsURI,getEditableSettingsURI,getOpenSettings,parseExtensionFromDefaultSettingsUri}from'./utils/preferenceUri.js';export{reviveUri}from'./utils/reviveUri.js';export{buildExtensionNodeContext,buildExtensionSettingsNodeContext,buildNodeContext,buildPermissionNodeContext,buildPolicyNodeContext,buildRoleNodeContext,buildUiLayoutNodeContext,isSystemContribution}from'./utils/nodeContext.js';export{splitCdecodeUri,splitOrgUri}from'./utils/splitCdecodeUri.js';export{generatePath}from'./utils/generatePath.js';export{SLUG_REGEX,SLUG_VALIDATION_MESSAGE,SLUG_VALIDATOR_CONFIG,getSlugValidationMessage,isValidSlug,slugValidator,slugify}from'./utils/slug-utils.js';export{pubSub}from'./utils/pubsub-utility.js';export{Disposable,DisposableCollection}from'./core/disposable.js';export{BaseDisposable}from'./core/BaseDisposable.js';export{Emitter,Event,WaitUntilEvent}from'./core/event.js';export{Path}from'./core/path.js';export{OrganizationContext,OrganizationResource,toOrganizationResource,toOrganizationResources,toUri}from'./core/organization/organization.js';export{OrganizationConfiguration}from'./core/organization/configuration.js';export{isOrganizationIdentifier,isRawFileOrganizationResource,isRawUriOrganizationResource,isSingleResourceOrganizationIdentifier,isSingleResourceOrganizationInitializationPayload}from'./core/organization/helpers/organization-helpers.js';export{ConfigurationTargetConfigurationMapper,ConfigurationTargetToString,SettingsTypeToConfiguraitonTarget,addToValueTree,getConfigurationValue,getMigratedSettingValue,isConfigurationOverrides,keyFromOverrideIdentifier,merge,overrideIdentifierFromKey,removeFromValueTree,toValuesTree}from'./core/configurations/helpers/configuration.js';export{ConfigurationModel}from'./core/configurations/models/ConfigurationModel.js';export{EnhancedConfigurationModel}from'./core/configurations/models/ConfigurationModelWrapper.js';export{Configuration,OVERRIDE_PROPERTY_REGEX,compare,overrideIdentifiersFromKey}from'./core/configurations/configuration.js';export{ConfigurationChangeEvent}from'./core/configurations/events/ConfigurationChangeEvent.js';export{parseConfiguration}from'./core/configurations/parser/configurationParser.js';export{createConfigurationModel,extractConfiguration,extractConfigurationWithModel,extractIdentifiersFromKey,getBaseKeys,getOverrideByIdentifier,getOverrideKeys,hasOverrides,isBracketKey,removeOverrideKeys}from'./core/configurations/utils/configurationExtractor.js';export{CdeCodeProvider}from'./core/in-memory-providers/cde-code-provider.js';export{AuthError}from'./errors/auth-error.js';export{AbstractOrganizationContextService}from'./services/abstract-organization-context-service.js';export{AbstractOrganizationConfigurationClientService}from'./services/abstract-configuration.js';export{PreDefineAccountPermissions}from'./modules/account-api/enums/index.js';export{BillingModules,PreDefineBillingPermissions}from'./modules/billing-api/enums/index.js';export{URI,uriToFsPath}from'@vscode-alt/monaco-editor/esm/vs/base/common/uri.js';export{ConfigurationScope}from'common';//# sourceMappingURL=index.js.map
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PubSub utility for external integrations (REST APIs, WebSockets, RxJS, etc.)
|
|
3
|
+
* Allows external systems to subscribe to PubSub node updates by node ID.
|
|
4
|
+
*
|
|
5
|
+
* Usage examples:
|
|
6
|
+
*
|
|
7
|
+
* 1. RESTful API:
|
|
8
|
+
* const unsubscribe = pubSub.subscribe(nodeId, (data) => {
|
|
9
|
+
* res.json(data); // Send to HTTP response
|
|
10
|
+
* });
|
|
11
|
+
*
|
|
12
|
+
* 2. WebSocket:
|
|
13
|
+
* const unsubscribe = pubSub.subscribe(nodeId, (data) => {
|
|
14
|
+
* ws.send(JSON.stringify(data)); // Send to WebSocket client
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* 3. RxJS:
|
|
18
|
+
* const subject = new Subject();
|
|
19
|
+
* pubSub.subscribe(nodeId, (data) => subject.next(data));
|
|
20
|
+
* return subject.asObservable();
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
declare class PubSubUtility {
|
|
24
|
+
private static instance;
|
|
25
|
+
private subscribers;
|
|
26
|
+
/**
|
|
27
|
+
* Private constructor to prevent direct instantiation
|
|
28
|
+
*/
|
|
29
|
+
private constructor();
|
|
30
|
+
/**
|
|
31
|
+
* Get the singleton instance
|
|
32
|
+
* @returns The singleton instance of PubSubUtility
|
|
33
|
+
*/
|
|
34
|
+
static getInstance(): PubSubUtility;
|
|
35
|
+
/**
|
|
36
|
+
* Subscribe to a PubSub node by its ID
|
|
37
|
+
* @param nodeId - The PubSub node ID to subscribe to
|
|
38
|
+
* @param callback - Function called when the node publishes new data
|
|
39
|
+
* @returns Unsubscribe function
|
|
40
|
+
*/
|
|
41
|
+
subscribe(nodeId: string, callback: (data: any) => void): () => void;
|
|
42
|
+
/**
|
|
43
|
+
* Publish data to all subscribers of a node
|
|
44
|
+
* @param nodeId - The PubSub node ID publishing data
|
|
45
|
+
* @param data - The data to publish
|
|
46
|
+
*/
|
|
47
|
+
publish(nodeId: string, data: any): void;
|
|
48
|
+
/**
|
|
49
|
+
* Get the number of subscribers for a node
|
|
50
|
+
*/
|
|
51
|
+
getSubscriberCount(nodeId: string): number;
|
|
52
|
+
/**
|
|
53
|
+
* Clear all subscribers for a specific node
|
|
54
|
+
*/
|
|
55
|
+
clearNode(nodeId: string): void;
|
|
56
|
+
/**
|
|
57
|
+
* Clear all subscribers from all nodes
|
|
58
|
+
*/
|
|
59
|
+
clearAll(): void;
|
|
60
|
+
/**
|
|
61
|
+
* Get all node IDs that have subscribers
|
|
62
|
+
*/
|
|
63
|
+
getActiveNodes(): string[];
|
|
64
|
+
}
|
|
65
|
+
export declare const pubSub: PubSubUtility;
|
|
66
|
+
export default pubSub;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PubSub utility for external integrations (REST APIs, WebSockets, RxJS, etc.)
|
|
3
|
+
* Allows external systems to subscribe to PubSub node updates by node ID.
|
|
4
|
+
*
|
|
5
|
+
* Usage examples:
|
|
6
|
+
*
|
|
7
|
+
* 1. RESTful API:
|
|
8
|
+
* const unsubscribe = pubSub.subscribe(nodeId, (data) => {
|
|
9
|
+
* res.json(data); // Send to HTTP response
|
|
10
|
+
* });
|
|
11
|
+
*
|
|
12
|
+
* 2. WebSocket:
|
|
13
|
+
* const unsubscribe = pubSub.subscribe(nodeId, (data) => {
|
|
14
|
+
* ws.send(JSON.stringify(data)); // Send to WebSocket client
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* 3. RxJS:
|
|
18
|
+
* const subject = new Subject();
|
|
19
|
+
* pubSub.subscribe(nodeId, (data) => subject.next(data));
|
|
20
|
+
* return subject.asObservable();
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
const globalObject = typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : typeof global !== 'undefined' ? global : {};
|
|
24
|
+
class PubSubUtility {
|
|
25
|
+
static instance;
|
|
26
|
+
subscribers = new Map();
|
|
27
|
+
/**
|
|
28
|
+
* Private constructor to prevent direct instantiation
|
|
29
|
+
*/
|
|
30
|
+
constructor() {}
|
|
31
|
+
/**
|
|
32
|
+
* Get the singleton instance
|
|
33
|
+
* @returns The singleton instance of PubSubUtility
|
|
34
|
+
*/
|
|
35
|
+
static getInstance() {
|
|
36
|
+
if (!PubSubUtility.instance) {
|
|
37
|
+
// Check if instance exists on window object (web environment)
|
|
38
|
+
if (globalObject.pubSubInstance) {
|
|
39
|
+
PubSubUtility.instance = globalObject.pubSubInstance;
|
|
40
|
+
} else {
|
|
41
|
+
// Create new instance if none exists
|
|
42
|
+
PubSubUtility.instance = new PubSubUtility();
|
|
43
|
+
// Register to window object when in web environment
|
|
44
|
+
if (globalObject) {
|
|
45
|
+
globalObject.pubSubInstance = PubSubUtility.instance;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return PubSubUtility.instance;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Subscribe to a PubSub node by its ID
|
|
53
|
+
* @param nodeId - The PubSub node ID to subscribe to
|
|
54
|
+
* @param callback - Function called when the node publishes new data
|
|
55
|
+
* @returns Unsubscribe function
|
|
56
|
+
*/
|
|
57
|
+
subscribe(nodeId, callback) {
|
|
58
|
+
if (!this.subscribers.has(nodeId)) {
|
|
59
|
+
this.subscribers.set(nodeId, new Set());
|
|
60
|
+
}
|
|
61
|
+
this.subscribers.get(nodeId).add(callback);
|
|
62
|
+
console.log(`[PubSub] New subscriber for node "${nodeId}". Total: ${this.subscribers.get(nodeId).size}`);
|
|
63
|
+
// Return unsubscribe function
|
|
64
|
+
return () => {
|
|
65
|
+
const nodeSubscribers = this.subscribers.get(nodeId);
|
|
66
|
+
if (nodeSubscribers) {
|
|
67
|
+
nodeSubscribers.delete(callback);
|
|
68
|
+
console.log(`[PubSub] Unsubscribed from node "${nodeId}". Remaining: ${nodeSubscribers.size}`);
|
|
69
|
+
if (nodeSubscribers.size === 0) {
|
|
70
|
+
this.subscribers.delete(nodeId);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Publish data to all subscribers of a node
|
|
77
|
+
* @param nodeId - The PubSub node ID publishing data
|
|
78
|
+
* @param data - The data to publish
|
|
79
|
+
*/
|
|
80
|
+
publish(nodeId, data) {
|
|
81
|
+
if (!data) return;
|
|
82
|
+
try {
|
|
83
|
+
const nodeSubscribers = this.subscribers.get(nodeId);
|
|
84
|
+
if (nodeSubscribers && nodeSubscribers.size > 0) {
|
|
85
|
+
console.log(`[PubSub] Publishing to ${nodeSubscribers.size} subscriber(s) for node "${nodeId}"`);
|
|
86
|
+
nodeSubscribers.forEach(callback => {
|
|
87
|
+
try {
|
|
88
|
+
callback(data);
|
|
89
|
+
} catch (error) {
|
|
90
|
+
console.error(`[PubSub] Error in subscriber callback for node "${nodeId}":`, error);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
} catch (error) {
|
|
95
|
+
console.error(`[PubSub] Error in publish for node "${nodeId}":`, error);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Get the number of subscribers for a node
|
|
100
|
+
*/
|
|
101
|
+
getSubscriberCount(nodeId) {
|
|
102
|
+
return this.subscribers.get(nodeId)?.size ?? 0;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Clear all subscribers for a specific node
|
|
106
|
+
*/
|
|
107
|
+
clearNode(nodeId) {
|
|
108
|
+
this.subscribers.delete(nodeId);
|
|
109
|
+
console.log(`[PubSub] Cleared all subscribers for node "${nodeId}"`);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Clear all subscribers from all nodes
|
|
113
|
+
*/
|
|
114
|
+
clearAll() {
|
|
115
|
+
this.subscribers.clear();
|
|
116
|
+
console.log('[PubSub] Cleared all subscribers');
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Get all node IDs that have subscribers
|
|
120
|
+
*/
|
|
121
|
+
getActiveNodes() {
|
|
122
|
+
return Array.from(this.subscribers.keys());
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
// Named export for `export * from './pubsub-utility'` in index.ts
|
|
126
|
+
const pubSub = PubSubUtility.getInstance();
|
|
127
|
+
// 1. RESTful API (Long Polling)
|
|
128
|
+
// import { pubSub } from '@workflow-editor/core/nodes/function/pubsub';
|
|
129
|
+
// app.get('/api/pubsub/:nodeId', async (req, res) => {
|
|
130
|
+
// const { nodeId } = req.params;
|
|
131
|
+
// const unsubscribe = pubSub.subscribe(nodeId, (data) => {
|
|
132
|
+
// res.json({ success: true, data });
|
|
133
|
+
// unsubscribe();
|
|
134
|
+
// });
|
|
135
|
+
// // Timeout after 30 seconds
|
|
136
|
+
// setTimeout(() => {
|
|
137
|
+
// unsubscribe();
|
|
138
|
+
// res.json({ success: false, message: 'Timeout' });
|
|
139
|
+
// }, 30000);
|
|
140
|
+
// });
|
|
141
|
+
// 2. WebSocket
|
|
142
|
+
// import { pubSub } from '@workflow-editor/core/nodes/function/pubsub';
|
|
143
|
+
// wss.on('connection', (ws) => {
|
|
144
|
+
// let unsubscribe: (() => void) | null = null;
|
|
145
|
+
// ws.on('message', (message) => {
|
|
146
|
+
// const { action, nodeId } = JSON.parse(message);
|
|
147
|
+
// if (action === 'subscribe') {
|
|
148
|
+
// unsubscribe = pubSub.subscribe(nodeId, (data) => {
|
|
149
|
+
// ws.send(JSON.stringify({ type: 'update', nodeId, data }));
|
|
150
|
+
// });
|
|
151
|
+
// }
|
|
152
|
+
// });
|
|
153
|
+
// ws.on('close', () => {
|
|
154
|
+
// unsubscribe?.();
|
|
155
|
+
// });
|
|
156
|
+
// });
|
|
157
|
+
// 3. RxJS Observable
|
|
158
|
+
// import { pubSub } from '@workflow-editor/core/nodes/function/pubsub';
|
|
159
|
+
// import { Observable } from 'rxjs';
|
|
160
|
+
// export function createPubSubObservable(nodeId: string): Observable<any> {
|
|
161
|
+
// return new Observable(subscriber => {
|
|
162
|
+
// const unsubscribe = pubSub.subscribe(nodeId, (data) => {
|
|
163
|
+
// subscriber.next(data);
|
|
164
|
+
// });
|
|
165
|
+
// return () => unsubscribe();
|
|
166
|
+
// });
|
|
167
|
+
// }
|
|
168
|
+
// // Usage
|
|
169
|
+
// const stream$ = createPubSubObservable('node-123');
|
|
170
|
+
// stream$.subscribe(data => console.log('PubSub update:', data));
|
|
171
|
+
// 4. Browser console window globally
|
|
172
|
+
// const mySubscription = window.pubSub.subscribe('node_abc123', (data) => {
|
|
173
|
+
// console.group('🔔 PubSub Notification');
|
|
174
|
+
// console.log('Node ID:', 'node_abc123');
|
|
175
|
+
// console.log('Data:', data);
|
|
176
|
+
// console.log('Timestamp:', new Date().toISOString());
|
|
177
|
+
// console.groupEnd();
|
|
178
|
+
// });
|
|
179
|
+
export{pubSub as default,pubSub};//# sourceMappingURL=pubsub-utility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pubsub-utility.js","sources":["../../src/utils/pubsub-utility.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;AAqBG;AAEH,MAAM,YAAY,GACd,OAAO,MAAM,KAAK,WAAW,GAAA,MAAA,GAAA,OAAA,IAAA,KAAA,WAAA,GAAA,IAAA,GAAA,OAAA,MAAA,KAAA,WAAA,GAAA,MAAA,GAAA,EAAA;AACzB,MAAE,aAAM,CAAA;AACR,EAAA,OAAE,QAAW;AACX,EAAA,WAAE,GAAI,IAAA,GAAA,EAAA;AACN;AACE;;AAGZ,EAAA,WAAM,GAAA,CAAA;;AAEM;AAER;;AAEG,EAAA,OAAA,WAAA,GAAA;AACH,IAAA,IAAA,CAAA,aAAwB,CAAA,QAAA,EAAA;AAExB;;;AAGG,MAAA,CAAA,MAAA;AACI;AACH,QAAA,aAAK,CAAA,QAAc,GAAA,IAAU,aAAC,EAAA;;AAE1B,QAAA,IAAA,YAAI,EAAA;AACA,UAAA,YAAA,CAAA,cAAc,GAAQ,aAAe,CAAC;;;;AAGtC,IAAA,OAAA,aAAA,CAAA,QAAc;;;AAIV;;;;;WAKf,CAAA,MAAA,EAAA,QAAA,EAAA;AAED,IAAA,IAAA,CAAA,IAAA,CAAA,WAAA,CAAA,GAAA,CAAA,MAAA,CAAA,EAAA;;;;;AAKG;IACI,OAAA,MAAU;YACT,eAAM,GAAY,IAAI,CAAA,WAAU,CAAA,GAAA,CAAA,MAAA,CAAA;yBAC3B,EAAA;QACT,eAAC,CAAA,MAAA,CAAA,QAAA,CAAA;AAED,QAAA,OAAK,CAAA,GAAA,CAAA,CAAA,iCAAuC,EAAA,MAAA,CAAA,cAAA,EAAA,eAAA,CAAA,IAAA,CAAA,CAAA,CAAA;AAE5C,QAAA,IAAA;UAEA,IAAA,CAAA,WAAA,CAAA,MAAA,CAAA,MAA8B,CAAA;AAC9B,QAAA;;;AAGQ,EAAA;;AAEA;AACI;;;AAGZ,EAAA,OAAC,CAAC,MAAA,EAAA,IAAA,EAAA;IACN,IAAC,CAAA,IAAA,EAAA;AAED,IAAA,IAAA;;;;AAIG,QAAA,eAAA,CAAA,OAAA,CAAA,QAAA,IAAA;UACI,IAAQ;AACX,YAAI,QAAK,CAAA,IAAA,CAAA;YAAE,OAAO,KAAA,EAAA;AAElB,YAAI,OAAC,CAAA,KAAA,CAAA,CAAA,gDAAA,EAAA,MAAA,CAAA,EAAA,CAAA,EAAA,KAAA,CAAA;;;;AAIG,IAAA,CAAA,CAAA,OAAA,KAAA,EAAA;AACI,MAAA,OAAA,CAAA,KAAA,CAAA,CAAA,oCAAK,EAAA,MAAA,CAAA,EAAA,CAAA,EAAA,KAAA,CAAA;;;;;;AAKT,EAAA,kBAAG,CAAA,MAAA,EAAA;eACN,CAAA,WAAA,CAAA,GAAA,CAAA,MAAA,CAAA,EAAA,IAAA,IAAA,CAAA;;;;;WAIR,CAAA,MAAA,EAAA;AAED,IAAA,IAAA,CAAA,WAAA,CAAA,MAAA,CAAA,MAAA,CAAA;;AAEG,EAAA;AACH;AACI;;AAGJ,EAAA,QAAA,GAAA;;AAEG,IAAA,OAAA,CAAA,GAAA,CAAA,kCAAA,CAAA;AACH,EAAA;AACI;AACA;;AAGJ,EAAA,cAAA,GAAA;;AAEG,EAAA;;AAEC;AACA,MAAA,MAAW,GAAC,aAAA,CAAA,WAAA;;AAKb;;;;AAIN;AAED;AACA;AAEA;AACA;AAEA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adminide-stack/core",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.4-alpha.10",
|
|
4
4
|
"description": "AdminIDE core for higher packages to depend on",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "CDMBase LLC",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"vscode-uri": "^3.0.8"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"common": "13.0.
|
|
33
|
+
"common": "13.0.4-alpha.10"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@common-stack/server-core": ">=0.5.21",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"typescript": {
|
|
43
43
|
"definition": "lib/index.d.ts"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "b52e435703fd60e1fc091131502ab4a1de78f6b9"
|
|
46
46
|
}
|