text
stringlengths
9
39.2M
dir
stringlengths
26
295
lang
stringclasses
185 values
created_date
timestamp[us]
updated_date
timestamp[us]
repo_name
stringlengths
1
97
repo_full_name
stringlengths
7
106
star
int64
1k
183k
len_tokens
int64
1
13.8M
```xml /** * Get the value of a command line argument * * @param name The name of the argument * @param shortName The optioanl short name * @returns The value of the argument or undefined if the argument is not present */ export function getArg(name: string, shortName?: string) { const argument = process.argv .slice(2) .filter( (arg) => arg === `--${name}` || arg.startsWith(`--${name}=`) || (shortName && arg.startsWith(`-${shortName}=`)) ) .map((arg) => arg.split("=")[1] ?? "true") .map((arg) => arg.trim()) .join(","); return argument || undefined; } ```
/content/code_sandbox/server/utils/args.ts
xml
2016-05-22T21:31:47
2024-08-16T19:57:22
outline
outline/outline
26,751
165
```xml import GraphController from '../../../controller/GraphController'; import { IMail } from '../../../model/IMail'; export interface IOneDriveProps { graphController: GraphController; mail: IMail; successCallback: (msg: string) => void; errorCallback: (msg: string) => void; } ```
/content/code_sandbox/samples/react-outlook-copy2teams/src/webparts/outlook2SharePoint/components/IOneDriveProps.ts
xml
2016-08-30T17:21:43
2024-08-16T18:41:32
sp-dev-fx-webparts
pnp/sp-dev-fx-webparts
2,027
68
```xml import { createContext, useContext } from 'react'; export type DialogSurfaceContextValue = boolean; const defaultContextValue: DialogSurfaceContextValue = false; export const DialogSurfaceContext = createContext<DialogSurfaceContextValue | undefined>(undefined); export const DialogSurfaceProvider = DialogSurfaceContext.Provider; export const useDialogSurfaceContext_unstable = () => useContext(DialogSurfaceContext) ?? defaultContextValue; ```
/content/code_sandbox/packages/react-components/react-dialog/library/src/contexts/dialogSurfaceContext.ts
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
81
```xml import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { ColorPickerDocModule } from '@doc/colorpicker/colorpickerdoc.module'; import { ColorPickerDemo } from './colorpickerdemo'; import { ColorPickerDemoRoutingModule } from './colorpickerdemo-routing.module'; @NgModule({ imports: [CommonModule, ColorPickerDemoRoutingModule, ColorPickerDocModule], declarations: [ColorPickerDemo] }) export class ColorPickerDemoModule {} ```
/content/code_sandbox/src/app/showcase/pages/colorpicker/colorpickerdemo.module.ts
xml
2016-01-16T09:23:28
2024-08-16T19:58:20
primeng
primefaces/primeng
9,969
98
```xml import * as React from 'react'; import ComponentExample from '../../../../components/ComponentDoc/ComponentExample'; import ExampleSection from '../../../../components/ComponentDoc/ExampleSection'; const Variations = () => ( <ExampleSection title="Variations"> <ComponentExample title="Sizes" description="A Pill can be sized." examplePath="components/Pill/Variations/PillExampleSizes" /> <ComponentExample title="Appearance" description="A Pill can be filled, inverted or outlined." examplePath="components/Pill/Variations/PillExampleAppearance" /> <ComponentExample title="Rectangular" description="A Pill can be rectangular." examplePath="components/Pill/Variations/PillExampleRectangular" /> <ComponentExample title="Actionable" description="A Pill can be actionable." examplePath="components/Pill/Variations/PillExampleActionable" /> <ComponentExample title="Image" description="A Pill can have an Image." examplePath="components/Pill/Variations/PillExampleImage" /> <ComponentExample title="Icon" description="A Pill can have an Icon." examplePath="components/Pill/Variations/PillExampleIcon" /> <ComponentExample title="Selectable" description="A Pill can be selectable." examplePath="components/Pill/Variations/PillExampleSelectable" /> </ExampleSection> ); export default Variations; ```
/content/code_sandbox/packages/fluentui/docs/src/examples/components/Pill/Variations/index.tsx
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
324
```xml <?xml version="1.0" encoding="utf-8"?> <resources> <integer name="translation_completeness">2</integer> </resources> ```
/content/code_sandbox/app/src/main/res/values-af/translation_info.xml
xml
2016-07-02T10:44:04
2024-08-16T18:55:54
StreetComplete
streetcomplete/StreetComplete
3,781
35
```xml import {MetadataTypes} from "@tsed/core"; import {BaseContext} from "@tsed/di"; import type {Ttl} from "../services/PlatformCache.js"; export interface PlatformCacheOptions extends MetadataTypes { /** * key expiration ttl in seconds. */ ttl?: Ttl; /** * By default, the key is generated from the method name and the arguments passed to the method. */ prefix?: string; /** * Algorithm used to generate the key. By default, the key is generated from the method name and the arguments passed to the method. */ key?: string | ((args: any[], ctx?: BaseContext) => string); /** * threshold to refresh the cache. */ refreshThreshold?: number; /** * The function determine if the result must be cached or not. */ canCache?: ((item: any) => boolean) | "no-nullish"; } ```
/content/code_sandbox/packages/platform/platform-cache/src/interfaces/PlatformCacheOptions.ts
xml
2016-02-21T18:38:47
2024-08-14T21:19:48
tsed
tsedio/tsed
2,817
199
```xml <?xml version="1.0" encoding="utf-8"?> <!-- path_to_url Unless required by applicable law or agreed to in writing, software WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --> <vector xmlns:android="path_to_url" android:width="24dp" android:height="24dp" android:viewportWidth="24.0" android:viewportHeight="24.0"> <path android:fillColor="?attr/colorOnSurface" android:pathData="M19,19 L21,19 L21,21 L19,21 L19,19 Z M19,17 L21,17 L21,15 L19,15 L19,17 Z M3,13 L5,13 L5,11 L3,11 L3,13 Z M3,17 L5,17 L5,15 L3,15 L3,17 Z M3,9 L5,9 L5,7 L3,7 L3,9 Z M3,5 L5,5 L5,3 L3,3 L3,5 Z M7,5 L9,5 L9,3 L7,3 L7,5 Z M15,21 L17,21 L17,19 L15,19 L15,21 Z M11,21 L13,21 L13,19 L11,19 L11,21 Z M15,21 L17,21 L17,19 L15,19 L15,21 Z M7,21 L9,21 L9,19 L7,19 L7,21 Z M3,21 L5,21 L5,19 L3,19 L3,21 Z M21,8 C21,5.24,18.76,3,16,3 L11,3 L11,5 L16,5 C17.65,5,19,6.35,19,8 L19,13 L21,13 L21,8 Z" /> <path android:pathData="M0,0 L24,0 L24,24 L0,24 Z" /> </vector> ```
/content/code_sandbox/catalog/java/io/material/catalog/assets/res/drawable-v21/ic_rounded_corners_24px.xml
xml
2016-12-05T16:11:29
2024-08-16T17:51:42
material-components-android
material-components/material-components-android
16,176
463
```xml import CounterStyle from '@jsamr/counter-style'; import decimal from '@jsamr/counter-style/presets/decimal'; import decimalLeadingZero from '@jsamr/counter-style/presets/decimalLeadingZero'; import lowerRoman from '@jsamr/counter-style/presets/lowerRoman'; import lowerAlpha from '@jsamr/counter-style/presets/lowerAlpha'; import lowerGreek from '@jsamr/counter-style/presets/lowerGreek'; import upperAlpha from '@jsamr/counter-style/presets/upperAlpha'; import upperRoman from '@jsamr/counter-style/presets/upperRoman'; import DisclosureClosedSymbolRenderer from './symbolic/DisclosureClosedSymbolRenderer'; import DisclosureOpenSymbolRenderer from './symbolic/DisclosureOpenSymbolRenderer'; import CircleSymbolRenderer from './symbolic/CircleSymbolRenderer'; import DiscSymbolRenderer from './symbolic/DiscSymbolRenderer'; import SquareSymbolRenderer from './symbolic/SquareSymbolRenderer'; import type { DefaultSupportedListStyleType, ListStyleSpec } from '../shared-types'; const unitaryRenderer = CounterStyle.cyclic('*').withSuffix(' '); const lowerAlphaSpec = { type: 'textual', counterStyleRenderer: lowerAlpha } as const; const upperAlphaSpec = { type: 'textual', counterStyleRenderer: upperAlpha } as const; /** * Default list style specs supported by this library. * * @public */ const defaultListStyleSpecs: Record< DefaultSupportedListStyleType, ListStyleSpec > = { 'decimal-leading-zero': { type: 'textual', counterStyleRenderer: decimalLeadingZero }, 'disclosure-closed': { counterStyleRenderer: unitaryRenderer, type: 'unitary', Component: DisclosureClosedSymbolRenderer }, 'disclosure-open': { counterStyleRenderer: unitaryRenderer, type: 'unitary', Component: DisclosureOpenSymbolRenderer }, 'lower-alpha': lowerAlphaSpec, 'lower-greek': { type: 'textual', counterStyleRenderer: lowerGreek }, 'lower-latin': lowerAlphaSpec, 'lower-roman': { type: 'textual', counterStyleRenderer: lowerRoman }, 'upper-alpha': upperAlphaSpec, 'upper-latin': upperAlphaSpec, 'upper-roman': { type: 'textual', counterStyleRenderer: upperRoman }, circle: { counterStyleRenderer: unitaryRenderer, type: 'unitary', Component: CircleSymbolRenderer }, decimal: { type: 'textual', counterStyleRenderer: decimal }, disc: { counterStyleRenderer: unitaryRenderer, type: 'unitary', Component: DiscSymbolRenderer }, none: { counterStyleRenderer: CounterStyle.symbolic('').withSuffix(null), type: 'unitary', Component: () => null }, square: { counterStyleRenderer: unitaryRenderer, type: 'unitary', Component: SquareSymbolRenderer } }; export default defaultListStyleSpecs; ```
/content/code_sandbox/packages/render-html/src/elements/defaultListStyleSpecs.ts
xml
2016-11-29T10:50:53
2024-08-08T06:53:22
react-native-render-html
meliorence/react-native-render-html
3,445
689
```xml <?xml version="1.0" encoding="utf-8"?> <!-- contributor license agreements. See the NOTICE file distributed with --> <!-- this work for additional information regarding copyright ownership. --> <!-- --> <!-- path_to_url --> <!-- --> <!-- Unless required by applicable law or agreed to in writing, software --> <!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --> <!-- $Id$ --> <!-- !!! THIS IS A GENERATED FILE !!! --> <!-- If updates are needed, then: --> <!-- * run 'ant codegen-hyphenation-classes', --> <!-- which will generate a new file classes.xml --> <!-- in 'src/java/org/apache/fop/hyphenation' --> <!-- * commit the changed file --> <classes> aA bB cC dD eE fF gG hH iI jJ kK lL mM nN oO pP qQ rR sS tT uU vV wW xX yY zZ I S </classes> ```
/content/code_sandbox/itext/itext.hyph/external/classes.xml
xml
2016-06-16T14:34:03
2024-08-14T11:37:28
itext-dotnet
itext/itext-dotnet
1,630
486
```xml <project xmlns="path_to_url" xmlns:xsi="path_to_url" xsi:schemaLocation="path_to_url path_to_url"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>${groupId}</groupId> <artifactId>${rootArtifactId}</artifactId> <version>${version}</version> </parent> <artifactId>${service2Name}-api</artifactId> <packaging>jar</packaging> <dependencies> <dependency> <groupId>com.lightbend.lagom</groupId> <artifactId>lagom-javadsl-api_${scala.binary.version}</artifactId> </dependency> </dependencies> </project> ```
/content/code_sandbox/dev/archetypes/maven-java/src/main/resources/archetype-resources/__service2Name__-api/pom.xml
xml
2016-02-23T01:51:06
2024-07-17T04:00:50
lagom
lagom/lagom
2,630
159
```xml import type { NavigationRoute, ReactNavigationInstrumentation } from '../../src/js/tracing/reactnavigation'; export function createMockNavigationAndAttachTo(sut: ReactNavigationInstrumentation) { const mockedNavigationContained = mockNavigationContainer(); const mockedNavigation = { emitCancelledNavigation: () => { mockedNavigationContained.listeners['__unsafe_action__']({ // this object is not used by the instrumentation }); }, navigateToNewScreen: () => { mockedNavigationContained.listeners['__unsafe_action__']({ // this object is not used by the instrumentation }); mockedNavigationContained.currentRoute = { key: 'new_screen', name: 'New Screen', }; mockedNavigationContained.listeners['state']({ // this object is not used by the instrumentation }); }, navigateToSecondScreen: () => { mockedNavigationContained.listeners['__unsafe_action__']({ // this object is not used by the instrumentation }); mockedNavigationContained.currentRoute = { key: 'second_screen', name: 'Second Screen', }; mockedNavigationContained.listeners['state']({ // this object is not used by the instrumentation }); }, navigateToInitialScreen: () => { mockedNavigationContained.listeners['__unsafe_action__']({ // this object is not used by the instrumentation }); mockedNavigationContained.currentRoute = { key: 'initial_screen', name: 'Initial Screen', }; mockedNavigationContained.listeners['state']({ // this object is not used by the instrumentation }); }, finishAppStartNavigation: () => { mockedNavigationContained.currentRoute = { key: 'initial_screen', name: 'Initial Screen', }; mockedNavigationContained.listeners['state']({ // this object is not used by the instrumentation }); }, }; sut.registerNavigationContainer(mockRef(mockedNavigationContained)); return mockedNavigation; } function mockRef<T>(wat: T): { current: T } { return { current: wat, }; } function mockNavigationContainer(): MockNavigationContainer { return new MockNavigationContainer(); } export class MockNavigationContainer { currentRoute: NavigationRoute = { key: 'initial_screen', name: 'Initial Screen', }; listeners: Record<string, (e: any) => void> = {}; addListener: any = jest.fn((eventType: string, listener: (e: any) => void): void => { this.listeners[eventType] = listener; }); getCurrentRoute(): NavigationRoute | undefined { return this.currentRoute; } } ```
/content/code_sandbox/test/tracing/reactnavigationutils.ts
xml
2016-11-30T14:45:57
2024-08-16T13:21:38
sentry-react-native
getsentry/sentry-react-native
1,558
552
```xml import {VersionWorker, Plugin, PluginFactory, Operation} from './api'; import {VersionWorkerImpl} from './worker'; import {ScopedCache} from './cache'; import {NgSwAdapter, NgSwCache, NgSwEvents, NgSwFetch, Clock} from './facade'; import {LOG, LOGGER, Verbosity} from './logging'; import {Manifest, parseManifest} from './manifest'; let driverId: number = 0; /** * Possible states for the service worker. */ export enum DriverState { // Just starting up - this is the initial state. The worker is not servicing requests yet. // Crucially, it does not know if it is an active worker, or is being freshly installed or // updated. STARTUP, // The service worker has an active manifest and is currently serving traffic. READY, // The service worker is READY, but also has an updated manifest staged. When a fetch // is received and no current tabs are open, the worker may choose to activate the // pending manifest and discard the old one, in which case it will transition to READY. UPDATE_PENDING, // The worker has started up, but had no active manifest cached. In this case, it must // download from the network. INSTALLING, // Something happened that prevented the worker from reaching a good state. In the LAME // state the worker forwards all requests directly to the network, effectively self-disabling. // The worker will not recover from this state until it is terminated. LAME, } /** * Manages the lifecycle of the Angular service worker. * * `Driver` is a singleton within the worker. It attempts to instantiate a `VersionWorker`, * a class that serves fetch (and other) events according to the instructions defined in a * particular version of a manifest file. The `Driver` maintains an active `VersionWorker` * and routes events to it when possible. A state machine ensures the `Driver` always * responds to traffic correctly. * * A principle consideration for choosing a 'correct' manifest with which to serve traffic * is when to switch to a new (updated) version of the manifest. `Driver` is responsible * for periodically downloading fresh versions of the manifest from the server, staging * a new `VersionWorker` if the manifest has been updated, and deciding when to switch app * traffic from the old to the new manifest. A large part of `Driver`'s logic is devoted * to this update process. * * At a high level, updates follow this process: * * 1) When a new `Driver` is created (worker startup), it initializes into a READY state * and then checks for an updated manifest from the network. * * 2) If such a manifest is found, the `Driver` creates a new `VersionWorker` and attempts * to set it up successfully, updating files from the old `VersionWorker` currently * serving traffic. * * 3) If that update is successful, the driver queues the new manifest as staged and * enters an UPDATE_PENDING state. * * 4) On the next `fetch` event that meets all the criteria for an update, the `Driver` * activates the stage manifest, begins serving traffic with the new `VersionWorker`, * and instructs the old `VersionWorker to clear up. */ export class Driver { // The worker always starts in STARTUP. private state: DriverState = DriverState.STARTUP; // A hash of the pending manifest, if the worker is in an UPDATE_PENDING state. private pendingUpdateHash: string = null; // Tracks which `Driver` instance this is, useful for testing only. private id: number; // A `Promise` that resolves when the worker reaches a state other than READY. The worker // blocks on this when handling fetch events. private init: Promise<any>; // The currently active `VersionWorkerImpl`, which handles events for the active manifest. // This is only valid if the worker is in the READY or UPDATE_PENDING states. private active: VersionWorkerImpl; // A `CacheStorage` API wrapper with the service worker prefix. This is used to delete all // caches associated with the worker when upgrading between worker versions or recovering // from a critical error. private scopedCache: ScopedCache; // The next available id for observable streams used to communicate with application tabs. private streamId: number = 0; // A map of stream ids to `MessagePort`s that communicate with application tabs. private streams: {[key: number]: MessagePort} = {}; // The worker's lifecycle log, which is appended to when lifecycle events happen. This // is not ever cleared, but should not grow very large. private lifecycleLog: string[] = []; // A `Promise` that resolves when the worker enters the READY state. Used only in tests. ready: Promise<any>; // A resolve function that resolves the `ready` promise. Used only for testing. readyResolve: Function; // A `Promise` that resolves when the worker enters the UPDATE_PENDING state. Used only // in tests. updatePending: Promise<any>; // A resolve function that resolves the `ready` promise. Used only for testing. updatePendingResolve: Function; // Stream IDs that are actively listening for update lifecycle events. private updateListeners: number[] = []; constructor( private manifestUrl: string, private plugins: PluginFactory<any>[], private scope: ServiceWorkerGlobalScope, private adapter: NgSwAdapter, private cache: NgSwCache, private events: NgSwEvents, public fetcher: NgSwFetch, public clock: Clock) { this.id = driverId++; // Set up Promises for testing. this.ready = new Promise(resolve => this.readyResolve = resolve) this.updatePending = new Promise(resolve => this.updatePendingResolve = resolve); // All SW caching should go through this cache. this.scopedCache = new ScopedCache(this.cache, 'ngsw:'); // Subscribe to all the service worker lifecycle events: events.install = (event: InstallEvent) => { this.lifecycle('install event'); event.waitUntil(Promise.resolve() // On installation, wipe all the caches to avoid any inconsistent states // with what the previous script version saved. .then(() => this.reset()) // Get rid of the old service worker asap. .then(() => this.scope.skipWaiting()) ); }; events.activate = (event: ActivateEvent) => { this.lifecycle('activate event'); // Kick off the startup process right away, so the worker doesn't wait for fetch // events before getting a manifest and installing the app. if (!this.init) { this.startup(); } // Take over all active pages. At this point the worker is still in STARTUP, so // all requests will fall back on the network. event.waitUntil(this.scope.clients.claim()); }; events.fetch = (event: FetchEvent) => { const req = event.request; // Handle the log event no matter what state the worker is in. if (req.url.endsWith('/ngsw.log')) { event.respondWith(this .status() .then(status => this.adapter.newResponse(JSON.stringify(status, null, 2))) ); return; } // Skip fetch events when in LAME state - no need to wait for init for this. // Since the worker doesn't call event.respondWith(), the browser will go to // the network for this request. if (this.state === DriverState.LAME) { return; } // If this is the first request and the worker is in STARTUP, kick off the startup // process. This is a normal step for subsequent startups of the worker (during the // first one, the activate event usually kicks off the startup process). if (this.state === DriverState.STARTUP && !this.init) { this.startup(); } // Should not happen, but just in case, throw an error. if (!this.init) { throw new Error(`init Promise not present in state ${DriverState[this.state]}`); } event.respondWith(this // For every request, first wait on initialization. After this.init resolves, the // worker should no longer be in STARTUP. Choose the strategy to handle the // request based on the worker's state. .init .then(() => { switch (this.state) { case DriverState.READY: // The worker is ready and this.active is set to a VersionWorker. return this.active.fetch(req); case DriverState.UPDATE_PENDING: // The worker is ready but has a pending update. Decide whether to activate // the pending manifest before servicing the request. return this .maybeUpdate(event.clientId) // After maybeUpdate(), the worker is either still in UPDATE_PENDING (the // worker couldn't update because other tabs were open, etc) or in READY // and this.active is now the new VersionWorker for the updated manifest. // Either way, serve the request with the active worker. .then(() => this.active.fetch(req)); case DriverState.INSTALLING: case DriverState.LAME: // Whether the worker is still INSTALLING or has freshly transitioned to a // LAME state, serve the request with the network. return this.fetcher.request(req, true); default: // Shouldn't happen, but just be safe and serve the request from the network. return this.fetcher.request(req, true); } }) ); }; events.message = (event: MessageEvent) => { // Skip all events in the LAME state. if (this.state === DriverState.LAME) { return; } // Start up if needed (see fetch above). if (this.state === DriverState.STARTUP && !this.init) { this.startup(); } if (!this.init) { throw new Error(`init Promise not present in state ${DriverState[this.state]}`); } // Some sanity checks against the incoming message - is it intended for the worker? if (event.ports.length !== 1 || !event.data || !event.data.hasOwnProperty('$ngsw')) { return; } // Wait for initialization. this.init.then(() => { // Did the worker reach a good state? if (this.state !== DriverState.READY && this.state !== DriverState.UPDATE_PENDING) { // No - drop the message, it can't be handled until the worker is in a good state. return; } // The message includes a MessagePort for sending responses. Set this up as a stream. const respond: MessagePort = event.ports[0]; const id = this.streamId++; this.streams[id] = respond; // Send the id as the first response. This can be used by the client to notify of an // "unsubscription" to this request. respond.postMessage({'$ngsw': true, 'id': id}); // Handle the actual payload. this.handleMessage(event.data, id); }); } events.push = (event: PushEvent) => { // Skip all PUSH messages in the LAME state. Technically this isn't valid per the spec, // but better to ignore them than throw random errors. if (this.state === DriverState.LAME) { return; } // Start up if needed (see fetch above). if (this.state === DriverState.STARTUP && !this.init) { this.startup(); } if (!this.init) { throw new Error(`init Promise not present in state ${DriverState[this.state]}`); } Promise // Wait for both initialization and the data sent with the push message. .all([ this.init, event.data.text(), ]) // Result of this.init is unimportant as long as it's resolved. .then(results => results[1]) .then(data => { // Make sure the worker ended up in a good state after initialization. if (this.state !== DriverState.READY && this.state !== DriverState.UPDATE_PENDING) { // If not, drop the push message. Again, not valid per the spec, but safer than attempting // to handle and throwing errors. return; } // Handle the message with the active VersionWorker. this.active.push(data); }); }; } /** * Write a message to the lifecycle log. */ private lifecycle(msg: string): void { this.lifecycleLog.push(msg); } /** * Attempt to reset the service worker to a pristine state, as if one had never been installed * before. * * This involves removing all of the caches that fall under the `ScopedCache` used by the * worker. */ private reset(): Promise<any> { return this .scopedCache // List all the keys in the cache. .keys() .then(keys => Promise // Wait for them all to be removed. .all(keys.map(key => this.scopedCache.remove(key))) // Log it for debugging. .then(() => this.lifecycle(`reset removed ${keys.length} ngsw: caches`))); } /** * Start up the worker. * * this.init is set up as a Promise that resolves when the worker exits the STARTUP state. * In the background, it also kicks off a check for a new version of the manifest. * * In the usual update flow, this means that the worker will first transition to READY, * and then to UPDATE_PENDING when the updated manifest is set up and ready to be served. */ private startup() { this.init = this.initialize(); this.init.then(() => this.checkForUpdate()); } /** * Possibly switch to a pending manifest if it's safe to do so. * * Safety is determined by whether there are other application tabs open, since they may * be depending on the worker to serve lazily-loaded js from the previous version of the * app, or it may be using a shared IndexedDB across all the tabs that can't be updated * yet, etc. */ private maybeUpdate(clientId: any): Promise<any> { return this .scope .clients .matchAll() .then(clients => { // Currently, the only criteria is that this must be a fresh tab (no current // clients). if (clients.length !== 0) { return null; } return this.doUpdate(); }); } /** * Switch to the staged worker (if any). * * After updating, the worker will be in state READY, always. If a staged manifest * was present and validated, it will be set as active. * * If `expectVersion` is set but the staged manifest does not match the expected * version, the update is skipped and the result resolves to false. */ private doUpdate(expectVersion?: string): Promise<boolean> { return this .fetchManifestFromCache('staged') .then(manifest => { // If no staged manifest exists in the cache, just transition to READY now. if (!manifest) { this.transition(DriverState.READY); return false; } // If a particular version is expected if (!!expectVersion && manifest._hash !== expectVersion) { return false; } return this // Open the new manifest. This implicitly validates that the manifest was // downloaded correctly and is ready to serve, and can resolve with null if // this validation fails. .openManifest(manifest) .then(worker => this // Regardless of whether the new manifest validated correctly, clear the staged // manifest. This ensures that if the validation failed, the worker will try again. .clearStaged() // If the worker is present, set the manifest as active, ensuring it will be used // in the future. .then(() => worker ? this.setManifest(manifest, 'active') : null) .then(() => { if (worker) { // Set this.active to the new worker. const oldActive = this.active; this.active = worker as VersionWorkerImpl; // At this point, the old worker can clean up its caches as they're no longer // needed. this .cleanup(oldActive) .then(() => this.lifecycle(`cleaned up old version ${oldActive.manifest._hash}`)); // Notify update listeners that an update has occurred. this.updateListeners.forEach(id => { this.sendToStream(id, { type: 'activation', version: manifest._hash, }); }); this.lifecycle(`updated to manifest ${manifest._hash}`); } // Regardless of whether the manifest successfully validated, it is no longer // a pending update, so transition to READY. this.transition(DriverState.READY); return true; }) as Promise<boolean> ); }); } /** * Clear the currently active manifest (if any). */ private clearActive(): Promise<any> { // Fail if the worker is in a state which expects an active manifest to be present. if (this.state === DriverState.READY || this.state === DriverState.UPDATE_PENDING) { return Promise.reject("Cannot clear the active manifest when it's being used."); } return this.scopedCache.invalidate('active', this.manifestUrl); } /** * Clear the currently staged manifest (if any). */ private clearStaged(): Promise<any> { return this.scopedCache.invalidate('staged', this.manifestUrl); } /** * Check the network for a new version of the manifest, and stage it if possible. * * This will request a new copy of the manifest from the network and compare it with * both the active manifest and any staged manifest if present. * * If the manifest is newer than the active or the staged manifest, it will be loaded * and the setup process run for all installed plugins. If it passes that process, it * will be set as the staged manifest, and the worker state will be set to UPDATE_PENDING. * * checkForUpdate() returns a boolean indicating whether a staged update is pending, * regardless of whether this particular call caused the update to become staged. */ private checkForUpdate(): Promise<boolean> { // If the driver isn't in a good serving state, there is no reasonable course of action // if an update would be found, so don't check. if (this.state !== DriverState.READY && this.state !== DriverState.UPDATE_PENDING) { this.lifecycle(`skipping update check, in state ${DriverState[this.state]}`); return Promise.resolve(false); } // If the worker is in the UPDATE_PENDING state, then no need to check, there is an update. if (this.state === DriverState.UPDATE_PENDING) { return Promise.resolve(true); } return Promise // Fetch active and staged manifests and a fresh copy of the manifest from the network. // Technically, the staged manifest should be null, but it is checked here for thoroughness. .all([ this.fetchManifestFromCache('active'), this.fetchManifestFromCache('staged'), this.fetchManifestFromNetwork(), ]) .then((manifests: Manifest[]) => { const [active, staged, network] = manifests; // If the request for a manifest from the network was unsuccessful, there's no // way to tell if an update is available, so skip. if (!network) { // Even if the network request failed, there could still be a pending manifest. // This technically shouldn't happen since the worker should have been placed in // the UPDATE_PENDING state by initialize(), but this is here for safety. if (!!staged) { // If there is a staged manifest, transition to UPDATE_PENDING. this.pendingUpdateHash = staged._hash; this.transition(DriverState.UPDATE_PENDING); return true; } else { return false; } } // If the network manifest is currently the active manifest, no update is available. if (!!active && active._hash === network._hash) { return false; } // If the network manifest is already staged, just go to UPDATE_PENDING. Theoretically // this shouldn't happen since initialize() should have already transitioned to // UPDATE_PENDING, but as above, this is here for safety. if (!!staged && staged._hash === network._hash) { this.lifecycle(`network manifest ${network._hash} is already staged`); this.pendingUpdateHash = staged._hash; this.transition(DriverState.UPDATE_PENDING); return true; } // A Promise which may do extra work before the update. let start = Promise.resolve(); // If there is a staged manifest, then before setting up the update, remove it. if (!!staged) { this.lifecycle(`staged manifest ${staged._hash} is old, removing`); start = this.clearStaged(); } return start // Create a VersionWorker from the network manifest, setting up all registered plugins. // this.active is passed as if there is a currently active worker, the updated // VersionWorker will possibly update from it, saving bytes for files which have not // changed between manifest versions. This update process is plugin-specific. .then(() => this.setupManifest(network, this.active)) // Once the new VersionWorker has been set up properly, mark the manifest as staged. // This sets up the worker to update to it on a future fetch event, when maybeUpdate() // decides to update. .then(() => this.setManifest(network, 'staged')) .then(() => { // Finally, transition to UPDATE_PENDING to indicate updates should be checked. this.pendingUpdateHash = network._hash; this.transition(DriverState.UPDATE_PENDING); this.lifecycle(`staged update to ${network._hash}`); return true; }); }); } /** * Transitions the worker out of the STARTUP state, by either serving the active * manifest or installing from the network if one is not present. * * Initialization can fail, which will result in the worker ending up in a LAME * state where it effectively disables itself until the next startup. * * This function returns a Promise which, when resolved, guarantees the worker is * no longer in a STARTUP state. */ private initialize(): Promise<any> { // Fail if the worker is initialized twice. if (!!this.init) { throw new Error("double initialization!"); } // Initialization is only valid in the STARTUP state. if (this.state !== DriverState.STARTUP) { return Promise.reject(new Error("driver: initialize() called when not in STARTUP state")); } return Promise // Fetch both active and staged manifests. .all([ this.fetchManifestFromCache('active'), this.fetchManifestFromCache('staged'), ]) .then(manifests => { const [active, staged] = manifests; if (!active) { // If there's no active manifest, then a network installation is required. this.transition(DriverState.INSTALLING); // Installing from the network is asynchronous, but initialization doesn't block on // it. Therefore the Promise returned from doInstallFromNetwork() is ignored. this.doInstallFromNetwork(); return null; } return this // Turn the active manifest into a VersionWorker, which will implicitly validate that // all files are cached correctly. If this fails, openManifest() can resolve with a // null worker. .openManifest(active) .then(worker => { if (!worker) { // The active manifest is somehow invalid. Nothing to do but enter a LAME state // and remove it, and hope the next time the worker is initialized, a fresh copy // will be installed from the network without issues. this.transition(DriverState.LAME); return this.clearActive(); } this.lifecycle(`manifest ${active._hash} activated`); this.active = worker as VersionWorkerImpl; // If a staged manifest exist, go to UPDATE_PENDING instead of READY. if (!!staged) { if (staged._hash === active._hash) { this.lifecycle(`staged manifest ${staged._hash} is already active, cleaning it up`); this.transition(DriverState.READY); return this.clearStaged(); } else { this.lifecycle(`staged manifest ${staged._hash} present at initialization`); this.pendingUpdateHash = staged._hash; this.transition(DriverState.UPDATE_PENDING); return null; } } this.transition(DriverState.READY); }); }); } /** * Fetch and install a manifest from the network. * * If successful, the manifest will become active and the worker will finish in state * READY. If any errors are encountered, the worker will transition to a LAME state. */ private doInstallFromNetwork(): Promise<any> { return this // First get a new copy of the manifest from the network. .fetchManifestFromNetwork() .then(manifest => { if (!manifest) { // If it wasn't successful, there's no graceful way to recover, so go to a // LAME state. this.lifecycle('no network manifest found to install from'); this.transition(DriverState.LAME); return null; } return this // Set up a new VersionWorker using this manifest, which could fail if all of the // resources listed don't download correctly. .setupManifest(manifest, null) .then(worker => { if (!worker) { this.lifecycle('network manifest setup failed'); this.transition(DriverState.LAME); return null; } this // Setup was successful, and the VersionWorker is ready to serve traffic. Set the // new manifest as active. .setManifest(manifest, 'active') .then(() => { // Set this.active and transition to READY. this.active = worker as VersionWorkerImpl; this.lifecycle(`installed version ${manifest._hash} from network`); this.transition(DriverState.READY); }); }); }); } /** * Fetch a cached copy of the manifest. */ private fetchManifestFromCache(cache: string): Promise<Manifest> { return this .scopedCache .load(cache, this.manifestUrl) .then(resp => this.manifestFromResponse(resp)); } /** * Fetch a copy of the manifest from the network. * * Resolves with null on a failure. */ private fetchManifestFromNetwork(): Promise<Manifest> { return this .fetcher .refresh(this.manifestUrl) .then(resp => this.manifestFromResponse(resp)) .catch(() => null); } /** * Parse the given `Response` and return a `Manifest` object. */ private manifestFromResponse(resp: Response): Promise<Manifest> { if (!resp || resp.status !== 200) { return null; } return resp.text().then(body => parseManifest(body)); } /** * Store the given `Manifest` in the given cache. */ private setManifest(manifest: Manifest, cache: string): Promise<void> { return this.scopedCache.store(cache, this.manifestUrl, this.adapter.newResponse(manifest._json)); } /** * Construct a `VersionWorker` for the given manifest. * * This worker will have all of the plugins specified during the bootstrap process installed, * but not yet initialized (setup()). */ private workerFromManifest(manifest: Manifest): VersionWorkerImpl { const plugins: Plugin<any>[] = []; const worker = new VersionWorkerImpl(this, this.scope, manifest, this.adapter, new ScopedCache(this.scopedCache, `manifest:${manifest._hash}:`), this.clock, this.fetcher, plugins); plugins.push(...this.plugins.map(factory => factory(worker))); return worker; } /** * Instantiates a `VersionWorker` from a manifest and runs it through its setup process. * * Optionally, the worker can be directed to update from an existing `VersionWorker` * instead of performing a fresh setup. This can save time if resources have not changed * between the old and new manifests. */ private setupManifest(manifest: Manifest, existing: VersionWorker = null): Promise<VersionWorker> { const worker = this.workerFromManifest(manifest); return worker .setup(existing as VersionWorkerImpl) .then(() => worker); } /** * Instantiates a `VersionWorker` from a manifest that was previously set up according * by `setupManifest`. * * The worker will be validated (its caches checked against the manifest to assure all * resources listed are cached properly). If it passes validation, the returned Promise * will resolve with the worker instance, if not it resolves with `null`. */ private openManifest(manifest: Manifest): Promise<VersionWorker> { const worker = this.workerFromManifest(manifest); return worker // Run validation to make sure all resources have been previously set up properly. .validate() .then(valid => { if (!valid) { // The worker wasn't valid - something was missing from the caches. this.lifecycle(`cached version ${manifest._hash} not valid`); // Attempt to recover by cleaning up the worker. This should allow it to be // freshly installed the next time the `Driver` starts. return this .cleanup(worker) .then(() => null); } return worker; }); } /** * Run a `VersionWorker` through its cleanup process, resolving when it completes. */ private cleanup(worker: VersionWorkerImpl): Promise<any> { return worker .cleanup() .reduce<Promise<Response>>( (prev, curr) => prev.then(resp => curr()), Promise.resolve(null) ); } /** * Fetch the status of the `Driver`, including current state and lifecycle messages. */ private status(): Promise<any> { return Promise.resolve({ state: DriverState[this.state], lifecycleLog: this.lifecycleLog, }); } /** * Transition into a new state. * * `transition` logs the transition, and also handles resolving several promises useful * for testing the more asynchronous parts of the `Driver` which aren't exposed via the * more public API. */ private transition(state: DriverState): void { this.lifecycle(`transition from ${DriverState[this.state]} to ${DriverState[state]}`); this.state = state; // If the `DRIVER` entered the READY state, resolve the ready Promise. if (state === DriverState.READY && this.readyResolve !== null) { const resolve = this.readyResolve; this.readyResolve = null; resolve(); } // If the driver entered the UPDATE_PENDING state, resolve the update pending Promise, // and reset the ready Promise. if (state === DriverState.UPDATE_PENDING && this.updatePendingResolve !== null) { this.ready = new Promise(resolve => this.readyResolve = resolve) const resolve = this.updatePendingResolve; this.updatePendingResolve = null; resolve(); } // If the driver entered the UPDATE_PENDING state, notify all update subscribers // about the pending update. if (state === DriverState.UPDATE_PENDING && this.pendingUpdateHash !== null) { this.updateListeners.forEach(id => this.sendToStream(id, { type: 'pending', version: this.pendingUpdateHash, })); } else if (state !== DriverState.UPDATE_PENDING) { // Reset the pending update hash if not transitioning to UPDATE_PENDING. this.pendingUpdateHash = null; } } /** * Process a `postMessage` received by the worker. */ private handleMessage(message: Object, id: number): void { // If the `Driver` is not in a known good state, nothing to do but exit. if (this.state !== DriverState.READY && this.state !== DriverState.UPDATE_PENDING) { this.lifecycle(`can't handle message in state ${DriverState[this.state]}`) return; } // The message has a 'cmd' key which determines the action the `Driver` will take. // Some commands are handled directly by the `Driver`, the rest are passed on to the // active `VersionWorker` to be handled by a plugin. switch (message['cmd']) { // A ping is a request for the service worker to assert it is up and running by // completing the "Observable" stream. case 'ping': this.lifecycle(`responding to ping on ${id}`) this.closeStream(id); break; // An update message is a request for the service worker to keep the application // apprised of any pending update events, such as a new manifest becoming pending. case 'update': this.updateListeners.push(id); // Since this is a new subscriber, check if there's a pending update now and // deliver an initial event if so. if (this.state === DriverState.UPDATE_PENDING && this.pendingUpdateHash !== null) { this.sendToStream(id, { type: 'pending', version: this.pendingUpdateHash, }); } break; // Check for a pending update, fetching a new manifest from the network if necessary, // and return the result as a boolean value beore completing. case 'checkUpdate': this.checkForUpdate().then(value => { this.sendToStream(id, value); this.closeStream(id); }); break; case 'activateUpdate': this.doUpdate(message['version'] || undefined).then(success => { this.sendToStream(id, success); this.closeStream(id); }); break; // 'cancel' is a special command that the other side has unsubscribed from the stream. // Plugins may choose to take action as a result. case 'cancel': // Attempt to look up the stream the client is requesting to cancel. const idToCancel = message['id']; if (!this.streams.hasOwnProperty(id)) { // Not found - nothing to do but exit. return; } // Notify the active `VersionWorker` that the client has unsubscribed. this.active.messageClosed(id); // This listener may have been a subscriber to 'update' events. this.maybeRemoveUpdateListener(id); // Finally, remove the stream. delete this.streams[id]; break; // A request to stream the service worker debugging log. Only one of these is valid // at a time. case 'log': LOGGER.messages = (message: string) => { this.sendToStream(id, message); }; break; // If the command is unknown, delegate to the active `VersionWorker` to handle it. default: this.active.message(message, id); } } /** * Remove the given stream id from the set of subscribers to update events, if present. */ private maybeRemoveUpdateListener(id: number): void { const idx = this.updateListeners.indexOf(id); if (idx !== -1) { this.updateListeners.splice(idx, 1); } } /** * Post a message to the stream with the given id. */ sendToStream(id: number, message: Object): void { if (!this.streams.hasOwnProperty(id)) { return; } this.streams[id].postMessage(message); } /** * Complete the stream with the given id. * * Per the protocol between the service worker and client tabs, a completion is modeled as * a null message. */ closeStream(id: number): void { if (!this.streams.hasOwnProperty(id)) { return; } this.streams[id].postMessage(null); delete this.streams[id]; } } ```
/content/code_sandbox/service-worker/worker/src/worker/driver.ts
xml
2016-01-25T17:36:44
2024-08-15T10:53:22
mobile-toolkit
angular/mobile-toolkit
1,336
7,855
```xml import { toTypedRxJsonSchema, type ExtractDocumentTypeFromTypedRxJsonSchema, type RxCollection, type RxDatabase, type RxJsonSchema } from 'rxdb'; export const HeroSchemaLiteral = { title: 'hero', description: 'an individual hero', version: 0, type: 'object', indexes: [ 'createdAt', 'updatedAt' ], primaryKey: 'name', properties: { name: { type: 'string', }, color: { type: 'string' }, createdAt: { type: 'number', }, updatedAt: { type: 'number', }, }, required: ['name', 'color','createdAt','updatedAt'], } as const; export const SchemaTyped = toTypedRxJsonSchema(HeroSchemaLiteral); // aggregate the document type from the schema export type HeroDocType = ExtractDocumentTypeFromTypedRxJsonSchema<typeof SchemaTyped>; // create the typed RxJsonSchema from the literal typed object. export const HeroSchema: RxJsonSchema<HeroDocType> = SchemaTyped; type HeroesCollection = RxCollection<HeroDocType>; export type MyDatabaseCollections = { heroes: HeroesCollection; }; export type MyDatabase = RxDatabase<MyDatabaseCollections>; ```
/content/code_sandbox/examples/vite-vanilla-ts/src/schema.ts
xml
2016-12-02T19:34:42
2024-08-16T15:47:20
rxdb
pubkey/rxdb
21,054
274
```xml import { Observable, Subject } from 'rxjs'; export class StateObservable<S> extends Observable<S> { value: S; private __notifier = new Subject<S>(); constructor(input$: Observable<S>, initialState: S) { super((subscriber) => { const subscription = this.__notifier.subscribe(subscriber); if (subscription && !subscription.closed) { subscriber.next(this.value); } return subscription; }); this.value = initialState; input$.subscribe((value) => { // We only want to update state$ if it has actually changed since // redux requires reducers use immutability patterns. // This is basically what distinctUntilChanged() does but it's so simple // we don't need to pull that code in if (value !== this.value) { this.value = value; this.__notifier.next(value); } }); } } ```
/content/code_sandbox/src/StateObservable.ts
xml
2016-04-20T21:58:23
2024-08-12T22:17:00
redux-observable
redux-observable/redux-observable
7,852
193
```xml <?xml version="1.0" encoding="utf-8" ?> <services version="1.0"> <admin version="2.0"> <adminserver hostalias="ADMIN0" /> <logserver hostalias="ADMIN0" /> <slobroks> <slobrok hostalias="SLOBROK0" /> </slobroks> <configservers> <configserver hostalias="ADMIN0" /> <configserver hostalias="SLOBROK0" /> </configservers> </admin> <routing version="1.0"> <routingtable protocol="document"> <route name="cats" hops="storage"/> </routingtable> </routing> <container version="1.0"> <nodes> <node hostalias="QRS0"/> </nodes> <document-api/> <handler id="com.yahoo.foo.bar.FooHandler:1" /> </container> <container version="1.0" id="migration"> <http> <server port="8000" id="migration-server" /> </http> <document-processing> <chain id="baz"> <documentprocessor id="com.yahoo.foo.bar.baz.BazDocproc" /> </chain> </document-processing> <nodes> <node hostalias="DOCPROC0" /> </nodes> </container> <content version="1.0" id="mailbox"> <redundancy>1</redundancy> <documents> <document type="mailbox" mode="streaming"/> </documents> <nodes><node hostalias="VDS0" distribution-key="0"/></nodes> </content> <content version="1.0" id="message"> <redundancy>1</redundancy> <documents> <document type="message" mode="streaming"/> </documents> <nodes><node hostalias="VDS0" distribution-key="0"/></nodes> </content> <content version="1.0" id="mail"> <redundancy>1</redundancy> <documents> <document type="mail" mode="streaming"/> </documents> <nodes><node hostalias="VDS0" distribution-key="0"/></nodes> </content> </services> ```
/content/code_sandbox/config-model/src/test/cfg/application/app_nohosts/services.xml
xml
2016-06-03T20:54:20
2024-08-16T15:32:01
vespa
vespa-engine/vespa
5,524
522
```xml <vector android:height="24dp" android:tint="@android:color/black" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp" xmlns:android="path_to_url"> <path android:fillColor="@android:color/black" android:pathData="M17.65,6.35C16.2,4.9 14.21,4 12,4c-4.42,0 -7.99,3.58 -7.99,8s3.57,8 7.99,8c3.73,0 6.84,-2.55 7.73,-6h-2.08c-0.82,2.33 -3.04,4 -5.65,4 -3.31,0 -6,-2.69 -6,-6s2.69,-6 6,-6c1.66,0 3.14,0.69 4.22,1.78L13,11h7V4l-2.35,2.35z"/> </vector> ```
/content/code_sandbox/app/src/main/res/drawable/ic_refresh_24dp.xml
xml
2016-02-01T23:48:36
2024-08-15T03:35:42
TagMo
HiddenRamblings/TagMo
2,976
241
```xml import React from 'react' import styled from 'styled-components' interface ApiPreviewProps { responseStatus: number | null chartUrl: string } export const ApiPreview = ({ responseStatus, chartUrl }: ApiPreviewProps) => { if (responseStatus === 201 && chartUrl) { return ( <Link href={chartUrl} target="_blank" rel="noopener noreferrer"> <Image src={chartUrl} alt="api result" /> </Link> ) } return ( <EmptyContainer> Click the generate button in order to generate the chart. <br /> You can customize settings by using dedicated controls. </EmptyContainer> ) } const Link = styled.a` position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; ` const Image = styled.img` max-width: 100%; max-height: 100%; ` const EmptyContainer = styled.div` font-size: 14px; line-height: 1.6em; color: ${({ theme }) => theme.colors.textLight}; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; ` ```
/content/code_sandbox/website/src/components/components/api-client/ApiPreview.tsx
xml
2016-04-16T03:27:56
2024-08-16T03:38:37
nivo
plouc/nivo
13,010
283
```xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="path_to_url" package="com.hussein.mycurrentlocation"> <!-- The ACCESS_COARSE/FINE_LOCATION permissions are not required to use Google Maps Android API v2, but you must specify either coarse or fine location permissions for the 'MyLocation' functionality. --> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <!-- The API key for Google Maps-based APIs is defined as a string resource. (See the file "res/values/google_maps_api.xml"). Note that the API key is linked to the encryption key used to sign the APK. You need a different API key for each encryption key, including the release key that is used to sign the APK for publishing. You can define the keys for the debug and release targets in src/debug/ and src/release/. --> <meta-data android:name="com.google.android.geo.API_KEY" android:value="@string/google_maps_key" /> <activity android:name=".MapsActivity" android:label="@string/title_activity_maps"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> ```
/content/code_sandbox/Pockemon/MyCurrentLocationApp/app/src/main/AndroidManifest.xml
xml
2016-09-26T16:36:28
2024-08-13T08:59:01
AndroidTutorialForBeginners
hussien89aa/AndroidTutorialForBeginners
4,360
347
```xml import fs from 'fs'; import { EOL } from 'os'; import path from 'path'; import { Builder, Parser } from 'xml2js'; export type XMLValue = boolean | number | string | null | XMLArray | XMLObject; export interface XMLArray extends Array<XMLValue> {} export interface XMLObject { [key: string]: XMLValue | undefined; } export async function writeXMLAsync(options: { path: string; xml: any }): Promise<void> { const xml = format(options.xml); await fs.promises.mkdir(path.dirname(options.path), { recursive: true }); await fs.promises.writeFile(options.path, xml); } export async function readXMLAsync(options: { path: string; fallback?: string | null; }): Promise<XMLObject> { let contents: string = ''; try { contents = await fs.promises.readFile(options.path, { encoding: 'utf8', flag: 'r' }); } catch { // catch and use fallback } const parser = new Parser(); const manifest = await parser.parseStringPromise(contents || options.fallback || ''); return _processAndroidXML(manifest); } export function _processAndroidXML(manifest: any): XMLObject { // For strings.xml if (Array.isArray(manifest?.resources?.string)) { for (const string of manifest?.resources?.string) { if (string.$.translatable === 'false' || string.$.translatable === false) { continue; } string._ = unescapeAndroidString(string._); } } return manifest; } export async function parseXMLAsync(contents: string): Promise<XMLObject> { const xml = await new Parser().parseStringPromise(contents); return xml; } const stringTimesN = (n: number, char: string) => Array(n + 1).join(char); export function format(manifest: any, { indentLevel = 2, newline = EOL } = {}): string { let xmlInput: string; if (typeof manifest === 'string') { xmlInput = manifest; } else if (manifest.toString) { const builder = new Builder({ headless: true, }); // For strings.xml if (Array.isArray(manifest?.resources?.string)) { for (const string of manifest?.resources?.string) { if (string.$.translatable === 'false' || string.$.translatable === false) { continue; } string._ = escapeAndroidString(string._); } } xmlInput = builder.buildObject(manifest); return xmlInput; } else { throw new Error(`Invalid XML value passed in: ${manifest}`); } const indentString = stringTimesN(indentLevel, ' '); let formatted = ''; const regex = /(>)(<)(\/*)/g; const xml = xmlInput.replace(regex, `$1${newline}$2$3`); let pad = 0; xml .split(/\r?\n/) .map((line: string) => line.trim()) .forEach((line: string) => { let indent = 0; if (line.match(/.+<\/\w[^>]*>$/)) { indent = 0; } else if (line.match(/^<\/\w/)) { if (pad !== 0) { pad -= 1; } } else if (line.match(/^<\w([^>]*[^/])?>.*$/)) { indent = 1; } else { indent = 0; } const padding = stringTimesN(pad, indentString); formatted += padding + line + newline; pad += indent; }); return formatted.trim(); } /** * Escapes Android string literals, specifically characters `"`, `'`, `\`, `\n`, `\r`, `\t` * * @param value unescaped Android XML string literal. */ export function escapeAndroidString(value: string): string { value = value.replace(/[\n\r\t'"@]/g, (m) => { switch (m) { case '"': case "'": case '@': return '\\' + m; case '\n': return '\\n'; case '\r': return '\\r'; case '\t': return '\\t'; default: throw new Error(`Cannot escape unhandled XML character: ${m}`); } }); if (value.match(/(^\s|\s$)/)) { value = '"' + value + '"'; } return value; } export function unescapeAndroidString(value: string): string { return value.replace(/\\(.)/g, '$1'); } ```
/content/code_sandbox/packages/@expo/config-plugins/src/utils/XML.ts
xml
2016-08-15T17:14:25
2024-08-16T19:54:44
expo
expo/expo
32,004
999
```xml /// /// /// /// path_to_url /// /// Unless required by applicable law or agreed to in writing, software /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. /// import { ValidatorFn } from '@angular/forms'; import { isNotEmptyStr, isNumber } from '@core/utils'; import { VersionCreateConfig } from '@shared/models/vc.models'; import { HasUUID } from '@shared/models/id/has-uuid'; export const smtpPortPattern: RegExp = /^([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$/; export interface AdminSettings<T> { key: string; jsonValue: T; } export enum SmtpProtocol { SMTP = 'smtp', SMTPS = 'smtps' } export interface MailServerSettings { showChangePassword?: boolean; mailFrom: string; smtpProtocol: SmtpProtocol; smtpHost: string; smtpPort: number; timeout: number; enableTls: boolean; tlsVersion: string; username: string; changePassword?: boolean; password?: string; enableProxy: boolean; proxyHost: string; proxyPort: number; proxyUser: string; proxyPassword: string; enableOauth2: boolean; providerId?: string; clientId?: string; clientSecret?: string; providerTenantId?: string; authUri?: string; tokenUri?: string; scope?: Array<string>; redirectUri?: string; tokenGenerated?: boolean; } export enum MailServerOauth2Provider { OFFICE_365 = 'OFFICE_365', CUSTOM = 'CUSTOM' } export interface MailConfigTemplate { id: HasUUID; createdTime: number; name: string; providerId: string; helpLink: string; scope: Array<string>; accessTokenUri: string; authorizationUri: string; enableTls: boolean; tlsVersion: string; smtpProtocol: SmtpProtocol; smtpHost: string; smtpPort: number; timeout: number; additionalInfo: any; } export interface GeneralSettings { baseUrl: string; } export type DeviceConnectivityProtocol = 'http' | 'https' | 'mqtt' | 'mqtts' | 'coap' | 'coaps'; export interface DeviceConnectivityInfo { enabled: boolean; host: string; port: number; } export type DeviceConnectivitySettings = Record<DeviceConnectivityProtocol, DeviceConnectivityInfo>; export interface UserPasswordPolicy { minimumLength: number; maximumLength: number; minimumUppercaseLetters: number; minimumLowercaseLetters: number; minimumDigits: number; minimumSpecialCharacters: number; passwordExpirationPeriodDays: number; allowWhitespaces: boolean; forceUserToResetPasswordIfNotValid: boolean; } export interface SecuritySettings { passwordPolicy: UserPasswordPolicy; } export interface JwtSettings { tokenIssuer: string; tokenSigningKey: string; tokenExpirationTime: number; refreshTokenExpTime: number; } export interface UpdateMessage { updateAvailable: boolean; currentVersion: string; latestVersion: string; upgradeInstructionsUrl: string; currentVersionReleaseNotesUrl: string; latestVersionReleaseNotesUrl: string; } export const phoneNumberPattern = /^\+[1-9]\d{1,14}$/; export const phoneNumberPatternTwilio = /^\+[1-9]\d{1,14}$|^(MG|PN).*$/; export enum SmsProviderType { AWS_SNS = 'AWS_SNS', TWILIO = 'TWILIO', SMPP = 'SMPP' } export const smsProviderTypeTranslationMap = new Map<SmsProviderType, string>( [ [SmsProviderType.AWS_SNS, 'admin.sms-provider-type-aws-sns'], [SmsProviderType.TWILIO, 'admin.sms-provider-type-twilio'], [SmsProviderType.SMPP, 'admin.sms-provider-type-smpp'] ] ); export interface AwsSnsSmsProviderConfiguration { accessKeyId?: string; secretAccessKey?: string; region?: string; } export interface TwilioSmsProviderConfiguration { accountSid?: string; accountToken?: string; numberFrom?: string; } export interface SmppSmsProviderConfiguration { protocolVersion: number; host: string; port: number; systemId: string; password: string; systemType?: string; bindType?: string; serviceType?: string; sourceAddress?: string; sourceTon?: number; sourceNpi?: number; destinationTon?: number; destinationNpi?: number; addressRange?: string; codingScheme?: number; } export const smppVersions = [ {value: 3.3}, {value: 3.4} ]; export enum BindTypes { TX = 'TX', RX = 'RX', TRX = 'TRX' } export const bindTypesTranslationMap = new Map<BindTypes, string>([ [BindTypes.TX, 'admin.smpp-provider.bind-type-tx'], [BindTypes.RX, 'admin.smpp-provider.bind-type-rx'], [BindTypes.TRX, 'admin.smpp-provider.bind-type-trx'] ]); export enum TypeOfNumber { Unknown = 'Unknown', International = 'International', National = 'National', NetworkSpecific = 'NetworkSpecific', SubscriberNumber = 'SubscriberNumber', Alphanumeric = 'Alphanumeric', Abbreviated = 'Abbreviated' } export interface TypeDescriptor { name: string; value: number; } export const typeOfNumberMap = new Map<TypeOfNumber, TypeDescriptor>([ [TypeOfNumber.Unknown, { name: 'admin.smpp-provider.ton-unknown', value: 0 }], [TypeOfNumber.International, { name: 'admin.smpp-provider.ton-international', value: 1 }], [TypeOfNumber.National, { name: 'admin.smpp-provider.ton-national', value: 2 }], [TypeOfNumber.NetworkSpecific, { name: 'admin.smpp-provider.ton-network-specific', value: 3 }], [TypeOfNumber.SubscriberNumber, { name: 'admin.smpp-provider.ton-subscriber-number', value: 4 }], [TypeOfNumber.Alphanumeric, { name: 'admin.smpp-provider.ton-alphanumeric', value: 5 }], [TypeOfNumber.Abbreviated, { name: 'admin.smpp-provider.ton-abbreviated', value: 6 }], ]); export enum NumberingPlanIdentification { Unknown = 'Unknown', ISDN = 'ISDN', DataNumberingPlan = 'DataNumberingPlan', TelexNumberingPlan = 'TelexNumberingPlan', LandMobile = 'LandMobile', NationalNumberingPlan = 'NationalNumberingPlan', PrivateNumberingPlan = 'PrivateNumberingPlan', ERMESNumberingPlan = 'ERMESNumberingPlan', Internet = 'Internet', WAPClientId = 'WAPClientId', } export const numberingPlanIdentificationMap = new Map<NumberingPlanIdentification, TypeDescriptor>([ [NumberingPlanIdentification.Unknown, { name: 'admin.smpp-provider.npi-unknown', value: 0 }], [NumberingPlanIdentification.ISDN, { name: 'admin.smpp-provider.npi-isdn', value: 1 }], [NumberingPlanIdentification.DataNumberingPlan, { name: 'admin.smpp-provider.npi-data-numbering-plan', value: 3 }], [NumberingPlanIdentification.TelexNumberingPlan, { name: 'admin.smpp-provider.npi-telex-numbering-plan', value: 4 }], [NumberingPlanIdentification.LandMobile, { name: 'admin.smpp-provider.npi-land-mobile', value: 5 }], [NumberingPlanIdentification.NationalNumberingPlan, { name: 'admin.smpp-provider.npi-national-numbering-plan', value: 8 }], [NumberingPlanIdentification.PrivateNumberingPlan, { name: 'admin.smpp-provider.npi-private-numbering-plan', value: 9 }], [NumberingPlanIdentification.ERMESNumberingPlan, { name: 'admin.smpp-provider.npi-ermes-numbering-plan', value: 10 }], [NumberingPlanIdentification.Internet, { name: 'admin.smpp-provider.npi-internet', value: 13 }], [NumberingPlanIdentification.WAPClientId, { name: 'admin.smpp-provider.npi-wap-client-id', value: 18 }], ]); export enum CodingSchemes { SMSC = 'SMSC', IA5 = 'IA5', OctetUnspecified2 = 'OctetUnspecified2', Latin1 = 'Latin1', OctetUnspecified4 = 'OctetUnspecified4', JIS = 'JIS', Cyrillic = 'Cyrillic', LatinHebrew = 'LatinHebrew', UCS2UTF16 = 'UCS2UTF16', PictogramEncoding = 'PictogramEncoding', MusicCodes = 'MusicCodes', ExtendedKanjiJIS = 'ExtendedKanjiJIS', KoreanGraphicCharacterSet = 'KoreanGraphicCharacterSet', } export const codingSchemesMap = new Map<CodingSchemes, TypeDescriptor>([ [CodingSchemes.SMSC, { name: 'admin.smpp-provider.scheme-smsc', value: 0 }], [CodingSchemes.IA5, { name: 'admin.smpp-provider.scheme-ia5', value: 1 }], [CodingSchemes.OctetUnspecified2, { name: 'admin.smpp-provider.scheme-octet-unspecified-2', value: 2 }], [CodingSchemes.Latin1, { name: 'admin.smpp-provider.scheme-latin-1', value: 3 }], [CodingSchemes.OctetUnspecified4, { name: 'admin.smpp-provider.scheme-octet-unspecified-4', value: 4 }], [CodingSchemes.JIS, { name: 'admin.smpp-provider.scheme-jis', value: 5 }], [CodingSchemes.Cyrillic, { name: 'admin.smpp-provider.scheme-cyrillic', value: 6 }], [CodingSchemes.LatinHebrew, { name: 'admin.smpp-provider.scheme-latin-hebrew', value: 7 }], [CodingSchemes.UCS2UTF16, { name: 'admin.smpp-provider.scheme-ucs-utf', value: 8 }], [CodingSchemes.PictogramEncoding, { name: 'admin.smpp-provider.scheme-pictogram-encoding', value: 9 }], [CodingSchemes.MusicCodes, { name: 'admin.smpp-provider.scheme-music-codes', value: 10 }], [CodingSchemes.ExtendedKanjiJIS, { name: 'admin.smpp-provider.scheme-extended-kanji-jis', value: 13 }], [CodingSchemes.KoreanGraphicCharacterSet, { name: 'admin.smpp-provider.scheme-korean-graphic-character-set', value: 14 }], ]); export type SmsProviderConfigurations = Partial<SmppSmsProviderConfiguration> & AwsSnsSmsProviderConfiguration & TwilioSmsProviderConfiguration; export interface SmsProviderConfiguration extends SmsProviderConfigurations { type: SmsProviderType; } export function smsProviderConfigurationValidator(required: boolean): ValidatorFn { return control => { const configuration: SmsProviderConfiguration = control.value; let errors = null; if (required) { let valid = false; if (configuration && configuration.type) { switch (configuration.type) { case SmsProviderType.AWS_SNS: const awsSnsConfiguration: AwsSnsSmsProviderConfiguration = configuration; valid = isNotEmptyStr(awsSnsConfiguration.accessKeyId) && isNotEmptyStr(awsSnsConfiguration.secretAccessKey) && isNotEmptyStr(awsSnsConfiguration.region); break; case SmsProviderType.TWILIO: const twilioConfiguration: TwilioSmsProviderConfiguration = configuration; valid = isNotEmptyStr(twilioConfiguration.numberFrom) && isNotEmptyStr(twilioConfiguration.accountSid) && isNotEmptyStr(twilioConfiguration.accountToken); break; case SmsProviderType.SMPP: const smppConfiguration = configuration as SmppSmsProviderConfiguration; valid = isNotEmptyStr(smppConfiguration.host) && isNumber(smppConfiguration.port) && isNotEmptyStr(smppConfiguration.systemId) && isNotEmptyStr(smppConfiguration.password); break; } } if (!valid) { errors = { invalid: true }; } } return errors; }; } export interface TestSmsRequest { providerConfiguration: SmsProviderConfiguration; numberTo: string; message: string; } export function createSmsProviderConfiguration(type: SmsProviderType): SmsProviderConfiguration { let smsProviderConfiguration: SmsProviderConfiguration; if (type) { switch (type) { case SmsProviderType.AWS_SNS: const awsSnsSmsProviderConfiguration: AwsSnsSmsProviderConfiguration = { accessKeyId: '', secretAccessKey: '', region: 'us-east-1' }; smsProviderConfiguration = {...awsSnsSmsProviderConfiguration, type: SmsProviderType.AWS_SNS}; break; case SmsProviderType.TWILIO: const twilioSmsProviderConfiguration: TwilioSmsProviderConfiguration = { numberFrom: '', accountSid: '', accountToken: '' }; smsProviderConfiguration = {...twilioSmsProviderConfiguration, type: SmsProviderType.TWILIO}; break; case SmsProviderType.SMPP: const smppSmsProviderConfiguration: SmppSmsProviderConfiguration = { protocolVersion: 3.3, host: '', port: null, systemId: '', password: '', systemType: '', bindType: 'TX', serviceType: '', sourceAddress: '', sourceTon: 5, sourceNpi: 0, destinationTon: 5, destinationNpi: 0, addressRange: '', codingScheme: 0 }; smsProviderConfiguration = {...smppSmsProviderConfiguration, type: SmsProviderType.SMPP}; break; } } return smsProviderConfiguration; } export enum RepositoryAuthMethod { USERNAME_PASSWORD = 'USERNAME_PASSWORD', PRIVATE_KEY = 'PRIVATE_KEY' } export const repositoryAuthMethodTranslationMap = new Map<RepositoryAuthMethod, string>([ [RepositoryAuthMethod.USERNAME_PASSWORD, 'admin.auth-method-username-password'], [RepositoryAuthMethod.PRIVATE_KEY, 'admin.auth-method-private-key'] ]); export interface RepositorySettings { repositoryUri: string; defaultBranch: string; showMergeCommits: boolean; authMethod: RepositoryAuthMethod; username: string; password: string; privateKeyFileName: string; privateKey: string; privateKeyPassword: string; } export interface RepositorySettingsInfo { configured: boolean; readOnly: boolean; } export interface AutoVersionCreateConfig extends VersionCreateConfig { branch: string; } export type AutoCommitSettings = {[entityType: string]: AutoVersionCreateConfig}; export interface FeaturesInfo { emailEnabled: boolean; smsEnabled: boolean; notificationEnabled: boolean; oauthEnabled: boolean; twoFaEnabled: boolean; } ```
/content/code_sandbox/ui-ngx/src/app/shared/models/settings.models.ts
xml
2016-12-01T09:33:30
2024-08-16T19:58:25
thingsboard
thingsboard/thingsboard
16,820
3,507
```xml export function mapValues<T, U = T>( object: Record<string, T>, callback: (value: T) => U ): Record<string, U> { const result: Record<string, U> = Object.create(null); for (const [key, value] of Object.entries(object)) { result[key] = callback(value); } return result; } ```
/content/code_sandbox/packages/apollo-graphql/src/utilities/mapValues.ts
xml
2016-08-12T15:28:09
2024-08-03T08:25:34
apollo-tooling
apollographql/apollo-tooling
3,040
81
```xml // // ViewController.m // SmartiOSEchoCancellation // // Created by daniulive on 2019/1/22. // #import "ViewController.h" #import "SmartPublisherSDK.h" #import "SmartPlayerSDK.h" @interface ViewController ()<SmartPublisherDelegate,SmartPlayerDelegate> { CGFloat screen_width_; CGFloat screen_height_; UIButton *btn_publisher_controller_; UIButton *btn_switch_camera_; UIButton *btn_publisher_mute_; UIButton *btn_player_controller_; UIButton *btn_player_mute_; SmartPlayerSDK *smart_player_sdk; SmartPublisherSDK *smart_publisher_sdk; Boolean is_pushing_rtmp_; Boolean is_playing_; NSString* rtmp_push_url_; NSString* playback_url_; Boolean is_pusher_mute_; Boolean is_player_mute_; } @property (nonatomic, strong) UIView *publishView; @property (nonatomic, strong) UIView *playView; //event @property (strong, nonatomic) UILabel *textPublisherEventLabel; //event @property (strong, nonatomic) UILabel *textPlayerEventLabel; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. // screen_width_ = CGRectGetWidth([UIScreen mainScreen].bounds); screen_height_ = CGRectGetHeight([UIScreen mainScreen].bounds); is_pushing_rtmp_ = NO; is_playing_ = NO; //RTMPurl NSInteger randNumber = arc4random()%(1000000); NSString *strNumber = [NSString stringWithFormat:@"%ld", (long)randNumber]; NSString *baseURL = @"rtmp://player.daniulive.com:1935/hls/stream"; rtmp_push_url_ = [ baseURL stringByAppendingString:strNumber]; playback_url_ = @"rtmp://202.69.69.180:443/webcast/bshdlive-pc"; is_pusher_mute_ = NO; is_player_mute_ = NO; btn_publisher_controller_ = [UIButton buttonWithType:(UIButtonTypeCustom)]; btn_publisher_controller_.frame = CGRectMake(0, 100, 100, 30); btn_publisher_controller_.backgroundColor = [UIColor redColor]; [self.view addSubview:btn_publisher_controller_]; [btn_publisher_controller_ setTitle:@"" forState:(UIControlStateNormal)]; [btn_publisher_controller_ addTarget:self action:@selector(RtmpPusherController) forControlEvents:(UIControlEventTouchUpInside)]; btn_switch_camera_ = [UIButton buttonWithType:(UIButtonTypeCustom)]; btn_switch_camera_.frame = CGRectMake(0, 160, 100, 30); btn_switch_camera_.backgroundColor = [UIColor blueColor]; [self.view addSubview:btn_switch_camera_]; [btn_switch_camera_ setTitle:@"" forState:(UIControlStateNormal)]; [btn_switch_camera_ addTarget:self action:@selector(SwitchCamera:) forControlEvents:(UIControlEventTouchUpInside)]; btn_publisher_mute_ = [UIButton buttonWithType:UIButtonTypeCustom]; btn_publisher_mute_.frame = CGRectMake(0, 220, 100, 30); btn_publisher_mute_.backgroundColor = [UIColor blueColor]; [self.view addSubview:btn_publisher_mute_]; [btn_publisher_mute_ setTitle:@"" forState:(UIControlStateNormal)]; [btn_publisher_mute_ addTarget:self action:@selector(PushererMute:) forControlEvents:(UIControlEventTouchUpInside)]; btn_player_controller_ = [UIButton buttonWithType:UIButtonTypeCustom]; btn_player_controller_.frame = CGRectMake(0, screen_height_/2, 100, 30); btn_player_controller_.backgroundColor = [UIColor redColor]; [self.view addSubview:btn_player_controller_]; [btn_player_controller_ setTitle:@"" forState:(UIControlStateNormal)]; [btn_player_controller_ addTarget:self action:@selector(PlayerController) forControlEvents:(UIControlEventTouchUpInside)]; btn_player_mute_ = [UIButton buttonWithType:UIButtonTypeCustom]; btn_player_mute_.frame = CGRectMake(0, screen_height_/2 + 60, 100, 30); btn_player_mute_.backgroundColor = [UIColor blueColor]; [self.view addSubview:btn_player_mute_]; [btn_player_mute_ setTitle:@"" forState:(UIControlStateNormal)]; [btn_player_mute_ addTarget:self action:@selector(PlayerMute:) forControlEvents:(UIControlEventTouchUpInside)]; // Event _textPublisherEventLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, screen_height_/2 - 50, self.view.frame.size.width, 50)]; // UILabel _textPublisherEventLabel.backgroundColor = [UIColor clearColor]; // UILabel _textPublisherEventLabel.textColor = [UIColor colorWithRed:1.0 green:0.0 blue:1.0 alpha:1.0]; _textPublisherEventLabel.adjustsFontSizeToFitWidth = YES; NSString* pub_tag = @"URL:"; _textPublisherEventLabel.text = [pub_tag stringByAppendingFormat:@"%@", rtmp_push_url_]; [self.view addSubview:_textPublisherEventLabel]; // Event _textPlayerEventLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, screen_height_ - 50, self.view.frame.size.width, 50)]; // UILabel _textPlayerEventLabel.backgroundColor = [UIColor clearColor]; // UILabel _textPlayerEventLabel.textColor = [UIColor colorWithRed:1.0 green:0.0 blue:1.0 alpha:1.0]; _textPlayerEventLabel.adjustsFontSizeToFitWidth = YES; NSString* play_tag = @"URL:"; _textPlayerEventLabel.text = [play_tag stringByAppendingFormat:@"%@", playback_url_]; [self.view addSubview:_textPlayerEventLabel]; } - (void)RtmpPusherController{ if(is_pushing_rtmp_) { [self StopPublisher]; } else { [self StartPublisher]; } } - (void)SwitchCamera:(UIButton *)button { NSLog(@"Run into SwitchCamera.."); button.selected = !button.selected; if(smart_publisher_sdk) { [smart_publisher_sdk SmartPublisherSwitchCamera]; } } - (void)PushererMute:(UIButton *)button { NSLog(@"Run into PushererMute.."); if ( smart_publisher_sdk != nil ) { is_pusher_mute_ = !is_pusher_mute_; if ( is_pusher_mute_ ) { [btn_publisher_mute_ setTitle:@"" forState:UIControlStateNormal]; } else { [btn_publisher_mute_ setTitle:@"" forState:UIControlStateNormal]; } [smart_publisher_sdk SmartPublisherSetMute:is_pusher_mute_]; } } -(void)PlayerController{ if(is_playing_) { [self StopPlayer]; } else { [self StartPlayer]; } } - (void)PlayerMute:(UIButton *)button { NSLog(@"Run into PlayerMute.."); if ( smart_player_sdk != nil ) { is_player_mute_ = !is_player_mute_; if ( is_player_mute_ ) { [btn_player_mute_ setTitle:@"" forState:UIControlStateNormal]; } else { [btn_player_mute_ setTitle:@"" forState:UIControlStateNormal]; } [smart_player_sdk SmartPlayerSetMute:is_player_mute_]; } } - (void)StartPublisher{ smart_publisher_sdk = [[SmartPublisherSDK alloc]init]; if (smart_publisher_sdk == nil) { NSLog(@"publisher"); return; } if (smart_publisher_sdk.delegate == nil) { smart_publisher_sdk.delegate = self; } if([smart_publisher_sdk SmartPublisherInit:1 video_opt:1] != 0) { smart_publisher_sdk = nil; NSLog(@"publisher"); return; } _publishView = [[UIView alloc]initWithFrame:CGRectMake(screen_width_ - 300, 50, 225, 300)]; _publishView.backgroundColor = [UIColor blackColor]; [self.view addSubview:_publishView]; if ([smart_publisher_sdk SmartPublisherSetVideoPreview:_publishView] != 0) { [smart_publisher_sdk SmartPublisherUnInit]; // smart_publisher_sdk = nil; return; } // /* if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { if([smart_publisher_sdk SmartPublisherSetPublishOrientation:2]!=0) { NSLog(@""); } }else { if([smart_publisher_sdk SmartPublisherSetPublishOrientation:1]!=0) { NSLog(@""); } } */ Boolean is_enable_echo_cancellation = YES; [smart_publisher_sdk SmartPublisherSetEchoCancellation:is_enable_echo_cancellation]; DNVideoStreamingQuality video_stream_quality = DN_VIDEO_QUALITY_MEDIUM; if ([smart_publisher_sdk SmartPublisherStartCapture:video_stream_quality]!=0) { [smart_publisher_sdk SmartPublisherUnInit]; smart_publisher_sdk = nil; return; } NSInteger video_encoder_type = 1; //1: H.264, 2: H.265 Boolean is_video_hardware_encoder = YES; [smart_publisher_sdk SmartPublisherSetVideoEncoderType:video_encoder_type isHwEncoder:is_video_hardware_encoder]; NSInteger audio_encoder_type = 1; //1: AAC Boolean is_audio_hardware_encoder = NO; [smart_publisher_sdk SmartPublisherSetAudioEncoderType:audio_encoder_type isHwEncoder:is_audio_hardware_encoder]; NSInteger gop_interval = 40; [smart_publisher_sdk SmartPublisherSetGopInterval:gop_interval]; NSInteger fps = 20; [smart_publisher_sdk SmartPublisherSetFPS:fps]; //NSInteger sw_video_encoder_profile = 1; //[smart_publisher_sdk SmartPublisherSetSWVideoEncoderProfile:sw_video_encoder_profile]; //NSInteger sw_video_encoder_speed = 2; //[smart_publisher_sdk SmartPublisherSetSWVideoEncoderSpeed:sw_video_encoder_speed]; Boolean clip_mode = false; [smart_publisher_sdk SmartPublisherSetClippingMode:clip_mode]; if ( !is_video_hardware_encoder ) { NSInteger is_enable_vbr = 1; if(is_enable_vbr) { NSInteger video_quality = [self CalVideoQuality:video_stream_quality is_h264:YES]; NSInteger vbr_max_kbitrate = [self CalVbrMaxKBitRate:video_stream_quality]; [smart_publisher_sdk SmartPublisherSetSwVBRMode:is_enable_vbr video_quality:video_quality vbr_max_kbitrate:vbr_max_kbitrate]; } else { //NSInteger avg_bit_rate = 500; //NSInteger max_bit_rate = 1000; //[smart_publisher_sdk SmartPublisherSetVideoBitRate:avg_bit_rate maxBitRate:max_bit_rate]; } } else { // if(video_stream_quality == DN_VIDEO_QUALITY_MEDIUM) { NSInteger avg_bit_rate = 800; NSInteger max_bit_rate = 1600; [smart_publisher_sdk SmartPublisherSetVideoBitRate:avg_bit_rate maxBitRate:max_bit_rate]; } } NSInteger ret = [smart_publisher_sdk SmartPublisherStartPublisher:rtmp_push_url_]; if(ret != 0) { if (ret == 2) { NSLog(@""); } else { NSLog(@" DANIULIVE_RETURN_ERROR"); } return; } is_pushing_rtmp_ = YES; [btn_publisher_controller_ setTitle:@"" forState:(UIControlStateNormal)]; } - (void)StopPublisher{ if([smart_publisher_sdk SmartPublisherStopPublisher] != 0) { // NSLog(@"rtmp pusher StopPublisher failed.."); } if([smart_publisher_sdk SmartPublisherStopCaputure] != 0) { // NSLog(@"rtmp pusher StopCaputure failed.."); } if ([smart_publisher_sdk SmartPublisherUnInit] != 0) { //uninitSDK NSLog(@"rtmp pusher UnInit failed.."); } if (_publishView != nil) { [_publishView removeFromSuperview]; _publishView = nil; } smart_publisher_sdk.delegate = nil; smart_publisher_sdk = nil; is_pushing_rtmp_ = NO; [btn_publisher_controller_ setTitle:@"" forState:(UIControlStateNormal)]; [btn_publisher_mute_ setTitle:@"" forState:UIControlStateNormal]; } - (void)StartPlayer{ _playView = (__bridge UIView *)[SmartPlayerSDK SmartPlayerCreatePlayView:(screen_width_ - 300) y:screen_height_/2 width:300 height:200]; [self.view addSubview:_playView]; smart_player_sdk = [[SmartPlayerSDK alloc]init];// if (smart_player_sdk ==nil) { return; } if (smart_player_sdk.delegate == nil) { smart_player_sdk.delegate = self;// } NSInteger initRet = [smart_player_sdk SmartPlayerInitPlayer];//player if ( initRet != 0 ) { return; } NSInteger videoDecoder = [smart_player_sdk SmartPlayerSetVideoDecoderMode:0];// 0 1 if (videoDecoder != 0) { return; } NSInteger isEchoCancellationMode = 1; // [smart_player_sdk SmartPlayerSetEchoCancellationMode:isEchoCancellationMode]; if( [smart_player_sdk SmartPlayerSetPlayView:(__bridge void *)(_playView)]!= 0) { return; } NSInteger bufferTime = 0; if( [smart_player_sdk SmartPlayerSetBuffer:bufferTime] != 0 ) { return; } if([smart_player_sdk SmartPlayerSetPlayURL:playback_url_] != 0) { return; } if([smart_player_sdk SmartPlayerStart] != 0) { NSLog(@""); return; } is_playing_ = YES; [btn_player_controller_ setTitle:@"" forState:(UIControlStateNormal)]; } - (void)StopPlayer{ NSLog(@"StopPlayer++"); if (smart_player_sdk != nil) { [smart_player_sdk SmartPlayerStop]; } if (_playView != nil) { [_playView removeFromSuperview]; [SmartPlayerSDK SmartPlayeReleasePlayView:(__bridge void *)(_playView)]; _playView = nil; } [smart_player_sdk SmartPlayerUnInitPlayer]; if (smart_player_sdk.delegate != nil) { smart_player_sdk.delegate = nil; } smart_player_sdk = nil; is_playing_ = NO; [btn_player_controller_ setTitle:@"" forState:(UIControlStateNormal)]; [btn_player_mute_ setTitle:@"" forState:(UIControlStateNormal)]; } - (NSInteger) handleSmartPublisherEvent:(NSInteger)nID param1:(unsigned long long)param1 param2:(unsigned long long)param2 param3:(NSString*)param3 param4:(NSString*)param4 pObj:(void *)pObj{ NSString* pubilisher_event = @""; NSString* lable = @""; if (nID == EVENT_DANIULIVE_ERC_PUBLISHER_STARTED) { lable = @"..url:"; pubilisher_event = [lable stringByAppendingFormat:@"%@", param3]; } else if (nID == EVENT_DANIULIVE_ERC_PUBLISHER_CONNECTING) { pubilisher_event = @".."; } else if (nID == EVENT_DANIULIVE_ERC_PUBLISHER_CONNECTION_FAILED) { pubilisher_event = @".."; } else if (nID == EVENT_DANIULIVE_ERC_PUBLISHER_CONNECTED) { pubilisher_event = @".."; } else if (nID == EVENT_DANIULIVE_ERC_PUBLISHER_DISCONNECTED) { pubilisher_event = @".."; } else if (nID == EVENT_DANIULIVE_ERC_PUBLISHER_STOP) { lable = @"..url:"; pubilisher_event = [lable stringByAppendingFormat:@"%@", param3]; } else if (nID == EVENT_DANIULIVE_ERC_PUBLISHER_RECORDER_START_NEW_FILE) { lable = @"..:"; pubilisher_event = [lable stringByAppendingFormat:@"%@", param3]; } else if (nID == EVENT_DANIULIVE_ERC_PUBLISHER_ONE_RECORDER_FILE_FINISHED) { lable = @"..:"; pubilisher_event = [lable stringByAppendingFormat:@"%@", param3]; } else if (nID == EVENT_DANIULIVE_ERC_PUBLISHER_CAPTURE_IMAGE) { if ((int)param1 == 0) { lable = @":"; pubilisher_event = [lable stringByAppendingFormat:@"%@", param3]; } else { lable = @":"; pubilisher_event = [lable stringByAppendingFormat:@"%@", param3]; } } else if (nID == EVENT_DANIULIVE_ERC_PUBLISHER_RTSP_URL) { lable = @"RTSPURL:"; pubilisher_event = [lable stringByAppendingFormat:@"%@", param3]; } else { lable = @"nID:"; pubilisher_event = [lable stringByAppendingFormat:@"%lx", (long)nID]; } NSString* publisher_event_tag = @":"; if(nID == EVENT_DANIULIVE_ERC_PUBLISHER_RTSP_URL) { publisher_event_tag = @""; } NSString* event = [publisher_event_tag stringByAppendingFormat:@"%@", pubilisher_event]; NSLog(@"%@", event); dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ dispatch_async(dispatch_get_main_queue(), ^{ self.textPublisherEventLabel.text = event; }); }); return 0; } - (NSInteger)handleSmartPlayerEvent:(NSInteger)nID param1:(unsigned long long)param1 param2:(unsigned long long)param2 param3:(NSString *)param3 param4:(NSString *)param4 pObj:(void *)pObj{ NSString* player_event = @""; NSString* lable = @""; if (nID == EVENT_DANIULIVE_ERC_PLAYER_STARTED) { player_event = @"[event].."; } else if (nID == EVENT_DANIULIVE_ERC_PLAYER_CONNECTING) { player_event = @"[event].."; } else if (nID == EVENT_DANIULIVE_ERC_PLAYER_CONNECTION_FAILED) { player_event = @"[event].."; } else if (nID == EVENT_DANIULIVE_ERC_PLAYER_CONNECTED) { player_event = @"[event].."; } else if (nID == EVENT_DANIULIVE_ERC_PLAYER_DISCONNECTED) { player_event = @"[event].."; } else if (nID == EVENT_DANIULIVE_ERC_PLAYER_STOP) { player_event = @"[event].."; } else if (nID == EVENT_DANIULIVE_ERC_PLAYER_RESOLUTION_INFO) { NSString *str_w = [NSString stringWithFormat:@"%ld", (NSInteger)param1]; NSString *str_h = [NSString stringWithFormat:@"%ld", (NSInteger)param2]; lable = @"[event]: "; player_event = [lable stringByAppendingFormat:@"%@*%@", str_w, str_h]; } else if (nID == EVENT_DANIULIVE_ERC_PLAYER_NO_MEDIADATA_RECEIVED) { player_event = @"[event]RTMP.."; } else if (nID == EVENT_DANIULIVE_ERC_PLAYER_SWITCH_URL) { player_event = @"[event]url.."; } else if (nID == EVENT_DANIULIVE_ERC_PLAYER_CAPTURE_IMAGE) { if ((int)param1 == 0) { NSLog(@"[event]: %@", param3); lable = @"[event]:"; player_event = [lable stringByAppendingFormat:@"%@", param3]; } else { lable = @"[event]"; player_event = [lable stringByAppendingFormat:@"%@", param3]; } } else if (nID == EVENT_DANIULIVE_ERC_PLAYER_RECORDER_START_NEW_FILE) { lable = @"[event]..:"; player_event = [lable stringByAppendingFormat:@"%@", param3]; } else if (nID == EVENT_DANIULIVE_ERC_PLAYER_ONE_RECORDER_FILE_FINISHED) { lable = @"..:"; player_event = [lable stringByAppendingFormat:@"%@", param3]; } else if (nID == EVENT_DANIULIVE_ERC_PLAYER_START_BUFFERING) { NSLog(@"[event]buffer.."); } else if (nID == EVENT_DANIULIVE_ERC_PLAYER_BUFFERING) { NSLog(@"[event]buffer: %lld", param1); } else if (nID == EVENT_DANIULIVE_ERC_PLAYER_STOP_BUFFERING) { NSLog(@"[event]buffer.."); } else if (nID == EVENT_DANIULIVE_ERC_PLAYER_DOWNLOAD_SPEED) { NSInteger speed_kbps = (NSInteger)param1*8/1000; NSInteger speed_KBs = (NSInteger)param1/1024; lable = @"[event]download speed :"; player_event = [lable stringByAppendingFormat:@"%ld kbps - %ld KB/s", (long)speed_kbps, (long)speed_KBs]; } else if(nID == EVENT_DANIULIVE_ERC_PLAYER_RTSP_STATUS_CODE) { lable = @"[event]RTSP status code received:"; player_event = [lable stringByAppendingFormat:@"%ld", (long)param1]; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ dispatch_async(dispatch_get_main_queue(), ^{ UIAlertController *aleView=[UIAlertController alertControllerWithTitle:@"RTSP" message:player_event preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *action_ok=[UIAlertAction actionWithTitle:@"" style:UIAlertActionStyleCancel handler:nil]; [aleView addAction:action_ok]; [self presentViewController:aleView animated:YES completion:nil]; }); }); } else NSLog(@"[event]nID:%lx", (long)nID); NSString* player_event_tag = @":"; NSString* event = [player_event_tag stringByAppendingFormat:@"%@", player_event]; NSLog(@"%@", event); dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ dispatch_async(dispatch_get_main_queue(), ^{ self.textPlayerEventLabel.text = event; }); }); return 0; } - (NSInteger)CalVideoQuality:(DNVideoStreamingQuality)video_quality is_h264:(Boolean)is_h264 { NSInteger quality = is_h264 ? 23 : 28; if ( DN_VIDEO_QUALITY_LOW == video_quality ) { quality = is_h264? 23 : 27; } else if ( DN_VIDEO_QUALITY_MEDIUM == video_quality ) { quality = is_h264? 26 : 28; } else if ( DN_VIDEO_QUALITY_HIGH == video_quality ) { quality = is_h264? 27 : 29; } return quality; } - (NSInteger)CalVbrMaxKBitRate:(DNVideoStreamingQuality)video_quality { NSInteger max_kbit_rate = 2000; if ( DN_VIDEO_QUALITY_LOW == video_quality ) { max_kbit_rate = 400; } else if ( DN_VIDEO_QUALITY_MEDIUM == video_quality ) { max_kbit_rate = 700; } else if ( DN_VIDEO_QUALITY_HIGH == video_quality ) { max_kbit_rate = 1400; } return max_kbit_rate; } @end ```
/content/code_sandbox/SourceCode/IOS/SmartiOSEchoCancellation/SmartiOSEchoCancellation/ViewController.mm
xml
2016-03-26T14:46:02
2024-08-15T03:36:44
SmarterStreaming
daniulive/SmarterStreaming
10,895
5,234
```xml import url from "url"; import path from "path"; import log from "electron-log"; import electron, { BrowserWindow, ipcMain } from "electron"; import * as appWindow from "./appWindow"; const app = electron.app; let win: BrowserWindow | null = null; function getSetupInfo(): any { const platform = process.platform; const appPath = app.getAppPath(); const appDir = path.dirname(appPath); const appScriptPath = path.join(appDir, "tad.sh"); const exePath = app.getPath("exe"); const exeDir = path.dirname(exePath); const setupInfo = { platform, appDir, appScriptPath, exePath, exeDir, }; return setupInfo; } function openExample() { const app = electron.app; const appPath = app.getAppPath(); const appDir = process.defaultApp ? appPath : path.dirname(appPath); const exampleFilePath = path.join(appDir, "examples", "movie_metadata.csv"); appWindow.createFromFile(exampleFilePath); } export const showQuickStart = () => { if (!win) { ipcMain.handle("getSetupInfo", getSetupInfo); ipcMain.handle("openExample", openExample); win = new BrowserWindow({ width: 850, height: 600, webPreferences: { nodeIntegration: true, contextIsolation: false, }, }); win.loadURL( url.format({ pathname: path.join(__dirname, "userdocs", "quickstart.html"), protocol: "file:", slashes: true, }) ); win.on("close", (e) => { win = null; }); } win.show(); }; ```
/content/code_sandbox/packages/tad-app/app/quickStart.ts
xml
2016-10-24T18:59:04
2024-08-16T16:29:52
tad
antonycourtney/tad
3,125
375
```xml import { Alert, Bulk, router } from '@erxes/ui/src'; import { MainQueryResponse, RemoveMutationResponse, } from '../types'; import { mutations, queries } from '../graphql'; import GoalTypesList from '../components/goalTypesList'; import React from 'react'; import { gql, useQuery, useMutation } from '@apollo/client'; type Props = { queryParams: any; }; const goalTypesList = (props: Props) => { const { queryParams } = props; const goalTypesMainQuery = useQuery<MainQueryResponse>( gql(queries.goalTypesMain), { variables: { ...router.generatePaginationParams(queryParams || {}), date: queryParams.date, endDate: queryParams.endDate, branch: queryParams.branch, department: queryParams.department, unit: queryParams.unit, contribution: queryParams.contribution, }, fetchPolicy: 'network-only', }, ); const [goalTypesRemove] = useMutation<RemoveMutationResponse>( gql(mutations.goalTypesRemove), { refetchQueries: ['goalTypesMain'], }, ); const remove = ({ goalTypeIds }, emptyBulk) => { goalTypesRemove({ variables: { goalTypeIds }, }) .then(() => { emptyBulk(); Alert.success('You successfully deleted a goalType'); }) .catch((e) => { Alert.error(e.message); }); }; const goalTypesList = (bulkProps) => { const { list = [], totalCount = 0 } = goalTypesMainQuery?.data?.goalTypesMain || {}; const updatedProps = { ...props, totalCount, goalTypes: list, loading: goalTypesMainQuery.loading, remove, }; return <GoalTypesList {...updatedProps} {...bulkProps} />; }; const refetch = () => { goalTypesMainQuery.refetch(); }; return <Bulk content={goalTypesList} refetch={refetch} />; }; export default goalTypesList; ```
/content/code_sandbox/packages/plugin-goals-ui/src/containers/goalTypesList.tsx
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
434
```xml import {EventEmitter} from 'events'; import Listing, { ListingOptions } from './Listing'; import RedditContent from './RedditContent'; import RedditUser from './RedditUser'; import Submission from './Submission'; export default class LiveThread extends RedditContent<LiveThread> { description_html: string; description: string; nsfw: boolean; resources_html: string; resources: string; state: string; stream: EventEmitter; title: string; viewer_count_fuzzed: number | null; viewer_count: number | null; websocket_url: string | null; acceptContributorInvite(): Promise<this>; addUpdate(body: string): Promise<this>; closeStream(): void; closeThread(): Promise<this>; deleteUpdate(options: { id: string; }): Promise<this>; editSettings(options: LiveThreadSettings): Promise<this>; getContributors(): Promise<RedditUser[]>; getDiscussions(options?: ListingOptions): Promise<Listing<Submission>>; getRecentUpdates(options?: ListingOptions): Promise<Listing<LiveUpdate>>; inviteContributor(options: { name: string; permissions: Permissions[]}): Promise<this>; leaveContributor(): Promise<this>; removeContributor(options: { name: string; }): Promise<this>; report(options: { reason: ReportReason; }): Promise<this>; revokeContributorInvite(options: { name: string; }): Promise<this>; setContributorPermissions(options: { name: string; permissions: Permissions[]; }): Promise<this>; strikeUpdate(options: { id: string; }): Promise<this>; } type Permissions = 'update' | 'edit' | 'manage'; type ReportReason = 'spam' | 'vote-manipulation' | 'personal-information' | 'sexualizing-minors' | 'site-breaking'; export interface LiveThreadSettings { title: string; description?: string; resources?: string; nsfw?: boolean; } interface LiveUpdate { body: string; name: string; embeds: Embed[]; mobile_embeds: MobileEmbed[]; author: RedditUser; created: number; created_utc: number; body_html: string; stricken: boolean; id: string; } interface Embed { url: string; width: number; height: number; } interface MobileEmbed extends Embed { provider_url: string; original_url: string; version: string; provider_name: string; type: string; thumbnail_url: string; thumbnail_height: number; thumbnail_width: number; } ```
/content/code_sandbox/src/objects/LiveThread.d.ts
xml
2016-01-18T06:13:04
2024-08-09T14:11:47
snoowrap
not-an-aardvark/snoowrap
1,011
544
```xml <clickhouse> <keeper_server> <use_cluster>false</use_cluster> <tcp_port>9181</tcp_port> <server_id>1</server_id> <log_storage_path>/var/lib/clickhouse/coordination/log</log_storage_path> <snapshot_storage_path>/var/lib/clickhouse/coordination/snapshots</snapshot_storage_path> <coordination_settings> <operation_timeout_ms>5000</operation_timeout_ms> <session_timeout_ms>10000</session_timeout_ms> <raft_logs_level>trace</raft_logs_level> </coordination_settings> <raft_configuration> <server> <id>1</id> <hostname>node1</hostname> <port>9234</port> </server> <server> <id>2</id> <hostname>node2</hostname> <port>9234</port> </server> <server> <id>3</id> <hostname>node3</hostname> <port>9234</port> </server> </raft_configuration> </keeper_server> </clickhouse> ```
/content/code_sandbox/tests/integration/test_keeper_nodes_add/configs/enable_keeper_three_nodes_1.xml
xml
2016-06-02T08:28:18
2024-08-16T18:39:33
ClickHouse
ClickHouse/ClickHouse
36,234
253
```xml import { TestBed, inject } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { SystemAdminGuard } from './system-admin-activate.service'; import { AppConfigService } from '../../services/app-config.service'; import { SessionService } from '../services/session.service'; describe('SystemAdminGuard', () => { const fakeAppConfigService = null; const fakeSessionService = null; beforeEach(() => { TestBed.configureTestingModule({ imports: [RouterTestingModule], providers: [ SystemAdminGuard, { provide: AppConfigService, useValue: fakeAppConfigService }, { provide: SessionService, useValue: fakeSessionService }, ], }); }); it('should be created', inject( [SystemAdminGuard], (service: SystemAdminGuard) => { expect(service).toBeTruthy(); } )); }); ```
/content/code_sandbox/src/portal/src/app/shared/router-guard/system-admin-activate.service.spec.ts
xml
2016-01-28T21:10:28
2024-08-16T15:28:34
harbor
goharbor/harbor
23,335
183
```xml <?xml version="1.0" encoding="utf-8"?> <!-- path_to_url Unless required by applicable law or agreed to in writing, software WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --> <resources> <dimen name="cat_bottom_nav_standard_spacing">8dp</dimen> </resources> ```
/content/code_sandbox/catalog/java/io/material/catalog/bottomnav/res/values/dimens.xml
xml
2016-12-05T16:11:29
2024-08-16T17:51:42
material-components-android
material-components/material-components-android
16,176
76
```xml <epp xmlns="urn:ietf:params:xml:ns:epp-1.0"> <response> <result code="1000"> <msg>Command completed successfully</msg> </result> <resData> <host:infData xmlns:host="urn:ietf:params:xml:ns:host-1.0"> <host:name>ns1.example.com</host:name> <host:roid>NS1_EXAMPLE1-REP</host:roid> <host:status s="linked"/> <host:status s="clientUpdateProhibited"/> <host:addr ip="v4">192.0.2.2</host:addr> <host:addr ip="v4">192.0.2.29</host:addr> <host:addr ip="v6">1080:0:0:0:8:800:200C:417A</host:addr> <host:clID>TheRegistrar</host:clID> <host:crID>NewRegistrar</host:crID> <host:crDate>1999-04-03T22:00:00.0Z</host:crDate> <host:upID>NewRegistrar</host:upID> <host:upDate>1999-12-03T09:00:00.0Z</host:upDate> <host:trDate>2000-04-08T09:00:00.0Z</host:trDate> </host:infData> </resData> <trID> <clTRID>ABC-12345</clTRID> <svTRID>server-trid</svTRID> </trID> </response> </epp> ```
/content/code_sandbox/core/src/test/resources/google/registry/xjc/host_info_response.xml
xml
2016-02-29T20:16:48
2024-08-15T19:49:29
nomulus
google/nomulus
1,685
391
```xml <?xml version="1.0" encoding="UTF-8"?> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2"> <file source-language="en" target-language="da" datatype="plaintext" original="invoice-renderer.en.xlf"> <body> <trans-unit id="hOcTt2G" resname="invoice_renderer"> <source>invoice_renderer</source> <target>Faktura dokument</target> </trans-unit> <trans-unit id="Utbj3k_" resname="invoice"> <source>invoice</source> <target>Faktura (standard)</target> </trans-unit> <trans-unit id="lt2Y2LO" resname="timesheet"> <source>timesheet</source> <target>Timeseddel</target> </trans-unit> <trans-unit id="m1UyfD9" resname="service-date"> <source>service-date</source> <target>Freelancer</target> </trans-unit> <trans-unit id="7mEUv6C" resname="help.upload" xml:space="preserve"> <source>help.upload</source> <target state="translated">Advarsel: eksisterende filer bliver overskrevet. Tilladte filtyper er: %extensions%.</target> </trans-unit> <trans-unit id="22pt8Gs" resname="download_invoice_renderer" xml:space="preserve"> <source>download_invoice_renderer</source> <target state="translated">Du kan hente flere templates/skabeloner her</target> </trans-unit> <trans-unit id="E5BwZHT" resname="programmatic" xml:space="preserve"> <source>programmatic</source> <target state="translated">Til yderligere bearbejdning</target> </trans-unit> <trans-unit id="mC2ePrm" resname="text" xml:space="preserve"> <source>text</source> <target state="translated">Tekst</target> </trans-unit> <trans-unit id="N6juwc4" resname="default" xml:space="preserve" approved="no"> <source>Invoice</source> <target state="translated">Faktura</target> </trans-unit> </body> </file> </xliff> ```
/content/code_sandbox/translations/invoice-renderer.da.xlf
xml
2016-10-20T17:06:34
2024-08-16T18:27:30
kimai
kimai/kimai
3,084
553
```xml import * as ChildProcess from "child_process" import * as Oni from "oni-api" import * as Log from "oni-core-logging" import * as Platform from "./../../Platform" import { configuration } from "./../../Services/Configuration" export interface IShellEnvironmentFetcher { getEnvironmentVariables(): Promise<any> } interface IShellEnv { default: { sync: (shell?: string) => NodeJS.ProcessEnv } } export class ShellEnvironmentFetcher implements IShellEnvironmentFetcher { private _shellEnvPromise: Promise<any> private _shellEnv: IShellEnv constructor() { // Dynamic imports return { default: Module } this._shellEnvPromise = import("shell-env") } public async getEnvironmentVariables(): Promise<NodeJS.ProcessEnv> { if (!this._shellEnv) { this._shellEnv = await this._shellEnvPromise } try { const userShell = configuration.getValue<string>("oni.userShell") const shell = typeof userShell === "string" ? userShell : undefined const env = this._shellEnv.default.sync(shell) return env } catch (error) { Log.warn( `[Oni environment fetcher]: unable to get enviroment variables because: ${ error.message }`, ) } return {} } } export class Process implements Oni.Process { public _spawnedProcessIds: number[] = [] private _env: NodeJS.ProcessEnv constructor( private _shellEnvironmentFetcher: IShellEnvironmentFetcher = new ShellEnvironmentFetcher(), ) {} public getPathSeparator = () => { return Platform.isWindows() ? ";" : ":" } public mergePathEnvironmentVariable = (currentPath: string, pathsToAdd: string[]): string => { if (!pathsToAdd || !pathsToAdd.length) { return currentPath } const separator = this.getPathSeparator() const joinedPathsToAdd = pathsToAdd.join(separator) return currentPath + separator + joinedPathsToAdd } /** * API surface area responsible for handling process-related tasks * (spawning processes, managing running process, etc) */ public execNodeScript = async ( scriptPath: string, args: string[] = [], options: ChildProcess.ExecOptions = {}, callback: (err: any, stdout: string, stderr: string) => void, ): Promise<ChildProcess.ChildProcess> => { const spawnOptions = await this.mergeSpawnOptions(options) spawnOptions.env.ELECTRON_RUN_AS_NODE = 1 const execOptions = [process.execPath, scriptPath].concat(args) const execString = execOptions.map(s => `"${s}"`).join(" ") const proc = ChildProcess.exec(execString, spawnOptions, callback) this._spawnedProcessIds.push(proc.pid) return proc } /** * Get the set of process IDs that were spawned by Oni */ public getPIDs = (): number[] => { return [...this._spawnedProcessIds] } /** * Get the __dirname of currently executing file */ public getDirname = () => { return __dirname } /** * Wrapper around `child_process.exec` to run using electron as opposed to node */ public spawnNodeScript = async ( scriptPath: string, args: string[] = [], options: ChildProcess.SpawnOptions = {}, ): Promise<ChildProcess.ChildProcess> => { const spawnOptions = await this.mergeSpawnOptions(options) spawnOptions.env.ELECTRON_RUN_AS_NODE = 1 const allArgs = [scriptPath].concat(args) const proc = ChildProcess.spawn(process.execPath, allArgs, spawnOptions) this._spawnedProcessIds.push(proc.pid) return proc } /** * Spawn process - wrapper around `child_process.spawn` */ public spawnProcess = async ( startCommand: string, args: string[] = [], options: ChildProcess.SpawnOptions = {}, ): Promise<ChildProcess.ChildProcess> => { const spawnOptions = await this.mergeSpawnOptions(options) const proc = ChildProcess.spawn(startCommand, args, spawnOptions) this._spawnedProcessIds.push(proc.pid) proc.on("error", (err: Error) => { Log.error(err) }) return proc } public mergeSpawnOptions = async ( originalSpawnOptions: ChildProcess.ExecOptions | ChildProcess.SpawnOptions, ): Promise<any> => { let existingPath: string try { if (!this._env) { this._env = await this._shellEnvironmentFetcher.getEnvironmentVariables() } existingPath = process.env.Path || process.env.PATH } catch (e) { existingPath = process.env.Path || process.env.PATH } const additionalEnvironmentVariables = configuration.getValue("environment.additionalVariables") || {} const requiredOptions = { env: { ...process.env, ...this._env, ...originalSpawnOptions.env, ...additionalEnvironmentVariables, }, } // TODO: Workaround for the bug fix here: // path_to_url // Once 0.3.2 is available and we've switched, we won't need this anymore. if (Platform.isMac() && !requiredOptions.env.LANG) { requiredOptions.env.LANG = "en_us.UTF-8" Log.warn( "'LANG' environment variable not set, using default value of 'en_us.UTF-8'. Consider setting environment.additionalVariables['LANG'].", ) } requiredOptions.env.PATH = this.mergePathEnvironmentVariable( existingPath, configuration.getValue("environment.additionalPaths"), ) return { ...originalSpawnOptions, ...requiredOptions, } } } export default new Process() ```
/content/code_sandbox/browser/src/Plugins/Api/Process.ts
xml
2016-11-16T14:42:55
2024-08-14T11:48:05
oni
onivim/oni
11,355
1,256
```xml import { Entity } from "../../../../../../src/decorator/entity/Entity" import { PrimaryGeneratedColumn } from "../../../../../../src/decorator/columns/PrimaryGeneratedColumn" import { Column } from "../../../../../../src/decorator/columns/Column" import { ManyToMany } from "../../../../../../src/decorator/relations/ManyToMany" import { Post } from "./Post" import { Image } from "./Image" import { JoinTable } from "../../../../../../src/decorator/relations/JoinTable" @Entity() export class Category { @PrimaryGeneratedColumn() id: number @Column() name: string @Column() isRemoved: boolean = false @ManyToMany((type) => Post, (post) => post.categories) posts: Post[] @ManyToMany((type) => Image, (image) => image.categories) @JoinTable() images: Image[] postCount: number removedPostCount: number imageCount: number removedImageCount: number } ```
/content/code_sandbox/test/functional/query-builder/relation-count/relation-count-many-to-many/entity/Category.ts
xml
2016-02-29T07:41:14
2024-08-16T18:28:52
typeorm
typeorm/typeorm
33,875
220
```xml <!-- WindowsSpyBlocker - simplewall extra rules --> <!-- Source: path_to_url --> <!-- Last-Modified: Mon, 16 May 2022 14:06:44 +0200 --> <?xml version="1.0"?> <root> <item name="extra_13.64.186.225" rule="13.64.186.225" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.69.116.104" rule="13.69.116.104" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.69.146.58" rule="13.69.146.58" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.69.239.72" rule="13.69.239.72" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.69.239.73" rule="13.69.239.73" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.69.239.74" rule="13.69.239.74" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.69.244.117" rule="13.69.244.117" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.70.180.171" rule="13.70.180.171" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.76.218.117" rule="13.76.218.117" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.76.219.191" rule="13.76.219.191" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.76.219.210" rule="13.76.219.210" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.77.112.132" rule="13.77.112.132" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.77.115.36" rule="13.77.115.36" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.78.111.198" rule="13.78.111.198" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.78.111.199" rule="13.78.111.199" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.78.235.126" rule="13.78.235.126" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.78.235.247" rule="13.78.235.247" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.79.7.57" rule="13.79.7.57" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.79.239.69" rule="13.79.239.69" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.79.239.82" rule="13.79.239.82" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.80.7.77" rule="13.80.7.77" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.80.12.54" rule="13.80.12.54" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.81.5.53" rule="13.81.5.53" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.81.118.91" rule="13.81.118.91" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.83.65.212" rule="13.83.65.212" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.83.98.37" rule="13.83.98.37" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.85.88.16" rule="13.85.88.16" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.86.252.235" rule="13.86.252.235" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.88.28.53" rule="13.88.28.53" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.88.139.208" rule="13.88.139.208" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.88.145.128" rule="13.88.145.128" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.89.51.159" rule="13.89.51.159" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.89.178.26" rule="13.89.178.26" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.89.178.27" rule="13.89.178.27" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.89.179.8" rule="13.89.179.8" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.89.179.9" rule="13.89.179.9" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.89.179.10" rule="13.89.179.10" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.89.179.12" rule="13.89.179.12" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.89.202.241" rule="13.89.202.241" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.95.147.73" rule="13.95.147.73" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.104.158.177" rule="13.104.158.177" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.104.158.179" rule="13.104.158.179" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.104.158.180" rule="13.104.158.180" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.104.158.183" rule="13.104.158.183" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.104.208.160" rule="13.104.208.160" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.104.208.162" rule="13.104.208.162" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.104.208.164" rule="13.104.208.164" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.104.208.165" rule="13.104.208.165" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.105.66.144" rule="13.105.66.144" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.105.74.49" rule="13.105.74.49" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.3.128" rule="13.107.3.128" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.3.254" rule="13.107.3.254" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.5.80" rule="13.107.5.80" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.5.88" rule="13.107.5.88" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.5.91" rule="13.107.5.91" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.6.156" rule="13.107.6.156" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.6.158" rule="13.107.6.158" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.6.163" rule="13.107.6.163" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.6.254" rule="13.107.6.254" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.13.88" rule="13.107.13.88" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.13.91" rule="13.107.13.91" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.18.11" rule="13.107.18.11" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.18.254" rule="13.107.18.254" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.19.254" rule="13.107.19.254" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.21.200" rule="13.107.21.200" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.21.229" rule="13.107.21.229" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.22.200" rule="13.107.22.200" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.40.203" rule="13.107.40.203" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.42.11" rule="13.107.42.11" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.42.12" rule="13.107.42.12" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.42.13" rule="13.107.42.13" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.42.14" rule="13.107.42.14" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.42.23" rule="13.107.42.23" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.42.254" rule="13.107.42.254" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.43.12" rule="13.107.43.12" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.43.14" rule="13.107.43.14" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.43.23" rule="13.107.43.23" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.46.88" rule="13.107.46.88" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.47.88" rule="13.107.47.88" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.49.254" rule="13.107.49.254" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.128.254" rule="13.107.128.254" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.136.254" rule="13.107.136.254" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.140.254" rule="13.107.140.254" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.213.42" rule="13.107.213.42" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.246.10" rule="13.107.246.10" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.246.13" rule="13.107.246.13" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.246.19" rule="13.107.246.19" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.246.254" rule="13.107.246.254" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.255.72" rule="13.107.255.72" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.255.73" rule="13.107.255.73" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.255.74" rule="13.107.255.74" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_13.107.255.76" rule="13.107.255.76" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.36.218.63" rule="20.36.218.63" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.36.218.70" rule="20.36.218.70" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.36.246.225" rule="20.36.246.225" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.36.253.92" rule="20.36.253.92" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.38.96.100" rule="20.38.96.100" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.38.101.132" rule="20.38.101.132" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.38.101.228" rule="20.38.101.228" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.38.122.68" rule="20.38.122.68" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.38.122.100" rule="20.38.122.100" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.38.122.132" rule="20.38.122.132" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.38.122.228" rule="20.38.122.228" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.40.129.122" rule="20.40.129.122" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.40.136.238" rule="20.40.136.238" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.42.65.84" rule="20.42.65.84" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.42.65.85" rule="20.42.65.85" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.42.65.88" rule="20.42.65.88" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.42.65.89" rule="20.42.65.89" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.42.65.90" rule="20.42.65.90" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.42.65.92" rule="20.42.65.92" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.42.72.131" rule="20.42.72.131" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.42.73.24" rule="20.42.73.24" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.42.73.25" rule="20.42.73.25" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.42.73.26" rule="20.42.73.26" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.42.73.27" rule="20.42.73.27" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.42.73.29" rule="20.42.73.29" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.43.92.14" rule="20.43.92.14" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.44.10.122" rule="20.44.10.122" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.44.10.123" rule="20.44.10.123" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.44.82.31" rule="20.44.82.31" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.44.208.51" rule="20.44.208.51" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.44.232.74" rule="20.44.232.74" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.46.146.84" rule="20.46.146.84" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.49.157.6" rule="20.49.157.6" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.50.73.9" rule="20.50.73.9" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.50.73.10" rule="20.50.73.10" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.50.80.209" rule="20.50.80.209" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.50.80.210" rule="20.50.80.210" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.50.102.62" rule="20.50.102.62" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.50.201.195" rule="20.50.201.195" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.50.201.200" rule="20.50.201.200" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.54.64.202" rule="20.54.64.202" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.54.88.152" rule="20.54.88.152" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.54.122.82" rule="20.54.122.82" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.60.18.36" rule="20.60.18.36" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.60.30.36" rule="20.60.30.36" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.60.30.68" rule="20.60.30.68" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.60.58.97" rule="20.60.58.97" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.60.59.193" rule="20.60.59.193" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.60.59.235" rule="20.60.59.235" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.60.133.132" rule="20.60.133.132" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.60.178.4" rule="20.60.178.4" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.60.179.4" rule="20.60.179.4" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.60.181.193" rule="20.60.181.193" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.60.181.225" rule="20.60.181.225" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.60.240.33" rule="20.60.240.33" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.60.240.65" rule="20.60.240.65" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.67.112.184" rule="20.67.112.184" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.67.219.150" rule="20.67.219.150" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.69.130.185" rule="20.69.130.185" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.72.78.248" rule="20.72.78.248" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.73.128.142" rule="20.73.128.142" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.82.209.104" rule="20.82.209.104" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.82.209.183" rule="20.82.209.183" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.82.210.154" rule="20.82.210.154" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.82.217.86" rule="20.82.217.86" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.82.250.189" rule="20.82.250.189" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.86.161.79" rule="20.86.161.79" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.86.173.234" rule="20.86.173.234" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.86.186.134" rule="20.86.186.134" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.93.58.141" rule="20.93.58.141" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.101.57.9" rule="20.101.57.9" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.140.48.69" rule="20.140.48.69" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.140.56.70" rule="20.140.56.70" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.150.17.68" rule="20.150.17.68" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.150.29.228" rule="20.150.29.228" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.150.36.228" rule="20.150.36.228" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.150.50.4" rule="20.150.50.4" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.150.50.132" rule="20.150.50.132" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.150.77.68" rule="20.150.77.68" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.150.77.100" rule="20.150.77.100" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.150.88.4" rule="20.150.88.4" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.150.88.132" rule="20.150.88.132" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.150.88.196" rule="20.150.88.196" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.150.95.4" rule="20.150.95.4" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.150.95.132" rule="20.150.95.132" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.150.95.164" rule="20.150.95.164" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.150.95.196" rule="20.150.95.196" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.150.95.228" rule="20.150.95.228" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.188.76.57" rule="20.188.76.57" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.189.74.153" rule="20.189.74.153" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.189.79.72" rule="20.189.79.72" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.189.118.208" rule="20.189.118.208" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.189.173.1" rule="20.189.173.1" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.189.173.2" rule="20.189.173.2" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.189.173.3" rule="20.189.173.3" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.189.173.4" rule="20.189.173.4" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.189.173.5" rule="20.189.173.5" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.189.173.6" rule="20.189.173.6" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.189.173.7" rule="20.189.173.7" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.189.173.8" rule="20.189.173.8" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.189.173.9" rule="20.189.173.9" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.189.173.10" rule="20.189.173.10" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.189.173.11" rule="20.189.173.11" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.189.173.12" rule="20.189.173.12" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.189.173.13" rule="20.189.173.13" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.189.173.14" rule="20.189.173.14" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.189.173.15" rule="20.189.173.15" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.189.173.20" rule="20.189.173.20" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.189.173.21" rule="20.189.173.21" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.189.173.22" rule="20.189.173.22" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.129.2" rule="20.190.129.2" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.129.17" rule="20.190.129.17" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.129.19" rule="20.190.129.19" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.129.24" rule="20.190.129.24" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.129.128" rule="20.190.129.128" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.129.130" rule="20.190.129.130" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.129.133" rule="20.190.129.133" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.129.160" rule="20.190.129.160" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.137.6" rule="20.190.137.6" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.137.10" rule="20.190.137.10" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.137.14" rule="20.190.137.14" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.137.69" rule="20.190.137.69" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.137.73" rule="20.190.137.73" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.137.75" rule="20.190.137.75" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.137.96" rule="20.190.137.96" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.137.98" rule="20.190.137.98" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.159.0" rule="20.190.159.0" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.159.2" rule="20.190.159.2" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.159.4" rule="20.190.159.4" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.159.23" rule="20.190.159.23" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.159.30" rule="20.190.159.30" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.159.32" rule="20.190.159.32" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.159.64" rule="20.190.159.64" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.159.68" rule="20.190.159.68" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.159.71" rule="20.190.159.71" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.159.73" rule="20.190.159.73" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.159.75" rule="20.190.159.75" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.159.132" rule="20.190.159.132" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.159.134" rule="20.190.159.134" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.159.136" rule="20.190.159.136" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.159.138" rule="20.190.159.138" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.159.161" rule="20.190.159.161" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.159.162" rule="20.190.159.162" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.160.2" rule="20.190.160.2" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.160.4" rule="20.190.160.4" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.160.6" rule="20.190.160.6" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.160.8" rule="20.190.160.8" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.160.14" rule="20.190.160.14" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.160.17" rule="20.190.160.17" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.160.20" rule="20.190.160.20" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.160.22" rule="20.190.160.22" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.160.24" rule="20.190.160.24" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.160.67" rule="20.190.160.67" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.160.69" rule="20.190.160.69" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.160.71" rule="20.190.160.71" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.160.73" rule="20.190.160.73" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.160.75" rule="20.190.160.75" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.160.129" rule="20.190.160.129" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.160.132" rule="20.190.160.132" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.160.134" rule="20.190.160.134" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_20.190.160.136" rule="20.190.160.136" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_23.96.52.53" rule="23.96.52.53" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_23.96.208.208" rule="23.96.208.208" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_23.97.61.137" rule="23.97.61.137" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_23.97.153.169" rule="23.97.153.169" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_23.97.178.173" rule="23.97.178.173" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_23.97.209.97" rule="23.97.209.97" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_23.99.109.44" rule="23.99.109.44" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_23.99.109.64" rule="23.99.109.64" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_23.99.116.116" rule="23.99.116.116" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_23.99.121.207" rule="23.99.121.207" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_23.99.206.110" rule="23.99.206.110" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_23.100.122.175" rule="23.100.122.175" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_23.101.156.198" rule="23.101.156.198" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_23.101.158.111" rule="23.101.158.111" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_23.102.47.40" rule="23.102.47.40" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.67.249.61" rule="40.67.249.61" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.69.176.16" rule="40.69.176.16" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.70.0.108" rule="40.70.0.108" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.70.158.26" rule="40.70.158.26" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.70.186.239" rule="40.70.186.239" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.70.221.249" rule="40.70.221.249" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.74.35.71" rule="40.74.35.71" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.74.70.63" rule="40.74.70.63" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.74.94.131" rule="40.74.94.131" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.74.98.192" rule="40.74.98.192" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.74.98.193" rule="40.74.98.193" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.74.98.194" rule="40.74.98.194" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.74.98.195" rule="40.74.98.195" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.74.108.123" rule="40.74.108.123" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.77.225.248" rule="40.77.225.248" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.77.230.45" rule="40.77.230.45" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.79.48.16" rule="40.79.48.16" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.79.138.41" rule="40.79.138.41" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.79.189.58" rule="40.79.189.58" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.79.189.59" rule="40.79.189.59" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.79.197.35" rule="40.79.197.35" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.80.145.78" rule="40.80.145.78" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.81.30.53" rule="40.81.30.53" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.81.94.65" rule="40.81.94.65" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.81.188.85" rule="40.81.188.85" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.83.74.46" rule="40.83.74.46" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.83.127.51" rule="40.83.127.51" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.83.150.233" rule="40.83.150.233" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.85.78.63" rule="40.85.78.63" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.85.83.182" rule="40.85.83.182" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.89.135.48" rule="40.89.135.48" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.22.183" rule="40.90.22.183" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.22.184" rule="40.90.22.184" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.22.185" rule="40.90.22.185" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.22.186" rule="40.90.22.186" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.22.187" rule="40.90.22.187" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.22.188" rule="40.90.22.188" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.22.189" rule="40.90.22.189" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.22.190" rule="40.90.22.190" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.22.191" rule="40.90.22.191" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.22.192" rule="40.90.22.192" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.22.198" rule="40.90.22.198" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.23.0-40.90.23.255" rule="40.90.23.0-40.90.23.255" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.65.7" rule="40.90.65.7" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.65.17" rule="40.90.65.17" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.65.22" rule="40.90.65.22" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.65.26" rule="40.90.65.26" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.65.28" rule="40.90.65.28" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.65.32" rule="40.90.65.32" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.65.44" rule="40.90.65.44" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.65.53" rule="40.90.65.53" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.65.54" rule="40.90.65.54" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.65.65" rule="40.90.65.65" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.128.17" rule="40.90.128.17" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.130.192" rule="40.90.130.192" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.133.97" rule="40.90.133.97" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.133.112" rule="40.90.133.112" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.136.1" rule="40.90.136.1" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.136.3" rule="40.90.136.3" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.136.19" rule="40.90.136.19" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.136.20" rule="40.90.136.20" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.136.163" rule="40.90.136.163" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.136.166" rule="40.90.136.166" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.136.179" rule="40.90.136.179" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.136.180" rule="40.90.136.180" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.136.182" rule="40.90.136.182" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.137.120" rule="40.90.137.120" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.137.122" rule="40.90.137.122" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.137.124" rule="40.90.137.124" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.137.125" rule="40.90.137.125" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.137.126" rule="40.90.137.126" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.137.127" rule="40.90.137.127" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.142.224" rule="40.90.142.224" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.142.226" rule="40.90.142.226" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.142.230" rule="40.90.142.230" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.190.179" rule="40.90.190.179" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.218.0" rule="40.90.218.0" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.90.221.9" rule="40.90.221.9" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.91.76.238" rule="40.91.76.238" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.91.78.9" rule="40.91.78.9" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.97.161.50" rule="40.97.161.50" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.100.54.2" rule="40.100.54.2" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.100.54.194" rule="40.100.54.194" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.100.174.2" rule="40.100.174.2" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.100.174.18" rule="40.100.174.18" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.100.174.34" rule="40.100.174.34" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.100.174.194" rule="40.100.174.194" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.100.174.210" rule="40.100.174.210" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.100.174.226" rule="40.100.174.226" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.100.175.146" rule="40.100.175.146" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.4.2" rule="40.101.4.2" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.12.2" rule="40.101.12.2" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.12.50" rule="40.101.12.50" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.12.66" rule="40.101.12.66" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.12.98" rule="40.101.12.98" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.12.114" rule="40.101.12.114" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.12.130" rule="40.101.12.130" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.18.18" rule="40.101.18.18" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.18.226" rule="40.101.18.226" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.18.242" rule="40.101.18.242" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.19.146" rule="40.101.19.146" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.19.162" rule="40.101.19.162" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.46.178" rule="40.101.46.178" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.80.2" rule="40.101.80.2" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.80.18" rule="40.101.80.18" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.80.178" rule="40.101.80.178" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.80.194" rule="40.101.80.194" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.81.130" rule="40.101.81.130" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.81.146" rule="40.101.81.146" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.83.18" rule="40.101.83.18" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.83.194" rule="40.101.83.194" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.121.2" rule="40.101.121.2" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.121.18" rule="40.101.121.18" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.121.34" rule="40.101.121.34" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.124.34" rule="40.101.124.34" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.124.194" rule="40.101.124.194" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.128.178" rule="40.101.128.178" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.136.2" rule="40.101.136.2" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.136.18" rule="40.101.136.18" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.136.242" rule="40.101.136.242" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.137.2" rule="40.101.137.2" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.137.18" rule="40.101.137.18" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.137.34" rule="40.101.137.34" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.137.50" rule="40.101.137.50" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.137.66" rule="40.101.137.66" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.137.82" rule="40.101.137.82" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.137.98" rule="40.101.137.98" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.138.2" rule="40.101.138.2" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.138.18" rule="40.101.138.18" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.101.138.210" rule="40.101.138.210" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.102.34.194" rule="40.102.34.194" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.112.72.19" rule="40.112.72.19" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.112.72.44" rule="40.112.72.44" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.112.75.175" rule="40.112.75.175" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.112.90.122" rule="40.112.90.122" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.112.91.29" rule="40.112.91.29" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.112.93.153" rule="40.112.93.153" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.113.0.16" rule="40.113.0.16" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.113.10.47" rule="40.113.10.47" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.113.97.222" rule="40.113.97.222" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.113.109.30" rule="40.113.109.30" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.113.225.85" rule="40.113.225.85" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.114.54.223" rule="40.114.54.223" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.114.140.1" rule="40.114.140.1" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.114.224.200" rule="40.114.224.200" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.114.241.141" rule="40.114.241.141" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.115.33.128" rule="40.115.33.128" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.115.56.78" rule="40.115.56.78" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.115.117.93" rule="40.115.117.93" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.117.96.136" rule="40.117.96.136" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.117.190.72" rule="40.117.190.72" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.118.61.1" rule="40.118.61.1" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.118.103.7" rule="40.118.103.7" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.118.106.130" rule="40.118.106.130" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.119.6.179" rule="40.119.6.179" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.119.249.228" rule="40.119.249.228" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.121.213.159" rule="40.121.213.159" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.122.160.14" rule="40.122.160.14" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.122.192.126" rule="40.122.192.126" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.124.168.44" rule="40.124.168.44" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.125.120.53" rule="40.125.120.53" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.1.128" rule="40.126.1.128" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.1.130" rule="40.126.1.130" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.1.142" rule="40.126.1.142" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.1.145" rule="40.126.1.145" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.1.166" rule="40.126.1.166" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.9.5" rule="40.126.9.5" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.9.6" rule="40.126.9.6" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.9.8" rule="40.126.9.8" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.9.66" rule="40.126.9.66" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.9.73" rule="40.126.9.73" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.9.77" rule="40.126.9.77" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.31.1" rule="40.126.31.1" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.31.4" rule="40.126.31.4" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.31.6" rule="40.126.31.6" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.31.8" rule="40.126.31.8" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.31.67" rule="40.126.31.67" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.31.69" rule="40.126.31.69" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.31.71" rule="40.126.31.71" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.31.73" rule="40.126.31.73" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.31.135" rule="40.126.31.135" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.31.137" rule="40.126.31.137" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.31.139" rule="40.126.31.139" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.31.141" rule="40.126.31.141" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.31.143" rule="40.126.31.143" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.31.163" rule="40.126.31.163" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.31.164" rule="40.126.31.164" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.32.68" rule="40.126.32.68" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.32.72" rule="40.126.32.72" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.32.74" rule="40.126.32.74" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.32.76" rule="40.126.32.76" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.32.133" rule="40.126.32.133" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.32.134" rule="40.126.32.134" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.32.136" rule="40.126.32.136" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.32.138" rule="40.126.32.138" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.126.32.140" rule="40.126.32.140" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.127.128.174" rule="40.127.128.174" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.127.142.76" rule="40.127.142.76" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.127.195.156" rule="40.127.195.156" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.127.240.158" rule="40.127.240.158" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_40.127.243.65" rule="40.127.243.65" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.11.168.160" rule="51.11.168.160" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.11.168.232" rule="51.11.168.232" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.104.15.252" rule="51.104.15.252" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.104.15.253" rule="51.104.15.253" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.104.139.180" rule="51.104.139.180" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.104.144.132" rule="51.104.144.132" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.104.146.109" rule="51.104.146.109" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.105.71.136" rule="51.105.71.136" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.105.71.137" rule="51.105.71.137" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.105.208.173" rule="51.105.208.173" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.105.236.244" rule="51.105.236.244" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.116.232.21" rule="51.116.232.21" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.124.78.146" rule="51.124.78.146" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.132.193.104" rule="51.132.193.104" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.132.193.105" rule="51.132.193.105" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.132.208.181" rule="51.132.208.181" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.136.15.177" rule="51.136.15.177" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.136.37.147" rule="51.136.37.147" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.137.137.111" rule="51.137.137.111" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.138.106.75" rule="51.138.106.75" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.140.65.84" rule="51.140.65.84" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.140.98.69" rule="51.140.98.69" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.140.127.197" rule="51.140.127.197" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.141.26.229" rule="51.141.26.229" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.141.32.51" rule="51.141.32.51" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.141.118.220" rule="51.141.118.220" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.141.166.104" rule="51.141.166.104" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.143.49.132" rule="51.143.49.132" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.144.108.120" rule="51.144.108.120" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.144.113.175" rule="51.144.113.175" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_51.145.123.29" rule="51.145.123.29" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.129.66" rule="52.97.129.66" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.129.226" rule="52.97.129.226" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.129.242" rule="52.97.129.242" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.133.146" rule="52.97.133.146" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.133.162" rule="52.97.133.162" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.133.178" rule="52.97.133.178" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.133.194" rule="52.97.133.194" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.133.210" rule="52.97.133.210" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.133.226" rule="52.97.133.226" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.133.242" rule="52.97.133.242" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.135.114" rule="52.97.135.114" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.144.2" rule="52.97.144.2" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.146.34" rule="52.97.146.34" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.146.130" rule="52.97.146.130" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.146.162" rule="52.97.146.162" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.146.194" rule="52.97.146.194" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.146.210" rule="52.97.146.210" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.150.2" rule="52.97.150.2" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.151.50" rule="52.97.151.50" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.151.82" rule="52.97.151.82" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.152.114" rule="52.97.152.114" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.155.114" rule="52.97.155.114" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.158.162" rule="52.97.158.162" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.163.2" rule="52.97.163.2" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.170.34" rule="52.97.170.34" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.171.194" rule="52.97.171.194" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.179.194" rule="52.97.179.194" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.179.226" rule="52.97.179.226" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.179.242" rule="52.97.179.242" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.186.114" rule="52.97.186.114" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.188.66" rule="52.97.188.66" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.189.98" rule="52.97.189.98" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.200.130" rule="52.97.200.130" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.200.146" rule="52.97.200.146" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.200.178" rule="52.97.200.178" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.201.2" rule="52.97.201.2" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.201.18" rule="52.97.201.18" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.201.34" rule="52.97.201.34" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.201.50" rule="52.97.201.50" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.201.66" rule="52.97.201.66" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.201.98" rule="52.97.201.98" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.208.18" rule="52.97.208.18" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.208.50" rule="52.97.208.50" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.211.66" rule="52.97.211.66" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.211.82" rule="52.97.211.82" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.211.98" rule="52.97.211.98" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.211.114" rule="52.97.211.114" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.211.130" rule="52.97.211.130" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.211.146" rule="52.97.211.146" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.211.162" rule="52.97.211.162" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.211.178" rule="52.97.211.178" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.211.194" rule="52.97.211.194" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.211.210" rule="52.97.211.210" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.211.226" rule="52.97.211.226" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.211.242" rule="52.97.211.242" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.212.82" rule="52.97.212.82" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.212.98" rule="52.97.212.98" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.212.114" rule="52.97.212.114" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.215.98" rule="52.97.215.98" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.219.194" rule="52.97.219.194" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.219.210" rule="52.97.219.210" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.219.226" rule="52.97.219.226" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.219.242" rule="52.97.219.242" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.232.194" rule="52.97.232.194" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.233.2" rule="52.97.233.2" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.233.18" rule="52.97.233.18" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.233.34" rule="52.97.233.34" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.233.50" rule="52.97.233.50" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.233.66" rule="52.97.233.66" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.233.82" rule="52.97.233.82" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.233.98" rule="52.97.233.98" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.233.114" rule="52.97.233.114" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.241.162" rule="52.97.241.162" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.241.178" rule="52.97.241.178" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.250.194" rule="52.97.250.194" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.97.250.226" rule="52.97.250.226" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.98.5.194" rule="52.98.5.194" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.98.42.194" rule="52.98.42.194" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.98.66.98" rule="52.98.66.98" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.98.145.66" rule="52.98.145.66" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.98.145.82" rule="52.98.145.82" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.98.145.98" rule="52.98.145.98" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.98.145.114" rule="52.98.145.114" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.98.151.226" rule="52.98.151.226" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.98.151.242" rule="52.98.151.242" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.98.207.130" rule="52.98.207.130" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.98.207.146" rule="52.98.207.146" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.98.207.162" rule="52.98.207.162" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.8.19" rule="52.109.8.19" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.8.20" rule="52.109.8.20" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.8.21" rule="52.109.8.21" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.12.18" rule="52.109.12.18" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.12.19" rule="52.109.12.19" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.12.20" rule="52.109.12.20" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.12.21" rule="52.109.12.21" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.12.22" rule="52.109.12.22" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.12.23" rule="52.109.12.23" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.12.24" rule="52.109.12.24" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.28.63" rule="52.109.28.63" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.28.107" rule="52.109.28.107" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.32.23" rule="52.109.32.23" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.32.63" rule="52.109.32.63" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.68.14" rule="52.109.68.14" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.68.21" rule="52.109.68.21" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.76.8" rule="52.109.76.8" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.76.30" rule="52.109.76.30" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.76.31" rule="52.109.76.31" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.76.32" rule="52.109.76.32" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.76.33" rule="52.109.76.33" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.76.34" rule="52.109.76.34" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.76.35" rule="52.109.76.35" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.76.36" rule="52.109.76.36" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.76.40" rule="52.109.76.40" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.76.68" rule="52.109.76.68" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.76.124" rule="52.109.76.124" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.88.6" rule="52.109.88.6" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.88.10" rule="52.109.88.10" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.88.34" rule="52.109.88.34" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.88.35" rule="52.109.88.35" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.88.36" rule="52.109.88.36" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.88.37" rule="52.109.88.37" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.88.38" rule="52.109.88.38" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.88.39" rule="52.109.88.39" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.88.40" rule="52.109.88.40" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.88.44" rule="52.109.88.44" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.88.174" rule="52.109.88.174" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.120.17" rule="52.109.120.17" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.120.18" rule="52.109.120.18" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.120.19" rule="52.109.120.19" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.120.20" rule="52.109.120.20" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.120.21" rule="52.109.120.21" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.120.22" rule="52.109.120.22" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.120.23" rule="52.109.120.23" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.124.18" rule="52.109.124.18" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.124.19" rule="52.109.124.19" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.124.20" rule="52.109.124.20" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.124.21" rule="52.109.124.21" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.124.22" rule="52.109.124.22" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.124.23" rule="52.109.124.23" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.109.124.24" rule="52.109.124.24" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.113.194.131" rule="52.113.194.131" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.113.194.132" rule="52.113.194.132" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.113.195.132" rule="52.113.195.132" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.113.196.254" rule="52.113.196.254" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.6.46" rule="52.114.6.46" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.6.47" rule="52.114.6.47" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.7.36" rule="52.114.7.36" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.7.37" rule="52.114.7.37" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.7.38" rule="52.114.7.38" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.7.39" rule="52.114.7.39" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.20.14" rule="52.114.20.14" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.20.18" rule="52.114.20.18" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.32.5" rule="52.114.32.5" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.32.6" rule="52.114.32.6" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.32.7" rule="52.114.32.7" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.32.8" rule="52.114.32.8" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.32.24" rule="52.114.32.24" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.32.25" rule="52.114.32.25" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.36.1" rule="52.114.36.1" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.36.2" rule="52.114.36.2" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.36.3" rule="52.114.36.3" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.36.4" rule="52.114.36.4" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.74.43" rule="52.114.74.43" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.74.44" rule="52.114.74.44" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.74.45" rule="52.114.74.45" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.75.78" rule="52.114.75.78" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.75.79" rule="52.114.75.79" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.75.149" rule="52.114.75.149" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.75.150" rule="52.114.75.150" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.76.34" rule="52.114.76.34" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.76.35" rule="52.114.76.35" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.76.37" rule="52.114.76.37" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.77.33" rule="52.114.77.33" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.77.34" rule="52.114.77.34" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.77.137" rule="52.114.77.137" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.77.164" rule="52.114.77.164" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.88.19" rule="52.114.88.19" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.88.20" rule="52.114.88.20" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.88.21" rule="52.114.88.21" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.88.22" rule="52.114.88.22" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.88.28" rule="52.114.88.28" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.88.29" rule="52.114.88.29" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.128.7" rule="52.114.128.7" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.128.8" rule="52.114.128.8" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.128.9" rule="52.114.128.9" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.128.10" rule="52.114.128.10" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.128.43" rule="52.114.128.43" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.128.44" rule="52.114.128.44" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.128.58" rule="52.114.128.58" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.128.69" rule="52.114.128.69" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.128.70" rule="52.114.128.70" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.128.71" rule="52.114.128.71" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.128.72" rule="52.114.128.72" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.128.73" rule="52.114.128.73" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.128.74" rule="52.114.128.74" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.128.75" rule="52.114.128.75" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.132.11" rule="52.114.132.11" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.132.12" rule="52.114.132.12" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.132.14" rule="52.114.132.14" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.132.20" rule="52.114.132.20" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.132.21" rule="52.114.132.21" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.132.22" rule="52.114.132.22" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.132.23" rule="52.114.132.23" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.132.34" rule="52.114.132.34" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.132.47" rule="52.114.132.47" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.132.73" rule="52.114.132.73" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.132.74" rule="52.114.132.74" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.132.91" rule="52.114.132.91" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.133.60" rule="52.114.133.60" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.133.61" rule="52.114.133.61" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.158.50" rule="52.114.158.50" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.158.51" rule="52.114.158.51" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.158.52" rule="52.114.158.52" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.158.53" rule="52.114.158.53" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.158.91" rule="52.114.158.91" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.158.92" rule="52.114.158.92" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.158.102" rule="52.114.158.102" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.159.22" rule="52.114.159.22" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.159.23" rule="52.114.159.23" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.159.32" rule="52.114.159.32" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.159.33" rule="52.114.159.33" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.159.34" rule="52.114.159.34" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.159.35" rule="52.114.159.35" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.114.159.112" rule="52.114.159.112" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.136.230.174" rule="52.136.230.174" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.138.148.87" rule="52.138.148.87" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.138.148.89" rule="52.138.148.89" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.138.148.159" rule="52.138.148.159" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.138.216.83" rule="52.138.216.83" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.142.80.173" rule="52.142.80.173" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.142.84.61" rule="52.142.84.61" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.142.114.2" rule="52.142.114.2" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.142.114.176" rule="52.142.114.176" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.142.119.134" rule="52.142.119.134" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.154.66.52" rule="52.154.66.52" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.154.67.2" rule="52.154.67.2" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.154.67.56" rule="52.154.67.56" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.155.172.105" rule="52.155.172.105" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.156.41.171" rule="52.156.41.171" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.156.48.67" rule="52.156.48.67" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.156.146.245" rule="52.156.146.245" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.156.196.151" rule="52.156.196.151" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.156.204.185" rule="52.156.204.185" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.158.24.209" rule="52.158.24.209" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.158.24.229" rule="52.158.24.229" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.158.25.39" rule="52.158.25.39" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.158.238.42" rule="52.158.238.42" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.159.49.192" rule="52.159.49.192" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.163.118.68" rule="52.163.118.68" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.164.191.55" rule="52.164.191.55" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.164.227.208" rule="52.164.227.208" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.164.251.44" rule="52.164.251.44" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.165.136.32" rule="52.165.136.32" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.166.110.64" rule="52.166.110.64" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.166.110.215" rule="52.166.110.215" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.166.120.77" rule="52.166.120.77" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.167.18.95" rule="52.167.18.95" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.167.88.112" rule="52.167.88.112" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.167.249.196" rule="52.167.249.196" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.168.24.174" rule="52.168.24.174" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.168.112.66" rule="52.168.112.66" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.168.112.67" rule="52.168.112.67" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.168.117.169" rule="52.168.117.169" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.168.117.170" rule="52.168.117.170" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.168.117.173" rule="52.168.117.173" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.169.71.150" rule="52.169.71.150" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.170.57.27" rule="52.170.57.27" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.170.194.77" rule="52.170.194.77" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.171.136.200" rule="52.171.136.200" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.173.152.64" rule="52.173.152.64" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.175.30.196" rule="52.175.30.196" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.176.224.96" rule="52.176.224.96" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.178.17.2" rule="52.178.17.2" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.178.17.3" rule="52.178.17.3" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.178.161.41" rule="52.178.161.41" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.178.163.85" rule="52.178.163.85" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.178.178.16" rule="52.178.178.16" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.178.182.73" rule="52.178.182.73" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.178.193.116" rule="52.178.193.116" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.179.13.204" rule="52.179.13.204" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.182.143.208" rule="52.182.143.208" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.182.143.210" rule="52.182.143.210" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.182.143.211" rule="52.182.143.211" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.182.143.212" rule="52.182.143.212" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.183.24.194" rule="52.183.24.194" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.183.104.36" rule="52.183.104.36" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.184.81.210" rule="52.184.81.210" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.184.82.129" rule="52.184.82.129" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.184.92.48" rule="52.184.92.48" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.184.168.116" rule="52.184.168.116" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.184.220.11" rule="52.184.220.11" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.186.25.68" rule="52.186.25.68" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.188.77.27" rule="52.188.77.27" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.224.75.92" rule="52.224.75.92" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.225.136.36" rule="52.225.136.36" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.225.255.33" rule="52.225.255.33" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.230.10.183" rule="52.230.10.183" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.230.240.94" rule="52.230.240.94" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.231.32.10" rule="52.231.32.10" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.232.16.77" rule="52.232.16.77" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.232.19.76" rule="52.232.19.76" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.232.69.150" rule="52.232.69.150" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.233.164.195" rule="52.233.164.195" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.233.199.249" rule="52.233.199.249" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.137.4" rule="52.239.137.4" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.150.170" rule="52.239.150.170" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.151.138" rule="52.239.151.138" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.151.170" rule="52.239.151.170" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.156.2" rule="52.239.156.2" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.156.2" rule="52.239.156.2" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.156.74" rule="52.239.156.74" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.156.138" rule="52.239.156.138" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.157.138" rule="52.239.157.138" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.157.202" rule="52.239.157.202" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.172.132" rule="52.239.172.132" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.172.164" rule="52.239.172.164" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.174.4" rule="52.239.174.4" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.174.132" rule="52.239.174.132" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.174.196" rule="52.239.174.196" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.174.228" rule="52.239.174.228" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.175.4" rule="52.239.175.4" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.175.68" rule="52.239.175.68" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.177.36" rule="52.239.177.36" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.177.68" rule="52.239.177.68" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.177.100" rule="52.239.177.100" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.177.228" rule="52.239.177.228" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.184.10" rule="52.239.184.10" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.184.42" rule="52.239.184.42" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.198.228" rule="52.239.198.228" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.207.100" rule="52.239.207.100" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.222.100" rule="52.239.222.100" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.223.19" rule="52.239.223.19" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.223.132" rule="52.239.223.132" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.234.100" rule="52.239.234.100" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.234.228" rule="52.239.234.228" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.239.235.100" rule="52.239.235.100" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.247.37.26" rule="52.247.37.26" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_52.255.148.73" rule="52.255.148.73" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_64.4.16.212" rule="64.4.16.212" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_64.4.16.214" rule="64.4.16.214" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_64.4.16.216" rule="64.4.16.216" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_64.4.16.218" rule="64.4.16.218" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_64.4.23.0-64.4.23.255" rule="64.4.23.0-64.4.23.255" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_64.4.54.18" rule="64.4.54.18" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_64.4.54.22" rule="64.4.54.22" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_64.4.54.253" rule="64.4.54.253" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_64.4.54.254" rule="64.4.54.254" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_65.52.98.231" rule="65.52.98.231" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_65.52.226.14" rule="65.52.226.14" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_65.54.187.128" rule="65.54.187.128" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_65.54.187.130" rule="65.54.187.130" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_65.54.187.131" rule="65.54.187.131" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_65.54.187.132" rule="65.54.187.132" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_65.54.187.134" rule="65.54.187.134" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_65.54.198.196" rule="65.54.198.196" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_65.55.44.51" rule="65.55.44.51" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_65.55.44.54" rule="65.55.44.54" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_65.55.44.108" rule="65.55.44.108" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_65.55.44.109" rule="65.55.44.109" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_65.55.108.23" rule="65.55.108.23" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_65.55.130.50" rule="65.55.130.50" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_65.55.223.0-65.55.223.255" rule="65.55.223.0-65.55.223.255" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.40.144.210" rule="104.40.144.210" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.40.159.215" rule="104.40.159.215" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.40.210.32" rule="104.40.210.32" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.40.211.35" rule="104.40.211.35" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.41.219.140" rule="104.41.219.140" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.42.41.237" rule="104.42.41.237" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.42.191.226" rule="104.42.191.226" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.43.203.255" rule="104.43.203.255" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.44.80.172" rule="104.44.80.172" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.44.88.24" rule="104.44.88.24" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.44.88.28" rule="104.44.88.28" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.44.88.103" rule="104.44.88.103" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.45.18.177" rule="104.45.18.177" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.46.91.34" rule="104.46.91.34" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.208.16.88" rule="104.208.16.88" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.208.16.89" rule="104.208.16.89" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.208.16.90" rule="104.208.16.90" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.208.16.94" rule="104.208.16.94" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.208.248.16" rule="104.208.248.16" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.209.172.133" rule="104.209.172.133" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.210.62.125" rule="104.210.62.125" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.211.73.16" rule="104.211.73.16" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.211.91.221" rule="104.211.91.221" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.211.93.71" rule="104.211.93.71" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.211.96.15" rule="104.211.96.15" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.212.67.88" rule="104.212.67.88" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.212.67.92" rule="104.212.67.92" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.212.67.142" rule="104.212.67.142" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.212.67.154" rule="104.212.67.154" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.212.67.162" rule="104.212.67.162" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.212.67.168" rule="104.212.67.168" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.212.67.187" rule="104.212.67.187" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.212.67.188" rule="104.212.67.188" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.212.67.223" rule="104.212.67.223" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.212.67.234" rule="104.212.67.234" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.212.67.245" rule="104.212.67.245" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.214.77.221" rule="104.214.77.221" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.214.150.122" rule="104.214.150.122" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.214.220.181" rule="104.214.220.181" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_104.215.146.200" rule="104.215.146.200" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_131.253.14.227" rule="131.253.14.227" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_131.253.14.229" rule="131.253.14.229" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_131.253.14.230" rule="131.253.14.230" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_131.253.14.231" rule="131.253.14.231" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_131.253.33.200" rule="131.253.33.200" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_131.253.33.203" rule="131.253.33.203" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_131.253.33.219" rule="131.253.33.219" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_131.253.33.254" rule="131.253.33.254" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_131.253.61.0-131.253.61.255" rule="131.253.61.0-131.253.61.255" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_134.170.178.97" rule="134.170.178.97" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_134.170.185.70" rule="134.170.185.70" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_134.170.188.248" rule="134.170.188.248" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_137.116.44.10" rule="137.116.44.10" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_137.116.234.82" rule="137.116.234.82" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_137.117.142.136" rule="137.117.142.136" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_137.117.144.39" rule="137.117.144.39" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_137.117.228.253" rule="137.117.228.253" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_137.117.235.16" rule="137.117.235.16" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_137.117.243.30" rule="137.117.243.30" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_137.135.251.63" rule="137.135.251.63" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_138.91.122.49" rule="138.91.122.49" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_138.91.136.108" rule="138.91.136.108" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_138.91.140.216" rule="138.91.140.216" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_138.91.141.104" rule="138.91.141.104" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_157.55.56.0-157.55.56.255" rule="157.55.56.0-157.55.56.255" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_157.55.109.7" rule="157.55.109.7" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_157.55.109.224" rule="157.55.109.224" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_157.55.109.226" rule="157.55.109.226" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_157.55.109.228" rule="157.55.109.228" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_157.55.109.230" rule="157.55.109.230" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_157.55.109.232" rule="157.55.109.232" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_157.55.129.21" rule="157.55.129.21" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_157.55.134.136" rule="157.55.134.136" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_157.55.134.138" rule="157.55.134.138" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_157.55.134.140" rule="157.55.134.140" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_157.55.134.142" rule="157.55.134.142" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_157.55.135.128" rule="157.55.135.128" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_157.55.135.130" rule="157.55.135.130" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_157.55.135.132" rule="157.55.135.132" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_157.55.135.134" rule="157.55.135.134" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_157.56.57.5" rule="157.56.57.5" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_168.62.57.154" rule="168.62.57.154" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_168.62.58.130" rule="168.62.58.130" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_168.62.200.169" rule="168.62.200.169" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_168.63.18.79" rule="168.63.18.79" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_168.63.67.155" rule="168.63.67.155" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_168.63.102.42" rule="168.63.102.42" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_191.237.208.126" rule="191.237.208.126" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_191.239.213.197" rule="191.239.213.197" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_204.79.197.0-204.79.197.255" rule="204.79.197.0-204.79.197.255" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_204.152.141.244" rule="204.152.141.244" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_207.46.7.252" rule="207.46.7.252" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_207.46.26.12" rule="207.46.26.12" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_207.46.26.14" rule="207.46.26.14" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_207.46.26.16" rule="207.46.26.16" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_207.46.26.18" rule="207.46.26.18" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_207.46.101.29" rule="207.46.101.29" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_207.46.153.155" rule="207.46.153.155" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_207.46.194.14" rule="207.46.194.14" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_207.46.194.25" rule="207.46.194.25" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_207.46.194.33" rule="207.46.194.33" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_207.46.194.40" rule="207.46.194.40" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> <item name="extra_207.46.223.94" rule="207.46.223.94" dir="0" protocol="0" version="0" is_block="1" is_enabled="1" /> </root> ```
/content/code_sandbox/data/simplewall/extra/blocklist.xml
xml
2016-03-04T21:03:47
2024-08-16T13:23:49
WindowsSpyBlocker
crazy-max/WindowsSpyBlocker
4,569
46,472
```xml <vector xmlns:android="path_to_url" android:width="96dp" android:height="96dp" android:viewportWidth="96" android:viewportHeight="96"> <path android:pathData="m12.7838,13.644c0,0 2.5047,-3.2413 13.5547,1.768C35.0311,19.39 11.0158,30.7347 8.6585,26.02 7.1852,23.2207 12.7838,13.644 12.7838,13.644" android:fillColor="#a8d600"/> <path android:pathData="M78.1997,50.33C64.6451,40.9007 50.5011,12.9074 48.7331,12.9074c-5.0093,0 -8.2507,1.9153 -8.2507,1.9153l32.266,46.8519c0,0.1473 7.2193,-10.166 5.4513,-11.3447" android:fillColor="#5b636b"/> <path android:pathData="M84.8297,54.75C82.7671,52.982 76.8737,51.8033 75.2531,50.1827 69.0651,43.4053 56.0998,31.4713 45.0498,11.2867 41.0718,3.7727 22.6551,16.8854 22.6551,16.8854L54.7738,68.01c0.2947,0 37.7173,-6.9247 30.056,-13.26" android:fillColor="#333"/> <path android:pathData="M55.9524,64.7686C57.8678,63.148 57.7204,54.308 56.0998,52.098 46.0811,37.6593 29.5798,15.854 23.0971,15.854c-6.7773,0 -7.956,9.1347 -11.7867,9.1347 -3.2413,0 1.326,-11.492 1.326,-11.492 -6.188,6.9247 -7.2193,29.0246 -7.2193,29.0246 0,0 26.2253,43.1686 50.5353,22.2473" android:fillColor="#5b636b"/> <path android:pathData="m5.5645,40.606c0,0 -0.5893,-5.746 1.9153,-13.4073 0.1473,8.6927 5.5987,10.7553 4.1253,22.2473l-6.0407,-8.84" android:fillColor="#69727a"/> <path android:pathData="m34.2945,67.2733c6.7773,-15.7646 35.9493,0.1473 50.5353,-12.5233 2.3573,0.2947 7.072,8.398 7.072,8.398 0,0 -5.304,21.216 -57.6073,4.1253" android:fillColor="#69727a"/> <path android:pathData="m5.5645,39.8693c-1.4733,0 -1.1787,10.166 0,11.7867 7.8087,9.724 15.912,12.2287 26.6673,25.194 12.9653,15.47 60.7013,8.1033 60.7013,-5.1567 0,-10.9027 -1.326,-9.8713 -1.326,-9.8713 -3.3887,8.84 -33.592,10.7553 -44.6419,8.398C22.6551,65.2106 7.1852,39.8693 5.5645,39.8693" android:fillColor="#d0d0d0"/> <path android:pathData="M32.8833,39.3611a2.961,3.5954 0,1 0,5.9219 0a2.961,3.5954 0,1 0,-5.9219 0z" android:fillColor="#333"/> <path android:pathData="M26.3564,30.1838a2.961,3.5954 0,1 0,5.9219 0a2.961,3.5954 0,1 0,-5.9219 0z" android:fillColor="#333"/> <path android:pathData="M39.2726,47.7794a2.961,3.5954 0,1 0,5.9219 0a2.961,3.5954 0,1 0,-5.9219 0z" android:fillColor="#333"/> <path android:pathData="M45.9241,55.0994a2.961,3.5954 0,1 0,5.9219 0a2.961,3.5954 0,1 0,-5.9219 0z" android:fillColor="#333"/> <path android:pathData="m50.6484,57.5493c-0.2947,0 -0.7367,-0.1473 -1.0313,-0.442 -0.5893,-0.7367 -0.5893,-1.768 0,-2.5047 0.2947,-0.442 8.2507,-9.724 23.2786,-9.724 0.7367,0 1.4733,0.7367 1.4733,1.768 0,0.884 -0.5893,1.768 -1.4733,1.768 -13.8493,0 -21.216,8.6927 -21.3633,8.6927 -0.1473,0.2947 -0.442,0.442 -0.884,0.442" android:fillColor="#a8d600"/> <path android:pathData="m44.0944,49.33c-0.2947,0 -0.5893,-0.1473 -0.884,-0.442 -0.5893,-0.5893 -0.7367,-1.6207 -0.2947,-2.3573 0.2947,-0.442 6.4827,-9.724 23.868,-9.724 0.7367,0 1.4733,0.7367 1.4733,1.768 0,0.884 -0.5893,1.768 -1.4733,1.768 -15.7646,0 -21.5106,8.398 -21.658,8.398 -0.1473,0.2947 -0.5893,0.5893 -1.0313,0.5893" android:fillColor="#a8d600"/> <path android:pathData="m37.6878,40.767c-0.2947,0 -0.7367,-0.1473 -1.0313,-0.442 -0.5893,-0.5893 -0.5893,-1.768 -0.1473,-2.5047 7.072,-9.4293 23.7206,-9.5767 24.4573,-9.5767 0.7367,0 1.4733,0.7367 1.4733,1.768 0,0.884 -0.5893,1.768 -1.4733,1.768 -0.1473,0 -16.0593,0.1473 -22.3946,8.398 -0.1473,0.442 -0.5893,0.5893 -0.884,0.5893" android:fillColor="#a8d600"/> <path android:pathData="m31.1115,31.0163c-0.442,0 -0.884,-0.2947 -1.1787,-0.7367 -0.442,-0.7367 -0.2947,-1.9153 0.2947,-2.3573 0.2947,-0.2947 8.84,-7.8087 24.752,-7.8087 0.7367,0 1.4733,0.7367 1.4733,1.768 0,1.0313 -0.5893,1.768 -1.4733,1.768 -14.8806,0 -22.984,7.072 -22.984,7.2193 -0.2947,0.1473 -0.5893,0.1473 -0.884,0.1473" android:fillColor="#a8d600"/> </vector> ```
/content/code_sandbox/app/src/main/res/drawable/ic_recycling_shoes.xml
xml
2016-07-02T10:44:04
2024-08-16T18:55:54
StreetComplete
streetcomplete/StreetComplete
3,781
2,169
```xml <class_libraries> <library path="libmoveit_ros_control_interface_trajectory_plugin"> <class name="position_controllers/JointTrajectoryController" type="moveit_ros_control_interface::JointTrajectoryControllerAllocator" base_class_type="moveit_ros_control_interface::ControllerHandleAllocator"> <description></description> </class> <class name="velocity_controllers/JointTrajectoryController" type="moveit_ros_control_interface::JointTrajectoryControllerAllocator" base_class_type="moveit_ros_control_interface::ControllerHandleAllocator"> <description></description> </class> <class name="effort_controllers/JointTrajectoryController" type="moveit_ros_control_interface::JointTrajectoryControllerAllocator" base_class_type="moveit_ros_control_interface::ControllerHandleAllocator"> <description></description> </class> <class name="pos_vel_controllers/JointTrajectoryController" type="moveit_ros_control_interface::JointTrajectoryControllerAllocator" base_class_type="moveit_ros_control_interface::ControllerHandleAllocator"> <description></description> </class> <class name="pos_vel_acc_controllers/JointTrajectoryController" type="moveit_ros_control_interface::JointTrajectoryControllerAllocator" base_class_type="moveit_ros_control_interface::ControllerHandleAllocator"> <description></description> </class> </library> </class_libraries> ```
/content/code_sandbox/moveit_plugins/moveit_ros_control_interface/moveit_ros_control_interface_plugins.xml
xml
2016-07-27T20:38:09
2024-08-15T02:08:44
moveit
moveit/moveit
1,626
292
```xml export * from './FileSystem'; export * from './FileSystem.types'; //# sourceMappingURL=index.d.ts.map ```
/content/code_sandbox/packages/expo-file-system/build/index.d.ts
xml
2016-08-15T17:14:25
2024-08-16T19:54:44
expo
expo/expo
32,004
20
```xml /** * @license * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at path_to_url */ import { Path, basename, dirname, join, normalize } from '@angular-devkit/core'; export interface Location { name: string; path: Path; } export function parseName(path: string, name: string): Location { const nameWithoutPath = basename(normalize(name)); const namePath = dirname(join(normalize(path), name)); return { name: nameWithoutPath, path: normalize('/' + namePath), }; } ```
/content/code_sandbox/npm/ng-packs/packages/schematics/src/utils/angular/parse-name.ts
xml
2016-12-03T22:56:24
2024-08-16T16:24:05
abp
abpframework/abp
12,657
131
```xml <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net9.0-android</TargetFramework> <SupportedOSPlatformVersion>SUPPORTED_OS_PLATFORM_VERSION</SupportedOSPlatformVersion> <RootNamespace Condition="'$(name)' != '$(name{-VALUE-FORMS-}safe_namespace)'">AndroidApp1</RootNamespace> <OutputType>Exe</OutputType> <Nullable>enable</Nullable> <ImplicitUsings>enable</ImplicitUsings> <ApplicationId>com.companyname.AndroidApp1</ApplicationId> <ApplicationVersion>1</ApplicationVersion> <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion> </PropertyGroup> <!-- Enable full trimming in Release mode. To learn more, see: path_to_url#trimming-granularity --> <PropertyGroup Condition="'$(Configuration)' == 'Release'"> <TrimMode>full</TrimMode> </PropertyGroup> </Project> ```
/content/code_sandbox/src/Microsoft.Android.Templates/android/AndroidApp1.csproj
xml
2016-03-30T15:37:14
2024-08-16T19:22:13
android
dotnet/android
1,905
213
```xml import * as React from 'react' import { IAPIWorkflowJobStep } from '../../lib/api' import { isFailure } from '../../lib/ci-checks/ci-checks' import { CICheckRunActionsJobStepListItem } from './ci-check-run-actions-job-step-item' interface ICICheckRunActionsJobStepListsProps { /** The action jobs steps of a check run **/ readonly steps: ReadonlyArray<IAPIWorkflowJobStep> /** Callback to open a job steps link on dotcom*/ readonly onViewJobStep: (step: IAPIWorkflowJobStep) => void } interface ICICheckRunActionsJobStepListsState { readonly firstFailedStep: IAPIWorkflowJobStep | undefined } /** The CI check list item. */ export class CICheckRunActionsJobStepList extends React.PureComponent< ICICheckRunActionsJobStepListsProps, ICICheckRunActionsJobStepListsState > { public constructor(props: ICICheckRunActionsJobStepListsProps) { super(props) this.state = { firstFailedStep: this.props.steps.find(isFailure), } } public componentDidUpdate() { this.setState({ firstFailedStep: this.props.steps.find(isFailure), }) } public render() { const { steps } = this.props const jobSteps = steps.map((step, i) => { return ( <CICheckRunActionsJobStepListItem key={i} step={step} firstFailedStep={this.state.firstFailedStep} onViewJobStepExternally={this.props.onViewJobStep} /> ) }) return <ul className="ci-check-run-job-steps-list">{jobSteps}</ul> } } ```
/content/code_sandbox/app/src/ui/check-runs/ci-check-run-actions-job-step-list.tsx
xml
2016-05-11T15:59:00
2024-08-16T17:00:41
desktop
desktop/desktop
19,544
371
```xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="path_to_url" android:layout_width="50dp" android:layout_height="50dp" android:background="@drawable/bg_item" android:gravity="center" android:orientation="vertical"> <TextView android:id="@+id/date" android:textSize="12sp" android:textColor="@color/text_gray_666666" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:id="@+id/week" android:textSize="12sp" android:textColor="@color/text_gray_666666" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> ```
/content/code_sandbox/app/src/main/res/layout/listitem_date_info.xml
xml
2016-11-28T06:41:44
2024-07-02T03:09:32
ScrollablePanel
Kelin-Hong/ScrollablePanel
2,079
173
```xml import {css, html, LitElement, PropertyValues, TemplateResult} from "lit"; import {customElement, property} from "lit/decorators.js"; import {AssetDescriptor, JsonRule, LogicGroup, LogicGroupOperator, RuleCondition, WellknownAssets, AssetTypeInfo, Asset} from "@openremote/model"; import {OrRulesRuleUnsupportedEvent, RulesConfig} from "../index"; import {buttonStyle} from "../style"; import "./or-rule-condition"; import i18next from "i18next"; import {InputType} from "@openremote/or-mwc-components/or-mwc-input"; import {OrRulesJsonRuleChangedEvent} from "./or-rule-json-viewer"; import {getWhenTypesMenu, updateRuleConditionType} from "./or-rule-condition"; import {getContentWithMenuTemplate} from "@openremote/or-mwc-components/or-mwc-menu"; import { translate } from "@openremote/or-translate"; enum ResetOption { NO_LONGER_MATCHES = "noLongerMatches", VALUE_CHANGES = "valueChanges" } // language=CSS const style = css` :host { display: block; } ${buttonStyle} .rule-group-items { display: flex; flex-direction: column; } .rule-group .rule-group-items > div { margin: 10px 0; } .rule-condition { display: flex; padding-right: 5px; } .rule-condition > * { flex-grow: 0; } .rule-condition > or-rule-condition { flex-grow: 1; } or-rule-condition { margin-bottom: 10px; } .rule-group-item > or-icon { padding-left: 17px; } or-icon.small { --or-icon-width: 14px; --or-icon-height: 14px; } or-panel { margin: 10px 10px 20px 10px; position: relative; } or-panel > .remove-button { position: absolute; right: 0; top: 0; width: 24px; height: 24px; transform: translate(50%, -50%); } .rule-condition:hover .button-clear { visibility: visible; } or-panel:hover .remove-button.button-clear { visibility: visible; } .add-button-wrapper { display: flex; align-items: center; white-space: nowrap; } .add-button-wrapper > * { margin-right: 6px; } .add-button-wrapper or-mwc-menu { text-transform: capitalize; } strong { margin: var(--internal-or-panel-heading-margin); font-size: var(--internal-or-panel-heading-font-size); } `; @customElement("or-rule-when") class OrRuleWhen extends translate(i18next)(LitElement) { static get styles() { return style; } @property({type: Object}) public rule?: JsonRule; @property({type: Boolean}) public readonly?: boolean; @property({type: Object}) public assetProvider?: (type: string) => Promise<Asset[]> public config?: RulesConfig; @property({type: Object, attribute: false}) public assetInfos?: AssetTypeInfo[]; protected ruleGroupTemplate(group: LogicGroup<RuleCondition>, parentGroup?: LogicGroup<RuleCondition>): TemplateResult | undefined { if (!group) { return html``; } const isTopLevel = !parentGroup; const showAddCondition = !this.readonly && (!this.config || !this.config.controls || this.config.controls.hideWhenAddCondition !== true); const showRemoveCondition = !this.readonly; const showRemoveGroup = !this.readonly; let wrapper: (content: TemplateResult, item: LogicGroup<RuleCondition> | RuleCondition, parent: LogicGroup<RuleCondition>, isGroup: boolean, isFirst: boolean) => TemplateResult; if (isTopLevel) { wrapper = (content, item, parent, isGroup, isFirst) => { return html` <or-panel .heading="${i18next.t(isFirst ? "when" : "orWhen")}..."> ${showRemoveGroup ? html` <button class="button-clear remove-button" @click="${() => this.removeItem(item, parent, isGroup)}"> <or-icon icon="close-circle"></or-icon> </button> ` : ``} ${content} </or-panel>`; }; } else { wrapper = (content, item, parent, isGroup, isFirst) => { return html` ${!isFirst ? html` <or-icon class="small" icon="ampersand"></or-icon> ` : ``} ${content} `; return content; } } let groupsTemplate: TemplateResult | string = ``; let itemsTemplate: TemplateResult | string = ``; let addTemplate: TemplateResult | string = ``; let isFirst = true; if (group.groups && group.groups.length > 0) { groupsTemplate = html` ${group.groups.map((childGroup: LogicGroup<RuleCondition>, index) => { const content = html` <div class="rule-group-item"> ${this.ruleGroupTemplate(childGroup, group)} </div> `; return wrapper(content, childGroup, group, true, index == 0); })} `; isFirst = false; } if (group.items && group.items.length > 0) { itemsTemplate = html` ${group.items.map((condition: RuleCondition, index) => { const content = html` <div class="rule-group-item"> <div class="rule-condition"> <or-rule-condition .config="${this.config}" .assetInfos="${this.assetInfos}" .ruleCondition="${condition}" .readonly="${this.readonly}" .assetProvider="${this.assetProvider}"></or-rule-condition> ${showRemoveGroup ? html` <button class="button-clear ${showRemoveCondition ? "" : "hidden"}" @click="${() => this.removeItem(condition, group, false)}"><or-icon icon="close-circle"></or-icon></input> ` : ``} </div> </div> `; return wrapper(content, condition, group, true, isFirst && index === 0); })} `; isFirst = false; } if (!isTopLevel && showAddCondition) { addTemplate = html` <span class="add-button-wrapper"> ${getContentWithMenuTemplate( html`<or-mwc-input class="plus-button" type="${InputType.BUTTON}" icon="plus" .label="${i18next.t("rulesEditorAddCondition")}"></or-mwc-input>`, getWhenTypesMenu(this.config, this.assetInfos), undefined, (value) => this.addCondition(group, value as string))} </span> `; } return html` ${groupsTemplate} ${itemsTemplate} ${addTemplate} `; } protected dateTimePredicateTemplate() { return html`<span>DATE TIME PREDICATE NOT IMPLEMENTED</span>`; } public shouldUpdate(_changedProperties: PropertyValues): boolean { if (_changedProperties.has("rule")) { if (this.rule) { if (!this.rule.when) { this.rule.when = { operator: LogicGroupOperator.OR }; } else { // Check this is a rule compatible with this editor if (!OrRuleWhen._isRuleWhenCompatible(this.rule.when)) { this.rule = undefined; this.dispatchEvent(new OrRulesRuleUnsupportedEvent()); } } } } return super.shouldUpdate(_changedProperties); } protected render() { if (!this.rule || !this.rule.when) { return html``; } const showAddGroup = !this.readonly && (!this.config || !this.config.controls || this.config.controls.hideWhenAddGroup !== true); return html` <div> ${this.ruleGroupTemplate(this.rule.when)} </div> ${!showAddGroup ? `` : html` <or-panel> <strong>${i18next.t(!this.rule.when.groups || this.rule.when.groups.length === 0 ? "when" : "orWhen")}...</strong> <span class="add-button-wrapper"> ${getContentWithMenuTemplate( html`<or-mwc-input class="plus-button" type="${InputType.BUTTON}" icon="plus"></or-mwc-input>`, getWhenTypesMenu(this.config, this.assetInfos), undefined, (value) => this.addGroup(this.rule!.when!, value as string))} </span> </or-panel> `} `; } /** * Currently only support a top level OR group and then N child AND groups with no more descendants */ protected static _isRuleWhenCompatible(when: LogicGroup<RuleCondition>): boolean { if (when.operator !== LogicGroupOperator.OR) { console.warn("Incompatible rule: when operator not set to 'OR'"); return false; } if (when.items && when.items.length > 0) { console.warn("Incompatible rule: when items not supported"); return false; } if (when.groups && when.groups.find((g) => !this._isWhenGroupCompatible(g))) { console.warn("Incompatible rule: when groups incompatible"); return false; } return true; } protected static _isWhenGroupCompatible(group: LogicGroup<RuleCondition>): boolean { if (group.operator === LogicGroupOperator.OR) { console.warn("Incompatible rule: when group operator not set to 'AND'"); return false; } if (group.groups && group.groups.length > 0) { console.warn("Incompatible rule: when group nested groups not supported"); return false; } return true; } private addGroup(parent: LogicGroup<RuleCondition>, type: string | undefined) { if (!this.rule || !this.rule.when || parent !== this.rule.when) { return; } let newGroup: LogicGroup<RuleCondition> = { operator: LogicGroupOperator.AND }; if (this.config && this.config.json && this.config.json.whenGroup) { newGroup = JSON.parse(JSON.stringify(this.config.json.whenGroup)) as LogicGroup<RuleCondition>; } if (newGroup.operator !== LogicGroupOperator.AND) { console.warn("JSON rules editor doesn't support top level logic group with type OR"); this.dispatchEvent(new OrRulesRuleUnsupportedEvent()); return; } if (newGroup.groups && newGroup.groups.length > 0) { console.warn("JSON rules editor doesn't support multiple top level logic groups"); this.dispatchEvent(new OrRulesRuleUnsupportedEvent()); return; } newGroup.groups = undefined; // Add an item if none exist if (!newGroup.items || newGroup.items!.length === 0) { this.addCondition(newGroup, type, true); } if (!parent.groups) { parent.groups = []; } parent.groups.push(newGroup); this.dispatchEvent(new OrRulesJsonRuleChangedEvent()); this.requestUpdate(); } private removeItem(item: LogicGroup<RuleCondition> | RuleCondition, parent: LogicGroup<RuleCondition>, isGroup: boolean) { let removed = false; if (parent) { if (isGroup) { const index = parent.groups!.indexOf(item as LogicGroup<RuleCondition>); parent.groups!.splice(index, 1); removed = index >= 0; } else { const index = parent.items!.indexOf(item as RuleCondition); parent.items!.splice(index, 1); removed = index >= 0; } if (removed) { this.dispatchEvent(new OrRulesJsonRuleChangedEvent()); this.requestUpdate(); } } } private addCondition(parent: LogicGroup<RuleCondition>, type: string | undefined, silent?: boolean) { if (!parent) { return; } if (!parent.items) { parent.items = []; } let newCondition: RuleCondition = {}; if (this.config && this.config.json && this.config.json.whenCondition) { newCondition = JSON.parse(JSON.stringify(this.config.json.whenCondition)) as RuleCondition; } else { updateRuleConditionType(newCondition, type || WellknownAssets.THINGASSET, this.config); } parent.items.push(newCondition); if (!silent) { this.dispatchEvent(new OrRulesJsonRuleChangedEvent()); this.requestUpdate(); } } } ```
/content/code_sandbox/ui/component/or-rules/src/json-viewer/or-rule-when.ts
xml
2016-02-03T11:14:02
2024-08-16T12:45:50
openremote
openremote/openremote
1,184
2,748
```xml <?xml version="1.0" encoding="utf-8"?> <package xmlns="path_to_url"> <metadata> <id>WixSharp.bin</id> <version>1.22.1.0</version> <title>Wix# (WixSharp) - Binaries</title> <authors>Oleg Shilo</authors> <owners>Oleg Shilo</owners> <license type="expression">MIT</license> <icon>wixsharp_logo.png</icon> <projectUrl>path_to_url <description>Wix# is a framework for building a complete MSI or WiX source code by using build script files written with the C# syntax. The package contains Wix# binaries only. In order to use this package you need have WiX Toolset installed. The package is tested against WIX (Windows Installer Xml) Toolset v3.10 (v3.10.2103.0)</description> <summary>Wix# (WixSharp) - Binaries</summary> <releaseNotes>Release v1.22.1.0 - Added Support StoreType.sha1Hash in DigitalSignatureBootstrapper - Issue #1317: Bootstrapper bundle has bugs on wxs files generation. - Issue #1310: Problem during dynamic localization </releaseNotes> <language>en-AU</language> <tags>C# scripting msi install setup wix</tags> <references> <reference file="BootstrapperCore.dll" /> <reference file="Microsoft.Deployment.WindowsInstaller.dll" /> <reference file="WixSharp.dll" /> <reference file="WixSharp.Msi.dll" /> <reference file="WixSharp.UI.dll" /> </references> </metadata> <files> <file src="build\WixSharp.bin.targets" target="build\WixSharp.bin.targets" /> <file src="lib\BootstrapperCore.dll" target="lib\BootstrapperCore.dll" /> <file src="lib\BootstrapperCore.xml" target="lib\BootstrapperCore.xml" /> <file src="lib\Microsoft.Deployment.WindowsInstaller.dll" target="lib\Microsoft.Deployment.WindowsInstaller.dll" /> <file src="lib\Microsoft.Deployment.WindowsInstaller.xml" target="lib\Microsoft.Deployment.WindowsInstaller.xml" /> <file src="lib\nbsbuilder.exe" target="lib\nbsbuilder.exe" /> <file src="lib\WixSharp.dll" target="lib\WixSharp.dll" /> <file src="lib\WixSharp.Msi.dll" target="lib\WixSharp.Msi.dll" /> <file src="lib\WixSharp.Msi.xml" target="lib\WixSharp.Msi.xml" /> <file src="lib\WixSharp.UI.dll" target="lib\WixSharp.UI.dll" /> <file src="lib\WixSharp.UI.xml" target="lib\WixSharp.UI.xml" /> <file src="lib\WixSharp.xml" target="lib\WixSharp.xml" /> <file src="..\..\Templates\WixSharpVSIX\WixSharpVSIX\wixsharp_logo.png" target="" /> </files> </package> ```
/content/code_sandbox/Source/NuGet/WixSharp/WixSharp.bin.nuspec
xml
2016-01-16T05:51:01
2024-08-16T12:26:25
wixsharp
oleg-shilo/wixsharp
1,077
716
```xml import { keyframes } from '@fluentui/merge-styles'; import type { IRawStyle } from '@fluentui/merge-styles'; const DEFAULT_DURATION = '14s'; const DEFAULT_DELAY = '2s'; const DEFAULT_ITERATION_COUNT = '1'; function _continuousPulseStepOne(beaconColorOne: string, innerDimension: string): IRawStyle { return { borderColor: beaconColorOne, borderWidth: '0px', width: innerDimension, height: innerDimension, }; } function _continuousPulseStepTwo(borderWidth: string): IRawStyle { return { opacity: 1, borderWidth: borderWidth, }; } function _continuousPulseStepThree(): IRawStyle { return { opacity: 1, }; } function _continuousPulseStepFour(beaconColorTwo: string, outerDimension: string): IRawStyle { return { borderWidth: '0', width: outerDimension, height: outerDimension, opacity: 0, borderColor: beaconColorTwo, }; } function _continuousPulseStepFive(beaconColorOne: string, innerDimension: string): IRawStyle { return { ..._continuousPulseStepOne(beaconColorOne, innerDimension), ...{ opacity: 0, }, }; } function _continuousPulseAnimationDouble( beaconColorOne: string, beaconColorTwo: string, innerDimension: string, outerDimension: string, borderWidth: string, ): string { return keyframes({ '0%': _continuousPulseStepOne(beaconColorOne, innerDimension), '1.42%': _continuousPulseStepTwo(borderWidth), '3.57%': _continuousPulseStepThree(), '7.14%': _continuousPulseStepFour(beaconColorTwo, outerDimension), '8%': _continuousPulseStepFive(beaconColorOne, innerDimension), '29.99%': _continuousPulseStepFive(beaconColorOne, innerDimension), '30%': _continuousPulseStepOne(beaconColorOne, innerDimension), '31.42%': _continuousPulseStepTwo(borderWidth), '33.57%': _continuousPulseStepThree(), '37.14%': _continuousPulseStepFour(beaconColorTwo, outerDimension), '38%': _continuousPulseStepFive(beaconColorOne, innerDimension), '79.42%': _continuousPulseStepFive(beaconColorOne, innerDimension), '79.43': _continuousPulseStepOne(beaconColorOne, innerDimension), '81.85': _continuousPulseStepTwo(borderWidth), '83.42': _continuousPulseStepThree(), '87%': _continuousPulseStepFour(beaconColorTwo, outerDimension), '100%': {}, }); } function _continuousPulseAnimationSingle( beaconColorOne: string, beaconColorTwo: string, innerDimension: string, outerDimension: string, borderWidth: string, ): string { return keyframes({ '0%': _continuousPulseStepOne(beaconColorOne, innerDimension), '14.2%': _continuousPulseStepTwo(borderWidth), '35.7%': _continuousPulseStepThree(), '71.4%': _continuousPulseStepFour(beaconColorTwo, outerDimension), '100%': {}, }); } function _createDefaultAnimation(animationName: string, delayLength?: string): IRawStyle { return { animationName, animationIterationCount: DEFAULT_ITERATION_COUNT, animationDuration: DEFAULT_DURATION, animationDelay: delayLength || DEFAULT_DELAY, }; } export const PulsingBeaconAnimationStyles = { continuousPulseAnimationDouble: _continuousPulseAnimationDouble, continuousPulseAnimationSingle: _continuousPulseAnimationSingle, createDefaultAnimation: _createDefaultAnimation, }; ```
/content/code_sandbox/packages/style-utilities/src/styles/PulsingBeaconAnimationStyles.ts
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
861
```xml <?xml version="1.0"?> <project xmlns="path_to_url" xmlns:xsi="path_to_url" xsi:schemaLocation="path_to_url path_to_url"> <parent> <groupId>io.debezium</groupId> <artifactId>debezium-parent</artifactId> <version>3.0.0-SNAPSHOT</version> <relativePath>../debezium-parent/pom.xml</relativePath> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>debezium-testing</artifactId> <name>Debezium Testing</name> <packaging>pom</packaging> <properties> <maven.compiler.source>${debezium.java.source}</maven.compiler.source> <maven.compiler.target>${debezium.java.specific.target}</maven.compiler.target> <maven.compiler.release>${debezium.java.specific.target}</maven.compiler.release> <maven.compiler.testRelease>${debezium.java.specific.target}</maven.compiler.testRelease> </properties> <modules> <module>debezium-testing-testcontainers</module> <module>debezium-testing-system</module> </modules> </project> ```
/content/code_sandbox/debezium-testing/pom.xml
xml
2016-01-22T20:17:05
2024-08-16T13:42:33
debezium
debezium/debezium
10,320
283
```xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="path_to_url" xmlns:tools="path_to_url" package="com.cyl.musiclake"> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.BLUETOOTH" /> <!-- --> <uses-permission android:name="android.permission.BROADCAST_STICKY" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <!-- --> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- audio session ID --> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <!-- --> <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" tools:ignore="ProtectedPermissions" /> <uses-permission android:name="android.permission.WRITE_SETTINGS" tools:ignore="ProtectedPermissions" /> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <!-- --> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <!-- --> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <!-- GPS --> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <!-- --> <!-- --> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <uses-permission android:name="android.permission.READ_LOGS" tools:ignore="ProtectedPermissions" /> <uses-permission android:name="android.permission.SYSTEM_OVERLAY_WINDOW" /> <application android:name=".MusicApp" android:allowBackup="false" android:icon="@drawable/default_cover_music" android:label="@string/app_name" android:largeHeap="true" android:networkSecurityConfig="@xml/network_security_config" android:preserveLegacyExternalStorage="true" android:requestLegacyExternalStorage="true" android:roundIcon="@drawable/default_cover_music" android:supportsRtl="true" android:theme="@style/AppTheme" android:usesCleartextTraffic="true" tools:replace="android:allowBackup"> <activity android:name=".ui.youtube.YoutubeActivity" android:configChanges="orientation|screenSize|keyboardHidden|smallestScreenSize|screenLayout" android:hardwareAccelerated="true" android:resizeableActivity="true" android:supportsPictureInPicture="true" /> <activity android:name=".ui.main.WelcomeActivity" android:exported="true" android:screenOrientation="portrait" android:theme="@style/AppTheme.Welcome"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <meta-data android:name="android.app.shortcuts" android:resource="@xml/shortcuts" /> </activity> <activity android:name=".ui.main.MainActivity" android:launchMode="singleTask" android:theme="@style/MainActivityTheme" /> <activity android:name=".ui.my.LoginActivity" android:exported="true" android:launchMode="singleTask" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <!-- scheme --> <category android:name="android.intent.category.BROWSABLE" /> <data android:host="oauth" android:scheme="musiclake" /> </intent-filter> </activity> <activity android:name=".ui.my.BindLoginActivity" android:label="@string/bind_netease" android:screenOrientation="portrait" /> <activity android:name=".ui.music.playlist.square.PlaylistSquareActivity" android:screenOrientation="portrait" /> <activity android:name=".ui.music.playlist.PlaylistActivity" android:screenOrientation="portrait" /> <activity android:name=".ui.my.RegisterActivity" android:screenOrientation="portrait" /> <activity android:name=".ui.music.playlist.edit.PlaylistManagerActivity" android:screenOrientation="portrait" /> <activity android:name=".ui.music.comment.SongCommentActivity" android:label="@string/song_comment_title" android:screenOrientation="portrait" /> <activity android:name=".ui.music.charts.activity.BaiduMusicListActivity" android:label="@string/app_name" android:theme="@style/MainActivityTheme" /> <!-- <activity--> <!-- android:name=".ui.music.mv.VideoDetailActivity"--> <!-- android:configChanges="keyboardHidden|orientation|screenSize|locale"--> <!-- android:label="@string/app_name"--> <!-- android:screenOrientation="portrait" />--> <activity android:name=".ui.music.mv.VideoDetailActivity" android:configChanges="keyboardHidden|orientation|screenSize|locale" android:label="@string/app_name" android:launchMode="singleTask" android:screenOrientation="portrait" /> <activity android:name=".ui.music.charts.activity.NeteasePlaylistActivity" android:label="@string/app_name" android:theme="@style/MainActivityTheme" /> <activity android:name=".ui.music.search.SearchActivity" android:configChanges="keyboardHidden|orientation|screenSize" android:label="@string/app_name" android:screenOrientation="portrait" android:windowSoftInputMode="adjustPan|stateHidden" /> <activity android:name=".ui.music.edit.EditSongListActivity" android:label="@string/app_name" android:screenOrientation="portrait" /> <activity android:name=".ui.music.playlist.detail.PlaylistDetailActivity" android:label="@string/playlist_name" android:theme="@style/MainActivityTheme" /> <activity android:name=".ui.music.artist.activity.ArtistDetailActivity" android:label="@string/artist_detail" android:theme="@style/MainActivityTheme" /> <activity android:name=".ui.music.edit.EditMusicActivity" android:label="@string/app_name" android:screenOrientation="portrait" /> <activity android:name=".ui.music.local.fragment.LocalMusicActivity" android:label="@string/local_music" android:screenOrientation="portrait" /> <activity android:name=".ui.music.local.fragment.LocalVideoActivity" android:label="@string/item_video" android:screenOrientation="portrait" /> <activity android:name=".ui.settings.SettingsActivity" android:label="@string/title_activity_settings" android:parentActivityName=".ui.main.MainActivity" android:screenOrientation="portrait" /> <activity android:name=".ui.settings.AboutActivity" android:label="@string/title_about" android:parentActivityName=".ui.settings.SettingsActivity" android:screenOrientation="portrait" /> <activity android:name=".ui.main.WebActivity" android:screenOrientation="portrait" /> <activity android:name=".ui.music.mv.VideoPlayerActivity" android:screenOrientation="portrait" /> <activity android:name="com.tencent.tauth.AuthActivity" android:launchMode="singleTask" android:noHistory="true" android:exported="true" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="tencent101454823" /> </intent-filter> </activity> <!-- QQ --> <activity android:name="com.tencent.connect.common.AssistActivity" android:configChanges="orientation|keyboardHidden|screenSize" android:theme="@android:style/Theme.Translucent.NoTitleBar" /> <!-- QQ --> <activity android:name=".ui.main.TestActivity" android:label="" /> <activity android:name=".ui.music.playpage.PlayerActivity" android:launchMode="singleTask" android:theme="@style/MainActivityTheme" /> <activity android:name=".ui.music.importplaylist.ImportPlaylistActivity" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="true" android:label="@string/import_playlist" android:screenOrientation="portrait" android:windowSoftInputMode="adjustPan|stateHidden"> <intent-filter> <action android:name="android.intent.action.SEND" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="text/plain" /> </intent-filter> </activity> <activity android:name="com.tencent.bugly.beta.ui.BetaActivity" android:configChanges="keyboardHidden|orientation|screenSize|locale" android:theme="@android:style/Theme.Translucent" /> <activity android:name=".ui.chat.ChatActivity" android:label="@string/title_activity_chat" android:theme="@style/MainActivityTheme" /> <!-- <activity--> <!-- android:name=".ui.chat.ChatActivity"--> <!-- android:configChanges="keyboardHidden|orientation|screenSize"--> <!-- android:label="@string/title_activity_chat"--> <!-- android:screenOrientation="portrait"--> <!-- android:windowSoftInputMode="adjustPan|stateHidden">--> <!-- &lt;!&ndash; <intent-filter>&ndash;&gt;--> <!-- &lt;!&ndash; <action android:name="android.intent.action.SEND" />&ndash;&gt;--> <!-- &lt;!&ndash; <category android:name="android.intent.category.DEFAULT" />&ndash;&gt;--> <!-- &lt;!&ndash; <data android:mimeType="text/plain" />&ndash;&gt;--> <!-- &lt;!&ndash; </intent-filter>&ndash;&gt;--> <!-- </activity> &lt;!&ndash; <meta-data android:value="6090a1a7c1c3df8bde8f916df96ce91d" android:name="BUG_HD_SDK_GENERAL_KEY" /> &ndash;&gt;--> <activity android:name=".ui.music.playpage.LockScreenPlayerActivity" android:launchMode="singleTask" android:screenOrientation="portrait" /> <activity android:name=".ui.chat.ChatDetailActivity" android:configChanges="keyboardHidden|orientation|screenSize" android:label="@string/title_activity_chat" android:screenOrientation="portrait" /> <activity android:name=".ui.timing.SleepTimerActivity" android:configChanges="keyboardHidden|orientation|screenSize" android:label="@string/title_count_down" android:screenOrientation="portrait" /> <activity android:name=".ui.music.search.PlaylistSearchActivity" android:configChanges="keyboardHidden|orientation|screenSize" android:label="@string/title_count_down" android:screenOrientation="portrait" android:windowSoftInputMode="adjustPan|stateHidden" /> <activity android:name=".ui.music.video.YouTubeDemoActivity" android:configChanges="keyboardHidden|orientation|screenSize" android:screenOrientation="portrait" android:theme="@style/AppTranslucent" android:windowSoftInputMode="adjustPan|stateHidden" /> <provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}.fileProvider" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths" /> </provider> <receiver android:name=".player.MediaButtonIntentReceiver" android:exported="true"> <intent-filter android:priority="2147483647"> <action android:name="android.media.AUDIO_BECOMING_NOISY" /> <action android:name="android.intent.action.MEDIA_BUTTON" /> </intent-filter> </receiver> <receiver android:name=".ui.widget.appwidgets.StandardWidget" android:exported="true" android:label="@string/widget_standard"> <intent-filter> <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> <action android:name="com.cyl.music_lake.metachanged" /> <action android:name="com.cyl.music_lake.notify.play_state" /> </intent-filter> <meta-data android:name="android.appwidget.provider" android:resource="@xml/widget_standard" /> </receiver> <service android:name=".player.MusicPlayerService" android:enabled="true" android:exported="true" /> <uses-library android:name="org.apache.http.legacy" android:required="false" /> </application> </manifest> ```
/content/code_sandbox/app/src/main/AndroidManifest.xml
xml
2016-04-09T15:47:45
2024-08-14T04:30:04
MusicLake
caiyonglong/MusicLake
2,654
2,942
```xml <epp xmlns="urn:ietf:params:xml:ns:epp-1.0"> <response> <result code="1000"> <msg>Command completed successfully</msg> </result> <resData> <domain:chkData xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"> <domain:cd> <domain:name avail="0">reserved.tld</domain:name> <domain:reason>Reserved</domain:reason> </domain:cd> <domain:cd> <domain:name avail="0">allowedinsunrise.tld</domain:name> <domain:reason>Reserved</domain:reason> </domain:cd> <domain:cd> <domain:name avail="0">collision.tld</domain:name> <domain:reason>Cannot be delegated</domain:reason> </domain:cd> <domain:cd> <domain:name avail="0">premiumcollision.tld</domain:name> <domain:reason>Cannot be delegated</domain:reason> </domain:cd> </domain:chkData> </resData> <extension> <fee:chkData xmlns:fee="urn:ietf:params:xml:ns:fee-0.11" xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"> <fee:cd avail="1"> <fee:object> <domain:name>reserved.tld</domain:name> </fee:object> <fee:command>restore</fee:command> <fee:currency>USD</fee:currency> <fee:period unit="y">1</fee:period> <fee:fee description="restore">17.00</fee:fee> </fee:cd> <fee:cd avail="1"> <fee:object> <domain:name>allowedinsunrise.tld</domain:name> </fee:object> <fee:command>restore</fee:command> <fee:currency>USD</fee:currency> <fee:period unit="y">1</fee:period> <fee:fee description="restore">17.00</fee:fee> </fee:cd> <fee:cd avail="1"> <fee:object> <domain:name>collision.tld</domain:name> </fee:object> <fee:command>restore</fee:command> <fee:currency>USD</fee:currency> <fee:period unit="y">1</fee:period> <fee:fee description="restore">17.00</fee:fee> </fee:cd> <fee:cd avail="1"> <fee:object> <domain:name>premiumcollision.tld</domain:name> </fee:object> <fee:command>restore</fee:command> <fee:currency>USD</fee:currency> <fee:period unit="y">1</fee:period> <fee:fee description="restore">17.00</fee:fee> </fee:cd> </fee:chkData> </extension> <trID> <clTRID>ABC-12345</clTRID> <svTRID>server-trid</svTRID> </trID> </response> </epp> ```
/content/code_sandbox/core/src/test/resources/google/registry/flows/domain/domain_check_fee_reserved_response_v11_restore.xml
xml
2016-02-29T20:16:48
2024-08-15T19:49:29
nomulus
google/nomulus
1,685
744
```xml /* * * * path_to_url * * Unless required by applicable law or agreed to in writing, software * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ import * as React from "react"; import { H5, Position, Radio, RadioGroup, Switch } from "@blueprintjs/core"; import { TimezoneDisplayFormat, TimezoneSelect } from "@blueprintjs/datetime"; import { Example, type ExampleProps, handleBooleanChange, handleValueChange } from "@blueprintjs/docs-theme"; export interface TimezoneSelectExampleState { disabled: boolean; displayFormat: TimezoneDisplayFormat; fill: boolean; showCustomTarget: boolean; showLocalTimezone: boolean; timezone: string; } export class TimezoneSelectExample extends React.PureComponent<ExampleProps, TimezoneSelectExampleState> { public state: TimezoneSelectExampleState = { disabled: false, displayFormat: TimezoneDisplayFormat.COMPOSITE, fill: false, showCustomTarget: false, showLocalTimezone: true, timezone: "", }; private handleDisabledChange = handleBooleanChange(disabled => this.setState({ disabled })); private handleDisplayFormatChange = handleValueChange((displayFormat: TimezoneDisplayFormat) => this.setState({ displayFormat }), ); private handleFillChange = handleBooleanChange(fill => this.setState({ fill })); private handleShowLocalChange = handleBooleanChange(showLocalTimezone => this.setState({ showLocalTimezone })); public render() { const { timezone, disabled, displayFormat, fill, showLocalTimezone } = this.state; const options = ( <> <H5>Props</H5> <Switch checked={showLocalTimezone} label="Show local timezone" onChange={this.handleShowLocalChange} /> <Switch checked={disabled} label="Disabled" onChange={this.handleDisabledChange} /> <Switch label="Fill container width" checked={this.state.fill} onChange={this.handleFillChange} /> <RadioGroup label="Display format" onChange={this.handleDisplayFormatChange} selectedValue={this.state.displayFormat} > <Radio label="Composite" value={TimezoneDisplayFormat.COMPOSITE} /> <Radio label="Abbreviation" value={TimezoneDisplayFormat.ABBREVIATION} /> <Radio label="Long Name" value={TimezoneDisplayFormat.LONG_NAME} /> <Radio label="IANA Code" value={TimezoneDisplayFormat.CODE} /> <Radio label="Offset" value={TimezoneDisplayFormat.OFFSET} /> </RadioGroup> </> ); return ( <Example options={options} {...this.props}> <TimezoneSelect disabled={disabled} fill={fill} onChange={this.handleTimezoneChange} popoverProps={{ position: Position.BOTTOM }} showLocalTimezone={showLocalTimezone} value={timezone} valueDisplayFormat={displayFormat} /> </Example> ); } private handleTimezoneChange = (timezone: string) => this.setState({ timezone }); } ```
/content/code_sandbox/packages/docs-app/src/examples/datetime-examples/timezoneSelectExample.tsx
xml
2016-10-25T21:17:50
2024-08-16T15:14:48
blueprint
palantir/blueprint
20,593
665
```xml /* * one or more contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright ownership. */ import React from 'react'; import {observer} from 'mobx-react'; import {ComboBox as BaseComboBox} from '@carbon/react'; type Item = {id: string; label: string}; type Props = { id: string; value: string; titleText?: string; placeholder?: string; onChange: (data: {[selectedItem: string]: Item | null | undefined}) => void; items: Item[]; disabled?: boolean; title?: string; }; const ComboBox: React.FC<Props> = observer( ({id, items, onChange, value, disabled, ...props}) => { const getItemById = (id: string) => { return items.find((item) => item.id === id); }; return ( <BaseComboBox id={id} items={items} onChange={onChange} selectedItem={getItemById(value) ?? null} disabled={disabled || items.length === 0} shouldFilterItem={(data) => { const {inputValue, item} = data; return ( inputValue !== undefined && item.label.toLowerCase().includes(inputValue?.toLowerCase()) ); }} size="sm" {...props} /> ); }, ); export {ComboBox}; ```
/content/code_sandbox/operate/client/src/modules/components/ComboBox/index.tsx
xml
2016-03-20T03:38:04
2024-08-16T19:59:58
camunda
camunda/camunda
3,172
290
```xml import * as React from 'react'; import { InlineDrawer, DrawerHeader, DrawerHeaderTitle, Button, makeStyles } from '@fluentui/react-components'; import { Dismiss24Regular } from '@fluentui/react-icons'; const useStyles = makeStyles({ drawer: { width: '400px', height: '600px', }, }); export const WithTitle = () => { return ( <InlineDrawer className={useStyles().drawer} open> <DrawerHeader> <DrawerHeaderTitle>Drawer with title</DrawerHeaderTitle> <DrawerHeaderTitle heading={{ as: 'h1' }}>Drawer with custom tag</DrawerHeaderTitle> <DrawerHeaderTitle action={<Button appearance="subtle" aria-label="Close" icon={<Dismiss24Regular />} />}> Drawer with title and action </DrawerHeaderTitle> </DrawerHeader> </InlineDrawer> ); }; WithTitle.parameters = { docs: { controls: { disable: true, }, description: { story: [ '`DrawerHeaderTitle` is a component that provides a structured heading for a Drawer and can be used to display a title and an action.', 'Although it works as a standalone component, it is intended to be used within a `DrawerHeader`.', 'The title renders an `h2` element by default but it can be customized using the `heading` prop.', ].join('\n'), }, }, }; ```
/content/code_sandbox/packages/react-components/react-drawer/stories/src/Drawer/DrawerWithTitle.stories.tsx
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
307
```xml import { createSlice } from '@reduxjs/toolkit'; import { ModelState, UserSettingsState, getInitialModelState } from '@proton/account'; import type { ProtonThunkArguments } from '@proton/redux-shared-store-types'; import { createAsyncModelThunk, handleAsyncModel, previousSelector } from '@proton/redux-utilities'; import { getDirectoryCalendars } from '@proton/shared/lib/api/calendars'; import { CALENDAR_TYPE } from '@proton/shared/lib/calendar/constants'; import type { HolidaysDirectoryCalendar } from '@proton/shared/lib/interfaces/calendar'; const name = 'holidaysDirectory' as const; export interface HolidaysDirectoryState extends UserSettingsState { [name]: ModelState<HolidaysDirectoryCalendar[]>; } type SliceState = HolidaysDirectoryState[typeof name]; type Model = NonNullable<SliceState['value']>; export const selectHolidaysDirectory = (state: HolidaysDirectoryState) => state[name]; const modelThunk = createAsyncModelThunk<Model, HolidaysDirectoryState, ProtonThunkArguments>(`${name}/fetch`, { miss: ({ extraArgument }) => { return extraArgument .api<{ Calendars: HolidaysDirectoryCalendar[] }>({ ...getDirectoryCalendars(CALENDAR_TYPE.HOLIDAYS), silence: true, }) .then(({ Calendars }) => { return Calendars; }); }, previous: previousSelector(selectHolidaysDirectory), }); const initialState = getInitialModelState<Model>(); const slice = createSlice({ name, initialState, reducers: {}, extraReducers: (builder) => { handleAsyncModel(builder, modelThunk); }, }); export const holidaysDirectoryReducer = { [name]: slice.reducer }; export const holidaysDirectoryThunk = modelThunk.thunk; ```
/content/code_sandbox/packages/calendar/holidaysDirectory/index.ts
xml
2016-06-08T11:16:51
2024-08-16T14:14:27
WebClients
ProtonMail/WebClients
4,300
366
```xml import * as React from 'react'; import { render } from '@testing-library/react'; import { FocusTrapZone } from './FocusTrapZone'; import { isConformant } from '../../common/isConformant'; import { expectNoHiddenParents } from '../../common/testUtilities'; describe('FocusTrapZone', () => { isConformant({ Component: FocusTrapZone, displayName: 'FocusTrapZone', }); it('defaults to enableAriaHiddenSiblings=false', () => { const { getByText } = render( <div> <div>sibling</div> <FocusTrapZone> <button>content</button> </FocusTrapZone> </div>, ); expectNoHiddenParents(getByText('sibling')); expectNoHiddenParents(getByText('content')); }); it('respects enableAriaHiddenSiblings=true', () => { const { getByText } = render( <div> <div>sibling</div> <FocusTrapZone enableAriaHiddenSiblings> <button>content</button> </FocusTrapZone> </div>, ); expect(getByText('sibling').getAttribute('aria-hidden')).toBe('true'); expectNoHiddenParents(getByText('content')); }); it('un-hides siblings when unmounting', () => { const { getByText, rerender } = render( <div> <div>sibling</div> <FocusTrapZone enableAriaHiddenSiblings> <button>content</button> </FocusTrapZone> </div>, ); const sibling = getByText('sibling'); expect(sibling.getAttribute('aria-hidden')).toBe('true'); rerender( <div> <div>sibling</div> </div>, ); expect(getByText('sibling')).toBe(sibling); // make sure it's the same DOM node expect(sibling.getAttribute('aria-hidden')).toBeNull(); }); it('has data-tabster=uncontrolled', () => { const { getByTitle } = render( <div> <FocusTrapZone enableAriaHiddenSiblings title="ftz"> <button>content</button> </FocusTrapZone> </div>, ); expect(getByTitle('ftz').getAttribute('data-tabster')).toBe('{"uncontrolled": {"completely": true}}'); }); }); ```
/content/code_sandbox/packages/react/src/components/FocusTrapZone/FocusTrapZone.test.tsx
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
521
```xml /* Use of this source code is governed by an MIT-style license that can be found in the LICENSE file or at path_to_url */ import {assert} from 'workbox-core/_private/assert.js'; import {Deferred} from 'workbox-core/_private/Deferred.js'; import {logger} from 'workbox-core/_private/logger.js'; import {StreamSource} from './_types.js'; import {WorkboxError} from 'workbox-core/_private/WorkboxError.js'; import './_version.js'; /** * Takes either a Response, a ReadableStream, or a * [BodyInit](path_to_url#bodyinit) and returns the * ReadableStreamReader object associated with it. * * @param {workbox-streams.StreamSource} source * @return {ReadableStreamReader} * @private */ function _getReaderFromSource( source: StreamSource, ): ReadableStreamReader<unknown> { if (source instanceof Response) { // See path_to_url if (source.body) { return source.body.getReader(); } throw new WorkboxError('opaque-streams-source', {type: source.type}); } if (source instanceof ReadableStream) { return source.getReader(); } return new Response(source as BodyInit).body!.getReader(); } /** * Takes multiple source Promises, each of which could resolve to a Response, a * ReadableStream, or a [BodyInit](path_to_url#bodyinit). * * Returns an object exposing a ReadableStream with each individual stream's * data returned in sequence, along with a Promise which signals when the * stream is finished (useful for passing to a FetchEvent's waitUntil()). * * @param {Array<Promise<workbox-streams.StreamSource>>} sourcePromises * @return {Object<{done: Promise, stream: ReadableStream}>} * * @memberof workbox-streams */ function concatenate(sourcePromises: Promise<StreamSource>[]): { done: Promise<void>; stream: ReadableStream; } { if (process.env.NODE_ENV !== 'production') { assert!.isArray(sourcePromises, { moduleName: 'workbox-streams', funcName: 'concatenate', paramName: 'sourcePromises', }); } const readerPromises = sourcePromises.map((sourcePromise) => { return Promise.resolve(sourcePromise).then((source) => { return _getReaderFromSource(source); }); }); const streamDeferred: Deferred<void> = new Deferred(); let i = 0; const logMessages: any[] = []; const stream = new ReadableStream({ pull(controller: ReadableStreamDefaultController<any>) { return readerPromises[i] .then((reader) => { if (reader instanceof ReadableStreamDefaultReader) { return reader.read(); } else { return; } }) .then((result) => { if (result?.done) { if (process.env.NODE_ENV !== 'production') { logMessages.push([ 'Reached the end of source:', sourcePromises[i], ]); } i++; if (i >= readerPromises.length) { // Log all the messages in the group at once in a single group. if (process.env.NODE_ENV !== 'production') { logger.groupCollapsed( `Concatenating ${readerPromises.length} sources.`, ); for (const message of logMessages) { if (Array.isArray(message)) { logger.log(...message); } else { logger.log(message); } } logger.log('Finished reading all sources.'); logger.groupEnd(); } controller.close(); streamDeferred.resolve(); return; } // The `pull` method is defined because we're inside it. return this.pull!(controller); } else { controller.enqueue(result?.value); } }) .catch((error) => { if (process.env.NODE_ENV !== 'production') { logger.error('An error occurred:', error); } streamDeferred.reject(error); throw error; }); }, cancel() { if (process.env.NODE_ENV !== 'production') { logger.warn('The ReadableStream was cancelled.'); } streamDeferred.resolve(); }, }); return {done: streamDeferred.promise, stream}; } export {concatenate}; ```
/content/code_sandbox/packages/workbox-streams/src/concatenate.ts
xml
2016-04-04T15:55:19
2024-08-16T08:33:26
workbox
GoogleChrome/workbox
12,245
948
```xml import { MessageToWebApp } from '../Shared/IpcMessages' import { ElectronMainEvents, MainEventHandler } from '../Shared/ElectronMainEvents' const { ipcRenderer } = require('electron') const RemoteBridge = require('@electron/remote').getGlobal('RemoteBridge') const { contextBridge } = require('electron') process.once('loaded', function () { contextBridge.exposeInMainWorld('electronRemoteBridge', RemoteBridge.exposableValue) const mainEvents: ElectronMainEvents = { setUpdateAvailableHandler: (handler: MainEventHandler) => ipcRenderer.on(MessageToWebApp.UpdateAvailable, handler), setWindowBlurredHandler: (handler: MainEventHandler) => ipcRenderer.on(MessageToWebApp.WindowBlurred, handler), setWindowFocusedHandler: (handler: MainEventHandler) => ipcRenderer.on(MessageToWebApp.WindowFocused, handler), setWatchedDirectoriesChangeHandler: (handler: MainEventHandler) => ipcRenderer.on(MessageToWebApp.WatchedDirectoriesChanges, handler), setInstallComponentCompleteHandler: (handler: MainEventHandler) => ipcRenderer.on(MessageToWebApp.InstallComponentComplete, handler), setHomeServerStartedHandler: (handler: MainEventHandler) => ipcRenderer.on(MessageToWebApp.HomeServerStarted, handler), setConsoleLogHandler: (handler: MainEventHandler) => ipcRenderer.on(MessageToWebApp.ConsoleLog, handler), } contextBridge.exposeInMainWorld('electronMainEvents', mainEvents) }) ```
/content/code_sandbox/packages/desktop/app/javascripts/Renderer/Preload.ts
xml
2016-12-05T23:31:33
2024-08-16T06:51:19
app
standardnotes/app
5,180
313
```xml import type { ReactNode } from 'react'; import React, { useEffect, useRef } from 'react'; const usePrevious = (value: any) => { const ref = useRef(); useEffect(() => { // happens after return ref.current = value; }, [value]); return ref.current; }; const useUpdate = (update: boolean, value: any) => { const previousValue = usePrevious(value); return update ? value : previousValue; }; export interface AddonPanelProps { active: boolean; children: ReactNode; } export const AddonPanel = ({ active, children }: AddonPanelProps) => { return ( // the hidden attribute is an valid html element that's both accessible and works to visually hide content <div hidden={!active}>{useUpdate(active, children)}</div> ); }; ```
/content/code_sandbox/code/core/src/components/components/addon-panel/addon-panel.tsx
xml
2016-03-18T04:23:44
2024-08-16T19:22:08
storybook
storybookjs/storybook
83,755
181
```xml <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="path_to_url" android:shape="rectangle" > <solid android:color="?attr/colorAccent" /> <stroke android:width="2dip" android:color="@color/highlightBlack"/> <corners android:radius="@dimen/list_card_radius"/> </shape> ```
/content/code_sandbox/app/src/main/res/drawable-v21/active_outline.xml
xml
2016-02-01T23:48:36
2024-08-15T03:35:42
TagMo
HiddenRamblings/TagMo
2,976
81
```xml import { mat2d, mat4 } from "gl-matrix"; import AnimationController from "../AnimationController.js"; import ArrayBufferSlice from "../ArrayBufferSlice.js"; import { computeViewMatrix, computeViewMatrixSkybox } from "../Camera.js"; import { White, colorNewCopy } from "../Color.js"; import { AABB } from "../Geometry.js"; import { CalcBillboardFlags, calcBillboardMatrix } from "../MathHelpers.js"; import * as NITRO_GX from '../SuperMario64DS/nitro_gx.js'; import { Texture, getFormatName, parseTexImageParamWrapModeS, parseTexImageParamWrapModeT, readTexture, textureFormatIsTranslucent } from "../SuperMario64DS/nitro_tex.js"; import { NITRO_Program, VertexData } from '../SuperMario64DS/render.js'; import { TextureMapping } from "../TextureHolder.js"; import { setAttachmentStateSimple } from "../gfx/helpers/GfxMegaStateDescriptorHelpers.js"; import { convertToCanvas } from "../gfx/helpers/TextureConversionHelpers.js"; import { fillColor, fillMatrix3x2, fillMatrix4x3 } from "../gfx/helpers/UniformBufferHelpers.js"; import { GfxBindingLayoutDescriptor, GfxBlendFactor, GfxBlendMode, GfxDevice, GfxFormat, GfxMegaStateDescriptor, GfxMipFilterMode, GfxProgram, GfxSampler, GfxTexFilterMode, GfxTexture, makeTextureDescriptor2D } from '../gfx/platform/GfxPlatform.js'; import { GfxRenderCache } from "../gfx/render/GfxRenderCache.js"; import { GfxRenderInst, GfxRenderInstManager, GfxRendererLayer, makeSortKeyOpaque } from "../gfx/render/GfxRenderInstManager.js"; import { assertExists, nArray } from "../util.js"; import * as Viewer from '../viewer.js'; import { MDL0Material, MDL0Model, MDL0Node, MDL0Shape, PAT0, PAT0TexAnimator, SRT0, SRT0TexMtxAnimator, TEX0, TEX0Texture, bindPAT0, bindSRT0 } from "./NNS_G3D.js"; function textureToCanvas(bmdTex: TEX0Texture, pixels: Uint8Array, name: string): Viewer.Texture { const canvas = convertToCanvas(ArrayBufferSlice.fromView(pixels), bmdTex.width, bmdTex.height); const surfaces = [ canvas ]; const extraInfo = new Map<string, string>(); extraInfo.set('Format', getFormatName(bmdTex.format)); return { name, surfaces, extraInfo }; } const scratchTexMatrix = mat2d.create(); class MaterialInstance { private textureNames: string[] = []; private gfxTextures: GfxTexture[] = []; private gfxSampler: GfxSampler | null = null; private textureMappings: TextureMapping[] = nArray(1, () => new TextureMapping()); public viewerTextures: Viewer.Texture[] = []; public baseCtx: NITRO_GX.Context; public srt0Animator: SRT0TexMtxAnimator | null = null; public pat0Animator: PAT0TexAnimator | null = null; public lightMask = 0x0F; public diffuseColor = colorNewCopy(White); public ambientColor = colorNewCopy(White); public specularColor = colorNewCopy(White); public emissionColor = colorNewCopy(White); private sortKey: number; private megaStateFlags: Partial<GfxMegaStateDescriptor>; public visible = true; constructor(cache: GfxRenderCache, tex0: TEX0, private model: MDL0Model, public material: MDL0Material) { this.baseCtx = { color: White, alpha: this.material.alpha }; const device = cache.device; const texture = this.translateTexture(device, tex0, this.material.textureName, this.material.paletteName); if (texture !== null) { this.gfxSampler = cache.createSampler({ minFilter: GfxTexFilterMode.Point, magFilter: GfxTexFilterMode.Point, mipFilter: GfxMipFilterMode.Nearest, wrapS: parseTexImageParamWrapModeS(this.material.texParams), wrapT: parseTexImageParamWrapModeT(this.material.texParams), minLOD: 0, maxLOD: 100, }); const textureMapping = this.textureMappings[0]; textureMapping.gfxTexture = this.gfxTextures[0]; textureMapping.gfxSampler = this.gfxSampler; } // NITRO's Rendering Engine uses two passes. Opaque, then Transparent. // A transparent polygon is one that has an alpha of < 0xFF, or uses // A5I3 / A3I5 textures. const isTranslucent = (this.material.alpha < 0xFF) || (texture !== null && textureFormatIsTranslucent(texture.format)); const xl = !!((this.material.polyAttribs >>> 11) & 0x01); const depthWrite = xl || !isTranslucent; const layer = isTranslucent ? GfxRendererLayer.TRANSLUCENT : GfxRendererLayer.OPAQUE; this.sortKey = makeSortKeyOpaque(layer, 0); this.megaStateFlags = { depthWrite: depthWrite, cullMode: this.material.cullMode, }; setAttachmentStateSimple(this.megaStateFlags, { blendMode: GfxBlendMode.Add, blendDstFactor: GfxBlendFactor.OneMinusSrcAlpha, blendSrcFactor: GfxBlendFactor.SrcAlpha, }); } public bindSRT0(animationController: AnimationController, srt0: SRT0): void { this.srt0Animator = bindSRT0(animationController, srt0, this.material.name); } public bindPAT0(animationController: AnimationController, pat0: PAT0): boolean { this.pat0Animator = bindPAT0(animationController, pat0, this.material.name); return this.pat0Animator !== null; } public translatePAT0Textures(device: GfxDevice, tex0: TEX0): void { if (this.pat0Animator === null) return; while (this.gfxTextures.length > 1) { device.destroyTexture(this.gfxTextures.pop()!); this.textureNames.pop(); this.viewerTextures.pop(); } for (let i = 0; i < this.pat0Animator.matData.animationTrack.length; i++) { const { texName, plttName } = this.pat0Animator.matData.animationTrack[i]; this.translateTexture(device, tex0, texName, plttName); } } private translateTexture(device: GfxDevice, tex0: TEX0 | null, textureName: string | null, paletteName: string | null): TEX0Texture | null { if (tex0 === null || textureName === null) return null; const texture = assertExists(tex0.textures.find((t) => t.name === textureName)); const palette = paletteName !== null ? assertExists(tex0.palettes.find((t) => t.name === paletteName)) : null; const fullTextureName = `${textureName}/${paletteName}`; if (this.textureNames.indexOf(fullTextureName) >= 0) return texture; this.textureNames.push(fullTextureName); const inTexture: Texture = { ...texture, palData: palette !== null ? palette.data : null } as Texture; const pixels = readTexture(inTexture); const gfxTexture = device.createTexture(makeTextureDescriptor2D(GfxFormat.U8_RGBA_NORM, texture.width, texture.height, 1)); device.setResourceName(gfxTexture, textureName); this.gfxTextures.push(gfxTexture); device.uploadTextureData(gfxTexture, 0, [pixels]); this.viewerTextures.push(textureToCanvas(texture, pixels, fullTextureName)); return texture; } public setOnRenderInst(template: GfxRenderInst, viewerInput: Viewer.ViewerRenderInput): void { if (this.srt0Animator !== null) { this.srt0Animator.calcTexMtx(scratchTexMatrix, this.model.texMtxMode, this.material.texScaleS, this.material.texScaleT); } else { mat2d.copy(scratchTexMatrix, this.material.texMatrix); } template.sortKey = this.sortKey; template.setMegaStateFlags(this.megaStateFlags); if (this.pat0Animator !== null) { const fullTextureName = this.pat0Animator.calcFullTextureName(); const textureIndex = this.textureNames.indexOf(fullTextureName); if (textureIndex >= 0) this.textureMappings[0].gfxTexture = this.gfxTextures[textureIndex]; } template.setSamplerBindingsFromTextureMappings(this.textureMappings); let offs = template.allocateUniformBuffer(NITRO_Program.ub_MaterialParams, 8+16); const d = template.mapUniformBufferF32(NITRO_Program.ub_MaterialParams); offs += fillMatrix3x2(d, offs, scratchTexMatrix); offs += fillColor(d, offs, this.diffuseColor, 0); offs += fillColor(d, offs, this.ambientColor, this.lightMask); offs += fillColor(d, offs, this.specularColor); offs += fillColor(d, offs, this.emissionColor); } public destroy(device: GfxDevice): void { for (let i = 0; i < this.gfxTextures.length; i++) device.destroyTexture(this.gfxTextures[i]); } } class Node { public modelMatrix = mat4.create(); public billboardMode = BillboardMode.NONE; constructor(public node: MDL0Node) { } public calcMatrix(baseModelMatrix: mat4): void { mat4.mul(this.modelMatrix, baseModelMatrix, this.node.jointMatrix); } } const scratchMat4 = mat4.create(); class ShapeInstance { private vertexData: VertexData; constructor(cache: GfxRenderCache, private materialInstance: MaterialInstance, public node: Node, public shape: MDL0Shape, posScale: number) { const baseCtx = this.materialInstance.baseCtx; const nitroVertexData = NITRO_GX.readCmds(shape.dlBuffer, baseCtx, posScale); this.vertexData = new VertexData(cache, nitroVertexData); } private computeModelView(dst: mat4, viewerInput: Viewer.ViewerRenderInput, isSkybox: boolean): void { if (isSkybox) { computeViewMatrixSkybox(dst, viewerInput.camera); } else { computeViewMatrix(dst, viewerInput.camera); } mat4.mul(dst, dst, this.node.modelMatrix); if (this.node.billboardMode === BillboardMode.BB) calcBillboardMatrix(dst, dst, CalcBillboardFlags.UseRollLocal | CalcBillboardFlags.PriorityZ | CalcBillboardFlags.UseZPlane); else if (this.node.billboardMode === BillboardMode.BBY) calcBillboardMatrix(dst, dst, CalcBillboardFlags.UseRollLocal | CalcBillboardFlags.PriorityY | CalcBillboardFlags.UseZPlane); } public prepareToRender(renderInstManager: GfxRenderInstManager, viewerInput: Viewer.ViewerRenderInput, isSkybox: boolean): void { if (!this.materialInstance.visible) return; const renderInst = renderInstManager.newRenderInst(); renderInst.setVertexInput(this.vertexData.inputLayout, this.vertexData.vertexBufferDescriptors, this.vertexData.indexBufferDescriptor); let offs = renderInst.allocateUniformBuffer(NITRO_Program.ub_DrawParams, 12*32); const drawParamsMapped = renderInst.mapUniformBufferF32(NITRO_Program.ub_DrawParams); this.computeModelView(scratchMat4, viewerInput, isSkybox); offs += fillMatrix4x3(drawParamsMapped, offs, scratchMat4); this.materialInstance.setOnRenderInst(renderInst, viewerInput); const drawCall = this.vertexData.nitroVertexData.drawCall; renderInst.setDrawCount(drawCall.numIndices, drawCall.startIndex); renderInstManager.submitRenderInst(renderInst); } public destroy(device: GfxDevice): void { this.vertexData.destroy(device); } } export const nnsG3dBindingLayouts: GfxBindingLayoutDescriptor[] = [{ numUniformBuffers: 3, numSamplers: 1 }]; const enum BillboardMode { NONE, BB, BBY, } export class MDL0Renderer { private visible = true; public modelMatrix = mat4.create(); public isSkybox: boolean = false; public animationController = new AnimationController(); private gfxProgram: GfxProgram; public materialInstances: MaterialInstance[] = []; private shapeInstances: ShapeInstance[] = []; private nodes: Node[] = []; public viewerTextures: Viewer.Texture[] = []; public bbox: AABB | null = null; constructor(cache: GfxRenderCache, public model: MDL0Model, private tex0: TEX0) { const program = new NITRO_Program(); program.defines.set('USE_VERTEX_COLOR', '1'); program.defines.set('USE_TEXTURE', '1'); this.gfxProgram = cache.createProgram(program); const posScale = 50; mat4.fromScaling(this.modelMatrix, [posScale, posScale, posScale]); for (let i = 0; i < this.model.materials.length; i++) this.materialInstances.push(new MaterialInstance(cache, this.tex0, this.model, this.model.materials[i])); for (let i = 0; i < this.model.nodes.length; i++) this.nodes.push(new Node(this.model.nodes[i])); for (let i = 0; i < this.materialInstances.length; i++) if (this.materialInstances[i].viewerTextures.length > 0) this.viewerTextures.push(this.materialInstances[i].viewerTextures[0]); this.execSBC(cache); } public bindSRT0(srt0: SRT0, animationController: AnimationController = this.animationController): void { for (let i = 0; i < this.materialInstances.length; i++) this.materialInstances[i].bindSRT0(animationController, srt0); } public bindPAT0(device: GfxDevice, pat0: PAT0, animationController: AnimationController = this.animationController): void { for (let i = 0; i < this.materialInstances.length; i++) { if (this.materialInstances[i].bindPAT0(animationController, pat0)) this.materialInstances[i].translatePAT0Textures(device, this.tex0); } } private execSBC(cache: GfxRenderCache) { const model = this.model; const view = model.sbcBuffer.createDataView(); const enum Op { NOP, RET, NODE, MTX, MAT, SHP, NODEDESC, BB, BBY, NODEMIX, CALLDL, POSSCALE, ENVMAP, PRJMAP, }; let idx = 0; let currentNode: Node | null = null; let currentMaterial: MaterialInstance | null = null; while (true) { const w0 = view.getUint8(idx++); const cmd = w0 & 0x1F; const opt = (w0 & 0xE0) >>> 5; if (cmd === Op.NOP) continue; else if (cmd === Op.RET) break; else if (cmd === Op.NODE) { const nodeIdx = view.getUint8(idx++); const visible = view.getUint8(idx++); currentNode = this.nodes[nodeIdx]; } else if (cmd === Op.MTX) { const mtxIdx = view.getUint8(idx++); } else if (cmd === Op.MAT) { const matIdx = view.getUint8(idx++); currentMaterial = this.materialInstances[matIdx]; } else if (cmd === Op.SHP) { const shpIdx = view.getUint8(idx++); const shape = model.shapes[shpIdx]; this.shapeInstances.push(new ShapeInstance(cache, assertExists(currentMaterial), assertExists(currentNode), shape, this.model.posScale)); } else if (cmd === Op.NODEDESC) { const idxNode = view.getUint8(idx++); const idxNodeParent = view.getUint8(idx++); const flags = view.getUint8(idx++); let destIdx = -1, srcIdx = -1; if (opt & 0x01) destIdx = view.getUint8(idx++); if (opt & 0x02) srcIdx = view.getUint8(idx++); } else if (cmd === Op.BB) { const nodeIdx = view.getUint8(idx++); let destIdx = -1, srcIdx = -1; if (opt & 0x01) destIdx = view.getUint8(idx++); if (opt & 0x02) srcIdx = view.getUint8(idx++); if (opt === 0) this.nodes[nodeIdx].billboardMode = BillboardMode.BB; } else if (cmd === Op.BBY) { const nodeIdx = view.getUint8(idx++); let destIdx = -1, srcIdx = -1; if (opt & 0x01) destIdx = view.getUint8(idx++); if (opt & 0x02) srcIdx = view.getUint8(idx++); if (opt === 0) this.nodes[nodeIdx].billboardMode = BillboardMode.BBY; } else if (cmd === Op.POSSCALE) { // } else { throw new Error(`UNKNOWN SBC ${cmd.toString(16)}`); } } } public prepareToRender(renderInstManager: GfxRenderInstManager, viewerInput: Viewer.ViewerRenderInput): void { if (!this.visible) return; if (this.bbox !== null && !viewerInput.camera.frustum.contains(this.bbox)) return; this.animationController.setTimeInMilliseconds(viewerInput.time); for (let i = 0; i < this.nodes.length; i++) this.nodes[i].calcMatrix(this.modelMatrix); const template = renderInstManager.pushTemplateRenderInst(); template.setBindingLayouts(nnsG3dBindingLayouts); template.setGfxProgram(this.gfxProgram); for (let i = 0; i < this.shapeInstances.length; i++) this.shapeInstances[i].prepareToRender(renderInstManager, viewerInput, this.isSkybox); renderInstManager.popTemplateRenderInst(); } public destroy(device: GfxDevice): void { for (let i = 0; i < this.materialInstances.length; i++) this.materialInstances[i].destroy(device); for (let i = 0; i < this.shapeInstances.length; i++) this.shapeInstances[i].destroy(device); } } ```
/content/code_sandbox/src/nns_g3d/render.ts
xml
2016-10-06T21:43:45
2024-08-16T17:03:52
noclip.website
magcius/noclip.website
3,206
4,118
```xml import { DataSet } from './data-set'; export class Column { title: string = ''; type: string = ''; class: string = ''; width: string = ''; hide: boolean = false; isSortable: boolean = false; isEditable: boolean = true; isAddable: boolean = true; isFilterable: boolean = false; sortDirection: string = ''; defaultSortDirection: string = ''; editor: { type: string, config: any, component: any } = { type: '', config: {}, component: null }; filter: { type: string, config: any, component: any } = { type: '', config: {}, component: null }; renderComponent: any = null; compareFunction: Function; valuePrepareFunction: Function; filterFunction: Function; onComponentInitFunction: Function; constructor(public id: string, protected settings: any, protected dataSet: DataSet) { this.process(); } getOnComponentInitFunction(): Function { return this.onComponentInitFunction; } getCompareFunction(): Function { return this.compareFunction; } getValuePrepareFunction(): Function { return this.valuePrepareFunction; } getFilterFunction(): Function { return this.filterFunction; } getConfig(): any { return this.editor && this.editor.config; } getFilterType(): any { return this.filter && this.filter.type; } getFilterConfig(): any { return this.filter && this.filter.config; } protected process() { this.title = this.settings['title']; this.class = this.settings['class']; this.width = this.settings['width']; this.hide = !!this.settings['hide']; this.type = this.prepareType(); this.editor = this.settings['editor']; this.filter = this.settings['filter']; this.renderComponent = this.settings['renderComponent']; this.isFilterable = typeof this.settings['filter'] === 'undefined' ? true : !!this.settings['filter']; this.defaultSortDirection = ['asc', 'desc'] .indexOf(this.settings['sortDirection']) !== -1 ? this.settings['sortDirection'] : ''; this.isSortable = typeof this.settings['sort'] === 'undefined' ? true : !!this.settings['sort']; this.isEditable = typeof this.settings['editable'] === 'undefined' ? true : !!this.settings['editable']; this.isAddable=typeof this.settings['addable'] === 'undefined' ? true : !!this.settings['addable']; this.sortDirection = this.prepareSortDirection(); this.compareFunction = this.settings['compareFunction']; this.valuePrepareFunction = this.settings['valuePrepareFunction']; this.filterFunction = this.settings['filterFunction']; this.onComponentInitFunction = this.settings['onComponentInitFunction']; } prepareType(): string { return this.settings['type'] || this.determineType(); } prepareSortDirection(): string { return this.settings['sort'] === 'desc' ? 'desc' : 'asc'; } determineType(): string { // TODO: determine type by data return 'text'; } } ```
/content/code_sandbox/projects/ng2-smart-table/src/lib/lib/data-set/column.ts
xml
2016-08-10T10:25:51
2024-08-05T21:57:53
ng2-smart-table
akveo/ng2-smart-table
1,631
672
```xml import React from "react"; import { StyledTable, TableWrapper } from "../styles/main"; type Props = { children: React.ReactNode; striped?: boolean; bordered?: boolean; condensed?: boolean; hover?: boolean; responsive?: boolean; whiteSpace?: string; alignTop?: boolean; wideHeader?: boolean; }; class Table extends React.Component<Props> { static defaultProps = { required: false, striped: false, bordered: false, condensed: false, hover: false, responsive: false, alignTop: false }; render() { return ( <TableWrapper> <StyledTable {...this.props} /> </TableWrapper> ); } } export default Table; ```
/content/code_sandbox/client-portal/modules/common/Table.tsx
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
160
```xml import { QueryRunner } from "../../query-runner/QueryRunner" import { ObjectLiteral } from "../../common/ObjectLiteral" import { TransactionNotStartedError } from "../../error/TransactionNotStartedError" import { TableColumn } from "../../schema-builder/table/TableColumn" import { Table } from "../../schema-builder/table/Table" import { TableForeignKey } from "../../schema-builder/table/TableForeignKey" import { TableIndex } from "../../schema-builder/table/TableIndex" import { QueryRunnerAlreadyReleasedError } from "../../error/QueryRunnerAlreadyReleasedError" import { View } from "../../schema-builder/view/View" import { Query } from "../Query" import { OracleDriver } from "./OracleDriver" import { ReadStream } from "../../platform/PlatformTools" import { QueryFailedError } from "../../error/QueryFailedError" import { TableUnique } from "../../schema-builder/table/TableUnique" import { Broadcaster } from "../../subscriber/Broadcaster" import { BaseQueryRunner } from "../../query-runner/BaseQueryRunner" import { OrmUtils } from "../../util/OrmUtils" import { TableCheck } from "../../schema-builder/table/TableCheck" import { ColumnType } from "../types/ColumnTypes" import { IsolationLevel } from "../types/IsolationLevel" import { TableExclusion } from "../../schema-builder/table/TableExclusion" import { ReplicationMode } from "../types/ReplicationMode" import { TypeORMError } from "../../error" import { QueryResult } from "../../query-runner/QueryResult" import { MetadataTableType } from "../types/MetadataTableType" import { InstanceChecker } from "../../util/InstanceChecker" import { BroadcasterResult } from "../../subscriber/BroadcasterResult" /** * Runs queries on a single oracle database connection. */ export class OracleQueryRunner extends BaseQueryRunner implements QueryRunner { // your_sha256_hash--------- // Public Implemented Properties // your_sha256_hash--------- /** * Database driver used by connection. */ driver: OracleDriver // your_sha256_hash--------- // Protected Properties // your_sha256_hash--------- /** * Promise used to obtain a database connection for a first time. */ protected databaseConnectionPromise: Promise<any> // your_sha256_hash--------- // Constructor // your_sha256_hash--------- constructor(driver: OracleDriver, mode: ReplicationMode) { super() this.driver = driver this.connection = driver.connection this.broadcaster = new Broadcaster(this) this.mode = mode } // your_sha256_hash--------- // Public Methods // your_sha256_hash--------- /** * Creates/uses database connection from the connection pool to perform further operations. * Returns obtained database connection. */ connect(): Promise<any> { if (this.databaseConnection) return Promise.resolve(this.databaseConnection) if (this.databaseConnectionPromise) return this.databaseConnectionPromise if (this.mode === "slave" && this.driver.isReplicated) { this.databaseConnectionPromise = this.driver .obtainSlaveConnection() .then((connection) => { this.databaseConnection = connection return this.databaseConnection }) } else { // master this.databaseConnectionPromise = this.driver .obtainMasterConnection() .then((connection) => { this.databaseConnection = connection return this.databaseConnection }) } return this.databaseConnectionPromise } /** * Releases used database connection. * You cannot use query runner methods once its released. */ async release(): Promise<void> { this.isReleased = true if (!this.databaseConnection) { return } await this.databaseConnection.close() } /** * Starts transaction. */ async startTransaction( isolationLevel: IsolationLevel = "READ COMMITTED", ): Promise<void> { if (this.isReleased) throw new QueryRunnerAlreadyReleasedError() // await this.query("START TRANSACTION"); if ( isolationLevel !== "SERIALIZABLE" && isolationLevel !== "READ COMMITTED" ) { throw new TypeORMError( `Oracle only supports SERIALIZABLE and READ COMMITTED isolation`, ) } this.isTransactionActive = true try { await this.broadcaster.broadcast("BeforeTransactionStart") } catch (err) { this.isTransactionActive = false throw err } if (this.transactionDepth === 0) { this.transactionDepth += 1 await this.query( "SET TRANSACTION ISOLATION LEVEL " + isolationLevel, ) } else { this.transactionDepth += 1 await this.query(`SAVEPOINT typeorm_${this.transactionDepth - 1}`) } await this.broadcaster.broadcast("AfterTransactionStart") } /** * Commits transaction. * Error will be thrown if transaction was not started. */ async commitTransaction(): Promise<void> { if (!this.isTransactionActive) throw new TransactionNotStartedError() await this.broadcaster.broadcast("BeforeTransactionCommit") if (this.transactionDepth === 1) { await this.query("COMMIT") this.isTransactionActive = false } this.transactionDepth -= 1 await this.broadcaster.broadcast("AfterTransactionCommit") } /** * Rollbacks transaction. * Error will be thrown if transaction was not started. */ async rollbackTransaction(): Promise<void> { if (!this.isTransactionActive) throw new TransactionNotStartedError() await this.broadcaster.broadcast("BeforeTransactionRollback") if (this.transactionDepth > 1) { this.transactionDepth -= 1 await this.query( `ROLLBACK TO SAVEPOINT typeorm_${this.transactionDepth}`, ) } else { this.transactionDepth -= 1 await this.query("ROLLBACK") this.isTransactionActive = false } await this.broadcaster.broadcast("AfterTransactionRollback") } /** * Executes a given SQL query. */ async query( query: string, parameters?: any[], useStructuredResult = false, ): Promise<any> { if (this.isReleased) throw new QueryRunnerAlreadyReleasedError() const databaseConnection = await this.connect() const broadcasterResult = new BroadcasterResult() this.driver.connection.logger.logQuery(query, parameters, this) this.broadcaster.broadcastBeforeQueryEvent( broadcasterResult, query, parameters, ) const queryStartTime = +new Date() try { const executionOptions = { autoCommit: !this.isTransactionActive, outFormat: this.driver.oracle.OUT_FORMAT_OBJECT, } const raw = await databaseConnection.execute( query, parameters || {}, executionOptions, ) // log slow queries if maxQueryExecution time is set const maxQueryExecutionTime = this.driver.options.maxQueryExecutionTime const queryEndTime = +new Date() const queryExecutionTime = queryEndTime - queryStartTime this.broadcaster.broadcastAfterQueryEvent( broadcasterResult, query, parameters, true, queryExecutionTime, raw, undefined, ) if ( maxQueryExecutionTime && queryExecutionTime > maxQueryExecutionTime ) this.driver.connection.logger.logQuerySlow( queryExecutionTime, query, parameters, this, ) const result = new QueryResult() result.raw = raw.rows || raw.outBinds || raw.rowsAffected || raw.implicitResults if (raw?.hasOwnProperty("rows") && Array.isArray(raw.rows)) { result.records = raw.rows } if ( raw?.hasOwnProperty("outBinds") && Array.isArray(raw.outBinds) ) { result.records = raw.outBinds } if ( raw?.hasOwnProperty("implicitResults") && Array.isArray(raw.implicitResults) ) { result.records = raw.implicitResults } if (raw?.hasOwnProperty("rowsAffected")) { result.affected = raw.rowsAffected } if (useStructuredResult) { return result } else { return result.raw } } catch (err) { this.driver.connection.logger.logQueryError( err, query, parameters, this, ) this.broadcaster.broadcastAfterQueryEvent( broadcasterResult, query, parameters, false, undefined, undefined, err, ) throw new QueryFailedError(query, parameters, err) } finally { await broadcasterResult.wait() } } /** * Returns raw data stream. */ async stream( query: string, parameters?: any[], onEnd?: Function, onError?: Function, ): Promise<ReadStream> { if (this.isReleased) { throw new QueryRunnerAlreadyReleasedError() } const executionOptions = { autoCommit: !this.isTransactionActive, outFormat: this.driver.oracle.OUT_FORMAT_OBJECT, } const databaseConnection = await this.connect() this.driver.connection.logger.logQuery(query, parameters, this) try { const stream = databaseConnection.queryStream( query, parameters, executionOptions, ) if (onEnd) { stream.on("end", onEnd) } if (onError) { stream.on("error", onError) } return stream } catch (err) { this.driver.connection.logger.logQueryError( err, query, parameters, this, ) throw new QueryFailedError(query, parameters, err) } } /** * Returns all available database names including system databases. */ async getDatabases(): Promise<string[]> { return Promise.resolve([]) } /** * Returns all available schema names including system schemas. * If database parameter specified, returns schemas of that database. */ async getSchemas(database?: string): Promise<string[]> { return Promise.resolve([]) } /** * Checks if database with the given name exist. */ async hasDatabase(database: string): Promise<boolean> { try { const query = await this.query( `SELECT 1 AS "exists" FROM global_name@"${database}"`, ) return query.length > 0 } catch (e) { return false } } /** * Loads currently using database */ async getCurrentDatabase(): Promise<undefined> { const query = await this.query( `SELECT SYS_CONTEXT('USERENV','DB_NAME') AS "db_name" FROM dual`, ) return query[0]["db_name"] } /** * Checks if schema with the given name exist. */ async hasSchema(schema: string): Promise<boolean> { return Promise.resolve(false) } /** * Loads currently using database schema */ async getCurrentSchema(): Promise<string> { const query = await this.query( `SELECT SYS_CONTEXT('USERENV','CURRENT_SCHEMA') AS "schema_name" FROM dual`, ) return query[0]["schema_name"] } /** * Checks if table with the given name exist in the database. */ async hasTable(tableOrName: Table | string): Promise<boolean> { const { tableName } = this.driver.parseTableName(tableOrName) const sql = `SELECT "TABLE_NAME" FROM "USER_TABLES" WHERE "TABLE_NAME" = '${tableName}'` const result = await this.query(sql) return result.length ? true : false } /** * Checks if column with the given name exist in the given table. */ async hasColumn( tableOrName: Table | string, columnName: string, ): Promise<boolean> { const { tableName } = this.driver.parseTableName(tableOrName) const sql = `SELECT "COLUMN_NAME" FROM "USER_TAB_COLS" WHERE "TABLE_NAME" = '${tableName}' AND "COLUMN_NAME" = '${columnName}'` const result = await this.query(sql) return result.length ? true : false } /** * Creates a new database. */ async createDatabase( database: string, ifNotExist?: boolean, ): Promise<void> { // Even with `IF NOT EXISTS` we get: // ORA-01501: CREATE DATABASE failed // ORA-01100: database already mounted if (ifNotExist) { try { await this.query(`CREATE DATABASE IF NOT EXISTS "${database}";`) } catch (e) { // if (e instanceof QueryFailedError) { if (e.message.includes("ORA-01100: database already mounted")) { return } // } throw e } } else { await this.query(`CREATE DATABASE "${database}"`) } } /** * Drops database. */ async dropDatabase(database: string, ifExist?: boolean): Promise<void> { return Promise.resolve() } /** * Creates a new table schema. */ async createSchema( schemaPath: string, ifNotExist?: boolean, ): Promise<void> { throw new TypeORMError( `Schema create queries are not supported by Oracle driver.`, ) } /** * Drops table schema. */ async dropSchema(schemaPath: string, ifExist?: boolean): Promise<void> { throw new TypeORMError( `Schema drop queries are not supported by Oracle driver.`, ) } /** * Creates a new table. */ async createTable( table: Table, ifNotExist: boolean = false, createForeignKeys: boolean = true, createIndices: boolean = true, ): Promise<void> { if (ifNotExist) { const isTableExist = await this.hasTable(table) if (isTableExist) return Promise.resolve() } const upQueries: Query[] = [] const downQueries: Query[] = [] upQueries.push(this.createTableSql(table, createForeignKeys)) downQueries.push(this.dropTableSql(table)) // if createForeignKeys is true, we must drop created foreign keys in down query. // createTable does not need separate method to create foreign keys, because it create fk's in the same query with table creation. if (createForeignKeys) table.foreignKeys.forEach((foreignKey) => downQueries.push(this.dropForeignKeySql(table, foreignKey)), ) if (createIndices) { table.indices.forEach((index) => { // new index may be passed without name. In this case we generate index name manually. if (!index.name) index.name = this.connection.namingStrategy.indexName( table, index.columnNames, index.where, ) upQueries.push(this.createIndexSql(table, index)) downQueries.push(this.dropIndexSql(index)) }) } // if table have column with generated type, we must add the expression to the metadata table const generatedColumns = table.columns.filter( (column) => column.generatedType && column.asExpression, ) for (const column of generatedColumns) { const insertQuery = this.insertTypeormMetadataSql({ table: table.name, type: MetadataTableType.GENERATED_COLUMN, name: column.name, value: column.asExpression, }) const deleteQuery = this.deleteTypeormMetadataSql({ table: table.name, type: MetadataTableType.GENERATED_COLUMN, name: column.name, }) upQueries.push(insertQuery) downQueries.push(deleteQuery) } await this.executeQueries(upQueries, downQueries) } /** * Drops the table. */ async dropTable( tableOrName: Table | string, ifExist?: boolean, dropForeignKeys: boolean = true, dropIndices: boolean = true, ): Promise<void> { // It needs because if table does not exist and dropForeignKeys or dropIndices is true, we don't need // to perform drop queries for foreign keys and indices. if (ifExist) { const isTableExist = await this.hasTable(tableOrName) if (!isTableExist) return Promise.resolve() } // if dropTable called with dropForeignKeys = true, we must create foreign keys in down query. const createForeignKeys: boolean = dropForeignKeys const table = InstanceChecker.isTable(tableOrName) ? tableOrName : await this.getCachedTable(tableOrName) const upQueries: Query[] = [] const downQueries: Query[] = [] if (dropIndices) { table.indices.forEach((index) => { upQueries.push(this.dropIndexSql(index)) downQueries.push(this.createIndexSql(table, index)) }) } // if dropForeignKeys is true, we just drop the table, otherwise we also drop table foreign keys. // createTable does not need separate method to create foreign keys, because it create fk's in the same query with table creation. if (dropForeignKeys) table.foreignKeys.forEach((foreignKey) => upQueries.push(this.dropForeignKeySql(table, foreignKey)), ) upQueries.push(this.dropTableSql(table)) downQueries.push(this.createTableSql(table, createForeignKeys)) // if table had columns with generated type, we must remove the expression from the metadata table const generatedColumns = table.columns.filter( (column) => column.generatedType && column.asExpression, ) for (const column of generatedColumns) { const deleteQuery = this.deleteTypeormMetadataSql({ table: table.name, type: MetadataTableType.GENERATED_COLUMN, name: column.name, }) const insertQuery = this.insertTypeormMetadataSql({ table: table.name, type: MetadataTableType.GENERATED_COLUMN, name: column.name, value: column.asExpression, }) upQueries.push(deleteQuery) downQueries.push(insertQuery) } await this.executeQueries(upQueries, downQueries) } /** * Creates a new view. */ async createView( view: View, syncWithMetadata: boolean = false, ): Promise<void> { const upQueries: Query[] = [] const downQueries: Query[] = [] upQueries.push(this.createViewSql(view)) if (syncWithMetadata) upQueries.push(this.insertViewDefinitionSql(view)) downQueries.push(this.dropViewSql(view)) if (syncWithMetadata) downQueries.push(this.deleteViewDefinitionSql(view)) await this.executeQueries(upQueries, downQueries) } /** * Drops the view. */ async dropView(target: View | string): Promise<void> { const viewName = InstanceChecker.isView(target) ? target.name : target const view = await this.getCachedView(viewName) const upQueries: Query[] = [] const downQueries: Query[] = [] upQueries.push(this.deleteViewDefinitionSql(view)) upQueries.push(this.dropViewSql(view)) downQueries.push(this.insertViewDefinitionSql(view)) downQueries.push(this.createViewSql(view)) await this.executeQueries(upQueries, downQueries) } /** * Renames the given table. */ async renameTable( oldTableOrName: Table | string, newTableName: string, ): Promise<void> { const upQueries: Query[] = [] const downQueries: Query[] = [] const oldTable = InstanceChecker.isTable(oldTableOrName) ? oldTableOrName : await this.getCachedTable(oldTableOrName) let newTable = oldTable.clone() const { database: dbName, tableName: oldTableName } = this.driver.parseTableName(oldTable) newTable.name = dbName ? `${dbName}.${newTableName}` : newTableName // rename table upQueries.push( new Query( `ALTER TABLE ${this.escapePath( oldTable, )} RENAME TO "${newTableName}"`, ), ) downQueries.push( new Query( `ALTER TABLE ${this.escapePath( newTable, )} RENAME TO "${oldTableName}"`, ), ) // rename primary key constraint if ( newTable.primaryColumns.length > 0 && !newTable.primaryColumns[0].primaryKeyConstraintName ) { const columnNames = newTable.primaryColumns.map( (column) => column.name, ) const oldPkName = this.connection.namingStrategy.primaryKeyName( oldTable, columnNames, ) const newPkName = this.connection.namingStrategy.primaryKeyName( newTable, columnNames, ) // build queries upQueries.push( new Query( `ALTER TABLE ${this.escapePath( newTable, )} RENAME CONSTRAINT "${oldPkName}" TO "${newPkName}"`, ), ) downQueries.push( new Query( `ALTER TABLE ${this.escapePath( newTable, )} RENAME CONSTRAINT "${newPkName}" TO "${oldPkName}"`, ), ) } // rename unique constraints newTable.uniques.forEach((unique) => { const oldUniqueName = this.connection.namingStrategy.uniqueConstraintName( oldTable, unique.columnNames, ) // Skip renaming if Unique has user defined constraint name if (unique.name !== oldUniqueName) return // build new constraint name const newUniqueName = this.connection.namingStrategy.uniqueConstraintName( newTable, unique.columnNames, ) // build queries upQueries.push( new Query( `ALTER TABLE ${this.escapePath( newTable, )} RENAME CONSTRAINT "${ unique.name }" TO "${newUniqueName}"`, ), ) downQueries.push( new Query( `ALTER TABLE ${this.escapePath( newTable, )} RENAME CONSTRAINT "${newUniqueName}" TO "${ unique.name }"`, ), ) // replace constraint name unique.name = newUniqueName }) // rename index constraints newTable.indices.forEach((index) => { const oldIndexName = this.connection.namingStrategy.indexName( oldTable, index.columnNames, index.where, ) // Skip renaming if Index has user defined constraint name if (index.name !== oldIndexName) return // build new constraint name const newIndexName = this.connection.namingStrategy.indexName( newTable, index.columnNames, index.where, ) // build queries upQueries.push( new Query( `ALTER INDEX "${index.name}" RENAME TO "${newIndexName}"`, ), ) downQueries.push( new Query( `ALTER INDEX "${newIndexName}" RENAME TO "${index.name}"`, ), ) // replace constraint name index.name = newIndexName }) // rename foreign key constraints newTable.foreignKeys.forEach((foreignKey) => { const oldForeignKeyName = this.connection.namingStrategy.foreignKeyName( oldTable, foreignKey.columnNames, this.getTablePath(foreignKey), foreignKey.referencedColumnNames, ) // Skip renaming if foreign key has user defined constraint name if (foreignKey.name !== oldForeignKeyName) return // build new constraint name const newForeignKeyName = this.connection.namingStrategy.foreignKeyName( newTable, foreignKey.columnNames, this.getTablePath(foreignKey), foreignKey.referencedColumnNames, ) // build queries upQueries.push( new Query( `ALTER TABLE ${this.escapePath( newTable, )} RENAME CONSTRAINT "${ foreignKey.name }" TO "${newForeignKeyName}"`, ), ) downQueries.push( new Query( `ALTER TABLE ${this.escapePath( newTable, )} RENAME CONSTRAINT "${newForeignKeyName}" TO "${ foreignKey.name }"`, ), ) // replace constraint name foreignKey.name = newForeignKeyName }) await this.executeQueries(upQueries, downQueries) // rename old table and replace it in cached tabled; oldTable.name = newTable.name this.replaceCachedTable(oldTable, newTable) } /** * Creates a new column from the column in the table. */ async addColumn( tableOrName: Table | string, column: TableColumn, ): Promise<void> { const table = InstanceChecker.isTable(tableOrName) ? tableOrName : await this.getCachedTable(tableOrName) const clonedTable = table.clone() const upQueries: Query[] = [] const downQueries: Query[] = [] upQueries.push( new Query( `ALTER TABLE ${this.escapePath( table, )} ADD ${this.buildCreateColumnSql(column)}`, ), ) downQueries.push( new Query( `ALTER TABLE ${this.escapePath(table)} DROP COLUMN "${ column.name }"`, ), ) // create or update primary key constraint if (column.isPrimary) { const primaryColumns = clonedTable.primaryColumns // if table already have primary key, me must drop it and recreate again if (primaryColumns.length > 0) { const pkName = primaryColumns[0].primaryKeyConstraintName ? primaryColumns[0].primaryKeyConstraintName : this.connection.namingStrategy.primaryKeyName( clonedTable, primaryColumns.map((column) => column.name), ) const columnNames = primaryColumns .map((column) => `"${column.name}"`) .join(", ") upQueries.push( new Query( `ALTER TABLE ${this.escapePath( table, )} DROP CONSTRAINT "${pkName}"`, ), ) downQueries.push( new Query( `ALTER TABLE ${this.escapePath( table, )} ADD CONSTRAINT "${pkName}" PRIMARY KEY (${columnNames})`, ), ) } primaryColumns.push(column) const pkName = primaryColumns[0].primaryKeyConstraintName ? primaryColumns[0].primaryKeyConstraintName : this.connection.namingStrategy.primaryKeyName( clonedTable, primaryColumns.map((column) => column.name), ) const columnNames = primaryColumns .map((column) => `"${column.name}"`) .join(", ") upQueries.push( new Query( `ALTER TABLE ${this.escapePath( table, )} ADD CONSTRAINT "${pkName}" PRIMARY KEY (${columnNames})`, ), ) downQueries.push( new Query( `ALTER TABLE ${this.escapePath( table, )} DROP CONSTRAINT "${pkName}"`, ), ) } // create column index const columnIndex = clonedTable.indices.find( (index) => index.columnNames.length === 1 && index.columnNames[0] === column.name, ) if (columnIndex) { clonedTable.indices.splice( clonedTable.indices.indexOf(columnIndex), 1, ) upQueries.push(this.createIndexSql(table, columnIndex)) downQueries.push(this.dropIndexSql(columnIndex)) } // create unique constraint if (column.isUnique) { const uniqueConstraint = new TableUnique({ name: this.connection.namingStrategy.uniqueConstraintName( table, [column.name], ), columnNames: [column.name], }) clonedTable.uniques.push(uniqueConstraint) upQueries.push( new Query( `ALTER TABLE ${this.escapePath(table)} ADD CONSTRAINT "${ uniqueConstraint.name }" UNIQUE ("${column.name}")`, ), ) downQueries.push( new Query( `ALTER TABLE ${this.escapePath(table)} DROP CONSTRAINT "${ uniqueConstraint.name }"`, ), ) } if (column.generatedType && column.asExpression) { const insertQuery = this.insertTypeormMetadataSql({ table: table.name, type: MetadataTableType.GENERATED_COLUMN, name: column.name, value: column.asExpression, }) const deleteQuery = this.deleteTypeormMetadataSql({ table: table.name, type: MetadataTableType.GENERATED_COLUMN, name: column.name, }) upQueries.push(insertQuery) downQueries.push(deleteQuery) } await this.executeQueries(upQueries, downQueries) clonedTable.addColumn(column) this.replaceCachedTable(table, clonedTable) } /** * Creates a new columns from the column in the table. */ async addColumns( tableOrName: Table | string, columns: TableColumn[], ): Promise<void> { for (const column of columns) { await this.addColumn(tableOrName, column) } } /** * Renames column in the given table. */ async renameColumn( tableOrName: Table | string, oldTableColumnOrName: TableColumn | string, newTableColumnOrName: TableColumn | string, ): Promise<void> { const table = InstanceChecker.isTable(tableOrName) ? tableOrName : await this.getCachedTable(tableOrName) const oldColumn = InstanceChecker.isTableColumn(oldTableColumnOrName) ? oldTableColumnOrName : table.columns.find((c) => c.name === oldTableColumnOrName) if (!oldColumn) throw new TypeORMError( `Column "${oldTableColumnOrName}" was not found in the ${this.escapePath( table, )} table.`, ) let newColumn: TableColumn | undefined = undefined if (InstanceChecker.isTableColumn(newTableColumnOrName)) { newColumn = newTableColumnOrName } else { newColumn = oldColumn.clone() newColumn.name = newTableColumnOrName } await this.changeColumn(table, oldColumn, newColumn) } /** * Changes a column in the table. */ async changeColumn( tableOrName: Table | string, oldTableColumnOrName: TableColumn | string, newColumn: TableColumn, ): Promise<void> { const table = InstanceChecker.isTable(tableOrName) ? tableOrName : await this.getCachedTable(tableOrName) let clonedTable = table.clone() const upQueries: Query[] = [] const downQueries: Query[] = [] const oldColumn = InstanceChecker.isTableColumn(oldTableColumnOrName) ? oldTableColumnOrName : table.columns.find( (column) => column.name === oldTableColumnOrName, ) if (!oldColumn) throw new TypeORMError( `Column "${oldTableColumnOrName}" was not found in the ${this.escapePath( table, )} table.`, ) if ( (newColumn.isGenerated !== oldColumn.isGenerated && newColumn.generationStrategy !== "uuid") || oldColumn.type !== newColumn.type || oldColumn.length !== newColumn.length || oldColumn.generatedType !== newColumn.generatedType || oldColumn.asExpression !== newColumn.asExpression ) { // Oracle does not support changing of IDENTITY column, so we must drop column and recreate it again. // Also, we recreate column if column type changed await this.dropColumn(table, oldColumn) await this.addColumn(table, newColumn) // update cloned table clonedTable = table.clone() } else { if (newColumn.name !== oldColumn.name) { // rename column upQueries.push( new Query( `ALTER TABLE ${this.escapePath(table)} RENAME COLUMN "${ oldColumn.name }" TO "${newColumn.name}"`, ), ) downQueries.push( new Query( `ALTER TABLE ${this.escapePath(table)} RENAME COLUMN "${ newColumn.name }" TO "${oldColumn.name}"`, ), ) // rename column primary key constraint if ( oldColumn.isPrimary === true && !oldColumn.primaryKeyConstraintName ) { const primaryColumns = clonedTable.primaryColumns // build old primary constraint name const columnNames = primaryColumns.map( (column) => column.name, ) const oldPkName = this.connection.namingStrategy.primaryKeyName( clonedTable, columnNames, ) // replace old column name with new column name columnNames.splice(columnNames.indexOf(oldColumn.name), 1) columnNames.push(newColumn.name) // build new primary constraint name const newPkName = this.connection.namingStrategy.primaryKeyName( clonedTable, columnNames, ) upQueries.push( new Query( `ALTER TABLE ${this.escapePath( table, )} RENAME CONSTRAINT "${oldPkName}" TO "${newPkName}"`, ), ) downQueries.push( new Query( `ALTER TABLE ${this.escapePath( table, )} RENAME CONSTRAINT "${newPkName}" TO "${oldPkName}"`, ), ) } // rename unique constraints clonedTable.findColumnUniques(oldColumn).forEach((unique) => { const oldUniqueName = this.connection.namingStrategy.uniqueConstraintName( clonedTable, unique.columnNames, ) // Skip renaming if Unique has user defined constraint name if (unique.name !== oldUniqueName) return // build new constraint name unique.columnNames.splice( unique.columnNames.indexOf(oldColumn.name), 1, ) unique.columnNames.push(newColumn.name) const newUniqueName = this.connection.namingStrategy.uniqueConstraintName( clonedTable, unique.columnNames, ) // build queries upQueries.push( new Query( `ALTER TABLE ${this.escapePath( table, )} RENAME CONSTRAINT "${ unique.name }" TO "${newUniqueName}"`, ), ) downQueries.push( new Query( `ALTER TABLE ${this.escapePath( table, )} RENAME CONSTRAINT "${newUniqueName}" TO "${ unique.name }"`, ), ) // replace constraint name unique.name = newUniqueName }) // rename index constraints clonedTable.findColumnIndices(oldColumn).forEach((index) => { const oldIndexName = this.connection.namingStrategy.indexName( clonedTable, index.columnNames, index.where, ) // Skip renaming if Index has user defined constraint name if (index.name !== oldIndexName) return // build new constraint name index.columnNames.splice( index.columnNames.indexOf(oldColumn.name), 1, ) index.columnNames.push(newColumn.name) const newIndexName = this.connection.namingStrategy.indexName( clonedTable, index.columnNames, index.where, ) // build queries upQueries.push( new Query( `ALTER INDEX "${index.name}" RENAME TO "${newIndexName}"`, ), ) downQueries.push( new Query( `ALTER INDEX "${newIndexName}" RENAME TO "${index.name}"`, ), ) // replace constraint name index.name = newIndexName }) // rename foreign key constraints clonedTable .findColumnForeignKeys(oldColumn) .forEach((foreignKey) => { const foreignKeyName = this.connection.namingStrategy.foreignKeyName( clonedTable, foreignKey.columnNames, this.getTablePath(foreignKey), foreignKey.referencedColumnNames, ) // Skip renaming if foreign key has user defined constraint name if (foreignKey.name !== foreignKeyName) return // build new constraint name foreignKey.columnNames.splice( foreignKey.columnNames.indexOf(oldColumn.name), 1, ) foreignKey.columnNames.push(newColumn.name) const newForeignKeyName = this.connection.namingStrategy.foreignKeyName( clonedTable, foreignKey.columnNames, this.getTablePath(foreignKey), foreignKey.referencedColumnNames, ) // build queries upQueries.push( new Query( `ALTER TABLE ${this.escapePath( table, )} RENAME CONSTRAINT "${ foreignKey.name }" TO "${newForeignKeyName}"`, ), ) downQueries.push( new Query( `ALTER TABLE ${this.escapePath( table, )} RENAME CONSTRAINT "${newForeignKeyName}" TO "${ foreignKey.name }"`, ), ) // replace constraint name foreignKey.name = newForeignKeyName }) // rename old column in the Table object const oldTableColumn = clonedTable.columns.find( (column) => column.name === oldColumn.name, ) clonedTable.columns[ clonedTable.columns.indexOf(oldTableColumn!) ].name = newColumn.name oldColumn.name = newColumn.name } if (this.isColumnChanged(oldColumn, newColumn, true)) { let defaultUp: string = "" let defaultDown: string = "" let nullableUp: string = "" let nullableDown: string = "" // changing column default if ( newColumn.default !== null && newColumn.default !== undefined ) { defaultUp = `DEFAULT ${newColumn.default}` if ( oldColumn.default !== null && oldColumn.default !== undefined ) { defaultDown = `DEFAULT ${oldColumn.default}` } else { defaultDown = "DEFAULT NULL" } } else if ( oldColumn.default !== null && oldColumn.default !== undefined ) { defaultUp = "DEFAULT NULL" defaultDown = `DEFAULT ${oldColumn.default}` } // changing column isNullable property if (newColumn.isNullable !== oldColumn.isNullable) { if (newColumn.isNullable === true) { nullableUp = "NULL" nullableDown = "NOT NULL" } else { nullableUp = "NOT NULL" nullableDown = "NULL" } } upQueries.push( new Query( `ALTER TABLE ${this.escapePath(table)} MODIFY "${ oldColumn.name }" ${this.connection.driver.createFullType( newColumn, )} ${defaultUp} ${nullableUp}`, ), ) downQueries.push( new Query( `ALTER TABLE ${this.escapePath(table)} MODIFY "${ oldColumn.name }" ${this.connection.driver.createFullType( oldColumn, )} ${defaultDown} ${nullableDown}`, ), ) } if (newColumn.isPrimary !== oldColumn.isPrimary) { const primaryColumns = clonedTable.primaryColumns // if primary column state changed, we must always drop existed constraint. if (primaryColumns.length > 0) { const pkName = primaryColumns[0].primaryKeyConstraintName ? primaryColumns[0].primaryKeyConstraintName : this.connection.namingStrategy.primaryKeyName( clonedTable, primaryColumns.map((column) => column.name), ) const columnNames = primaryColumns .map((column) => `"${column.name}"`) .join(", ") upQueries.push( new Query( `ALTER TABLE ${this.escapePath( table, )} DROP CONSTRAINT "${pkName}"`, ), ) downQueries.push( new Query( `ALTER TABLE ${this.escapePath( table, )} ADD CONSTRAINT "${pkName}" PRIMARY KEY (${columnNames})`, ), ) } if (newColumn.isPrimary === true) { primaryColumns.push(newColumn) // update column in table const column = clonedTable.columns.find( (column) => column.name === newColumn.name, ) column!.isPrimary = true const pkName = primaryColumns[0].primaryKeyConstraintName ? primaryColumns[0].primaryKeyConstraintName : this.connection.namingStrategy.primaryKeyName( clonedTable, primaryColumns.map((column) => column.name), ) const columnNames = primaryColumns .map((column) => `"${column.name}"`) .join(", ") upQueries.push( new Query( `ALTER TABLE ${this.escapePath( table, )} ADD CONSTRAINT "${pkName}" PRIMARY KEY (${columnNames})`, ), ) downQueries.push( new Query( `ALTER TABLE ${this.escapePath( table, )} DROP CONSTRAINT "${pkName}"`, ), ) } else { const primaryColumn = primaryColumns.find( (c) => c.name === newColumn.name, ) primaryColumns.splice( primaryColumns.indexOf(primaryColumn!), 1, ) // update column in table const column = clonedTable.columns.find( (column) => column.name === newColumn.name, ) column!.isPrimary = false // if we have another primary keys, we must recreate constraint. if (primaryColumns.length > 0) { const pkName = primaryColumns[0] .primaryKeyConstraintName ? primaryColumns[0].primaryKeyConstraintName : this.connection.namingStrategy.primaryKeyName( clonedTable, primaryColumns.map((column) => column.name), ) const columnNames = primaryColumns .map((column) => `"${column.name}"`) .join(", ") upQueries.push( new Query( `ALTER TABLE ${this.escapePath( table, )} ADD CONSTRAINT "${pkName}" PRIMARY KEY (${columnNames})`, ), ) downQueries.push( new Query( `ALTER TABLE ${this.escapePath( table, )} DROP CONSTRAINT "${pkName}"`, ), ) } } } if (newColumn.isUnique !== oldColumn.isUnique) { if (newColumn.isUnique === true) { const uniqueConstraint = new TableUnique({ name: this.connection.namingStrategy.uniqueConstraintName( table, [newColumn.name], ), columnNames: [newColumn.name], }) clonedTable.uniques.push(uniqueConstraint) upQueries.push( new Query( `ALTER TABLE ${this.escapePath( table, )} ADD CONSTRAINT "${ uniqueConstraint.name }" UNIQUE ("${newColumn.name}")`, ), ) downQueries.push( new Query( `ALTER TABLE ${this.escapePath( table, )} DROP CONSTRAINT "${uniqueConstraint.name}"`, ), ) } else { const uniqueConstraint = clonedTable.uniques.find( (unique) => { return ( unique.columnNames.length === 1 && !!unique.columnNames.find( (columnName) => columnName === newColumn.name, ) ) }, ) clonedTable.uniques.splice( clonedTable.uniques.indexOf(uniqueConstraint!), 1, ) upQueries.push( new Query( `ALTER TABLE ${this.escapePath( table, )} DROP CONSTRAINT "${uniqueConstraint!.name}"`, ), ) downQueries.push( new Query( `ALTER TABLE ${this.escapePath( table, )} ADD CONSTRAINT "${ uniqueConstraint!.name }" UNIQUE ("${newColumn.name}")`, ), ) } } await this.executeQueries(upQueries, downQueries) this.replaceCachedTable(table, clonedTable) } } /** * Changes a column in the table. */ async changeColumns( tableOrName: Table | string, changedColumns: { newColumn: TableColumn; oldColumn: TableColumn }[], ): Promise<void> { for (const { oldColumn, newColumn } of changedColumns) { await this.changeColumn(tableOrName, oldColumn, newColumn) } } /** * Drops column in the table. */ async dropColumn( tableOrName: Table | string, columnOrName: TableColumn | string, ): Promise<void> { const table = InstanceChecker.isTable(tableOrName) ? tableOrName : await this.getCachedTable(tableOrName) const column = InstanceChecker.isTableColumn(columnOrName) ? columnOrName : table.findColumnByName(columnOrName) if (!column) throw new TypeORMError( `Column "${columnOrName}" was not found in table ${this.escapePath( table, )}`, ) const clonedTable = table.clone() const upQueries: Query[] = [] const downQueries: Query[] = [] // drop primary key constraint if (column.isPrimary) { const pkName = column.primaryKeyConstraintName ? column.primaryKeyConstraintName : this.connection.namingStrategy.primaryKeyName( clonedTable, clonedTable.primaryColumns.map((column) => column.name), ) const columnNames = clonedTable.primaryColumns .map((primaryColumn) => `"${primaryColumn.name}"`) .join(", ") upQueries.push( new Query( `ALTER TABLE ${this.escapePath( clonedTable, )} DROP CONSTRAINT "${pkName}"`, ), ) downQueries.push( new Query( `ALTER TABLE ${this.escapePath( clonedTable, )} ADD CONSTRAINT "${pkName}" PRIMARY KEY (${columnNames})`, ), ) // update column in table const tableColumn = clonedTable.findColumnByName(column.name) tableColumn!.isPrimary = false // if primary key have multiple columns, we must recreate it without dropped column if (clonedTable.primaryColumns.length > 0) { const pkName = clonedTable.primaryColumns[0] .primaryKeyConstraintName ? clonedTable.primaryColumns[0].primaryKeyConstraintName : this.connection.namingStrategy.primaryKeyName( clonedTable, clonedTable.primaryColumns.map( (column) => column.name, ), ) const columnNames = clonedTable.primaryColumns .map((primaryColumn) => `"${primaryColumn.name}"`) .join(", ") upQueries.push( new Query( `ALTER TABLE ${this.escapePath( clonedTable, )} ADD CONSTRAINT "${pkName}" PRIMARY KEY (${columnNames})`, ), ) downQueries.push( new Query( `ALTER TABLE ${this.escapePath( clonedTable, )} DROP CONSTRAINT "${pkName}"`, ), ) } } // drop column index const columnIndex = clonedTable.indices.find( (index) => index.columnNames.length === 1 && index.columnNames[0] === column.name, ) if (columnIndex) { upQueries.push(this.dropIndexSql(columnIndex)) downQueries.push(this.createIndexSql(table, columnIndex)) } // drop column check const columnCheck = clonedTable.checks.find( (check) => !!check.columnNames && check.columnNames.length === 1 && check.columnNames[0] === column.name, ) if (columnCheck) { clonedTable.checks.splice( clonedTable.checks.indexOf(columnCheck), 1, ) upQueries.push(this.dropCheckConstraintSql(table, columnCheck)) downQueries.push(this.createCheckConstraintSql(table, columnCheck)) } // drop column unique const columnUnique = clonedTable.uniques.find( (unique) => unique.columnNames.length === 1 && unique.columnNames[0] === column.name, ) if (columnUnique) { clonedTable.uniques.splice( clonedTable.uniques.indexOf(columnUnique), 1, ) upQueries.push(this.dropUniqueConstraintSql(table, columnUnique)) downQueries.push( this.createUniqueConstraintSql(table, columnUnique), ) } upQueries.push( new Query( `ALTER TABLE ${this.escapePath(table)} DROP COLUMN "${ column.name }"`, ), ) downQueries.push( new Query( `ALTER TABLE ${this.escapePath( table, )} ADD ${this.buildCreateColumnSql(column)}`, ), ) if (column.generatedType && column.asExpression) { const deleteQuery = this.deleteTypeormMetadataSql({ table: table.name, type: MetadataTableType.GENERATED_COLUMN, name: column.name, }) const insertQuery = this.insertTypeormMetadataSql({ table: table.name, type: MetadataTableType.GENERATED_COLUMN, name: column.name, value: column.asExpression, }) upQueries.push(deleteQuery) downQueries.push(insertQuery) } await this.executeQueries(upQueries, downQueries) clonedTable.removeColumn(column) this.replaceCachedTable(table, clonedTable) } /** * Drops the columns in the table. */ async dropColumns( tableOrName: Table | string, columns: TableColumn[] | string[], ): Promise<void> { for (const column of columns) { await this.dropColumn(tableOrName, column) } } /** * Creates a new primary key. */ async createPrimaryKey( tableOrName: Table | string, columnNames: string[], constraintName?: string, ): Promise<void> { const table = InstanceChecker.isTable(tableOrName) ? tableOrName : await this.getCachedTable(tableOrName) const clonedTable = table.clone() const up = this.createPrimaryKeySql(table, columnNames, constraintName) // mark columns as primary, because dropPrimaryKeySql build constraint name from table primary column names. clonedTable.columns.forEach((column) => { if (columnNames.find((columnName) => columnName === column.name)) column.isPrimary = true }) const down = this.dropPrimaryKeySql(clonedTable) await this.executeQueries(up, down) this.replaceCachedTable(table, clonedTable) } /** * Updates composite primary keys. */ async updatePrimaryKeys( tableOrName: Table | string, columns: TableColumn[], ): Promise<void> { const table = InstanceChecker.isTable(tableOrName) ? tableOrName : await this.getCachedTable(tableOrName) const columnNames = columns.map((column) => column.name) const clonedTable = table.clone() const upQueries: Query[] = [] const downQueries: Query[] = [] // if table already have primary columns, we must drop them. const primaryColumns = clonedTable.primaryColumns if (primaryColumns.length > 0) { const pkName = primaryColumns[0].primaryKeyConstraintName ? primaryColumns[0].primaryKeyConstraintName : this.connection.namingStrategy.primaryKeyName( clonedTable, primaryColumns.map((column) => column.name), ) const columnNamesString = primaryColumns .map((column) => `"${column.name}"`) .join(", ") upQueries.push( new Query( `ALTER TABLE ${this.escapePath( table, )} DROP CONSTRAINT "${pkName}"`, ), ) downQueries.push( new Query( `ALTER TABLE ${this.escapePath( table, )} ADD CONSTRAINT "${pkName}" PRIMARY KEY (${columnNamesString})`, ), ) } // update columns in table. clonedTable.columns .filter((column) => columnNames.indexOf(column.name) !== -1) .forEach((column) => (column.isPrimary = true)) const pkName = primaryColumns[0].primaryKeyConstraintName ? primaryColumns[0].primaryKeyConstraintName : this.connection.namingStrategy.primaryKeyName( clonedTable, columnNames, ) const columnNamesString = columnNames .map((columnName) => `"${columnName}"`) .join(", ") upQueries.push( new Query( `ALTER TABLE ${this.escapePath( table, )} ADD CONSTRAINT "${pkName}" PRIMARY KEY (${columnNamesString})`, ), ) downQueries.push( new Query( `ALTER TABLE ${this.escapePath( table, )} DROP CONSTRAINT "${pkName}"`, ), ) await this.executeQueries(upQueries, downQueries) this.replaceCachedTable(table, clonedTable) } /** * Drops a primary key. */ async dropPrimaryKey( tableOrName: Table | string, constraintName?: string, ): Promise<void> { const table = InstanceChecker.isTable(tableOrName) ? tableOrName : await this.getCachedTable(tableOrName) const up = this.dropPrimaryKeySql(table) const down = this.createPrimaryKeySql( table, table.primaryColumns.map((column) => column.name), constraintName, ) await this.executeQueries(up, down) table.primaryColumns.forEach((column) => { column.isPrimary = false }) } /** * Creates a new unique constraint. */ async createUniqueConstraint( tableOrName: Table | string, uniqueConstraint: TableUnique, ): Promise<void> { const table = InstanceChecker.isTable(tableOrName) ? tableOrName : await this.getCachedTable(tableOrName) // new unique constraint may be passed without name. In this case we generate unique name manually. if (!uniqueConstraint.name) uniqueConstraint.name = this.connection.namingStrategy.uniqueConstraintName( table, uniqueConstraint.columnNames, ) const up = this.createUniqueConstraintSql(table, uniqueConstraint) const down = this.dropUniqueConstraintSql(table, uniqueConstraint) await this.executeQueries(up, down) table.addUniqueConstraint(uniqueConstraint) } /** * Creates a new unique constraints. */ async createUniqueConstraints( tableOrName: Table | string, uniqueConstraints: TableUnique[], ): Promise<void> { const promises = uniqueConstraints.map((uniqueConstraint) => this.createUniqueConstraint(tableOrName, uniqueConstraint), ) await Promise.all(promises) } /** * Drops an unique constraint. */ async dropUniqueConstraint( tableOrName: Table | string, uniqueOrName: TableUnique | string, ): Promise<void> { const table = InstanceChecker.isTable(tableOrName) ? tableOrName : await this.getCachedTable(tableOrName) const uniqueConstraint = InstanceChecker.isTableUnique(uniqueOrName) ? uniqueOrName : table.uniques.find((u) => u.name === uniqueOrName) if (!uniqueConstraint) throw new TypeORMError( `Supplied unique constraint was not found in table ${table.name}`, ) const up = this.dropUniqueConstraintSql(table, uniqueConstraint) const down = this.createUniqueConstraintSql(table, uniqueConstraint) await this.executeQueries(up, down) table.removeUniqueConstraint(uniqueConstraint) } /** * Creates an unique constraints. */ async dropUniqueConstraints( tableOrName: Table | string, uniqueConstraints: TableUnique[], ): Promise<void> { const promises = uniqueConstraints.map((uniqueConstraint) => this.dropUniqueConstraint(tableOrName, uniqueConstraint), ) await Promise.all(promises) } /** * Creates new check constraint. */ async createCheckConstraint( tableOrName: Table | string, checkConstraint: TableCheck, ): Promise<void> { const table = InstanceChecker.isTable(tableOrName) ? tableOrName : await this.getCachedTable(tableOrName) // new unique constraint may be passed without name. In this case we generate unique name manually. if (!checkConstraint.name) checkConstraint.name = this.connection.namingStrategy.checkConstraintName( table, checkConstraint.expression!, ) const up = this.createCheckConstraintSql(table, checkConstraint) const down = this.dropCheckConstraintSql(table, checkConstraint) await this.executeQueries(up, down) table.addCheckConstraint(checkConstraint) } /** * Creates new check constraints. */ async createCheckConstraints( tableOrName: Table | string, checkConstraints: TableCheck[], ): Promise<void> { const promises = checkConstraints.map((checkConstraint) => this.createCheckConstraint(tableOrName, checkConstraint), ) await Promise.all(promises) } /** * Drops check constraint. */ async dropCheckConstraint( tableOrName: Table | string, checkOrName: TableCheck | string, ): Promise<void> { const table = InstanceChecker.isTable(tableOrName) ? tableOrName : await this.getCachedTable(tableOrName) const checkConstraint = InstanceChecker.isTableCheck(checkOrName) ? checkOrName : table.checks.find((c) => c.name === checkOrName) if (!checkConstraint) throw new TypeORMError( `Supplied check constraint was not found in table ${table.name}`, ) const up = this.dropCheckConstraintSql(table, checkConstraint) const down = this.createCheckConstraintSql(table, checkConstraint) await this.executeQueries(up, down) table.removeCheckConstraint(checkConstraint) } /** * Drops check constraints. */ async dropCheckConstraints( tableOrName: Table | string, checkConstraints: TableCheck[], ): Promise<void> { const promises = checkConstraints.map((checkConstraint) => this.dropCheckConstraint(tableOrName, checkConstraint), ) await Promise.all(promises) } /** * Creates a new exclusion constraint. */ async createExclusionConstraint( tableOrName: Table | string, exclusionConstraint: TableExclusion, ): Promise<void> { throw new TypeORMError(`Oracle does not support exclusion constraints.`) } /** * Creates a new exclusion constraints. */ async createExclusionConstraints( tableOrName: Table | string, exclusionConstraints: TableExclusion[], ): Promise<void> { throw new TypeORMError(`Oracle does not support exclusion constraints.`) } /** * Drops exclusion constraint. */ async dropExclusionConstraint( tableOrName: Table | string, exclusionOrName: TableExclusion | string, ): Promise<void> { throw new TypeORMError(`Oracle does not support exclusion constraints.`) } /** * Drops exclusion constraints. */ async dropExclusionConstraints( tableOrName: Table | string, exclusionConstraints: TableExclusion[], ): Promise<void> { throw new TypeORMError(`Oracle does not support exclusion constraints.`) } /** * Creates a new foreign key. */ async createForeignKey( tableOrName: Table | string, foreignKey: TableForeignKey, ): Promise<void> { const table = InstanceChecker.isTable(tableOrName) ? tableOrName : await this.getCachedTable(tableOrName) // new FK may be passed without name. In this case we generate FK name manually. if (!foreignKey.name) foreignKey.name = this.connection.namingStrategy.foreignKeyName( table, foreignKey.columnNames, this.getTablePath(foreignKey), foreignKey.referencedColumnNames, ) const up = this.createForeignKeySql(table, foreignKey) const down = this.dropForeignKeySql(table, foreignKey) await this.executeQueries(up, down) table.addForeignKey(foreignKey) } /** * Creates a new foreign keys. */ async createForeignKeys( tableOrName: Table | string, foreignKeys: TableForeignKey[], ): Promise<void> { const promises = foreignKeys.map((foreignKey) => this.createForeignKey(tableOrName, foreignKey), ) await Promise.all(promises) } /** * Drops a foreign key from the table. */ async dropForeignKey( tableOrName: Table | string, foreignKeyOrName: TableForeignKey | string, ): Promise<void> { const table = InstanceChecker.isTable(tableOrName) ? tableOrName : await this.getCachedTable(tableOrName) const foreignKey = InstanceChecker.isTableForeignKey(foreignKeyOrName) ? foreignKeyOrName : table.foreignKeys.find((fk) => fk.name === foreignKeyOrName) if (!foreignKey) throw new TypeORMError( `Supplied foreign key was not found in table ${table.name}`, ) const up = this.dropForeignKeySql(table, foreignKey) const down = this.createForeignKeySql(table, foreignKey) await this.executeQueries(up, down) table.removeForeignKey(foreignKey) } /** * Drops a foreign keys from the table. */ async dropForeignKeys( tableOrName: Table | string, foreignKeys: TableForeignKey[], ): Promise<void> { const promises = foreignKeys.map((foreignKey) => this.dropForeignKey(tableOrName, foreignKey), ) await Promise.all(promises) } /** * Creates a new index. */ async createIndex( tableOrName: Table | string, index: TableIndex, ): Promise<void> { const table = InstanceChecker.isTable(tableOrName) ? tableOrName : await this.getCachedTable(tableOrName) // new index may be passed without name. In this case we generate index name manually. if (!index.name) index.name = this.generateIndexName(table, index) const up = this.createIndexSql(table, index) const down = this.dropIndexSql(index) await this.executeQueries(up, down) table.addIndex(index) } /** * Creates a new indices */ async createIndices( tableOrName: Table | string, indices: TableIndex[], ): Promise<void> { const promises = indices.map((index) => this.createIndex(tableOrName, index), ) await Promise.all(promises) } /** * Drops an index from the table. */ async dropIndex( tableOrName: Table | string, indexOrName: TableIndex | string, ): Promise<void> { const table = InstanceChecker.isTable(tableOrName) ? tableOrName : await this.getCachedTable(tableOrName) const index = InstanceChecker.isTableIndex(indexOrName) ? indexOrName : table.indices.find((i) => i.name === indexOrName) if (!index) throw new TypeORMError( `Supplied index ${indexOrName} was not found in table ${table.name}`, ) // old index may be passed without name. In this case we generate index name manually. if (!index.name) index.name = this.generateIndexName(table, index) const up = this.dropIndexSql(index) const down = this.createIndexSql(table, index) await this.executeQueries(up, down) table.removeIndex(index) } /** * Drops an indices from the table. */ async dropIndices( tableOrName: Table | string, indices: TableIndex[], ): Promise<void> { const promises = indices.map((index) => this.dropIndex(tableOrName, index), ) await Promise.all(promises) } /** * Clears all table contents. * Note: this operation uses SQL's TRUNCATE query which cannot be reverted in transactions. */ async clearTable(tableName: string): Promise<void> { await this.query(`TRUNCATE TABLE ${this.escapePath(tableName)}`) } /** * Removes all tables from the currently connected database. */ async clearDatabase(): Promise<void> { const isAnotherTransactionActive = this.isTransactionActive if (!isAnotherTransactionActive) await this.startTransaction() try { // drop views const dropViewsQuery = `SELECT 'DROP VIEW "' || VIEW_NAME || '"' AS "query" FROM "USER_VIEWS"` const dropViewQueries: ObjectLiteral[] = await this.query( dropViewsQuery, ) await Promise.all( dropViewQueries.map((query) => this.query(query["query"])), ) // drop materialized views const dropMatViewsQuery = `SELECT 'DROP MATERIALIZED VIEW "' || MVIEW_NAME || '"' AS "query" FROM "USER_MVIEWS"` const dropMatViewQueries: ObjectLiteral[] = await this.query( dropMatViewsQuery, ) await Promise.all( dropMatViewQueries.map((query) => this.query(query["query"])), ) // drop tables const dropTablesQuery = `SELECT 'DROP TABLE "' || TABLE_NAME || '" CASCADE CONSTRAINTS' AS "query" FROM "USER_TABLES"` const dropTableQueries: ObjectLiteral[] = await this.query( dropTablesQuery, ) await Promise.all( dropTableQueries.map((query) => this.query(query["query"])), ) if (!isAnotherTransactionActive) await this.commitTransaction() } catch (error) { try { // we throw original error even if rollback thrown an error if (!isAnotherTransactionActive) await this.rollbackTransaction() } catch (rollbackError) {} throw error } } // your_sha256_hash--------- // Protected Methods // your_sha256_hash--------- protected async loadViews(viewNames?: string[]): Promise<View[]> { const hasTable = await this.hasTable(this.getTypeormMetadataTableName()) if (!hasTable) { return [] } if (!viewNames) { viewNames = [] } const currentDatabase = await this.getCurrentDatabase() const currentSchema = await this.getCurrentSchema() const viewsCondition = viewNames .map((viewName) => this.driver.parseTableName(viewName)) .map(({ schema, tableName }) => { if (!schema) { schema = this.driver.options.schema || currentSchema } return `("T"."schema" = '${schema}' AND "T"."name" = '${tableName}')` }) .join(" OR ") let query = `SELECT "T".* FROM ${this.escapePath( this.getTypeormMetadataTableName(), )} "T" ` + `INNER JOIN "USER_OBJECTS" "O" ON "O"."OBJECT_NAME" = "T"."name" AND "O"."OBJECT_TYPE" IN ( 'MATERIALIZED VIEW', 'VIEW' ) ` + `WHERE "T"."type" IN ('${MetadataTableType.MATERIALIZED_VIEW}', '${MetadataTableType.VIEW}')` if (viewsCondition.length > 0) query += ` AND ${viewsCondition}` const dbViews = await this.query(query) return dbViews.map((dbView: any) => { const parsedName = this.driver.parseTableName(dbView["name"]) const view = new View() view.database = parsedName.database || dbView["database"] || currentDatabase view.schema = parsedName.schema || dbView["schema"] || currentSchema view.name = parsedName.tableName view.expression = dbView["value"] view.materialized = dbView["type"] === MetadataTableType.MATERIALIZED_VIEW return view }) } /** * Loads all tables (with given names) from the database and creates a Table from them. */ protected async loadTables(tableNames?: string[]): Promise<Table[]> { if (tableNames && tableNames.length === 0) { return [] } const dbTables: { TABLE_NAME: string; OWNER: string }[] = [] const currentSchema = await this.getCurrentSchema() const currentDatabase = await this.getCurrentDatabase() if (!tableNames) { const tablesSql = `SELECT "TABLE_NAME", "OWNER" FROM "ALL_TABLES"` dbTables.push(...(await this.query(tablesSql))) } else { const tablesCondition = tableNames .map((tableName) => { const parts = tableName.split(".") if (parts.length >= 3) { const [, schema, name] = parts return `("OWNER" = '${schema}' AND "TABLE_NAME" = '${name}')` } else if (parts.length === 2) { const [schema, name] = parts return `("OWNER" = '${schema}' AND "TABLE_NAME" = '${name}')` } else if (parts.length === 1) { const [name] = parts return `("TABLE_NAME" = '${name}')` } else { return `(1=0)` } }) .join(" OR ") const tablesSql = `SELECT "TABLE_NAME", "OWNER" FROM "ALL_TABLES" WHERE ${tablesCondition}` dbTables.push(...(await this.query(tablesSql))) } // if tables were not found in the db, no need to proceed if (dbTables.length === 0) { return [] } // load tables, columns, indices and foreign keys const columnsCondition = dbTables .map(({ TABLE_NAME, OWNER }) => { return `("C"."OWNER" = '${OWNER}' AND "C"."TABLE_NAME" = '${TABLE_NAME}')` }) .join(" OR ") const columnsSql = `SELECT * FROM "ALL_TAB_COLS" "C" WHERE (${columnsCondition})` const indicesSql = `SELECT "C"."INDEX_NAME", "C"."OWNER", "C"."TABLE_NAME", "C"."UNIQUENESS", ` + `LISTAGG ("COL"."COLUMN_NAME", ',') WITHIN GROUP (ORDER BY "COL"."COLUMN_NAME") AS "COLUMN_NAMES" ` + `FROM "ALL_INDEXES" "C" ` + `INNER JOIN "ALL_IND_COLUMNS" "COL" ON "COL"."INDEX_OWNER" = "C"."OWNER" AND "COL"."INDEX_NAME" = "C"."INDEX_NAME" ` + `LEFT JOIN "ALL_CONSTRAINTS" "CON" ON "CON"."OWNER" = "C"."OWNER" AND "CON"."CONSTRAINT_NAME" = "C"."INDEX_NAME" ` + `WHERE (${columnsCondition}) AND "CON"."CONSTRAINT_NAME" IS NULL ` + `GROUP BY "C"."INDEX_NAME", "C"."OWNER", "C"."TABLE_NAME", "C"."UNIQUENESS"` const foreignKeysSql = `SELECT "C"."CONSTRAINT_NAME", "C"."OWNER", "C"."TABLE_NAME", "COL"."COLUMN_NAME", "REF_COL"."TABLE_NAME" AS "REFERENCED_TABLE_NAME", ` + `"REF_COL"."COLUMN_NAME" AS "REFERENCED_COLUMN_NAME", "C"."DELETE_RULE" AS "ON_DELETE" ` + `FROM "ALL_CONSTRAINTS" "C" ` + `INNER JOIN "ALL_CONS_COLUMNS" "COL" ON "COL"."OWNER" = "C"."OWNER" AND "COL"."CONSTRAINT_NAME" = "C"."CONSTRAINT_NAME" ` + `INNER JOIN "ALL_CONS_COLUMNS" "REF_COL" ON "REF_COL"."OWNER" = "C"."R_OWNER" AND "REF_COL"."CONSTRAINT_NAME" = "C"."R_CONSTRAINT_NAME" AND "REF_COL"."POSITION" = "COL"."POSITION" ` + `WHERE (${columnsCondition}) AND "C"."CONSTRAINT_TYPE" = 'R'` const constraintsSql = `SELECT "C"."CONSTRAINT_NAME", "C"."CONSTRAINT_TYPE", "C"."OWNER", "C"."TABLE_NAME", "COL"."COLUMN_NAME", "C"."SEARCH_CONDITION" ` + `FROM "ALL_CONSTRAINTS" "C" ` + `INNER JOIN "ALL_CONS_COLUMNS" "COL" ON "COL"."OWNER" = "C"."OWNER" AND "COL"."CONSTRAINT_NAME" = "C"."CONSTRAINT_NAME" ` + `WHERE (${columnsCondition}) AND "C"."CONSTRAINT_TYPE" IN ('C', 'U', 'P') AND "C"."GENERATED" = 'USER NAME'` const [ dbColumns, dbIndices, dbForeignKeys, dbConstraints, ]: ObjectLiteral[][] = await Promise.all([ this.query(columnsSql), this.query(indicesSql), this.query(foreignKeysSql), this.query(constraintsSql), ]) // create tables for loaded tables return await Promise.all( dbTables.map(async (dbTable) => { const table = new Table() const owner = dbTable["OWNER"] === currentSchema && (!this.driver.options.schema || this.driver.options.schema === currentSchema) ? undefined : dbTable["OWNER"] table.database = currentDatabase table.schema = dbTable["OWNER"] table.name = this.driver.buildTableName( dbTable["TABLE_NAME"], owner, ) // create columns from the loaded columns table.columns = await Promise.all( dbColumns .filter( (dbColumn) => dbColumn["OWNER"] === dbTable["OWNER"] && dbColumn["TABLE_NAME"] === dbTable["TABLE_NAME"] && // Filter out auto-generated virtual columns, // since TypeORM will have no info about them. !( dbColumn["VIRTUAL_COLUMN"] === "YES" && dbColumn["USER_GENERATED"] === "NO" ), ) .map(async (dbColumn) => { const columnConstraints = dbConstraints.filter( (dbConstraint) => dbConstraint["OWNER"] === dbColumn["OWNER"] && dbConstraint["TABLE_NAME"] === dbColumn["TABLE_NAME"] && dbConstraint["COLUMN_NAME"] === dbColumn["COLUMN_NAME"], ) const uniqueConstraints = columnConstraints.filter( (constraint) => constraint["CONSTRAINT_TYPE"] === "U", ) const isConstraintComposite = uniqueConstraints.every((uniqueConstraint) => { return dbConstraints.some( (dbConstraint) => dbConstraint["OWNER"] === dbColumn["OWNER"] && dbConstraint["TABLE_NAME"] === dbColumn["TABLE_NAME"] && dbConstraint["COLUMN_NAME"] !== dbColumn["COLUMN_NAME"] && dbConstraint["CONSTRAINT_NAME"] === uniqueConstraint[ "CONSTRAINT_NAME" ] && dbConstraint["CONSTRAINT_TYPE"] === "U", ) }) const tableColumn = new TableColumn() tableColumn.name = dbColumn["COLUMN_NAME"] tableColumn.type = dbColumn["DATA_TYPE"].toLowerCase() if (tableColumn.type.indexOf("(") !== -1) tableColumn.type = tableColumn.type.replace( /\([0-9]*\)/, "", ) // check only columns that have length property if ( this.driver.withLengthColumnTypes.indexOf( tableColumn.type as ColumnType, ) !== -1 ) { const length = tableColumn.type === "raw" ? dbColumn["DATA_LENGTH"] : dbColumn["CHAR_COL_DECL_LENGTH"] tableColumn.length = length && !this.isDefaultColumnLength( table, tableColumn, length, ) ? length.toString() : "" } if ( tableColumn.type === "number" || tableColumn.type === "float" ) { if ( dbColumn["DATA_PRECISION"] !== null && !this.isDefaultColumnPrecision( table, tableColumn, dbColumn["DATA_PRECISION"], ) ) tableColumn.precision = dbColumn["DATA_PRECISION"] if ( dbColumn["DATA_SCALE"] !== null && !this.isDefaultColumnScale( table, tableColumn, dbColumn["DATA_SCALE"], ) ) tableColumn.scale = dbColumn["DATA_SCALE"] } else if ( (tableColumn.type === "timestamp" || tableColumn.type === "timestamp with time zone" || tableColumn.type === "timestamp with local time zone") && dbColumn["DATA_SCALE"] !== null ) { tableColumn.precision = !this.isDefaultColumnPrecision( table, tableColumn, dbColumn["DATA_SCALE"], ) ? dbColumn["DATA_SCALE"] : undefined } tableColumn.default = dbColumn["DATA_DEFAULT"] !== null && dbColumn["DATA_DEFAULT"] !== undefined && dbColumn["VIRTUAL_COLUMN"] === "NO" && dbColumn["DATA_DEFAULT"].trim() !== "NULL" ? (tableColumn.default = dbColumn["DATA_DEFAULT"].trim()) : undefined const primaryConstraint = columnConstraints.find( (constraint) => constraint["CONSTRAINT_TYPE"] === "P", ) if (primaryConstraint) { tableColumn.isPrimary = true // find another columns involved in primary key constraint const anotherPrimaryConstraints = dbConstraints.filter( (constraint) => constraint["OWNER"] === dbColumn["OWNER"] && constraint["TABLE_NAME"] === dbColumn["TABLE_NAME"] && constraint["COLUMN_NAME"] !== dbColumn["COLUMN_NAME"] && constraint["CONSTRAINT_TYPE"] === "P", ) // collect all column names const columnNames = anotherPrimaryConstraints.map( (constraint) => constraint["COLUMN_NAME"], ) columnNames.push(dbColumn["COLUMN_NAME"]) // build default primary key constraint name const pkName = this.connection.namingStrategy.primaryKeyName( table, columnNames, ) // if primary key has user-defined constraint name, write it in table column if ( primaryConstraint["CONSTRAINT_NAME"] !== pkName ) { tableColumn.primaryKeyConstraintName = primaryConstraint["CONSTRAINT_NAME"] } } tableColumn.isNullable = dbColumn["NULLABLE"] === "Y" tableColumn.isUnique = uniqueConstraints.length > 0 && !isConstraintComposite tableColumn.isGenerated = dbColumn["IDENTITY_COLUMN"] === "YES" if (tableColumn.isGenerated) { tableColumn.generationStrategy = "increment" tableColumn.default = undefined } tableColumn.comment = "" // todo if (dbColumn["VIRTUAL_COLUMN"] === "YES") { tableColumn.generatedType = "VIRTUAL" const asExpressionQuery = this.selectTypeormMetadataSql({ table: dbTable["TABLE_NAME"], type: MetadataTableType.GENERATED_COLUMN, name: tableColumn.name, }) const results = await this.query( asExpressionQuery.query, asExpressionQuery.parameters, ) if (results[0] && results[0].value) { tableColumn.asExpression = results[0].value } else { tableColumn.asExpression = "" } } return tableColumn }), ) // find unique constraints of table, group them by constraint name and build TableUnique. const tableUniqueConstraints = OrmUtils.uniq( dbConstraints.filter((dbConstraint) => { return ( dbConstraint["TABLE_NAME"] === dbTable["TABLE_NAME"] && dbConstraint["OWNER"] === dbTable["OWNER"] && dbConstraint["CONSTRAINT_TYPE"] === "U" ) }), (dbConstraint) => dbConstraint["CONSTRAINT_NAME"], ) table.uniques = tableUniqueConstraints.map((constraint) => { const uniques = dbConstraints.filter( (dbC) => dbC["CONSTRAINT_NAME"] === constraint["CONSTRAINT_NAME"], ) return new TableUnique({ name: constraint["CONSTRAINT_NAME"], columnNames: uniques.map((u) => u["COLUMN_NAME"]), }) }) // find check constraints of table, group them by constraint name and build TableCheck. const tableCheckConstraints = OrmUtils.uniq( dbConstraints.filter((dbConstraint) => { return ( dbConstraint["TABLE_NAME"] === dbTable["TABLE_NAME"] && dbConstraint["OWNER"] === dbTable["OWNER"] && dbConstraint["CONSTRAINT_TYPE"] === "C" ) }), (dbConstraint) => dbConstraint["CONSTRAINT_NAME"], ) table.checks = tableCheckConstraints.map((constraint) => { const checks = dbConstraints.filter( (dbC) => dbC["TABLE_NAME"] === constraint["TABLE_NAME"] && dbC["OWNER"] === constraint["OWNER"] && dbC["CONSTRAINT_NAME"] === constraint["CONSTRAINT_NAME"], ) return new TableCheck({ name: constraint["CONSTRAINT_NAME"], columnNames: checks.map((c) => c["COLUMN_NAME"]), expression: constraint["SEARCH_CONDITION"], }) }) // find foreign key constraints of table, group them by constraint name and build TableForeignKey. const tableForeignKeyConstraints = OrmUtils.uniq( dbForeignKeys.filter( (dbForeignKey) => dbForeignKey["OWNER"] === dbTable["OWNER"] && dbForeignKey["TABLE_NAME"] === dbTable["TABLE_NAME"], ), (dbForeignKey) => dbForeignKey["CONSTRAINT_NAME"], ) table.foreignKeys = tableForeignKeyConstraints.map( (dbForeignKey) => { const foreignKeys = dbForeignKeys.filter( (dbFk) => dbFk["TABLE_NAME"] === dbForeignKey["TABLE_NAME"] && dbFk["OWNER"] === dbForeignKey["OWNER"] && dbFk["CONSTRAINT_NAME"] === dbForeignKey["CONSTRAINT_NAME"], ) return new TableForeignKey({ name: dbForeignKey["CONSTRAINT_NAME"], columnNames: foreignKeys.map( (dbFk) => dbFk["COLUMN_NAME"], ), referencedDatabase: table.database, referencedSchema: dbForeignKey["OWNER"], referencedTableName: dbForeignKey["REFERENCED_TABLE_NAME"], referencedColumnNames: foreignKeys.map( (dbFk) => dbFk["REFERENCED_COLUMN_NAME"], ), onDelete: dbForeignKey["ON_DELETE"], onUpdate: "NO ACTION", // Oracle does not have onUpdate option in FK's, but we need it for proper synchronization }) }, ) // Attempt to map auto-generated virtual columns to their // referenced columns, through its 'DATA_DEFAULT' property. // // An example of this happening is when a column of type // TIMESTAMP WITH TIME ZONE is indexed. Oracle will create a // virtual column of type TIMESTAMP with a default value of // SYS_EXTRACT_UTC(<column>). const autoGenVirtualDbColumns = dbColumns .filter( (dbColumn) => dbColumn["OWNER"] === dbTable["OWNER"] && dbColumn["TABLE_NAME"] === dbTable["TABLE_NAME"] && dbColumn["VIRTUAL_COLUMN"] === "YES" && dbColumn["USER_GENERATED"] === "NO", ) .reduce((acc, x) => { const referencedDbColumn = dbColumns.find((dbColumn) => x["DATA_DEFAULT"].includes(dbColumn["COLUMN_NAME"]), ) if (!referencedDbColumn) return acc return { ...acc, [x["COLUMN_NAME"]]: referencedDbColumn["COLUMN_NAME"], } }, {}) // create TableIndex objects from the loaded indices table.indices = dbIndices .filter( (dbIndex) => dbIndex["TABLE_NAME"] === dbTable["TABLE_NAME"] && dbIndex["OWNER"] === dbTable["OWNER"], ) .map((dbIndex) => { // const columnNames = dbIndex["COLUMN_NAMES"] .split(",") .map( ( columnName: keyof typeof autoGenVirtualDbColumns, ) => autoGenVirtualDbColumns[columnName] ?? columnName, ) return new TableIndex({ name: dbIndex["INDEX_NAME"], columnNames, isUnique: dbIndex["UNIQUENESS"] === "UNIQUE", }) }) return table }), ) } /** * Builds and returns SQL for create table. */ protected createTableSql(table: Table, createForeignKeys?: boolean): Query { const columnDefinitions = table.columns .map((column) => this.buildCreateColumnSql(column)) .join(", ") let sql = `CREATE TABLE ${this.escapePath(table)} (${columnDefinitions}` table.columns .filter((column) => column.isUnique) .forEach((column) => { const isUniqueExist = table.uniques.some( (unique) => unique.columnNames.length === 1 && unique.columnNames[0] === column.name, ) if (!isUniqueExist) table.uniques.push( new TableUnique({ name: this.connection.namingStrategy.uniqueConstraintName( table, [column.name], ), columnNames: [column.name], }), ) }) if (table.uniques.length > 0) { const uniquesSql = table.uniques .map((unique) => { const uniqueName = unique.name ? unique.name : this.connection.namingStrategy.uniqueConstraintName( table, unique.columnNames, ) const columnNames = unique.columnNames .map((columnName) => `"${columnName}"`) .join(", ") return `CONSTRAINT "${uniqueName}" UNIQUE (${columnNames})` }) .join(", ") sql += `, ${uniquesSql}` } if (table.checks.length > 0) { const checksSql = table.checks .map((check) => { const checkName = check.name ? check.name : this.connection.namingStrategy.checkConstraintName( table, check.expression!, ) return `CONSTRAINT "${checkName}" CHECK (${check.expression})` }) .join(", ") sql += `, ${checksSql}` } if (table.foreignKeys.length > 0 && createForeignKeys) { const foreignKeysSql = table.foreignKeys .map((fk) => { const columnNames = fk.columnNames .map((columnName) => `"${columnName}"`) .join(", ") if (!fk.name) fk.name = this.connection.namingStrategy.foreignKeyName( table, fk.columnNames, this.getTablePath(fk), fk.referencedColumnNames, ) const referencedColumnNames = fk.referencedColumnNames .map((columnName) => `"${columnName}"`) .join(", ") let constraint = `CONSTRAINT "${ fk.name }" FOREIGN KEY (${columnNames}) REFERENCES ${this.escapePath( this.getTablePath(fk), )} (${referencedColumnNames})` if (fk.onDelete && fk.onDelete !== "NO ACTION") { // Oracle does not support NO ACTION, but we set NO ACTION by default in EntityMetadata constraint += ` ON DELETE ${fk.onDelete}` } return constraint }) .join(", ") sql += `, ${foreignKeysSql}` } const primaryColumns = table.columns.filter( (column) => column.isPrimary, ) if (primaryColumns.length > 0) { const primaryKeyName = primaryColumns[0].primaryKeyConstraintName ? primaryColumns[0].primaryKeyConstraintName : this.connection.namingStrategy.primaryKeyName( table, primaryColumns.map((column) => column.name), ) const columnNames = primaryColumns .map((column) => `"${column.name}"`) .join(", ") sql += `, CONSTRAINT "${primaryKeyName}" PRIMARY KEY (${columnNames})` } sql += `)` return new Query(sql) } /** * Builds drop table sql. */ protected dropTableSql( tableOrName: Table | string, ifExist?: boolean, ): Query { const query = ifExist ? `DROP TABLE IF EXISTS ${this.escapePath(tableOrName)}` : `DROP TABLE ${this.escapePath(tableOrName)}` return new Query(query) } protected createViewSql(view: View): Query { const materializedClause = view.materialized ? "MATERIALIZED " : "" if (typeof view.expression === "string") { return new Query( `CREATE ${materializedClause}VIEW ${this.escapePath(view)} AS ${ view.expression }`, ) } else { return new Query( `CREATE ${materializedClause}VIEW ${this.escapePath( view, )} AS ${view.expression(this.connection).getQuery()}`, ) } } protected insertViewDefinitionSql(view: View): Query { const expression = typeof view.expression === "string" ? view.expression.trim() : view.expression(this.connection).getQuery() const type = view.materialized ? MetadataTableType.MATERIALIZED_VIEW : MetadataTableType.VIEW const { schema, tableName } = this.driver.parseTableName(view) return this.insertTypeormMetadataSql({ type: type, name: tableName, schema: schema, value: expression, }) } /** * Builds drop view sql. */ protected dropViewSql(view: View): Query { const materializedClause = view.materialized ? "MATERIALIZED " : "" return new Query( `DROP ${materializedClause}VIEW ${this.escapePath(view)}`, ) } /** * Builds remove view sql. */ protected deleteViewDefinitionSql(view: View): Query { const type = view.materialized ? MetadataTableType.MATERIALIZED_VIEW : MetadataTableType.VIEW return this.deleteTypeormMetadataSql({ type, name: view.name }) } /** * Builds create index sql. */ protected createIndexSql(table: Table, index: TableIndex): Query { const columns = index.columnNames .map((columnName) => `"${columnName}"`) .join(", ") return new Query( `CREATE ${index.isUnique ? "UNIQUE " : ""}INDEX "${ index.name }" ON ${this.escapePath(table)} (${columns})`, ) } /** * Builds drop index sql. */ protected dropIndexSql(indexOrName: TableIndex | string): Query { let indexName = InstanceChecker.isTableIndex(indexOrName) ? indexOrName.name : indexOrName return new Query(`DROP INDEX "${indexName}"`) } /** * Builds create primary key sql. */ protected createPrimaryKeySql( table: Table, columnNames: string[], constraintName?: string, ): Query { const primaryKeyName = constraintName ? constraintName : this.connection.namingStrategy.primaryKeyName(table, columnNames) const columnNamesString = columnNames .map((columnName) => `"${columnName}"`) .join(", ") return new Query( `ALTER TABLE ${this.escapePath( table, )} ADD CONSTRAINT "${primaryKeyName}" PRIMARY KEY (${columnNamesString})`, ) } /** * Builds drop primary key sql. */ protected dropPrimaryKeySql(table: Table): Query { if (!table.primaryColumns.length) throw new TypeORMError(`Table ${table} has no primary keys.`) const columnNames = table.primaryColumns.map((column) => column.name) const constraintName = table.primaryColumns[0].primaryKeyConstraintName const primaryKeyName = constraintName ? constraintName : this.connection.namingStrategy.primaryKeyName(table, columnNames) return new Query( `ALTER TABLE ${this.escapePath( table, )} DROP CONSTRAINT "${primaryKeyName}"`, ) } /** * Builds create unique constraint sql. */ protected createUniqueConstraintSql( table: Table, uniqueConstraint: TableUnique, ): Query { const columnNames = uniqueConstraint.columnNames .map((column) => `"` + column + `"`) .join(", ") return new Query( `ALTER TABLE ${this.escapePath(table)} ADD CONSTRAINT "${ uniqueConstraint.name }" UNIQUE (${columnNames})`, ) } /** * Builds drop unique constraint sql. */ protected dropUniqueConstraintSql( table: Table, uniqueOrName: TableUnique | string, ): Query { const uniqueName = InstanceChecker.isTableUnique(uniqueOrName) ? uniqueOrName.name : uniqueOrName return new Query( `ALTER TABLE ${this.escapePath( table, )} DROP CONSTRAINT "${uniqueName}"`, ) } /** * Builds create check constraint sql. */ protected createCheckConstraintSql( table: Table, checkConstraint: TableCheck, ): Query { return new Query( `ALTER TABLE ${this.escapePath(table)} ADD CONSTRAINT "${ checkConstraint.name }" CHECK (${checkConstraint.expression})`, ) } /** * Builds drop check constraint sql. */ protected dropCheckConstraintSql( table: Table, checkOrName: TableCheck | string, ): Query { const checkName = InstanceChecker.isTableCheck(checkOrName) ? checkOrName.name : checkOrName return new Query( `ALTER TABLE ${this.escapePath( table, )} DROP CONSTRAINT "${checkName}"`, ) } /** * Builds create foreign key sql. */ protected createForeignKeySql( table: Table, foreignKey: TableForeignKey, ): Query { const columnNames = foreignKey.columnNames .map((column) => `"` + column + `"`) .join(", ") const referencedColumnNames = foreignKey.referencedColumnNames .map((column) => `"` + column + `"`) .join(",") let sql = `ALTER TABLE ${this.escapePath(table)} ADD CONSTRAINT "${ foreignKey.name }" FOREIGN KEY (${columnNames}) ` + `REFERENCES ${this.escapePath( this.getTablePath(foreignKey), )} (${referencedColumnNames})` // Oracle does not support NO ACTION, but we set NO ACTION by default in EntityMetadata if (foreignKey.onDelete && foreignKey.onDelete !== "NO ACTION") { sql += ` ON DELETE ${foreignKey.onDelete}` } return new Query(sql) } /** * Builds drop foreign key sql. */ protected dropForeignKeySql( table: Table, foreignKeyOrName: TableForeignKey | string, ): Query { const foreignKeyName = InstanceChecker.isTableForeignKey( foreignKeyOrName, ) ? foreignKeyOrName.name : foreignKeyOrName return new Query( `ALTER TABLE ${this.escapePath( table, )} DROP CONSTRAINT "${foreignKeyName}"`, ) } /** * Builds a query for create column. */ protected buildCreateColumnSql(column: TableColumn) { let c = `"${column.name}" ` + this.connection.driver.createFullType(column) if (column.charset) c += " CHARACTER SET " + column.charset if (column.collation) c += " COLLATE " + column.collation if (column.asExpression) c += ` AS (${column.asExpression}) VIRTUAL` if (column.default !== undefined && column.default !== null) // DEFAULT must be placed before NOT NULL c += " DEFAULT " + column.default if (column.isNullable !== true && !column.isGenerated) // NOT NULL is not supported with GENERATED c += " NOT NULL" if ( column.isGenerated === true && column.generationStrategy === "increment" ) c += " GENERATED BY DEFAULT AS IDENTITY" return c } /** * Escapes given table or view path. */ protected escapePath(target: Table | View | string): string { // Ignore database when escaping paths const { schema, tableName } = this.driver.parseTableName(target) if (schema && schema !== this.driver.schema) { return `"${schema}"."${tableName}"` } return `"${tableName}"` } /** * Change table comment. */ changeTableComment( tableOrName: Table | string, comment?: string, ): Promise<void> { throw new TypeORMError( `oracle driver does not support change table comment.`, ) } } ```
/content/code_sandbox/src/driver/oracle/OracleQueryRunner.ts
xml
2016-02-29T07:41:14
2024-08-16T18:28:52
typeorm
typeorm/typeorm
33,875
20,880
```xml import { websiteOrigin } from '../../apiClient'; import { openAuthSessionAsync, getAuthSchemeAsync } from '../../native-modules/DevLauncherAuth'; import { startAuthSessionAsync } from '../startAuthSessionAsync'; const mockOpenAuthSessionAsync = openAuthSessionAsync as jest.Mock; const mockGetAuthSchemeAsync = getAuthSchemeAsync as jest.Mock; describe('startAuthSessionAsync()', () => { beforeEach(() => { mockOpenAuthSessionAsync.mockResolvedValue({ type: 'success', url: 'path_to_url }); }); afterEach(() => { mockOpenAuthSessionAsync.mockClear(); mockGetAuthSchemeAsync.mockClear(); }); test('signup calls openAuthSessionAsync()', async () => { const fakeScheme = 'test-scheme'; mockGetAuthSchemeAsync.mockResolvedValue(fakeScheme); expect(openAuthSessionAsync).not.toHaveBeenCalled(); expect(getAuthSchemeAsync).not.toHaveBeenCalled(); await startAuthSessionAsync('signup'); expect(getAuthSchemeAsync).toHaveBeenCalled(); expect(openAuthSessionAsync).toHaveBeenCalled(); expect(openAuthSessionAsync).toHaveBeenCalledWith( expect.stringContaining('signup'), expect.stringMatching(fakeScheme) ); expect(openAuthSessionAsync).toHaveBeenCalledWith( expect.stringContaining(websiteOrigin), expect.stringMatching(fakeScheme) ); }); test('login calls openAuthSessionAsync()', async () => { const fakeScheme = 'another-test-scheme'; mockGetAuthSchemeAsync.mockResolvedValue(fakeScheme); expect(openAuthSessionAsync).not.toHaveBeenCalled(); expect(getAuthSchemeAsync).not.toHaveBeenCalled(); await startAuthSessionAsync('login'); expect(openAuthSessionAsync).toHaveBeenCalled(); expect(getAuthSchemeAsync).toHaveBeenCalled(); expect(openAuthSessionAsync).toHaveBeenCalledWith( expect.stringContaining('login'), expect.stringMatching(fakeScheme) ); expect(openAuthSessionAsync).toHaveBeenCalledWith( expect.stringContaining(websiteOrigin), expect.stringMatching(fakeScheme) ); }); }); ```
/content/code_sandbox/packages/expo-dev-launcher/bundle/functions/__tests__/startAuthSessionAsync.test.ts
xml
2016-08-15T17:14:25
2024-08-16T19:54:44
expo
expo/expo
32,004
426
```xml import * as React from 'react'; import { ExampleCard, IComponentDemoPageProps, ComponentPage, PropertiesTableSet, } from '@fluentui/react-docsite-components'; import { FolderCoverBasicExample } from './FolderCover.Basic.Example'; const FolderCoverBasicExampleCode = require('!raw-loader?esModule=false!@fluentui/react-examples/src/react-experiments/FolderCover/FolderCover.Basic.Example.tsx') as string; export class FolderCoverPage extends React.Component<IComponentDemoPageProps, {}> { public render(): JSX.Element { return ( <ComponentPage title="FolderCover" componentName="FolderCover" exampleCards={ <div> <ExampleCard title="Folder Cover" isOptIn={true} code={FolderCoverBasicExampleCode}> <FolderCoverBasicExample /> </ExampleCard> </div> } propertiesTables={ <PropertiesTableSet sources={[ require<string>('!raw-loader?esModule=false!@fluentui/react-experiments/src/components/FolderCover/FolderCover.types.ts'), ]} /> } overview={ <div> Initialize folder covers first using <code>initializeFolderCovers()</code>. </div> } dos={ <div> <ul> <li>Use them to represent a folder which may contain visual content.</li> </ul> </div> } donts={ <div> <ul> <li>To represent the concept of a folder as opposed to an actual folder item.</li> </ul> </div> } isHeaderVisible={this.props.isHeaderVisible} /> ); } } ```
/content/code_sandbox/packages/react-examples/src/react-experiments/FolderCover/FolderCoverPage.tsx
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
369
```xml import { log } from 'wechaty-puppet' import type { Constructor } from 'clone-class' import type { WechatyInterface } from '../wechaty/mod.js' const WECHATIFIED_PREFIX = 'Wechatified' interface WechatyMinxin { wechaty: WechatyInterface, new (...args: any[]): { get wechaty (): WechatyInterface } } const wechatifyUserModule = <T extends WechatyMinxin> (UserClass: T) => { log.verbose('WechatifyMixin', 'wechatifyUserModule(%s)', UserClass.name) return (wechaty: WechatyInterface): T => { log.verbose('WechatifyMixin', 'wechatifyUserModule(%s)(%s)', UserClass.name, wechaty) class WechatifiedUserClass extends UserClass { static override get wechaty () { return wechaty } override get wechaty () { return wechaty } } Reflect.defineProperty(WechatifiedUserClass, 'name', { value: WECHATIFIED_PREFIX + UserClass.name, }) return WechatifiedUserClass } } const throwWechatifyError = (WechatyUserClass: Function) => { throw new Error([ `${WechatyUserClass.name}: Wechaty User Class (WUC) can not be instantiated directly!`, 'See: path_to_url ].join('\n')) } const isWechatified = (klass: Function) => klass.name.startsWith(WECHATIFIED_PREFIX) const wechatifyMixin = <TBase extends Constructor> (Base: TBase) => { log.verbose('WechatifyMixin', 'wechatifyMixin(%s)', Base.name || '') abstract class AbstractWechatifyMixin extends Base { static get wechaty (): WechatyInterface { return throwWechatifyError(this) } get wechaty (): WechatyInterface { return throwWechatifyError(this.constructor) } constructor (...args: any[]) { super(...args) if (!isWechatified(this.constructor)) { throwWechatifyError(this.constructor) } } } return AbstractWechatifyMixin } const wechatifyMixinBase = () => wechatifyMixin(class EmptyBase {}) export { isWechatified, wechatifyMixin, wechatifyMixinBase, wechatifyUserModule, } ```
/content/code_sandbox/src/user-mixins/wechatify.ts
xml
2016-05-01T14:36:45
2024-08-16T17:27:03
wechaty
wechaty/wechaty
19,828
529
```xml import type * as Har from 'har-format'; import type { Body, Converter, ImportRequest } from '../entities'; export const id = 'har'; export const name = 'HAR 1.2'; export const description = 'Importer for HTTP Archive 1.2'; let requestCount = 1; interface HarRoot { log: { entries: Har.Entry[]; }; httpVersion: string; method: string; url: string; } const extractRequests = (harRoot: HarRoot): ImportRequest[] => { const { log, httpVersion, method, url } = harRoot; if (!log && httpVersion && method && url) { // If there is not "log" property, try to use the root object if it looks like a request return [harRoot]; } return log.entries.map(({ comment, request }) => { if (comment && request && !request.comment) { // Preserve the entry comment for request name generation request.comment = comment; } return request; }); }; const removeComment = <T extends { comment?: string }>(obj: T) => { const { comment, ...newObject } = obj; return newObject; }; const importPostData = (postData?: Har.PostData): Body => { if (!postData) { return {}; } const { params, mimeType = '', text = '' } = postData; if (params && params.length) { return { mimeType: mimeType || 'application/x-www-form-urlencoded', params: params.map(({ name, fileName, value = '' }) => ({ name, ...(fileName ? { fileName } : { value }), })), }; } else { return { mimeType, text, }; } }; const importRequest = (request: ImportRequest): ImportRequest => { const cookieHeaderValue = (request.cookies ?? []) .map(({ name, value }) => `${name}=${value}`) .join('; '); const headers = request.headers ? request.headers.map(removeComment) : []; // Convert cookie value to header const existingCookieHeader = headers.find( header => header.name.toLowerCase() === 'cookie', ); if (cookieHeaderValue && existingCookieHeader) { // Has existing cookie header, so let's update it existingCookieHeader.value += `; ${cookieHeaderValue}`; } else if (cookieHeaderValue) { // No existing cookie header, so let's make a new one headers.push({ name: 'Cookie', value: cookieHeaderValue, }); } const count = requestCount++; return { _type: 'request', _id: `__REQ_${count}__`, name: request.comment || request.url || `HAR Import ${count}`, parentId: '__WORKSPACE_ID__', url: request.url, method: request.method?.toUpperCase(), body: importPostData(request.postData), parameters: request.queryString ? request.queryString.map(removeComment) : [], headers: headers, // Authentication isn't part of HAR, but we should be able to sniff for things like Basic Authentication headers and pull out the auth info authentication: {}, }; }; export const convert: Converter = rawData => { requestCount = 1; try { const data = JSON.parse(rawData); const requests = extractRequests(data); return requests.map(importRequest); } catch (error) { return null; } }; ```
/content/code_sandbox/packages/insomnia/src/utils/importers/importers/har.ts
xml
2016-04-23T03:54:26
2024-08-16T16:50:44
insomnia
Kong/insomnia
34,054
743
```xml <?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="path_to_url"> <!-- This file is used to set configuration option for all projects. --> <!-- Automatic PlatformToolset version selection. --> <!-- If there is no DefaultPlatformToolset set, we will try to detect the version based on version of the build tools. --> <PropertyGroup> <BuildToolVersion>$(VisualStudioVersion)</BuildToolVersion> <!-- Only use the MSBuildToolsVersion if we don't have the VisualStudioVersion and MSBuildToolsVersion is set to something other than Current. --> <BuildToolVersion Condition="'$(BuildToolVersion)'=='' and '$(MSBuildToolsVersion)' != 'Current'">$(MSBuildToolsVersion)</BuildToolVersion> <!-- Version Note: v140 is the Visual Studio 2015 toolset. (14.0) v141 is the Visual Studio 2017 toolset. (15.0) v142 is the Visual Studio 2019 toolset. (16.0) v143 is the Visual Studio 2022 toolset. (17.0) --> <AutoDetectedPlatformToolset Condition="'$(BuildToolVersion)'=='14.0'">v140</AutoDetectedPlatformToolset> <AutoDetectedPlatformToolset Condition="'$(BuildToolVersion)'=='15.0'">v141</AutoDetectedPlatformToolset> <AutoDetectedPlatformToolset Condition="'$(BuildToolVersion)'=='16.0'">v142</AutoDetectedPlatformToolset> <AutoDetectedPlatformToolset Condition="'$(BuildToolVersion)'=='17.0'">v143</AutoDetectedPlatformToolset> </PropertyGroup> <PropertyGroup Label="EmptyDefaultPlatformToolset"> <DefaultPlatformToolset Condition=" '$(DefaultPlatformToolset)' == '' ">$(AutoDetectedPlatformToolset)</DefaultPlatformToolset> </PropertyGroup> <PropertyGroup Label="PlatformToolset"> <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> </PropertyGroup> <!-- This is the default SDK target. --> <!-- If not already set, use the latest installed version of the Windows 10 SDK. The Windows 10 SDK is backwards compatible to Windows 7, as long as WINVER and _WIN32_WINNT are set before compiling. Note: - With VS2019, VS2022 using a value of "10.0" means that it will use the latest installed version. - With VS2017, we need to manually detect the latest SDK version from the registry. - With VS2015, use the Windows 8.1 SDK. --> <PropertyGroup Condition="'$(WindowsTargetPlatformVersion)'=='' and ('$(PlatformToolset)'=='v142' or '$(PlatformToolset)'=='v143')"> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> </PropertyGroup> <PropertyGroup Condition="'$(WindowsTargetPlatformVersion)'=='' and ('$(PlatformToolset)'=='v141' or '$(AutodetectWin10SDK)'=='true')"> <!-- Detect the SDK version. --> <WindowsSdkInstallFolder_10 Condition="'$(WindowsSdkInstallFolder_10)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@InstallationFolder)</WindowsSdkInstallFolder_10> <WindowsSdkInstallFolder_10 Condition="'$(WindowsSdkInstallFolder_10)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0@InstallationFolder)</WindowsSdkInstallFolder_10> <WindowsTargetPlatformVersion_10 Condition="'$(WindowsTargetPlatformVersion_10)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion)</WindowsTargetPlatformVersion_10> <WindowsTargetPlatformVersion_10 Condition="'$(WindowsTargetPlatformVersion_10)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion)</WindowsTargetPlatformVersion_10> <!-- Sometimes the version in the registry has the '.0' suffix, and sometimes it doesn't. Check and add it. --> <WindowsTargetPlatformVersion_10 Condition="'$(WindowsTargetPlatformVersion_10)' != '' and !$(WindowsTargetPlatformVersion_10.EndsWith('.0'))">$(WindowsTargetPlatformVersion_10).0</WindowsTargetPlatformVersion_10> <!-- Set the default. --> <WindowsTargetPlatformVersion>$(WindowsTargetPlatformVersion_10)</WindowsTargetPlatformVersion> </PropertyGroup> <PropertyGroup Condition="'$(WindowsTargetPlatformVersion)'=='' and '$(PlatformToolset)'=='v140'"> <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> </PropertyGroup> <!-- Disable MSBuild warning about Linker OutputFile. --> <PropertyGroup> <!-- For example: MSBuild complains that the common project creates "icuuc62.dll" rather than "common.dll". However, this is intentional. --> <MSBuildWarningsAsMessages>MSB8012</MSBuildWarningsAsMessages> </PropertyGroup> <!-- This enables outputting the source code line when an error occurs (to make it easier to see what/where the issue is). --> <ItemDefinitionGroup> <ClCompile> <DiagnosticsFormat>Caret</DiagnosticsFormat> </ClCompile> </ItemDefinitionGroup> </Project> ```
/content/code_sandbox/icu4c/source/allinone/Build.Windows.PlatformToolset.props
xml
2016-01-08T02:42:32
2024-08-16T18:14:55
icu
unicode-org/icu
2,693
1,216
```xml /* * @license Apache-2.0 * * * * path_to_url * * Unless required by applicable law or agreed to in writing, software * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ import gammainc = require( './index' ); // TESTS // // The function returns a number... { gammainc( 3.5, 2 ); // $ExpectType number gammainc( 3.5, 2, false ); // $ExpectType number gammainc( 3.5, 2, false, true ); // $ExpectType number } // The compiler throws an error if the function is provided values other than numbers for the first two parameters... { gammainc( true, 3 ); // $ExpectError gammainc( false, 2 ); // $ExpectError gammainc( '5', 1 ); // $ExpectError gammainc( [], 1 ); // $ExpectError gammainc( {}, 2 ); // $ExpectError gammainc( ( x: number ): number => x, 2 ); // $ExpectError gammainc( 9, true ); // $ExpectError gammainc( 9, false ); // $ExpectError gammainc( 5, '5' ); // $ExpectError gammainc( 8, [] ); // $ExpectError gammainc( 9, {} ); // $ExpectError gammainc( 8, ( x: number ): number => x ); // $ExpectError } // The compiler throws an error if the function is provided a value other than a boolean as the third argument... { gammainc( 3.5, 2, '5' ); // $ExpectError gammainc( 3.5, 2, 123 ); // $ExpectError gammainc( 3.5, 2, {} ); // $ExpectError gammainc( 3.5, 2, [] ); // $ExpectError gammainc( 3.5, 2, ( x: number ): number => x ); // $ExpectError } // The compiler throws an error if the function is provided a value other than a boolean as the fourth argument... { gammainc( 3.5, 2, true, '5' ); // $ExpectError gammainc( 3.5, 2, true, 123 ); // $ExpectError gammainc( 3.5, 2, true, {} ); // $ExpectError gammainc( 3.5, 2, true, [] ); // $ExpectError gammainc( 3.5, 2, true, ( x: number ): number => x ); // $ExpectError } // The compiler throws an error if the function is provided insufficient arguments... { gammainc(); // $ExpectError gammainc( 3 ); // $ExpectError } ```
/content/code_sandbox/lib/node_modules/@stdlib/math/base/special/gammainc/docs/types/test.ts
xml
2016-03-24T04:19:52
2024-08-16T09:03:19
stdlib
stdlib-js/stdlib
4,266
672
```xml import * as React from 'react'; import { FolderRegular, EditRegular, OpenRegular, DocumentRegular, PeopleRegular, DocumentPdfRegular, VideoRegular, } from '@fluentui/react-icons'; import { PresenceBadgeStatus, Avatar, DataGridBody, DataGridRow, DataGrid, DataGridHeader, DataGridHeaderCell, DataGridCell, TableCellLayout, TableColumnDefinition, createTableColumn, } from '@fluentui/react-components'; type FileCell = { label: string; icon: JSX.Element; }; type LastUpdatedCell = { label: string; timestamp: number; }; type LastUpdateCell = { label: string; icon: JSX.Element; }; type AuthorCell = { label: string; status: PresenceBadgeStatus; }; type Item = { file: FileCell; author: AuthorCell; lastUpdated: LastUpdatedCell; lastUpdate: LastUpdateCell; }; const items: Item[] = [ { file: { label: 'Meeting notes', icon: <DocumentRegular /> }, author: { label: 'Max Mustermann', status: 'available' }, lastUpdated: { label: '7h ago', timestamp: 1 }, lastUpdate: { label: 'You edited this', icon: <EditRegular />, }, }, { file: { label: 'Thursday presentation', icon: <FolderRegular /> }, author: { label: 'Erika Mustermann', status: 'busy' }, lastUpdated: { label: 'Yesterday at 1:45 PM', timestamp: 2 }, lastUpdate: { label: 'You recently opened this', icon: <OpenRegular />, }, }, { file: { label: 'Training recording', icon: <VideoRegular /> }, author: { label: 'John Doe', status: 'away' }, lastUpdated: { label: 'Yesterday at 1:45 PM', timestamp: 2 }, lastUpdate: { label: 'You recently opened this', icon: <OpenRegular />, }, }, { file: { label: 'Purchase order', icon: <DocumentPdfRegular /> }, author: { label: 'Jane Doe', status: 'offline' }, lastUpdated: { label: 'Tue at 9:30 AM', timestamp: 3 }, lastUpdate: { label: 'You shared this in a Teams chat', icon: <PeopleRegular />, }, }, ]; const columns: TableColumnDefinition<Item>[] = [ createTableColumn<Item>({ columnId: 'file', compare: (a, b) => { return a.file.label.localeCompare(b.file.label); }, renderHeaderCell: () => { return 'File'; }, renderCell: item => { return <TableCellLayout media={item.file.icon}>{item.file.label}</TableCellLayout>; }, }), createTableColumn<Item>({ columnId: 'author', compare: (a, b) => { return a.author.label.localeCompare(b.author.label); }, renderHeaderCell: () => { return 'Author'; }, renderCell: item => { return ( <TableCellLayout media={ <Avatar aria-label={item.author.label} name={item.author.label} badge={{ status: item.author.status }} /> } > {item.author.label} </TableCellLayout> ); }, }), createTableColumn<Item>({ columnId: 'lastUpdated', compare: (a, b) => { return a.lastUpdated.timestamp - b.lastUpdated.timestamp; }, renderHeaderCell: () => { return 'Last updated'; }, renderCell: item => { return item.lastUpdated.label; }, }), createTableColumn<Item>({ columnId: 'lastUpdate', compare: (a, b) => { return a.lastUpdate.label.localeCompare(b.lastUpdate.label); }, renderHeaderCell: () => { return 'Last update'; }, renderCell: item => { return <TableCellLayout media={item.lastUpdate.icon}>{item.lastUpdate.label}</TableCellLayout>; }, }), ]; export const MultipleSelect = () => { const defaultSelectedItems = React.useMemo(() => new Set([1]), []); return ( <DataGrid items={items} columns={columns} selectionMode="multiselect" defaultSelectedItems={defaultSelectedItems} style={{ minWidth: '550px' }} > <DataGridHeader> <DataGridRow selectionCell={{ checkboxIndicator: { 'aria-label': 'Select all rows' } }}> {({ renderHeaderCell }) => <DataGridHeaderCell>{renderHeaderCell()}</DataGridHeaderCell>} </DataGridRow> </DataGridHeader> <DataGridBody<Item>> {({ item, rowId }) => ( <DataGridRow<Item> key={rowId} selectionCell={{ checkboxIndicator: { 'aria-label': 'Select row' } }}> {({ renderCell }) => <DataGridCell>{renderCell(item)}</DataGridCell>} </DataGridRow> )} </DataGridBody> </DataGrid> ); }; MultipleSelect.parameters = { docs: { description: { story: [ 'In order to enable this feature the `selectionMode` prop needs to be set. The API surface is directly', 'equivalent to the usage of `useTableFeatures`.', ].join('\n'), }, }, }; ```
/content/code_sandbox/packages/react-components/react-table/stories/src/DataGrid/MultipleSelect.stories.tsx
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
1,201
```xml /// /// /// /// path_to_url /// /// Unless required by applicable law or agreed to in writing, software /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. /// import { Injectable } from '@angular/core'; import { ActivatedRoute, ActivatedRouteSnapshot, Resolve, Router } from '@angular/router'; import { CellActionDescriptor, checkBoxCell, DateEntityTableColumn, EntityTableColumn, EntityTableConfig, GroupActionDescriptor, HeaderActionDescriptor } from '@home/models/entity/entities-table-config.models'; import { TranslateService } from '@ngx-translate/core'; import { DatePipe } from '@angular/common'; import { EntityType, entityTypeResources, entityTypeTranslations } from '@shared/models/entity-type.models'; import { AddEntityDialogData, EntityAction } from '@home/models/entity/entity-component.models'; import { Device, DeviceCredentials, DeviceInfo, DeviceInfoFilter, DeviceInfoQuery } from '@app/shared/models/device.models'; import { DeviceComponent } from '@modules/home/pages/device/device.component'; import { forkJoin, Observable, of, Subject } from 'rxjs'; import { select, Store } from '@ngrx/store'; import { selectAuthUser, selectUserSettingsProperty } from '@core/auth/auth.selectors'; import { map, mergeMap, take, tap } from 'rxjs/operators'; import { AppState } from '@core/core.state'; import { DeviceService } from '@app/core/http/device.service'; import { Authority } from '@app/shared/models/authority.enum'; import { CustomerService } from '@core/http/customer.service'; import { Customer } from '@app/shared/models/customer.model'; import { NULL_UUID } from '@shared/models/id/has-uuid'; import { BroadcastService } from '@core/services/broadcast.service'; import { DeviceTableHeaderComponent } from '@modules/home/pages/device/device-table-header.component'; import { MatDialog } from '@angular/material/dialog'; import { DeviceCredentialsDialogComponent, DeviceCredentialsDialogData } from '@modules/home/pages/device/device-credentials-dialog.component'; import { DialogService } from '@core/services/dialog.service'; import { AssignToCustomerDialogComponent, AssignToCustomerDialogData } from '@modules/home/dialogs/assign-to-customer-dialog.component'; import { DeviceId } from '@app/shared/models/id/device-id'; import { AddEntitiesToCustomerDialogComponent, AddEntitiesToCustomerDialogData } from '../../dialogs/add-entities-to-customer-dialog.component'; import { DeviceTabsComponent } from '@home/pages/device/device-tabs.component'; import { HomeDialogsService } from '@home/dialogs/home-dialogs.service'; import { DeviceWizardDialogComponent } from '@home/components/wizard/device-wizard-dialog.component'; import { BaseData, HasId } from '@shared/models/base-data'; import { deepClone, isDefined, isDefinedAndNotNull } from '@core/utils'; import { EdgeService } from '@core/http/edge.service'; import { AddEntitiesToEdgeDialogComponent, AddEntitiesToEdgeDialogData } from '@home/dialogs/add-entities-to-edge-dialog.component'; import { EdgeId } from '@shared/models/id/edge-id'; import { CustomerId } from '@shared/models/id/customer-id'; import { PageLink, PageQueryParam } from '@shared/models/page/page-link'; import { DeviceProfileId } from '@shared/models/id/device-profile-id'; import { DeviceCheckConnectivityDialogComponent, DeviceCheckConnectivityDialogData } from '@home/pages/device/device-check-connectivity-dialog.component'; import { EntityId } from '@shared/models/id/entity-id'; interface DevicePageQueryParams extends PageQueryParam { deviceProfileId?: string; active?: boolean | string; } @Injectable() export class DevicesTableConfigResolver implements Resolve<EntityTableConfig<DeviceInfo>> { private readonly config: EntityTableConfig<DeviceInfo> = new EntityTableConfig<DeviceInfo>(); private customerId: string; constructor(private store: Store<AppState>, private broadcast: BroadcastService, private deviceService: DeviceService, private customerService: CustomerService, private dialogService: DialogService, private edgeService: EdgeService, private homeDialogs: HomeDialogsService, private translate: TranslateService, private datePipe: DatePipe, private router: Router, private dialog: MatDialog) { this.config.entityType = EntityType.DEVICE; this.config.entityComponent = DeviceComponent; this.config.entityTabsComponent = DeviceTabsComponent; this.config.entityTranslations = entityTypeTranslations.get(EntityType.DEVICE); this.config.entityResources = entityTypeResources.get(EntityType.DEVICE); this.config.addDialogStyle = {width: '600px'}; this.config.deleteEntityTitle = device => this.translate.instant('device.delete-device-title', {deviceName: device.name}); this.config.deleteEntityContent = () => this.translate.instant('device.delete-device-text'); this.config.deleteEntitiesTitle = count => this.translate.instant('device.delete-devices-title', {count}); this.config.deleteEntitiesContent = () => this.translate.instant('device.delete-devices-text'); this.config.loadEntity = id => this.deviceService.getDeviceInfo(id.id); this.config.saveEntity = device => this.deviceService.saveDevice(device).pipe( tap(() => { this.broadcast.broadcast('deviceSaved'); }), mergeMap((savedDevice) => this.deviceService.getDeviceInfo(savedDevice.id.id) )); this.config.onEntityAction = action => this.onDeviceAction(action, this.config); this.config.detailsReadonly = () => (this.config.componentsData.deviceScope === 'customer_user' || this.config.componentsData.deviceScope === 'edge_customer_user'); this.config.onLoadAction = (route) => this.onLoadAction(route); this.config.headerComponent = DeviceTableHeaderComponent; } resolve(route: ActivatedRouteSnapshot): Observable<EntityTableConfig<DeviceInfo>> { const routeParams = route.params; this.config.componentsData = { deviceScope: route.data.devicesType, deviceInfoFilter: {}, deviceCredentials$: new Subject<DeviceCredentials>(), edgeId: routeParams.edgeId }; this.customerId = routeParams.customerId; this.config.componentsData.edgeId = routeParams.edgeId; return this.store.pipe(select(selectAuthUser), take(1)).pipe( tap((authUser) => { if (authUser.authority === Authority.CUSTOMER_USER) { if (route.data.devicesType === 'edge') { this.config.componentsData.deviceScope = 'edge_customer_user'; } else { this.config.componentsData.deviceScope = 'customer_user'; } this.customerId = authUser.customerId; } }), mergeMap(() => this.customerId ? this.customerService.getCustomer(this.customerId) : of(null as Customer) ), map((parentCustomer) => { if (parentCustomer) { if (parentCustomer.additionalInfo && parentCustomer.additionalInfo.isPublic) { this.config.tableTitle = this.translate.instant('customer.public-devices'); } else { this.config.tableTitle = parentCustomer.title + ': ' + this.translate.instant('device.devices'); } } else if (this.config.componentsData.deviceScope === 'edge') { this.edgeService.getEdge(this.config.componentsData.edgeId).subscribe( edge => this.config.tableTitle = edge.name + ': ' + this.translate.instant('device.devices') ); } else { this.config.tableTitle = this.translate.instant('device.devices'); } this.config.columns = this.configureColumns(this.config.componentsData.deviceScope); this.configureEntityFunctions(this.config.componentsData.deviceScope); this.config.cellActionDescriptors = this.configureCellActions(this.config.componentsData.deviceScope); this.config.groupActionDescriptors = this.configureGroupActions(this.config.componentsData.deviceScope); this.config.addActionDescriptors = this.configureAddActions(this.config.componentsData.deviceScope); this.config.addEnabled = !(this.config.componentsData.deviceScope === 'customer_user' || this.config.componentsData.deviceScope === 'edge_customer_user'); this.config.entitiesDeleteEnabled = this.config.componentsData.deviceScope === 'tenant'; this.config.deleteEnabled = () => this.config.componentsData.deviceScope === 'tenant'; return this.config; }) ); } onLoadAction(route: ActivatedRoute): void { const routerQueryParams: DevicePageQueryParams = route.snapshot.queryParams; if (routerQueryParams) { const queryParams = deepClone(routerQueryParams); let replaceUrl = false; if (routerQueryParams?.deviceProfileId) { this.config.componentsData.deviceInfoFilter.deviceProfileId = new DeviceProfileId(routerQueryParams?.deviceProfileId); delete queryParams.deviceProfileId; replaceUrl = true; } if (isDefined(routerQueryParams?.active)) { this.config.componentsData.deviceInfoFilter.active = (routerQueryParams?.active === true || routerQueryParams?.active === 'true'); delete queryParams.active; replaceUrl = true; } if (replaceUrl) { this.router.navigate([], { relativeTo: route, queryParams, queryParamsHandling: '', replaceUrl: true }); } } } configureColumns(deviceScope: string): Array<EntityTableColumn<DeviceInfo>> { const columns: Array<EntityTableColumn<DeviceInfo>> = [ new DateEntityTableColumn<DeviceInfo>('createdTime', 'common.created-time', this.datePipe, '150px'), new EntityTableColumn<DeviceInfo>('name', 'device.name', '25%'), new EntityTableColumn<DeviceInfo>('deviceProfileName', 'device-profile.device-profile', '25%'), new EntityTableColumn<DeviceInfo>('label', 'device.label', '25%'), new EntityTableColumn<DeviceInfo>('active', 'device.state', '80px', entity => this.deviceState(entity), entity => this.deviceStateStyle(entity)) ]; if (deviceScope === 'tenant') { columns.push( new EntityTableColumn<DeviceInfo>('customerTitle', 'customer.customer', '25%'), new EntityTableColumn<DeviceInfo>('customerIsPublic', 'device.public', '60px', entity => checkBoxCell(entity.customerIsPublic), () => ({})), ); } columns.push( new EntityTableColumn<DeviceInfo>('gateway', 'device.is-gateway', '60px', entity => checkBoxCell(entity.additionalInfo && entity.additionalInfo.gateway), () => ({}), false) ); return columns; } private deviceState(device: DeviceInfo): string { let translateKey = 'device.active'; let backgroundColor = 'rgba(25, 128, 56, 0.08)'; if (!device.active) { translateKey = 'device.inactive'; backgroundColor = 'rgba(209, 39, 48, 0.08)'; } return `<div class="status" style="border-radius: 16px; height: 32px; line-height: 32px; padding: 0 12px; width: fit-content; background-color: ${backgroundColor}"> ${this.translate.instant(translateKey)} </div>`; } private deviceStateStyle(device: DeviceInfo): object { const styleObj = { fontSize: '14px', color: '#198038', cursor: 'pointer' }; if (!device.active) { styleObj.color = '#d12730'; } return styleObj; } configureEntityFunctions(deviceScope: string): void { this.config.entitiesFetchFunction = pageLink => this.deviceService.getDeviceInfosByQuery(this.prepareDeviceInfoQuery(pageLink)); if (deviceScope === 'tenant') { this.config.deleteEntity = id => this.deviceService.deleteDevice(id.id); } else { this.config.deleteEntity = () => of(); } } prepareDeviceInfoQuery(pageLink: PageLink): DeviceInfoQuery { const deviceInfoFilter: DeviceInfoFilter = deepClone(this.config.componentsData.deviceInfoFilter); if (this.config.componentsData.deviceScope === 'edge' || this.config.componentsData.deviceScope === 'edge_customer_user') { deviceInfoFilter.edgeId = new EdgeId(this.config.componentsData.edgeId); } else if (this.config.componentsData.deviceScope !== 'tenant') { deviceInfoFilter.customerId = new CustomerId(this.customerId); } return new DeviceInfoQuery(pageLink, deviceInfoFilter); } configureCellActions(deviceScope: string): Array<CellActionDescriptor<DeviceInfo>> { const actions: Array<CellActionDescriptor<DeviceInfo>> = []; if (deviceScope === 'tenant') { actions.push( { name: this.translate.instant('device.make-public'), icon: 'share', isEnabled: (entity) => (!entity.customerId || entity.customerId.id === NULL_UUID), onAction: ($event, entity) => this.makePublic($event, entity) }, { name: this.translate.instant('device.assign-to-customer'), icon: 'assignment_ind', isEnabled: (entity) => (!entity.customerId || entity.customerId.id === NULL_UUID), onAction: ($event, entity) => this.assignToCustomer($event, [entity.id]) }, { name: this.translate.instant('device.unassign-from-customer'), icon: 'assignment_return', isEnabled: (entity) => (entity.customerId && entity.customerId.id !== NULL_UUID && !entity.customerIsPublic), onAction: ($event, entity) => this.unassignFromCustomer($event, entity) }, { name: this.translate.instant('device.make-private'), icon: 'reply', isEnabled: (entity) => (entity.customerId && entity.customerId.id !== NULL_UUID && entity.customerIsPublic), onAction: ($event, entity) => this.unassignFromCustomer($event, entity) }, { name: this.translate.instant('device.manage-credentials'), icon: 'security', isEnabled: () => true, onAction: ($event, entity) => this.manageCredentials($event, entity) } ); } if (deviceScope === 'customer') { actions.push( { name: this.translate.instant('device.unassign-from-customer'), icon: 'assignment_return', isEnabled: (entity) => (entity.customerId && entity.customerId.id !== NULL_UUID && !entity.customerIsPublic), onAction: ($event, entity) => this.unassignFromCustomer($event, entity) }, { name: this.translate.instant('device.make-private'), icon: 'reply', isEnabled: (entity) => (entity.customerId && entity.customerId.id !== NULL_UUID && entity.customerIsPublic), onAction: ($event, entity) => this.unassignFromCustomer($event, entity) }, { name: this.translate.instant('device.manage-credentials'), icon: 'security', isEnabled: () => true, onAction: ($event, entity) => this.manageCredentials($event, entity) } ); } if (deviceScope === 'customer_user' || deviceScope === 'edge_customer_user') { actions.push( { name: this.translate.instant('device.view-credentials'), icon: 'security', isEnabled: () => true, onAction: ($event, entity) => this.manageCredentials($event, entity) } ); } if (deviceScope === 'edge') { actions.push( { name: this.translate.instant('edge.unassign-from-edge'), icon: 'assignment_return', isEnabled: (entity) => true, onAction: ($event, entity) => this.unassignFromEdge($event, entity) } ); } return actions; } configureGroupActions(deviceScope: string): Array<GroupActionDescriptor<DeviceInfo>> { const actions: Array<GroupActionDescriptor<DeviceInfo>> = []; if (deviceScope === 'tenant') { actions.push( { name: this.translate.instant('device.assign-devices'), icon: 'assignment_ind', isEnabled: true, onAction: ($event, entities) => this.assignToCustomer($event, entities.map((entity) => entity.id)) } ); } if (deviceScope === 'customer') { actions.push( { name: this.translate.instant('device.unassign-devices'), icon: 'assignment_return', isEnabled: true, onAction: ($event, entities) => this.unassignDevicesFromCustomer($event, entities) } ); } if (deviceScope === 'edge') { actions.push( { name: this.translate.instant('device.unassign-devices-from-edge'), icon: 'assignment_return', isEnabled: true, onAction: ($event, entities) => this.unassignDevicesFromEdge($event, entities) } ); } return actions; } configureAddActions(deviceScope: string): Array<HeaderActionDescriptor> { this.config.addEntity = null; const actions: Array<HeaderActionDescriptor> = []; if (deviceScope === 'tenant') { actions.push( { name: this.translate.instant('device.add-device-text'), icon: 'insert_drive_file', isEnabled: () => true, onAction: ($event) => this.deviceWizard($event) }, { name: this.translate.instant('device.import'), icon: 'file_upload', isEnabled: () => true, onAction: ($event) => this.importDevices($event) }, ); this.config.addEntity = () => {this.deviceWizard(null); return of(null); }; } if (deviceScope === 'customer') { actions.push( { name: this.translate.instant('device.assign-new-device'), icon: 'add', isEnabled: () => true, onAction: ($event) => this.addDevicesToCustomer($event) } ); } if (deviceScope === 'edge') { actions.push( { name: this.translate.instant('device.assign-new-device'), icon: 'add', isEnabled: () => true, onAction: ($event) => this.addDevicesToEdge($event) } ); } return actions; } private openDevice($event: Event, device: Device, config: EntityTableConfig<DeviceInfo>) { if ($event) { $event.stopPropagation(); } const url = this.router.createUrlTree([device.id.id], {relativeTo: config.getActivatedRoute()}); this.router.navigateByUrl(url); } importDevices($event: Event) { this.homeDialogs.importEntities(EntityType.DEVICE).subscribe((res) => { if (res) { this.broadcast.broadcast('deviceSaved'); this.config.updateData(); } }); } deviceWizard($event: Event) { this.dialog.open<DeviceWizardDialogComponent, AddEntityDialogData<BaseData<HasId>>, Device>(DeviceWizardDialogComponent, { disableClose: true, panelClass: ['tb-dialog', 'tb-fullscreen-dialog'] }).afterClosed().subscribe( (res) => { if (res) { this.store.pipe(select(selectUserSettingsProperty( 'notDisplayConnectivityAfterAddDevice'))).pipe( take(1) ).subscribe((settings: boolean) => { if(!settings) { this.checkConnectivity(null, res.id, true); } else { this.config.updateData(); } }); } } ); } addDevicesToCustomer($event: Event) { if ($event) { $event.stopPropagation(); } this.dialog.open<AddEntitiesToCustomerDialogComponent, AddEntitiesToCustomerDialogData, boolean>(AddEntitiesToCustomerDialogComponent, { disableClose: true, panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], data: { customerId: this.customerId, entityType: EntityType.DEVICE } }).afterClosed() .subscribe((res) => { if (res) { this.config.updateData(); } }); } makePublic($event: Event, device: Device) { if ($event) { $event.stopPropagation(); } this.dialogService.confirm( this.translate.instant('device.make-public-device-title', {deviceName: device.name}), this.translate.instant('device.make-public-device-text'), this.translate.instant('action.no'), this.translate.instant('action.yes'), true ).subscribe((res) => { if (res) { this.deviceService.makeDevicePublic(device.id.id).subscribe( () => { this.config.updateData(); } ); } } ); } assignToCustomer($event: Event, deviceIds: Array<DeviceId>) { if ($event) { $event.stopPropagation(); } this.dialog.open<AssignToCustomerDialogComponent, AssignToCustomerDialogData, boolean>(AssignToCustomerDialogComponent, { disableClose: true, panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], data: { entityIds: deviceIds, entityType: EntityType.DEVICE } }).afterClosed() .subscribe((res) => { if (res) { this.config.updateData(); } }); } unassignFromCustomer($event: Event, device: DeviceInfo) { if ($event) { $event.stopPropagation(); } const isPublic = device.customerIsPublic; let title; let content; if (isPublic) { title = this.translate.instant('device.make-private-device-title', {deviceName: device.name}); content = this.translate.instant('device.make-private-device-text'); } else { title = this.translate.instant('device.unassign-device-title', {deviceName: device.name}); content = this.translate.instant('device.unassign-device-text'); } this.dialogService.confirm( title, content, this.translate.instant('action.no'), this.translate.instant('action.yes'), true ).subscribe((res) => { if (res) { this.deviceService.unassignDeviceFromCustomer(device.id.id).subscribe( () => { this.config.updateData(this.config.componentsData.deviceScope !== 'tenant'); } ); } } ); } unassignDevicesFromCustomer($event: Event, devices: Array<DeviceInfo>) { if ($event) { $event.stopPropagation(); } this.dialogService.confirm( this.translate.instant('device.unassign-devices-title', {count: devices.length}), this.translate.instant('device.unassign-devices-text'), this.translate.instant('action.no'), this.translate.instant('action.yes'), true ).subscribe((res) => { if (res) { const tasks: Observable<any>[] = []; devices.forEach( (device) => { tasks.push(this.deviceService.unassignDeviceFromCustomer(device.id.id)); } ); forkJoin(tasks).subscribe( () => { this.config.updateData(); } ); } } ); } manageCredentials($event: Event, device: Device) { if ($event) { $event.stopPropagation(); } this.dialog.open<DeviceCredentialsDialogComponent, DeviceCredentialsDialogData, DeviceCredentials>(DeviceCredentialsDialogComponent, { disableClose: true, panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], data: { deviceId: device.id.id, deviceProfileId: device.deviceProfileId.id, isReadOnly: this.config.componentsData.deviceScope === 'customer_user' || this.config.componentsData.deviceScope === 'edge_customer_user' } }).afterClosed().subscribe(deviceCredentials => { if (isDefinedAndNotNull(deviceCredentials)) { this.config.componentsData.deviceCredentials$.next(deviceCredentials); } }); } onDeviceAction(action: EntityAction<DeviceInfo>, config: EntityTableConfig<DeviceInfo>): boolean { switch (action.action) { case 'open': this.openDevice(action.event, action.entity, config); return true; case 'makePublic': this.makePublic(action.event, action.entity); return true; case 'assignToCustomer': this.assignToCustomer(action.event, [action.entity.id]); return true; case 'unassignFromCustomer': this.unassignFromCustomer(action.event, action.entity); return true; case 'unassignFromEdge': this.unassignFromEdge(action.event, action.entity); return true; case 'manageCredentials': this.manageCredentials(action.event, action.entity); return true; case 'checkConnectivity': this.checkConnectivity(action.event, action.entity.id); return true; } return false; } addDevicesToEdge($event: Event) { if ($event) { $event.stopPropagation(); } this.dialog.open<AddEntitiesToEdgeDialogComponent, AddEntitiesToEdgeDialogData, boolean>(AddEntitiesToEdgeDialogComponent, { disableClose: true, panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], data: { edgeId: this.config.componentsData.edgeId, entityType: EntityType.DEVICE } }).afterClosed() .subscribe((res) => { if (res) { this.config.updateData(); } }); } unassignFromEdge($event: Event, device: DeviceInfo) { if ($event) { $event.stopPropagation(); } this.dialogService.confirm( this.translate.instant('device.unassign-device-from-edge-title', {deviceName: device.name}), this.translate.instant('device.unassign-device-from-edge-text'), this.translate.instant('action.no'), this.translate.instant('action.yes'), true ).subscribe((res) => { if (res) { this.deviceService.unassignDeviceFromEdge(this.config.componentsData.edgeId, device.id.id).subscribe( () => { this.config.updateData(this.config.componentsData.deviceScope !== 'tenant'); } ); } } ); } unassignDevicesFromEdge($event: Event, devices: Array<DeviceInfo>) { if ($event) { $event.stopPropagation(); } this.dialogService.confirm( this.translate.instant('device.unassign-devices-from-edge-title', {count: devices.length}), this.translate.instant('device.unassign-devices-from-edge-text'), this.translate.instant('action.no'), this.translate.instant('action.yes'), true ).subscribe((res) => { if (res) { const tasks: Observable<any>[] = []; devices.forEach( (device) => { tasks.push(this.deviceService.unassignDeviceFromEdge(this.config.componentsData.edgeId, device.id.id)); } ); forkJoin(tasks).subscribe( () => { this.config.updateData(); } ); } } ); } checkConnectivity($event: Event, deviceId: EntityId, afterAdd = false) { if ($event) { $event.stopPropagation(); } this.dialog.open<DeviceCheckConnectivityDialogComponent, DeviceCheckConnectivityDialogData> (DeviceCheckConnectivityDialogComponent, { disableClose: true, panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], data: { deviceId, afterAdd } }) .afterClosed() .subscribe(() => { if (afterAdd ) { this.config.updateData(); } }); } } ```
/content/code_sandbox/ui-ngx/src/app/modules/home/pages/device/devices-table-config.resolver.ts
xml
2016-12-01T09:33:30
2024-08-16T19:58:25
thingsboard
thingsboard/thingsboard
16,820
5,834
```xml import { Button, Flex, FlexItem, GridIcon, TableIcon } from '@fluentui/react-northstar'; import * as React from 'react'; import { ViewName } from '../IAllConversationsState'; export interface IHeaderButtonProps { flipFilterPanel: (isOpen: boolean) => void; setView: (viewName: ViewName) => void; } export const HeaderButton: React.FunctionComponent<IHeaderButtonProps> = (props: React.PropsWithChildren<IHeaderButtonProps>) => { return ( <Flex gap="gap.small"> {/* <FlexItem> <Button icon={<FilterIcon/>} content="Filter" onClick={()=>props.flipFilterPanel(true)} /> </FlexItem> */} <h1>Search conversation</h1> <FlexItem push> <Button.Group buttons={[ { icon: <GridIcon />, key: 'Gallery', iconOnly: true, title: 'Gallery View', onClick:()=>props.setView(ViewName.Grid) }, { icon: <TableIcon />, key: 'Table', iconOnly: true, title: 'Table View', onClick:()=>props.setView(ViewName.Table) } ]} /> </FlexItem> </Flex> ); }; ```
/content/code_sandbox/samples/react-teams-conversationview/src/webparts/allConversations/components/headerButton/HeaderButton.tsx
xml
2016-08-30T17:21:43
2024-08-16T18:41:32
sp-dev-fx-webparts
pnp/sp-dev-fx-webparts
2,027
278
```xml import {ancestorsOf, classOf, nameOf} from "@tsed/core"; import {BaseContext, DIContext, Inject, Injectable, InjectorService} from "@tsed/di"; import {ErrorFilter} from "../components/ErrorFilter.js"; import {ExceptionFilter} from "../components/ExceptionFilter.js"; import {MongooseErrorFilter} from "../components/MongooseErrorFilter.js"; import {StringErrorFilter} from "../components/StringErrorFilter.js"; import {ExceptionFilterKey, ExceptionFiltersContainer} from "../domain/ExceptionFiltersContainer.js"; import {ResourceNotFound} from "../errors/ResourceNotFound.js"; import {ExceptionFilterMethods} from "../interfaces/ExceptionFilterMethods.js"; /** * Catch all errors and return the json error with the right status code when it's possible. * * @platform */ @Injectable({ imports: [ErrorFilter, ExceptionFilter, MongooseErrorFilter, StringErrorFilter] }) export class PlatformExceptions { types: Map<ExceptionFilterKey, ExceptionFilterMethods> = new Map(); @Inject() injector: InjectorService; $onInit() { ExceptionFiltersContainer.forEach((token, type) => { this.types.set(type, this.injector.get(token)!); }); } catch(error: unknown, ctx: DIContext) { const name = nameOf(classOf(error)); if (name && this.types.has(name)) { return this.types.get(name)!.catch(error, ctx); } const target = ancestorsOf(error) .reverse() .find((target) => this.types.has(target)); if (target) { return this.types.get(target)!.catch(error, ctx); } // default return this.types.get(Error)!.catch(error, ctx); } resourceNotFound(ctx: DIContext) { return this.catch(new ResourceNotFound(ctx.request.url), ctx); } } ```
/content/code_sandbox/packages/platform/platform-exceptions/src/services/PlatformExceptions.ts
xml
2016-02-21T18:38:47
2024-08-14T21:19:48
tsed
tsedio/tsed
2,817
395
```xml import { html, LitElement } from 'lit'; import { classMap } from 'lit/directives/class-map.js'; import { property } from 'lit/decorators.js'; export class StatusHeaderBase extends LitElement { @property() state: 'active' | 'positive' | 'caution' | 'error' | 'neutral' = 'neutral'; @property({ type: String }) statusText = ''; @property({ type: String }) statusHelper = ''; @property({ type: String }) titleText = ''; protected override render() { const classes = { active: this.state === 'active', caution: this.state === 'caution', error: this.state === 'error', positive: this.state === 'positive', }; return html` <div class="status-header ${classMap(classes)}"> <div class="status-header-title"> <div class="status-header-title-text">${this.titleText}</div> <slot name="status-header-actions"></slot> </div> <div class="status-header-status"> <div class="status-header-icon"> <slot name="status-header-icon"></slot> </div> <div class="status-header-text-block"> <div class="status-header-text">${this.statusText}</div> <div class="status-header-helper">${this.statusHelper}</div> </div> <div class="status-header-slot"> <slot name="status-header-text"></slot> </div> </div> <slot></slot> </div> `; } } ```
/content/code_sandbox/libs/components/src/status-header/status-header-base.ts
xml
2016-07-11T23:30:52
2024-08-15T15:20:45
covalent
Teradata/covalent
2,228
341
```xml /* eslint-env jest */ import execa from 'execa'; import fs from 'fs-extra'; import klawSync from 'klaw-sync'; import path from 'path'; import { execute, projectRoot, getLoadedModulesAsync, bin } from './utils'; const originalForceColor = process.env.FORCE_COLOR; const originalCI = process.env.CI; beforeAll(async () => { await fs.mkdir(projectRoot, { recursive: true }); process.env.FORCE_COLOR = '0'; process.env.CI = '1'; process.env._EXPO_E2E_USE_PATH_ALIASES = '1'; }); afterAll(() => { process.env.FORCE_COLOR = originalForceColor; process.env.CI = originalCI; delete process.env._EXPO_E2E_USE_PATH_ALIASES; }); it('loads expected modules by default', async () => { const modules = await getLoadedModulesAsync( `require('../../build/src/export/embed').expoExportEmbed` ); expect(modules).toStrictEqual([ '@expo/cli/build/src/export/embed/index.js', '@expo/cli/build/src/log.js', '@expo/cli/build/src/utils/args.js', ]); }); it('runs `npx expo export:embed --help`', async () => { const results = await execute('export:embed', '--help'); expect(results.stdout).toMatchInlineSnapshot(` " Info (Internal) Export the JavaScript bundle during a native build script for embedding in a native binary Usage $ npx expo export:embed <dir> Options <dir> Directory of the Expo project. Default: Current working directory --entry-file <path> Path to the root JS file, either absolute or relative to JS root --platform <string> Either "ios" or "android" (default: "ios") --transformer <string> Specify a custom transformer to be used --dev [boolean] If false, warnings are disabled and the bundle is minified (default: true) --minify [boolean] Allows overriding whether bundle is minified. This defaults to false if dev is true, and true if dev is false. Disabling minification can be useful for speeding up production builds for testing purposes. --bundle-output <string> File name where to store the resulting bundle, ex. /tmp/groups.bundle --bundle-encoding <string> Encoding the bundle should be written in (path_to_url#buffer_buffer). (default: "utf8") --max-workers <number> Specifies the maximum number of workers the worker-pool will spawn for transforming files. This defaults to the number of the cores available on your machine. --sourcemap-output <string> File name where to store the sourcemap file for resulting bundle, ex. /tmp/groups.map --sourcemap-sources-root <string> Path to make sourcemap's sources entries relative to, ex. /root/dir --sourcemap-use-absolute-path Report SourceMapURL using its full path --assets-dest <string> Directory name where to store assets referenced in the bundle --asset-catalog-dest <string> Directory to create an iOS Asset Catalog for images --unstable-transform-profile <string> Experimental, transform JS for a specific JS engine. Currently supported: hermes, hermes-canary, default --reset-cache Removes cached files -v, --verbose Enables debug logging --config <string> Path to the CLI configuration file --read-global-cache Try to fetch transformed JS code from the global cache, if configured. -h, --help Usage info " `); }); function ensureTesterReady(fixtureName: string): string { const root = path.join(__dirname, '../../../../../apps/router-e2e'); // Clear metro cache for the env var to be updated // await fs.remove(path.join(root, "node_modules/.cache/metro")); // @ts-ignore process.env.E2E_ROUTER_SRC = fixtureName; return root; } it( 'runs `npx expo export:embed`', async () => { const projectRoot = ensureTesterReady('static-rendering'); const output = 'dist-export-embed'; await fs.remove(path.join(projectRoot, output)); await fs.ensureDir(path.join(projectRoot, output)); await execa( 'node', [ bin, 'export:embed', '--entry-file', path.join(projectRoot, './index.js'), '--bundle-output', `./${output}/output.js`, '--assets-dest', output, '--platform', 'ios', '--dev', 'false', ], { cwd: projectRoot, env: { NODE_ENV: 'production', EXPO_USE_STATIC: 'static', E2E_ROUTER_JS_ENGINE: 'hermes', E2E_ROUTER_SRC: 'static-rendering', E2E_ROUTER_ASYNC: 'development', EXPO_USE_FAST_RESOLVER: 'true', }, } ); const outputDir = path.join(projectRoot, 'dist-export-embed'); // List output files with sizes for snapshotting. // This is to make sure that any changes to the output are intentional. // Posix path formatting is used to make paths the same across OSes. const files = klawSync(outputDir) .map((entry) => { if (entry.path.includes('node_modules') || !entry.stats.isFile()) { return null; } return path.posix.relative(outputDir, entry.path); }) .filter(Boolean); // If this changes then everything else probably changed as well. expect(files).toEqual([ 'assets/__e2e__/static-rendering/sweet.ttf', 'assets/__packages/expo-router/assets/error.png', 'assets/__packages/expo-router/assets/file.png', 'assets/__packages/expo-router/assets/forward.png', 'assets/__packages/expo-router/assets/pkg.png', 'assets/assets/icon.png', 'output.js', ]); // Ensure output.js is a utf8 encoded file const outputJS = fs.readFileSync(path.join(outputDir, 'output.js'), 'utf8'); expect(outputJS.slice(0, 5)).toBe('var _'); // Ensure no `//# sourceURL=` comment expect(outputJS).not.toContain('//# sourceURL='); // Ensure `//# sourceMappingURL=output.js.map` expect(outputJS).not.toContain('//# sourceMappingURL='); }, // Could take 45s depending on how fast npm installs 120 * 1000 ); it( 'runs `npx expo export:embed --platform ios` with source maps', async () => { const projectRoot = ensureTesterReady('static-rendering'); const output = 'dist-export-embed-source-maps'; await fs.remove(path.join(projectRoot, output)); await fs.ensureDir(path.join(projectRoot, output)); await execa( 'node', [ bin, 'export:embed', '--entry-file', path.join(projectRoot, './index.js'), '--bundle-output', `./${output}/output.js`, '--assets-dest', output, '--platform', 'ios', '--dev', 'false', '--sourcemap-output', `./${output}/output.js.map`, '--sourcemap-sources-root', projectRoot, ], { cwd: projectRoot, env: { NODE_ENV: 'production', EXPO_USE_STATIC: 'static', E2E_ROUTER_SRC: 'static-rendering', E2E_ROUTER_ASYNC: 'development', EXPO_USE_FAST_RESOLVER: '1', }, } ); const outputDir = path.join(projectRoot, output); // List output files with sizes for snapshotting. // This is to make sure that any changes to the output are intentional. // Posix path formatting is used to make paths the same across OSes. const files = klawSync(outputDir) .map((entry) => { if (entry.path.includes('node_modules') || !entry.stats.isFile()) { return null; } return path.posix.relative(outputDir, entry.path); }) .filter(Boolean); // Ensure output.js is a utf8 encoded file const outputJS = fs.readFileSync(path.join(outputDir, 'output.js'), 'utf8'); expect(outputJS.slice(0, 5)).toBe('var _'); // Ensure no `//# sourceURL=` comment expect(outputJS).not.toContain('//# sourceURL='); // Ensure `//# sourceMappingURL=output.js.map` expect(outputJS).toContain('//# sourceMappingURL=output.js.map'); // If this changes then everything else probably changed as well. expect(files).toEqual([ 'assets/__e2e__/static-rendering/sweet.ttf', 'assets/__packages/expo-router/assets/error.png', 'assets/__packages/expo-router/assets/file.png', 'assets/__packages/expo-router/assets/forward.png', 'assets/__packages/expo-router/assets/pkg.png', 'assets/assets/icon.png', 'output.js', 'output.js.map', ]); }, // Could take 45s depending on how fast npm installs 120 * 1000 ); it( 'runs `npx expo export:embed --platform ios` with a robot user', async () => { const projectRoot = ensureTesterReady('react-native-canary'); const output = 'dist-export-embed-robot-user'; await fs.remove(path.join(projectRoot, output)); await fs.ensureDir(path.join(projectRoot, output)); await execa( 'node', [ bin, 'export:embed', '--entry-file', path.join(projectRoot, './index.js'), '--bundle-output', `./${output}/output.js`, '--assets-dest', output, '--platform', 'ios', '--dev', 'false', ], { cwd: projectRoot, env: { NODE_ENV: 'production', E2E_ROUTER_SRC: 'react-native-canary', E2E_ROUTER_ASYNC: 'development', EXPO_USE_FAST_RESOLVER: '1', // Most important part: // NOTE(EvanBacon): This is a robot user token for an expo-managed account that can authenticate with view-only permission. // The token is not secret and can be used to authenticate with the Expo API. EXPO_TOKEN: '4awlFlcNYg7qOFa8J3a7d5Uaph8FaTsD1SP2xWEf', // Ensure EXPO_OFFLINE is not set! // EXPO_OFFLINE }, // stdio: 'inherit', } ); const outputDir = path.join(projectRoot, output); // List output files with sizes for snapshotting. // This is to make sure that any changes to the output are intentional. // Posix path formatting is used to make paths the same across OSes. const files = klawSync(outputDir) .map((entry) => { if (entry.path.includes('node_modules') || !entry.stats.isFile()) { return null; } return path.posix.relative(outputDir, entry.path); }) .filter(Boolean); // Ensure output.js is a utf8 encoded file const outputJS = fs.readFileSync(path.join(outputDir, 'output.js'), 'utf8'); expect(outputJS.slice(0, 5)).toBe('var _'); // If this changes then everything else probably changed as well. expect(files).toEqual([ 'assets/__packages/expo-router/assets/error.png', 'assets/__packages/expo-router/assets/file.png', 'assets/__packages/expo-router/assets/forward.png', 'assets/__packages/expo-router/assets/pkg.png', 'output.js', ]); }, 120 * 1000 ); it( 'runs `npx expo export:embed --platform android` with source maps', async () => { const projectRoot = ensureTesterReady('static-rendering'); const output = 'dist-export-embed-source-maps-android'; await fs.remove(path.join(projectRoot, output)); await fs.ensureDir(path.join(projectRoot, output)); console.log( [ 'export:embed', '--entry-file', path.join(projectRoot, './index.js'), '--bundle-output', `./${output}/output.js`, '--assets-dest', output, '--platform', 'android', '--dev', 'false', '--sourcemap-output', path.join(projectRoot, `./${output}/output.js.map`), '--sourcemap-sources-root', projectRoot, ].join(' ') ); const res = await execa( 'node', // yarn expo export:embed --platform android --dev false --reset-cache --entry-file /Users/cedric/Desktop/test-expo-29656/node_modules/expo/AppEntry.js --bundle-output /Users/cedric/Desktop/test-expo-29656/android/app/build/generated/assets/createBundleReleaseJsAndAssets/index.android.bundle --assets-dest /Users/cedric/Desktop/test-expo-29656/android/app/build/generated/res/createBundleReleaseJsAndAssets // --sourcemap-output /Users/cedric/Desktop/test-expo-29656/android/app/build/intermediates/sourcemaps/react/release/index.android.bundle.packager.map --minify false [ bin, 'export:embed', '--entry-file', path.join(projectRoot, './index.js'), '--bundle-output', `./${output}/output.js`, '--assets-dest', output, '--platform', 'android', '--dev', 'false', '--sourcemap-output', path.join(projectRoot, `./${output}/output.js.map`), '--sourcemap-sources-root', projectRoot, ], { cwd: projectRoot, env: { NODE_ENV: 'production', EXPO_USE_STATIC: 'static', E2E_ROUTER_SRC: 'static-rendering', E2E_ROUTER_ASYNC: 'development', EXPO_USE_FAST_RESOLVER: '1', }, } ); // Ensure no unexpected errors/warnings are thrown. expect(res.stderr).toBe('Experimental module resolution is enabled.'); const outputDir = path.join(projectRoot, output); // List output files with sizes for snapshotting. // This is to make sure that any changes to the output are intentional. // Posix path formatting is used to make paths the same across OSes. const files = klawSync(outputDir) .map((entry) => { if (entry.path.includes('node_modules') || !entry.stats.isFile()) { return null; } return path.posix.relative(outputDir, entry.path); }) .filter(Boolean); // Ensure output.js is a utf8 encoded file const outputJS = fs.readFileSync(path.join(outputDir, 'output.js'), 'utf8'); expect(outputJS.slice(0, 5)).toBe('var _'); // Ensure no `//# sourceURL=` comment expect(outputJS).not.toContain('//# sourceURL='); // Ensure `//# sourceMappingURL=output.js.map` expect(outputJS).toContain('//# sourceMappingURL=output.js.map'); // If this changes then everything else probably changed as well. expect(files).toEqual([ 'drawable-mdpi/__packages_exporouter_assets_error.png', 'drawable-mdpi/__packages_exporouter_assets_file.png', 'drawable-mdpi/__packages_exporouter_assets_forward.png', 'drawable-mdpi/__packages_exporouter_assets_pkg.png', 'drawable-mdpi/assets_icon.png', 'output.js', 'output.js.map', 'raw/__e2e___staticrendering_sweet.ttf', ]); }, // Could take 45s depending on how fast npm installs 120 * 1000 ); ```
/content/code_sandbox/packages/@expo/cli/e2e/__tests__/export-embed-test.ts
xml
2016-08-15T17:14:25
2024-08-16T19:54:44
expo
expo/expo
32,004
3,503
```xml import { AnyFeatureDescription } from '../Feature/AnyFeatureDescription' import { EditorFeatureDescription } from '../Feature/EditorFeatureDescription' import { IframeComponentFeatureDescription } from '../Feature/IframeComponentFeatureDescription' import { ContentType, RoleName } from '@standardnotes/domain-core' import { PermissionName } from '../Permission/PermissionName' import { NativeFeatureIdentifier } from '../Feature/NativeFeatureIdentifier' import { NoteType } from '../Component/NoteType' import { FillIframeEditorDefaults } from './Utilities/FillEditorComponentDefaults' import { ComponentAction } from '../Component/ComponentAction' import { ComponentArea } from '../Component/ComponentArea' export function GetDeprecatedFeatures(): AnyFeatureDescription[] { const code = FillIframeEditorDefaults({ name: 'Code', spellcheckControl: true, identifier: NativeFeatureIdentifier.TYPES.DeprecatedCodeEditor, permission_name: PermissionName.DeprecatedCodeEditor, note_type: NoteType.Code, file_type: 'txt', interchangeable: true, deprecated: true, index_path: 'index.html', description: 'Syntax highlighting and convenient keyboard shortcuts for over 120 programming' + ' languages. Ideal for code snippets and procedures.', thumbnail_url: 'path_to_url availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], }) const plus = FillIframeEditorDefaults({ name: 'Rich Text', note_type: NoteType.RichText, file_type: 'html', identifier: NativeFeatureIdentifier.TYPES.DeprecatedPlusEditor, permission_name: PermissionName.DeprecatedPlusEditor, spellcheckControl: true, deprecated: true, description: 'From highlighting to custom font sizes and colors, to tables and lists, this editor is perfect for crafting any document.', thumbnail_url: 'path_to_url availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], }) const markdown = FillIframeEditorDefaults({ name: 'Markdown', identifier: NativeFeatureIdentifier.TYPES.DeprecatedMarkdownProEditor, note_type: NoteType.Markdown, file_type: 'md', permission_name: PermissionName.DeprecatedMarkdownProEditor, spellcheckControl: true, deprecated: true, description: 'A fully featured Markdown editor that supports live preview, a styling toolbar, and split pane support.', thumbnail_url: 'path_to_url availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], }) const task = FillIframeEditorDefaults({ name: 'Checklist', identifier: NativeFeatureIdentifier.TYPES.DeprecatedTaskEditor, note_type: NoteType.Task, spellcheckControl: true, file_type: 'md', interchangeable: false, deprecated: true, permission_name: PermissionName.DeprecatedTaskEditor, description: 'A great way to manage short-term and long-term to-do"s. You can mark tasks as completed, change their order, and edit the text naturally in place.', thumbnail_url: 'path_to_url availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], }) const bold: EditorFeatureDescription = FillIframeEditorDefaults({ name: 'Alternative Rich Text', identifier: NativeFeatureIdentifier.TYPES.DeprecatedBoldEditor, note_type: NoteType.RichText, file_type: 'html', component_permissions: [ { name: ComponentAction.StreamContextItem, content_types: [ContentType.TYPES.Note], }, { name: ComponentAction.StreamItems, content_types: [ ContentType.TYPES.FilesafeCredentials, ContentType.TYPES.FilesafeFileMetadata, ContentType.TYPES.FilesafeIntegration, ], }, ], spellcheckControl: true, deprecated: true, permission_name: PermissionName.BoldEditor, description: 'A simple and peaceful rich editor that helps you write and think clearly.', thumbnail_url: 'path_to_url availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], }) const markdownBasic: EditorFeatureDescription = FillIframeEditorDefaults({ name: 'Basic Markdown', identifier: NativeFeatureIdentifier.TYPES.DeprecatedMarkdownBasicEditor, note_type: NoteType.Markdown, spellcheckControl: true, file_type: 'md', deprecated: true, permission_name: PermissionName.MarkdownBasicEditor, description: 'A Markdown editor with dynamic split-pane preview.', thumbnail_url: 'path_to_url availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], }) const markdownAlt: EditorFeatureDescription = FillIframeEditorDefaults({ name: 'Markdown Alternative', identifier: NativeFeatureIdentifier.TYPES.DeprecatedMarkdownVisualEditor, note_type: NoteType.Markdown, file_type: 'md', deprecated: true, permission_name: PermissionName.MarkdownVisualEditor, spellcheckControl: true, description: 'A WYSIWYG-style Markdown editor that renders Markdown in preview-mode while you type without displaying any syntax.', index_path: 'build/index.html', availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], }) const markdownMinimist: EditorFeatureDescription = FillIframeEditorDefaults({ name: 'Minimal Markdown', identifier: NativeFeatureIdentifier.TYPES.DeprecatedMarkdownMinimistEditor, note_type: NoteType.Markdown, file_type: 'md', index_path: 'index.html', permission_name: PermissionName.MarkdownMinimistEditor, spellcheckControl: true, deprecated: true, description: 'A minimal Markdown editor with live rendering and in-text search via Ctrl/Cmd + F', thumbnail_url: 'path_to_url availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], }) const markdownMath: EditorFeatureDescription = FillIframeEditorDefaults({ name: 'Markdown with Math', identifier: NativeFeatureIdentifier.TYPES.DeprecatedMarkdownMathEditor, spellcheckControl: true, permission_name: PermissionName.MarkdownMathEditor, note_type: NoteType.Markdown, file_type: 'md', deprecated: true, index_path: 'index.html', description: 'A beautiful split-pane Markdown editor with synced-scroll, LaTeX support, and colorful syntax.', thumbnail_url: 'path_to_url availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], }) const filesafe: IframeComponentFeatureDescription = FillIframeEditorDefaults({ name: 'FileSafe', identifier: NativeFeatureIdentifier.TYPES.DeprecatedFileSafe, component_permissions: [ { name: ComponentAction.StreamContextItem, content_types: [ContentType.TYPES.Note], }, { name: ComponentAction.StreamItems, content_types: [ ContentType.TYPES.FilesafeCredentials, ContentType.TYPES.FilesafeFileMetadata, ContentType.TYPES.FilesafeIntegration, ], }, ], permission_name: PermissionName.ComponentFilesafe, area: ComponentArea.EditorStack, deprecated: true, description: 'Encrypted attachments for your notes using your Dropbox, Google Drive, or WebDAV server. Limited to 50MB per file.', thumbnail_url: 'path_to_url availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], }) return [code, plus, markdown, task, bold, markdownBasic, markdownMinimist, markdownMath, markdownAlt, filesafe] } ```
/content/code_sandbox/packages/features/src/Domain/Lists/DeprecatedFeatures.ts
xml
2016-12-05T23:31:33
2024-08-16T06:51:19
app
standardnotes/app
5,180
1,650
```xml import { ChangeDetectionStrategy, Component, OnDestroy } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { TranslateService } from '@ngx-translate/core'; import { Store } from '@ngxs/store'; import { Environment } from 'app/model/environment.model'; import { Project } from 'app/model/project.model'; import { AutoUnsubscribe } from 'app/shared/decorator/autoUnsubscribe'; import { ToastService } from 'app/shared/toast/ToastService'; import { AddEnvironment } from 'app/store/environment.action'; import { Subscription } from 'rxjs'; import { finalize } from 'rxjs/operators'; @Component({ selector: 'app-environment-add', templateUrl: './environment.add.html', styleUrls: ['./environment.add.scss'], changeDetection: ChangeDetectionStrategy.OnPush }) @AutoUnsubscribe() export class EnvironmentAddComponent implements OnDestroy { project: Project; newEnvironment: Environment = new Environment(); envPatternError = false; loading = false; dataSubscription: Subscription; environmentNamePattern = new RegExp('^[a-zA-Z0-9._-]{1,}$'); constructor( private store: Store, private _activatedRoute: ActivatedRoute, private _router: Router, private _toast: ToastService, private _translate: TranslateService ) { this.dataSubscription = this._activatedRoute.data.subscribe(datas => { this.project = datas['project']; }); } ngOnDestroy(): void {} // Should be set to use @AutoUnsubscribe with AOT checkPattern(envName: string) { if (!envName) { return; } this.envPatternError = !this.environmentNamePattern.test(envName); } createEnv(): void { if (!this.newEnvironment.name || this.envPatternError) { return; } this.loading = true; this.store.dispatch(new AddEnvironment({ projectKey: this.project.key, environment: this.newEnvironment })) .pipe(finalize(() => this.loading = false)) .subscribe(() => { this._toast.success('', this._translate.instant('environment_created')); this._router.navigate(['/project', this.project.key, 'environment', this.newEnvironment.name]); this.newEnvironment = new Environment(); }); } } ```
/content/code_sandbox/ui/src/app/views/environment/add/environment.add.component.ts
xml
2016-10-11T08:28:23
2024-08-16T01:55:31
cds
ovh/cds
4,535
479
```xml <menu xmlns:android="path_to_url" xmlns:app="path_to_url" xmlns:tools="path_to_url" tools:context="phonelocation.example.asuss550c.phonelocation.ContactList"> <item android:id="@+id/add" android:title="Save" android:icon="@drawable/ic_add_white_24dp" app:showAsAction="always" /> <item android:id="@+id/goback" android:title="Save" android:icon="@drawable/ic_done_white_24dp" app:showAsAction="always" /> </menu> ```
/content/code_sandbox/MyTracker/app/src/main/res/menu/menu_contact_list.xml
xml
2016-09-26T16:36:28
2024-08-13T08:59:01
AndroidTutorialForBeginners
hussien89aa/AndroidTutorialForBeginners
4,360
132
```xml import type { ConfigurationChangeEvent } from 'vscode'; import { Disposable, workspace } from 'vscode'; import type { ContextKeys } from '../../constants'; import type { Container } from '../../container'; import type { Subscription } from '../../plus/gk/account/subscription'; import { isSubscriptionPaid, SubscriptionState } from '../../plus/gk/account/subscription'; import type { SubscriptionChangeEvent } from '../../plus/gk/account/subscriptionService'; import { configuration } from '../../system/configuration'; import { getContext, onDidChangeContext } from '../../system/context'; import type { IpcMessage } from '../protocol'; import type { WebviewHost, WebviewProvider } from '../webviewProvider'; import type { State, UpdateConfigurationParams } from './protocol'; import { DidChangeNotification, DidChangeOrgSettings, UpdateConfigurationCommand } from './protocol'; const emptyDisposable = Object.freeze({ dispose: () => { /* noop */ }, }); export class WelcomeWebviewProvider implements WebviewProvider<State> { private readonly _disposable: Disposable; constructor( private readonly container: Container, private readonly host: WebviewHost, ) { this._disposable = Disposable.from( configuration.onDidChange(this.onConfigurationChanged, this), this.container.git.onDidChangeRepositories(() => this.notifyDidChange(), this), !workspace.isTrusted ? workspace.onDidGrantWorkspaceTrust(() => this.notifyDidChange(), this) : emptyDisposable, this.container.subscription.onDidChange(this.onSubscriptionChanged, this), onDidChangeContext(this.onContextChanged, this), ); } dispose() { this._disposable.dispose(); } includeBootstrap(): Promise<State> { return this.getState(); } onReloaded() { void this.notifyDidChange(); } private getOrgSettings(): State['orgSettings'] { return { ai: getContext('gitlens:gk:organization:ai:enabled', false), drafts: getContext('gitlens:gk:organization:drafts:enabled', false), }; } private onContextChanged(key: keyof ContextKeys) { if (['gitlens:gk:organization:ai:enabled', 'gitlens:gk:organization:drafts:enabled'].includes(key)) { this.notifyDidChangeOrgSettings(); } } private onSubscriptionChanged(e: SubscriptionChangeEvent) { void this.notifyDidChange(e.current); } private onConfigurationChanged(e: ConfigurationChangeEvent) { if (!configuration.changed(e, 'codeLens.enabled') && !configuration.changed(e, 'currentLine.enabled')) return; void this.notifyDidChange(); } onMessageReceived(e: IpcMessage) { switch (true) { case UpdateConfigurationCommand.is(e): this.updateConfiguration(e.params); break; } } private async getState(subscription?: Subscription): Promise<State> { return { ...this.host.baseWebviewState, version: this.container.version, // Make sure to get the raw config so to avoid having the mode mixed in config: { codeLens: configuration.get('codeLens.enabled', undefined, true, true), currentLine: configuration.get('currentLine.enabled', undefined, true, true), }, repoFeaturesBlocked: !workspace.isTrusted || this.container.git.openRepositoryCount === 0 || this.container.git.hasUnsafeRepositories(), isTrialOrPaid: await this.getTrialOrPaidState(subscription), canShowPromo: await this.getCanShowPromo(subscription), orgSettings: this.getOrgSettings(), }; } private async getTrialOrPaidState(subscription?: Subscription): Promise<boolean> { const sub = subscription ?? (await this.container.subscription.getSubscription(true)); if ([SubscriptionState.FreePlusInTrial, SubscriptionState.Paid].includes(sub.state)) { return true; } return false; } private async getCanShowPromo(subscription?: Subscription): Promise<boolean> { const expiresTime = new Date('2023-12-31T07:59:00.000Z').getTime(); // 2023-12-30 23:59:00 PST-0800 if (Date.now() > expiresTime) { return false; } const sub = subscription ?? (await this.container.subscription.getSubscription(true)); return !isSubscriptionPaid(sub); } private updateConfiguration(params: UpdateConfigurationParams) { void configuration.updateEffective(`${params.type}.enabled`, params.value); } private async notifyDidChange(subscription?: Subscription) { void this.host.notify(DidChangeNotification, { state: await this.getState(subscription) }); } private notifyDidChangeOrgSettings() { void this.host.notify(DidChangeOrgSettings, { orgSettings: this.getOrgSettings(), }); } } ```
/content/code_sandbox/src/webviews/welcome/welcomeWebview.ts
xml
2016-08-08T14:50:30
2024-08-15T21:25:09
vscode-gitlens
gitkraken/vscode-gitlens
8,889
1,022
```xml // See LICENSE in the project root for license information. import type * as argparse from 'argparse'; import { CommandLineParameterProvider } from './CommandLineParameterProvider'; import { CommandLineParserExitError } from './CommandLineParserExitError'; /** * Options for the CommandLineAction constructor. * @public */ export interface ICommandLineActionOptions { /** * The name of the action. For example, if the tool is called "example", * then the "build" action might be invoked as: "example build -q --some-other-option" */ actionName: string; /** * A quick summary that is shown on the main help page, which is displayed * by the command "example --help" */ summary: string; /** * A detailed description that is shown on the action help page, which is displayed * by the command "example build --help", e.g. for actionName="build". */ documentation: string; } /** * Example: "do-something" */ const ACTION_NAME_REGEXP: RegExp = /^[a-z][a-z0-9]*([-:][a-z0-9]+)*$/; /** * Represents a sub-command that is part of the CommandLineParser command line. * Applications should create subclasses of CommandLineAction corresponding to * each action that they want to expose. * * The action name should be comprised of lower case words separated by hyphens * or colons. The name should include an English verb (e.g. "deploy"). Use a * hyphen to separate words (e.g. "upload-docs"). A group of related commands * can be prefixed with a colon (e.g. "docs:generate", "docs:deploy", * "docs:serve", etc). * * @public */ export abstract class CommandLineAction extends CommandLineParameterProvider { /** {@inheritDoc ICommandLineActionOptions.actionName} */ public readonly actionName: string; /** {@inheritDoc ICommandLineActionOptions.summary} */ public readonly summary: string; /** {@inheritDoc ICommandLineActionOptions.documentation} */ public readonly documentation: string; private _argumentParser: argparse.ArgumentParser | undefined; public constructor(options: ICommandLineActionOptions) { super(); if (!ACTION_NAME_REGEXP.test(options.actionName)) { throw new Error( `Invalid action name "${options.actionName}". ` + `The name must be comprised of lower-case words optionally separated by hyphens or colons.` ); } this.actionName = options.actionName; this.summary = options.summary; this.documentation = options.documentation; this._argumentParser = undefined; } /** * This is called internally by CommandLineParser.addAction() * @internal */ public _buildParser(actionsSubParser: argparse.SubParser): void { this._argumentParser = actionsSubParser.addParser(this.actionName, { help: this.summary, description: this.documentation }); // Monkey-patch the error handling for the action parser this._argumentParser.exit = (status: number, message: string) => { throw new CommandLineParserExitError(status, message); }; const originalArgumentParserErrorFn: (err: Error | string) => void = this._argumentParser.error.bind( this._argumentParser ); this._argumentParser.error = (err: Error | string) => { // Ensure the ParserExitError bubbles up to the top without any special processing if (err instanceof CommandLineParserExitError) { throw err; } originalArgumentParserErrorFn(err); }; this.onDefineParameters?.(); } /** * Invoked by CommandLineParser.onExecute(). * @internal */ public _executeAsync(): Promise<void> { return this.onExecute(); } /** * {@inheritDoc CommandLineParameterProvider._getArgumentParser} * @internal */ public _getArgumentParser(): argparse.ArgumentParser { // override if (!this._argumentParser) { // We will improve this in the future throw new Error('The CommandLineAction must be added to a CommandLineParser before it can be used'); } return this._argumentParser; } /** * Your subclass should implement this hook to perform the operation. * * @remarks * In a future release, this function will be renamed to onExecuteAsync */ protected abstract onExecute(): Promise<void>; } ```
/content/code_sandbox/libraries/ts-command-line/src/providers/CommandLineAction.ts
xml
2016-09-30T00:28:20
2024-08-16T18:54:35
rushstack
microsoft/rushstack
5,790
944
```xml import glo_m4 = require("glo_m4"); ```
/content/code_sandbox/tests/format/typescript/conformance/types/importEqualsDeclaration/importEqualsDeclaration.ts
xml
2016-11-29T17:13:37
2024-08-16T17:29:57
prettier
prettier/prettier
48,913
13
```xml <!-- ~ contributor license agreements. See the NOTICE file distributed with ~ this work for additional information regarding copyright ownership. ~ ~ path_to_url ~ ~ Unless required by applicable law or agreed to in writing, software ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --> <dataset update-count="1"> <metadata data-nodes="tbl.t_broadcast_table"> <column name="id" type="numeric" /> <column name="status" type="varchar" /> </metadata> <row data-node="tbl.t_broadcast_table" values="1, finished" /> </dataset> ```
/content/code_sandbox/test/e2e/sql/src/test/resources/cases/dml/dataset/tbl/update_broadcast_table.xml
xml
2016-01-18T12:49:26
2024-08-16T15:48:11
shardingsphere
apache/shardingsphere
19,707
140
```xml /* * @license Apache-2.0 * * * * path_to_url * * Unless required by applicable law or agreed to in writing, software * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ import median = require( './index' ); // TESTS // // The function returns a number... { median( 0, 4 ); // $ExpectType number } // The compiler throws an error if the function is provided values other than two numbers... { median( true, 3 ); // $ExpectError median( false, 2 ); // $ExpectError median( '5', 1 ); // $ExpectError median( [], 1 ); // $ExpectError median( {}, 2 ); // $ExpectError median( ( x: number ): number => x, 2 ); // $ExpectError median( 9, true ); // $ExpectError median( 9, false ); // $ExpectError median( 5, '5' ); // $ExpectError median( 8, [] ); // $ExpectError median( 9, {} ); // $ExpectError median( 8, ( x: number ): number => x ); // $ExpectError median( [], true ); // $ExpectError median( {}, false ); // $ExpectError median( false, '5' ); // $ExpectError median( {}, [] ); // $ExpectError median( '5', ( x: number ): number => x ); // $ExpectError } // The compiler throws an error if the function is provided insufficient arguments... { median(); // $ExpectError median( 3 ); // $ExpectError } ```
/content/code_sandbox/lib/node_modules/@stdlib/stats/base/dists/arcsine/median/docs/types/test.ts
xml
2016-03-24T04:19:52
2024-08-16T09:03:19
stdlib
stdlib-js/stdlib
4,266
379
```xml import { generateModels } from "./connectionResolver"; import { getBoardItemLink } from "./models/utils"; export default { actions: [ { label: "Deal created", action: "create", type: "sales:deal" }, { label: "Deal updated", action: "update", type: "sales:deal" }, { label: "Deal deleted", action: "delete", type: "sales:deal" }, { label: "Deal moved", action: "createBoardItemMovementLog", type: "sales:deal" } ], getInfo: async ({ subdomain, data: { data, contentType, actionText, action } }) => { const models = await generateModels(subdomain); if (action === "createBoardItemMovementLog") { return { content: `${contentType} with name ${ data.data.item.name || "" } has moved from ${data.data.activityLogContent.text}`, url: data.data.link }; } if (!["create", "update"].includes(action)) { return { content: `${contentType} ${actionText}`, url: "" }; } const { object } = data; return { url: await getBoardItemLink(models, object.stageId, object._id), content: `${contentType} ${actionText}` }; } }; ```
/content/code_sandbox/packages/plugin-sales-api/src/webhooks.ts
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
306
```xml import {Component} from '@angular/core'; import {TestBed, fakeAsync, flush} from '@angular/core/testing'; import {DEFAULT_OPTIONS, GoogleMap} from '../google-map/google-map'; import { createMapConstructorSpy, createMapSpy, createTransitLayerConstructorSpy, createTransitLayerSpy, } from '../testing/fake-google-map-utils'; import {MapTransitLayer} from './map-transit-layer'; describe('MapTransitLayer', () => { let mapSpy: jasmine.SpyObj<google.maps.Map>; beforeEach(() => { mapSpy = createMapSpy(DEFAULT_OPTIONS); createMapConstructorSpy(mapSpy); }); afterEach(() => { (window.google as any) = undefined; }); it('initializes a Google Map Transit Layer', fakeAsync(() => { const transitLayerSpy = createTransitLayerSpy(); const transitLayerConstructorSpy = createTransitLayerConstructorSpy(transitLayerSpy); const fixture = TestBed.createComponent(TestApp); fixture.detectChanges(); flush(); expect(transitLayerConstructorSpy).toHaveBeenCalled(); expect(transitLayerSpy.setMap).toHaveBeenCalledWith(mapSpy); })); }); @Component({ selector: 'test-app', template: ` <google-map> <map-transit-layer /> </google-map> `, standalone: true, imports: [GoogleMap, MapTransitLayer], }) class TestApp {} ```
/content/code_sandbox/src/google-maps/map-transit-layer/map-transit-layer.spec.ts
xml
2016-01-04T18:50:02
2024-08-16T11:21:13
components
angular/components
24,263
301
```xml // See LICENSE in the project root for license information. /** @public */ export type Lib1GenericType<T1, T2> = { one: T1; two: T2; }; ```
/content/code_sandbox/build-tests/api-extractor-lib1-test/src/Lib1GenericType.ts
xml
2016-09-30T00:28:20
2024-08-16T18:54:35
rushstack
microsoft/rushstack
5,790
42
```xml import type { Classnames, ControlElementsProp, FullField } from 'react-querybuilder'; import { getCompatContextProvider } from 'react-querybuilder'; import { TremorActionElement } from './TremorActionElement'; import { TremorNotToggle } from './TremorNotToggle'; import { TremorValueEditor } from './TremorValueEditor'; import { TremorValueSelector } from './TremorValueSelector'; export * from './TremorActionElement'; export * from './TremorNotToggle'; export * from './TremorValueEditor'; export * from './TremorValueSelector'; export const tremorControlElements = { actionElement: TremorActionElement, notToggle: TremorNotToggle, valueEditor: TremorValueEditor, valueSelector: TremorValueSelector, } satisfies ControlElementsProp<FullField, string>; export const tremorControlClassnames = { notToggle: 'flex flex-row gap-1', } satisfies Partial<Classnames>; export const QueryBuilderTremor = getCompatContextProvider({ controlClassnames: tremorControlClassnames, controlElements: tremorControlElements, }); ```
/content/code_sandbox/packages/tremor/src/index.tsx
xml
2016-06-17T22:03:19
2024-08-16T10:28:42
react-querybuilder
react-querybuilder/react-querybuilder
1,131
249
```xml import type { IThemeSlotRule } from './IThemeSlotRule'; export interface IThemeRules { [key: string]: IThemeSlotRule; } ```
/content/code_sandbox/packages/react/src/components/ThemeGenerator/IThemeRules.ts
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
35
```xml <?xml version="1.0" encoding="utf-8" ?> <page version="1.0"> <renderer name="two-column"/> <section region="left"> <source url="path_to_url article id]"/> <renderer name="articleBodyRenderer"> <parameter name="color">blue</parameter> </renderer> </section> <section region="right"> <renderer name="multi-item-column"> <parameter name="items">3</parameter> </renderer> <section region="1"> <renderer for="news" name="articleRenderer"/> <content> <hit relevance="1.0" source="news"> <id>news-1</id> </hit> <hit relevance="0.5" source="news"> <id>news-2</id> </hit> </content> </section> <section region="2"> <source url="path_to_url"/> <renderer name="identityRenderer"/> </section> <section region="3"> <renderer name="htmlRenderer"/> <content> <hit relevance="1.0" source="htmlSource"> <id>htmlSource-1</id> </hit> </content> </section> </section> </page> ```
/content/code_sandbox/container-search/src/test/java/com/yahoo/search/pagetemplates/engine/test/PageWithSourceRendererResult.xml
xml
2016-06-03T20:54:20
2024-08-16T15:32:01
vespa
vespa-engine/vespa
5,524
286
```xml import type { SupportedRenderers as CoreSupportedFrameworks, SupportedFrameworks, } from '@storybook/core/types'; import { minVersion, validRange } from 'semver'; function eqMajor(versionRange: string, major: number) { // Uses validRange to avoid a throw from minVersion if an invalid range gets passed if (validRange(versionRange)) { return minVersion(versionRange)?.major === major; } return false; } /** A list of all frameworks that are supported, but use a package outside the storybook monorepo */ export type ExternalFramework = { name: SupportedFrameworks; packageName?: string; frameworks?: string[]; renderer?: string; }; export const externalFrameworks: ExternalFramework[] = [ { name: 'qwik', packageName: 'storybook-framework-qwik' }, { name: 'solid', frameworks: ['storybook-solidjs-vite'], renderer: 'storybook-solidjs' }, ]; /** @deprecated Please use `SupportedFrameworks` from `@storybook/types` instead */ export type SupportedRenderers = CoreSupportedFrameworks; export const SUPPORTED_RENDERERS: SupportedRenderers[] = [ 'react', 'react-native', 'vue3', 'angular', 'ember', 'preact', 'svelte', 'qwik', 'solid', ]; export enum ProjectType { UNDETECTED = 'UNDETECTED', UNSUPPORTED = 'UNSUPPORTED', REACT = 'REACT', REACT_SCRIPTS = 'REACT_SCRIPTS', REACT_NATIVE = 'REACT_NATIVE', REACT_PROJECT = 'REACT_PROJECT', WEBPACK_REACT = 'WEBPACK_REACT', NEXTJS = 'NEXTJS', VUE3 = 'VUE3', ANGULAR = 'ANGULAR', EMBER = 'EMBER', WEB_COMPONENTS = 'WEB_COMPONENTS', HTML = 'HTML', QWIK = 'QWIK', PREACT = 'PREACT', SVELTE = 'SVELTE', SVELTEKIT = 'SVELTEKIT', SERVER = 'SERVER', NX = 'NX', SOLID = 'SOLID', } export enum CoreBuilder { Webpack5 = 'webpack5', Vite = 'vite', } export enum CoreWebpackCompilers { Babel = 'babel', SWC = 'swc', } export enum CommunityBuilder { Rsbuild = 'rsbuild', } export const compilerNameToCoreCompiler: Record<string, CoreWebpackCompilers> = { '@storybook/addon-webpack5-compiler-babel': CoreWebpackCompilers.Babel, '@storybook/addon-webpack5-compiler-swc': CoreWebpackCompilers.SWC, }; export const builderNameToCoreBuilder: Record<string, CoreBuilder> = { '@storybook/builder-webpack5': CoreBuilder.Webpack5, '@storybook/builder-vite': CoreBuilder.Vite, }; // The `& {}` bit allows for auto-complete, see: path_to_url export type Builder = CoreBuilder | (string & {}); export enum SupportedLanguage { JAVASCRIPT = 'javascript', TYPESCRIPT_3_8 = 'typescript-3-8', TYPESCRIPT_4_9 = 'typescript-4-9', } export type TemplateMatcher = { files?: boolean[]; dependencies?: boolean[]; peerDependencies?: boolean[]; }; export type TemplateConfiguration = { preset: ProjectType; /** Will be checked both against dependencies and devDependencies */ dependencies?: string[] | { [dependency: string]: (version: string) => boolean }; peerDependencies?: string[] | { [dependency: string]: (version: string) => boolean }; files?: string[]; matcherFunction: (matcher: TemplateMatcher) => boolean; }; /** * Configuration to match a storybook preset template. * * This has to be an array sorted in order of specificity/priority. Reason: both REACT and * WEBPACK_REACT have react as dependency, therefore WEBPACK_REACT has to come first, as it's more * specific. */ export const supportedTemplates: TemplateConfiguration[] = [ { preset: ProjectType.VUE3, dependencies: { // This Vue template works with Vue 3 vue: (versionRange) => versionRange === 'next' || eqMajor(versionRange, 3), }, matcherFunction: ({ dependencies }) => { return dependencies?.some(Boolean) ?? false; }, }, { preset: ProjectType.EMBER, dependencies: ['ember-cli'], matcherFunction: ({ dependencies }) => { return dependencies?.every(Boolean) ?? true; }, }, { preset: ProjectType.NEXTJS, dependencies: ['next'], matcherFunction: ({ dependencies }) => { return dependencies?.every(Boolean) ?? true; }, }, { preset: ProjectType.QWIK, dependencies: ['@builder.io/qwik'], matcherFunction: ({ dependencies }) => { return dependencies?.every(Boolean) ?? true; }, }, { preset: ProjectType.REACT_PROJECT, peerDependencies: ['react'], matcherFunction: ({ peerDependencies }) => { return peerDependencies?.every(Boolean) ?? true; }, }, { preset: ProjectType.REACT_NATIVE, dependencies: ['react-native', 'react-native-scripts'], matcherFunction: ({ dependencies }) => { return dependencies?.some(Boolean) ?? false; }, }, { preset: ProjectType.REACT_SCRIPTS, // For projects using a custom/forked `react-scripts` package. files: ['/node_modules/.bin/react-scripts'], // For standard CRA projects dependencies: ['react-scripts'], matcherFunction: ({ dependencies, files }) => { return (dependencies?.every(Boolean) || files?.every(Boolean)) ?? false; }, }, { preset: ProjectType.ANGULAR, dependencies: ['@angular/core'], matcherFunction: ({ dependencies }) => { return dependencies?.every(Boolean) ?? true; }, }, { preset: ProjectType.WEB_COMPONENTS, dependencies: ['lit-element', 'lit-html', 'lit'], matcherFunction: ({ dependencies }) => { return dependencies?.some(Boolean) ?? false; }, }, { preset: ProjectType.PREACT, dependencies: ['preact'], matcherFunction: ({ dependencies }) => { return dependencies?.every(Boolean) ?? true; }, }, { // TODO: This only works because it is before the SVELTE template. could be more explicit preset: ProjectType.SVELTEKIT, dependencies: ['@sveltejs/kit'], matcherFunction: ({ dependencies }) => { return dependencies?.every(Boolean) ?? true; }, }, { preset: ProjectType.SVELTE, dependencies: ['svelte'], matcherFunction: ({ dependencies }) => { return dependencies?.every(Boolean) ?? true; }, }, { preset: ProjectType.SOLID, dependencies: ['solid-js'], matcherFunction: ({ dependencies }) => { return dependencies?.every(Boolean) ?? true; }, }, // DO NOT MOVE ANY TEMPLATES BELOW THIS LINE // React is part of every Template, after Storybook is initialized once { preset: ProjectType.WEBPACK_REACT, dependencies: ['react', 'webpack'], matcherFunction: ({ dependencies }) => { return dependencies?.every(Boolean) ?? true; }, }, { preset: ProjectType.REACT, dependencies: ['react'], matcherFunction: ({ dependencies }) => { return dependencies?.every(Boolean) ?? true; }, }, ]; // A TemplateConfiguration that matches unsupported frameworks // Framework matchers can be added to this object to give // users an "Unsupported framework" message export const unsupportedTemplate: TemplateConfiguration = { preset: ProjectType.UNSUPPORTED, dependencies: { // TODO(blaine): Remove when we support Nuxt 3 nuxt: (versionRange) => eqMajor(versionRange, 3), }, matcherFunction: ({ dependencies }) => { return dependencies?.some(Boolean) ?? false; }, }; const notInstallableProjectTypes: ProjectType[] = [ ProjectType.UNDETECTED, ProjectType.UNSUPPORTED, ProjectType.NX, ]; export const installableProjectTypes = Object.values(ProjectType) .filter((type) => !notInstallableProjectTypes.includes(type)) .map((type) => type.toLowerCase()); ```
/content/code_sandbox/code/core/src/cli/project_types.ts
xml
2016-03-18T04:23:44
2024-08-16T19:22:08
storybook
storybookjs/storybook
83,755
1,825
```xml export * from './getFieldDefinitionsFromRecords'; export * from './ResourceConfiguration'; export * from './useResourceConfiguration'; export * from './useResourcesConfiguration'; export * from './ResourceConfigurationContext'; export * from './ResourceConfigurationProvider'; ```
/content/code_sandbox/packages/ra-no-code/src/ResourceConfiguration/index.ts
xml
2016-07-13T07:58:54
2024-08-16T18:32:27
react-admin
marmelab/react-admin
24,624
49
```xml import * as React from 'react'; import { Checkbox, Combobox, Field, Input, makeResetStyles, Option, Radio, RadioGroup, Slider, SpinButton, Switch, Textarea, tokens, } from '@fluentui/react-components'; const useStackClassName = makeResetStyles({ display: 'flex', flexDirection: 'column', rowGap: tokens.spacingVerticalL, }); export const ComponentExamples = () => ( <div className={useStackClassName()}> <Field label="Input"> <Input /> </Field> <Field label="Textarea"> <Textarea /> </Field> <Field label="Combobox"> <Combobox> <Option>Option 1</Option> <Option>Option 2</Option> <Option>Option 3</Option> </Combobox> </Field> <Field label="SpinButton"> <SpinButton /> </Field> <Field hint="Checkboxes use their own label instead of the Field label."> <Checkbox label="Checkbox" /> </Field> <Field label="Slider"> <Slider defaultValue={25} /> </Field> <Field label="Switch"> <Switch /> </Field> <Field label="RadioGroup"> <RadioGroup> <Radio label="Option 1" /> <Radio label="Option 2" /> <Radio label="Option 3" /> </RadioGroup> </Field> </div> ); ComponentExamples.storyName = 'Component Examples'; ComponentExamples.parameters = { docs: { description: { story: `Field can be used with any input components in this library. This story shows some examples. It can also be used to add a label or error text to components like ProgressBar.`, }, }, }; ```
/content/code_sandbox/packages/react-components/react-field/stories/src/Field/FieldComponentExamples.stories.tsx
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
400
```xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="path_to_url" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:id="@+id/LL_contacts_topbar_content" android:layout_width="match_parent" android:layout_height="@dimen/top_bar_height" android:alpha="0.8" android:fitsSystemWindows="true" android:background="@android:color/white" android:focusable="true" android:focusableInTouchMode="true" android:orientation="vertical"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp"> <ImageView android:id="@+id/IV_contacts_add" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:layout_marginRight="10dp" android:src="@drawable/ic_add_white_24dp" /> <TextView android:id="@+id/IV_contacts_title" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerInParent="true" android:layout_marginLeft="34dp" android:layout_marginRight="34dp" android:ellipsize="end" android:gravity="center" android:maxLines="1" android:textColor="@android:color/white" android:textSize="20dp" /> </RelativeLayout> <EditText android:id="@+id/EDT_main_contacts_search" android:layout_width="match_parent" android:layout_height="26dp" android:layout_centerVertical="true" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:layout_marginTop="10dp" android:background="@drawable/edittext_rounded_corner_bg" android:drawableLeft="@drawable/ic_search_white_18dp" android:drawableTint="@color/button_disable_color" android:textColor="@android:color/white" /> </LinearLayout> <RelativeLayout android:id="@+id/RL_contacts_content" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/LL_contacts_topbar_content"> <com.kiminonawa.mydiary.contacts.LatterSortLayout android:id="@+id/STL_contacts" android:layout_width="30dp" android:layout_height="match_parent" android:paddingBottom="5dp" android:paddingTop="5dp" /> <android.support.v7.widget.RecyclerView android:id="@+id/RecyclerView_contacts" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_toRightOf="@+id/STL_contacts" android:paddingLeft="10dp" android:alpha="0.95" android:paddingRight="10dp" android:paddingTop="10dp" /> <TextView android:id="@+id/TV_contact_short_sort" android:layout_width="80dp" android:layout_height="80dp" android:layout_centerInParent="true" android:layout_gravity="center" android:gravity="center" android:textColor="#ffffffff" android:textSize="30dp" android:visibility="gone" /> </RelativeLayout> <View android:layout_width="match_parent" android:layout_height="@dimen/shadow_height_5dp" android:layout_below="@id/LL_contacts_topbar_content" android:background="@drawable/view_bottom_shadow" /> </RelativeLayout> ```
/content/code_sandbox/app/src/main/res/layout/activity_contacts.xml
xml
2016-11-04T02:04:13
2024-08-07T01:13:41
MyDiary
DaxiaK/MyDiary
1,580
826
```xml import { useState, useEffect } from 'react'; import { RefreshCw } from 'lucide-react'; import { Registry } from '@/react/portainer/registries/types/registry'; import { Select } from '@@/form-components/ReactSelect'; import { FormControl } from '@@/form-components/FormControl'; import { Button } from '@@/buttons'; import { FormError } from '@@/form-components/FormError'; import { SwitchField } from '@@/form-components/SwitchField'; import { TextTip } from '@@/Tip/TextTip'; import { FormSection } from '@@/form-components/FormSection'; interface Props { value?: number; registries: Registry[]; onChange?: () => void; formInvalid?: boolean; errorMessage?: string; onSelect: (value?: number) => void; isActive?: boolean; clearRegistries?: () => void; method?: 'repository' | string; } export function PrivateRegistryFieldset({ value, registries, onChange = () => {}, formInvalid, errorMessage, onSelect, isActive, clearRegistries = () => {}, method, }: Props) { const [checked, setChecked] = useState(isActive || false); const [selected, setSelected] = useState(value); const tooltipMessage = 'This allows you to provide credentials when using a private registry that requires authentication'; useEffect(() => { if (isActive) { setChecked(isActive); } }, [isActive]); useEffect(() => { if (checked) { onChange(); } else { clearRegistries(); } // eslint-disable-next-line react-hooks/exhaustive-deps }, [checked]); useEffect(() => { setSelected(value); }, [value]); function reload() { onChange(); setSelected(value); } return ( <FormSection title="Registry"> <div className="form-group"> <div className="col-sm-12"> <SwitchField checked={checked} onChange={(value) => setChecked(value)} tooltip={tooltipMessage} label="Use Credentials" labelClass="col-sm-3 col-lg-2" disabled={formInvalid} data-cy="private-registry-use-credentials-switch" /> </div> </div> {checked && ( <> {method !== 'repository' && ( <TextTip color="blue"> If you make any changes to the image urls in your yaml, please reload or select registry manually </TextTip> )} {!errorMessage ? ( <FormControl label="Registry" inputId="users-selector"> <div className="flex"> <Select value={registries.filter( (registry) => registry.Id === selected )} options={registries} getOptionLabel={(registry) => registry.Name} getOptionValue={(registry) => registry.Id.toString()} onChange={(value) => onSelect(value?.Id)} className="w-full" data-cy="private-registry-selector" /> {method !== 'repository' && ( <Button onClick={reload} title="Reload" icon={RefreshCw} color="light" data-cy="private-registry-reload-button" /> )} </div> </FormControl> ) : ( <FormError>{errorMessage}</FormError> )} </> )} </FormSection> ); } ```
/content/code_sandbox/app/react/edge/edge-stacks/components/PrivateRegistryFieldset.tsx
xml
2016-05-19T20:15:28
2024-08-16T19:15:14
portainer
portainer/portainer
30,083
746
```xml import type { WasmBitcoinAddressClient, WasmEmailIntegrationClient, WasmExchangeRateClient, WasmInviteClient, WasmNetworkClient, WasmPaymentGatewayClient, WasmPriceGraphClient, WasmProtonWalletApiClient, WasmSettingsClient, WasmWalletClient, } from '@proton/andromeda'; import * as useWalletApiModule from '@proton/wallet/contexts/ExtendedApiContext'; import { freeable } from '../utils/wasm'; type PartiallyMockedWalletApiClient = Partial<{ bitcoin_address: Partial<Omit<WasmBitcoinAddressClient, 'free'>>; email_integration: Partial<Omit<WasmEmailIntegrationClient, 'free'>>; exchange_rate: Partial<Omit<WasmExchangeRateClient, 'free'>>; network: Partial<Omit<WasmNetworkClient, 'free'>>; settings: Partial<Omit<WasmSettingsClient, 'free'>>; wallet: Partial<Omit<WasmWalletClient, 'free'>>; invite: Partial<Omit<WasmInviteClient, 'free'>>; payment_gateway: Partial<Omit<WasmPaymentGatewayClient, 'free'>>; price_graph: Partial<Omit<WasmPriceGraphClient, 'free'>>; }>; export const getMockedApi = (mockedValue?: PartiallyMockedWalletApiClient): WasmProtonWalletApiClient => { const f = freeable({ exchange_rate: freeable({ getExchangeRate: mockedValue?.exchange_rate?.getExchangeRate ?? vi.fn(), getAllFiatCurrencies: mockedValue?.exchange_rate?.getAllFiatCurrencies ?? vi.fn(), }), email_integration: freeable({ createBitcoinAddressesRequest: mockedValue?.email_integration?.createBitcoinAddressesRequest ?? vi.fn(), lookupBitcoinAddress: mockedValue?.email_integration?.lookupBitcoinAddress ?? vi.fn(), }), settings: freeable({ getUserSettings: mockedValue?.settings?.getUserSettings ?? vi.fn(), setBitcoinUnit: mockedValue?.settings?.setBitcoinUnit ?? vi.fn(), setFiatCurrency: mockedValue?.settings?.setFiatCurrency ?? vi.fn(), setTwoFaThreshold: mockedValue?.settings?.setTwoFaThreshold ?? vi.fn(), setHideEmptyUsedAddresses: mockedValue?.settings?.setHideEmptyUsedAddresses ?? vi.fn(), acceptTermsAndConditions: mockedValue?.settings?.acceptTermsAndConditions ?? vi.fn(), setReceiveNotificationEmail: mockedValue?.settings?.setReceiveNotificationEmail ?? vi.fn(), getUserWalletEligibility: mockedValue?.settings?.getUserWalletEligibility ?? vi.fn(), }), network: freeable({ getNetwork: mockedValue?.network?.getNetwork ?? vi.fn(), free: vi.fn() }), wallet: freeable({ getWallets: mockedValue?.wallet?.getWallets ?? vi.fn(), createWallet: mockedValue?.wallet?.createWallet ?? vi.fn(), updateWalletName: mockedValue?.wallet?.updateWalletName ?? vi.fn(), deleteWallet: mockedValue?.wallet?.deleteWallet ?? vi.fn(), getWalletAccounts: mockedValue?.wallet?.getWalletAccounts ?? vi.fn(), createWalletAccount: mockedValue?.wallet?.createWalletAccount ?? vi.fn(), updateWalletAccountLabel: mockedValue?.wallet?.updateWalletAccountLabel ?? vi.fn(), updateWalletAccountFiatCurrency: mockedValue?.wallet?.updateWalletAccountFiatCurrency ?? vi.fn(), deleteWalletAccount: mockedValue?.wallet?.deleteWalletAccount ?? vi.fn(), getWalletTransactions: mockedValue?.wallet?.getWalletTransactions ?? vi.fn(), getWalletTransactionsToHash: mockedValue?.wallet?.getWalletTransactionsToHash ?? vi.fn(), createWalletTransaction: mockedValue?.wallet?.createWalletTransaction ?? vi.fn(), updateWalletTransactionLabel: mockedValue?.wallet?.updateWalletTransactionLabel ?? vi.fn(), updateWalletTransactionHashedTxId: mockedValue?.wallet?.updateWalletTransactionHashedTxId ?? vi.fn(), deleteWalletTransaction: mockedValue?.wallet?.deleteWalletTransaction ?? vi.fn(), addEmailAddress: mockedValue?.wallet?.addEmailAddress ?? vi.fn(), removeEmailAddress: mockedValue?.wallet?.removeEmailAddress ?? vi.fn(), setWalletTransactionFlag: mockedValue?.wallet?.setWalletTransactionFlag ?? vi.fn(), deleteWalletTransactionFlag: mockedValue?.wallet?.deleteWalletTransactionFlag ?? vi.fn(), updateExternalWalletTransactionSender: mockedValue?.wallet?.updateExternalWalletTransactionSender ?? vi.fn(), disableShowWalletRecovery: mockedValue?.wallet?.disableShowWalletRecovery ?? vi.fn(), updateWalletAccountsOrder: mockedValue?.wallet?.updateWalletAccountsOrder ?? vi.fn(), updateWalletAccountLastUsedIndex: mockedValue?.wallet?.updateWalletAccountLastUsedIndex ?? vi.fn(), getWalletAccountAddresses: mockedValue?.wallet?.getWalletAccountAddresses ?? vi.fn(), }), bitcoin_address: freeable({ getBitcoinAddresses: mockedValue?.bitcoin_address?.getBitcoinAddresses ?? vi.fn(), getBitcoinAddressHighestIndex: mockedValue?.bitcoin_address?.getBitcoinAddressHighestIndex ?? vi.fn(), addBitcoinAddress: mockedValue?.bitcoin_address?.addBitcoinAddress ?? vi.fn(), updateBitcoinAddress: mockedValue?.bitcoin_address?.updateBitcoinAddress ?? vi.fn(), }), payment_gateway: freeable({ getCountries: mockedValue?.payment_gateway?.getCountries ?? vi.fn(), getFiatCurrencies: mockedValue?.payment_gateway?.getFiatCurrencies ?? vi.fn(), getPaymentMethods: mockedValue?.payment_gateway?.getPaymentMethods ?? vi.fn(), getQuotes: mockedValue?.payment_gateway?.getQuotes ?? vi.fn(), createOnRampCheckout: mockedValue?.payment_gateway?.createOnRampCheckout ?? vi.fn(), signUrl: mockedValue?.payment_gateway?.signUrl ?? vi.fn(), getPublicApiKey: mockedValue?.payment_gateway?.getPublicApiKey ?? vi.fn(), getCheckoutIframeSrc: mockedValue?.payment_gateway?.getCheckoutIframeSrc ?? vi.fn(), }), invite: freeable({ checkInviteStatus: mockedValue?.invite?.checkInviteStatus ?? vi.fn(), sendNewcomerInvite: mockedValue?.invite?.sendNewcomerInvite ?? vi.fn(), sendEmailIntegrationInvite: mockedValue?.invite?.sendEmailIntegrationInvite ?? vi.fn(), getRemainingMonthlyInvitation: mockedValue?.invite?.getRemainingMonthlyInvitation ?? vi.fn(), }), price_graph: freeable({ getGraphData: mockedValue?.price_graph?.getGraphData ?? vi.fn(), }), }); return freeable({ clients: () => f, }); }; export const mockUseWalletApi = (mockedValue?: WasmProtonWalletApiClient) => { const spy = vi.spyOn(useWalletApiModule, 'useWalletApi'); spy.mockReturnValue(mockedValue ?? getMockedApi()); return spy; }; export const mockUseWalletApiClients = (mockedValue?: WasmProtonWalletApiClient) => { const spy = vi.spyOn(useWalletApiModule, 'useWalletApiClients'); spy.mockReturnValue((mockedValue ?? getMockedApi()).clients()); return spy; }; ```
/content/code_sandbox/packages/wallet/tests/mocks/useWalletApi.ts
xml
2016-06-08T11:16:51
2024-08-16T14:14:27
WebClients
ProtonMail/WebClients
4,300
1,527
```xml import * as React from 'react'; import { Chiclet, ChicletSize } from '@fluentui/react-experiments/lib/Chiclet'; import { IButtonProps, IconButton } from '@fluentui/react/lib/Button'; import { Icon, IIconProps } from '@fluentui/react/lib/Icon'; import { Text } from '@fluentui/react/lib/Text'; import { mergeStyles } from '@fluentui/react/lib/Styling'; const SAMPLE_URL = 'path_to_url const footerStyle = mergeStyles({ display: 'flex', }); const activitiesStyle = mergeStyles({ display: 'flex', alignItems: 'center', justifyContent: 'flex-end', width: 190, fontSize: 12, lineHeight: 1.83, letterSpacing: 'normal', }); const attachStyle = mergeStyles({ height: '24px', width: '16px', fontSize: '16px', marginTop: '6px', marginLeft: '6px', backgroundColor: 'white', color: '#0078d7', }); const sizeStyle = mergeStyles({ width: 34, alignSelf: 'center', lineHeight: 1.83, letterSpacing: 'normal', }); export const ChicletXsmallFooterExample: React.FunctionComponent<{}> = () => { const footerButtonProps: IButtonProps[] = [ { iconProps: { iconName: 'More' } }, { iconProps: { iconName: 'CloudUpload' } }, ]; const attachIconProp: IIconProps = { iconName: 'Attach' }; const footer = <FooterComponent buttonProps={footerButtonProps} attachProps={attachIconProp} />; return ( <Chiclet url={SAMPLE_URL} title="Quarterly Results.docx" image="path_to_url" itemType="docx" size={ChicletSize.xSmall} footer={footer} /> ); }; class FooterComponent extends React.Component<IFooterComponent, {}> { public render(): JSX.Element { const { buttonProps, attachProps } = this.props; return _renderFooter(buttonProps, attachProps); } } // eslint-disable-next-line deprecation/deprecation interface IFooterComponent extends React.Props<FooterComponent> { buttonProps: IButtonProps[]; attachProps: IIconProps; } function _renderFooter(buttonProps: IButtonProps[], attachProps: IIconProps): React.ReactElement<HTMLDivElement> { return ( <div className={footerStyle}> <Icon {...attachProps} className={attachStyle} /> <Text variant="small" className={sizeStyle}> {'4MB'} </Text> <div className={activitiesStyle}> {buttonProps && buttonProps.map((buttonProp: IButtonProps, index: number) => { return ( <div key={index}> <IconButton {...buttonProp} /> </div> ); })} </div> </div> ); } ```
/content/code_sandbox/packages/react-examples/src/react-experiments/Chiclet/Chiclet.Xsmall.Footer.Example.tsx
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
647
```xml import CONSTANT from "../../src/constants"; import Partial from "../../src/partial"; import { expect } from "chai"; const { DATA, OVERRIDE } = CONSTANT; // eslint-disable-next-line @typescript-eslint/no-var-requires const _ = require("lodash"); describe("partial", () => { it("should default partials to {}", () => { // eslint-disable-next-line @typescript-eslint/no-empty-function const fn = () => {}; const partial = new Partial("test", fn); expect(partial[DATA].config).to.deep.equal(fn); expect(partial[OVERRIDE]).to.deep.equal(_.identity); }); it("should handle config returned from function", () => { const partial = new Partial("test", { config: () => { return { test: 1 }; }, }); const config = partial.compose({}); expect(config.test).equal(1); }); it("should handle using webpackPartial from config returned from function", () => { const partial = new Partial("test", { config: () => { return { webpackPartial: { test: 1 } }; }, }); const config = partial.compose({}); expect(config.test).equal(1); }); it("should setOverride", () => { // eslint-disable-next-line @typescript-eslint/no-empty-function const fn = () => {}; const partial = new Partial("test", {}); expect(partial[OVERRIDE]).not.to.equals(fn); partial.setOverride(fn); expect(partial[OVERRIDE]).to.deep.equals(fn); partial.setOverride(null); expect(partial[OVERRIDE]).to.deep.equal(_.identity); }); }); ```
/content/code_sandbox/packages/webpack-config-composer/test/spec/partial.spec.ts
xml
2016-09-06T19:02:39
2024-08-11T11:43:11
electrode
electrode-io/electrode
2,103
355
```xml import '../iterablehelpers'; import { empty, isEmpty } from 'ix/iterable/index.js'; test('Iterable#isEmpty empty', () => { expect(isEmpty(empty())).toBeTruthy(); }); test('Iterable#isEmpty not-empty', () => { expect(isEmpty([1])).toBeFalsy(); }); ```
/content/code_sandbox/spec/iterable-operators/isempty-spec.ts
xml
2016-02-22T20:04:19
2024-08-09T18:46:41
IxJS
ReactiveX/IxJS
1,319
62
```xml import {Column, Entity, Index, ManyToOne, OneToMany, PrimaryGeneratedColumn, Unique,} from 'typeorm'; import {ParentDirectoryDTO, SubDirectoryDTO,} from '../../../../common/entities/DirectoryDTO'; import {MediaEntity} from './MediaEntity'; import {FileEntity} from './FileEntity'; import {columnCharsetCS} from './EntityUtils'; import {MediaDTO} from '../../../../common/entities/MediaDTO'; @Entity() @Unique(['name', 'path']) export class DirectoryEntity implements ParentDirectoryDTO<MediaDTO>, SubDirectoryDTO<MediaDTO> { @Index() @PrimaryGeneratedColumn({unsigned: true}) id: number; @Index() @Column(columnCharsetCS) name: string; @Index() @Column(columnCharsetCS) path: string; /** * last time the directory was modified (from outside, eg.: a new media was added) */ @Column('bigint', { unsigned: true, transformer: { from: (v) => parseInt(v, 10), to: (v) => v, }, }) public lastModified: number; /** * Last time the directory was fully scanned, not only for a few media to create a cover */ @Column({ type: 'bigint', nullable: true, unsigned: true, transformer: { from: (v) => parseInt(v, 10) || null, to: (v) => v, }, }) public lastScanned: number; isPartial?: boolean; @Column('mediumint', {unsigned: true}) mediaCount: number; @Column('bigint', { nullable: true, transformer: { from: (v) => parseInt(v, 10), to: (v) => v, }, }) oldestMedia: number; @Column('bigint', { nullable: true, transformer: { from: (v) => parseInt(v, 10), to: (v) => v, }, }) youngestMedia: number; @Index() @ManyToOne(() => DirectoryEntity, (directory) => directory.directories, { onDelete: 'CASCADE', }) public parent: DirectoryEntity; @OneToMany(() => DirectoryEntity, (dir) => dir.parent) public directories: DirectoryEntity[]; // not saving to database, it is only assigned when querying the DB @ManyToOne(() => MediaEntity, {onDelete: 'SET NULL'}) public cover: MediaEntity; // On galley change, cover will be invalid @Column({type: 'boolean', default: false}) validCover: boolean; @OneToMany(() => MediaEntity, (media) => media.directory) public media: MediaEntity[]; @OneToMany(() => FileEntity, (file) => file.directory) public metaFile: FileEntity[]; } ```
/content/code_sandbox/src/backend/model/database/enitites/DirectoryEntity.ts
xml
2016-03-12T11:46:41
2024-08-16T19:56:44
pigallery2
bpatrik/pigallery2
1,727
624
```xml import { CompletionTestSetup, testDSL } from '../../test-util/completion-test-util'; import { parseHTMLDocument } from '../parser/htmlParser'; import { doComplete } from '../services/htmlCompletion'; const setup: CompletionTestSetup = { langId: 'vue-html', docUri: 'test://test/test.html', doComplete(doc, pos) { const htmlDoc = parseHTMLDocument(doc); return doComplete(doc, pos, htmlDoc, [], {}); } }; const vueHtml = testDSL(setup); suite('Emmet Completion', () => { test('Emmet HTML Expansion', () => { vueHtml`ul>li*3|`.has(`ul>li*3`).become( `<ul> \t<li>\${1}</li> \t<li>\${2}</li> \t<li>\${0}</li> </ul>` ); vueHtml`{{ul>li*3|}}`.hasNo(`ul>li*3`); vueHtml`div+p|`.has(`div+p`).become( `<div>\${1}</div> <p>\${0}</p>` ); }); vueHtml`#header|`.has(`#header`).become(`<div id="header">\${0}</div>`); }); ```
/content/code_sandbox/server/src/modes/template/test/emmet.test.ts
xml
2016-10-29T23:20:43
2024-08-16T03:59:58
vetur
vuejs/vetur
5,739
273
```xml export * from './chart.component'; export * from './chart.module'; export * from './widget-utils'; ```
/content/code_sandbox/npm/ng-packs/packages/components/chart.js/src/public-api.ts
xml
2016-12-03T22:56:24
2024-08-16T16:24:05
abp
abpframework/abp
12,657
22
```xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "path_to_url"> <mapper namespace="org.ibase4j.mapper.SysEmailMapper"> <!-- --> <select id="selectIdPage" resultType="java.lang.Long" useCache="false"> select id_ from sys_email <where> <if test="cm.keyword != null and cm.keyword != ''"> and (email_content like CONCAT('%',#{cm.keyword},'%')) </if> </where> </select> </mapper> ```
/content/code_sandbox/iBase4J-SYS-Service/src/main/java/org/ibase4j/mapper/xml/SysEmailMapper.xml
xml
2016-08-15T06:48:34
2024-07-23T12:49:30
iBase4J
iBase4J/iBase4J
1,584
137
```xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="path_to_url" xmlns:xsi="path_to_url" xsi:schemaLocation="path_to_url path_to_url"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.didispace</groupId> <artifactId>compute-service</artifactId> <version>1.0-SNAPSHOT</version> </parent> <artifactId>compute-api</artifactId> <name>compute-api</name> <packaging>jar</packaging> </project> ```
/content/code_sandbox/1.x/Chapter9-2-2/compute-service/compute-api/pom.xml
xml
2016-08-21T03:39:06
2024-08-16T17:54:09
SpringBoot-Learning
dyc87112/SpringBoot-Learning
15,676
137