@uniformdev/mesh-sdk 20.72.3-alpha.2 → 20.72.3-alpha.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +396 -21
- package/dist/index.d.ts +396 -21
- package/dist/index.esm.js +100 -52
- package/dist/index.js +105 -52
- package/dist/index.mjs +100 -52
- package/dist/server/index.d.mts +386 -0
- package/dist/server/index.mjs +354 -0
- package/package.json +34 -12
package/dist/index.esm.js
CHANGED
|
@@ -7,7 +7,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
7
7
|
|
|
8
8
|
// src/clients/IntegrationDefinitionClient.ts
|
|
9
9
|
import { ApiClient } from "@uniformdev/context/api";
|
|
10
|
-
var _url;
|
|
10
|
+
var _url, _credentialsUrl;
|
|
11
11
|
var _IntegrationDefinitionClient = class _IntegrationDefinitionClient extends ApiClient {
|
|
12
12
|
constructor(options) {
|
|
13
13
|
super(options);
|
|
@@ -18,7 +18,7 @@ var _IntegrationDefinitionClient = class _IntegrationDefinitionClient extends Ap
|
|
|
18
18
|
const fetchUri = this.createUrl(__privateGet(_IntegrationDefinitionClient, _url), { ...options, teamId });
|
|
19
19
|
return await this.apiClient(fetchUri);
|
|
20
20
|
}
|
|
21
|
-
/** Creates or updates a mesh app definition on a team */
|
|
21
|
+
/** Creates or updates a mesh app definition on a team. Identity-delegation credentials must be minted separately via {@link rotateCredential}. */
|
|
22
22
|
async upsert(body) {
|
|
23
23
|
const fetchUri = this.createUrl(__privateGet(_IntegrationDefinitionClient, _url));
|
|
24
24
|
return await this.apiClient(fetchUri, {
|
|
@@ -35,9 +35,37 @@ var _IntegrationDefinitionClient = class _IntegrationDefinitionClient extends Ap
|
|
|
35
35
|
expectNoContent: true
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Mints or rotates an identity-delegation credential for an integration definition. The plaintext
|
|
40
|
+
* `appSecret` is returned exactly once and is not retrievable afterwards — Uniform stores only
|
|
41
|
+
* the hash. A successful response invalidates any previously-issued secret of the same kind.
|
|
42
|
+
* Caller must be a team admin.
|
|
43
|
+
*/
|
|
44
|
+
async rotateCredential(body) {
|
|
45
|
+
const fetchUri = this.createUrl(__privateGet(_IntegrationDefinitionClient, _credentialsUrl));
|
|
46
|
+
return await this.apiClient(fetchUri, {
|
|
47
|
+
method: "POST",
|
|
48
|
+
body: JSON.stringify({ ...body, teamId: this.options.teamId })
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Revokes an identity-delegation credential. Future delegation grants and refreshes will fail
|
|
53
|
+
* until a new credential is minted; in-flight delegation tokens remain valid until natural
|
|
54
|
+
* expiry (up to ~15 minutes). Caller must be a team admin.
|
|
55
|
+
*/
|
|
56
|
+
async revokeCredential(body) {
|
|
57
|
+
const fetchUri = this.createUrl(__privateGet(_IntegrationDefinitionClient, _credentialsUrl));
|
|
58
|
+
await this.apiClient(fetchUri, {
|
|
59
|
+
method: "DELETE",
|
|
60
|
+
body: JSON.stringify({ ...body, teamId: this.options.teamId }),
|
|
61
|
+
expectNoContent: true
|
|
62
|
+
});
|
|
63
|
+
}
|
|
38
64
|
};
|
|
39
65
|
_url = new WeakMap();
|
|
66
|
+
_credentialsUrl = new WeakMap();
|
|
40
67
|
__privateAdd(_IntegrationDefinitionClient, _url, "/api/v1/integration-definitions");
|
|
68
|
+
__privateAdd(_IntegrationDefinitionClient, _credentialsUrl, "/api/v1/integration-credentials");
|
|
41
69
|
var IntegrationDefinitionClient = _IntegrationDefinitionClient;
|
|
42
70
|
|
|
43
71
|
// src/clients/IntegrationInstallationClient.ts
|
|
@@ -86,6 +114,14 @@ _url2 = new WeakMap();
|
|
|
86
114
|
__privateAdd(_IntegrationInstallationClient, _url2, "/api/v1/integration-installations");
|
|
87
115
|
var IntegrationInstallationClient = _IntegrationInstallationClient;
|
|
88
116
|
|
|
117
|
+
// src/delegation/csrfConstants.ts
|
|
118
|
+
var CSRF_HEADER_NAME = "x-mesh-csrf";
|
|
119
|
+
var CSRF_HEADER_VALUE = "1";
|
|
120
|
+
|
|
121
|
+
// src/delegation/delegationExpired.ts
|
|
122
|
+
var DELEGATION_EXPIRED_CODE = "delegation_expired";
|
|
123
|
+
var DELEGATION_SESSION_EXPIRED_MESSAGE = "Delegation session expired.";
|
|
124
|
+
|
|
89
125
|
// src/locations/aiAgents.ts
|
|
90
126
|
var functionCallSystemParameters = ["pageHtml"];
|
|
91
127
|
function parseFunctionCall(request) {
|
|
@@ -131,7 +167,7 @@ var getLogger = (prefix, debug) => {
|
|
|
131
167
|
};
|
|
132
168
|
|
|
133
169
|
// src/temp/version.ts
|
|
134
|
-
var UNIFORM_MESH_SDK_VERSION = "20.
|
|
170
|
+
var UNIFORM_MESH_SDK_VERSION = "20.73.0";
|
|
135
171
|
|
|
136
172
|
// src/framepost/constants.ts
|
|
137
173
|
var DEFAULT_REQUEST_TIMEOUT = 5e3;
|
|
@@ -488,56 +524,63 @@ async function connectToParent({
|
|
|
488
524
|
});
|
|
489
525
|
client.onRequest("metadata-value", onMetadataUpdated);
|
|
490
526
|
client.onRequest("external-value-update", onValueExternallyUpdated);
|
|
527
|
+
const parent = {
|
|
528
|
+
resize: async ({ height }) => {
|
|
529
|
+
await client.request("resize", { height });
|
|
530
|
+
},
|
|
531
|
+
setValue: async (value) => {
|
|
532
|
+
await client.request("setValue", value);
|
|
533
|
+
},
|
|
534
|
+
openDialog: async (message) => {
|
|
535
|
+
const res = await client.request(
|
|
536
|
+
"openDialog",
|
|
537
|
+
message
|
|
538
|
+
);
|
|
539
|
+
const dialogId = res == null ? void 0 : res.dialogId;
|
|
540
|
+
if (!dialogId) {
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
return new Promise((resolve, reject) => {
|
|
544
|
+
dialogResponseHandlers[dialogId] = { resolve, reject };
|
|
545
|
+
});
|
|
546
|
+
},
|
|
547
|
+
closeDialog: async (message) => {
|
|
548
|
+
await client.request("closeDialog", message);
|
|
549
|
+
},
|
|
550
|
+
getDataResource: async (message) => {
|
|
551
|
+
return await client.request("getDataResource", message, {
|
|
552
|
+
timeout: 3e4
|
|
553
|
+
});
|
|
554
|
+
},
|
|
555
|
+
navigate: async (message) => {
|
|
556
|
+
await client.request("navigate", message);
|
|
557
|
+
},
|
|
558
|
+
reloadLocation: async () => {
|
|
559
|
+
await client.request("reload");
|
|
560
|
+
},
|
|
561
|
+
editConnectedData: async (message) => {
|
|
562
|
+
return await client.request(
|
|
563
|
+
"editConnectedData",
|
|
564
|
+
message,
|
|
565
|
+
{
|
|
566
|
+
timeout: (
|
|
567
|
+
// 24 hours in ms
|
|
568
|
+
864e5
|
|
569
|
+
)
|
|
570
|
+
}
|
|
571
|
+
);
|
|
572
|
+
},
|
|
573
|
+
getSessionToken: async () => {
|
|
574
|
+
return await client.request("getSessionToken", void 0, {
|
|
575
|
+
// Delegation may wait on consent UI + token API; default framepost timeout (5s) is too short.
|
|
576
|
+
timeout: 12e4
|
|
577
|
+
});
|
|
578
|
+
},
|
|
579
|
+
editorState: createEditorStateApi(client)
|
|
580
|
+
};
|
|
491
581
|
return {
|
|
492
582
|
initData,
|
|
493
|
-
parent
|
|
494
|
-
resize: async ({ height }) => {
|
|
495
|
-
await client.request("resize", { height });
|
|
496
|
-
},
|
|
497
|
-
setValue: async (value) => {
|
|
498
|
-
await client.request("setValue", value);
|
|
499
|
-
},
|
|
500
|
-
openDialog: async (message) => {
|
|
501
|
-
const res = await client.request(
|
|
502
|
-
"openDialog",
|
|
503
|
-
message
|
|
504
|
-
);
|
|
505
|
-
const dialogId = res == null ? void 0 : res.dialogId;
|
|
506
|
-
if (!dialogId) {
|
|
507
|
-
return;
|
|
508
|
-
}
|
|
509
|
-
return new Promise((resolve, reject) => {
|
|
510
|
-
dialogResponseHandlers[dialogId] = { resolve, reject };
|
|
511
|
-
});
|
|
512
|
-
},
|
|
513
|
-
closeDialog: async (message) => {
|
|
514
|
-
await client.request("closeDialog", message);
|
|
515
|
-
},
|
|
516
|
-
getDataResource: async (message) => {
|
|
517
|
-
return await client.request("getDataResource", message, {
|
|
518
|
-
timeout: 3e4
|
|
519
|
-
});
|
|
520
|
-
},
|
|
521
|
-
navigate: async (message) => {
|
|
522
|
-
await client.request("navigate", message);
|
|
523
|
-
},
|
|
524
|
-
reloadLocation: async () => {
|
|
525
|
-
await client.request("reload");
|
|
526
|
-
},
|
|
527
|
-
editConnectedData: async (message) => {
|
|
528
|
-
return await client.request(
|
|
529
|
-
"editConnectedData",
|
|
530
|
-
message,
|
|
531
|
-
{
|
|
532
|
-
timeout: (
|
|
533
|
-
// 24 hours in ms
|
|
534
|
-
864e5
|
|
535
|
-
)
|
|
536
|
-
}
|
|
537
|
-
);
|
|
538
|
-
},
|
|
539
|
-
editorState: createEditorStateApi(client)
|
|
540
|
-
}
|
|
583
|
+
parent
|
|
541
584
|
};
|
|
542
585
|
}
|
|
543
586
|
function createEditorStateApi(client) {
|
|
@@ -923,7 +966,8 @@ async function initializeUniformMeshSDK({
|
|
|
923
966
|
},
|
|
924
967
|
closeCurrentLocationDialog: async () => {
|
|
925
968
|
await parent.closeDialog({ dialogId: void 0, dialogType: "currentLocation" });
|
|
926
|
-
}
|
|
969
|
+
},
|
|
970
|
+
getSessionToken: () => parent.getSessionToken()
|
|
927
971
|
};
|
|
928
972
|
window.UniformMeshSDK = sdk;
|
|
929
973
|
initializing = false;
|
|
@@ -945,6 +989,10 @@ var hasRole = (role, user) => {
|
|
|
945
989
|
return user.roles.some((userRole) => userRole.name === role || userRole.id === role);
|
|
946
990
|
};
|
|
947
991
|
export {
|
|
992
|
+
CSRF_HEADER_NAME,
|
|
993
|
+
CSRF_HEADER_VALUE,
|
|
994
|
+
DELEGATION_EXPIRED_CODE,
|
|
995
|
+
DELEGATION_SESSION_EXPIRED_MESSAGE,
|
|
948
996
|
IntegrationDefinitionClient,
|
|
949
997
|
IntegrationInstallationClient,
|
|
950
998
|
functionCallSystemParameters,
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
if (typeof process !== 'undefined' && process.emitWarning) { process.emitWarning('@uniformdev/mesh-sdk CommonJS entry is deprecated and will be removed in v21; Node.js 18 support will also be removed in v21 (Node.js 20+ required). Import the ESM build instead.', { type: 'DeprecationWarning', code: 'UNIFORM_MESH_SDK_CJS' }); }
|
|
1
2
|
"use strict";
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
@@ -36,6 +37,10 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
36
37
|
// src/index.ts
|
|
37
38
|
var index_exports = {};
|
|
38
39
|
__export(index_exports, {
|
|
40
|
+
CSRF_HEADER_NAME: () => CSRF_HEADER_NAME,
|
|
41
|
+
CSRF_HEADER_VALUE: () => CSRF_HEADER_VALUE,
|
|
42
|
+
DELEGATION_EXPIRED_CODE: () => DELEGATION_EXPIRED_CODE,
|
|
43
|
+
DELEGATION_SESSION_EXPIRED_MESSAGE: () => DELEGATION_SESSION_EXPIRED_MESSAGE,
|
|
39
44
|
IntegrationDefinitionClient: () => IntegrationDefinitionClient,
|
|
40
45
|
IntegrationInstallationClient: () => IntegrationInstallationClient,
|
|
41
46
|
functionCallSystemParameters: () => functionCallSystemParameters,
|
|
@@ -48,7 +53,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
48
53
|
|
|
49
54
|
// src/clients/IntegrationDefinitionClient.ts
|
|
50
55
|
var import_api = require("@uniformdev/context/api");
|
|
51
|
-
var _url;
|
|
56
|
+
var _url, _credentialsUrl;
|
|
52
57
|
var _IntegrationDefinitionClient = class _IntegrationDefinitionClient extends import_api.ApiClient {
|
|
53
58
|
constructor(options) {
|
|
54
59
|
super(options);
|
|
@@ -59,7 +64,7 @@ var _IntegrationDefinitionClient = class _IntegrationDefinitionClient extends im
|
|
|
59
64
|
const fetchUri = this.createUrl(__privateGet(_IntegrationDefinitionClient, _url), { ...options, teamId });
|
|
60
65
|
return await this.apiClient(fetchUri);
|
|
61
66
|
}
|
|
62
|
-
/** Creates or updates a mesh app definition on a team */
|
|
67
|
+
/** Creates or updates a mesh app definition on a team. Identity-delegation credentials must be minted separately via {@link rotateCredential}. */
|
|
63
68
|
async upsert(body) {
|
|
64
69
|
const fetchUri = this.createUrl(__privateGet(_IntegrationDefinitionClient, _url));
|
|
65
70
|
return await this.apiClient(fetchUri, {
|
|
@@ -76,9 +81,37 @@ var _IntegrationDefinitionClient = class _IntegrationDefinitionClient extends im
|
|
|
76
81
|
expectNoContent: true
|
|
77
82
|
});
|
|
78
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Mints or rotates an identity-delegation credential for an integration definition. The plaintext
|
|
86
|
+
* `appSecret` is returned exactly once and is not retrievable afterwards — Uniform stores only
|
|
87
|
+
* the hash. A successful response invalidates any previously-issued secret of the same kind.
|
|
88
|
+
* Caller must be a team admin.
|
|
89
|
+
*/
|
|
90
|
+
async rotateCredential(body) {
|
|
91
|
+
const fetchUri = this.createUrl(__privateGet(_IntegrationDefinitionClient, _credentialsUrl));
|
|
92
|
+
return await this.apiClient(fetchUri, {
|
|
93
|
+
method: "POST",
|
|
94
|
+
body: JSON.stringify({ ...body, teamId: this.options.teamId })
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Revokes an identity-delegation credential. Future delegation grants and refreshes will fail
|
|
99
|
+
* until a new credential is minted; in-flight delegation tokens remain valid until natural
|
|
100
|
+
* expiry (up to ~15 minutes). Caller must be a team admin.
|
|
101
|
+
*/
|
|
102
|
+
async revokeCredential(body) {
|
|
103
|
+
const fetchUri = this.createUrl(__privateGet(_IntegrationDefinitionClient, _credentialsUrl));
|
|
104
|
+
await this.apiClient(fetchUri, {
|
|
105
|
+
method: "DELETE",
|
|
106
|
+
body: JSON.stringify({ ...body, teamId: this.options.teamId }),
|
|
107
|
+
expectNoContent: true
|
|
108
|
+
});
|
|
109
|
+
}
|
|
79
110
|
};
|
|
80
111
|
_url = new WeakMap();
|
|
112
|
+
_credentialsUrl = new WeakMap();
|
|
81
113
|
__privateAdd(_IntegrationDefinitionClient, _url, "/api/v1/integration-definitions");
|
|
114
|
+
__privateAdd(_IntegrationDefinitionClient, _credentialsUrl, "/api/v1/integration-credentials");
|
|
82
115
|
var IntegrationDefinitionClient = _IntegrationDefinitionClient;
|
|
83
116
|
|
|
84
117
|
// src/clients/IntegrationInstallationClient.ts
|
|
@@ -127,6 +160,14 @@ _url2 = new WeakMap();
|
|
|
127
160
|
__privateAdd(_IntegrationInstallationClient, _url2, "/api/v1/integration-installations");
|
|
128
161
|
var IntegrationInstallationClient = _IntegrationInstallationClient;
|
|
129
162
|
|
|
163
|
+
// src/delegation/csrfConstants.ts
|
|
164
|
+
var CSRF_HEADER_NAME = "x-mesh-csrf";
|
|
165
|
+
var CSRF_HEADER_VALUE = "1";
|
|
166
|
+
|
|
167
|
+
// src/delegation/delegationExpired.ts
|
|
168
|
+
var DELEGATION_EXPIRED_CODE = "delegation_expired";
|
|
169
|
+
var DELEGATION_SESSION_EXPIRED_MESSAGE = "Delegation session expired.";
|
|
170
|
+
|
|
130
171
|
// src/locations/aiAgents.ts
|
|
131
172
|
var functionCallSystemParameters = ["pageHtml"];
|
|
132
173
|
function parseFunctionCall(request) {
|
|
@@ -172,7 +213,7 @@ var getLogger = (prefix, debug) => {
|
|
|
172
213
|
};
|
|
173
214
|
|
|
174
215
|
// src/temp/version.ts
|
|
175
|
-
var UNIFORM_MESH_SDK_VERSION = "20.
|
|
216
|
+
var UNIFORM_MESH_SDK_VERSION = "20.73.0";
|
|
176
217
|
|
|
177
218
|
// src/framepost/constants.ts
|
|
178
219
|
var DEFAULT_REQUEST_TIMEOUT = 5e3;
|
|
@@ -529,56 +570,63 @@ async function connectToParent({
|
|
|
529
570
|
});
|
|
530
571
|
client.onRequest("metadata-value", onMetadataUpdated);
|
|
531
572
|
client.onRequest("external-value-update", onValueExternallyUpdated);
|
|
573
|
+
const parent = {
|
|
574
|
+
resize: async ({ height }) => {
|
|
575
|
+
await client.request("resize", { height });
|
|
576
|
+
},
|
|
577
|
+
setValue: async (value) => {
|
|
578
|
+
await client.request("setValue", value);
|
|
579
|
+
},
|
|
580
|
+
openDialog: async (message) => {
|
|
581
|
+
const res = await client.request(
|
|
582
|
+
"openDialog",
|
|
583
|
+
message
|
|
584
|
+
);
|
|
585
|
+
const dialogId = res == null ? void 0 : res.dialogId;
|
|
586
|
+
if (!dialogId) {
|
|
587
|
+
return;
|
|
588
|
+
}
|
|
589
|
+
return new Promise((resolve, reject) => {
|
|
590
|
+
dialogResponseHandlers[dialogId] = { resolve, reject };
|
|
591
|
+
});
|
|
592
|
+
},
|
|
593
|
+
closeDialog: async (message) => {
|
|
594
|
+
await client.request("closeDialog", message);
|
|
595
|
+
},
|
|
596
|
+
getDataResource: async (message) => {
|
|
597
|
+
return await client.request("getDataResource", message, {
|
|
598
|
+
timeout: 3e4
|
|
599
|
+
});
|
|
600
|
+
},
|
|
601
|
+
navigate: async (message) => {
|
|
602
|
+
await client.request("navigate", message);
|
|
603
|
+
},
|
|
604
|
+
reloadLocation: async () => {
|
|
605
|
+
await client.request("reload");
|
|
606
|
+
},
|
|
607
|
+
editConnectedData: async (message) => {
|
|
608
|
+
return await client.request(
|
|
609
|
+
"editConnectedData",
|
|
610
|
+
message,
|
|
611
|
+
{
|
|
612
|
+
timeout: (
|
|
613
|
+
// 24 hours in ms
|
|
614
|
+
864e5
|
|
615
|
+
)
|
|
616
|
+
}
|
|
617
|
+
);
|
|
618
|
+
},
|
|
619
|
+
getSessionToken: async () => {
|
|
620
|
+
return await client.request("getSessionToken", void 0, {
|
|
621
|
+
// Delegation may wait on consent UI + token API; default framepost timeout (5s) is too short.
|
|
622
|
+
timeout: 12e4
|
|
623
|
+
});
|
|
624
|
+
},
|
|
625
|
+
editorState: createEditorStateApi(client)
|
|
626
|
+
};
|
|
532
627
|
return {
|
|
533
628
|
initData,
|
|
534
|
-
parent
|
|
535
|
-
resize: async ({ height }) => {
|
|
536
|
-
await client.request("resize", { height });
|
|
537
|
-
},
|
|
538
|
-
setValue: async (value) => {
|
|
539
|
-
await client.request("setValue", value);
|
|
540
|
-
},
|
|
541
|
-
openDialog: async (message) => {
|
|
542
|
-
const res = await client.request(
|
|
543
|
-
"openDialog",
|
|
544
|
-
message
|
|
545
|
-
);
|
|
546
|
-
const dialogId = res == null ? void 0 : res.dialogId;
|
|
547
|
-
if (!dialogId) {
|
|
548
|
-
return;
|
|
549
|
-
}
|
|
550
|
-
return new Promise((resolve, reject) => {
|
|
551
|
-
dialogResponseHandlers[dialogId] = { resolve, reject };
|
|
552
|
-
});
|
|
553
|
-
},
|
|
554
|
-
closeDialog: async (message) => {
|
|
555
|
-
await client.request("closeDialog", message);
|
|
556
|
-
},
|
|
557
|
-
getDataResource: async (message) => {
|
|
558
|
-
return await client.request("getDataResource", message, {
|
|
559
|
-
timeout: 3e4
|
|
560
|
-
});
|
|
561
|
-
},
|
|
562
|
-
navigate: async (message) => {
|
|
563
|
-
await client.request("navigate", message);
|
|
564
|
-
},
|
|
565
|
-
reloadLocation: async () => {
|
|
566
|
-
await client.request("reload");
|
|
567
|
-
},
|
|
568
|
-
editConnectedData: async (message) => {
|
|
569
|
-
return await client.request(
|
|
570
|
-
"editConnectedData",
|
|
571
|
-
message,
|
|
572
|
-
{
|
|
573
|
-
timeout: (
|
|
574
|
-
// 24 hours in ms
|
|
575
|
-
864e5
|
|
576
|
-
)
|
|
577
|
-
}
|
|
578
|
-
);
|
|
579
|
-
},
|
|
580
|
-
editorState: createEditorStateApi(client)
|
|
581
|
-
}
|
|
629
|
+
parent
|
|
582
630
|
};
|
|
583
631
|
}
|
|
584
632
|
function createEditorStateApi(client) {
|
|
@@ -964,7 +1012,8 @@ async function initializeUniformMeshSDK({
|
|
|
964
1012
|
},
|
|
965
1013
|
closeCurrentLocationDialog: async () => {
|
|
966
1014
|
await parent.closeDialog({ dialogId: void 0, dialogType: "currentLocation" });
|
|
967
|
-
}
|
|
1015
|
+
},
|
|
1016
|
+
getSessionToken: () => parent.getSessionToken()
|
|
968
1017
|
};
|
|
969
1018
|
window.UniformMeshSDK = sdk;
|
|
970
1019
|
initializing = false;
|
|
@@ -987,6 +1036,10 @@ var hasRole = (role, user) => {
|
|
|
987
1036
|
};
|
|
988
1037
|
// Annotate the CommonJS export names for ESM import in node:
|
|
989
1038
|
0 && (module.exports = {
|
|
1039
|
+
CSRF_HEADER_NAME,
|
|
1040
|
+
CSRF_HEADER_VALUE,
|
|
1041
|
+
DELEGATION_EXPIRED_CODE,
|
|
1042
|
+
DELEGATION_SESSION_EXPIRED_MESSAGE,
|
|
990
1043
|
IntegrationDefinitionClient,
|
|
991
1044
|
IntegrationInstallationClient,
|
|
992
1045
|
functionCallSystemParameters,
|
package/dist/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
7
7
|
|
|
8
8
|
// src/clients/IntegrationDefinitionClient.ts
|
|
9
9
|
import { ApiClient } from "@uniformdev/context/api";
|
|
10
|
-
var _url;
|
|
10
|
+
var _url, _credentialsUrl;
|
|
11
11
|
var _IntegrationDefinitionClient = class _IntegrationDefinitionClient extends ApiClient {
|
|
12
12
|
constructor(options) {
|
|
13
13
|
super(options);
|
|
@@ -18,7 +18,7 @@ var _IntegrationDefinitionClient = class _IntegrationDefinitionClient extends Ap
|
|
|
18
18
|
const fetchUri = this.createUrl(__privateGet(_IntegrationDefinitionClient, _url), { ...options, teamId });
|
|
19
19
|
return await this.apiClient(fetchUri);
|
|
20
20
|
}
|
|
21
|
-
/** Creates or updates a mesh app definition on a team */
|
|
21
|
+
/** Creates or updates a mesh app definition on a team. Identity-delegation credentials must be minted separately via {@link rotateCredential}. */
|
|
22
22
|
async upsert(body) {
|
|
23
23
|
const fetchUri = this.createUrl(__privateGet(_IntegrationDefinitionClient, _url));
|
|
24
24
|
return await this.apiClient(fetchUri, {
|
|
@@ -35,9 +35,37 @@ var _IntegrationDefinitionClient = class _IntegrationDefinitionClient extends Ap
|
|
|
35
35
|
expectNoContent: true
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Mints or rotates an identity-delegation credential for an integration definition. The plaintext
|
|
40
|
+
* `appSecret` is returned exactly once and is not retrievable afterwards — Uniform stores only
|
|
41
|
+
* the hash. A successful response invalidates any previously-issued secret of the same kind.
|
|
42
|
+
* Caller must be a team admin.
|
|
43
|
+
*/
|
|
44
|
+
async rotateCredential(body) {
|
|
45
|
+
const fetchUri = this.createUrl(__privateGet(_IntegrationDefinitionClient, _credentialsUrl));
|
|
46
|
+
return await this.apiClient(fetchUri, {
|
|
47
|
+
method: "POST",
|
|
48
|
+
body: JSON.stringify({ ...body, teamId: this.options.teamId })
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Revokes an identity-delegation credential. Future delegation grants and refreshes will fail
|
|
53
|
+
* until a new credential is minted; in-flight delegation tokens remain valid until natural
|
|
54
|
+
* expiry (up to ~15 minutes). Caller must be a team admin.
|
|
55
|
+
*/
|
|
56
|
+
async revokeCredential(body) {
|
|
57
|
+
const fetchUri = this.createUrl(__privateGet(_IntegrationDefinitionClient, _credentialsUrl));
|
|
58
|
+
await this.apiClient(fetchUri, {
|
|
59
|
+
method: "DELETE",
|
|
60
|
+
body: JSON.stringify({ ...body, teamId: this.options.teamId }),
|
|
61
|
+
expectNoContent: true
|
|
62
|
+
});
|
|
63
|
+
}
|
|
38
64
|
};
|
|
39
65
|
_url = new WeakMap();
|
|
66
|
+
_credentialsUrl = new WeakMap();
|
|
40
67
|
__privateAdd(_IntegrationDefinitionClient, _url, "/api/v1/integration-definitions");
|
|
68
|
+
__privateAdd(_IntegrationDefinitionClient, _credentialsUrl, "/api/v1/integration-credentials");
|
|
41
69
|
var IntegrationDefinitionClient = _IntegrationDefinitionClient;
|
|
42
70
|
|
|
43
71
|
// src/clients/IntegrationInstallationClient.ts
|
|
@@ -86,6 +114,14 @@ _url2 = new WeakMap();
|
|
|
86
114
|
__privateAdd(_IntegrationInstallationClient, _url2, "/api/v1/integration-installations");
|
|
87
115
|
var IntegrationInstallationClient = _IntegrationInstallationClient;
|
|
88
116
|
|
|
117
|
+
// src/delegation/csrfConstants.ts
|
|
118
|
+
var CSRF_HEADER_NAME = "x-mesh-csrf";
|
|
119
|
+
var CSRF_HEADER_VALUE = "1";
|
|
120
|
+
|
|
121
|
+
// src/delegation/delegationExpired.ts
|
|
122
|
+
var DELEGATION_EXPIRED_CODE = "delegation_expired";
|
|
123
|
+
var DELEGATION_SESSION_EXPIRED_MESSAGE = "Delegation session expired.";
|
|
124
|
+
|
|
89
125
|
// src/locations/aiAgents.ts
|
|
90
126
|
var functionCallSystemParameters = ["pageHtml"];
|
|
91
127
|
function parseFunctionCall(request) {
|
|
@@ -131,7 +167,7 @@ var getLogger = (prefix, debug) => {
|
|
|
131
167
|
};
|
|
132
168
|
|
|
133
169
|
// src/temp/version.ts
|
|
134
|
-
var UNIFORM_MESH_SDK_VERSION = "20.
|
|
170
|
+
var UNIFORM_MESH_SDK_VERSION = "20.73.0";
|
|
135
171
|
|
|
136
172
|
// src/framepost/constants.ts
|
|
137
173
|
var DEFAULT_REQUEST_TIMEOUT = 5e3;
|
|
@@ -488,56 +524,63 @@ async function connectToParent({
|
|
|
488
524
|
});
|
|
489
525
|
client.onRequest("metadata-value", onMetadataUpdated);
|
|
490
526
|
client.onRequest("external-value-update", onValueExternallyUpdated);
|
|
527
|
+
const parent = {
|
|
528
|
+
resize: async ({ height }) => {
|
|
529
|
+
await client.request("resize", { height });
|
|
530
|
+
},
|
|
531
|
+
setValue: async (value) => {
|
|
532
|
+
await client.request("setValue", value);
|
|
533
|
+
},
|
|
534
|
+
openDialog: async (message) => {
|
|
535
|
+
const res = await client.request(
|
|
536
|
+
"openDialog",
|
|
537
|
+
message
|
|
538
|
+
);
|
|
539
|
+
const dialogId = res == null ? void 0 : res.dialogId;
|
|
540
|
+
if (!dialogId) {
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
return new Promise((resolve, reject) => {
|
|
544
|
+
dialogResponseHandlers[dialogId] = { resolve, reject };
|
|
545
|
+
});
|
|
546
|
+
},
|
|
547
|
+
closeDialog: async (message) => {
|
|
548
|
+
await client.request("closeDialog", message);
|
|
549
|
+
},
|
|
550
|
+
getDataResource: async (message) => {
|
|
551
|
+
return await client.request("getDataResource", message, {
|
|
552
|
+
timeout: 3e4
|
|
553
|
+
});
|
|
554
|
+
},
|
|
555
|
+
navigate: async (message) => {
|
|
556
|
+
await client.request("navigate", message);
|
|
557
|
+
},
|
|
558
|
+
reloadLocation: async () => {
|
|
559
|
+
await client.request("reload");
|
|
560
|
+
},
|
|
561
|
+
editConnectedData: async (message) => {
|
|
562
|
+
return await client.request(
|
|
563
|
+
"editConnectedData",
|
|
564
|
+
message,
|
|
565
|
+
{
|
|
566
|
+
timeout: (
|
|
567
|
+
// 24 hours in ms
|
|
568
|
+
864e5
|
|
569
|
+
)
|
|
570
|
+
}
|
|
571
|
+
);
|
|
572
|
+
},
|
|
573
|
+
getSessionToken: async () => {
|
|
574
|
+
return await client.request("getSessionToken", void 0, {
|
|
575
|
+
// Delegation may wait on consent UI + token API; default framepost timeout (5s) is too short.
|
|
576
|
+
timeout: 12e4
|
|
577
|
+
});
|
|
578
|
+
},
|
|
579
|
+
editorState: createEditorStateApi(client)
|
|
580
|
+
};
|
|
491
581
|
return {
|
|
492
582
|
initData,
|
|
493
|
-
parent
|
|
494
|
-
resize: async ({ height }) => {
|
|
495
|
-
await client.request("resize", { height });
|
|
496
|
-
},
|
|
497
|
-
setValue: async (value) => {
|
|
498
|
-
await client.request("setValue", value);
|
|
499
|
-
},
|
|
500
|
-
openDialog: async (message) => {
|
|
501
|
-
const res = await client.request(
|
|
502
|
-
"openDialog",
|
|
503
|
-
message
|
|
504
|
-
);
|
|
505
|
-
const dialogId = res == null ? void 0 : res.dialogId;
|
|
506
|
-
if (!dialogId) {
|
|
507
|
-
return;
|
|
508
|
-
}
|
|
509
|
-
return new Promise((resolve, reject) => {
|
|
510
|
-
dialogResponseHandlers[dialogId] = { resolve, reject };
|
|
511
|
-
});
|
|
512
|
-
},
|
|
513
|
-
closeDialog: async (message) => {
|
|
514
|
-
await client.request("closeDialog", message);
|
|
515
|
-
},
|
|
516
|
-
getDataResource: async (message) => {
|
|
517
|
-
return await client.request("getDataResource", message, {
|
|
518
|
-
timeout: 3e4
|
|
519
|
-
});
|
|
520
|
-
},
|
|
521
|
-
navigate: async (message) => {
|
|
522
|
-
await client.request("navigate", message);
|
|
523
|
-
},
|
|
524
|
-
reloadLocation: async () => {
|
|
525
|
-
await client.request("reload");
|
|
526
|
-
},
|
|
527
|
-
editConnectedData: async (message) => {
|
|
528
|
-
return await client.request(
|
|
529
|
-
"editConnectedData",
|
|
530
|
-
message,
|
|
531
|
-
{
|
|
532
|
-
timeout: (
|
|
533
|
-
// 24 hours in ms
|
|
534
|
-
864e5
|
|
535
|
-
)
|
|
536
|
-
}
|
|
537
|
-
);
|
|
538
|
-
},
|
|
539
|
-
editorState: createEditorStateApi(client)
|
|
540
|
-
}
|
|
583
|
+
parent
|
|
541
584
|
};
|
|
542
585
|
}
|
|
543
586
|
function createEditorStateApi(client) {
|
|
@@ -923,7 +966,8 @@ async function initializeUniformMeshSDK({
|
|
|
923
966
|
},
|
|
924
967
|
closeCurrentLocationDialog: async () => {
|
|
925
968
|
await parent.closeDialog({ dialogId: void 0, dialogType: "currentLocation" });
|
|
926
|
-
}
|
|
969
|
+
},
|
|
970
|
+
getSessionToken: () => parent.getSessionToken()
|
|
927
971
|
};
|
|
928
972
|
window.UniformMeshSDK = sdk;
|
|
929
973
|
initializing = false;
|
|
@@ -945,6 +989,10 @@ var hasRole = (role, user) => {
|
|
|
945
989
|
return user.roles.some((userRole) => userRole.name === role || userRole.id === role);
|
|
946
990
|
};
|
|
947
991
|
export {
|
|
992
|
+
CSRF_HEADER_NAME,
|
|
993
|
+
CSRF_HEADER_VALUE,
|
|
994
|
+
DELEGATION_EXPIRED_CODE,
|
|
995
|
+
DELEGATION_SESSION_EXPIRED_MESSAGE,
|
|
948
996
|
IntegrationDefinitionClient,
|
|
949
997
|
IntegrationInstallationClient,
|
|
950
998
|
functionCallSystemParameters,
|