@shapediver/sdk.platform-api-sdk-v1 2.15.0 → 2.15.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/LICENSE +0 -0
- package/README.md +0 -0
- package/dist/SdPlatformErrors.d.ts +0 -0
- package/dist/SdPlatformErrors.d.ts.map +0 -0
- package/dist/SdPlatformErrors.js +147 -0
- package/dist/SdPlatformErrors.js.map +1 -0
- package/dist/SdPlatformSdk.d.ts +0 -0
- package/dist/SdPlatformSdk.d.ts.map +0 -0
- package/dist/SdPlatformSdk.js +265 -0
- package/dist/SdPlatformSdk.js.map +1 -0
- package/dist/SdPlatformSdkContext.d.ts +0 -0
- package/dist/SdPlatformSdkContext.d.ts.map +0 -0
- package/dist/SdPlatformSdkContext.js +88 -0
- package/dist/SdPlatformSdkContext.js.map +1 -0
- package/dist/SdPlatformSdkCreate.d.ts +0 -0
- package/dist/SdPlatformSdkCreate.d.ts.map +0 -0
- package/dist/SdPlatformSdkCreate.js +20 -0
- package/dist/SdPlatformSdkCreate.js.map +1 -0
- package/dist/api/SdPlatformRequestId.d.ts +1 -0
- package/dist/api/SdPlatformRequestId.d.ts.map +1 -1
- package/dist/api/SdPlatformRequestId.js +145 -0
- package/dist/api/SdPlatformRequestId.js.map +1 -0
- package/dist/api/SdPlatformSdkApi.d.ts +0 -0
- package/dist/api/SdPlatformSdkApi.d.ts.map +0 -0
- package/dist/api/SdPlatformSdkApi.js +173 -0
- package/dist/api/SdPlatformSdkApi.js.map +1 -0
- package/dist/api/SdPlatformSdkConfig.d.ts +0 -0
- package/dist/api/SdPlatformSdkConfig.d.ts.map +0 -0
- package/dist/api/SdPlatformSdkConfig.js +21 -0
- package/dist/api/SdPlatformSdkConfig.js.map +1 -0
- package/dist/api/SdPlatformSdkErrorMapping.d.ts +0 -0
- package/dist/api/SdPlatformSdkErrorMapping.d.ts.map +0 -0
- package/dist/api/SdPlatformSdkErrorMapping.js +84 -0
- package/dist/api/SdPlatformSdkErrorMapping.js.map +1 -0
- package/dist/auth/SdPlatformAuthServiceApi.d.ts +0 -0
- package/dist/auth/SdPlatformAuthServiceApi.d.ts.map +0 -0
- package/dist/auth/SdPlatformAuthServiceApi.js +225 -0
- package/dist/auth/SdPlatformAuthServiceApi.js.map +1 -0
- package/dist/index.d.ts +0 -0
- package/dist/index.d.ts.map +0 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/resources/SdPlatformApiClientsApi.d.ts +0 -0
- package/dist/resources/SdPlatformApiClientsApi.d.ts.map +0 -0
- package/dist/resources/SdPlatformApiClientsApi.js +54 -0
- package/dist/resources/SdPlatformApiClientsApi.js.map +1 -0
- package/dist/resources/SdPlatformApiTokenApi.d.ts +0 -0
- package/dist/resources/SdPlatformApiTokenApi.d.ts.map +0 -0
- package/dist/resources/SdPlatformApiTokenApi.js +58 -0
- package/dist/resources/SdPlatformApiTokenApi.js.map +1 -0
- package/dist/resources/SdPlatformBackendSystemApi.d.ts +0 -0
- package/dist/resources/SdPlatformBackendSystemApi.d.ts.map +0 -0
- package/dist/resources/SdPlatformBackendSystemApi.js +55 -0
- package/dist/resources/SdPlatformBackendSystemApi.js.map +1 -0
- package/dist/resources/SdPlatformBookmarkApi.d.ts +0 -0
- package/dist/resources/SdPlatformBookmarkApi.d.ts.map +0 -0
- package/dist/resources/SdPlatformBookmarkApi.js +34 -0
- package/dist/resources/SdPlatformBookmarkApi.js.map +1 -0
- package/dist/resources/SdPlatformChargebeeApi.d.ts +0 -0
- package/dist/resources/SdPlatformChargebeeApi.d.ts.map +0 -0
- package/dist/resources/SdPlatformChargebeeApi.js +57 -0
- package/dist/resources/SdPlatformChargebeeApi.js.map +1 -0
- package/dist/resources/SdPlatformDocumentApi.d.ts +0 -0
- package/dist/resources/SdPlatformDocumentApi.d.ts.map +0 -0
- package/dist/resources/SdPlatformDocumentApi.js +86 -0
- package/dist/resources/SdPlatformDocumentApi.js.map +1 -0
- package/dist/resources/SdPlatformDomainApi.d.ts +0 -0
- package/dist/resources/SdPlatformDomainApi.d.ts.map +0 -0
- package/dist/resources/SdPlatformDomainApi.js +63 -0
- package/dist/resources/SdPlatformDomainApi.js.map +1 -0
- package/dist/resources/SdPlatformHttpLogApi.d.ts +0 -0
- package/dist/resources/SdPlatformHttpLogApi.d.ts.map +0 -0
- package/dist/resources/SdPlatformHttpLogApi.js +23 -0
- package/dist/resources/SdPlatformHttpLogApi.js.map +1 -0
- package/dist/resources/SdPlatformImageApi.d.ts +0 -0
- package/dist/resources/SdPlatformImageApi.d.ts.map +0 -0
- package/dist/resources/SdPlatformImageApi.js +55 -0
- package/dist/resources/SdPlatformImageApi.js.map +1 -0
- package/dist/resources/SdPlatformJobLogApi.d.ts +0 -0
- package/dist/resources/SdPlatformJobLogApi.d.ts.map +0 -0
- package/dist/resources/SdPlatformJobLogApi.js +23 -0
- package/dist/resources/SdPlatformJobLogApi.js.map +1 -0
- package/dist/resources/SdPlatformModelApi.d.ts +0 -0
- package/dist/resources/SdPlatformModelApi.d.ts.map +0 -0
- package/dist/resources/SdPlatformModelApi.js +105 -0
- package/dist/resources/SdPlatformModelApi.js.map +1 -0
- package/dist/resources/SdPlatformModelSharingApi.d.ts +0 -0
- package/dist/resources/SdPlatformModelSharingApi.d.ts.map +0 -0
- package/dist/resources/SdPlatformModelSharingApi.js +88 -0
- package/dist/resources/SdPlatformModelSharingApi.js.map +1 -0
- package/dist/resources/SdPlatformModelTokenApi.d.ts +0 -0
- package/dist/resources/SdPlatformModelTokenApi.d.ts.map +0 -0
- package/dist/resources/SdPlatformModelTokenApi.js +23 -0
- package/dist/resources/SdPlatformModelTokenApi.js.map +1 -0
- package/dist/resources/SdPlatformModelTransferApi.d.ts +0 -0
- package/dist/resources/SdPlatformModelTransferApi.d.ts.map +0 -0
- package/dist/resources/SdPlatformModelTransferApi.js +65 -0
- package/dist/resources/SdPlatformModelTransferApi.js.map +1 -0
- package/dist/resources/SdPlatformNotificationApi.d.ts +0 -0
- package/dist/resources/SdPlatformNotificationApi.d.ts.map +0 -0
- package/dist/resources/SdPlatformNotificationApi.js +86 -0
- package/dist/resources/SdPlatformNotificationApi.js.map +1 -0
- package/dist/resources/SdPlatformOpenIDProviderApi.d.ts +0 -0
- package/dist/resources/SdPlatformOpenIDProviderApi.d.ts.map +0 -0
- package/dist/resources/SdPlatformOpenIDProviderApi.js +58 -0
- package/dist/resources/SdPlatformOpenIDProviderApi.js.map +1 -0
- package/dist/resources/SdPlatformOrganizationAnalyticsApi.d.ts +0 -0
- package/dist/resources/SdPlatformOrganizationAnalyticsApi.d.ts.map +0 -0
- package/dist/resources/SdPlatformOrganizationAnalyticsApi.js +23 -0
- package/dist/resources/SdPlatformOrganizationAnalyticsApi.js.map +1 -0
- package/dist/resources/SdPlatformOrganizationApi.d.ts +7 -1
- package/dist/resources/SdPlatformOrganizationApi.d.ts.map +1 -1
- package/dist/resources/SdPlatformOrganizationApi.js +139 -0
- package/dist/resources/SdPlatformOrganizationApi.js.map +1 -0
- package/dist/resources/SdPlatformPolicyApi.d.ts +0 -0
- package/dist/resources/SdPlatformPolicyApi.d.ts.map +0 -0
- package/dist/resources/SdPlatformPolicyApi.js +56 -0
- package/dist/resources/SdPlatformPolicyApi.js.map +1 -0
- package/dist/resources/SdPlatformSavedStateApi.d.ts +0 -0
- package/dist/resources/SdPlatformSavedStateApi.d.ts.map +0 -0
- package/dist/resources/SdPlatformSavedStateApi.js +69 -0
- package/dist/resources/SdPlatformSavedStateApi.js.map +1 -0
- package/dist/resources/SdPlatformSavedStateSharingApi.d.ts +0 -0
- package/dist/resources/SdPlatformSavedStateSharingApi.d.ts.map +0 -0
- package/dist/resources/SdPlatformSavedStateSharingApi.js +88 -0
- package/dist/resources/SdPlatformSavedStateSharingApi.js.map +1 -0
- package/dist/resources/SdPlatformStargateApi.d.ts +0 -0
- package/dist/resources/SdPlatformStargateApi.d.ts.map +0 -0
- package/dist/resources/SdPlatformStargateApi.js +21 -0
- package/dist/resources/SdPlatformStargateApi.js.map +1 -0
- package/dist/resources/SdPlatformTagApi.d.ts +0 -0
- package/dist/resources/SdPlatformTagApi.d.ts.map +0 -0
- package/dist/resources/SdPlatformTagApi.js +35 -0
- package/dist/resources/SdPlatformTagApi.js.map +1 -0
- package/dist/resources/SdPlatformUserAnalyticsApi.d.ts +0 -0
- package/dist/resources/SdPlatformUserAnalyticsApi.d.ts.map +0 -0
- package/dist/resources/SdPlatformUserAnalyticsApi.js +23 -0
- package/dist/resources/SdPlatformUserAnalyticsApi.js.map +1 -0
- package/dist/resources/SdPlatformUserApi.d.ts +0 -0
- package/dist/resources/SdPlatformUserApi.d.ts.map +0 -0
- package/dist/resources/SdPlatformUserApi.js +118 -0
- package/dist/resources/SdPlatformUserApi.js.map +1 -0
- package/dist/resources/SdPlatformWebhookApi.d.ts +0 -0
- package/dist/resources/SdPlatformWebhookApi.d.ts.map +0 -0
- package/dist/resources/SdPlatformWebhookApi.js +67 -0
- package/dist/resources/SdPlatformWebhookApi.js.map +1 -0
- package/dist/resources/commons/FilterBuilder.d.ts +0 -0
- package/dist/resources/commons/FilterBuilder.d.ts.map +0 -0
- package/dist/resources/commons/FilterBuilder.js +65 -0
- package/dist/resources/commons/FilterBuilder.js.map +1 -0
- package/dist/resources/commons/ResourcesApi.d.ts +0 -0
- package/dist/resources/commons/ResourcesApi.d.ts.map +0 -0
- package/dist/resources/commons/ResourcesApi.js +112 -0
- package/dist/resources/commons/ResourcesApi.js.map +1 -0
- package/package.json +5 -9
- package/dist/bundle.js +0 -6859
- package/dist/bundle.node.js +0 -8946
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RequestId = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Identifier for type of request to the ShapeDiver Platform Backend.
|
|
6
|
+
*/
|
|
7
|
+
var RequestId;
|
|
8
|
+
(function (RequestId) {
|
|
9
|
+
/**
|
|
10
|
+
* Platform Authentication API
|
|
11
|
+
*/
|
|
12
|
+
RequestId["PasswordGrant"] = "password_grant";
|
|
13
|
+
RequestId["RefreshToken"] = "refresh_token";
|
|
14
|
+
RequestId["AuthorizationCode"] = "authorization_code";
|
|
15
|
+
RequestId["Logout"] = "logout";
|
|
16
|
+
RequestId["RequestAuthorizationCode"] = "request_authorization_code";
|
|
17
|
+
/**
|
|
18
|
+
* Platform Backend API
|
|
19
|
+
*/
|
|
20
|
+
RequestId["ApiTokenGet"] = "api_token_get";
|
|
21
|
+
RequestId["ApiTokenQuery"] = "api_token_query";
|
|
22
|
+
RequestId["ApiTokenCreate"] = "api_token_create";
|
|
23
|
+
RequestId["ApiTokenPatch"] = "api_token_patch";
|
|
24
|
+
RequestId["ApiTokenDelete"] = "api_token_delete";
|
|
25
|
+
RequestId["ApiClientQuery"] = "api_client_query";
|
|
26
|
+
RequestId["ApiClientCreate"] = "api_client_create";
|
|
27
|
+
RequestId["ApiClientPatch"] = "api_client_patch";
|
|
28
|
+
RequestId["ApiClientDelete"] = "api_client_delete";
|
|
29
|
+
RequestId["BackendSystemQuery"] = "backend_system_query";
|
|
30
|
+
RequestId["BackendSystemCreate"] = "backend_system_create";
|
|
31
|
+
RequestId["BackendSystemPatch"] = "backend_system_patch";
|
|
32
|
+
RequestId["BackendSystemDelete"] = "backend_system_delete";
|
|
33
|
+
RequestId["BackendSystemToken"] = "backend_system_token";
|
|
34
|
+
RequestId["BookmarkCreate"] = "bookmark_create";
|
|
35
|
+
RequestId["BookmarkDelete"] = "bookmark_delete";
|
|
36
|
+
RequestId["ImageGet"] = "image_get";
|
|
37
|
+
RequestId["ImageQuery"] = "image_query";
|
|
38
|
+
RequestId["ImageCreate"] = "image_create";
|
|
39
|
+
RequestId["ImagesDelete"] = "image_delete";
|
|
40
|
+
RequestId["PolicyGet"] = "policy_get";
|
|
41
|
+
RequestId["PolicyQuery"] = "policy_query";
|
|
42
|
+
RequestId["PolicyCreate"] = "policy_create";
|
|
43
|
+
RequestId["PolicyPatch"] = "policy_patch";
|
|
44
|
+
RequestId["PolicyDelete"] = "policy_delete";
|
|
45
|
+
RequestId["TagGet"] = "tag_get";
|
|
46
|
+
RequestId["TagQuery"] = "tag_query";
|
|
47
|
+
RequestId["TokenCreate"] = "token_create";
|
|
48
|
+
RequestId["UserGet"] = "user_get";
|
|
49
|
+
RequestId["UserQuery"] = "user_query";
|
|
50
|
+
RequestId["UserPatch"] = "user_patch";
|
|
51
|
+
RequestId["UserDelete"] = "user_delete";
|
|
52
|
+
RequestId["UserRegister"] = "user_register";
|
|
53
|
+
RequestId["UserConfirm"] = "user_confirm";
|
|
54
|
+
RequestId["UserRefreshToken"] = "user_refresh_token";
|
|
55
|
+
RequestId["UserDeleteRefreshToken"] = "user_delete_refresh_token";
|
|
56
|
+
RequestId["PasswordReset"] = "password_reset";
|
|
57
|
+
RequestId["PasswordResetConfirm"] = "password_reset_confirm";
|
|
58
|
+
RequestId["ModelGet"] = "model_get";
|
|
59
|
+
RequestId["ModelQuery"] = "model_query";
|
|
60
|
+
RequestId["ModelCreate"] = "model_create";
|
|
61
|
+
RequestId["ModelPatch"] = "model_patch";
|
|
62
|
+
RequestId["ModelDelete"] = "model_delete";
|
|
63
|
+
RequestId["DecryptTicket"] = "decrypt_ticket";
|
|
64
|
+
RequestId["ModelIframeData"] = "model_iframe_data";
|
|
65
|
+
RequestId["SavedStateGet"] = "saved_state_get";
|
|
66
|
+
RequestId["SavedStateQuery"] = "saved_state_query";
|
|
67
|
+
RequestId["SavedStatePatch"] = "saved_state_patch";
|
|
68
|
+
RequestId["SavedStateCreate"] = "saved_state_create";
|
|
69
|
+
RequestId["SavedStateDelete"] = "saved_state_delete";
|
|
70
|
+
RequestId["DomainGet"] = "domain_get";
|
|
71
|
+
RequestId["DomainQuery"] = "domain_query";
|
|
72
|
+
RequestId["DomainCreate"] = "domain_create";
|
|
73
|
+
RequestId["DomainPatch"] = "domain_patch";
|
|
74
|
+
RequestId["DomainDelete"] = "domain_delete";
|
|
75
|
+
RequestId["OpenIDProviderGet"] = "openid_provider_get";
|
|
76
|
+
RequestId["OpenIDProviderCreate"] = "openid_provider_create";
|
|
77
|
+
RequestId["OpenIDProviderQuery"] = "openid_provider_query";
|
|
78
|
+
RequestId["OpenIDProviderPatch"] = "openid_provider_patch";
|
|
79
|
+
RequestId["OpenIDPRoviderDelete"] = "openid_provider_delete";
|
|
80
|
+
RequestId["OrganizationGet"] = "organization_get";
|
|
81
|
+
RequestId["OrganizationQuery"] = "organization_query";
|
|
82
|
+
RequestId["OrganizationCreate"] = "organization_create";
|
|
83
|
+
RequestId["OrganizationDelete"] = "organization_delete";
|
|
84
|
+
RequestId["OrganizationPatch"] = "organization_patch";
|
|
85
|
+
RequestId["OrganizationInvitationCreate"] = "organization_invitation_create";
|
|
86
|
+
RequestId["OrganizationInvitationDelete"] = "organization_invitation_delete";
|
|
87
|
+
RequestId["OrganizationInvitationsGet"] = "organization_invitation_get";
|
|
88
|
+
RequestId["OrganizationInvitationAccept"] = "organization_invitation_accept";
|
|
89
|
+
RequestId["OrganizationInvitationDeny"] = "organization_invitation_deny";
|
|
90
|
+
RequestId["OrganizationPatchMemberRole"] = "organization_patch_member_role";
|
|
91
|
+
RequestId["OrganizationInvitationByEmail"] = "organization_invitation_by_email";
|
|
92
|
+
RequestId["OrganizationIdentifySSO"] = "organization_identify_sso";
|
|
93
|
+
RequestId["NotificationGet"] = "notification_get";
|
|
94
|
+
RequestId["NotificationQuery"] = "notification_query";
|
|
95
|
+
RequestId["NotificationCreate"] = "notification_create";
|
|
96
|
+
RequestId["NotificationPatch"] = "notification_patch";
|
|
97
|
+
RequestId["NotificationDelete"] = "notification_delete";
|
|
98
|
+
RequestId["NotificationSummary"] = "notification_summary";
|
|
99
|
+
RequestId["NotificationReadAll"] = "notification_read_all";
|
|
100
|
+
RequestId["UserModelSessionsQuery"] = "user_model_sessions_query";
|
|
101
|
+
RequestId["OrganizationModelSessionsQuery"] = "organization_model_sessions_query";
|
|
102
|
+
RequestId["ChargebeeHostedPage"] = "chargebee_hosted_page";
|
|
103
|
+
RequestId["ChargebeeHostedPageUpdatePaymentMethod"] = "chargebee_hosted_page_update_payment_method";
|
|
104
|
+
RequestId["ChargebeePortalSession"] = "chargebee_portal_session";
|
|
105
|
+
RequestId["ChargebeeConfig"] = "chargebee_config";
|
|
106
|
+
RequestId["ChargebeeQueryPlan"] = "chargebee_query_plan";
|
|
107
|
+
RequestId["HttpLogQuery"] = "http_log_query";
|
|
108
|
+
RequestId["ModelSharingCreate"] = "model_sharing_create";
|
|
109
|
+
RequestId["ModelSharingCreateMultiple"] = "model_sharing_create_multiple";
|
|
110
|
+
RequestId["ModelSharingQuery"] = "model_sharing_query";
|
|
111
|
+
RequestId["ModelSharingQueryByModel"] = "model_sharing_query_by_model";
|
|
112
|
+
RequestId["ModelSharingQueryByUser"] = "model_sharing_query_by_user";
|
|
113
|
+
RequestId["ModelSharingGetByModelAndUser"] = "model_sharing_get_by_model_and_user";
|
|
114
|
+
RequestId["ModelSharingDelete"] = "model_sharing_delete";
|
|
115
|
+
RequestId["ModelSharingGroupedByuser"] = "model_sharing_grouped_by_user";
|
|
116
|
+
RequestId["SavedStateSharingCreate"] = "saved_state_sharing_create";
|
|
117
|
+
RequestId["SavedStateSharingCreateMultiple"] = "saved_state_sharing_create_multiple";
|
|
118
|
+
RequestId["SavedStateSharingQuery"] = "saved_state_sharing_query";
|
|
119
|
+
RequestId["SavedStateSharingQueryBySavedState"] = "saved_state_sharing_query_by_saved_state";
|
|
120
|
+
RequestId["SavedStateSharingQueryByUser"] = "saved_state_sharing_query_by_user";
|
|
121
|
+
RequestId["SavedStateSharingGetBySavedStateAndUser"] = "saved_state_sharing_get_by_saved_state_and_user";
|
|
122
|
+
RequestId["SavedStateSharingDelete"] = "saved_state_sharing_delete";
|
|
123
|
+
RequestId["SavedStateSharingGroupedByuser"] = "saved_state_sharing_grouped_by_user";
|
|
124
|
+
RequestId["WebhookChargebeeEvent"] = "webhook_chargebee_event";
|
|
125
|
+
RequestId["WebhookModelMessage"] = "webhook_model_message";
|
|
126
|
+
RequestId["WebhookNotification"] = "webhook_notification";
|
|
127
|
+
RequestId["ModelTransferRequestCreate"] = "model_transfer_request_create";
|
|
128
|
+
RequestId["ModelTransferRequestDelete"] = "model_transfer_request_delete";
|
|
129
|
+
RequestId["ModelTransferRequestList"] = "model_transfer_request_list";
|
|
130
|
+
RequestId["ModelTransferRequestGet"] = "model_transfer_request_get";
|
|
131
|
+
RequestId["ModelTransferRequestAccept"] = "model_transfer_request_accept";
|
|
132
|
+
RequestId["ModelTransferRequestDeny"] = "model_transfer_request_deny";
|
|
133
|
+
RequestId["DocumentCreate"] = "document_create";
|
|
134
|
+
RequestId["DocumentQuery"] = "document_query";
|
|
135
|
+
RequestId["DocumentDelete"] = "document_delete";
|
|
136
|
+
RequestId["DocumentList"] = "document_list";
|
|
137
|
+
RequestId["DocumentDownload"] = "document_download";
|
|
138
|
+
RequestId["DocumentView"] = "document_view";
|
|
139
|
+
RequestId["DocumentAccept"] = "document_accept";
|
|
140
|
+
RequestId["DocumentBrowserDownload"] = "document_browser_download";
|
|
141
|
+
RequestId["DocumentBrowserView"] = "document_browser_view";
|
|
142
|
+
RequestId["JobLogQuery"] = "job_log_query";
|
|
143
|
+
RequestId["StargateGetConfig"] = "stargate_get_config";
|
|
144
|
+
})(RequestId = exports.RequestId || (exports.RequestId = {}));
|
|
145
|
+
//# sourceMappingURL=SdPlatformRequestId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SdPlatformRequestId.js","sourceRoot":"","sources":["../../src/api/SdPlatformRequestId.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,SAoKX;AApKD,WAAY,SAAS;IAEjB;;OAEG;IACH,6CAAgC,CAAA;IAChC,2CAA8B,CAAA;IAC9B,qDAAwC,CAAA;IACxC,8BAAiB,CAAA;IACjB,oEAAuD,CAAA;IAEvD;;OAEG;IACH,0CAA6B,CAAA;IAC7B,8CA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,2CAA8B,CAAA;IAC9B,+CAAkC,CAAA;IAClC,kEAAqD,CAAA;IACrD,0DAA6C,CAAA;IAE7C,0CAA6B,CAAA;IAE7B,sDAAyC,CAAA;AAC7C,CAAC,EApKW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAoKpB"}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.SdPlatformSdkApi = void 0;
|
|
16
|
+
const SdPlatformSdkErrorMapping_1 = require("./SdPlatformSdkErrorMapping");
|
|
17
|
+
const axios_1 = __importDefault(require("axios"));
|
|
18
|
+
var Method;
|
|
19
|
+
(function (Method) {
|
|
20
|
+
Method["GET"] = "GET";
|
|
21
|
+
Method["POST"] = "POST";
|
|
22
|
+
Method["PATCH"] = "PATCH";
|
|
23
|
+
Method["DELETE"] = "DELETE";
|
|
24
|
+
})(Method || (Method = {}));
|
|
25
|
+
/**
|
|
26
|
+
* Base API used by the authentication API and the ShapeDiver Platform resource APIs.
|
|
27
|
+
*/
|
|
28
|
+
class SdPlatformSdkApi {
|
|
29
|
+
constructor(__config) {
|
|
30
|
+
this.__config = __config;
|
|
31
|
+
this.__onRequestStart = [];
|
|
32
|
+
this.__onRequestFinished = [];
|
|
33
|
+
}
|
|
34
|
+
__toQueryString(data) {
|
|
35
|
+
const keys = Object.keys(data);
|
|
36
|
+
const mapFn = (key) => data[key] ? `${encodeURIComponent(key)}=${encodeURIComponent(data[key])}` : '';
|
|
37
|
+
return `?${keys.map(mapFn).join('&')}`;
|
|
38
|
+
}
|
|
39
|
+
__resolveRequest(url, method, config, data, headers) {
|
|
40
|
+
const request = {
|
|
41
|
+
url,
|
|
42
|
+
method,
|
|
43
|
+
withCredentials: true,
|
|
44
|
+
headers: {
|
|
45
|
+
"Content-Type": "application/json",
|
|
46
|
+
"Authorization": "",
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
if (config.access_token) {
|
|
50
|
+
request.headers["Authorization"] = `Bearer ${config.access_token}`;
|
|
51
|
+
}
|
|
52
|
+
else if (config.basic_access_token) {
|
|
53
|
+
request.headers["Authorization"] = `Basic ${config.basic_access_token}`;
|
|
54
|
+
}
|
|
55
|
+
if (config.client_id) {
|
|
56
|
+
request.headers["X-ShapeDiver-Client"] = config.client_id;
|
|
57
|
+
}
|
|
58
|
+
if (headers && Object.keys(headers).length > 0) {
|
|
59
|
+
for (const key in headers) {
|
|
60
|
+
request.headers[key] = headers[key];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (config.username) {
|
|
64
|
+
request.auth = {
|
|
65
|
+
username: config.username,
|
|
66
|
+
password: config.password
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
if (data) {
|
|
70
|
+
request.data = data;
|
|
71
|
+
}
|
|
72
|
+
return request;
|
|
73
|
+
}
|
|
74
|
+
__afterRequest(id, requestConfig, response) {
|
|
75
|
+
if (this.__onRequestFinished.length > 0) {
|
|
76
|
+
// NOTE shallow copy for now
|
|
77
|
+
// TODO use library for deep cloning!
|
|
78
|
+
const requestConfigCopy = Object.assign({}, requestConfig);
|
|
79
|
+
const responseCopy = Object.assign({}, response);
|
|
80
|
+
const requestFinishedEvent = {
|
|
81
|
+
id,
|
|
82
|
+
requestParams: {
|
|
83
|
+
method: requestConfigCopy.method,
|
|
84
|
+
url: requestConfigCopy.url,
|
|
85
|
+
data: undefined,
|
|
86
|
+
},
|
|
87
|
+
response: {
|
|
88
|
+
status: responseCopy.status,
|
|
89
|
+
data: responseCopy.data
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
this.__onRequestFinished.forEach(x => x(requestFinishedEvent));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
__fetch(id, requestInit) {
|
|
96
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
// fire event indicating that request is starting
|
|
98
|
+
if (this.__onRequestStart.length > 0) {
|
|
99
|
+
// NOTE shallow copy for now
|
|
100
|
+
// TODO use library for deep cloning!
|
|
101
|
+
const requestInitCopy = Object.assign({}, requestInit);
|
|
102
|
+
const requestStartEvent = {
|
|
103
|
+
id,
|
|
104
|
+
requestParams: {
|
|
105
|
+
method: requestInitCopy.method,
|
|
106
|
+
url: requestInitCopy.url,
|
|
107
|
+
data: requestInitCopy.data,
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
this.__onRequestStart.forEach(x => x(requestStartEvent));
|
|
111
|
+
}
|
|
112
|
+
// request
|
|
113
|
+
try {
|
|
114
|
+
const response = yield (0, axios_1.default)(Object.assign({}, requestInit));
|
|
115
|
+
this.__afterRequest(id, requestInit, response);
|
|
116
|
+
return response;
|
|
117
|
+
}
|
|
118
|
+
catch (e) {
|
|
119
|
+
const error = (0, SdPlatformSdkErrorMapping_1.mapToApiError)(e);
|
|
120
|
+
// The request was made and the server responded with a status code
|
|
121
|
+
// that falls out of the range of 2xx
|
|
122
|
+
if (e.response)
|
|
123
|
+
this.__afterRequest(id, requestInit, e.response);
|
|
124
|
+
throw error;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Register callbacks for request start events.
|
|
130
|
+
* @param cb
|
|
131
|
+
*/
|
|
132
|
+
onRequestStart(cb) {
|
|
133
|
+
this.__onRequestStart.push(cb);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Register callbacks for request finished events.
|
|
137
|
+
* @param cb
|
|
138
|
+
*/
|
|
139
|
+
onRequestFinished(cb) {
|
|
140
|
+
this.__onRequestFinished.push(cb);
|
|
141
|
+
}
|
|
142
|
+
get(id, url, config, queryParams) {
|
|
143
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
+
const qp = queryParams ? this.__toQueryString(queryParams) : "";
|
|
145
|
+
const request = this.__resolveRequest(`${this.__config.baseUrl}/${url}${qp}`, Method.GET, config);
|
|
146
|
+
const response = yield this.__fetch(id, request);
|
|
147
|
+
return Promise.resolve(response.data);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
post(id, url, data, config, headers) {
|
|
151
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
152
|
+
const request = this.__resolveRequest(`${this.__config.baseUrl}/${url}`, Method.POST, config, data, headers);
|
|
153
|
+
const response = yield this.__fetch(id, request);
|
|
154
|
+
return Promise.resolve(response.data);
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
patch(id, url, data, config, headers) {
|
|
158
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
159
|
+
const request = this.__resolveRequest(`${this.__config.baseUrl}/${url}`, Method.PATCH, config, data);
|
|
160
|
+
const response = yield this.__fetch(id, request);
|
|
161
|
+
return Promise.resolve(response.data);
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
delete(id, url, config) {
|
|
165
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
166
|
+
const request = this.__resolveRequest(`${this.__config.baseUrl}/${url}`, Method.DELETE, config);
|
|
167
|
+
const response = yield this.__fetch(id, request);
|
|
168
|
+
return Promise.resolve(response.data);
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
exports.SdPlatformSdkApi = SdPlatformSdkApi;
|
|
173
|
+
//# sourceMappingURL=SdPlatformSdkApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SdPlatformSdkApi.js","sourceRoot":"","sources":["../../src/api/SdPlatformSdkApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,2EAA4D;AAC5D,kDAAiE;AAEjE,IAAK,MAMJ;AAND,WAAK,MAAM;IAEP,qBAAW,CAAA;IACX,uBAAa,CAAA;IACb,yBAAe,CAAA;IACf,2BAAiB,CAAA;AACrB,CAAC,EANI,MAAM,KAAN,MAAM,QAMV;AA4CD;;GAEG;AACH,MAAa,gBAAgB;IAKzB,YAAoB,QAA6B;QAA7B,aAAQ,GAAR,QAAQ,CAAqB;QAHzC,qBAAgB,GAAwD,EAAE,CAAC;QAC3E,wBAAmB,GAA2D,EAAE,CAAC;IAIzF,CAAC;IAEO,eAAe,CAAC,IAA2B;QAE/C,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/B,MAAM,KAAK,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,kBAAkB,CAAC,GAAG,CAAC,IAAI,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9G,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IAC3C,CAAC;IAEO,gBAAgB,CAAC,GAAW,EAAE,MAAc,EAAE,MAAkC,EAAE,IAAU,EAAE,OAAkC;QAEpI,MAAM,OAAO,GAAuB;YAChC,GAAG;YACH,MAAM;YACN,eAAe,EAAE,IAAI;YACrB,OAAO,EAAE;gBACL,cAAc,EAAE,kBAAkB;gBAClC,eA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EY,KAAK,CAAI,EAAa,EAAE,GAAW,EAAE,IAAS,EAAE,MAAkC,EAAE,OAAkC;;YAE/H,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CACjC,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,IAAI,GAAG,EAAE,EACjC,MAAM,CAAC,KAAK,EAAE,MAAM,EACpB,IAAI,CACP,CAAC;YAEF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;YAEjD,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC1C,CAAC;KAAA;IAEY,MAAM,CAAI,EAAa,EAAE,GAAW,EAAE,MAAkC;;YAEjF,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CACjC,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,IAAI,GAAG,EAAE,EACjC,MAAM,CAAC,MAAM,EACb,MAAM,CACT,CAAC;YAEF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;YAEjD,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC1C,CAAC;KAAA;CACJ;AA/MD,4CA+MC"}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SdPlatformSdkConfig = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Configuration of an instance of the platform SDK.
|
|
6
|
+
*/
|
|
7
|
+
class SdPlatformSdkConfig {
|
|
8
|
+
constructor(
|
|
9
|
+
/** Client id to use */
|
|
10
|
+
clientId,
|
|
11
|
+
/** Client secret to use */
|
|
12
|
+
clientSecret,
|
|
13
|
+
/** Base URL of the ShapeDiver Platform Backend */
|
|
14
|
+
baseUrl) {
|
|
15
|
+
this.clientId = clientId;
|
|
16
|
+
this.clientSecret = clientSecret;
|
|
17
|
+
this.baseUrl = baseUrl;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.SdPlatformSdkConfig = SdPlatformSdkConfig;
|
|
21
|
+
//# sourceMappingURL=SdPlatformSdkConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SdPlatformSdkConfig.js","sourceRoot":"","sources":["../../src/api/SdPlatformSdkConfig.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAa,mBAAmB;IAE5B;IACI,uBAAuB;IAChB,QAAwB;IAC/B,2BAA2B;IACpB,YAA4B;IACnC,kDAAkD;IAC3C,OAAsB;QAJtB,aAAQ,GAAR,QAAQ,CAAgB;QAExB,iBAAY,GAAZ,YAAY,CAAgB;QAE5B,YAAO,GAAP,OAAO,CAAe;IAEjC,CAAC;CACJ;AAXD,kDAWC"}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.mapToApiError = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const SdPlatformErrors_1 = require("../SdPlatformErrors");
|
|
9
|
+
function isOAuthResponseError(response) {
|
|
10
|
+
return ("error" in response) && ("error_description" in response);
|
|
11
|
+
}
|
|
12
|
+
function isResourceResponseError(response) {
|
|
13
|
+
return ("error" in response) && ("message" in response.error);
|
|
14
|
+
}
|
|
15
|
+
function isValidationError(response) {
|
|
16
|
+
return isResourceResponseError(response) && ("fields" in response.error);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Maps the given error into a ShapeDiver API response error object.
|
|
20
|
+
*/
|
|
21
|
+
function mapToApiError(error) {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
// Handle basic non-axios errors
|
|
24
|
+
if (!axios_1.default.isAxiosError(error))
|
|
25
|
+
return new SdPlatformErrors_1.SdPlatformError(error.message);
|
|
26
|
+
const axiosError = error;
|
|
27
|
+
if (axiosError.response) {
|
|
28
|
+
// Request was made and server responded with 4xx or 5xx
|
|
29
|
+
let data = axiosError.response.data;
|
|
30
|
+
if (axiosError.response.status >= 500) {
|
|
31
|
+
return new SdPlatformErrors_1.SdPlatformServerResponseError((_b = (_a = data === null || data === void 0 ? void 0 : data.error) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : "Server Error.", axiosError.response.status);
|
|
32
|
+
}
|
|
33
|
+
else if (data && isOAuthResponseError(data)) {
|
|
34
|
+
if (data.error == "invalid_client") {
|
|
35
|
+
return new SdPlatformErrors_1.SdPlatformInvalidClientOAuthResponseError(`${data.error}. ${data.error_description}.`, axiosError.response.status, data.error, data.error_description, data.error_uri);
|
|
36
|
+
}
|
|
37
|
+
else if (data.error == "invalid_request") {
|
|
38
|
+
return new SdPlatformErrors_1.SdPlatformInvalidRequestOAuthResponseError(`${data.error}. ${data.error_description}.`, axiosError.response.status, data.error, data.error_description, data.error_uri);
|
|
39
|
+
}
|
|
40
|
+
else if (data.error == "invalid_grant") {
|
|
41
|
+
return new SdPlatformErrors_1.SdPlatformInvalidGrantOAuthResponseError(`${data.error}. ${data.error_description}.`, axiosError.response.status, data.error, data.error_description, data.error_uri);
|
|
42
|
+
}
|
|
43
|
+
else if (data.error == "unauthorized_client") {
|
|
44
|
+
return new SdPlatformErrors_1.SdPlatformUnauthorizedClientOAuthResponseError(`${data.error}. ${data.error_description}.`, axiosError.response.status, data.error, data.error_description, data.error_uri);
|
|
45
|
+
}
|
|
46
|
+
else if (data.error == "unsupported_grant_type") {
|
|
47
|
+
return new SdPlatformErrors_1.SdPlatformUnsupportedGrantTypeClientOAuthResponseError(`${data.error}. ${data.error_description}.`, axiosError.response.status, data.error, data.error_description, data.error_uri);
|
|
48
|
+
}
|
|
49
|
+
return new SdPlatformErrors_1.SdPlatformOAuthResponseError(`${data.error}. ${data.error_description}.`, axiosError.response.status, data.error, data.error_description, data.error_uri);
|
|
50
|
+
}
|
|
51
|
+
else if (data && isResourceResponseError(data)) {
|
|
52
|
+
if (isValidationError(data)) {
|
|
53
|
+
return new SdPlatformErrors_1.SdPlatformValidationResponseError(`${data.error.message}. ${data.error.description}.`, axiosError.response.status, data.error.message, data.error.description, data.error.href, data.error.code, data.error.fields);
|
|
54
|
+
}
|
|
55
|
+
switch (axiosError.response.status) {
|
|
56
|
+
case 404:
|
|
57
|
+
return new SdPlatformErrors_1.SdPlatformNotFoundResponseError(`${data.error.message}. ${data.error.description}.`, axiosError.response.status, data.error.message, data.error.description, data.error.href, data.error.code);
|
|
58
|
+
case 403:
|
|
59
|
+
return new SdPlatformErrors_1.SdPlatformForbiddenResponseError(`${data.error.message}. ${data.error.description}.`, axiosError.response.status, data.error.message, data.error.description, data.error.href, data.error.code);
|
|
60
|
+
case 401:
|
|
61
|
+
return new SdPlatformErrors_1.SdPlatformUnauthorizedResponseError(`${data.error.message}. ${data.error.description}.`, axiosError.response.status, data.error.message, data.error.description, data.error.href, data.error.code);
|
|
62
|
+
default:
|
|
63
|
+
return new SdPlatformErrors_1.SdPlatformResourceResponseError(`${data.error.message}. ${data.error.description}.`, axiosError.response.status, data.error.message, data.error.description, data.error.href, data.error.code);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
// Response was made but an unknown error object was received
|
|
68
|
+
return new SdPlatformErrors_1.SdPlatformError("");
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else if (axiosError.request) {
|
|
72
|
+
// The request was made but no response was received.
|
|
73
|
+
// We can do something with `error.request`.
|
|
74
|
+
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
|
|
75
|
+
// http.ClientRequest in node.js.
|
|
76
|
+
return new SdPlatformErrors_1.SdPlatformRequestError("Could not send request.", "The request was made but no response was received.");
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
// Something happened in setting up the request that triggered an Error
|
|
80
|
+
return new SdPlatformErrors_1.SdPlatformError(error.message);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.mapToApiError = mapToApiError;
|
|
84
|
+
//# sourceMappingURL=SdPlatformSdkErrorMapping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SdPlatformSdkErrorMapping.js","sourceRoot":"","sources":["../../src/api/SdPlatformSdkErrorMapping.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAwD;AACxD,0DAgB4B;AAwC5B,SAAS,oBAAoB,CAAC,QAAa;IAEvC,OAAO,CAAC,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,mBAAmB,IAAI,QAAQ,CAAC,CAAA;AACrE,CAAC;AAED,SAAS,uBAAuB,CAAC,QAAa;IAE1C,OAAO,CAAC,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAA;AACjE,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAa;IAEpC,OAAO,uBAAuB,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC7E,CAAC;AAGD;;GAEG;AACH,SAAgB,aAAa,CAAC,KAAyB;;IAGnD,gCAAgC;IAChC,IAAI,CAAC,eAAK,CAAC,YAAY,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,kCAAe,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAE1E,MAAM,UAAU,GAAe,KAAK,CAAA;IACpC,IAAI,UAAU,CAAC,QAAQ,EACvB;QACI,wDAAwD;QACxD,IAAI,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAA;QAEnC,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,IAAI,GAAG,EACrC;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