twenty-client-sdk 2.15.0 → 2.16.0
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/application-CbP6KYwU.mjs +99 -0
- package/dist/application-DB3rje-9.js +1 -0
- package/dist/generate.cjs +3 -3
- package/dist/generate.mjs +1 -1
- package/dist/metadata/generated/schema.d.ts +134 -134
- package/dist/metadata/generated/types.d.ts +87 -87
- package/dist/metadata.cjs +1 -1
- package/dist/metadata.mjs +70 -70
- package/dist/rest.cjs +1 -1
- package/dist/rest.mjs +7 -7
- package/package.json +1 -1
- package/dist/application-C4wcjAez.mjs +0 -4
- package/dist/application-CWqEaQ63.js +0 -1
package/dist/metadata.mjs
CHANGED
|
@@ -1749,6 +1749,7 @@ var i = class e {
|
|
|
1749
1749
|
isEmailVerificationRequired: [6],
|
|
1750
1750
|
defaultSubdomain: [1],
|
|
1751
1751
|
frontDomain: [1],
|
|
1752
|
+
publicFunctionDomain: [1],
|
|
1752
1753
|
analyticsEnabled: [6],
|
|
1753
1754
|
support: [187],
|
|
1754
1755
|
isAttachmentPreviewEnabled: [6],
|
|
@@ -1983,6 +1984,7 @@ var i = class e {
|
|
|
1983
1984
|
id: [3],
|
|
1984
1985
|
domain: [1],
|
|
1985
1986
|
records: [232],
|
|
1987
|
+
isCustomDomainEnabled: [6],
|
|
1986
1988
|
__typename: [1]
|
|
1987
1989
|
},
|
|
1988
1990
|
UpsertRowLevelPermissionPredicatesResult: {
|
|
@@ -2347,6 +2349,7 @@ var i = class e {
|
|
|
2347
2349
|
},
|
|
2348
2350
|
ToolIndexEntry: {
|
|
2349
2351
|
name: [1],
|
|
2352
|
+
label: [1],
|
|
2350
2353
|
description: [1],
|
|
2351
2354
|
category: [1],
|
|
2352
2355
|
objectName: [1],
|
|
@@ -2729,13 +2732,6 @@ var i = class e {
|
|
|
2729
2732
|
getViewGroup: [66, { id: [1, "String!"] }],
|
|
2730
2733
|
myMessageFolders: [330, { messageChannelId: [3] }],
|
|
2731
2734
|
myCalendarChannels: [325, { connectedAccountId: [3] }],
|
|
2732
|
-
findApplicationRegistrationByClientId: [201, { clientId: [1, "String!"] }],
|
|
2733
|
-
findApplicationRegistrationByUniversalIdentifier: [7, { universalIdentifier: [1, "String!"] }],
|
|
2734
|
-
findManyApplicationRegistrations: [7],
|
|
2735
|
-
findOneApplicationRegistration: [7, { id: [1, "String!"] }],
|
|
2736
|
-
findApplicationRegistrationStats: [199, { id: [1, "String!"] }],
|
|
2737
|
-
findApplicationRegistrationVariables: [174, { applicationRegistrationId: [1, "String!"] }],
|
|
2738
|
-
applicationRegistrationTarballUrl: [1, { id: [1, "String!"] }],
|
|
2739
2735
|
minimalMetadata: [336],
|
|
2740
2736
|
appConnections: [218, { filter: [342] }],
|
|
2741
2737
|
appConnection: [218, { id: [219, "ID!"] }],
|
|
@@ -2757,6 +2753,13 @@ var i = class e {
|
|
|
2757
2753
|
checkWorkspaceSubdomainAvailability: [254, { subdomain: [1, "String!"] }],
|
|
2758
2754
|
getWorkspaceCreationDefaults: [255],
|
|
2759
2755
|
validatePasswordResetToken: [252, { passwordResetToken: [1, "String!"] }],
|
|
2756
|
+
findApplicationRegistrationByClientId: [201, { clientId: [1, "String!"] }],
|
|
2757
|
+
findApplicationRegistrationByUniversalIdentifier: [7, { universalIdentifier: [1, "String!"] }],
|
|
2758
|
+
findManyApplicationRegistrations: [7],
|
|
2759
|
+
findOneApplicationRegistration: [7, { id: [1, "String!"] }],
|
|
2760
|
+
findApplicationRegistrationStats: [199, { id: [1, "String!"] }],
|
|
2761
|
+
findApplicationRegistrationVariables: [174, { applicationRegistrationId: [1, "String!"] }],
|
|
2762
|
+
applicationRegistrationTarballUrl: [1, { id: [1, "String!"] }],
|
|
2760
2763
|
currentUser: [79],
|
|
2761
2764
|
currentWorkspace: [76],
|
|
2762
2765
|
getPublicWorkspaceDataByDomain: [181, { origin: [1] }],
|
|
@@ -3044,21 +3047,6 @@ var i = class e {
|
|
|
3044
3047
|
updateMessageFolder: [330, { input: [460, "UpdateMessageFolderInput!"] }],
|
|
3045
3048
|
updateMessageFolders: [330, { input: [462, "UpdateMessageFoldersInput!"] }],
|
|
3046
3049
|
updateCalendarChannel: [325, { input: [463, "UpdateCalendarChannelInput!"] }],
|
|
3047
|
-
createApplicationRegistration: [200, { input: [465, "CreateApplicationRegistrationInput!"] }],
|
|
3048
|
-
updateApplicationRegistration: [7, { input: [466, "UpdateApplicationRegistrationInput!"] }],
|
|
3049
|
-
deleteApplicationRegistration: [6, { id: [1, "String!"] }],
|
|
3050
|
-
rotateApplicationRegistrationClientSecret: [202, { id: [1, "String!"] }],
|
|
3051
|
-
createApplicationRegistrationVariable: [5, { input: [468, "CreateApplicationRegistrationVariableInput!"] }],
|
|
3052
|
-
updateApplicationRegistrationVariable: [5, { input: [469, "UpdateApplicationRegistrationVariableInput!"] }],
|
|
3053
|
-
deleteApplicationRegistrationVariable: [6, { id: [1, "String!"] }],
|
|
3054
|
-
uploadAppTarball: [7, {
|
|
3055
|
-
file: [358, "Upload!"],
|
|
3056
|
-
universalIdentifier: [1]
|
|
3057
|
-
}],
|
|
3058
|
-
transferApplicationRegistrationOwnership: [7, {
|
|
3059
|
-
applicationRegistrationId: [1, "String!"],
|
|
3060
|
-
targetWorkspaceSubdomain: [1, "String!"]
|
|
3061
|
-
}],
|
|
3062
3050
|
createChatThread: [316],
|
|
3063
3051
|
sendChatMessage: [320, {
|
|
3064
3052
|
threadId: [3, "UUID!"],
|
|
@@ -3066,7 +3054,7 @@ var i = class e {
|
|
|
3066
3054
|
messageId: [3, "UUID!"],
|
|
3067
3055
|
browsingContext: [15],
|
|
3068
3056
|
modelId: [1],
|
|
3069
|
-
fileAttachments: [
|
|
3057
|
+
fileAttachments: [465, "[FileAttachmentInput!]"]
|
|
3070
3058
|
}],
|
|
3071
3059
|
stopAgentChatStream: [6, { threadId: [3, "UUID!"] }],
|
|
3072
3060
|
renameChatThread: [316, {
|
|
@@ -3077,8 +3065,8 @@ var i = class e {
|
|
|
3077
3065
|
unarchiveChatThread: [316, { id: [3, "UUID!"] }],
|
|
3078
3066
|
deleteChatThread: [6, { id: [3, "UUID!"] }],
|
|
3079
3067
|
deleteQueuedChatMessage: [6, { messageId: [3, "UUID!"] }],
|
|
3080
|
-
createSkill: [314, { input: [
|
|
3081
|
-
updateSkill: [314, { input: [
|
|
3068
|
+
createSkill: [314, { input: [466, "CreateSkillInput!"] }],
|
|
3069
|
+
updateSkill: [314, { input: [467, "UpdateSkillInput!"] }],
|
|
3082
3070
|
deleteSkill: [314, { id: [3, "UUID!"] }],
|
|
3083
3071
|
activateSkill: [314, { id: [3, "UUID!"] }],
|
|
3084
3072
|
deactivateSkill: [314, { id: [3, "UUID!"] }],
|
|
@@ -3087,7 +3075,7 @@ var i = class e {
|
|
|
3087
3075
|
agentId: [3, "UUID!"],
|
|
3088
3076
|
input: [1, "String!"]
|
|
3089
3077
|
}],
|
|
3090
|
-
getAuthorizationUrlForSSO: [247, { input: [
|
|
3078
|
+
getAuthorizationUrlForSSO: [247, { input: [468, "GetAuthorizationUrlForSSOInput!"] }],
|
|
3091
3079
|
getLoginTokenFromCredentials: [258, {
|
|
3092
3080
|
email: [1, "String!"],
|
|
3093
3081
|
password: [1, "String!"],
|
|
@@ -3137,7 +3125,7 @@ var i = class e {
|
|
|
3137
3125
|
locale: [1],
|
|
3138
3126
|
verifyEmailRedirectPath: [1]
|
|
3139
3127
|
}],
|
|
3140
|
-
signUpInNewWorkspace: [250, { input: [
|
|
3128
|
+
signUpInNewWorkspace: [250, { input: [469] }],
|
|
3141
3129
|
uploadNewWorkspaceLogo: [131, {
|
|
3142
3130
|
workspaceId: [1, "String!"],
|
|
3143
3131
|
file: [358, "Upload!"]
|
|
@@ -3168,6 +3156,21 @@ var i = class e {
|
|
|
3168
3156
|
passwordResetToken: [1, "String!"],
|
|
3169
3157
|
newPassword: [1, "String!"]
|
|
3170
3158
|
}],
|
|
3159
|
+
createApplicationRegistration: [200, { input: [470, "CreateApplicationRegistrationInput!"] }],
|
|
3160
|
+
updateApplicationRegistration: [7, { input: [471, "UpdateApplicationRegistrationInput!"] }],
|
|
3161
|
+
deleteApplicationRegistration: [6, { id: [1, "String!"] }],
|
|
3162
|
+
rotateApplicationRegistrationClientSecret: [202, { id: [1, "String!"] }],
|
|
3163
|
+
createApplicationRegistrationVariable: [5, { input: [473, "CreateApplicationRegistrationVariableInput!"] }],
|
|
3164
|
+
updateApplicationRegistrationVariable: [5, { input: [474, "UpdateApplicationRegistrationVariableInput!"] }],
|
|
3165
|
+
deleteApplicationRegistrationVariable: [6, { id: [1, "String!"] }],
|
|
3166
|
+
uploadAppTarball: [7, {
|
|
3167
|
+
file: [358, "Upload!"],
|
|
3168
|
+
universalIdentifier: [1]
|
|
3169
|
+
}],
|
|
3170
|
+
transferApplicationRegistrationOwnership: [7, {
|
|
3171
|
+
applicationRegistrationId: [1, "String!"],
|
|
3172
|
+
targetWorkspaceSubdomain: [1, "String!"]
|
|
3173
|
+
}],
|
|
3171
3174
|
initiateOTPProvisioning: [241, {
|
|
3172
3175
|
loginToken: [1, "String!"],
|
|
3173
3176
|
origin: [1, "String!"]
|
|
@@ -3223,11 +3226,7 @@ var i = class e {
|
|
|
3223
3226
|
updateLabPublicFeatureFlag: [171, { input: [491, "UpdateLabPublicFeatureFlagInput!"] }],
|
|
3224
3227
|
createPublicDomain: [270, {
|
|
3225
3228
|
domain: [1, "String!"],
|
|
3226
|
-
applicationId: [1]
|
|
3227
|
-
}],
|
|
3228
|
-
updatePublicDomain: [270, {
|
|
3229
|
-
domain: [1, "String!"],
|
|
3230
|
-
applicationId: [1]
|
|
3229
|
+
applicationId: [1, "String!"]
|
|
3231
3230
|
}],
|
|
3232
3231
|
deletePublicDomain: [6, { domain: [1, "String!"] }],
|
|
3233
3232
|
checkPublicDomainValidRecords: [233, { domain: [1, "String!"] }],
|
|
@@ -3761,6 +3760,7 @@ var i = class e {
|
|
|
3761
3760
|
cronTriggerSettings: [15],
|
|
3762
3761
|
databaseEventTriggerSettings: [15],
|
|
3763
3762
|
httpRouteTriggerSettings: [15],
|
|
3763
|
+
serverRouteTriggerSettings: [15],
|
|
3764
3764
|
toolTriggerSettings: [15],
|
|
3765
3765
|
workflowActionTriggerSettings: [15],
|
|
3766
3766
|
__typename: [1]
|
|
@@ -4123,6 +4123,40 @@ var i = class e {
|
|
|
4123
4123
|
isSyncEnabled: [6],
|
|
4124
4124
|
__typename: [1]
|
|
4125
4125
|
},
|
|
4126
|
+
FileAttachmentInput: {
|
|
4127
|
+
id: [3],
|
|
4128
|
+
filename: [1],
|
|
4129
|
+
__typename: [1]
|
|
4130
|
+
},
|
|
4131
|
+
CreateSkillInput: {
|
|
4132
|
+
id: [3],
|
|
4133
|
+
name: [1],
|
|
4134
|
+
label: [1],
|
|
4135
|
+
icon: [1],
|
|
4136
|
+
description: [1],
|
|
4137
|
+
content: [1],
|
|
4138
|
+
__typename: [1]
|
|
4139
|
+
},
|
|
4140
|
+
UpdateSkillInput: {
|
|
4141
|
+
id: [3],
|
|
4142
|
+
name: [1],
|
|
4143
|
+
label: [1],
|
|
4144
|
+
icon: [1],
|
|
4145
|
+
description: [1],
|
|
4146
|
+
content: [1],
|
|
4147
|
+
isActive: [6],
|
|
4148
|
+
__typename: [1]
|
|
4149
|
+
},
|
|
4150
|
+
GetAuthorizationUrlForSSOInput: {
|
|
4151
|
+
identityProviderId: [3],
|
|
4152
|
+
workspaceInviteHash: [1],
|
|
4153
|
+
__typename: [1]
|
|
4154
|
+
},
|
|
4155
|
+
SignUpInNewWorkspaceInput: {
|
|
4156
|
+
displayName: [1],
|
|
4157
|
+
subdomain: [1],
|
|
4158
|
+
__typename: [1]
|
|
4159
|
+
},
|
|
4126
4160
|
CreateApplicationRegistrationInput: {
|
|
4127
4161
|
name: [1],
|
|
4128
4162
|
universalIdentifier: [1],
|
|
@@ -4132,7 +4166,7 @@ var i = class e {
|
|
|
4132
4166
|
},
|
|
4133
4167
|
UpdateApplicationRegistrationInput: {
|
|
4134
4168
|
id: [1],
|
|
4135
|
-
update: [
|
|
4169
|
+
update: [472],
|
|
4136
4170
|
__typename: [1]
|
|
4137
4171
|
},
|
|
4138
4172
|
UpdateApplicationRegistrationPayload: {
|
|
@@ -4152,7 +4186,7 @@ var i = class e {
|
|
|
4152
4186
|
},
|
|
4153
4187
|
UpdateApplicationRegistrationVariableInput: {
|
|
4154
4188
|
id: [1],
|
|
4155
|
-
update: [
|
|
4189
|
+
update: [475],
|
|
4156
4190
|
__typename: [1]
|
|
4157
4191
|
},
|
|
4158
4192
|
UpdateApplicationRegistrationVariablePayload: {
|
|
@@ -4161,40 +4195,6 @@ var i = class e {
|
|
|
4161
4195
|
description: [1],
|
|
4162
4196
|
__typename: [1]
|
|
4163
4197
|
},
|
|
4164
|
-
FileAttachmentInput: {
|
|
4165
|
-
id: [3],
|
|
4166
|
-
filename: [1],
|
|
4167
|
-
__typename: [1]
|
|
4168
|
-
},
|
|
4169
|
-
CreateSkillInput: {
|
|
4170
|
-
id: [3],
|
|
4171
|
-
name: [1],
|
|
4172
|
-
label: [1],
|
|
4173
|
-
icon: [1],
|
|
4174
|
-
description: [1],
|
|
4175
|
-
content: [1],
|
|
4176
|
-
__typename: [1]
|
|
4177
|
-
},
|
|
4178
|
-
UpdateSkillInput: {
|
|
4179
|
-
id: [3],
|
|
4180
|
-
name: [1],
|
|
4181
|
-
label: [1],
|
|
4182
|
-
icon: [1],
|
|
4183
|
-
description: [1],
|
|
4184
|
-
content: [1],
|
|
4185
|
-
isActive: [6],
|
|
4186
|
-
__typename: [1]
|
|
4187
|
-
},
|
|
4188
|
-
GetAuthorizationUrlForSSOInput: {
|
|
4189
|
-
identityProviderId: [3],
|
|
4190
|
-
workspaceInviteHash: [1],
|
|
4191
|
-
__typename: [1]
|
|
4192
|
-
},
|
|
4193
|
-
SignUpInNewWorkspaceInput: {
|
|
4194
|
-
displayName: [1],
|
|
4195
|
-
subdomain: [1],
|
|
4196
|
-
__typename: [1]
|
|
4197
|
-
},
|
|
4198
4198
|
UpdateWorkspaceMemberSettingsInput: {
|
|
4199
4199
|
workspaceMemberId: [3],
|
|
4200
4200
|
update: [15],
|
|
@@ -5828,7 +5828,6 @@ var i = class e {
|
|
|
5828
5828
|
IS_UNIQUE_INDEXES_ENABLED: "IS_UNIQUE_INDEXES_ENABLED",
|
|
5829
5829
|
IS_JSON_FILTER_ENABLED: "IS_JSON_FILTER_ENABLED",
|
|
5830
5830
|
IS_MARKETPLACE_SETTING_TAB_VISIBLE: "IS_MARKETPLACE_SETTING_TAB_VISIBLE",
|
|
5831
|
-
IS_PUBLIC_DOMAIN_ENABLED: "IS_PUBLIC_DOMAIN_ENABLED",
|
|
5832
5831
|
IS_EMAIL_GROUP_ENABLED: "IS_EMAIL_GROUP_ENABLED",
|
|
5833
5832
|
IS_JUNCTION_RELATIONS_ENABLED: "IS_JUNCTION_RELATIONS_ENABLED",
|
|
5834
5833
|
IS_REST_METADATA_API_NEW_FORMAT_DIRECT: "IS_REST_METADATA_API_NEW_FORMAT_DIRECT",
|
|
@@ -5966,7 +5965,8 @@ var i = class e {
|
|
|
5966
5965
|
frontComponent: "frontComponent",
|
|
5967
5966
|
webhook: "webhook",
|
|
5968
5967
|
applicationVariable: "applicationVariable",
|
|
5969
|
-
connectionProvider: "connectionProvider"
|
|
5968
|
+
connectionProvider: "connectionProvider",
|
|
5969
|
+
searchFieldMetadata: "searchFieldMetadata"
|
|
5970
5970
|
}, ou = {
|
|
5971
5971
|
WORKSPACE_EVENT: "WORKSPACE_EVENT",
|
|
5972
5972
|
PAGEVIEW: "PAGEVIEW",
|
package/dist/rest.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./application-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./application-DB3rje-9.js");var t=e=>e!=null,n=class extends Error{constructor(e,t){super(e),this.name=`RestApiClientError`,this.status=t?.status,this.statusText=t?.statusText,this.url=t?.url,this.body=t?.body}},r=()=>globalThis.process?.env??{},i=(e,n,r)=>{let i=/^https?:\/\//i.test(n)?n:`${e}${n.startsWith(`/`)?``:`/`}${n}`;if(!t(r))return i;let a=new URLSearchParams;for(let[e,n]of Object.entries(r))t(n)&&a.append(e,String(n));let o=a.toString();return o.length===0?i:i.includes(`?`)?`${i}&${o}`:`${i}?${o}`},a=class{constructor(e){this.refreshAccessTokenPromise=null,this.baseUrl=e?.baseUrl,this.token=e?.token,this.defaultHeaders=e?.defaultHeaders,this.fetchImplementation=e?.fetch??globalThis.fetch??null,this.authorizationToken=e?.token??null}request(e,t,n){return this.execute(e,t,n?.body,n)}get(e,t){return this.execute(`GET`,e,void 0,t)}post(e,t,n){return this.execute(`POST`,e,t,n)}put(e,t,n){return this.execute(`PUT`,e,t,n)}patch(e,t,n){return this.execute(`PATCH`,e,t,n)}delete(e,t){return this.execute(`DELETE`,e,void 0,t)}resolveBaseUrl(){let i=this.baseUrl??r().TWENTY_API_URL;if(!t(i)||i.trim().length===0)throw new n(`Missing API url. Set the \`${e.n}\` environment variable or pass \`baseUrl\` to \`RestApiClient\`.`);return i.replace(/\/+$/,``)}resolveToken(){if(!t(this.authorizationToken)){let e=r();this.authorizationToken=this.token??e.TWENTY_APP_ACCESS_TOKEN??e.TWENTY_API_KEY??null}if(!t(this.authorizationToken)||this.authorizationToken.length===0)throw new n(`Missing application access token. Set the \`${e.t}\` environment variable or pass \`token\` to \`RestApiClient\`.`);return this.authorizationToken}async requestRefreshedAccessToken(){let t=globalThis.frontComponentHostCommunicationApi?.requestAccessTokenRefresh;return typeof t==`function`?(this.refreshAccessTokenPromise||=t().then(t=>typeof t!=`string`||t.length===0?null:(this.authorizationToken=t,r()[e.t]=t,t)).catch(e=>(console.error(`Twenty REST client: token refresh failed`,e),null)).finally(()=>{this.refreshAccessTokenPromise=null}),this.refreshAccessTokenPromise):null}sendRequest(e,r,i,a,o){if(!t(this.fetchImplementation))throw new n("Global `fetch` function is not available, pass a fetch implementation to `RestApiClient`.");let s=new Headers(this.defaultHeaders);t(o?.headers)&&new Headers(o.headers).forEach((e,t)=>s.set(t,e));let c=typeof FormData<`u`&&i instanceof FormData,l=t(i)&&!c&&typeof i!=`string`;c?s.delete(`Content-Type`):l&&s.set(`Content-Type`,`application/json`),s.set(`Authorization`,`Bearer ${a}`);let u=t(i)?c||typeof i==`string`?i:JSON.stringify(i):void 0;return this.fetchImplementation.call(globalThis,e,{method:r,headers:s,body:u,signal:o?.signal})}async parseResponse(e,t){let r=await e.text(),i;if(r.trim().length>0)try{i=JSON.parse(r)}catch{i=r}if(!e.ok)throw new n(`Request to ${t} failed with status ${e.status} ${e.statusText}`,{status:e.status,statusText:e.statusText,url:t,body:i});return i}async execute(e,n,r,a){let o=i(this.resolveBaseUrl(),n,a?.query),s=this.resolveToken(),c=await this.sendRequest(o,e,r,s,a);if(c.status===401){let n=await this.requestRefreshedAccessToken();t(n)&&(c=await this.sendRequest(o,e,r,n,a))}return this.parseResponse(c,o)}};exports.RestApiClient=a,exports.RestApiClientError=n;
|
package/dist/rest.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as e, t } from "./application-
|
|
1
|
+
import { n as e, t } from "./application-CbP6KYwU.mjs";
|
|
2
2
|
//#region src/rest/index.ts
|
|
3
3
|
var n = (e) => e != null, r = class extends Error {
|
|
4
4
|
constructor(e, t) {
|
|
@@ -34,21 +34,21 @@ var n = (e) => e != null, r = class extends Error {
|
|
|
34
34
|
return this.execute("DELETE", e, void 0, t);
|
|
35
35
|
}
|
|
36
36
|
resolveBaseUrl() {
|
|
37
|
-
let
|
|
38
|
-
if (!n(
|
|
39
|
-
return
|
|
37
|
+
let t = this.baseUrl ?? i().TWENTY_API_URL;
|
|
38
|
+
if (!n(t) || t.trim().length === 0) throw new r(`Missing API url. Set the \`${e}\` environment variable or pass \`baseUrl\` to \`RestApiClient\`.`);
|
|
39
|
+
return t.replace(/\/+$/, "");
|
|
40
40
|
}
|
|
41
41
|
resolveToken() {
|
|
42
42
|
if (!n(this.authorizationToken)) {
|
|
43
43
|
let e = i();
|
|
44
44
|
this.authorizationToken = this.token ?? e.TWENTY_APP_ACCESS_TOKEN ?? e.TWENTY_API_KEY ?? null;
|
|
45
45
|
}
|
|
46
|
-
if (!n(this.authorizationToken) || this.authorizationToken.length === 0) throw new r(`Missing application access token. Set the \`${
|
|
46
|
+
if (!n(this.authorizationToken) || this.authorizationToken.length === 0) throw new r(`Missing application access token. Set the \`${t}\` environment variable or pass \`token\` to \`RestApiClient\`.`);
|
|
47
47
|
return this.authorizationToken;
|
|
48
48
|
}
|
|
49
49
|
async requestRefreshedAccessToken() {
|
|
50
|
-
let
|
|
51
|
-
return typeof
|
|
50
|
+
let e = globalThis.frontComponentHostCommunicationApi?.requestAccessTokenRefresh;
|
|
51
|
+
return typeof e == "function" ? (this.refreshAccessTokenPromise ||= e().then((e) => typeof e != "string" || e.length === 0 ? null : (this.authorizationToken = e, i()[t] = e, e)).catch((e) => (console.error("Twenty REST client: token refresh failed", e), null)).finally(() => {
|
|
52
52
|
this.refreshAccessTokenPromise = null;
|
|
53
53
|
}), this.refreshAccessTokenPromise) : null;
|
|
54
54
|
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=`TWENTY_API_KEY`,t=`TWENTY_API_URL`,n=`TWENTY_APP_ACCESS_TOKEN`;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});
|