本文整理汇总了TypeScript中wicked-sdk.Callback类的典型用法代码示例。如果您正苦于以下问题:TypeScript Callback类的具体用法?TypeScript Callback怎么用?TypeScript Callback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Callback类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: callback
}, function (err, results) {
if (err)
return callback(err);
const services = results.services as KongCollection<KongService>;
const routes = results.routes as KongCollection<KongRoute>;
// Step 1: Build a service id to service map
const serviceIdMap = new Map<string, KongService>();
for (let i = 0; i < services.data.length; ++i) {
const s = services.data[i];
serviceIdMap.set(s.id, s);
}
// Step 2: Match the routes to the services
const kongApis: KongApi[] = [];
for (let i = 0; i < routes.data.length; ++i) {
const r = routes.data[i];
if (!serviceIdMap.has(r.service.id)) {
warn(`kongGetAllApis: Route ${r.id} with paths ${r.paths} has an unknown service id ${r.service.id}`);
continue;
}
kongApis.push(wicked.kongServiceRouteToApi(serviceIdMap.get(r.service.id), r));
}
return callback(null, {
data: kongApis
});
});
开发者ID:Haufe-Lexware,项目名称:wicked.portal-kong-adapter,代码行数:27,代码来源:utils.ts
示例2: callback
}, function (err, authServers: WickedAuthServer[]) {
if (err)
return callback(err);
debug(JSON.stringify(authServers, null, 2));
// Fix auth server and API auth server IDs; also adapt
// the upstream_url (canonicalize it).
for (let i = 0; i < authServers.length; ++i) {
const as = authServers[i] as WickedAuthServer;
const id = `${authServerNames[i]}-auth`;
as.id = id;
if (as.config.api.hasOwnProperty('id'))
delete as.config.api.id;
as.config.api.name = id;
try {
const url = new URL(as.config.api.upstream_url);
as.config.api.upstream_url = url.toString();
} catch (err) {
const msg = `getAuthServerApis(): upstream_url for auth server ${authServerNames[i]} is not a valid URL: ${as.config.api.upstream_url}`;
return callback(new WickedError(msg, 500));
}
checkApiConfig(as.config);
}
callback(null, authServers);
});
开发者ID:Haufe-Lexware,项目名称:wicked.portal-kong-adapter,代码行数:26,代码来源:portal.ts
示例3: callback
wicked.getWebhookEvents('kong-adapter', function (err, pendingEvents) {
if (err) {
error('COULD NOT RETRIEVE WEBHOOKS')
return callback(err);
}
const duration = (new Date().getTime() - now);
debug(`processPendingWebhooks: Retrieved ${pendingEvents.length} events in ${duration}ms`);
const onlyDelete = false;
if (pendingEvents.length === 0)
return callback(null, false);
async.eachSeries(pendingEvents, (webhookData: WickedEvent, callback) => {
const now = new Date().getTime();
dispatchWebhookAction(webhookData, onlyDelete, function (err) {
const duration = (new Date().getTime() - now);
debug(`processPendingWebhooks: Processed ${webhookData.action} ${webhookData.entity} event in ${duration}ms`);
if (err)
return callback(err);
return callback(null);
});
}, function (err) {
if (err) {
error('An error occurred during dispatching events.');
error(err);
return callback(err);
}
return callback(null, true);
});
});
开发者ID:Haufe-Lexware,项目名称:wicked.portal-kong-adapter,代码行数:29,代码来源:main.ts
示例4: callback
function (err, results) {
if (err) {
error(err);
error(err.stack);
return callback(err);
}
debug('getKongConsumers() succeeded.');
return callback(null, results as ConsumerInfo[]);
});
开发者ID:Haufe-Lexware,项目名称:wicked.portal-kong-adapter,代码行数:9,代码来源:kong.ts
注:本文中的wicked-sdk.Callback类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论