codeapp-js 0.1.1 → 0.2.2
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/codeApp/dist/codeapp.js +552 -78
- package/codeApp/dist/power-apps-data.js +2531 -2531
- package/dev files/outlook.js +218 -9
- package/examples/combined demo/dist/codeapp.js +1098 -0
- package/examples/combined demo/dist/index.js +69 -114
- package/examples/combined demo/dist/power-apps-data.js +646 -170
- package/examples/combined demo/power.config.json +42 -42
- package/examples/dataverse Demo/dist/codeapp.js +1085 -0
- package/examples/dataverse Demo/dist/index.html +54 -54
- package/examples/dataverse Demo/dist/index.js +82 -70
- package/examples/dataverse Demo/dist/power-apps-data.js +551 -170
- package/examples/dataverse Demo/power.config.json +34 -34
- package/examples/dataverse Demo/readme.md +79 -79
- package/examples/groups Demo/dist/codeapp.js +1085 -0
- package/examples/groups Demo/dist/index.js +27 -27
- package/examples/groups Demo/dist/power-apps-data.js +551 -170
- package/examples/kanban/dist/dataverse.js +94 -94
- package/examples/kanban/dist/environmentVar.js +55 -55
- package/examples/kanban/dist/office365groups.js +97 -97
- package/examples/kanban/dist/office365users.js +169 -169
- package/examples/kanban/dist/outlook.js +162 -162
- package/examples/kanban/dist/power-apps-data.js +560 -138
- package/examples/kanban/dist/sharepoint.js +339 -339
- package/examples/myProfile/dist/index.html +184 -184
- package/examples/myProfile/dist/index.js +141 -141
- package/examples/myProfile/dist/office365users.js +169 -169
- package/examples/myProfile/dist/power-apps-data.js +560 -138
- package/examples/myProfile/power.config.json +22 -22
- package/examples/myProfile/readme.md +79 -79
- package/examples/outlook Demo/dist/codeapp.js +1085 -0
- package/examples/outlook Demo/dist/index.html +35 -35
- package/examples/outlook Demo/dist/index.js +170 -166
- package/examples/outlook Demo/dist/outlook.js +121 -121
- package/examples/outlook Demo/dist/power-apps-data.js +551 -170
- package/examples/outlook Demo/dist/styles.css +84 -84
- package/examples/outlook Demo/readme.md +82 -82
- package/examples/outlook Demo2/OutlookDemo_1_0_0_1.zip +0 -0
- package/examples/outlook Demo2/agent/decision-log.md +7 -0
- package/examples/outlook Demo2/dist/codeapp.js +1334 -0
- package/examples/outlook Demo2/dist/icon-512.png +0 -0
- package/examples/outlook Demo2/dist/index.html +98 -0
- package/examples/outlook Demo2/dist/index.js +346 -0
- package/examples/outlook Demo2/dist/power-apps-data.js +3007 -0
- package/examples/outlook Demo2/dist/styles.css +639 -0
- package/examples/outlook Demo2/power.config.json +23 -0
- package/examples/outlook Demo2/src/generated/index.ts +14 -0
- package/examples/outlook Demo2/src/generated/models/Office365GroupsModel.ts +363 -0
- package/examples/outlook Demo2/src/generated/models/Office365OutlookModel.ts +2046 -0
- package/examples/outlook Demo2/src/generated/models/Office365UsersModel.ts +254 -0
- package/examples/outlook Demo2/src/generated/services/Office365GroupsService.ts +326 -0
- package/examples/outlook Demo2/src/generated/services/Office365OutlookService.ts +2476 -0
- package/examples/outlook Demo2/src/generated/services/Office365UsersService.ts +358 -0
- package/examples/planning Poker/.vscode/settings.json +4 -4
- package/examples/planning Poker/additional files/customizations (tables).xml +6428 -6428
- package/examples/planning Poker/additional files/dataverse-tables.json +165 -165
- package/examples/planning Poker/additional files/readme.md +122 -122
- package/examples/planning Poker/dist/dataverse.js +78 -78
- package/examples/planning Poker/dist/index.html +198 -198
- package/examples/planning Poker/dist/index.js +954 -954
- package/examples/planning Poker/dist/power-apps-data.js +560 -138
- package/examples/planning Poker/dist/styles.css +815 -815
- package/examples/sharePoint Demo/agent/decision-log.md +5 -5
- package/examples/sharePoint Demo/dist/codeapp.js +1085 -0
- package/examples/sharePoint Demo/dist/index.js +44 -51
- package/examples/sharePoint Demo/dist/power-apps-data.js +551 -170
- package/examples/sharePoint Demo/power.config.json +22 -22
- package/examples/solution explorer/agent/decision-log.md +27 -0
- package/examples/solution explorer/agent/mockup-01-swiss-grid.html +452 -0
- package/examples/solution explorer/agent/mockup-02-dark-glass.html +496 -0
- package/examples/solution explorer/agent/mockup-03-paper-console.html +510 -0
- package/examples/solution explorer/agent/mockup-04-neon-noir.html +546 -0
- package/examples/solution explorer/agent/mockup-05-zen-garden.html +534 -0
- package/examples/solution explorer/dist/codeapp.js +1098 -0
- package/examples/solution explorer/dist/icon-512.png +0 -0
- package/examples/solution explorer/dist/index.html +80 -0
- package/examples/solution explorer/dist/index.js +735 -0
- package/examples/solution explorer/dist/power-apps-data.js +3007 -0
- package/examples/solution explorer/dist/styles.css +571 -0
- package/examples/solution explorer/power.config.json +151 -0
- package/examples/todo/dist/dataverse.js +64 -64
- package/examples/todo/dist/index.html +75 -75
- package/examples/todo/dist/index.js +8 -8
- package/examples/todo/dist/power-apps-data.js +560 -138
- package/examples/todo/dist/renderer.js +375 -375
- package/examples/todo/dist/styles.css +691 -691
- package/examples/todo/power.config.json +34 -34
- package/package.json +1 -8
- package/docs-mockups/atelier/index.html +0 -120
- package/docs-mockups/atelier/script.js +0 -23
- package/docs-mockups/atelier/styles.css +0 -361
- package/docs-mockups/field-guide/index.html +0 -112
- package/docs-mockups/field-guide/script.js +0 -20
- package/docs-mockups/field-guide/styles.css +0 -272
- package/docs-mockups/index.html +0 -80
- package/docs-mockups/maker-hub/index.html +0 -178
- package/docs-mockups/maker-hub/script.js +0 -20
- package/docs-mockups/maker-hub/styles.css +0 -404
- package/docs-mockups/script.js +0 -26
- package/docs-mockups/signal/index.html +0 -146
- package/docs-mockups/signal/script.js +0 -20
- package/docs-mockups/signal/styles.css +0 -314
- package/docs-mockups/styles.css +0 -287
- package/examples/combined demo/dist/dataverse.js +0 -86
- package/examples/combined demo/dist/environmentVar.js +0 -55
- package/examples/combined demo/dist/office365groups.js +0 -97
- package/examples/combined demo/dist/office365users.js +0 -169
- package/examples/combined demo/dist/outlook.js +0 -162
- package/examples/combined demo/dist/sharepoint.js +0 -339
- package/examples/dataverse Demo/dist/dataverse.js +0 -86
- package/examples/groups Demo/dist/dataverse.js +0 -86
- package/examples/groups Demo/dist/environmentVar.js +0 -55
- package/examples/groups Demo/dist/office365groups.js +0 -97
- package/examples/groups Demo/dist/office365users.js +0 -169
- package/examples/groups Demo/dist/outlook.js +0 -162
- package/examples/groups Demo/dist/sharepoint.js +0 -339
- package/examples/sharePoint Demo/dist/dataverse.js +0 -94
- package/examples/sharePoint Demo/dist/environmentVar.js +0 -55
- package/examples/sharePoint Demo/dist/office365groups.js +0 -97
- package/examples/sharePoint Demo/dist/office365users.js +0 -169
- package/examples/sharePoint Demo/dist/outlook.js +0 -162
- package/examples/sharePoint Demo/dist/sharepoint.js +0 -339
|
@@ -1,8 +1,318 @@
|
|
|
1
|
+
/* power-apps-data.js - Standalone Power Apps SDK for Code Apps
|
|
2
|
+
Converted from @microsoft/power-apps v1.0.4
|
|
3
|
+
Zero dependencies - all code is self-contained */
|
|
1
4
|
var __defProp = Object.defineProperty;
|
|
2
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
6
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
var DefaultPowerAppsBridge = class {
|
|
9
|
+
constructor() {
|
|
10
|
+
__publicField(this, "_antiCSRFToken");
|
|
11
|
+
__publicField(this, "_callbacks", {});
|
|
12
|
+
__publicField(this, "_currentCallbackId", 0);
|
|
13
|
+
__publicField(this, "_instanceId", Date.now().toString());
|
|
14
|
+
__publicField(this, "_messageChannel", new window.MessageChannel());
|
|
15
|
+
__publicField(this, "_postMessageQueue", []);
|
|
16
|
+
__publicField(this, "_postMessageSource");
|
|
17
|
+
__publicField(this, "_handleMessageEvent", (messageEvent) => {
|
|
18
|
+
const message = messageEvent.data;
|
|
19
|
+
if (message && typeof message.isPluginCall === "boolean") {
|
|
20
|
+
if (message.isPluginCall) {
|
|
21
|
+
const callbackId = message.callbackId;
|
|
22
|
+
const status = message.status;
|
|
23
|
+
const args = message.args;
|
|
24
|
+
const keepCallback = message.keepCallback;
|
|
25
|
+
try {
|
|
26
|
+
const callback = this._callbacks[callbackId];
|
|
27
|
+
if (keepCallback) {
|
|
28
|
+
if (callback && callback.onUpdate) {
|
|
29
|
+
callback.onUpdate(message.args?.[0]);
|
|
30
|
+
}
|
|
31
|
+
} else {
|
|
32
|
+
if (callback) {
|
|
33
|
+
if (status === 1) {
|
|
34
|
+
callback.resolve(args[0]);
|
|
35
|
+
} else if (status !== 0) {
|
|
36
|
+
callback.reject(args);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (!keepCallback) {
|
|
40
|
+
delete this._callbacks[callbackId];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.error(error);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
} else if (message && message.messageType === "initCommunication") {
|
|
48
|
+
this._antiCSRFToken = message.antiCSRFToken;
|
|
49
|
+
this._postMessageSource = this._messageChannel.port1;
|
|
50
|
+
if (this._postMessageSource) {
|
|
51
|
+
for (let i = 0; i < this._postMessageQueue.length; i++) {
|
|
52
|
+
this._postMessageQueue[i].antiCSRFToken = this._antiCSRFToken;
|
|
53
|
+
this._postMessageSource.postMessage(this._postMessageQueue[i]);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
async initialize() {
|
|
60
|
+
this._messageChannel.port1.onmessage = this._handleMessageEvent;
|
|
61
|
+
window.parent.postMessage({
|
|
62
|
+
messageType: "initCommunicationWithPort",
|
|
63
|
+
instanceId: this._instanceId
|
|
64
|
+
}, "*", [this._messageChannel.port2]);
|
|
65
|
+
}
|
|
66
|
+
async executePluginAsync(pluginName, pluginAction, params = [], onUpdate) {
|
|
67
|
+
return new Promise((resolve, reject) => {
|
|
68
|
+
const callbackId = this._getCallbackId(pluginName);
|
|
69
|
+
this._callbacks[callbackId] = { resolve, reject, onUpdate };
|
|
70
|
+
this._sendMessage({
|
|
71
|
+
isPluginCall: true,
|
|
72
|
+
callbackId,
|
|
73
|
+
service: pluginName,
|
|
74
|
+
action: pluginAction,
|
|
75
|
+
actionArgs: params,
|
|
76
|
+
antiCSRFToken: this._antiCSRFToken
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
_sendMessage(message) {
|
|
81
|
+
if (!this._postMessageSource) {
|
|
82
|
+
this._postMessageQueue.push(message);
|
|
83
|
+
} else {
|
|
84
|
+
this._postMessageSource.postMessage(message);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
_getCallbackId(pluginName) {
|
|
88
|
+
return "instanceId=" + this._instanceId + "_" + pluginName + this._currentCallbackId++;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
var bridgePromise;
|
|
93
|
+
async function executePluginAsync(pluginName, pluginAction, params = [], update) {
|
|
94
|
+
const powerAppsBridge = await getBridge();
|
|
95
|
+
return powerAppsBridge.executePluginAsync(pluginName, pluginAction, params, update);
|
|
96
|
+
}
|
|
97
|
+
async function getBridge() {
|
|
98
|
+
if (!bridgePromise) {
|
|
99
|
+
bridgePromise = new Promise(async (resolve, reject) => {
|
|
100
|
+
try {
|
|
101
|
+
const bridge = window && window.powerAppsBridge ? window.powerAppsBridge : new DefaultPowerAppsBridge();
|
|
102
|
+
await bridge.initialize();
|
|
103
|
+
resolve(bridge);
|
|
104
|
+
} catch (error) {
|
|
105
|
+
reject(error);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return bridgePromise;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
var context;
|
|
113
|
+
async function getContext() {
|
|
114
|
+
if (context) {
|
|
115
|
+
return context;
|
|
116
|
+
}
|
|
117
|
+
context = await executePluginAsync("AppLifecycle", "getContext");
|
|
118
|
+
return context;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
var IncompatibleMessageReceiver = class {
|
|
122
|
+
constructor(versionInfo, incompatibilityDescription) {
|
|
123
|
+
__publicField(this, "versionInfo");
|
|
124
|
+
__publicField(this, "incompatibilityDescription");
|
|
125
|
+
__publicField(this, "isCompatible", false);
|
|
126
|
+
this.versionInfo = versionInfo;
|
|
127
|
+
this.incompatibilityDescription = incompatibilityDescription;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
var SendMessageOperation = class {
|
|
132
|
+
constructor(resultPromise, sendUpdate) {
|
|
133
|
+
__publicField(this, "resultPromise");
|
|
134
|
+
__publicField(this, "sendUpdate");
|
|
135
|
+
/**
|
|
136
|
+
* When completed is false onMessageReceived and sendUpdate will be visible.
|
|
137
|
+
* When completed is true then these are hidden.
|
|
138
|
+
*/
|
|
139
|
+
__publicField(this, "completed", false);
|
|
140
|
+
__publicField(this, "onMessageReceived");
|
|
141
|
+
this.resultPromise = resultPromise;
|
|
142
|
+
this.sendUpdate = sendUpdate;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
var CompatibleMessageReceiver = class {
|
|
147
|
+
constructor(_receiverName, versionInfo) {
|
|
148
|
+
__publicField(this, "_receiverName");
|
|
149
|
+
__publicField(this, "versionInfo");
|
|
150
|
+
__publicField(this, "isCompatible", true);
|
|
151
|
+
this._receiverName = _receiverName;
|
|
152
|
+
this.versionInfo = versionInfo;
|
|
153
|
+
}
|
|
154
|
+
async sendMessage(message, onMessageReceived) {
|
|
155
|
+
let resolveOperationPromise;
|
|
156
|
+
let rejectOperationPromise;
|
|
157
|
+
const operationPromise = new Promise((resolve, reject) => {
|
|
158
|
+
resolveOperationPromise = resolve;
|
|
159
|
+
rejectOperationPromise = reject;
|
|
160
|
+
});
|
|
161
|
+
const correlationId = crypto.randomUUID();
|
|
162
|
+
const handleMessage = (compatibleReceiverMessage) => {
|
|
163
|
+
try {
|
|
164
|
+
if (sendMessageOperation.completed) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (compatibleReceiverMessage) {
|
|
168
|
+
if (compatibleReceiverMessage.isUpdate) {
|
|
169
|
+
if (sendMessageOperation.onMessageReceived) {
|
|
170
|
+
try {
|
|
171
|
+
sendMessageOperation.onMessageReceived(compatibleReceiverMessage.message);
|
|
172
|
+
} catch (error) {
|
|
173
|
+
sendMessageOperation.completed = true;
|
|
174
|
+
rejectOperationPromise(error);
|
|
175
|
+
}
|
|
176
|
+
} else {
|
|
177
|
+
sendMessageOperation.completed = true;
|
|
178
|
+
rejectOperationPromise(new Error(`Native receiver expected a message handler, but no handler was supplied. Message: ${compatibleReceiverMessage.message}`));
|
|
179
|
+
}
|
|
180
|
+
} else {
|
|
181
|
+
sendMessageOperation.completed = true;
|
|
182
|
+
resolveOperationPromise(compatibleReceiverMessage.message);
|
|
183
|
+
}
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
} catch {
|
|
187
|
+
}
|
|
188
|
+
sendMessageOperation.completed = true;
|
|
189
|
+
resolveOperationPromise(compatibleReceiverMessage.message);
|
|
190
|
+
};
|
|
191
|
+
const handleError = (error) => {
|
|
192
|
+
sendMessageOperation.completed = true;
|
|
193
|
+
rejectOperationPromise(error);
|
|
194
|
+
};
|
|
195
|
+
const sendUpdate = (updateMessage) => {
|
|
196
|
+
if (sendMessageOperation.completed) {
|
|
197
|
+
throw new Error("Tried to send update for completed operation.");
|
|
198
|
+
}
|
|
199
|
+
executePluginAsync("SendMessagePlugin", "sendMessage", [
|
|
200
|
+
this._receiverName,
|
|
201
|
+
updateMessage,
|
|
202
|
+
correlationId
|
|
203
|
+
]);
|
|
204
|
+
};
|
|
205
|
+
const sendMessageOperation = new SendMessageOperation(operationPromise, sendUpdate);
|
|
206
|
+
sendMessageOperation.onMessageReceived = onMessageReceived;
|
|
207
|
+
try {
|
|
208
|
+
await executePluginAsync("SendMessagePlugin", "sendMessage", [this._receiverName, message, correlationId], (response) => {
|
|
209
|
+
handleMessage(response);
|
|
210
|
+
});
|
|
211
|
+
} catch (error) {
|
|
212
|
+
handleError(error);
|
|
213
|
+
}
|
|
214
|
+
return sendMessageOperation;
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
var SendMessage = class _SendMessage {
|
|
219
|
+
static createInstanceAsync() {
|
|
220
|
+
return Promise.resolve(new _SendMessage());
|
|
221
|
+
}
|
|
222
|
+
async getMessageReceiverAsync(receiverName, isCompatibleChecker) {
|
|
223
|
+
const versionInfo = await this._getVersionInfo(receiverName);
|
|
224
|
+
if (versionInfo) {
|
|
225
|
+
const compatibilityCheckerResult = isCompatibleChecker(versionInfo);
|
|
226
|
+
if (compatibilityCheckerResult.isCompatible === false) {
|
|
227
|
+
return new IncompatibleMessageReceiver(versionInfo, compatibilityCheckerResult.incompatibilityDescription || "");
|
|
228
|
+
} else {
|
|
229
|
+
return new CompatibleMessageReceiver(receiverName, versionInfo);
|
|
230
|
+
}
|
|
231
|
+
} else {
|
|
232
|
+
return new IncompatibleMessageReceiver(void 0, `No receiver ${receiverName} registered.`);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
async _getVersionInfo(receiverName) {
|
|
236
|
+
const result = await executePluginAsync("SendMessagePlugin", "getVersionInfo", [receiverName]);
|
|
237
|
+
return result;
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
var loggerInstance;
|
|
242
|
+
async function initializeLogger(logger) {
|
|
243
|
+
loggerInstance = logger;
|
|
244
|
+
const sendMessagePlugin = await SendMessage.createInstanceAsync();
|
|
245
|
+
const receiver = await sendMessagePlugin.getMessageReceiverAsync("PowerApps.AppMonitorReceiver", (versionInfo) => {
|
|
246
|
+
let isCompatible = false;
|
|
247
|
+
if (versionInfo === "1.0.0") {
|
|
248
|
+
isCompatible = true;
|
|
249
|
+
}
|
|
250
|
+
return { isCompatible };
|
|
251
|
+
});
|
|
252
|
+
if (receiver.isCompatible) {
|
|
253
|
+
await receiver.sendMessage("initialize", (message) => {
|
|
254
|
+
const parsedMessage = JSON.parse(message);
|
|
255
|
+
if (parsedMessage.metrics) {
|
|
256
|
+
for (const metric of parsedMessage.metrics) {
|
|
257
|
+
loggerInstance.logMetric?.(metric);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function getAppLoadedPerformanceData() {
|
|
265
|
+
const performanceApi = new PerformanceApi();
|
|
266
|
+
const perfData = {
|
|
267
|
+
appTimeOrigin: performanceApi.timeOrigin
|
|
268
|
+
};
|
|
269
|
+
const navigationTimingEntries = performanceApi.getEntriesByType("navigation");
|
|
270
|
+
const navigationTiming = navigationTimingEntries[0];
|
|
271
|
+
if (navigationTiming) {
|
|
272
|
+
perfData.appNavigateType = navigationTiming.type;
|
|
273
|
+
perfData.appNavigationStart = navigationTiming.startTime;
|
|
274
|
+
perfData.appNavigationDuration = navigationTiming.duration;
|
|
275
|
+
perfData.appEncodedBodySize = navigationTiming.encodedBodySize;
|
|
276
|
+
perfData.appNextHopProtocol = navigationTiming.nextHopProtocol;
|
|
277
|
+
perfData.appDomainLookupStart = navigationTiming.domainLookupStart;
|
|
278
|
+
perfData.appDomainLookupEnd = navigationTiming.domainLookupEnd;
|
|
279
|
+
perfData.appConnectStart = navigationTiming.connectStart;
|
|
280
|
+
perfData.appConnectEnd = navigationTiming.connectEnd;
|
|
281
|
+
perfData.appSecureConnectionStart = navigationTiming.secureConnectionStart;
|
|
282
|
+
perfData.appFetchStart = navigationTiming.fetchStart;
|
|
283
|
+
perfData.appRequestStart = navigationTiming.requestStart;
|
|
284
|
+
perfData.appResponseStart = navigationTiming.responseStart;
|
|
285
|
+
perfData.appResponseEnd = navigationTiming.responseEnd;
|
|
286
|
+
perfData.appLoadEventEnd = navigationTiming.loadEventEnd;
|
|
287
|
+
perfData.appDomInteractive = navigationTiming.domInteractive;
|
|
288
|
+
perfData.appDomContentLoadedEventStart = navigationTiming.domContentLoadedEventStart;
|
|
289
|
+
}
|
|
290
|
+
return perfData;
|
|
291
|
+
}
|
|
292
|
+
var PerformanceApi = class {
|
|
293
|
+
constructor(targetWindow = window) {
|
|
294
|
+
__publicField(this, "_performance");
|
|
295
|
+
this._performance = targetWindow.performance;
|
|
296
|
+
}
|
|
297
|
+
get timeOrigin() {
|
|
298
|
+
return this._performance?.timeOrigin;
|
|
299
|
+
}
|
|
300
|
+
getEntriesByType(type) {
|
|
301
|
+
if (!this._performance?.getEntriesByType) {
|
|
302
|
+
return [];
|
|
303
|
+
}
|
|
304
|
+
return this._performance.getEntriesByType(type);
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
executePluginAsync("AppLifecycle", "notifyAppSdkLoaded", [getAppLoadedPerformanceData()]);
|
|
309
|
+
|
|
310
|
+
function setConfig(config) {
|
|
311
|
+
if (config.logger) {
|
|
312
|
+
initializeLogger(config.logger);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
6
316
|
var HttpMethod;
|
|
7
317
|
(function(HttpMethod2) {
|
|
8
318
|
HttpMethod2["GET"] = "GET";
|
|
@@ -17,7 +327,6 @@ var DataSources;
|
|
|
17
327
|
DataSources2["Connector"] = "Connector";
|
|
18
328
|
})(DataSources || (DataSources = {}));
|
|
19
329
|
|
|
20
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/core/error/codes.js
|
|
21
330
|
var ErrorCodes;
|
|
22
331
|
(function(ErrorCodes2) {
|
|
23
332
|
ErrorCodes2["InitializationFailed"] = "PDR_INIT_FAILED";
|
|
@@ -44,7 +353,6 @@ var ErrorCodes;
|
|
|
44
353
|
ErrorCodes2["TokenAcquisitionFailed"] = "TOKEN_ACQUISITION_FAILED";
|
|
45
354
|
})(ErrorCodes || (ErrorCodes = {}));
|
|
46
355
|
|
|
47
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/core/error/messages.js
|
|
48
356
|
var UnknownErrorMessage = "An unknown error occurred";
|
|
49
357
|
var ErrorMessages = {
|
|
50
358
|
// PowerDataRuntime specific errors
|
|
@@ -93,12 +401,10 @@ var DataOperationErrorMessages;
|
|
|
93
401
|
DataOperationErrorMessages2["UpdateFailed"] = "Update operation failure";
|
|
94
402
|
})(DataOperationErrorMessages || (DataOperationErrorMessages = {}));
|
|
95
403
|
|
|
96
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/core/types/index.js
|
|
97
404
|
function isOperationResult(result) {
|
|
98
405
|
return result?.success !== void 0;
|
|
99
406
|
}
|
|
100
407
|
|
|
101
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/core/telemetry/log.js
|
|
102
408
|
var ServiceName = "PublishedAppTelemetry";
|
|
103
409
|
var TelemetryActionNames;
|
|
104
410
|
(function(TelemetryActionNames2) {
|
|
@@ -207,7 +513,6 @@ var _Log = class _Log {
|
|
|
207
513
|
__publicField(_Log, "_instance", null);
|
|
208
514
|
var Log = _Log;
|
|
209
515
|
|
|
210
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/core/error/types.js
|
|
211
516
|
var PowerDataRuntimeError = class extends Error {
|
|
212
517
|
/**
|
|
213
518
|
* Creates an instance of PowerDataRuntimeError.
|
|
@@ -228,7 +533,6 @@ var PowerDataRuntimeError = class extends Error {
|
|
|
228
533
|
}
|
|
229
534
|
};
|
|
230
535
|
|
|
231
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/core/error/constants.js
|
|
232
536
|
var HeaderNames;
|
|
233
537
|
(function(HeaderNames2) {
|
|
234
538
|
HeaderNames2["RequestId"] = "x-ms-client-request-id";
|
|
@@ -250,7 +554,6 @@ var ConnectorOperationName;
|
|
|
250
554
|
ConnectorOperationName2["RetrieveMultipleRecords"] = "connectorDataOperation.retrieveMultipleRecordsAsync";
|
|
251
555
|
})(ConnectorOperationName || (ConnectorOperationName = {}));
|
|
252
556
|
|
|
253
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/core/error/util.js
|
|
254
557
|
function getErrorMessage(error) {
|
|
255
558
|
if (typeof error === "string") {
|
|
256
559
|
return error;
|
|
@@ -300,7 +603,6 @@ function parseHttpPluginError(error) {
|
|
|
300
603
|
};
|
|
301
604
|
}
|
|
302
605
|
|
|
303
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/core/data/defaultOperationOrchestrator.js
|
|
304
606
|
var DefaultDataOperationOrchestrator = class {
|
|
305
607
|
// Static identifiers for services and actions
|
|
306
608
|
// Used to identify specific services and actions within the PowerApps environment
|
|
@@ -488,7 +790,6 @@ var DefaultDataOperationOrchestrator = class {
|
|
|
488
790
|
}
|
|
489
791
|
};
|
|
490
792
|
|
|
491
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/core/metadata/runtimeMetadataOperations.js
|
|
492
793
|
var RuntimeMetadataOperations = class {
|
|
493
794
|
// Static identifiers for services and actions
|
|
494
795
|
// Used to identify specific services and actions within the PowerApps environment
|
|
@@ -496,18 +797,18 @@ var RuntimeMetadataOperations = class {
|
|
|
496
797
|
__publicField(this, "_clientProvider");
|
|
497
798
|
this._clientProvider = _clientProvider;
|
|
498
799
|
}
|
|
499
|
-
async getConnections(
|
|
800
|
+
async getConnections(context2) {
|
|
500
801
|
const client = await this._clientProvider.getMetadataClientAsync();
|
|
501
|
-
const response = await client.getAppConnectionConfigsAsync(
|
|
802
|
+
const response = await client.getAppConnectionConfigsAsync(context2);
|
|
502
803
|
return {
|
|
503
804
|
success: response.success,
|
|
504
805
|
data: response.data ? [response.data] : [],
|
|
505
806
|
error: response.error
|
|
506
807
|
};
|
|
507
808
|
}
|
|
508
|
-
async getConnectionApis(_connectionId,
|
|
809
|
+
async getConnectionApis(_connectionId, context2) {
|
|
509
810
|
const client = await this._clientProvider.getMetadataClientAsync();
|
|
510
|
-
const response = await client.getAppDataSourceConfigsAsync(
|
|
811
|
+
const response = await client.getAppDataSourceConfigsAsync(context2);
|
|
511
812
|
return {
|
|
512
813
|
success: response.success,
|
|
513
814
|
data: response.data ? [response.data] : [],
|
|
@@ -516,7 +817,6 @@ var RuntimeMetadataOperations = class {
|
|
|
516
817
|
}
|
|
517
818
|
};
|
|
518
819
|
|
|
519
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/core/common/utils.js
|
|
520
820
|
function arrayBufferToBase64(buffer) {
|
|
521
821
|
return window.btoa(convertArrayBufferToString(buffer));
|
|
522
822
|
}
|
|
@@ -541,7 +841,6 @@ function extractDataverseUrlParts(url) {
|
|
|
541
841
|
return { baseUrl, encodedPath };
|
|
542
842
|
}
|
|
543
843
|
|
|
544
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/core/runtimeClient/runtimeDataClient.js
|
|
545
844
|
var _RuntimeDataClient = class _RuntimeDataClient {
|
|
546
845
|
// Constructor for RuntimeDataClient
|
|
547
846
|
// Accepts an IPowerOperationExecutor instance for executing operations
|
|
@@ -566,7 +865,7 @@ var _RuntimeDataClient = class _RuntimeDataClient {
|
|
|
566
865
|
* @throws Error if the request fails or the response is invalid
|
|
567
866
|
* @throws Error if the request body is invalid
|
|
568
867
|
*/
|
|
569
|
-
async createDataAsync(url, apiId, tableName, body,
|
|
868
|
+
async createDataAsync(url, apiId, tableName, body, context2) {
|
|
570
869
|
try {
|
|
571
870
|
if (!body) {
|
|
572
871
|
throw new Error(`${DataOperationErrorMessages.InvalidRequest}: ${DataOperationErrorMessages.MissingRequestBody}`);
|
|
@@ -578,8 +877,8 @@ var _RuntimeDataClient = class _RuntimeDataClient {
|
|
|
578
877
|
tableName,
|
|
579
878
|
body: JSON.stringify(body)
|
|
580
879
|
};
|
|
581
|
-
|
|
582
|
-
return await this._executeRequest(config,
|
|
880
|
+
context2 = this._ensureContext(context2, "runtimeDataClient.createDataAsync");
|
|
881
|
+
return await this._executeRequest(config, context2);
|
|
583
882
|
} catch (error) {
|
|
584
883
|
if (isOperationResult(error)) {
|
|
585
884
|
return error;
|
|
@@ -599,7 +898,7 @@ var _RuntimeDataClient = class _RuntimeDataClient {
|
|
|
599
898
|
* @throws Error if the request fails or the response is invalid
|
|
600
899
|
* @throws Error if the request body is invalid
|
|
601
900
|
*/
|
|
602
|
-
async updateDataAsync(url, apiId, tableName, body,
|
|
901
|
+
async updateDataAsync(url, apiId, tableName, body, context2) {
|
|
603
902
|
try {
|
|
604
903
|
if (!body) {
|
|
605
904
|
throw new Error(`${DataOperationErrorMessages.InvalidRequest}: ${DataOperationErrorMessages.MissingRequestBody}`);
|
|
@@ -611,8 +910,8 @@ var _RuntimeDataClient = class _RuntimeDataClient {
|
|
|
611
910
|
tableName,
|
|
612
911
|
body: JSON.stringify(body)
|
|
613
912
|
};
|
|
614
|
-
|
|
615
|
-
return await this._executeRequest(config,
|
|
913
|
+
context2 = this._ensureContext(context2, "runtimeDataClient.updateDataAsync");
|
|
914
|
+
return await this._executeRequest(config, context2);
|
|
616
915
|
} catch (error) {
|
|
617
916
|
if (isOperationResult(error)) {
|
|
618
917
|
return error;
|
|
@@ -630,7 +929,7 @@ var _RuntimeDataClient = class _RuntimeDataClient {
|
|
|
630
929
|
* @return Promise resolving to the response data
|
|
631
930
|
* @throws Error if the request fails or the response is invalid
|
|
632
931
|
*/
|
|
633
|
-
async deleteDataAsync(url, connectionApi, serviceNamespace,
|
|
932
|
+
async deleteDataAsync(url, connectionApi, serviceNamespace, context2) {
|
|
634
933
|
try {
|
|
635
934
|
const config = {
|
|
636
935
|
url,
|
|
@@ -638,8 +937,8 @@ var _RuntimeDataClient = class _RuntimeDataClient {
|
|
|
638
937
|
apiId: connectionApi,
|
|
639
938
|
tableName: serviceNamespace
|
|
640
939
|
};
|
|
641
|
-
|
|
642
|
-
return await this._executeRequest(config,
|
|
940
|
+
context2 = this._ensureContext(context2, "runtimeDataClient.deleteDataAsync");
|
|
941
|
+
return await this._executeRequest(config, context2);
|
|
643
942
|
} catch (error) {
|
|
644
943
|
if (isOperationResult(error)) {
|
|
645
944
|
return error;
|
|
@@ -660,7 +959,7 @@ var _RuntimeDataClient = class _RuntimeDataClient {
|
|
|
660
959
|
* @return Promise resolving to the response data
|
|
661
960
|
* @throws Error if the request fails or the response is invalid
|
|
662
961
|
*/
|
|
663
|
-
async retrieveDataAsync(url, apiId, tableName, method, headers, body,
|
|
962
|
+
async retrieveDataAsync(url, apiId, tableName, method, headers, body, context2) {
|
|
664
963
|
try {
|
|
665
964
|
const config = {
|
|
666
965
|
url,
|
|
@@ -670,8 +969,8 @@ var _RuntimeDataClient = class _RuntimeDataClient {
|
|
|
670
969
|
headers,
|
|
671
970
|
body: body ? typeof body === "string" ? body : JSON.stringify(body) : void 0
|
|
672
971
|
};
|
|
673
|
-
|
|
674
|
-
return await this._executeRequest(config,
|
|
972
|
+
context2 = this._ensureContext(context2, "runtimeDataClient.retrieveDataAsync");
|
|
973
|
+
return await this._executeRequest(config, context2);
|
|
675
974
|
} catch (error) {
|
|
676
975
|
if (isOperationResult(error)) {
|
|
677
976
|
return error;
|
|
@@ -728,7 +1027,7 @@ var _RuntimeDataClient = class _RuntimeDataClient {
|
|
|
728
1027
|
* @return The headers for the request
|
|
729
1028
|
* @throws Error if header creation fails
|
|
730
1029
|
*/
|
|
731
|
-
_createHeaders(token, config,
|
|
1030
|
+
_createHeaders(token, config, context2) {
|
|
732
1031
|
const baseHeaders = {
|
|
733
1032
|
Accept: "application/json",
|
|
734
1033
|
"x-ms-protocol-semantics": "cdp",
|
|
@@ -736,14 +1035,14 @@ var _RuntimeDataClient = class _RuntimeDataClient {
|
|
|
736
1035
|
Authorization: `paauth ${token}`,
|
|
737
1036
|
"x-ms-pa-client-custom-headers-options": '{"addCustomHeaders":true}',
|
|
738
1037
|
"x-ms-enable-selects": "true",
|
|
739
|
-
"x-ms-pa-client-telemetry-options": `paclient-telemetry {"operationName":"${
|
|
1038
|
+
"x-ms-pa-client-telemetry-options": `paclient-telemetry {"operationName":"${context2?.operationName ?? "runtimeDataClient.executeRequest"}"}`,
|
|
740
1039
|
"x-ms-pa-client-telemetry-additional-data": `{"apiId":"${config.apiId}"}`
|
|
741
1040
|
};
|
|
742
1041
|
if (config.apiId === DataSources.Dataverse) {
|
|
743
1042
|
baseHeaders["x-ms-protocol-semantics"] = DataSources.Dataverse;
|
|
744
1043
|
baseHeaders.Authorization = `dynamicauth ${token}`;
|
|
745
1044
|
const { baseUrl, encodedPath } = extractDataverseUrlParts(config.url);
|
|
746
|
-
const batchId =
|
|
1045
|
+
const batchId = context2?.batchId || "";
|
|
747
1046
|
const preferHeader = this._mergePreferHeaders(config.headers, config.method);
|
|
748
1047
|
baseHeaders.BatchInfo = JSON.stringify({
|
|
749
1048
|
baseUrl,
|
|
@@ -769,9 +1068,9 @@ var _RuntimeDataClient = class _RuntimeDataClient {
|
|
|
769
1068
|
* @throws Error if the request fails or the response is invalid
|
|
770
1069
|
* @throws Error if the response content type is invalid
|
|
771
1070
|
*/
|
|
772
|
-
async _executeRequest(config,
|
|
773
|
-
const token = await this._getAccessToken(config.apiId,
|
|
774
|
-
const headers = this._createHeaders(token, config,
|
|
1071
|
+
async _executeRequest(config, context2) {
|
|
1072
|
+
const token = await this._getAccessToken(config.apiId, context2?.datasetName);
|
|
1073
|
+
const headers = this._createHeaders(token, config, context2);
|
|
775
1074
|
const requestBody = config.body ? new Blob([config.body], { type: "application/json" }) : "";
|
|
776
1075
|
let result;
|
|
777
1076
|
try {
|
|
@@ -809,12 +1108,12 @@ var _RuntimeDataClient = class _RuntimeDataClient {
|
|
|
809
1108
|
text = "{}";
|
|
810
1109
|
}
|
|
811
1110
|
const parsedResult = JSON.parse(text);
|
|
812
|
-
if (
|
|
1111
|
+
if (context2?.isDataVerseOperation || this._isDataverseCall(config.url)) {
|
|
813
1112
|
return {
|
|
814
1113
|
success: true,
|
|
815
1114
|
data: parsedResult
|
|
816
1115
|
};
|
|
817
|
-
} else if (!
|
|
1116
|
+
} else if (!context2?.isExecuteAsync && "value" in parsedResult && Array.isArray(parsedResult.value)) {
|
|
818
1117
|
return {
|
|
819
1118
|
success: true,
|
|
820
1119
|
data: parsedResult.value,
|
|
@@ -844,7 +1143,7 @@ var _RuntimeDataClient = class _RuntimeDataClient {
|
|
|
844
1143
|
if (buffer instanceof ArrayBuffer) {
|
|
845
1144
|
const value = convertArrayBufferToString(buffer);
|
|
846
1145
|
const status = responseData[0].status;
|
|
847
|
-
const responseType =
|
|
1146
|
+
const responseType = context2?.responseInfo?.[status];
|
|
848
1147
|
if (responseType) {
|
|
849
1148
|
let parsedValue;
|
|
850
1149
|
try {
|
|
@@ -888,14 +1187,14 @@ var _RuntimeDataClient = class _RuntimeDataClient {
|
|
|
888
1187
|
};
|
|
889
1188
|
}
|
|
890
1189
|
}
|
|
891
|
-
_ensureContext(
|
|
892
|
-
if (!
|
|
893
|
-
|
|
1190
|
+
_ensureContext(context2, defaultOperationName) {
|
|
1191
|
+
if (!context2) {
|
|
1192
|
+
context2 = {};
|
|
894
1193
|
}
|
|
895
|
-
if (!
|
|
896
|
-
|
|
1194
|
+
if (!context2.operationName) {
|
|
1195
|
+
context2.operationName = defaultOperationName;
|
|
897
1196
|
}
|
|
898
|
-
return
|
|
1197
|
+
return context2;
|
|
899
1198
|
}
|
|
900
1199
|
/**
|
|
901
1200
|
* Checks if the given URL is a Dataverse API call
|
|
@@ -951,7 +1250,6 @@ __publicField(_RuntimeDataClient, "ACTIONS", {
|
|
|
951
1250
|
__publicField(_RuntimeDataClient, "REQUEST_SOURCE", "PublishedApp");
|
|
952
1251
|
var RuntimeDataClient = _RuntimeDataClient;
|
|
953
1252
|
|
|
954
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/core/runtimeClient/runtimeMetadataClient.js
|
|
955
1253
|
var _RuntimeMetadataClient = class _RuntimeMetadataClient {
|
|
956
1254
|
// Private member for the PowerOperationExecutor
|
|
957
1255
|
// The PowerOperationExecutor is used to execute operations on the clients
|
|
@@ -1036,7 +1334,6 @@ __publicField(_RuntimeMetadataClient, "ACTIONS", {
|
|
|
1036
1334
|
});
|
|
1037
1335
|
var RuntimeMetadataClient = _RuntimeMetadataClient;
|
|
1038
1336
|
|
|
1039
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/core/runtimeClient/runtimeClientProvider.js
|
|
1040
1337
|
var RuntimeClientProvider = class {
|
|
1041
1338
|
// Constructor for RuntimeClientProvider
|
|
1042
1339
|
// Accepts an optional IPowerOperationExecutor instance for executing operations
|
|
@@ -1112,7 +1409,6 @@ var RuntimeClientProvider = class {
|
|
|
1112
1409
|
}
|
|
1113
1410
|
};
|
|
1114
1411
|
|
|
1115
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/core/data/executors/shared/stringQueryOptions.js
|
|
1116
1412
|
function convertOptionsToQueryString(options) {
|
|
1117
1413
|
if (!options) {
|
|
1118
1414
|
return "";
|
|
@@ -1143,7 +1439,6 @@ function convertOptionsToQueryString(options) {
|
|
|
1143
1439
|
return parts.length ? `?${parts.join("&")}` : "";
|
|
1144
1440
|
}
|
|
1145
1441
|
|
|
1146
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/core/data/executors/dataverseDataOperationExecutor.js
|
|
1147
1442
|
var ODATA_NEXT_LINK = "@odata.nextLink";
|
|
1148
1443
|
var DataverseDataOperationExecutor = class {
|
|
1149
1444
|
constructor(clientProvider) {
|
|
@@ -1575,7 +1870,6 @@ function extractSkipToken(nextLink) {
|
|
|
1575
1870
|
return match ? decodeURIComponent(match[1]) : void 0;
|
|
1576
1871
|
}
|
|
1577
1872
|
|
|
1578
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/core/data/executors/connectorDataOperationExecutor.js
|
|
1579
1873
|
var ConnectorDataOperationExecutor = class {
|
|
1580
1874
|
// =====================================
|
|
1581
1875
|
// Constructor
|
|
@@ -2076,7 +2370,6 @@ var ConnectorDataOperationExecutor = class {
|
|
|
2076
2370
|
}
|
|
2077
2371
|
};
|
|
2078
2372
|
|
|
2079
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/core/metadata/runtimeDataSourceService.js
|
|
2080
2373
|
var DataSourceServiceError;
|
|
2081
2374
|
/* @__PURE__ */ (function(DataSourceServiceError2) {
|
|
2082
2375
|
})(DataSourceServiceError || (DataSourceServiceError = {}));
|
|
@@ -2167,7 +2460,6 @@ var RuntimeDataSourceService = class {
|
|
|
2167
2460
|
}
|
|
2168
2461
|
};
|
|
2169
2462
|
|
|
2170
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/core/runtime/powerDataRuntime.js
|
|
2171
2463
|
var PowerDataRuntime = class {
|
|
2172
2464
|
/**
|
|
2173
2465
|
* Creates a new instance of PowerDataRuntime
|
|
@@ -2253,7 +2545,6 @@ var PowerDataRuntime = class {
|
|
|
2253
2545
|
}
|
|
2254
2546
|
};
|
|
2255
2547
|
|
|
2256
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/core/runtime/powerDataRuntimeInstance.js
|
|
2257
2548
|
var powerDataRuntimeInstance;
|
|
2258
2549
|
function getPowerDataRuntime(powerDataSourcesInfoProvider, powerOperationExecutor) {
|
|
2259
2550
|
if (!powerDataRuntimeInstance) {
|
|
@@ -2265,7 +2556,6 @@ function getPowerDataRuntime(powerDataSourcesInfoProvider, powerOperationExecuto
|
|
|
2265
2556
|
return powerDataRuntimeInstance;
|
|
2266
2557
|
}
|
|
2267
2558
|
|
|
2268
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/core/runtime/powerDataSourcesInfoProvider.js
|
|
2269
2559
|
var _PowerDataSourcesInfoProvider = class _PowerDataSourcesInfoProvider {
|
|
2270
2560
|
/**
|
|
2271
2561
|
* Private constructor to enforce the singleton pattern.
|
|
@@ -2305,113 +2595,6 @@ __publicField(_PowerDataSourcesInfoProvider, "instance", null);
|
|
|
2305
2595
|
var PowerDataSourcesInfoProvider = _PowerDataSourcesInfoProvider;
|
|
2306
2596
|
var powerDataSourcesInfoProvider_default = PowerDataSourcesInfoProvider;
|
|
2307
2597
|
|
|
2308
|
-
// node_modules/@microsoft/power-apps/lib/internal/plugins/DefaultPowerAppsBridge.js
|
|
2309
|
-
var DefaultPowerAppsBridge = class {
|
|
2310
|
-
constructor() {
|
|
2311
|
-
__publicField(this, "_antiCSRFToken");
|
|
2312
|
-
__publicField(this, "_callbacks", {});
|
|
2313
|
-
__publicField(this, "_currentCallbackId", 0);
|
|
2314
|
-
__publicField(this, "_instanceId", Date.now().toString());
|
|
2315
|
-
__publicField(this, "_messageChannel", new window.MessageChannel());
|
|
2316
|
-
__publicField(this, "_postMessageQueue", []);
|
|
2317
|
-
__publicField(this, "_postMessageSource");
|
|
2318
|
-
__publicField(this, "_handleMessageEvent", (messageEvent) => {
|
|
2319
|
-
const message = messageEvent.data;
|
|
2320
|
-
if (message && typeof message.isPluginCall === "boolean") {
|
|
2321
|
-
if (message.isPluginCall) {
|
|
2322
|
-
const callbackId = message.callbackId;
|
|
2323
|
-
const status = message.status;
|
|
2324
|
-
const args = message.args;
|
|
2325
|
-
const keepCallback = message.keepCallback;
|
|
2326
|
-
try {
|
|
2327
|
-
const callback = this._callbacks[callbackId];
|
|
2328
|
-
if (keepCallback) {
|
|
2329
|
-
if (callback && callback.onUpdate) {
|
|
2330
|
-
callback.onUpdate(message.args?.[0]);
|
|
2331
|
-
}
|
|
2332
|
-
} else {
|
|
2333
|
-
if (callback) {
|
|
2334
|
-
if (status === 1) {
|
|
2335
|
-
callback.resolve(args[0]);
|
|
2336
|
-
} else if (status !== 0) {
|
|
2337
|
-
callback.reject(args);
|
|
2338
|
-
}
|
|
2339
|
-
}
|
|
2340
|
-
if (!keepCallback) {
|
|
2341
|
-
delete this._callbacks[callbackId];
|
|
2342
|
-
}
|
|
2343
|
-
}
|
|
2344
|
-
} catch (error) {
|
|
2345
|
-
console.error(error);
|
|
2346
|
-
}
|
|
2347
|
-
}
|
|
2348
|
-
} else if (message && message.messageType === "initCommunication") {
|
|
2349
|
-
this._antiCSRFToken = message.antiCSRFToken;
|
|
2350
|
-
this._postMessageSource = this._messageChannel.port1;
|
|
2351
|
-
if (this._postMessageSource) {
|
|
2352
|
-
for (let i = 0; i < this._postMessageQueue.length; i++) {
|
|
2353
|
-
this._postMessageQueue[i].antiCSRFToken = this._antiCSRFToken;
|
|
2354
|
-
this._postMessageSource.postMessage(this._postMessageQueue[i]);
|
|
2355
|
-
}
|
|
2356
|
-
}
|
|
2357
|
-
}
|
|
2358
|
-
});
|
|
2359
|
-
}
|
|
2360
|
-
async initialize() {
|
|
2361
|
-
this._messageChannel.port1.onmessage = this._handleMessageEvent;
|
|
2362
|
-
window.parent.postMessage({
|
|
2363
|
-
messageType: "initCommunicationWithPort",
|
|
2364
|
-
instanceId: this._instanceId
|
|
2365
|
-
}, "*", [this._messageChannel.port2]);
|
|
2366
|
-
}
|
|
2367
|
-
async executePluginAsync(pluginName, pluginAction, params = [], onUpdate) {
|
|
2368
|
-
return new Promise((resolve, reject) => {
|
|
2369
|
-
const callbackId = this._getCallbackId(pluginName);
|
|
2370
|
-
this._callbacks[callbackId] = { resolve, reject, onUpdate };
|
|
2371
|
-
this._sendMessage({
|
|
2372
|
-
isPluginCall: true,
|
|
2373
|
-
callbackId,
|
|
2374
|
-
service: pluginName,
|
|
2375
|
-
action: pluginAction,
|
|
2376
|
-
actionArgs: params,
|
|
2377
|
-
antiCSRFToken: this._antiCSRFToken
|
|
2378
|
-
});
|
|
2379
|
-
});
|
|
2380
|
-
}
|
|
2381
|
-
_sendMessage(message) {
|
|
2382
|
-
if (!this._postMessageSource) {
|
|
2383
|
-
this._postMessageQueue.push(message);
|
|
2384
|
-
} else {
|
|
2385
|
-
this._postMessageSource.postMessage(message);
|
|
2386
|
-
}
|
|
2387
|
-
}
|
|
2388
|
-
_getCallbackId(pluginName) {
|
|
2389
|
-
return "instanceId=" + this._instanceId + "_" + pluginName + this._currentCallbackId++;
|
|
2390
|
-
}
|
|
2391
|
-
};
|
|
2392
|
-
|
|
2393
|
-
// node_modules/@microsoft/power-apps/lib/internal/plugins/PluginBridge.js
|
|
2394
|
-
var bridgePromise;
|
|
2395
|
-
async function executePluginAsync(pluginName, pluginAction, params = [], update) {
|
|
2396
|
-
const powerAppsBridge = await getBridge();
|
|
2397
|
-
return powerAppsBridge.executePluginAsync(pluginName, pluginAction, params, update);
|
|
2398
|
-
}
|
|
2399
|
-
async function getBridge() {
|
|
2400
|
-
if (!bridgePromise) {
|
|
2401
|
-
bridgePromise = new Promise(async (resolve, reject) => {
|
|
2402
|
-
try {
|
|
2403
|
-
const bridge = window && window.powerAppsBridge ? window.powerAppsBridge : new DefaultPowerAppsBridge();
|
|
2404
|
-
await bridge.initialize();
|
|
2405
|
-
resolve(bridge);
|
|
2406
|
-
} catch (error) {
|
|
2407
|
-
reject(error);
|
|
2408
|
-
}
|
|
2409
|
-
});
|
|
2410
|
-
}
|
|
2411
|
-
return bridgePromise;
|
|
2412
|
-
}
|
|
2413
|
-
|
|
2414
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/ConnectionUtils.js
|
|
2415
2598
|
var connectionsLoaded = false;
|
|
2416
2599
|
async function loadConnections() {
|
|
2417
2600
|
if (connectionsLoaded) {
|
|
@@ -2428,7 +2611,6 @@ async function resolveCompositeConnectionsAsync() {
|
|
|
2428
2611
|
return executePluginAsync("AppPowerAppsClientPlugin", "resolveCompositeConnectionsAsync", []);
|
|
2429
2612
|
}
|
|
2430
2613
|
|
|
2431
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/OperationExecutor.js
|
|
2432
2614
|
var loadConnectionsPromise;
|
|
2433
2615
|
var OperationExecutor = class {
|
|
2434
2616
|
/**
|
|
@@ -2455,7 +2637,6 @@ var OperationExecutor = class {
|
|
|
2455
2637
|
}
|
|
2456
2638
|
};
|
|
2457
2639
|
|
|
2458
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/core/runtime/getRuntimeContext.js
|
|
2459
2640
|
var _executor;
|
|
2460
2641
|
function getExecutor() {
|
|
2461
2642
|
if (!_executor) {
|
|
@@ -2469,41 +2650,37 @@ async function getPowerSdkInstance(dataSourcesInfo) {
|
|
|
2469
2650
|
return getPowerDataRuntime(provider, executor);
|
|
2470
2651
|
}
|
|
2471
2652
|
|
|
2472
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/core/api/createRecord.js
|
|
2473
2653
|
async function createRecordAsync(dataSourcesInfo, tableName, record) {
|
|
2474
2654
|
return await (await getPowerSdkInstance(dataSourcesInfo)).Data.createRecordAsync(tableName, record);
|
|
2475
2655
|
}
|
|
2476
2656
|
|
|
2477
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/core/api/updateRecord.js
|
|
2478
2657
|
async function updateRecordAsync(dataSourcesInfo, tableName, recordId, changes) {
|
|
2479
2658
|
return await (await getPowerSdkInstance(dataSourcesInfo)).Data.updateRecordAsync(tableName, recordId, changes);
|
|
2480
2659
|
}
|
|
2481
2660
|
|
|
2482
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/core/api/deleteRecord.js
|
|
2483
2661
|
async function deleteRecordAsync(dataSourcesInfo, tableName, recordId) {
|
|
2484
2662
|
return await (await getPowerSdkInstance(dataSourcesInfo)).Data.deleteRecordAsync(tableName, recordId);
|
|
2485
2663
|
}
|
|
2486
2664
|
|
|
2487
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/core/api/retrieveRecord.js
|
|
2488
2665
|
async function retrieveRecordAsync(dataSourcesInfo, tableName, recordId, options) {
|
|
2489
2666
|
return await (await getPowerSdkInstance(dataSourcesInfo)).Data.retrieveRecordAsync(tableName, recordId, options);
|
|
2490
2667
|
}
|
|
2491
2668
|
|
|
2492
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/core/api/retrieveMultipleRecords.js
|
|
2493
2669
|
async function retrieveMultipleRecordsAsync(dataSourcesInfo, tableName, options) {
|
|
2494
2670
|
return await (await getPowerSdkInstance(dataSourcesInfo)).Data.retrieveMultipleRecordsAsync(tableName, options);
|
|
2495
2671
|
}
|
|
2496
2672
|
|
|
2497
|
-
// node_modules/@microsoft/power-apps/lib/internal/data/core/api/execute.js
|
|
2498
2673
|
async function executeAsync(dataSourcesInfo, operation) {
|
|
2499
2674
|
return await (await getPowerSdkInstance(dataSourcesInfo)).Data.executeAsync(operation);
|
|
2500
2675
|
}
|
|
2501
2676
|
|
|
2502
|
-
// node_modules/@microsoft/power-apps/lib/data/powerAppsData.js
|
|
2503
2677
|
var _dataOperationExecutor;
|
|
2504
2678
|
function getDataOperationExecutor() {
|
|
2505
2679
|
return _dataOperationExecutor;
|
|
2506
2680
|
}
|
|
2681
|
+
function setDataOperationExecutor(dataOperationExecutorOverride) {
|
|
2682
|
+
_dataOperationExecutor = dataOperationExecutorOverride;
|
|
2683
|
+
}
|
|
2507
2684
|
function getClient(dataSourcesInfo) {
|
|
2508
2685
|
return {
|
|
2509
2686
|
createRecordAsync: (tableName, record) => {
|
|
@@ -2526,6 +2703,210 @@ function getClient(dataSourcesInfo) {
|
|
|
2526
2703
|
}
|
|
2527
2704
|
};
|
|
2528
2705
|
}
|
|
2529
|
-
|
|
2530
|
-
|
|
2706
|
+
|
|
2707
|
+
var MockDataOperationExecutor = class {
|
|
2708
|
+
constructor(data) {
|
|
2709
|
+
__publicField(this, "_dataStore");
|
|
2710
|
+
this._dataStore = data;
|
|
2711
|
+
}
|
|
2712
|
+
async createRecordAsync(tableName, data) {
|
|
2713
|
+
return {
|
|
2714
|
+
success: false,
|
|
2715
|
+
error: { message: "createRecordAsync is not supported by MockDataOperationExecutor" },
|
|
2716
|
+
data: null
|
|
2717
|
+
};
|
|
2718
|
+
}
|
|
2719
|
+
async updateRecordAsync(tableName, id, data) {
|
|
2720
|
+
return {
|
|
2721
|
+
success: false,
|
|
2722
|
+
error: { message: "updateRecordAsync is not supported by MockDataOperationExecutor" },
|
|
2723
|
+
data: null
|
|
2724
|
+
};
|
|
2725
|
+
}
|
|
2726
|
+
async deleteRecordAsync(tableName, id) {
|
|
2727
|
+
return {
|
|
2728
|
+
success: false,
|
|
2729
|
+
error: { message: "deleteRecordAsync is not supported by MockDataOperationExecutor" },
|
|
2730
|
+
data: void 0
|
|
2731
|
+
};
|
|
2732
|
+
}
|
|
2733
|
+
async retrieveRecordAsync(tableName, id, options) {
|
|
2734
|
+
if (!this._dataStore[tableName]) {
|
|
2735
|
+
return {
|
|
2736
|
+
success: false,
|
|
2737
|
+
error: { message: `table <${tableName}> not found` },
|
|
2738
|
+
data: null
|
|
2739
|
+
};
|
|
2740
|
+
}
|
|
2741
|
+
const record = this._dataStore[tableName][id];
|
|
2742
|
+
if (!record) {
|
|
2743
|
+
return {
|
|
2744
|
+
success: false,
|
|
2745
|
+
error: { message: `record with id "${id}" not found in table <${tableName}>` },
|
|
2746
|
+
data: null
|
|
2747
|
+
};
|
|
2748
|
+
}
|
|
2749
|
+
return {
|
|
2750
|
+
success: true,
|
|
2751
|
+
data: record
|
|
2752
|
+
};
|
|
2753
|
+
}
|
|
2754
|
+
async retrieveMultipleRecordsAsync(tableName, options) {
|
|
2755
|
+
if (!this._dataStore[tableName]) {
|
|
2756
|
+
return {
|
|
2757
|
+
success: false,
|
|
2758
|
+
error: { message: `table <${tableName}> not found` },
|
|
2759
|
+
data: []
|
|
2760
|
+
};
|
|
2761
|
+
}
|
|
2762
|
+
return {
|
|
2763
|
+
success: true,
|
|
2764
|
+
data: Object.values(this._dataStore[tableName])
|
|
2765
|
+
};
|
|
2766
|
+
}
|
|
2767
|
+
async executeAsync(operation) {
|
|
2768
|
+
return {
|
|
2769
|
+
success: false,
|
|
2770
|
+
error: { message: "executeAsync is not supported by MockDataOperationExecutor" },
|
|
2771
|
+
data: null
|
|
2772
|
+
};
|
|
2773
|
+
}
|
|
2774
|
+
};
|
|
2775
|
+
function createMockDataExecutor(data) {
|
|
2776
|
+
return new MockDataOperationExecutor(data);
|
|
2777
|
+
}
|
|
2778
|
+
|
|
2779
|
+
var entityClusterModeEnum = {
|
|
2780
|
+
0: "Partitioned",
|
|
2781
|
+
1: "Replicated",
|
|
2782
|
+
2: "Local"
|
|
2531
2783
|
};
|
|
2784
|
+
function getEntityClusterModeName(value) {
|
|
2785
|
+
return entityClusterModeEnum[value];
|
|
2786
|
+
}
|
|
2787
|
+
var ownershipTypeEnum = {
|
|
2788
|
+
0: "None",
|
|
2789
|
+
1: "UserOwned",
|
|
2790
|
+
2: "TeamOwned",
|
|
2791
|
+
4: "BusinessOwned",
|
|
2792
|
+
8: "OrganizationOwned",
|
|
2793
|
+
16: "BusinessParented",
|
|
2794
|
+
32: "Filtered"
|
|
2795
|
+
};
|
|
2796
|
+
function getOwnershipTypeName(value) {
|
|
2797
|
+
return ownershipTypeEnum[value];
|
|
2798
|
+
}
|
|
2799
|
+
var privilegeTypeEnum = {
|
|
2800
|
+
0: "None",
|
|
2801
|
+
1: "Create",
|
|
2802
|
+
2: "Read",
|
|
2803
|
+
3: "Write",
|
|
2804
|
+
4: "Delete",
|
|
2805
|
+
5: "Assign",
|
|
2806
|
+
6: "Share",
|
|
2807
|
+
7: "Append",
|
|
2808
|
+
8: "AppendTo"
|
|
2809
|
+
};
|
|
2810
|
+
function getPrivilegeTypeName(value) {
|
|
2811
|
+
return privilegeTypeEnum[value];
|
|
2812
|
+
}
|
|
2813
|
+
var attributeTypeCodeEnum = {
|
|
2814
|
+
0: "Boolean",
|
|
2815
|
+
1: "Customer",
|
|
2816
|
+
2: "DateTime",
|
|
2817
|
+
3: "Decimal",
|
|
2818
|
+
4: "Double",
|
|
2819
|
+
5: "Integer",
|
|
2820
|
+
6: "Lookup",
|
|
2821
|
+
7: "Memo",
|
|
2822
|
+
8: "Money",
|
|
2823
|
+
9: "Owner",
|
|
2824
|
+
10: "PartyList",
|
|
2825
|
+
11: "Picklist",
|
|
2826
|
+
12: "State",
|
|
2827
|
+
13: "Status",
|
|
2828
|
+
14: "String",
|
|
2829
|
+
15: "Uniqueidentifier",
|
|
2830
|
+
16: "CalendarRules",
|
|
2831
|
+
17: "Virtual",
|
|
2832
|
+
18: "BigInt",
|
|
2833
|
+
19: "ManagedProperty",
|
|
2834
|
+
20: "EntityName"
|
|
2835
|
+
};
|
|
2836
|
+
function getAttributeTypeCodeName(value) {
|
|
2837
|
+
return attributeTypeCodeEnum[value];
|
|
2838
|
+
}
|
|
2839
|
+
var attributeRequiredLevelEnum = {
|
|
2840
|
+
0: "None",
|
|
2841
|
+
1: "SystemRequired",
|
|
2842
|
+
2: "ApplicationRequired",
|
|
2843
|
+
3: "Recommended"
|
|
2844
|
+
};
|
|
2845
|
+
function getAttributeRequiredLevelName(value) {
|
|
2846
|
+
return attributeRequiredLevelEnum[value];
|
|
2847
|
+
}
|
|
2848
|
+
var relationshipTypeEnum = {
|
|
2849
|
+
0: "OneToManyRelationship",
|
|
2850
|
+
1: "ManyToManyRelationship"
|
|
2851
|
+
};
|
|
2852
|
+
function getRelationshipTypeName(value) {
|
|
2853
|
+
return relationshipTypeEnum[value];
|
|
2854
|
+
}
|
|
2855
|
+
var securityTypesEnum = {
|
|
2856
|
+
0: "None",
|
|
2857
|
+
1: "Append",
|
|
2858
|
+
2: "ParentChild",
|
|
2859
|
+
8: "Pointer",
|
|
2860
|
+
16: "Inheritance"
|
|
2861
|
+
// The referencing entity record inherits security from the referenced security record.
|
|
2862
|
+
};
|
|
2863
|
+
function getSecurityTypesName(value) {
|
|
2864
|
+
return securityTypesEnum[value];
|
|
2865
|
+
}
|
|
2866
|
+
var associatedMenuBehaviorEnum = {
|
|
2867
|
+
0: "UseCollectionName",
|
|
2868
|
+
1: "UseLabel",
|
|
2869
|
+
2: "DoNotDisplay"
|
|
2870
|
+
};
|
|
2871
|
+
function getAssociatedMenuBehaviorName(value) {
|
|
2872
|
+
return associatedMenuBehaviorEnum[value];
|
|
2873
|
+
}
|
|
2874
|
+
var associatedMenuGroupEnum = {
|
|
2875
|
+
0: "Details",
|
|
2876
|
+
1: "Sales",
|
|
2877
|
+
2: "Service",
|
|
2878
|
+
3: "Marketing"
|
|
2879
|
+
};
|
|
2880
|
+
function getAssociatedMenuGroupName(value) {
|
|
2881
|
+
return associatedMenuGroupEnum[value];
|
|
2882
|
+
}
|
|
2883
|
+
var cascadeTypeEnum = {
|
|
2884
|
+
0: "NoCascade",
|
|
2885
|
+
1: "Cascade",
|
|
2886
|
+
2: "Active",
|
|
2887
|
+
3: "UserOwned",
|
|
2888
|
+
4: "RemoveLink",
|
|
2889
|
+
5: "Restrict"
|
|
2890
|
+
// Prevent the Referenced entity record from being deleted when referencing entities exist.
|
|
2891
|
+
};
|
|
2892
|
+
function getCascadeTypeName(value) {
|
|
2893
|
+
return cascadeTypeEnum[value];
|
|
2894
|
+
}
|
|
2895
|
+
export {
|
|
2896
|
+
createMockDataExecutor,
|
|
2897
|
+
getAssociatedMenuBehaviorName,
|
|
2898
|
+
getAssociatedMenuGroupName,
|
|
2899
|
+
getAttributeRequiredLevelName,
|
|
2900
|
+
getAttributeTypeCodeName,
|
|
2901
|
+
getCascadeTypeName,
|
|
2902
|
+
getClient,
|
|
2903
|
+
getContext,
|
|
2904
|
+
getEntityClusterModeName,
|
|
2905
|
+
getOwnershipTypeName,
|
|
2906
|
+
getPrivilegeTypeName,
|
|
2907
|
+
getRelationshipTypeName,
|
|
2908
|
+
getSecurityTypesName,
|
|
2909
|
+
initializeLogger,
|
|
2910
|
+
setConfig,
|
|
2911
|
+
setDataOperationExecutor
|
|
2912
|
+
};
|