当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript uuid类代码示例

本文整理汇总了TypeScript中uuid的典型用法代码示例。如果您正苦于以下问题:TypeScript uuid类的具体用法?TypeScript uuid怎么用?TypeScript uuid使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了uuid类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: retrieve

  async retrieve (user: User, paymentReference: string): Promise<PaymentRetrieveResponse | undefined> {
    /*
    Calculated from:
     dependencies
      | where name contains "GET /card-payments"
      | summarize avg(duration)
     */
    const payRetrieveDelayInMs = 681
    await delay(payRetrieveDelayInMs)

    return Promise.resolve(
      {
        amount: 185,
        description: description,
        reference: paymentReference,
        currency: 'GBP',
        caseReference: uuid(),
        channel: 'online',
        method: 'card',
        externalProvider: 'gov pay',
        status: 'Success',
        externalReference: 'a-gov-pay-reference',
        siteId: siteId,
        serviceName: serviceName,
        fees: [
          { calculated_amount: 185, code: 'X0029', version: '1' }
        ]
      })
  }
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:29,代码来源:mockPayClient.ts

示例2: switch

export const addRequestReducer = (state = initialState, action: Action) => {
  switch (action.type) {
    case UPDATE_REQUEST_FIELDS:
      return {
        ...state,
        fields: {
          ...state.fields,
          ...action.payload
        }
      };
    case UPDATE_REQUEST_ROOT_FIELDS:
      return {
        ...state,
        ...action.payload
      };
    case RESET:
      return {
        ...initialState,
        fields: {
          ...initialState.fields,
          requestId: uuid().replace(/-/g, "")
        }
      };

    default:
      return state;
  }
};
开发者ID:code-mancers,项目名称:interceptor,代码行数:28,代码来源:addRequest.ts

示例3: forLogin

  static forLogin (req: express.Request,
                   res: express.Response,
                   receiver: RoutablePath = Paths.receiver): string {
    const redirectUri = buildURL(req, receiver.uri)
    const state = uuid()
    OAuthHelper.storeStateCookie(req, res, state)

    return `${loginPath}?response_type=code&state=${state}&client_id=${clientId}&redirect_uri=${redirectUri}`
  }
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:9,代码来源:oAuthHelper.ts

示例4: createClaimData

export function createClaimData (claimantType: PartyType, defendantType: PartyType, hasEmailAddress: boolean = true,
                                 interestType: InterestType = InterestType.STANDARD): ClaimData {
  let claimData = {
    claimants: [createClaimant(claimantType)],
    defendants: [createDefendant(defendantType, hasEmailAddress)],
    payment: {
      amount: claimFee * 100,
      reference: 'RC-1524-6488-1670-7520',
      status: 'success'
    },
    feeAmountInPennies: claimFee * 100,
    amount: claimAmount,
    interest: {
      type: 'no interest'
    },
    reason: claimReason,
    timeline: { rows: [{ date: 'may', description: 'ok' }] },
    externalId: uuid(),
    get total (): number {
      switch (interestType) {
        case InterestType.STANDARD:
          return this.amount.getClaimTotal() + claimFee
        case InterestType.BREAKDOWN:
          return this.amount.getClaimTotal() + fixedInterestAmount + claimFee
      }
    },
    moneyReceivedOn: null
  } as ClaimData

  switch (interestType) {
    case InterestType.BREAKDOWN:
      claimData.interest = {
        type: 'breakdown',
        interestBreakdown: {
          totalAmount: fixedInterestAmount,
          explanation: 'up to today'
        },
        specificDailyAmount: dailyInterestAmount
      }
      claimData.interest.interestDate = {
        endDateType: 'settled_or_judgment'
      }
      break
    case InterestType.STANDARD:
      claimData.interest = {
        type: 'standard',
        rate: 8
      }
      claimData.interest.interestDate = {
        type: 'submission'
      }
      break
  }

  return claimData
}
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:56,代码来源:test-data.ts

示例5: uuid

	router.get('/signin/twitter', async ctx => {
		const twCtx = await twAuth.begin();

		const sessid = uuid();

		redis.set(sessid, JSON.stringify(twCtx));

		const expires = 1000 * 60 * 60; // 1h
		ctx.cookies.set('signin_with_twitter_session_id', sessid, {
			path: '/',
			domain: config.host,
			secure: config.url.startsWith('https'),
			httpOnly: true,
			expires: new Date(Date.now() + expires),
			maxAge: expires
		});

		ctx.redirect(twCtx.url);
	});
开发者ID:ha-dai,项目名称:Misskey,代码行数:19,代码来源:twitter.ts

示例6: function

 executeTrigger: async function (trigger)
 {
     switch (trigger.name)
     {
         case 'watch':
             var stat = await promisify(fs.stat)(trigger.params['path'] as string);
             if (stat.isDirectory() || stat.isFile())
             {
                 var id = uuid();
                 var watcher = fs.watch(trigger.params['path'] as string, function (event, fileName)
                 {
                     if (!trigger.params['event'] || trigger.params['event'] == event)
                         server.trigger({ id: id, data: { path: fileName, mtime: new Date().toJSON() } });
                 });
                 registeredTriggers[id] = watcher;
             }
             break;
     }
     return null;
 }
开发者ID:domojs,项目名称:lifttt,代码行数:20,代码来源:fs.ts

示例7: addSlackButtons

  private addSlackButtons(f: IQueryResponseField, row: IQueryResponseRow, attachment: IAttachment) {

    if (!SlackUtils.slackButtonsEnabled) { return }

    const d = row[f.name]
    if (!d.links) { return }

    const usableActions = d.links.filter((l) => (l.type === "action") && !l.form && !l.form_url)
    if (!(usableActions.length > 0)) { return }

    attachment.actions = usableActions.map((link) => {
      return {
        name: "data_action",
        text: link.label,
        type: "button",
        value: JSON.stringify({lookerUrl: this.options.baseUrl, action: link}),
      }
    })
    attachment.callback_id = uuid()

  }
开发者ID:DipJar,项目名称:looker-slackbot,代码行数:21,代码来源:slack_table_formatter.ts

示例8: uuid

import * as uuid from "uuid";

import { newRequest, Action } from "../types";
import { RESET, UPDATE_REQUEST_FIELDS, UPDATE_REQUEST_ROOT_FIELDS } from "../actions/addRequest";

export const initialState: newRequest = {
  fields: {
    url: "",
    method: "GET",
    type: "xmlhttprequest",
    requestId: uuid().replace(/-/g, "")
  },
  error: ""
};

export const addRequestReducer = (state = initialState, action: Action) => {
  switch (action.type) {
    case UPDATE_REQUEST_FIELDS:
      return {
        ...state,
        fields: {
          ...state.fields,
          ...action.payload
        }
      };
    case UPDATE_REQUEST_ROOT_FIELDS:
      return {
        ...state,
        ...action.payload
      };
    case RESET:
开发者ID:code-mancers,项目名称:interceptor,代码行数:31,代码来源:addRequest.ts

示例9: constructor

 constructor(attrs: any) {
   this.id = uuid();
   this.start = moment.tz(attrs.start, attrs.timezone || 'Europe/Berlin');
   this.duration = attrs.duration;
   this.isAllDay = attrs.isAllDay || false;
 }
开发者ID:lehresman,项目名称:callay-engine,代码行数:6,代码来源:engine.spec.ts

示例10:

 rename: (name) => {
   return `${name}-${uuid()}`
 },
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:3,代码来源:routerFinder.ts


注:本文中的uuid类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。