@accelbyte/codegen 4.1.0 → 4.1.1
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.
|
@@ -1196,7 +1196,8 @@ var templateSdkSnippet = ({
|
|
|
1196
1196
|
serviceNameTitle,
|
|
1197
1197
|
apiName,
|
|
1198
1198
|
snippetMethod,
|
|
1199
|
-
snippetApiArgs: snippetApiArgsParam
|
|
1199
|
+
snippetApiArgs: snippetApiArgsParam,
|
|
1200
|
+
isUMD
|
|
1200
1201
|
}) => {
|
|
1201
1202
|
const methodArr = snippetMethod.split("//");
|
|
1202
1203
|
const snippetApiArgs = ["sdk", ...snippetApiArgsParam];
|
|
@@ -1204,7 +1205,8 @@ var templateSdkSnippet = ({
|
|
|
1204
1205
|
normMethod = normalizeMethodSnippet(normMethod, "queryParams:");
|
|
1205
1206
|
normMethod = normalizeMethodSnippet(normMethod, "queryParams?:");
|
|
1206
1207
|
normMethod += "\n\n//" + methodArr[1];
|
|
1207
|
-
const
|
|
1208
|
+
const sdkAcronyms = ["Ams", "Gdpr", "Iam", "Ugc"];
|
|
1209
|
+
let sdkSnippet = `import { AccelByte } from '@accelbyte/sdk'
|
|
1208
1210
|
import { ${serviceNameTitle} } from '@accelbyte/sdk-${serviceNameTitle.toLowerCase()}'
|
|
1209
1211
|
|
|
1210
1212
|
const sdk = AccelByte.SDK({
|
|
@@ -1218,6 +1220,26 @@ const sdk = AccelByte.SDK({
|
|
|
1218
1220
|
|
|
1219
1221
|
${serviceNameTitle}.${apiName}(${snippetApiArgs.join(", ")})
|
|
1220
1222
|
.${normMethod}`;
|
|
1223
|
+
if (isUMD) {
|
|
1224
|
+
sdkSnippet = `<script src="https://unpkg.com/@accelbyte/sdk/dist/global/index.global.js"></script>
|
|
1225
|
+
<script src="https://unpkg.com/@accelbyte/sdk-${serviceNameTitle.toLowerCase()}/dist/global/index.global.js"></script>
|
|
1226
|
+
|
|
1227
|
+
<script>
|
|
1228
|
+
|
|
1229
|
+
const sdk = AccelByteSDK.AccelByte.SDK({
|
|
1230
|
+
coreConfig: {
|
|
1231
|
+
baseURL: '__DOMAIN__',
|
|
1232
|
+
clientId: '77f88506b6174c3ea4d925f5b4096ce8',
|
|
1233
|
+
namespace: 'accelbyte',
|
|
1234
|
+
redirectURI: 'http://localhost:3030'
|
|
1235
|
+
}
|
|
1236
|
+
})
|
|
1237
|
+
|
|
1238
|
+
AccelByteSDK_${sdkAcronyms.includes(serviceNameTitle) ? serviceNameTitle.toUpperCase() : serviceNameTitle}.${apiName}(${snippetApiArgs.join(", ")})
|
|
1239
|
+
.${normMethod}
|
|
1240
|
+
|
|
1241
|
+
</script>`;
|
|
1242
|
+
}
|
|
1221
1243
|
return sdkSnippet;
|
|
1222
1244
|
};
|
|
1223
1245
|
var normalizeMethodSnippet = (methodInput, splitWord) => {
|
|
@@ -1409,9 +1431,17 @@ var SwaggerReaderHelpers = class _SwaggerReaderHelpers {
|
|
|
1409
1431
|
snippetMethod,
|
|
1410
1432
|
snippetApiArgs
|
|
1411
1433
|
});
|
|
1434
|
+
const resultUMDSnippet = templateSdkSnippet({
|
|
1435
|
+
serviceNameTitle,
|
|
1436
|
+
apiName: apiGenName,
|
|
1437
|
+
snippetMethod,
|
|
1438
|
+
snippetApiArgs,
|
|
1439
|
+
isUMD: true
|
|
1440
|
+
});
|
|
1412
1441
|
const currentSnippetMap = {};
|
|
1413
1442
|
snippetMap[pathWithBase][httpMethod] = currentSnippetMap;
|
|
1414
1443
|
currentSnippetMap.web = resultSnippet;
|
|
1444
|
+
currentSnippetMap.webUMD = resultUMDSnippet;
|
|
1415
1445
|
const generatedDirName = isAdminEndpoint ? "generated-admin" : "generated-public";
|
|
1416
1446
|
currentSnippetMap.webGit = GIT_URL + `/sdk-${sdkName}/src/${generatedDirName}/${apiGenName}.ts`;
|
|
1417
1447
|
currentSnippetMap.shell = snippetShell;
|