本文整理匯總了TypeScript中UUID.v1函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript v1函數的具體用法?TypeScript v1怎麽用?TypeScript v1使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了v1函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: installVsTestPlatformToolFromCustomFeed
// Installs the test platform from a custom feed provided by the user along with credentials for authentication against said feed
public async installVsTestPlatformToolFromCustomFeed(packageSource: string, versionSelectorInput: string, testPlatformVersion: string, username: string, password: string) {
let tempConfigFilePath = null;
try {
try {
if (!helpers.isNullEmptyOrUndefined(password)) {
tl.debug('Attempting to write feed details along with provided credentials to temporary config file.');
tempConfigFilePath = helpers.GenerateTempFile(`${uuid.v1()}.config`);
const feedId = uuid.v1();
this.prepareNugetConfigFile(packageSource, tempConfigFilePath, username, password, feedId);
packageSource = feedId;
ci.addToConsolidatedCi('passwordProvided', 'true');
ci.addToConsolidatedCi('usernameProvided', `${!helpers.isNullEmptyOrUndefined(username)}`);
} else {
packageSource = tl.getInput(constants.customFeed);
tl.debug(`Credentials were not provided. Skipping writing to config file. Will use custom package feed provided by user ${packageSource}`);
}
} catch (error) {
tl.error(error);
console.log(tl.loc('LatestStableCached'));
// Look for the latest stable version available in the cache as a fallback.
testPlatformVersion = 'x';
tempConfigFilePath = null;
}
await this.installVsTestPlatformToolFromSpecifiedFeed(packageSource, testPlatformVersion, versionSelectorInput, tempConfigFilePath);
} finally {
helpers.cleanUpTempConfigFile(tempConfigFilePath);
}
}
示例2:
export const metricsExplorerMetricToTSVBMetric = (metric: MetricsExplorerOptionsMetric) => {
if (metric.aggregation === MetricsExplorerAggregation.rate) {
const metricId = uuid.v1();
const positiveOnlyId = uuid.v1();
const derivativeId = uuid.v1();
return [
{
id: metricId,
type: 'max',
field: metric.field || void 0,
},
{
id: derivativeId,
type: 'derivative',
field: metricId,
unit: '1s',
},
{
id: positiveOnlyId,
type: 'positive_only',
field: derivativeId,
},
];
} else {
return [
{
id: uuid.v1(),
type: metric.aggregation,
field: metric.field || void 0,
},
];
}
};
示例3: getvsTestConfigurations
export function getvsTestConfigurations() {
const vsTestConfiguration = {} as models.VsTestConfigurations;
initTestConfigurations(vsTestConfiguration);
vsTestConfiguration.isResponseFileRun = false;
vsTestConfiguration.publishTestResultsInTiaMode = false;
vsTestConfiguration.publishRunAttachments = tl.getInput('publishRunAttachments');
vsTestConfiguration.vstestDiagFile = utils.Helper.GenerateTempFile(uuid.v1() + '.txt');
vsTestConfiguration.responseFile = utils.Helper.GenerateTempFile(uuid.v1() + '.txt');
vsTestConfiguration.vstestArgsFile = utils.Helper.GenerateTempFile(uuid.v1() + '.txt');
vsTestConfiguration.responseSupplementryFile = utils.Helper.GenerateTempFile(uuid.v1() + '.txt');
vsTestConfiguration.responseFileSupported = vsTestConfiguration.vsTestVersionDetails.isResponseFileSupported() || utils.Helper.isToolsInstallerFlow(vsTestConfiguration);
return vsTestConfiguration;
}
示例4: getTiaConfiguration
function getTiaConfiguration(): models.TiaConfiguration {
const tiaConfiguration = {} as models.TiaConfiguration;
tiaConfiguration.tiaEnabled = tl.getBoolInput('runOnlyImpactedTests');
tiaConfiguration.tiaRebaseLimit = tl.getInput('runAllTestsAfterXBuilds');
tiaConfiguration.fileLevel = tl.getVariable('tia.filelevel');
tiaConfiguration.sourcesDir = tl.getVariable('build.sourcesdirectory');
tiaConfiguration.tiaFilterPaths = tl.getVariable('TIA_IncludePathFilters');
tiaConfiguration.runIdFile = utils.Helper.GenerateTempFile(uuid.v1() + '.txt');
tiaConfiguration.baseLineBuildIdFile = utils.Helper.GenerateTempFile(uuid.v1() + '.txt');
tiaConfiguration.responseFile = utils.Helper.GenerateTempFile(uuid.v1() + '.txt');
tiaConfiguration.useNewCollector = false;
const useNewCollector = tl.getVariable('tia.useNewCollector');
if (useNewCollector && useNewCollector.toUpperCase() === 'TRUE') {
tiaConfiguration.useNewCollector = true;
}
const buildReason = tl.getVariable('Build.Reason');
// https://www.visualstudio.com/en-us/docs/build/define/variables
// PullRequest -> This is the case for TfsGit PR flow
// CheckInShelveset -> This is the case for TFVC Gated Checkin
if (buildReason && (buildReason === 'PullRequest' || buildReason === 'CheckInShelveset')) {
tiaConfiguration.isPrFlow = 'true';
} else {
tiaConfiguration.isPrFlow = tl.getVariable('tia.isPrFlow');
}
tiaConfiguration.useTestCaseFilterInResponseFile = tl.getVariable('tia.useTestCaseFilterInResponseFile');
const releaseuri = tl.getVariable('release.releaseUri');
tiaConfiguration.context = 'CI';
if (releaseuri) {
tiaConfiguration.context = 'CD';
}
// User map file
tiaConfiguration.userMapFile = tl.getVariable('tia.usermapfile');
// disable editing settings file to switch on data collector
if (tl.getVariable('tia.disabletiadatacollector') && tl.getVariable('tia.disabletiadatacollector').toUpperCase() === 'TRUE') {
tiaConfiguration.disableEnablingDataCollector = true;
} else {
tiaConfiguration.disableEnablingDataCollector = false;
}
return tiaConfiguration;
}
示例5: signToken
public signToken(user: api.models.UserModel): JwtTokenServiceData {
if (!user || !user.id) {
throw new Error('user is not defined to sign the jwt token');
}
let userInPayload = {
id: user.id,
firstName: user.firstName,
lastName: user.lastName,
displayName: user.displayName,
userName: user.username,
created: user.created,
updated: user.updated,
};
let xsrfToken = uuid.v1();
let payload = {
xsrfToken: xsrfToken,
user: userInPayload,
};
let options: jwt.SignOptions = {
expiresIn: api.helpers.Config.settings.expiration_jwt_minutes * 60,
issuer: 'tforex-gateway',
jwtid: 'uniqueId',
subject: user.id.toString(),
};
let token = jwt.sign(payload, api.helpers.Config.settings.jwt_secret, options);
let result: JwtTokenServiceData = {
jwt: token,
xsrf: xsrfToken,
};
return result;
}
示例6: postMessage
export const postErrorResponse = (requestID: string, err: Error) => {
const id = uuid.v1()
const response: ResponseMessage = {
id,
requestID,
result: 'error',
error: err.toString(),
}
postMessage(response)
}
示例7: createUser
public createUser(username:string, email:string, password:string):Q.IPromise<model.db.User> {
var id = uuid.v1();
var userDto = {
id: id,
username: username,
email: email,
password: HashPassword(this._hashType, id, password),
timestamp: Date.now()
};
return this._database.insert("Users", userDto).then((rowId:any) => {
return userDto;
});
}
示例8: async
export const postSuccessResponse = async (requestID: string, payload: any) => {
const id = uuid.v1()
await DB.put(id, payload)
const response: ResponseMessage = {
id,
requestID,
result: 'success',
}
postMessage(response)
}
示例9: createProject
public createProject(userId:string, project:string, git:string):Q.IPromise<model.db.Project> {
var projectDto = {
id: uuid.v1(),
userId: userId,
name: project,
git: git,
timestamp: Date.now()
};
return this._database.insert("Projects", projectDto).then((rowId:any) => {
return projectDto;
});
}
示例10: createFilterFromOptions
export const createTSVBLink = (
source: SourceQuery.Query['source']['configuration'] | undefined,
options: MetricsExplorerOptions,
series: MetricsExplorerSeries,
timeRange: MetricsExplorerTimeOptions
) => {
const appState = {
filters: [],
linked: false,
query: { language: 'kuery', query: '' },
uiState: {},
vis: {
aggs: [],
params: {
axis_formatter: 'number',
axis_position: 'left',
axis_scale: 'normal',
id: uuid.v1(),
default_index_pattern: (source && source.metricAlias) || 'metricbeat-*',
index_pattern: (source && source.metricAlias) || 'metricbeat-*',
interval: 'auto',
series: options.metrics.map(mapMetricToSeries),
show_grid: 1,
show_legend: 1,
time_field: (source && source.fields.timestamp) || '@timestamp',
type: 'timeseries',
filter: createFilterFromOptions(options, series),
},
title: series.id,
type: 'metrics',
},
};
const globalState = {
refreshInterval: { pause: true, value: 0 },
time: { from: timeRange.from, to: timeRange.to },
};
return `../app/kibana#/visualize/create?type=metrics&_g=${encode(globalState)}&_a=${encode(
appState as any
)}`;
};