@accelbyte/codegen 4.1.0 → 4.1.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.
|
@@ -1218,7 +1218,8 @@ var templateSdkSnippet = ({
|
|
|
1218
1218
|
serviceNameTitle,
|
|
1219
1219
|
apiName,
|
|
1220
1220
|
snippetMethod,
|
|
1221
|
-
snippetApiArgs: snippetApiArgsParam
|
|
1221
|
+
snippetApiArgs: snippetApiArgsParam,
|
|
1222
|
+
isUMD
|
|
1222
1223
|
}) => {
|
|
1223
1224
|
const methodArr = snippetMethod.split("//");
|
|
1224
1225
|
const snippetApiArgs = ["sdk", ...snippetApiArgsParam];
|
|
@@ -1226,8 +1227,9 @@ var templateSdkSnippet = ({
|
|
|
1226
1227
|
normMethod = normalizeMethodSnippet(normMethod, "queryParams:");
|
|
1227
1228
|
normMethod = normalizeMethodSnippet(normMethod, "queryParams?:");
|
|
1228
1229
|
normMethod += "\n\n//" + methodArr[1];
|
|
1229
|
-
const
|
|
1230
|
-
import {
|
|
1230
|
+
const sdkAcronyms = ["Ams", "Gdpr", "Iam", "Ugc"];
|
|
1231
|
+
let sdkSnippet = `import { AccelByte } from '@accelbyte/sdk'
|
|
1232
|
+
import { ${apiName} } from '@accelbyte/sdk-${serviceNameTitle.toLowerCase()}'
|
|
1231
1233
|
|
|
1232
1234
|
const sdk = AccelByte.SDK({
|
|
1233
1235
|
coreConfig: {
|
|
@@ -1238,8 +1240,28 @@ const sdk = AccelByte.SDK({
|
|
|
1238
1240
|
}
|
|
1239
1241
|
})
|
|
1240
1242
|
|
|
1241
|
-
${
|
|
1243
|
+
${apiName}(${snippetApiArgs.join(", ")})
|
|
1242
1244
|
.${normMethod}`;
|
|
1245
|
+
if (isUMD) {
|
|
1246
|
+
sdkSnippet = `<script src="https://unpkg.com/@accelbyte/sdk/dist/global/index.global.js"></script>
|
|
1247
|
+
<script src="https://unpkg.com/@accelbyte/sdk-${serviceNameTitle.toLowerCase()}/dist/global/index.global.js"></script>
|
|
1248
|
+
|
|
1249
|
+
<script>
|
|
1250
|
+
|
|
1251
|
+
const sdk = AccelByteSDK.AccelByte.SDK({
|
|
1252
|
+
coreConfig: {
|
|
1253
|
+
baseURL: '__DOMAIN__',
|
|
1254
|
+
clientId: '77f88506b6174c3ea4d925f5b4096ce8',
|
|
1255
|
+
namespace: 'accelbyte',
|
|
1256
|
+
redirectURI: 'http://localhost:3030'
|
|
1257
|
+
}
|
|
1258
|
+
})
|
|
1259
|
+
|
|
1260
|
+
AccelByteSDK_${sdkAcronyms.includes(serviceNameTitle) ? serviceNameTitle.toUpperCase() : serviceNameTitle}.${apiName}(${snippetApiArgs.join(", ")})
|
|
1261
|
+
.${normMethod}
|
|
1262
|
+
|
|
1263
|
+
</script>`;
|
|
1264
|
+
}
|
|
1243
1265
|
return sdkSnippet;
|
|
1244
1266
|
};
|
|
1245
1267
|
var normalizeMethodSnippet = (methodInput, splitWord) => {
|
|
@@ -1431,9 +1453,17 @@ var SwaggerReaderHelpers = class _SwaggerReaderHelpers {
|
|
|
1431
1453
|
snippetMethod,
|
|
1432
1454
|
snippetApiArgs
|
|
1433
1455
|
});
|
|
1456
|
+
const resultUMDSnippet = templateSdkSnippet({
|
|
1457
|
+
serviceNameTitle,
|
|
1458
|
+
apiName: apiGenName,
|
|
1459
|
+
snippetMethod,
|
|
1460
|
+
snippetApiArgs,
|
|
1461
|
+
isUMD: true
|
|
1462
|
+
});
|
|
1434
1463
|
const currentSnippetMap = {};
|
|
1435
1464
|
snippetMap[pathWithBase][httpMethod] = currentSnippetMap;
|
|
1436
1465
|
currentSnippetMap.web = resultSnippet;
|
|
1466
|
+
currentSnippetMap.webUMD = resultUMDSnippet;
|
|
1437
1467
|
const generatedDirName = isAdminEndpoint ? "generated-admin" : "generated-public";
|
|
1438
1468
|
currentSnippetMap.webGit = GIT_URL + `/sdk-${sdkName}/src/${generatedDirName}/${apiGenName}.ts`;
|
|
1439
1469
|
currentSnippetMap.shell = snippetShell;
|