@uniformdev/mesh-sdk 20.50.2-alpha.2 → 20.50.2-alpha.77
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 +412 -20
- package/dist/index.d.ts +412 -20
- package/dist/index.esm.js +191 -51
- package/dist/index.js +193 -51
- package/dist/index.mjs +191 -51
- package/package.json +8 -8
package/dist/index.esm.js
CHANGED
|
@@ -4,10 +4,112 @@ var __typeError = (msg) => {
|
|
|
4
4
|
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
5
5
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
6
6
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
7
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
8
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
9
|
+
|
|
10
|
+
// src/clients/DelegationTokenClient.ts
|
|
11
|
+
var DelegationTokenError = class extends Error {
|
|
12
|
+
constructor(status, kind, publicMessage) {
|
|
13
|
+
super(publicMessage);
|
|
14
|
+
this.name = "DelegationTokenError";
|
|
15
|
+
this.status = status;
|
|
16
|
+
this.kind = kind;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
var PUBLIC_MESSAGES = {
|
|
20
|
+
bad_request: "Token exchange request was rejected as invalid",
|
|
21
|
+
unauthenticated: "Token exchange authentication failed",
|
|
22
|
+
forbidden: "Token exchange forbidden by server",
|
|
23
|
+
not_found: "Token exchange target was not found",
|
|
24
|
+
rate_limited: "Token exchange rate limit exceeded",
|
|
25
|
+
server_error: "Token exchange server error",
|
|
26
|
+
unknown: "Token exchange failed"
|
|
27
|
+
};
|
|
28
|
+
function classifyDelegationTokenStatus(status) {
|
|
29
|
+
if (status === 400) {
|
|
30
|
+
return "bad_request";
|
|
31
|
+
}
|
|
32
|
+
if (status === 401) {
|
|
33
|
+
return "unauthenticated";
|
|
34
|
+
}
|
|
35
|
+
if (status === 403) {
|
|
36
|
+
return "forbidden";
|
|
37
|
+
}
|
|
38
|
+
if (status === 404) {
|
|
39
|
+
return "not_found";
|
|
40
|
+
}
|
|
41
|
+
if (status === 429) {
|
|
42
|
+
return "rate_limited";
|
|
43
|
+
}
|
|
44
|
+
if (status >= 500) {
|
|
45
|
+
return "server_error";
|
|
46
|
+
}
|
|
47
|
+
return "unknown";
|
|
48
|
+
}
|
|
49
|
+
function buildDelegationTokenError(status) {
|
|
50
|
+
const kind = classifyDelegationTokenStatus(status);
|
|
51
|
+
return new DelegationTokenError(status, kind, PUBLIC_MESSAGES[kind]);
|
|
52
|
+
}
|
|
53
|
+
var _options, _DelegationTokenClient_instances, post_fn;
|
|
54
|
+
var DelegationTokenClient = class {
|
|
55
|
+
constructor(options) {
|
|
56
|
+
__privateAdd(this, _DelegationTokenClient_instances);
|
|
57
|
+
__privateAdd(this, _options);
|
|
58
|
+
__privateSet(this, _options, options);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Exchanges a short-lived session token for a delegation token and refresh token.
|
|
62
|
+
* The session token is obtained by the integration's frontend via `sdk.getSessionToken()`.
|
|
63
|
+
*
|
|
64
|
+
* @deprecated This beta identity delegation API may change with breaking changes.
|
|
65
|
+
*/
|
|
66
|
+
async exchangeSessionToken(sessionToken) {
|
|
67
|
+
return __privateMethod(this, _DelegationTokenClient_instances, post_fn).call(this, {
|
|
68
|
+
grant_type: "delegation_token",
|
|
69
|
+
sessionToken,
|
|
70
|
+
integrationId: __privateGet(this, _options).integrationId,
|
|
71
|
+
integrationSecret: __privateGet(this, _options).integrationSecret
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Exchanges a refresh token for a new delegation token and a new refresh token.
|
|
76
|
+
*
|
|
77
|
+
* Replay posture: refresh tokens are bearer credentials that are valid until
|
|
78
|
+
* their server-side expiry. They are NOT single-use — a captured refresh token can be
|
|
79
|
+
* replayed by an attacker that also has the integration secret until it expires.
|
|
80
|
+
* Single-use enforcement (refresh-token storage, family/jti tracking, replay revocation)
|
|
81
|
+
* is tracked in `UNI-9279`.
|
|
82
|
+
*
|
|
83
|
+
* @deprecated This beta identity delegation API may change with breaking changes.
|
|
84
|
+
*/
|
|
85
|
+
async refreshDelegationToken(refreshToken) {
|
|
86
|
+
return __privateMethod(this, _DelegationTokenClient_instances, post_fn).call(this, {
|
|
87
|
+
grant_type: "refresh_token",
|
|
88
|
+
refreshToken,
|
|
89
|
+
integrationId: __privateGet(this, _options).integrationId,
|
|
90
|
+
integrationSecret: __privateGet(this, _options).integrationSecret
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
_options = new WeakMap();
|
|
95
|
+
_DelegationTokenClient_instances = new WeakSet();
|
|
96
|
+
post_fn = async function(body) {
|
|
97
|
+
const url = `${__privateGet(this, _options).apiHost}/api/v1/token`;
|
|
98
|
+
const response = await fetch(url, {
|
|
99
|
+
method: "POST",
|
|
100
|
+
headers: { "Content-Type": "application/json" },
|
|
101
|
+
body: JSON.stringify(body)
|
|
102
|
+
});
|
|
103
|
+
if (!response.ok) {
|
|
104
|
+
await response.text().catch(() => "");
|
|
105
|
+
throw buildDelegationTokenError(response.status);
|
|
106
|
+
}
|
|
107
|
+
return await response.json();
|
|
108
|
+
};
|
|
7
109
|
|
|
8
110
|
// src/clients/IntegrationDefinitionClient.ts
|
|
9
111
|
import { ApiClient } from "@uniformdev/context/api";
|
|
10
|
-
var _url;
|
|
112
|
+
var _url, _credentialsUrl;
|
|
11
113
|
var _IntegrationDefinitionClient = class _IntegrationDefinitionClient extends ApiClient {
|
|
12
114
|
constructor(options) {
|
|
13
115
|
super(options);
|
|
@@ -18,7 +120,7 @@ var _IntegrationDefinitionClient = class _IntegrationDefinitionClient extends Ap
|
|
|
18
120
|
const fetchUri = this.createUrl(__privateGet(_IntegrationDefinitionClient, _url), { ...options, teamId });
|
|
19
121
|
return await this.apiClient(fetchUri);
|
|
20
122
|
}
|
|
21
|
-
/** Creates or updates a mesh app definition on a team */
|
|
123
|
+
/** Creates or updates a mesh app definition on a team. Identity-delegation credentials must be minted separately via {@link rotateCredential}. */
|
|
22
124
|
async upsert(body) {
|
|
23
125
|
const fetchUri = this.createUrl(__privateGet(_IntegrationDefinitionClient, _url));
|
|
24
126
|
return await this.apiClient(fetchUri, {
|
|
@@ -35,9 +137,37 @@ var _IntegrationDefinitionClient = class _IntegrationDefinitionClient extends Ap
|
|
|
35
137
|
expectNoContent: true
|
|
36
138
|
});
|
|
37
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* Mints or rotates an identity-delegation credential for an integration definition. The plaintext
|
|
142
|
+
* `appSecret` is returned exactly once and is not retrievable afterwards — Uniform stores only
|
|
143
|
+
* the hash. A successful response invalidates any previously-issued secret of the same kind.
|
|
144
|
+
* Caller must be a team admin.
|
|
145
|
+
*/
|
|
146
|
+
async rotateCredential(body) {
|
|
147
|
+
const fetchUri = this.createUrl(__privateGet(_IntegrationDefinitionClient, _credentialsUrl));
|
|
148
|
+
return await this.apiClient(fetchUri, {
|
|
149
|
+
method: "POST",
|
|
150
|
+
body: JSON.stringify({ ...body, teamId: this.options.teamId })
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Revokes an identity-delegation credential. Future delegation grants and refreshes will fail
|
|
155
|
+
* until a new credential is minted; in-flight delegation tokens remain valid until natural
|
|
156
|
+
* expiry (up to ~15 minutes). Caller must be a team admin.
|
|
157
|
+
*/
|
|
158
|
+
async revokeCredential(body) {
|
|
159
|
+
const fetchUri = this.createUrl(__privateGet(_IntegrationDefinitionClient, _credentialsUrl));
|
|
160
|
+
await this.apiClient(fetchUri, {
|
|
161
|
+
method: "DELETE",
|
|
162
|
+
body: JSON.stringify({ ...body, teamId: this.options.teamId }),
|
|
163
|
+
expectNoContent: true
|
|
164
|
+
});
|
|
165
|
+
}
|
|
38
166
|
};
|
|
39
167
|
_url = new WeakMap();
|
|
168
|
+
_credentialsUrl = new WeakMap();
|
|
40
169
|
__privateAdd(_IntegrationDefinitionClient, _url, "/api/v1/integration-definitions");
|
|
170
|
+
__privateAdd(_IntegrationDefinitionClient, _credentialsUrl, "/api/v1/integration-credentials");
|
|
41
171
|
var IntegrationDefinitionClient = _IntegrationDefinitionClient;
|
|
42
172
|
|
|
43
173
|
// src/clients/IntegrationInstallationClient.ts
|
|
@@ -131,7 +261,7 @@ var getLogger = (prefix, debug) => {
|
|
|
131
261
|
};
|
|
132
262
|
|
|
133
263
|
// src/temp/version.ts
|
|
134
|
-
var UNIFORM_MESH_SDK_VERSION = "20.
|
|
264
|
+
var UNIFORM_MESH_SDK_VERSION = "20.61.1";
|
|
135
265
|
|
|
136
266
|
// src/framepost/constants.ts
|
|
137
267
|
var DEFAULT_REQUEST_TIMEOUT = 5e3;
|
|
@@ -488,56 +618,63 @@ async function connectToParent({
|
|
|
488
618
|
});
|
|
489
619
|
client.onRequest("metadata-value", onMetadataUpdated);
|
|
490
620
|
client.onRequest("external-value-update", onValueExternallyUpdated);
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
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
|
-
);
|
|
621
|
+
const parent = {
|
|
622
|
+
resize: async ({ height }) => {
|
|
623
|
+
await client.request("resize", { height });
|
|
624
|
+
},
|
|
625
|
+
setValue: async (value) => {
|
|
626
|
+
await client.request("setValue", value);
|
|
627
|
+
},
|
|
628
|
+
openDialog: async (message) => {
|
|
629
|
+
const res = await client.request(
|
|
630
|
+
"openDialog",
|
|
631
|
+
message
|
|
632
|
+
);
|
|
633
|
+
const dialogId = res == null ? void 0 : res.dialogId;
|
|
634
|
+
if (!dialogId) {
|
|
635
|
+
return;
|
|
538
636
|
}
|
|
637
|
+
return new Promise((resolve, reject) => {
|
|
638
|
+
dialogResponseHandlers[dialogId] = { resolve, reject };
|
|
639
|
+
});
|
|
640
|
+
},
|
|
641
|
+
closeDialog: async (message) => {
|
|
642
|
+
await client.request("closeDialog", message);
|
|
643
|
+
},
|
|
644
|
+
getDataResource: async (message) => {
|
|
645
|
+
return await client.request("getDataResource", message, {
|
|
646
|
+
timeout: 3e4
|
|
647
|
+
});
|
|
648
|
+
},
|
|
649
|
+
navigate: async (message) => {
|
|
650
|
+
await client.request("navigate", message);
|
|
651
|
+
},
|
|
652
|
+
reloadLocation: async () => {
|
|
653
|
+
await client.request("reload");
|
|
654
|
+
},
|
|
655
|
+
editConnectedData: async (message) => {
|
|
656
|
+
return await client.request(
|
|
657
|
+
"editConnectedData",
|
|
658
|
+
message,
|
|
659
|
+
{
|
|
660
|
+
timeout: (
|
|
661
|
+
// 24 hours in ms
|
|
662
|
+
864e5
|
|
663
|
+
)
|
|
664
|
+
}
|
|
665
|
+
);
|
|
666
|
+
},
|
|
667
|
+
getSessionToken: async () => {
|
|
668
|
+
return await client.request("getSessionToken", void 0, {
|
|
669
|
+
// Delegation may wait on consent UI + token API; default framepost timeout (5s) is too short.
|
|
670
|
+
timeout: 12e4
|
|
671
|
+
});
|
|
539
672
|
}
|
|
540
673
|
};
|
|
674
|
+
return {
|
|
675
|
+
initData,
|
|
676
|
+
parent
|
|
677
|
+
};
|
|
541
678
|
}
|
|
542
679
|
|
|
543
680
|
// src/sdkWindow.ts
|
|
@@ -816,7 +953,8 @@ async function initializeUniformMeshSDK({
|
|
|
816
953
|
},
|
|
817
954
|
closeCurrentLocationDialog: async () => {
|
|
818
955
|
await parent.closeDialog({ dialogId: void 0, dialogType: "currentLocation" });
|
|
819
|
-
}
|
|
956
|
+
},
|
|
957
|
+
getSessionToken: () => parent.getSessionToken()
|
|
820
958
|
};
|
|
821
959
|
window.UniformMeshSDK = sdk;
|
|
822
960
|
initializing = false;
|
|
@@ -838,6 +976,8 @@ var hasRole = (role, user) => {
|
|
|
838
976
|
return user.roles.some((userRole) => userRole.name === role || userRole.id === role);
|
|
839
977
|
};
|
|
840
978
|
export {
|
|
979
|
+
DelegationTokenClient,
|
|
980
|
+
DelegationTokenError,
|
|
841
981
|
IntegrationDefinitionClient,
|
|
842
982
|
IntegrationInstallationClient,
|
|
843
983
|
functionCallSystemParameters,
|
package/dist/index.js
CHANGED
|
@@ -32,10 +32,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
32
32
|
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
33
33
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
34
34
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
35
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
36
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
35
37
|
|
|
36
38
|
// src/index.ts
|
|
37
39
|
var src_exports = {};
|
|
38
40
|
__export(src_exports, {
|
|
41
|
+
DelegationTokenClient: () => DelegationTokenClient,
|
|
42
|
+
DelegationTokenError: () => DelegationTokenError,
|
|
39
43
|
IntegrationDefinitionClient: () => IntegrationDefinitionClient,
|
|
40
44
|
IntegrationInstallationClient: () => IntegrationInstallationClient,
|
|
41
45
|
functionCallSystemParameters: () => functionCallSystemParameters,
|
|
@@ -46,9 +50,109 @@ __export(src_exports, {
|
|
|
46
50
|
});
|
|
47
51
|
module.exports = __toCommonJS(src_exports);
|
|
48
52
|
|
|
53
|
+
// src/clients/DelegationTokenClient.ts
|
|
54
|
+
var DelegationTokenError = class extends Error {
|
|
55
|
+
constructor(status, kind, publicMessage) {
|
|
56
|
+
super(publicMessage);
|
|
57
|
+
this.name = "DelegationTokenError";
|
|
58
|
+
this.status = status;
|
|
59
|
+
this.kind = kind;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
var PUBLIC_MESSAGES = {
|
|
63
|
+
bad_request: "Token exchange request was rejected as invalid",
|
|
64
|
+
unauthenticated: "Token exchange authentication failed",
|
|
65
|
+
forbidden: "Token exchange forbidden by server",
|
|
66
|
+
not_found: "Token exchange target was not found",
|
|
67
|
+
rate_limited: "Token exchange rate limit exceeded",
|
|
68
|
+
server_error: "Token exchange server error",
|
|
69
|
+
unknown: "Token exchange failed"
|
|
70
|
+
};
|
|
71
|
+
function classifyDelegationTokenStatus(status) {
|
|
72
|
+
if (status === 400) {
|
|
73
|
+
return "bad_request";
|
|
74
|
+
}
|
|
75
|
+
if (status === 401) {
|
|
76
|
+
return "unauthenticated";
|
|
77
|
+
}
|
|
78
|
+
if (status === 403) {
|
|
79
|
+
return "forbidden";
|
|
80
|
+
}
|
|
81
|
+
if (status === 404) {
|
|
82
|
+
return "not_found";
|
|
83
|
+
}
|
|
84
|
+
if (status === 429) {
|
|
85
|
+
return "rate_limited";
|
|
86
|
+
}
|
|
87
|
+
if (status >= 500) {
|
|
88
|
+
return "server_error";
|
|
89
|
+
}
|
|
90
|
+
return "unknown";
|
|
91
|
+
}
|
|
92
|
+
function buildDelegationTokenError(status) {
|
|
93
|
+
const kind = classifyDelegationTokenStatus(status);
|
|
94
|
+
return new DelegationTokenError(status, kind, PUBLIC_MESSAGES[kind]);
|
|
95
|
+
}
|
|
96
|
+
var _options, _DelegationTokenClient_instances, post_fn;
|
|
97
|
+
var DelegationTokenClient = class {
|
|
98
|
+
constructor(options) {
|
|
99
|
+
__privateAdd(this, _DelegationTokenClient_instances);
|
|
100
|
+
__privateAdd(this, _options);
|
|
101
|
+
__privateSet(this, _options, options);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Exchanges a short-lived session token for a delegation token and refresh token.
|
|
105
|
+
* The session token is obtained by the integration's frontend via `sdk.getSessionToken()`.
|
|
106
|
+
*
|
|
107
|
+
* @deprecated This beta identity delegation API may change with breaking changes.
|
|
108
|
+
*/
|
|
109
|
+
async exchangeSessionToken(sessionToken) {
|
|
110
|
+
return __privateMethod(this, _DelegationTokenClient_instances, post_fn).call(this, {
|
|
111
|
+
grant_type: "delegation_token",
|
|
112
|
+
sessionToken,
|
|
113
|
+
integrationId: __privateGet(this, _options).integrationId,
|
|
114
|
+
integrationSecret: __privateGet(this, _options).integrationSecret
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Exchanges a refresh token for a new delegation token and a new refresh token.
|
|
119
|
+
*
|
|
120
|
+
* Replay posture: refresh tokens are bearer credentials that are valid until
|
|
121
|
+
* their server-side expiry. They are NOT single-use — a captured refresh token can be
|
|
122
|
+
* replayed by an attacker that also has the integration secret until it expires.
|
|
123
|
+
* Single-use enforcement (refresh-token storage, family/jti tracking, replay revocation)
|
|
124
|
+
* is tracked in `UNI-9279`.
|
|
125
|
+
*
|
|
126
|
+
* @deprecated This beta identity delegation API may change with breaking changes.
|
|
127
|
+
*/
|
|
128
|
+
async refreshDelegationToken(refreshToken) {
|
|
129
|
+
return __privateMethod(this, _DelegationTokenClient_instances, post_fn).call(this, {
|
|
130
|
+
grant_type: "refresh_token",
|
|
131
|
+
refreshToken,
|
|
132
|
+
integrationId: __privateGet(this, _options).integrationId,
|
|
133
|
+
integrationSecret: __privateGet(this, _options).integrationSecret
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
_options = new WeakMap();
|
|
138
|
+
_DelegationTokenClient_instances = new WeakSet();
|
|
139
|
+
post_fn = async function(body) {
|
|
140
|
+
const url = `${__privateGet(this, _options).apiHost}/api/v1/token`;
|
|
141
|
+
const response = await fetch(url, {
|
|
142
|
+
method: "POST",
|
|
143
|
+
headers: { "Content-Type": "application/json" },
|
|
144
|
+
body: JSON.stringify(body)
|
|
145
|
+
});
|
|
146
|
+
if (!response.ok) {
|
|
147
|
+
await response.text().catch(() => "");
|
|
148
|
+
throw buildDelegationTokenError(response.status);
|
|
149
|
+
}
|
|
150
|
+
return await response.json();
|
|
151
|
+
};
|
|
152
|
+
|
|
49
153
|
// src/clients/IntegrationDefinitionClient.ts
|
|
50
154
|
var import_api = require("@uniformdev/context/api");
|
|
51
|
-
var _url;
|
|
155
|
+
var _url, _credentialsUrl;
|
|
52
156
|
var _IntegrationDefinitionClient = class _IntegrationDefinitionClient extends import_api.ApiClient {
|
|
53
157
|
constructor(options) {
|
|
54
158
|
super(options);
|
|
@@ -59,7 +163,7 @@ var _IntegrationDefinitionClient = class _IntegrationDefinitionClient extends im
|
|
|
59
163
|
const fetchUri = this.createUrl(__privateGet(_IntegrationDefinitionClient, _url), { ...options, teamId });
|
|
60
164
|
return await this.apiClient(fetchUri);
|
|
61
165
|
}
|
|
62
|
-
/** Creates or updates a mesh app definition on a team */
|
|
166
|
+
/** Creates or updates a mesh app definition on a team. Identity-delegation credentials must be minted separately via {@link rotateCredential}. */
|
|
63
167
|
async upsert(body) {
|
|
64
168
|
const fetchUri = this.createUrl(__privateGet(_IntegrationDefinitionClient, _url));
|
|
65
169
|
return await this.apiClient(fetchUri, {
|
|
@@ -76,9 +180,37 @@ var _IntegrationDefinitionClient = class _IntegrationDefinitionClient extends im
|
|
|
76
180
|
expectNoContent: true
|
|
77
181
|
});
|
|
78
182
|
}
|
|
183
|
+
/**
|
|
184
|
+
* Mints or rotates an identity-delegation credential for an integration definition. The plaintext
|
|
185
|
+
* `appSecret` is returned exactly once and is not retrievable afterwards — Uniform stores only
|
|
186
|
+
* the hash. A successful response invalidates any previously-issued secret of the same kind.
|
|
187
|
+
* Caller must be a team admin.
|
|
188
|
+
*/
|
|
189
|
+
async rotateCredential(body) {
|
|
190
|
+
const fetchUri = this.createUrl(__privateGet(_IntegrationDefinitionClient, _credentialsUrl));
|
|
191
|
+
return await this.apiClient(fetchUri, {
|
|
192
|
+
method: "POST",
|
|
193
|
+
body: JSON.stringify({ ...body, teamId: this.options.teamId })
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Revokes an identity-delegation credential. Future delegation grants and refreshes will fail
|
|
198
|
+
* until a new credential is minted; in-flight delegation tokens remain valid until natural
|
|
199
|
+
* expiry (up to ~15 minutes). Caller must be a team admin.
|
|
200
|
+
*/
|
|
201
|
+
async revokeCredential(body) {
|
|
202
|
+
const fetchUri = this.createUrl(__privateGet(_IntegrationDefinitionClient, _credentialsUrl));
|
|
203
|
+
await this.apiClient(fetchUri, {
|
|
204
|
+
method: "DELETE",
|
|
205
|
+
body: JSON.stringify({ ...body, teamId: this.options.teamId }),
|
|
206
|
+
expectNoContent: true
|
|
207
|
+
});
|
|
208
|
+
}
|
|
79
209
|
};
|
|
80
210
|
_url = new WeakMap();
|
|
211
|
+
_credentialsUrl = new WeakMap();
|
|
81
212
|
__privateAdd(_IntegrationDefinitionClient, _url, "/api/v1/integration-definitions");
|
|
213
|
+
__privateAdd(_IntegrationDefinitionClient, _credentialsUrl, "/api/v1/integration-credentials");
|
|
82
214
|
var IntegrationDefinitionClient = _IntegrationDefinitionClient;
|
|
83
215
|
|
|
84
216
|
// src/clients/IntegrationInstallationClient.ts
|
|
@@ -172,7 +304,7 @@ var getLogger = (prefix, debug) => {
|
|
|
172
304
|
};
|
|
173
305
|
|
|
174
306
|
// src/temp/version.ts
|
|
175
|
-
var UNIFORM_MESH_SDK_VERSION = "20.
|
|
307
|
+
var UNIFORM_MESH_SDK_VERSION = "20.61.1";
|
|
176
308
|
|
|
177
309
|
// src/framepost/constants.ts
|
|
178
310
|
var DEFAULT_REQUEST_TIMEOUT = 5e3;
|
|
@@ -529,56 +661,63 @@ async function connectToParent({
|
|
|
529
661
|
});
|
|
530
662
|
client.onRequest("metadata-value", onMetadataUpdated);
|
|
531
663
|
client.onRequest("external-value-update", onValueExternallyUpdated);
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
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
|
-
);
|
|
664
|
+
const parent = {
|
|
665
|
+
resize: async ({ height }) => {
|
|
666
|
+
await client.request("resize", { height });
|
|
667
|
+
},
|
|
668
|
+
setValue: async (value) => {
|
|
669
|
+
await client.request("setValue", value);
|
|
670
|
+
},
|
|
671
|
+
openDialog: async (message) => {
|
|
672
|
+
const res = await client.request(
|
|
673
|
+
"openDialog",
|
|
674
|
+
message
|
|
675
|
+
);
|
|
676
|
+
const dialogId = res == null ? void 0 : res.dialogId;
|
|
677
|
+
if (!dialogId) {
|
|
678
|
+
return;
|
|
579
679
|
}
|
|
680
|
+
return new Promise((resolve, reject) => {
|
|
681
|
+
dialogResponseHandlers[dialogId] = { resolve, reject };
|
|
682
|
+
});
|
|
683
|
+
},
|
|
684
|
+
closeDialog: async (message) => {
|
|
685
|
+
await client.request("closeDialog", message);
|
|
686
|
+
},
|
|
687
|
+
getDataResource: async (message) => {
|
|
688
|
+
return await client.request("getDataResource", message, {
|
|
689
|
+
timeout: 3e4
|
|
690
|
+
});
|
|
691
|
+
},
|
|
692
|
+
navigate: async (message) => {
|
|
693
|
+
await client.request("navigate", message);
|
|
694
|
+
},
|
|
695
|
+
reloadLocation: async () => {
|
|
696
|
+
await client.request("reload");
|
|
697
|
+
},
|
|
698
|
+
editConnectedData: async (message) => {
|
|
699
|
+
return await client.request(
|
|
700
|
+
"editConnectedData",
|
|
701
|
+
message,
|
|
702
|
+
{
|
|
703
|
+
timeout: (
|
|
704
|
+
// 24 hours in ms
|
|
705
|
+
864e5
|
|
706
|
+
)
|
|
707
|
+
}
|
|
708
|
+
);
|
|
709
|
+
},
|
|
710
|
+
getSessionToken: async () => {
|
|
711
|
+
return await client.request("getSessionToken", void 0, {
|
|
712
|
+
// Delegation may wait on consent UI + token API; default framepost timeout (5s) is too short.
|
|
713
|
+
timeout: 12e4
|
|
714
|
+
});
|
|
580
715
|
}
|
|
581
716
|
};
|
|
717
|
+
return {
|
|
718
|
+
initData,
|
|
719
|
+
parent
|
|
720
|
+
};
|
|
582
721
|
}
|
|
583
722
|
|
|
584
723
|
// src/sdkWindow.ts
|
|
@@ -857,7 +996,8 @@ async function initializeUniformMeshSDK({
|
|
|
857
996
|
},
|
|
858
997
|
closeCurrentLocationDialog: async () => {
|
|
859
998
|
await parent.closeDialog({ dialogId: void 0, dialogType: "currentLocation" });
|
|
860
|
-
}
|
|
999
|
+
},
|
|
1000
|
+
getSessionToken: () => parent.getSessionToken()
|
|
861
1001
|
};
|
|
862
1002
|
window.UniformMeshSDK = sdk;
|
|
863
1003
|
initializing = false;
|
|
@@ -880,6 +1020,8 @@ var hasRole = (role, user) => {
|
|
|
880
1020
|
};
|
|
881
1021
|
// Annotate the CommonJS export names for ESM import in node:
|
|
882
1022
|
0 && (module.exports = {
|
|
1023
|
+
DelegationTokenClient,
|
|
1024
|
+
DelegationTokenError,
|
|
883
1025
|
IntegrationDefinitionClient,
|
|
884
1026
|
IntegrationInstallationClient,
|
|
885
1027
|
functionCallSystemParameters,
|