Best JavaScript code snippet using pact-foundation-pact
emacs.py
Source:emacs.py
...227 return r228 def previous_history(self, e):229 self._history.previous_history(self.l_buffer)230 self.l_buffer.point = lineobj.EndOfLine231 self.finalize()232 def next_history(self, e):233 self._history.next_history(self.l_buffer)234 self.finalize()235 def beginning_of_history(self, e):236 self._history.beginning_of_history()237 self.finalize()238 def end_of_history(self, e):239 self._history.end_of_history(self.l_buffer)240 self.finalize()241 def reverse_search_history(self, e):242 log('rev_search_history')243 self._init_incremental_search(self._history.reverse_search_history, e)244 self.finalize()245 def forward_search_history(self, e):246 log('fwd_search_history')247 self._init_incremental_search(self._history.forward_search_history, e)248 self.finalize()249 def history_search_forward(self, e):250 if self.previous_func and hasattr(self._history, self.previous_func.__name__):251 self._history.lastcommand = getattr(self._history, self.previous_func.__name__)252 else:253 self._history.lastcommand = None254 q = self._history.history_search_forward(self.l_buffer)255 self.l_buffer = q256 self.l_buffer.point = q.point257 self.finalize()258 return259 def history_search_backward(self, e):260 if self.previous_func and hasattr(self._history, self.previous_func.__name__):261 self._history.lastcommand = getattr(self._history, self.previous_func.__name__)262 else:263 self._history.lastcommand = None264 q = self._history.history_search_backward(self.l_buffer)265 self.l_buffer = q266 self.l_buffer.point = q.point267 self.finalize()268 return269 def yank_nth_arg(self, e):270 self.finalize()271 def yank_last_arg(self, e):272 self.finalize()273 def forward_backward_delete_char(self, e):274 self.finalize()275 def quoted_insert(self, e):276 self._insert_verbatim = True277 self.finalize()278 def tab_insert(self, e):279 cursor = min(self.l_buffer.point, len(self.l_buffer.line_buffer))280 ws = ' ' * (self.tabstop - cursor % self.tabstop)281 self.insert_text(ws)282 self.finalize()283 def transpose_chars(self, e):284 self.l_buffer.transpose_chars()285 self.finalize()286 def transpose_words(self, e):287 self.l_buffer.transpose_words()288 self.finalize()289 def overwrite_mode(self, e):290 self.finalize()291 def kill_line(self, e):292 self.l_buffer.kill_line()293 self.finalize()294 def backward_kill_line(self, e):295 self.l_buffer.backward_kill_line()296 self.finalize()297 def unix_line_discard(self, e):298 self.l_buffer.unix_line_discard()299 self.finalize()300 def kill_whole_line(self, e):301 self.l_buffer.kill_whole_line()302 self.finalize()303 def kill_word(self, e):304 self.l_buffer.kill_word()305 self.finalize()306 forward_kill_word = kill_word307 def backward_kill_word(self, e):308 self.l_buffer.backward_kill_word()309 self.finalize()310 def unix_word_rubout(self, e):311 self.l_buffer.unix_word_rubout()312 self.finalize()313 def kill_region(self, e):314 self.finalize()315 def copy_region_as_kill(self, e):316 self.finalize()317 def copy_backward_word(self, e):318 self.finalize()319 def copy_forward_word(self, e):320 self.finalize()321 def yank(self, e):322 self.l_buffer.yank()323 self.finalize()324 def yank_pop(self, e):325 self.l_buffer.yank_pop()326 self.finalize()327 def delete_char_or_list(self, e):328 self.finalize()329 def start_kbd_macro(self, e):330 self.finalize()331 def end_kbd_macro(self, e):332 self.finalize()333 def call_last_kbd_macro(self, e):334 self.finalize()335 def re_read_init_file(self, e):336 self.finalize()337 def abort(self, e):338 self._bell()339 self.finalize()340 def do_uppercase_version(self, e):341 self.finalize()342 def prefix_meta(self, e):343 self.next_meta = True344 self.finalize()345 def undo(self, e):346 self.l_buffer.pop_undo()347 self.finalize()348 def revert_line(self, e):349 self.finalize()350 def tilde_expand(self, e):351 self.finalize()352 def set_mark(self, e):353 self.l_buffer.set_mark()354 self.finalize()355 def exchange_point_and_mark(self, e):356 self.finalize()357 def character_search(self, e):358 self.finalize()359 def character_search_backward(self, e):360 self.finalize()361 def insert_comment(self, e):362 self.finalize()363 def dump_variables(self, e):364 self.finalize()365 def dump_macros(self, e):366 self.finalize()367 def digit_argument(self, e):368 self._init_digit_argument(e)369 def universal_argument(self, e):370 pass371 def init_editing_mode(self, e):372 self._bind_exit_key('Control-d')373 self._bind_exit_key('Control-z')374 self._bind_key('space', self.self_insert)375 self._bind_key('Shift-space', self.self_insert)376 self._bind_key('Control-space', self.self_insert)377 self._bind_key('Return', self.accept_line)378 self._bind_key('Left', self.backward_char)379 self._bind_key('Control-b', self.backward_char)380 self._bind_key('Right', self.forward_char)...
OrderDraftFinalize.ts
Source:OrderDraftFinalize.ts
1/* tslint:disable */2// This file was automatically generated and should not be edited.3import { OrderEventsEmails, OrderEvents, FulfillmentStatus, PaymentChargeStatusEnum, OrderStatus, OrderAction } from "./../../types/globalTypes";4// ====================================================5// GraphQL mutation operation: OrderDraftFinalize6// ====================================================7export interface OrderDraftFinalize_draftOrderComplete_errors {8 __typename: "Error";9 field: string | null;10 message: string | null;11}12export interface OrderDraftFinalize_draftOrderComplete_order_billingAddress_country {13 __typename: "CountryDisplay";14 code: string;15 country: string;16}17export interface OrderDraftFinalize_draftOrderComplete_order_billingAddress {18 __typename: "Address";19 city: string;20 cityArea: string;21 companyName: string;22 country: OrderDraftFinalize_draftOrderComplete_order_billingAddress_country;23 countryArea: string;24 firstName: string;25 id: string;26 lastName: string;27 phone: string | null;28 postalCode: string;29 streetAddress1: string;30 streetAddress2: string;31}32export interface OrderDraftFinalize_draftOrderComplete_order_events_user {33 __typename: "User";34 email: string;35}36export interface OrderDraftFinalize_draftOrderComplete_order_events {37 __typename: "OrderEvent";38 id: string;39 amount: number | null;40 date: any | null;41 email: string | null;42 emailType: OrderEventsEmails | null;43 message: string | null;44 quantity: number | null;45 type: OrderEvents | null;46 user: OrderDraftFinalize_draftOrderComplete_order_events_user | null;47}48export interface OrderDraftFinalize_draftOrderComplete_order_fulfillments_lines_orderLine_unitPrice_gross {49 __typename: "Money";50 amount: number;51 currency: string;52}53export interface OrderDraftFinalize_draftOrderComplete_order_fulfillments_lines_orderLine_unitPrice_net {54 __typename: "Money";55 amount: number;56 currency: string;57}58export interface OrderDraftFinalize_draftOrderComplete_order_fulfillments_lines_orderLine_unitPrice {59 __typename: "TaxedMoney";60 gross: OrderDraftFinalize_draftOrderComplete_order_fulfillments_lines_orderLine_unitPrice_gross;61 net: OrderDraftFinalize_draftOrderComplete_order_fulfillments_lines_orderLine_unitPrice_net;62}63export interface OrderDraftFinalize_draftOrderComplete_order_fulfillments_lines_orderLine {64 __typename: "OrderLine";65 id: string;66 isShippingRequired: boolean;67 productName: string;68 productSku: string;69 quantity: number;70 quantityFulfilled: number;71 unitPrice: OrderDraftFinalize_draftOrderComplete_order_fulfillments_lines_orderLine_unitPrice | null;72 thumbnailUrl: string | null;73}74export interface OrderDraftFinalize_draftOrderComplete_order_fulfillments_lines {75 __typename: "FulfillmentLine";76 id: string;77 quantity: number;78 orderLine: OrderDraftFinalize_draftOrderComplete_order_fulfillments_lines_orderLine | null;79}80export interface OrderDraftFinalize_draftOrderComplete_order_fulfillments {81 __typename: "Fulfillment";82 id: string;83 lines: (OrderDraftFinalize_draftOrderComplete_order_fulfillments_lines | null)[] | null;84 fulfillmentOrder: number;85 status: FulfillmentStatus;86 trackingNumber: string;87}88export interface OrderDraftFinalize_draftOrderComplete_order_lines_unitPrice_gross {89 __typename: "Money";90 amount: number;91 currency: string;92}93export interface OrderDraftFinalize_draftOrderComplete_order_lines_unitPrice_net {94 __typename: "Money";95 amount: number;96 currency: string;97}98export interface OrderDraftFinalize_draftOrderComplete_order_lines_unitPrice {99 __typename: "TaxedMoney";100 gross: OrderDraftFinalize_draftOrderComplete_order_lines_unitPrice_gross;101 net: OrderDraftFinalize_draftOrderComplete_order_lines_unitPrice_net;102}103export interface OrderDraftFinalize_draftOrderComplete_order_lines {104 __typename: "OrderLine";105 id: string;106 isShippingRequired: boolean;107 productName: string;108 productSku: string;109 quantity: number;110 quantityFulfilled: number;111 unitPrice: OrderDraftFinalize_draftOrderComplete_order_lines_unitPrice | null;112 thumbnailUrl: string | null;113}114export interface OrderDraftFinalize_draftOrderComplete_order_shippingAddress_country {115 __typename: "CountryDisplay";116 code: string;117 country: string;118}119export interface OrderDraftFinalize_draftOrderComplete_order_shippingAddress {120 __typename: "Address";121 city: string;122 cityArea: string;123 companyName: string;124 country: OrderDraftFinalize_draftOrderComplete_order_shippingAddress_country;125 countryArea: string;126 firstName: string;127 id: string;128 lastName: string;129 phone: string | null;130 postalCode: string;131 streetAddress1: string;132 streetAddress2: string;133}134export interface OrderDraftFinalize_draftOrderComplete_order_shippingMethod {135 __typename: "ShippingMethod";136 id: string;137}138export interface OrderDraftFinalize_draftOrderComplete_order_shippingPrice_gross {139 __typename: "Money";140 amount: number;141 currency: string;142}143export interface OrderDraftFinalize_draftOrderComplete_order_shippingPrice {144 __typename: "TaxedMoney";145 gross: OrderDraftFinalize_draftOrderComplete_order_shippingPrice_gross;146}147export interface OrderDraftFinalize_draftOrderComplete_order_subtotal_gross {148 __typename: "Money";149 amount: number;150 currency: string;151}152export interface OrderDraftFinalize_draftOrderComplete_order_subtotal {153 __typename: "TaxedMoney";154 gross: OrderDraftFinalize_draftOrderComplete_order_subtotal_gross;155}156export interface OrderDraftFinalize_draftOrderComplete_order_total_gross {157 __typename: "Money";158 amount: number;159 currency: string;160}161export interface OrderDraftFinalize_draftOrderComplete_order_total_tax {162 __typename: "Money";163 amount: number;164 currency: string;165}166export interface OrderDraftFinalize_draftOrderComplete_order_total {167 __typename: "TaxedMoney";168 gross: OrderDraftFinalize_draftOrderComplete_order_total_gross;169 tax: OrderDraftFinalize_draftOrderComplete_order_total_tax;170}171export interface OrderDraftFinalize_draftOrderComplete_order_totalAuthorized {172 __typename: "Money";173 amount: number;174 currency: string;175}176export interface OrderDraftFinalize_draftOrderComplete_order_totalCaptured {177 __typename: "Money";178 amount: number;179 currency: string;180}181export interface OrderDraftFinalize_draftOrderComplete_order_user {182 __typename: "User";183 id: string;184 email: string;185}186export interface OrderDraftFinalize_draftOrderComplete_order_availableShippingMethods_price {187 __typename: "Money";188 amount: number;189 currency: string;190}191export interface OrderDraftFinalize_draftOrderComplete_order_availableShippingMethods {192 __typename: "ShippingMethod";193 id: string;194 name: string;195 price: OrderDraftFinalize_draftOrderComplete_order_availableShippingMethods_price | null;196}197export interface OrderDraftFinalize_draftOrderComplete_order {198 __typename: "Order";199 id: string;200 billingAddress: OrderDraftFinalize_draftOrderComplete_order_billingAddress | null;201 canFinalize: boolean;202 created: any;203 customerNote: string;204 events: (OrderDraftFinalize_draftOrderComplete_order_events | null)[] | null;205 fulfillments: (OrderDraftFinalize_draftOrderComplete_order_fulfillments | null)[];206 lines: (OrderDraftFinalize_draftOrderComplete_order_lines | null)[];207 number: string | null;208 paymentStatus: PaymentChargeStatusEnum | null;209 shippingAddress: OrderDraftFinalize_draftOrderComplete_order_shippingAddress | null;210 shippingMethod: OrderDraftFinalize_draftOrderComplete_order_shippingMethod | null;211 shippingMethodName: string | null;212 shippingPrice: OrderDraftFinalize_draftOrderComplete_order_shippingPrice | null;213 status: OrderStatus;214 subtotal: OrderDraftFinalize_draftOrderComplete_order_subtotal | null;215 total: OrderDraftFinalize_draftOrderComplete_order_total | null;216 actions: (OrderAction | null)[];217 totalAuthorized: OrderDraftFinalize_draftOrderComplete_order_totalAuthorized | null;218 totalCaptured: OrderDraftFinalize_draftOrderComplete_order_totalCaptured | null;219 user: OrderDraftFinalize_draftOrderComplete_order_user | null;220 userEmail: string | null;221 availableShippingMethods: (OrderDraftFinalize_draftOrderComplete_order_availableShippingMethods | null)[] | null;222}223export interface OrderDraftFinalize_draftOrderComplete {224 __typename: "DraftOrderComplete";225 errors: OrderDraftFinalize_draftOrderComplete_errors[] | null;226 order: OrderDraftFinalize_draftOrderComplete_order | null;227}228export interface OrderDraftFinalize {229 draftOrderComplete: OrderDraftFinalize_draftOrderComplete | null;230}231export interface OrderDraftFinalizeVariables {232 id: string;...
nativetypes.py
Source:nativetypes.py
...41 if finalize is not None:42 if finalize_context or finalize_eval:43 const_finalize = None44 elif finalize_env:45 def const_finalize(x):46 return finalize(self.environment, x)47 else:48 const_finalize = finalize49 else:50 def const_finalize(x):51 return x52 # If we are inside a frame that requires output checking, we do so.53 outdent_later = False54 if frame.require_output_check:55 self.writeline('if parent_template is None:')56 self.indent()57 outdent_later = True58 # Try to evaluate as many chunks as possible into a static string at59 # compile time.60 body = []61 for child in node.nodes:62 try:63 if const_finalize is None:64 raise nodes.Impossible()65 const = child.as_const(frame.eval_ctx)66 if not has_safe_repr(const):67 raise nodes.Impossible()68 except nodes.Impossible:69 body.append(child)70 continue71 # the frame can't be volatile here, because otherwise the as_const72 # function would raise an Impossible exception at that point73 try:74 if frame.eval_ctx.autoescape:75 if hasattr(const, '__html__'):76 const = const.__html__()77 else:78 const = escape(const)79 const = const_finalize(const)80 except Exception:81 # if something goes wrong here we evaluate the node at runtime82 # for easier debugging83 body.append(child)84 continue85 if body and isinstance(body[-1], list):86 body[-1].append(const)87 else:88 body.append([const])89 # if we have less than 3 nodes or a buffer we yield or extend/append90 if len(body) < 3 or frame.buffer is not None:91 if frame.buffer is not None:92 # for one item we append, for more we extend93 if len(body) == 1:94 self.writeline('%s.append(' % frame.buffer)95 else:96 self.writeline('%s.extend((' % frame.buffer)97 self.indent()98 for item in body:99 if isinstance(item, list):100 val = repr(native_concat(item))101 if frame.buffer is None:102 self.writeline('yield ' + val)103 else:104 self.writeline(val + ',')105 else:106 if frame.buffer is None:107 self.writeline('yield ', item)108 else:109 self.newline(item)110 close = 0111 if finalize is not None:112 self.write('environment.finalize(')113 if finalize_context:114 self.write('context, ')115 close += 1116 self.visit(item, frame)117 if close > 0:118 self.write(')' * close)119 if frame.buffer is not None:120 self.write(',')121 if frame.buffer is not None:122 # close the open parentheses123 self.outdent()124 self.writeline(len(body) == 1 and ')' or '))')125 # otherwise we create a format string as this is faster in that case126 else:127 format = []128 arguments = []129 for item in body:130 if isinstance(item, list):131 format.append(native_concat(item).replace('%', '%%'))132 else:133 format.append('%s')134 arguments.append(item)135 self.writeline('yield ')136 self.write(repr(concat(format)) + ' % (')137 self.indent()138 for argument in arguments:139 self.newline(argument)140 close = 0141 if finalize is not None:142 self.write('environment.finalize(')143 if finalize_context:144 self.write('context, ')145 elif finalize_eval:146 self.write('context.eval_ctx, ')147 elif finalize_env:148 self.write('environment, ')149 close += 1150 self.visit(argument, frame)151 self.write(')' * close + ', ')152 self.outdent()153 self.writeline(')')154 if outdent_later:155 self.outdent()156class NativeTemplate(Template):...
table-gc.js
Source:table-gc.js
1// |jit-test| --no-baseline2// Turn off baseline and since it messes up the GC finalization assertions by3// adding spurious edges to the GC graph.4const Module = WebAssembly.Module;5const Instance = WebAssembly.Instance;6const Table = WebAssembly.Table;7const RuntimeError = WebAssembly.RuntimeError;8var caller = `(type $v2i (func (result i32))) (func $call (param $i i32) (result i32) (call_indirect $v2i (get_local $i))) (export "call" $call)`9var callee = i => `(func $f${i} (type $v2i) (i32.const ${i}))`;10// A table should not hold exported functions alive and exported functions11// should not hold their originating table alive. Live exported functions should12// hold instances alive and instances hold imported tables alive. Nothing13// should hold the export object alive.14resetFinalizeCount();15var i = wasmEvalText(`(module (table 2 anyfunc) (export "tbl" table) (elem (i32.const 0) $f0) ${callee(0)} ${caller})`);16var e = i.exports;17var t = e.tbl;18var f = t.get(0);19assertEq(f(), e.call(0));20assertErrorMessage(() => e.call(1), RuntimeError, /indirect call to null/);21assertErrorMessage(() => e.call(2), RuntimeError, /index out of bounds/);22assertEq(finalizeCount(), 0);23i.edge = makeFinalizeObserver();24t.edge = makeFinalizeObserver();25f.edge = makeFinalizeObserver();26gc();27assertEq(finalizeCount(), 0);28f.x = 42;29f = null;30gc();31assertEq(finalizeCount(), 0);32f = t.get(0);33assertEq(f.x, 42);34gc();35assertEq(finalizeCount(), 0);36i.exports = null;37e = null;38gc();39assertEq(finalizeCount(), 0);40t = null;41gc();42assertEq(finalizeCount(), 0);43i = null;44gc();45assertEq(finalizeCount(), 0);46assertEq(f(), 0);47f = null;48gc();49assertEq(finalizeCount(), 3);50// A table should hold the instance of any of its elements alive.51resetFinalizeCount();52var i = wasmEvalText(`(module (table 1 anyfunc) (export "tbl" table) (elem (i32.const 0) $f0) ${callee(0)} ${caller})`);53var e = i.exports;54var t = e.tbl;55var f = t.get(0);56i.edge = makeFinalizeObserver();57t.edge = makeFinalizeObserver();58f.edge = makeFinalizeObserver();59gc();60assertEq(finalizeCount(), 0);61i.exports = null;62e = null;63gc();64assertEq(finalizeCount(), 0);65f = null;66gc();67assertEq(finalizeCount(), 0);68i = null;69gc();70assertEq(finalizeCount(), 0);71t = null;72gc();73assertEq(finalizeCount(), 3);74// Null elements shouldn't keep anything alive.75resetFinalizeCount();76var i = wasmEvalText(`(module (table 2 anyfunc) (export "tbl" table) ${caller})`);77var e = i.exports;78var t = e.tbl;79i.edge = makeFinalizeObserver();80t.edge = makeFinalizeObserver();81gc();82assertEq(finalizeCount(), 0);83i.exports = null;84e = null;85gc();86assertEq(finalizeCount(), 0);87i = null;88gc();89assertEq(finalizeCount(), 1);90t = null;91gc();92assertEq(finalizeCount(), 2);93// Before initialization, a table is not bound to any instance.94resetFinalizeCount();95var i = wasmEvalText(`(module (func $f0 (result i32) (i32.const 0)) (export "f0" $f0))`);96var t = new Table({initial:4, element:"anyfunc"});97i.edge = makeFinalizeObserver();98t.edge = makeFinalizeObserver();99gc();100assertEq(finalizeCount(), 0);101i = null;102gc();103assertEq(finalizeCount(), 1);104t = null;105gc();106assertEq(finalizeCount(), 2);107// When a Table is created (uninitialized) and then first assigned, it keeps the108// first element's Instance alive (as above).109resetFinalizeCount();110var i = wasmEvalText(`(module (func $f (result i32) (i32.const 42)) (export "f" $f))`);111var f = i.exports.f;112var t = new Table({initial:1, element:"anyfunc"});113i.edge = makeFinalizeObserver();114f.edge = makeFinalizeObserver();115t.edge = makeFinalizeObserver();116t.set(0, f);117assertEq(t.get(0), f);118assertEq(t.get(0)(), 42);119gc();120assertEq(finalizeCount(), 0);121f = null;122i.exports = null;123gc();124assertEq(finalizeCount(), 0);125assertEq(t.get(0)(), 42);126i = null;127gc();128assertEq(finalizeCount(), 0);129t.set(0, null);130assertEq(t.get(0), null);131gc();132assertEq(finalizeCount(), 2);133t = null;134gc();135assertEq(finalizeCount(), 3);136// Once all of an instance's elements in a Table have been clobbered, the137// Instance should not be reachable.138resetFinalizeCount();139var i1 = wasmEvalText(`(module (func $f1 (result i32) (i32.const 13)) (export "f1" $f1))`);140var i2 = wasmEvalText(`(module (func $f2 (result i32) (i32.const 42)) (export "f2" $f2))`);141var f1 = i1.exports.f1;142var f2 = i2.exports.f2;143var t = new Table({initial:2, element:"anyfunc"});144i1.edge = makeFinalizeObserver();145i2.edge = makeFinalizeObserver();146f1.edge = makeFinalizeObserver();147f2.edge = makeFinalizeObserver();148t.edge = makeFinalizeObserver();149t.set(0, f1);150t.set(1, f2);151gc();152assertEq(finalizeCount(), 0);153f1 = f2 = null;154i1.exports = null;155i2.exports = null;156gc();157assertEq(finalizeCount(), 0);158i1 = null;159i2 = null;160gc();161assertEq(finalizeCount(), 0);162t.set(0, t.get(1));163gc();164assertEq(finalizeCount(), 2);165t.set(0, null);166t.set(1, null);167gc();168assertEq(finalizeCount(), 4);169t = null;170gc();171assertEq(finalizeCount(), 5);172// Ensure that an instance that is only live on the stack cannot be GC even if173// there are no outstanding references.174resetFinalizeCount();175const N = 10;176var tbl = new Table({initial:N, element:"anyfunc"});177tbl.edge = makeFinalizeObserver();178function runTest() {179 tbl = null;180 gc();181 assertEq(finalizeCount(), 0);182 return 100;183}184var i = wasmEvalText(185 `(module186 (import $imp "a" "b" (result i32))187 (func $f (param i32) (result i32) (call $imp))188 (export "f" $f)189 )`,190 {a:{b:runTest}}191);192i.edge = makeFinalizeObserver();193tbl.set(0, i.exports.f);194var m = new Module(wasmTextToBinary(`(module195 (import "a" "b" (table ${N} anyfunc))196 (type $i2i (func (param i32) (result i32)))197 (func $f (param $i i32) (result i32)198 (set_local $i (i32.sub (get_local $i) (i32.const 1)))199 (i32.add200 (i32.const 1)201 (call_indirect $i2i (get_local $i) (get_local $i))))202 (export "f" $f)203)`));204for (var i = 1; i < N; i++) {205 var inst = new Instance(m, {a:{b:tbl}});206 inst.edge = makeFinalizeObserver();207 tbl.set(i, inst.exports.f);208}209inst = null;210assertEq(tbl.get(N - 1)(N - 1), 109);211gc();...
ICPBravo.js
Source:ICPBravo.js
1function ICPBravoApplet() {2 return document.getElementById('ICPBravoApplet');3}45var currentCMS = '';6var onFinalizeCMS = null;7var onAddCertificate = null;8var currentHASH = '';9var onFinalizeHASH = null;10var onAppletLoaded = [];11var currentProp = '';12var currentValue = '';13var onFinalizeOperation = null;1415function initializeCMS() {16 currentCMS = '';17}1819function addCMSPart(part) {20 currentCMS += part; 21}2223function web2url(url) {24 while (url.indexOf('#') >= 0)25 url = url.replace('#', '%');26 return url;27}2829function url2org(url) {30 while (url.indexOf('%0D%0A') >= 0)31 url = url.replace('%0D%0A', '\n');32 33 while (url.indexOf('%0D') >= 0)34 url = url.replace('%0D', '\n');35 36 while (url.indexOf('%0A') >= 0)37 url = url.replace('%0A', '\n');38 39 while (url.indexOf('%2B') >= 0)40 url = url.replace('%2B', '+');41 42 while (url.indexOf('%2F') >= 0)43 url = url.replace('%2F', '/');44 45 while (url.indexOf('%3D') >= 0)46 url = url.replace('%3D', '=');47 48 return url;49}5051function addCertificate(alias, name) {52 if (onAddCertificate != null)53 onAddCertificate(alias, name);54}5556function setAddCertificate(fn) {57 onAddCertificate=fn;58}5960function finalizeCMS(msg) {61 currentCMS = web2url(currentCMS);62 63 if (onFinalizeCMS != null)64 onFinalizeCMS(currentCMS);65}6667function setCMSCallback(fn) {68 onFinalizeCMS=fn;69}707172function initializeHASH() {73 currentHASH = '';74}7576function addHASHPart(part) {77 currentHASH += part; 78}7980function finalizeHASH(msg) {81 currentHASH = web2url(currentHASH);82 if (onFinalizeHASH != null)83 onFinalizeHASH(currentHASH);84}8586function setHASHCallback(fn) {87 onFinalizeHASH=fn;88}899091var currentCertificate = '';92var onFinalizeCertificate = null;93 94function initializeCertificate() {95 currentCertificate = '';96}9798function addCertificatePart(part) {99 currentCertificate += part; 100}101102function finalizeCertificate(msg) {103 value = web2url(currentCertificate);104 if (onFinalizeCertificate != null)105 onFinalizeCertificate(value);106}107108function setCertificateGenereatedCallback(fn) {109 onFinalizeCertificate=fn;110}111112function operationOk() {113 if (onFinalizeOperation)114 onFinalizeOperation('ok');115}116117function operationError(msg) {118 if (onFinalizeOperation)119 onFinalizeOperation(msg);120 else121 alert(msg);122}123124function setFinalizeOperationCallback(fn) {125 onFinalizeOperation=fn;126}127128function apresentaDialogsErro(apresenta, fn) {129 ICPBravoApplet().apresentaDialogsErro(apresenta);130 if (fn)131 setFinalizeOperationCallback(fn);132}133134function appletLoaded() {135 for (var a=0; a<onAppletLoaded.length; a++) {136 onAppletLoaded[a]();137 }138}139140function setAppletLoadedCallback(fn) {141 onAppletLoaded[onAppletLoaded.length]=fn;142}143144function configureApplet() {145 ICPBravoApplet().configureApplet();146}147148function appletConfigured() {149 alert('Applet Configured');150}151152var onSetCertificateProperties = null;153154function initializeValue(prop) {155 currentProp = prop;156 currentValue = '';157}158159function addValuePart(part) {160 currentValue += part; 161}162163function finalizeValue(msg) {164 currentValue = web2url(currentValue);165 if (onSetCertificateProperties != null)166 onSetCertificateProperties(currentProp, currentValue);167}168169function setOnSetCertificateProperties(fn) {170 onSetCertificateProperties=fn;171}172173function certificatesLoaded() {174}175176function readCurrentDocument() {177 var toReturn = '<CurrentForm>\n';178 toReturn += 'HTML CONTENT\n';179 toReturn += document.body.innerHTML;180 181 toReturn += '</CurrentForm>\n<CurrentValues>\n';182 for (var a=0; a<document.forms.length; a++) {183 var frm = document.forms[a];184 for (var b=0; b<frm.elements.length; b++) {185 var el = frm.elements[b];186187 var elText = '<formValue';188 if (el.name)189 elText += ' name="'+el.name+'"';190 else191 elText += ' id="'+el.id+'"';192 elText += ' type="'+el.type+'"';193 elText += ' value="';194 195 if (el.type == 'text' || el.type == 'textarea' || el.type == 'button' || el.type == 'hidden') {196 elText += el.value;197 } else if (el.type == 'checkbox') {198 elText += el.checked;199 } else if (el.type == 'radio') {200 elText += el.value + '(' + el.checked + ')';201 } else if (el.type == 'select-one') {202 if (el.selectedIndex >= 0)203 elText += el.options[el.selectedIndex].text;204 else205 elText += 'none';206 } else207 elText += el.innerHTML;208 209 elText += '" />\n';210 toReturn += elText;211 }212 }213 toReturn += '</CurrentValues>\n';214 return toReturn;
...
FinalizeAuction.js
Source:FinalizeAuction.js
1// @flow weak2import React, {Component} from 'react';3import {Warnings} from '../Common/Warnings';4import {finalizeAuction} from '../../lib/ensService';5import {sendRawTransaction} from '../../lib/dAppService';6import {FinalizeAuctionInfo} from './FinalizeAuctionInfo';7import {FinalizeAuctionForm} from './FinalizeAuctionForm';8import './FinalizeAuction.css';9const handleFinalizeAuctionProcess = async (inputObj) => {10 const {domainName, privateKey, gas} = inputObj;11 let returnObj = {12 txHash: '',13 errMsg: undefined14 }15 const payload = finalizeAuction(domainName, privateKey, gas);16 // TODO17 // - should validate if the user can finalize the auction18 // getEstimateGas(payload)19 try {20 returnObj.txHash = await sendRawTransaction(payload);21 } catch (error) {22 returnObj.errMsg = `finalize auction error : ${error}`;23 }24 return returnObj;25}26export class FinalizeAuction extends Component {27 constructor(props) {28 super(props)29 this.state = {30 finalFormSent: '',31 warningOpen: false,32 warningMessage: ''33 }34 this.setFinalFormSent = this.setFinalFormSent.bind(this);35 this.handleWarningMessageClose = this.handleWarningMessageClose.bind(this);36 this.handleWarningMessageOpen = this.handleWarningMessageOpen.bind(this);37 this.handleFormSubmit = this.handleFormSubmit.bind(this);38 }39 setFinalFormSent(state) {40 this.setState({finalFormSent: state});41 }42 handleWarningMessageClose() {43 this.setState({warningOpen: false});44 }45 handleWarningMessageOpen(msg) {46 this.setState({warningOpen: true, warningMessage: msg});47 }48 handleFormSubmit(inputResult) {49 if (!(this.props.address && this.props.privateKey)) {50 this.handleWarningMessageOpen('Please unlock wallet before bid ENS.');51 return;52 }53 const inputObj = {54 domainName: this.props.searchResult.searchName,55 privateKey: this.props.privateKey,56 gas: inputResult.gas57 }58 handleFinalizeAuctionProcess(inputObj).then((result) => {59 // TODO60 // 1. not yet refactoring error message61 // 2. add set result data(like txhash) from input result if needed62 (result.errMsg === undefined) ?63 this.setFinalFormSent('sent') :64 this.handleWarningMessageOpen(result.errMsg);65 });66 }67 finalizeAuctionInfo = () => (68 <FinalizeAuctionInfo69 backToSearch={this.props.backToSearch}70 searchName={this.props.searchResult.searchName}71 switchPage={this.props.switchPage}72 />73 );74 finalizeAuctionForm = () => (75 <FinalizeAuctionForm76 {...this.props}77 {...this.state}78 handleFormSubmit={this.handleFormSubmit}79 handleWarningMessageOpen={this.handleWarningMessageOpen}80 />81 )82 render() {83 const finalizeAuctionPage = this.state.finalFormSent === 'sent' ?84 this.finalizeAuctionInfo() :85 this.finalizeAuctionForm();86 const warnings =87 <Warnings88 warningOpen={this.state.warningOpen}89 warningMessage={this.state.warningMessage}90 handleWarningMessageClose={this.handleWarningMessageClose}91 />92 return(93 <div>94 {finalizeAuctionPage} 95 {warnings}96 </div>97 )98 }...
Using AI Code Generation
1const pact = require("@pact-foundation/pact-node");2const path = require("path");3const opts = {4 pactFilesOrDirs: [path.resolve(process.cwd(), "pacts")],5};6pact.publishPacts(opts).then(() => {7 console.log("Pact contract publishing complete!");8 console.log("");9}).catch(e => {10 console.log("Pact contract publishing failed: ", e);11});12const { Verifier } = require("@pact-foundation/pact");13const path = require("path");14const opts = {15 pactUrls: [path.resolve(process.cwd(), "pacts", "consumer-Provider.json")],16};17new Verifier().verifyProvider(opts).then(output => {18 console.log("Pact Verification Complete!");19 console.log("");20 console.log(output);21}).catch(e => {22 console.log("Pact Verification Failed: ", e);23});24{25 "scripts": {26 },27 "dependencies": {
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!