@uniformdev/mesh-sdk 20.50.2-alpha.1 → 20.50.2-alpha.109
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 +823 -46
- package/dist/index.d.ts +823 -46
- package/dist/index.esm.js +297 -50
- package/dist/index.js +299 -50
- package/dist/index.mjs +297 -50
- 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.66.5";
|
|
135
265
|
|
|
136
266
|
// src/framepost/constants.ts
|
|
137
267
|
var DEFAULT_REQUEST_TIMEOUT = 5e3;
|
|
@@ -488,54 +618,167 @@ async function connectToParent({
|
|
|
488
618
|
});
|
|
489
619
|
client.onRequest("metadata-value", onMetadataUpdated);
|
|
490
620
|
client.onRequest("external-value-update", onValueExternallyUpdated);
|
|
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;
|
|
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
|
+
});
|
|
672
|
+
},
|
|
673
|
+
editorState: createEditorStateApi(client)
|
|
674
|
+
};
|
|
491
675
|
return {
|
|
492
676
|
initData,
|
|
493
|
-
parent
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
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
|
-
);
|
|
677
|
+
parent
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
function createEditorStateApi(client) {
|
|
681
|
+
let cachedRootNodeId;
|
|
682
|
+
return {
|
|
683
|
+
async getRootNodeId() {
|
|
684
|
+
if (cachedRootNodeId) {
|
|
685
|
+
return cachedRootNodeId;
|
|
538
686
|
}
|
|
687
|
+
const result = await client.request("editorState.getRootNodeId");
|
|
688
|
+
cachedRootNodeId = result;
|
|
689
|
+
return result;
|
|
690
|
+
},
|
|
691
|
+
// Read operations
|
|
692
|
+
async exportTree(params) {
|
|
693
|
+
const result = await client.request("editorState.exportTree", params);
|
|
694
|
+
cachedRootNodeId != null ? cachedRootNodeId : cachedRootNodeId = result == null ? void 0 : result._id;
|
|
695
|
+
return result;
|
|
696
|
+
},
|
|
697
|
+
async exportSubtree(params) {
|
|
698
|
+
return await client.request("editorState.exportSubtree", params);
|
|
699
|
+
},
|
|
700
|
+
async exportMetadata() {
|
|
701
|
+
return await client.request("editorState.exportMetadata");
|
|
702
|
+
},
|
|
703
|
+
async exportRootNodeMetadata() {
|
|
704
|
+
return await client.request("editorState.exportRootNodeMetadata");
|
|
705
|
+
},
|
|
706
|
+
async getNodeById(params) {
|
|
707
|
+
return await client.request("editorState.getNodeById", params);
|
|
708
|
+
},
|
|
709
|
+
async getNodeChildren(params) {
|
|
710
|
+
return await client.request("editorState.getNodeChildren", params);
|
|
711
|
+
},
|
|
712
|
+
async getNodeProperty(params) {
|
|
713
|
+
return await client.request("editorState.getNodeProperty", params);
|
|
714
|
+
},
|
|
715
|
+
async getNodeProperties(params) {
|
|
716
|
+
return await client.request("editorState.getNodeProperties", params);
|
|
717
|
+
},
|
|
718
|
+
async getParentInfo(params) {
|
|
719
|
+
return await client.request("editorState.getParentInfo", params);
|
|
720
|
+
},
|
|
721
|
+
// Selection
|
|
722
|
+
async getSelectedNodeId() {
|
|
723
|
+
return await client.request("editorState.getSelectedNodeId");
|
|
724
|
+
},
|
|
725
|
+
async setSelectedNodeId(params) {
|
|
726
|
+
await client.request("editorState.setSelectedNodeId", params);
|
|
727
|
+
},
|
|
728
|
+
async getSelectedParameterId() {
|
|
729
|
+
return await client.request("editorState.getSelectedParameterId");
|
|
730
|
+
},
|
|
731
|
+
async setSelectedParameterId(params) {
|
|
732
|
+
await client.request("editorState.setSelectedParameterId", params);
|
|
733
|
+
},
|
|
734
|
+
async getPristine() {
|
|
735
|
+
return await client.request("editorState.getPristine");
|
|
736
|
+
},
|
|
737
|
+
// Write operations
|
|
738
|
+
async insertNode(params) {
|
|
739
|
+
return await client.request("editorState.insertNode", params);
|
|
740
|
+
},
|
|
741
|
+
async deleteNode(params) {
|
|
742
|
+
await client.request("editorState.deleteNode", params);
|
|
743
|
+
},
|
|
744
|
+
async moveNode(params) {
|
|
745
|
+
await client.request("editorState.moveNode", params);
|
|
746
|
+
},
|
|
747
|
+
async updateNodeProperty(params) {
|
|
748
|
+
await client.request("editorState.updateNodeProperty", params);
|
|
749
|
+
},
|
|
750
|
+
async updateRootMetadata(params) {
|
|
751
|
+
await client.request("editorState.updateRootMetadata", params);
|
|
752
|
+
},
|
|
753
|
+
async updateRootNode(params) {
|
|
754
|
+
await client.request("editorState.updateRootNode", params);
|
|
755
|
+
},
|
|
756
|
+
// Pattern operations
|
|
757
|
+
async insertPattern(params) {
|
|
758
|
+
return await client.request("editorState.insertPattern", params);
|
|
759
|
+
},
|
|
760
|
+
async isPatternPropertyOverridden(params) {
|
|
761
|
+
return await client.request("editorState.isPatternPropertyOverridden", params);
|
|
762
|
+
},
|
|
763
|
+
async resetPatternPropertyOverride(params) {
|
|
764
|
+
await client.request("editorState.resetPatternPropertyOverride", params);
|
|
765
|
+
},
|
|
766
|
+
async setPropertyLocalizability(params) {
|
|
767
|
+
await client.request("editorState.setPropertyLocalizability", params);
|
|
768
|
+
},
|
|
769
|
+
// Locale operations
|
|
770
|
+
async enableLocale(params) {
|
|
771
|
+
await client.request("editorState.enableLocale", params);
|
|
772
|
+
},
|
|
773
|
+
async disableLocale(params) {
|
|
774
|
+
await client.request("editorState.disableLocale", params);
|
|
775
|
+
},
|
|
776
|
+
async setCurrentLocale(params) {
|
|
777
|
+
await client.request("editorState.setCurrentLocale", params);
|
|
778
|
+
},
|
|
779
|
+
// Dynamic input operations
|
|
780
|
+
async setDynamicInputPreviewValue(params) {
|
|
781
|
+
await client.request("editorState.setDynamicInputPreviewValue", params);
|
|
539
782
|
}
|
|
540
783
|
};
|
|
541
784
|
}
|
|
@@ -733,7 +976,8 @@ async function initializeUniformMeshSDK({
|
|
|
733
976
|
sdk.events.emit("onValueChanged", { newValue: value });
|
|
734
977
|
await parent.setValue({ uniformMeshLocationValue: value, closeDialog: true });
|
|
735
978
|
}
|
|
736
|
-
} : void 0
|
|
979
|
+
} : void 0,
|
|
980
|
+
editorState: parent.editorState
|
|
737
981
|
};
|
|
738
982
|
return location;
|
|
739
983
|
},
|
|
@@ -816,7 +1060,8 @@ async function initializeUniformMeshSDK({
|
|
|
816
1060
|
},
|
|
817
1061
|
closeCurrentLocationDialog: async () => {
|
|
818
1062
|
await parent.closeDialog({ dialogId: void 0, dialogType: "currentLocation" });
|
|
819
|
-
}
|
|
1063
|
+
},
|
|
1064
|
+
getSessionToken: () => parent.getSessionToken()
|
|
820
1065
|
};
|
|
821
1066
|
window.UniformMeshSDK = sdk;
|
|
822
1067
|
initializing = false;
|
|
@@ -838,6 +1083,8 @@ var hasRole = (role, user) => {
|
|
|
838
1083
|
return user.roles.some((userRole) => userRole.name === role || userRole.id === role);
|
|
839
1084
|
};
|
|
840
1085
|
export {
|
|
1086
|
+
DelegationTokenClient,
|
|
1087
|
+
DelegationTokenError,
|
|
841
1088
|
IntegrationDefinitionClient,
|
|
842
1089
|
IntegrationInstallationClient,
|
|
843
1090
|
functionCallSystemParameters,
|