@optimizely/ocp-local-env 1.0.0-beta.4
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/README.md +165 -0
- package/dist/package.json +104 -0
- package/dist/public/bundle.da978bb5437cd82e6d37.js +3 -0
- package/dist/public/bundle.da978bb5437cd82e6d37.js.LICENSE.txt +49 -0
- package/dist/public/bundle.da978bb5437cd82e6d37.js.map +1 -0
- package/dist/public/index.html +1 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.js +88 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/executor/FunctionExecutor.d.ts +56 -0
- package/dist/src/executor/FunctionExecutor.js +175 -0
- package/dist/src/executor/FunctionExecutor.js.map +1 -0
- package/dist/src/executor/JobExecutor.d.ts +60 -0
- package/dist/src/executor/JobExecutor.js +203 -0
- package/dist/src/executor/JobExecutor.js.map +1 -0
- package/dist/src/executor/LifecycleExecutor.d.ts +45 -0
- package/dist/src/executor/LifecycleExecutor.js +153 -0
- package/dist/src/executor/LifecycleExecutor.js.map +1 -0
- package/dist/src/executor/watcher.d.ts +63 -0
- package/dist/src/executor/watcher.js +213 -0
- package/dist/src/executor/watcher.js.map +1 -0
- package/dist/src/functions/hello.d.ts +4 -0
- package/dist/src/functions/hello.js +8 -0
- package/dist/src/functions/hello.js.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +9 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/jobs/dailyJob.d.ts +4 -0
- package/dist/src/jobs/dailyJob.js +8 -0
- package/dist/src/jobs/dailyJob.js.map +1 -0
- package/dist/src/local_engine/LocalNotifier.d.ts +10 -0
- package/dist/src/local_engine/LocalNotifier.js +26 -0
- package/dist/src/local_engine/LocalNotifier.js.map +1 -0
- package/dist/src/local_engine/local-engine-child-base.d.ts +79 -0
- package/dist/src/local_engine/local-engine-child-base.js +304 -0
- package/dist/src/local_engine/local-engine-child-base.js.map +1 -0
- package/dist/src/local_engine/local-engine-client.d.ts +80 -0
- package/dist/src/local_engine/local-engine-client.js +333 -0
- package/dist/src/local_engine/local-engine-client.js.map +1 -0
- package/dist/src/local_engine/local-engine-types.d.ts +132 -0
- package/dist/src/local_engine/local-engine-types.js +6 -0
- package/dist/src/local_engine/local-engine-types.js.map +1 -0
- package/dist/src/local_engine/local-engine-unified.d.ts +40 -0
- package/dist/src/local_engine/local-engine-unified.js +406 -0
- package/dist/src/local_engine/local-engine-unified.js.map +1 -0
- package/dist/src/local_engine/local-engine-utils.d.ts +70 -0
- package/dist/src/local_engine/local-engine-utils.js +192 -0
- package/dist/src/local_engine/local-engine-utils.js.map +1 -0
- package/dist/src/local_engine/localSDKConfig.d.ts +30 -0
- package/dist/src/local_engine/localSDKConfig.js +392 -0
- package/dist/src/local_engine/localSDKConfig.js.map +1 -0
- package/dist/src/local_engine/storage/LocalConfigStore.d.ts +56 -0
- package/dist/src/local_engine/storage/LocalConfigStore.js +129 -0
- package/dist/src/local_engine/storage/LocalConfigStore.js.map +1 -0
- package/dist/src/local_engine/storage/LocalJobStore.d.ts +110 -0
- package/dist/src/local_engine/storage/LocalJobStore.js +239 -0
- package/dist/src/local_engine/storage/LocalJobStore.js.map +1 -0
- package/dist/src/local_engine/storage/LocalKVStore.d.ts +105 -0
- package/dist/src/local_engine/storage/LocalKVStore.js +1002 -0
- package/dist/src/local_engine/storage/LocalKVStore.js.map +1 -0
- package/dist/src/local_engine/storage/LocalNotificationStore.d.ts +27 -0
- package/dist/src/local_engine/storage/LocalNotificationStore.js +125 -0
- package/dist/src/local_engine/storage/LocalNotificationStore.js.map +1 -0
- package/dist/src/local_engine/storage/LocalSecretsStore.d.ts +114 -0
- package/dist/src/local_engine/storage/LocalSecretsStore.js +319 -0
- package/dist/src/local_engine/storage/LocalSecretsStore.js.map +1 -0
- package/dist/src/local_engine/storage/LocalSettingsStore.d.ts +161 -0
- package/dist/src/local_engine/storage/LocalSettingsStore.js +417 -0
- package/dist/src/local_engine/storage/LocalSettingsStore.js.map +1 -0
- package/dist/src/local_engine/storage/NumberSet.d.ts +21 -0
- package/dist/src/local_engine/storage/NumberSet.js +32 -0
- package/dist/src/local_engine/storage/NumberSet.js.map +1 -0
- package/dist/src/local_engine/storage/StringSet.d.ts +21 -0
- package/dist/src/local_engine/storage/StringSet.js +32 -0
- package/dist/src/local_engine/storage/StringSet.js.map +1 -0
- package/dist/src/local_engine/types.d.ts +52 -0
- package/dist/src/local_engine/types.js +6 -0
- package/dist/src/local_engine/types.js.map +1 -0
- package/dist/src/local_engine/utils.d.ts +31 -0
- package/dist/src/local_engine/utils.js +126 -0
- package/dist/src/local_engine/utils.js.map +1 -0
- package/dist/src/logging/LogManager.d.ts +89 -0
- package/dist/src/logging/LogManager.js +237 -0
- package/dist/src/logging/LogManager.js.map +1 -0
- package/dist/src/server/api/functions.d.ts +7 -0
- package/dist/src/server/api/functions.js +80 -0
- package/dist/src/server/api/functions.js.map +1 -0
- package/dist/src/server/api/jobs.d.ts +8 -0
- package/dist/src/server/api/jobs.js +242 -0
- package/dist/src/server/api/jobs.js.map +1 -0
- package/dist/src/server/api/lifecycle.d.ts +6 -0
- package/dist/src/server/api/lifecycle.js +73 -0
- package/dist/src/server/api/lifecycle.js.map +1 -0
- package/dist/src/server/api/settings.d.ts +6 -0
- package/dist/src/server/api/settings.js +117 -0
- package/dist/src/server/api/settings.js.map +1 -0
- package/dist/src/server/api/stores.d.ts +2 -0
- package/dist/src/server/api/stores.js +341 -0
- package/dist/src/server/api/stores.js.map +1 -0
- package/dist/src/server/api/v1.d.ts +10 -0
- package/dist/src/server/api/v1.js +711 -0
- package/dist/src/server/api/v1.js.map +1 -0
- package/dist/src/server/api.d.ts +8 -0
- package/dist/src/server/api.js +154 -0
- package/dist/src/server/api.js.map +1 -0
- package/dist/src/server/app-discovery.d.ts +5 -0
- package/dist/src/server/app-discovery.js +81 -0
- package/dist/src/server/app-discovery.js.map +1 -0
- package/dist/src/server/config.d.ts +21 -0
- package/dist/src/server/config.js +100 -0
- package/dist/src/server/config.js.map +1 -0
- package/dist/src/server/websocket.d.ts +0 -0
- package/dist/src/server/websocket.js +2 -0
- package/dist/src/server/websocket.js.map +1 -0
- package/dist/src/server.d.ts +2 -0
- package/dist/src/server.js +546 -0
- package/dist/src/server.js.map +1 -0
- package/dist/src/types/app.d.ts +155 -0
- package/dist/src/types/app.js +24 -0
- package/dist/src/types/app.js.map +1 -0
- package/dist/src/types/kvstore.d.ts +320 -0
- package/dist/src/types/kvstore.js +5 -0
- package/dist/src/types/kvstore.js.map +1 -0
- package/dist/src/ui/components/App.d.ts +6 -0
- package/dist/src/ui/components/App.js +255 -0
- package/dist/src/ui/components/App.js.map +1 -0
- package/dist/src/ui/components/FunctionsView.d.ts +6 -0
- package/dist/src/ui/components/FunctionsView.js +217 -0
- package/dist/src/ui/components/FunctionsView.js.map +1 -0
- package/dist/src/ui/components/JobsView.d.ts +6 -0
- package/dist/src/ui/components/JobsView.js +257 -0
- package/dist/src/ui/components/JobsView.js.map +1 -0
- package/dist/src/ui/components/KVStoreViewer.d.ts +11 -0
- package/dist/src/ui/components/KVStoreViewer.js +168 -0
- package/dist/src/ui/components/KVStoreViewer.js.map +1 -0
- package/dist/src/ui/components/NotificationViewer.d.ts +16 -0
- package/dist/src/ui/components/NotificationViewer.js +69 -0
- package/dist/src/ui/components/NotificationViewer.js.map +1 -0
- package/dist/src/ui/components/SecretsStoreViewer.d.ts +11 -0
- package/dist/src/ui/components/SecretsStoreViewer.js +179 -0
- package/dist/src/ui/components/SecretsStoreViewer.js.map +1 -0
- package/dist/src/ui/components/SettingsStoreViewer.d.ts +24 -0
- package/dist/src/ui/components/SettingsStoreViewer.js +132 -0
- package/dist/src/ui/components/SettingsStoreViewer.js.map +1 -0
- package/dist/src/ui/components/StoreViewer.d.ts +16 -0
- package/dist/src/ui/components/StoreViewer.js +86 -0
- package/dist/src/ui/components/StoreViewer.js.map +1 -0
- package/dist/src/ui/components/TabbedConsole.d.ts +15 -0
- package/dist/src/ui/components/TabbedConsole.js +93 -0
- package/dist/src/ui/components/TabbedConsole.js.map +1 -0
- package/dist/src/ui/components/common/DataTree.d.ts +15 -0
- package/dist/src/ui/components/common/DataTree.js +95 -0
- package/dist/src/ui/components/common/DataTree.js.map +1 -0
- package/dist/src/ui/components/common/EyeIcon.d.ts +11 -0
- package/dist/src/ui/components/common/EyeIcon.js +11 -0
- package/dist/src/ui/components/common/EyeIcon.js.map +1 -0
- package/dist/src/ui/index.d.ts +1 -0
- package/dist/src/ui/index.js +20 -0
- package/dist/src/ui/index.js.map +1 -0
- package/package.json +104 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IPC_CONFIG = exports.isConnectionHealthy = exports.deserializeError = exports.serializeError = exports.cleanupPendingRequest = exports.createPendingRequest = exports.logIPCMessage = exports.safeSerialize = exports.createRequestTimeout = exports.sendIPCMessage = exports.validateMessage = exports.createBaseMessage = exports.generateMessageId = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* IPC Communication Utilities
|
|
6
|
+
*/
|
|
7
|
+
const crypto_1 = require("crypto");
|
|
8
|
+
/**
|
|
9
|
+
* Generate a unique correlation ID for IPC messages
|
|
10
|
+
*/
|
|
11
|
+
function generateMessageId() {
|
|
12
|
+
return (0, crypto_1.randomUUID)();
|
|
13
|
+
}
|
|
14
|
+
exports.generateMessageId = generateMessageId;
|
|
15
|
+
/**
|
|
16
|
+
* Create a base IPC message with common fields
|
|
17
|
+
*/
|
|
18
|
+
function createBaseMessage(type) {
|
|
19
|
+
return {
|
|
20
|
+
id: generateMessageId(),
|
|
21
|
+
type,
|
|
22
|
+
timestamp: Date.now()
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
exports.createBaseMessage = createBaseMessage;
|
|
26
|
+
/**
|
|
27
|
+
* Validate that a message conforms to the IPC schema
|
|
28
|
+
*/
|
|
29
|
+
function validateMessage(message) {
|
|
30
|
+
return (typeof message === 'object' &&
|
|
31
|
+
message !== null &&
|
|
32
|
+
typeof message.id === 'string' &&
|
|
33
|
+
typeof message.type === 'string' &&
|
|
34
|
+
typeof message.timestamp === 'number');
|
|
35
|
+
}
|
|
36
|
+
exports.validateMessage = validateMessage;
|
|
37
|
+
/**
|
|
38
|
+
* Send a message through IPC with error handling
|
|
39
|
+
*/
|
|
40
|
+
function sendIPCMessage(process, message) {
|
|
41
|
+
try {
|
|
42
|
+
if (process.send) {
|
|
43
|
+
process.send(message);
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
console.error('[IPC] Process does not support IPC communication');
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
console.error('[IPC] Failed to send message:', error);
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.sendIPCMessage = sendIPCMessage;
|
|
57
|
+
/**
|
|
58
|
+
* Create a timeout for pending requests
|
|
59
|
+
*/
|
|
60
|
+
function createRequestTimeout(requestId, timeoutMs, reject, cleanup) {
|
|
61
|
+
return setTimeout(() => {
|
|
62
|
+
cleanup();
|
|
63
|
+
reject(new Error(`IPC request ${requestId} timed out after ${timeoutMs}ms`));
|
|
64
|
+
}, timeoutMs);
|
|
65
|
+
}
|
|
66
|
+
exports.createRequestTimeout = createRequestTimeout;
|
|
67
|
+
/**
|
|
68
|
+
* Safe JSON serialization for IPC messages
|
|
69
|
+
*/
|
|
70
|
+
function safeSerialize(data) {
|
|
71
|
+
try {
|
|
72
|
+
// Handle special cases that don't serialize well
|
|
73
|
+
return JSON.parse(JSON.stringify(data, (key, value) => {
|
|
74
|
+
// Convert Uint8Array to regular array for serialization
|
|
75
|
+
if (value instanceof Uint8Array) {
|
|
76
|
+
return Array.from(value);
|
|
77
|
+
}
|
|
78
|
+
// Handle functions by converting to string representation
|
|
79
|
+
if (typeof value === 'function') {
|
|
80
|
+
return `[Function: ${value.name || 'anonymous'}]`;
|
|
81
|
+
}
|
|
82
|
+
// Handle circular references
|
|
83
|
+
if (typeof value === 'object' && value !== null) {
|
|
84
|
+
if (value.constructor && value.constructor.name !== 'Object' && value.constructor.name !== 'Array') {
|
|
85
|
+
return `[${value.constructor.name}]`;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return value;
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
console.warn('[IPC] Failed to serialize data, using fallback:', error);
|
|
93
|
+
return { __serialization_error: String(data) };
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.safeSerialize = safeSerialize;
|
|
97
|
+
/**
|
|
98
|
+
* Log IPC messages for debugging
|
|
99
|
+
*/
|
|
100
|
+
function logIPCMessage(direction, message, prefix = '[IPC]') {
|
|
101
|
+
const arrow = direction === 'SEND' ? '→' : '←';
|
|
102
|
+
console.log(`${prefix} ${arrow} ${message.type} (${message.id.slice(0, 8)})`);
|
|
103
|
+
// Log additional details for certain message types
|
|
104
|
+
if (message.type === 'execute_function' && 'data' in message) {
|
|
105
|
+
console.log(`${prefix} Function: ${message.data.functionId}`);
|
|
106
|
+
}
|
|
107
|
+
else if (message.type === 'execute_lifecycle' && 'data' in message) {
|
|
108
|
+
console.log(`${prefix} Method: ${message.data.method}`);
|
|
109
|
+
}
|
|
110
|
+
else if (message.type === 'error' && 'data' in message) {
|
|
111
|
+
console.log(`${prefix} Error: ${message.data.error}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
exports.logIPCMessage = logIPCMessage;
|
|
115
|
+
/**
|
|
116
|
+
* Create a pending request tracker
|
|
117
|
+
*/
|
|
118
|
+
function createPendingRequest(id, type, resolve, reject, timeoutMs = 30000) {
|
|
119
|
+
return {
|
|
120
|
+
id,
|
|
121
|
+
type,
|
|
122
|
+
startTime: Date.now(),
|
|
123
|
+
resolve,
|
|
124
|
+
reject,
|
|
125
|
+
timeout: undefined // Will be set by caller
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
exports.createPendingRequest = createPendingRequest;
|
|
129
|
+
/**
|
|
130
|
+
* Clean up a pending request and its timeout
|
|
131
|
+
*/
|
|
132
|
+
function cleanupPendingRequest(request) {
|
|
133
|
+
if (request.timeout) {
|
|
134
|
+
clearTimeout(request.timeout);
|
|
135
|
+
request.timeout = undefined;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
exports.cleanupPendingRequest = cleanupPendingRequest;
|
|
139
|
+
/**
|
|
140
|
+
* Convert error to serializable format for IPC
|
|
141
|
+
*/
|
|
142
|
+
function serializeError(error) {
|
|
143
|
+
if (error instanceof Error) {
|
|
144
|
+
return {
|
|
145
|
+
message: error.message,
|
|
146
|
+
stack: error.stack,
|
|
147
|
+
name: error.name
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
return {
|
|
152
|
+
message: String(error)
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
exports.serializeError = serializeError;
|
|
157
|
+
/**
|
|
158
|
+
* Convert serialized error back to Error object
|
|
159
|
+
*/
|
|
160
|
+
function deserializeError(errorData) {
|
|
161
|
+
const error = new Error(errorData.message);
|
|
162
|
+
if (errorData.stack) {
|
|
163
|
+
error.stack = errorData.stack;
|
|
164
|
+
}
|
|
165
|
+
if (errorData.name) {
|
|
166
|
+
error.name = errorData.name;
|
|
167
|
+
}
|
|
168
|
+
return error;
|
|
169
|
+
}
|
|
170
|
+
exports.deserializeError = deserializeError;
|
|
171
|
+
/**
|
|
172
|
+
* Check if IPC connection is healthy
|
|
173
|
+
*/
|
|
174
|
+
function isConnectionHealthy(connection, maxIdleTime = 300000) {
|
|
175
|
+
return (connection.process &&
|
|
176
|
+
!connection.process.killed &&
|
|
177
|
+
connection.ready &&
|
|
178
|
+
(Date.now() - connection.lastActivity) < maxIdleTime);
|
|
179
|
+
}
|
|
180
|
+
exports.isConnectionHealthy = isConnectionHealthy;
|
|
181
|
+
/**
|
|
182
|
+
* Constants for IPC configuration
|
|
183
|
+
*/
|
|
184
|
+
exports.IPC_CONFIG = {
|
|
185
|
+
DEFAULT_TIMEOUT: 30000,
|
|
186
|
+
MAX_IDLE_TIME: 300000,
|
|
187
|
+
HEARTBEAT_INTERVAL: 60000,
|
|
188
|
+
MAX_MESSAGE_SIZE: 10 * 1024 * 1024,
|
|
189
|
+
RETRY_ATTEMPTS: 3,
|
|
190
|
+
RETRY_DELAY: 1000 // 1 second
|
|
191
|
+
};
|
|
192
|
+
//# sourceMappingURL=local-engine-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-engine-utils.js","sourceRoot":"","sources":["../../../src/local_engine/local-engine-utils.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,mCAAoC;AAUpC;;GAEG;AACH,SAAgB,iBAAiB;IAC/B,OAAO,IAAA,mBAAU,GAAE,CAAC;AACtB,CAAC;AAFD,8CAEC;AAED;;GAEG;AACH,SAAgB,iBAAiB,CAAC,IAAY;IAC5C,OAAO;QACL,EAAE,EAAE,iBAAiB,EAAE;QACvB,IAAI;QACJ,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;KACtB,CAAC;AACJ,CAAC;AAND,8CAMC;AAED;;GAEG;AACH,SAAgB,eAAe,CAAC,OAAY;IAC1C,OAAO,CACL,OAAO,OAAO,KAAK,QAAQ;QAC3B,OAAO,KAAK,IAAI;QAChB,OAAO,OAAO,CAAC,EAAE,KAAK,QAAQ;QAC9B,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ;QAChC,OAAO,OAAO,CAAC,SAAS,KAAK,QAAQ,CACtC,CAAC;AACJ,CAAC;AARD,0CAQC;AAED;;GAEG;AACH,SAAgB,cAAc,CAAC,OAA6B,EAAE,OAAwB;IACpF,IAAI;QACF,IAAI,OAAO,CAAC,IAAI,EAAE;YAChB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC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U,CAAC,OAAO,CAAC,MAAM;QAC1B,UAAU,CAAC,KAAK;QAChB,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC,YAAY,CAAC,GAAG,WAAW,CACrD,CAAC;AACJ,CAAC;AAPD,kDAOC;AAED;;GAEG;AACU,QAAA,UAAU,GAAG;IACxB,eAAe,EAAE,KAAK;IACtB,aAAa,EAAE,MAAM;IACrB,kBAAkB,EAAE,KAAK;IACzB,gBAAgB,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI;IAClC,cAAc,EAAE,CAAC;IACjB,WAAW,EAAE,IAAI,CAAC,WAAW;CACrB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local Engine - SDK Configuration
|
|
3
|
+
*
|
|
4
|
+
* This file runs inside the app's Node.js process and configures the app's SDK instance
|
|
5
|
+
* for local testing. It uses dynamic require() calls to load the SDK from the app's
|
|
6
|
+
* node_modules, ensuring the same module instance is used by both this configuration
|
|
7
|
+
* code and the app's lifecycle code.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Configure SDKs for local testing environment using the app's SDK instance
|
|
11
|
+
*
|
|
12
|
+
* @param app - App configuration object
|
|
13
|
+
* @param settingsStore - Local settings store instance
|
|
14
|
+
* @param appPath - Path to the app directory (used to resolve app's node_modules)
|
|
15
|
+
* @param installId - Mock install ID for local testing
|
|
16
|
+
* @param configStore - Local config store instance for GUID management
|
|
17
|
+
*/
|
|
18
|
+
export declare function configureLocalSDKs(app: any, settingsStore: any, appPath: string, installId?: number, configStore?: any): {
|
|
19
|
+
success: boolean;
|
|
20
|
+
error?: undefined;
|
|
21
|
+
} | {
|
|
22
|
+
success: boolean;
|
|
23
|
+
error: any;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Clean up SDK configuration after app execution
|
|
27
|
+
*
|
|
28
|
+
* @param appPath - Path to the app directory (used to resolve app's node_modules)
|
|
29
|
+
*/
|
|
30
|
+
export declare function cleanUpLocalSDKs(appPath: string): void;
|
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Local Engine - SDK Configuration
|
|
4
|
+
*
|
|
5
|
+
* This file runs inside the app's Node.js process and configures the app's SDK instance
|
|
6
|
+
* for local testing. It uses dynamic require() calls to load the SDK from the app's
|
|
7
|
+
* node_modules, ensuring the same module instance is used by both this configuration
|
|
8
|
+
* code and the app's lifecycle code.
|
|
9
|
+
*/
|
|
10
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
11
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.cleanUpLocalSDKs = exports.configureLocalSDKs = void 0;
|
|
15
|
+
const path_1 = __importDefault(require("path"));
|
|
16
|
+
const LocalKVStore_1 = require("./storage/LocalKVStore");
|
|
17
|
+
const LocalSecretsStore_1 = require("./storage/LocalSecretsStore");
|
|
18
|
+
const LocalNotifier_1 = require("./LocalNotifier");
|
|
19
|
+
/**
|
|
20
|
+
* Mock implementation of BaseKVStore for stores we don't need in local testing
|
|
21
|
+
*/
|
|
22
|
+
class MockKVStore {
|
|
23
|
+
async get(key, fields) {
|
|
24
|
+
console.warn(`MockKVStore: get(${key}, ${fields || 'all'}) called - returning empty object`);
|
|
25
|
+
return {};
|
|
26
|
+
}
|
|
27
|
+
async put(key, value) {
|
|
28
|
+
console.warn(`MockKVStore: put(${key}, ${JSON.stringify(value)}) called - no-op`);
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
async patch(key, value) {
|
|
32
|
+
console.warn(`MockKVStore: patch(${key}, ${JSON.stringify(value)}) called - returning empty object`);
|
|
33
|
+
return {};
|
|
34
|
+
}
|
|
35
|
+
async delete(key, fields) {
|
|
36
|
+
console.warn(`MockKVStore: delete(${key}, ${fields || 'all'}) called - no-op`);
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
async exists(key) {
|
|
40
|
+
console.warn(`MockKVStore: exists(${key}) called - returning false`);
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Wrapper to make LocalSettingsStore compatible with BaseKVStore interface
|
|
46
|
+
*/
|
|
47
|
+
class LocalSettingsStoreWrapper {
|
|
48
|
+
constructor(settingsStore) {
|
|
49
|
+
this.settingsStore = settingsStore;
|
|
50
|
+
}
|
|
51
|
+
async get(key, fields) {
|
|
52
|
+
console.log(`[LocalSettingsStoreWrapper] GET request: key="${key}", fields=${JSON.stringify(fields)}`);
|
|
53
|
+
try {
|
|
54
|
+
// For settings store, key is typically a section name
|
|
55
|
+
const sectionSettings = this.settingsStore.getSectionSettings(key);
|
|
56
|
+
if (fields && fields.length > 0) {
|
|
57
|
+
// Return only requested fields
|
|
58
|
+
const filteredSettings = {};
|
|
59
|
+
fields.forEach((field) => {
|
|
60
|
+
if (sectionSettings[field] !== undefined) {
|
|
61
|
+
filteredSettings[field] = sectionSettings[field];
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
console.log(`[LocalSettingsStoreWrapper] GET result: key="${key}" -> ${JSON.stringify(filteredSettings)}`);
|
|
65
|
+
return filteredSettings;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
// Return all settings for the section
|
|
69
|
+
console.log(`[LocalSettingsStoreWrapper] GET result: key="${key}" -> ${JSON.stringify(sectionSettings)}`);
|
|
70
|
+
return sectionSettings;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
console.warn(`[LocalSettingsStoreWrapper] GET failed: key="${key}":`, error);
|
|
75
|
+
return {};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
async put(key, value) {
|
|
79
|
+
console.log(`[LocalSettingsStoreWrapper] PUT request: key="${key}", value=${JSON.stringify(value)}`);
|
|
80
|
+
try {
|
|
81
|
+
// Store the entire value object for the section
|
|
82
|
+
this.settingsStore.updateSectionSettings(key, value);
|
|
83
|
+
console.log(`[LocalSettingsStoreWrapper] PUT completed: updated entire section "${key}"`);
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
console.warn(`[LocalSettingsStoreWrapper] PUT failed: key="${key}", value=${JSON.stringify(value)}:`, error);
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
async patch(key, value) {
|
|
92
|
+
console.log(`[LocalSettingsStoreWrapper] PATCH request: key="${key}", value=${JSON.stringify(value)}`);
|
|
93
|
+
try {
|
|
94
|
+
const currentSettings = this.settingsStore.getSectionSettings(key);
|
|
95
|
+
// Update only the specified fields
|
|
96
|
+
this.settingsStore.updateSectionSettings(key, value);
|
|
97
|
+
console.log(`[LocalSettingsStoreWrapper] PATCH completed: updated fields in section "${key}"`);
|
|
98
|
+
return currentSettings;
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
console.warn(`[LocalSettingsStoreWrapper] PATCH failed: key="${key}", value=${JSON.stringify(value)}:`, error);
|
|
102
|
+
return {};
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
async delete(key, fields) {
|
|
106
|
+
console.log(`[LocalSettingsStoreWrapper] DELETE request: key="${key}", fields=${JSON.stringify(fields)}`);
|
|
107
|
+
try {
|
|
108
|
+
if (fields && fields.length > 0) {
|
|
109
|
+
// Delete specific fields
|
|
110
|
+
const currentSettings = this.settingsStore.getSectionSettings(key);
|
|
111
|
+
fields.forEach((field) => {
|
|
112
|
+
delete currentSettings[field];
|
|
113
|
+
});
|
|
114
|
+
this.settingsStore.updateSectionSettings(key, currentSettings);
|
|
115
|
+
console.log(`[LocalSettingsStoreWrapper] DELETE completed: removed fields ${JSON.stringify(fields)} from section "${key}"`);
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
// Clear the entire section
|
|
119
|
+
this.settingsStore.updateSectionSettings(key, {});
|
|
120
|
+
console.log(`[LocalSettingsStoreWrapper] DELETE completed: cleared entire section "${key}"`);
|
|
121
|
+
}
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
console.warn(`[LocalSettingsStoreWrapper] DELETE failed: key="${key}", fields=${JSON.stringify(fields)}:`, error);
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
async exists(key) {
|
|
130
|
+
console.log(`[LocalSettingsStoreWrapper] EXISTS request: key="${key}"`);
|
|
131
|
+
try {
|
|
132
|
+
const sectionSettings = this.settingsStore.getSectionSettings(key);
|
|
133
|
+
const exists = Object.keys(sectionSettings).length > 0;
|
|
134
|
+
console.log(`[LocalSettingsStoreWrapper] EXISTS result: key="${key}" -> ${exists}`);
|
|
135
|
+
return exists;
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
console.warn(`[LocalSettingsStoreWrapper] EXISTS failed: key="${key}":`, error);
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Wrapper to make LocalSecretsStore compatible with BaseKVStore interface
|
|
145
|
+
*/
|
|
146
|
+
class LocalSecretsStoreWrapper {
|
|
147
|
+
constructor(secretsStore) {
|
|
148
|
+
this.secretsStore = secretsStore;
|
|
149
|
+
}
|
|
150
|
+
async get(key, fields) {
|
|
151
|
+
try {
|
|
152
|
+
// For secrets store, key is typically a section name
|
|
153
|
+
const sectionSecrets = this.secretsStore.getSectionSecrets(key);
|
|
154
|
+
if (fields && fields.length > 0) {
|
|
155
|
+
// Return only requested fields
|
|
156
|
+
const filteredSecrets = {};
|
|
157
|
+
fields.forEach((field) => {
|
|
158
|
+
if (sectionSecrets[field] !== undefined) {
|
|
159
|
+
filteredSecrets[field] = sectionSecrets[field];
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
return filteredSecrets;
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
// Return all secrets for the section
|
|
166
|
+
return sectionSecrets;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
console.warn(`[LocalSecretsStoreWrapper] GET failed: key="${key}":`, error);
|
|
171
|
+
return {};
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
async put(key, value) {
|
|
175
|
+
try {
|
|
176
|
+
// Store the entire value object for the section
|
|
177
|
+
this.secretsStore.updateSectionSecrets(key, value);
|
|
178
|
+
return true;
|
|
179
|
+
}
|
|
180
|
+
catch (error) {
|
|
181
|
+
console.warn(`[LocalSecretsStoreWrapper] PUT failed: key="${key}", value=${JSON.stringify(value)}:`, error);
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
async patch(key, value) {
|
|
186
|
+
try {
|
|
187
|
+
const currentSecrets = this.secretsStore.getSectionSecrets(key);
|
|
188
|
+
// Update only the specified fields
|
|
189
|
+
this.secretsStore.updateSectionSecrets(key, value);
|
|
190
|
+
return currentSecrets;
|
|
191
|
+
}
|
|
192
|
+
catch (error) {
|
|
193
|
+
console.warn(`[LocalSecretsStoreWrapper] PATCH failed: key="${key}", value=${JSON.stringify(value)}:`, error);
|
|
194
|
+
return {};
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
async delete(key, fields) {
|
|
198
|
+
try {
|
|
199
|
+
if (fields && fields.length > 0) {
|
|
200
|
+
// Delete specific fields
|
|
201
|
+
this.secretsStore.deleteSecretFields(key, fields);
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
// Clear the entire section
|
|
205
|
+
this.secretsStore.updateSectionSecrets(key, {});
|
|
206
|
+
}
|
|
207
|
+
return true;
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
console.warn(`[LocalSecretsStoreWrapper] DELETE failed: key="${key}", fields=${JSON.stringify(fields)}:`, error);
|
|
211
|
+
return true;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
async exists(key) {
|
|
215
|
+
try {
|
|
216
|
+
return this.secretsStore.hasSectionSecrets(key);
|
|
217
|
+
}
|
|
218
|
+
catch (error) {
|
|
219
|
+
console.warn(`[LocalSecretsStoreWrapper] EXISTS failed: key="${key}":`, error);
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Mock notifier for local testing
|
|
226
|
+
*/
|
|
227
|
+
class MockNotifier {
|
|
228
|
+
async notify(message) {
|
|
229
|
+
console.warn('MockNotifier: notify called -', message);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Local implementation of FunctionApi that returns URLs pointing to the local test server
|
|
234
|
+
*/
|
|
235
|
+
class LocalFunctionApi {
|
|
236
|
+
constructor(appPath, appManifest, configStore, baseUrl = 'http://localhost:3000') {
|
|
237
|
+
this.appPath = appPath;
|
|
238
|
+
this.baseUrl = baseUrl;
|
|
239
|
+
this.appManifest = appManifest;
|
|
240
|
+
this.configStore = configStore;
|
|
241
|
+
}
|
|
242
|
+
async getEndpoints(installId) {
|
|
243
|
+
const actualInstallId = installId || 1;
|
|
244
|
+
// Get non-global functions from app manifest
|
|
245
|
+
const functions = this.appManifest.functions || {};
|
|
246
|
+
const endpoints = {};
|
|
247
|
+
Object.entries(functions).forEach(([functionKey, functionDef]) => {
|
|
248
|
+
// Only include non-global functions
|
|
249
|
+
if (!functionDef.global) {
|
|
250
|
+
// Get GUID for this function from config store
|
|
251
|
+
const guid = this.configStore.getFunctionGuid(functionKey);
|
|
252
|
+
const appId = this.appManifest.meta.app_id;
|
|
253
|
+
endpoints[functionKey] = `${this.baseUrl}/functions/${appId}/${functionKey}/${guid}`;
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
console.log(`[LocalFunctionApi] Generated non-global endpoints for install ${actualInstallId}:`, endpoints);
|
|
257
|
+
return endpoints;
|
|
258
|
+
}
|
|
259
|
+
async getGlobalEndpoints() {
|
|
260
|
+
// Get global functions from app manifest
|
|
261
|
+
const functions = this.appManifest.functions || {};
|
|
262
|
+
const endpoints = {};
|
|
263
|
+
Object.entries(functions).forEach(([functionKey, functionDef]) => {
|
|
264
|
+
// Only include global functions
|
|
265
|
+
if (functionDef.global) {
|
|
266
|
+
const appId = this.appManifest.meta.app_id;
|
|
267
|
+
// Global functions don't have GUID in the path
|
|
268
|
+
endpoints[functionKey] = `${this.baseUrl}/functions/${appId}/${functionKey}`;
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
console.log(`[LocalFunctionApi] Generated global endpoints:`, endpoints);
|
|
272
|
+
return endpoints;
|
|
273
|
+
}
|
|
274
|
+
getAuthorizationGrantUrl() {
|
|
275
|
+
const grantUrl = `${this.baseUrl}/auth/grant`;
|
|
276
|
+
console.log(`[LocalFunctionApi] Generated authorization grant URL:`, grantUrl);
|
|
277
|
+
return grantUrl;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Configure SDKs for local testing environment using the app's SDK instance
|
|
282
|
+
*
|
|
283
|
+
* @param app - App configuration object
|
|
284
|
+
* @param settingsStore - Local settings store instance
|
|
285
|
+
* @param appPath - Path to the app directory (used to resolve app's node_modules)
|
|
286
|
+
* @param installId - Mock install ID for local testing
|
|
287
|
+
* @param configStore - Local config store instance for GUID management
|
|
288
|
+
*/
|
|
289
|
+
function configureLocalSDKs(app, settingsStore, appPath, installId = 1, configStore) {
|
|
290
|
+
const { app_id, display_name, version, vendor } = app.manifest.meta;
|
|
291
|
+
// Dynamically load the SDK from the app's node_modules to ensure we use the same instance
|
|
292
|
+
const appSdkPath = path_1.default.join(appPath, 'node_modules', '@zaiusinc/app-sdk');
|
|
293
|
+
try {
|
|
294
|
+
const App = require(appSdkPath);
|
|
295
|
+
const { initializeStores, LogLevel, setNotifier, initializeFunctionApi } = require(appSdkPath);
|
|
296
|
+
// Configure the app SDK context (similar to production)
|
|
297
|
+
App.setContext({
|
|
298
|
+
manifest: app.manifest,
|
|
299
|
+
trackerId: 'local-testing-tracker',
|
|
300
|
+
installId: installId
|
|
301
|
+
});
|
|
302
|
+
// Set up logging context
|
|
303
|
+
const logContext = {
|
|
304
|
+
app_id,
|
|
305
|
+
app_version: version,
|
|
306
|
+
tracker_id: 'local-testing-tracker',
|
|
307
|
+
install_id: installId,
|
|
308
|
+
entry_point: 'local-testing',
|
|
309
|
+
request_id: `local-${Date.now()}`
|
|
310
|
+
};
|
|
311
|
+
App.setLogContext(logContext);
|
|
312
|
+
App.setLogLevel(LogLevel.Debug); // Use debug level for local testing
|
|
313
|
+
// Initialize stores with local implementations
|
|
314
|
+
const secretsStore = LocalSecretsStore_1.LocalSecretsStore.getInstance(appPath);
|
|
315
|
+
initializeStores({
|
|
316
|
+
settings: new LocalSettingsStoreWrapper(settingsStore),
|
|
317
|
+
secrets: new LocalSecretsStoreWrapper(secretsStore),
|
|
318
|
+
kvStore: LocalKVStore_1.LocalKVStore.getInstance(appPath),
|
|
319
|
+
sharedKvStore: LocalKVStore_1.LocalKVStore.getInstance(appPath, 'shared-kvstore.json') // Shared KV store with disk persistence
|
|
320
|
+
});
|
|
321
|
+
// Set up local notifier
|
|
322
|
+
const localNotifier = new LocalNotifier_1.LocalNotifier(appPath);
|
|
323
|
+
setNotifier(localNotifier);
|
|
324
|
+
// Initialize function API with local implementation
|
|
325
|
+
if (configStore) {
|
|
326
|
+
const localFunctionApi = new LocalFunctionApi(appPath, app.manifest, configStore);
|
|
327
|
+
initializeFunctionApi(localFunctionApi);
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
console.warn('[LocalSDKConfig] Config store not provided, skipping function API initialization');
|
|
331
|
+
}
|
|
332
|
+
console.log(`Configured local SDKs for app: ${display_name} v${version} (${app_id})`);
|
|
333
|
+
return { success: true };
|
|
334
|
+
}
|
|
335
|
+
catch (error) {
|
|
336
|
+
console.error(`Failed to configure local SDKs: ${error.message}`);
|
|
337
|
+
console.error(`Attempted to load SDK from: ${appSdkPath}`);
|
|
338
|
+
return { success: false, error: error.message };
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
exports.configureLocalSDKs = configureLocalSDKs;
|
|
342
|
+
/**
|
|
343
|
+
* Clean up SDK configuration after app execution
|
|
344
|
+
*
|
|
345
|
+
* @param appPath - Path to the app directory (used to resolve app's node_modules)
|
|
346
|
+
*/
|
|
347
|
+
function cleanUpLocalSDKs(appPath) {
|
|
348
|
+
try {
|
|
349
|
+
// Dynamically load the SDK from the app's node_modules
|
|
350
|
+
const appSdkPath = path_1.default.join(appPath, 'node_modules', '@zaiusinc/app-sdk');
|
|
351
|
+
const App = require(appSdkPath);
|
|
352
|
+
const { initializeStores, LogLevel, setNotifier } = require(appSdkPath);
|
|
353
|
+
// Reset to default/unknown context
|
|
354
|
+
App.setContext({
|
|
355
|
+
manifest: {
|
|
356
|
+
meta: {
|
|
357
|
+
app_id: 'unknown',
|
|
358
|
+
display_name: 'unknown',
|
|
359
|
+
version: '0.0.0',
|
|
360
|
+
vendor: 'unknown',
|
|
361
|
+
support_url: '',
|
|
362
|
+
summary: '',
|
|
363
|
+
contact_email: '',
|
|
364
|
+
categories: [],
|
|
365
|
+
availability: [],
|
|
366
|
+
},
|
|
367
|
+
runtime: 'node18'
|
|
368
|
+
},
|
|
369
|
+
trackerId: 'unknown',
|
|
370
|
+
installId: -1
|
|
371
|
+
});
|
|
372
|
+
App.setLogContext({
|
|
373
|
+
app_id: 'unknown',
|
|
374
|
+
app_version: '0.0.0'
|
|
375
|
+
});
|
|
376
|
+
App.setLogLevel(LogLevel.Info);
|
|
377
|
+
// Reset stores to disabled state
|
|
378
|
+
initializeStores({
|
|
379
|
+
settings: new MockKVStore(),
|
|
380
|
+
secrets: new MockKVStore(),
|
|
381
|
+
kvStore: new MockKVStore(),
|
|
382
|
+
sharedKvStore: new MockKVStore()
|
|
383
|
+
});
|
|
384
|
+
setNotifier(new MockNotifier());
|
|
385
|
+
console.log('Cleaned up local SDKs');
|
|
386
|
+
}
|
|
387
|
+
catch (error) {
|
|
388
|
+
console.warn(`Error during SDK cleanup: ${error.message}`);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
exports.cleanUpLocalSDKs = cleanUpLocalSDKs;
|
|
392
|
+
//# sourceMappingURL=localSDKConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localSDKConfig.js","sourceRoot":"","sources":["../../../src/local_engine/localSDKConfig.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;AAEH,gDAAwB;AACxB,yDAAsD;AACtD,mEAAgE;AAChE,mDAAgD;AAGhD;;GAEG;AACH,MAAM,WAAW;IACf,KAAK,CAAC,GAAG,CAAC,GAAW,EAAE,MAAiB;QACtC,OAAO,CAAC,IAAI,CAAC,oBAAoB,GAAG,KAAK,MAAM,IAAI,KAAK,mCAAmC,CAAC,CAAC;QAC7F,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,GAAW,EAAE,KAAU;QAC/B,OAAO,CAAC,IAAI,CAAC,oBAAoB,GAAG,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;QAClF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,GAAW,EAAE,KAAU;QACjC,OAAO,CAAC,IAAI,CAAC,sBAAsB,GAAG,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACrG,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAW,EAAE,MAAiB;QACzC,OAAO,CAAC,IAAI,CAAC,uBAAuB,GAAG,KAAK,MAAM,IAAI,KAAK,kBAAkB,CAAC,CAAC;QAC/E,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAW;QACtB,OAAO,CAAC,IAAI,C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