type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
|---|---|---|---|---|
ArrowFunction
|
() => {
let validators:
| ValidatorFn
| ValidatorFn[]
| Map<ControlId, ValidatorFn> = (a) => null;
a = createControlBase({ options: { validators } });
expect(a).toImplementObject({
validator: expect.any(Function),
validatorStore: new Map([[CONTROL_SELF_ID, validators]]),
});
testAllDefaultsExcept(a, 'validator', 'validatorStore');
validators = [() => null, () => ({ error: true })];
a = createControlBase({ options: { validators } });
expect(a).toImplementObject({
validator: expect.any(Function),
validatorStore: new Map([[CONTROL_SELF_ID, expect.any(Function)]]),
valid: false,
selfValid: false,
invalid: true,
selfInvalid: true,
errors: { error: true },
selfErrors: { error: true },
errorsStore: new Map([[CONTROL_SELF_ID, { error: true }]]),
status: 'INVALID',
});
testAllDefaultsExcept(
a,
'validator',
'validatorStore',
'valid',
'selfValid',
'invalid',
'selfInvalid',
'errors',
'selfErrors',
'errorsStore',
'status'
);
const fn1 = (() => null) as ValidatorFn;
const fn2 = (() => ({ error: true })) as ValidatorFn;
validators = new Map([
['one', fn1],
['two', fn2],
]);
a = createControlBase({ options: { validators } });
expect(a).toImplementObject({
validator: expect.any(Function),
validatorStore: new Map([
['one', fn1],
['two', fn2],
]),
valid: false,
selfValid: false,
invalid: true,
selfInvalid: true,
errors: { error: true },
selfErrors: { error: true },
errorsStore: new Map([[CONTROL_SELF_ID, { error: true }]]),
status: 'INVALID',
});
testAllDefaultsExcept(
a,
'validator',
'validatorStore',
'valid',
'selfValid',
'invalid',
'selfInvalid',
'errors',
'selfErrors',
'errorsStore',
'status'
);
a = createControlBase({ options: { validators: null } });
testAllDefaultsExcept(a);
}
|
jorroll/rx-controls
|
projects/rx-controls/src/lib/abstract-control/abstract-control-base-tests.ts
|
TypeScript
|
ArrowFunction
|
(a) => null
|
jorroll/rx-controls
|
projects/rx-controls/src/lib/abstract-control/abstract-control-base-tests.ts
|
TypeScript
|
ArrowFunction
|
() => ({ error: true })
|
jorroll/rx-controls
|
projects/rx-controls/src/lib/abstract-control/abstract-control-base-tests.ts
|
TypeScript
|
ArrowFunction
|
() => {
a = createControlBase({ options: { pending: true } });
expect(a).toImplementObject({
pending: true,
selfPending: true,
pendingStore: new Set([CONTROL_SELF_ID]),
status: 'PENDING',
});
testAllDefaultsExcept(
a,
'pending',
'selfPending',
'pendingStore',
'status'
);
a = createControlBase({ options: { pending: new Set(['one']) } });
expect(a).toImplementObject({
pending: true,
selfPending: true,
pendingStore: new Set(['one']),
status: 'PENDING',
});
testAllDefaultsExcept(
a,
'pending',
'selfPending',
'pendingStore',
'status'
);
a = createControlBase({ options: { pending: false } });
testAllDefaultsExcept(a);
}
|
jorroll/rx-controls
|
projects/rx-controls/src/lib/abstract-control/abstract-control-base-tests.ts
|
TypeScript
|
ArrowFunction
|
() => {
a = createControlBase();
}
|
jorroll/rx-controls
|
projects/rx-controls/src/lib/abstract-control/abstract-control-base-tests.ts
|
TypeScript
|
ArrowFunction
|
() => {
e = null;
}
|
jorroll/rx-controls
|
projects/rx-controls/src/lib/abstract-control/abstract-control-base-tests.ts
|
TypeScript
|
ArrowFunction
|
() => {
e = {
type: 'StateChange',
source: 'one',
meta: {},
debugPath: expect.any(String),
controlId: expect.any(Symbol),
changes: {
selfDisabled: true,
},
};
const result = a.processEvent(e);
expect(a).toImplementObject({
disabled: true,
selfDisabled: true,
enabled: false,
selfEnabled: false,
status: 'DISABLED',
});
testAllDefaultsExcept(
a,
'disabled',
'selfDisabled',
'enabled',
'selfEnabled',
'status'
);
expect(result.status).toEqual('PROCESSED');
expect(result.result).toEqual<IControlStateChangeEvent>({
type: 'StateChange',
source: 'one',
meta: {},
controlId: expect.any(Symbol),
debugPath: expect.any(String),
changes: {
disabled: true,
selfDisabled: true,
enabled: false,
selfEnabled: false,
status: 'DISABLED',
},
});
}
|
jorroll/rx-controls
|
projects/rx-controls/src/lib/abstract-control/abstract-control-base-tests.ts
|
TypeScript
|
ArrowFunction
|
() => {
e = {
type: 'StateChange',
source: 'one',
meta: {},
controlId: expect.any(Symbol),
debugPath: expect.any(String),
changes: { selfTouched: true },
};
const result = a.processEvent(e);
expect(a).toImplementObject({
touched: true,
selfTouched: true,
});
testAllDefaultsExcept(a, 'touched', 'selfTouched');
expect(result.status).toEqual('PROCESSED');
expect(result.result).toEqual<IControlStateChangeEvent>({
type: 'StateChange',
source: 'one',
meta: {},
controlId: expect.any(Symbol),
debugPath: expect.any(String),
changes: {
touched: true,
selfTouched: true,
},
});
}
|
jorroll/rx-controls
|
projects/rx-controls/src/lib/abstract-control/abstract-control-base-tests.ts
|
TypeScript
|
ArrowFunction
|
() => {
e = {
type: 'StateChange',
source: 'one',
meta: {},
controlId: expect.any(Symbol),
debugPath: expect.any(String),
changes: { selfDirty: true },
};
const result = a.processEvent(e);
expect(a).toImplementObject({
dirty: true,
selfDirty: true,
});
testAllDefaultsExcept(a, 'dirty', 'selfDirty');
expect(result.status).toEqual('PROCESSED');
expect(result.result).toEqual<IControlStateChangeEvent>({
type: 'StateChange',
source: 'one',
meta: {},
controlId: expect.any(Symbol),
debugPath: expect.any(String),
changes: {
dirty: true,
selfDirty: true,
},
});
}
|
jorroll/rx-controls
|
projects/rx-controls/src/lib/abstract-control/abstract-control-base-tests.ts
|
TypeScript
|
ArrowFunction
|
() => {
e = {
type: 'StateChange',
source: 'one',
meta: {},
controlId: expect.any(Symbol),
debugPath: expect.any(String),
changes: { selfReadonly: true },
};
const result = a.processEvent(e);
expect(a).toImplementObject({
readonly: true,
selfReadonly: true,
});
testAllDefaultsExcept(a, 'readonly', 'selfReadonly');
expect(result.status).toEqual('PROCESSED');
expect(result.result).toEqual<IControlStateChangeEvent>({
type: 'StateChange',
source: 'one',
meta: {},
controlId: expect.any(Symbol),
debugPath: expect.any(String),
changes: { readonly: true, selfReadonly: true },
});
}
|
jorroll/rx-controls
|
projects/rx-controls/src/lib/abstract-control/abstract-control-base-tests.ts
|
TypeScript
|
ArrowFunction
|
() => {
e = {
type: 'StateChange',
source: 'one',
meta: {},
controlId: expect.any(Symbol),
debugPath: expect.any(String),
changes: { selfSubmitted: true },
};
const result = a.processEvent(e);
expect(a).toImplementObject({
submitted: true,
selfSubmitted: true,
});
testAllDefaultsExcept(a, 'submitted', 'selfSubmitted');
expect(result.status).toEqual('PROCESSED');
expect(result.result).toEqual<IControlStateChangeEvent>({
type: 'StateChange',
source: 'one',
meta: {},
controlId: expect.any(Symbol),
debugPath: expect.any(String),
changes: { submitted: true, selfSubmitted: true },
});
}
|
jorroll/rx-controls
|
projects/rx-controls/src/lib/abstract-control/abstract-control-base-tests.ts
|
TypeScript
|
ArrowFunction
|
() => {
e = {
type: 'StateChange',
source: 'one',
meta: {},
controlId: expect.any(Symbol),
debugPath: expect.any(String),
changes: { data: { one: true } },
};
const result = a.processEvent(e);
expect(a).toImplementObject({
data: { one: true },
});
testAllDefaultsExcept(a, 'data');
expect(result.status).toEqual('PROCESSED');
expect(result.result).toEqual<IControlStateChangeEvent>({
type: 'StateChange',
source: 'one',
meta: {},
controlId: expect.any(Symbol),
debugPath: expect.any(String),
changes: { data: { one: true } },
});
}
|
jorroll/rx-controls
|
projects/rx-controls/src/lib/abstract-control/abstract-control-base-tests.ts
|
TypeScript
|
ArrowFunction
|
() => {
const validatorStore = new Map([['one', () => null]]);
e = {
type: 'StateChange',
source: 'one',
meta: {},
controlId: expect.any(Symbol),
debugPath: expect.any(String),
changes: { validatorStore },
};
const result = a.processEvent(e);
expect(a).toImplementObject({
validator: expect.any(Function),
validatorStore: new Map([['one', expect.any(Function)]]),
});
testAllDefaultsExcept(a, 'validator', 'validatorStore');
expect(result.status).toEqual('PROCESSED');
expect(result.result).toEqual<IControlStateChangeEvent>({
type: 'StateChange',
source: 'one',
meta: {},
controlId: expect.any(Symbol),
debugPath: expect.any(String),
changes: {
validatorStore: new Map([['one', expect.any(Function)]]),
validator: expect.any(Function),
},
});
}
|
jorroll/rx-controls
|
projects/rx-controls/src/lib/abstract-control/abstract-control-base-tests.ts
|
TypeScript
|
ArrowFunction
|
() => {
const pendingStore = new Set('one');
e = {
type: 'StateChange',
source: 'one',
meta: {},
controlId: expect.any(Symbol),
debugPath: expect.any(String),
changes: { pendingStore },
};
const result = a.processEvent(e);
expect(a).toImplementObject({
pending: true,
selfPending: true,
pendingStore,
status: 'PENDING',
});
testAllDefaultsExcept(
a,
'pending',
'selfPending',
'pendingStore',
'status'
);
expect(result.status).toEqual('PROCESSED');
expect(result.result).toEqual<IControlStateChangeEvent>({
type: 'StateChange',
source: 'one',
meta: {},
controlId: expect.any(Symbol),
debugPath: expect.any(String),
changes: {
pendingStore,
selfPending: true,
pending: true,
status: 'PENDING',
},
});
}
|
jorroll/rx-controls
|
projects/rx-controls/src/lib/abstract-control/abstract-control-base-tests.ts
|
TypeScript
|
ArrowFunction
|
() => {
const errors = { required: true };
const errorsStore = new Map([['one', errors]]);
e = {
type: 'StateChange',
source: 'one',
meta: {},
controlId: expect.any(Symbol),
debugPath: expect.any(String),
changes: { errorsStore },
};
const result = a.processEvent(e);
expect(a).toImplementObject({
errors,
selfErrors: errors,
errorsStore,
valid: false,
selfValid: false,
invalid: true,
selfInvalid: true,
status: 'INVALID',
});
testAllDefaultsExcept(
a,
'errors',
'selfErrors',
'errorsStore',
'status',
'valid',
'selfValid',
'invalid',
'selfInvalid'
);
expect(result.status).toEqual('PROCESSED');
expect(result.result).toEqual<IControlStateChangeEvent>({
type: 'StateChange',
source: 'one',
meta: {},
controlId: expect.any(Symbol),
debugPath: expect.any(String),
changes: {
errorsStore,
selfErrors: errors,
errors,
valid: false,
selfValid: false,
invalid: true,
selfInvalid: true,
status: 'INVALID',
},
});
}
|
jorroll/rx-controls
|
projects/rx-controls/src/lib/abstract-control/abstract-control-base-tests.ts
|
TypeScript
|
FunctionDeclaration
|
export function sync(
db: DexieCloudDB,
options: DexieCloudOptions,
schema: DexieCloudSchema,
syncOptions?: SyncOptions
): Promise<boolean> {
return _sync
.apply(this, arguments)
.then(() => {
if (!syncOptions?.justCheckIfNeeded) {
db.syncStateChangedEvent.next({
phase: 'in-sync',
});
}
})
.catch(async (error: any) => {
if (syncOptions?.justCheckIfNeeded) return Promise.reject(error); // Just rethrow.
console.debug('Error from _sync', {
isOnline,
syncOptions,
error,
});
if (
isOnline &&
syncOptions?.retryImmediatelyOnFetchError &&
error?.name === 'TypeError' &&
/fetch/.test(error?.message)
) {
db.syncStateChangedEvent.next({
phase: 'error',
error,
});
// Retry again in 500 ms but if it fails again, don't retry.
await new Promise((resolve) => setTimeout(resolve, 500));
return await sync(db, options, schema, {
...syncOptions,
retryImmediatelyOnFetchError: false,
});
}
// Make sure that no matter whether sync() explodes or not,
// always update the timestamp. Also store the error.
await db.$syncState.update('syncState', {
timestamp: new Date(),
error: '' + error,
});
db.syncStateChangedEvent.next({
phase: isOnline ? 'error' : 'offline',
error,
});
return Promise.reject(error);
});
}
|
lionsoft-pierre/Dexie.js
|
addons/dexie-cloud/src/sync/sync.ts
|
TypeScript
|
FunctionDeclaration
|
async function deleteObjectsFromRemovedRealms(
db: DexieCloudDB,
res: SyncResponse,
prevState: PersistedSyncState | undefined
) {
const deletedRealms: string[] = [];
const previousRealmSet = prevState
? prevState.realms.concat(prevState.inviteRealms)
: [];
const updatedRealmSet = new Set([...res.realms, ...res.inviteRealms]);
for (const realmId of previousRealmSet) {
if (!updatedRealmSet.has(realmId)) deletedRealms.push(realmId);
}
if (deletedRealms.length > 0) {
const deletedRealmSet = new Set(deletedRealms);
const tables = getSyncableTables(db);
for (const table of tables) {
if (
table.schema.indexes.some(
(idx) =>
idx.keyPath === 'realmId' ||
(Array.isArray(idx.keyPath) && idx.keyPath[0] === 'realmId')
)
) {
// There's an index to use:
await table.where('realmId').anyOf(deletedRealms).delete();
} else {
// No index to use:
await table
.filter((obj) => !!obj?.realmId && deletedRealmSet.has(obj.realmId))
.delete();
}
}
}
}
|
lionsoft-pierre/Dexie.js
|
addons/dexie-cloud/src/sync/sync.ts
|
TypeScript
|
FunctionDeclaration
|
export async function applyServerChanges(
changes: DBOperationsSet,
db: DexieCloudDB
) {
console.debug('Applying server changes', changes, Dexie.currentTransaction);
for (const { table: tableName, muts } of changes) {
const table = db.table(tableName);
if (!table) continue; // If server sends changes on a table we don't have, ignore it.
const { primaryKey } = table.core.schema;
for (const mut of muts) {
switch (mut.type) {
case 'insert':
if (primaryKey.outbound) {
await table.bulkAdd(mut.values, mut.keys);
} else {
mut.keys.forEach((key, i) => {
Dexie.setByKeyPath(mut.values[i], primaryKey.keyPath as any, key);
});
await table.bulkAdd(mut.values);
}
break;
case 'upsert':
if (primaryKey.outbound) {
await table.bulkPut(mut.values, mut.keys);
} else {
mut.keys.forEach((key, i) => {
Dexie.setByKeyPath(mut.values[i], primaryKey.keyPath as any, key);
});
await table.bulkPut(mut.values);
}
break;
case 'modify':
if (mut.keys.length === 1) {
await table.update(mut.keys[0], mut.changeSpec);
} else {
await table.where(':id').anyOf(mut.keys).modify(mut.changeSpec);
}
break;
case 'update':
await bulkUpdate(table, mut.keys, mut.changeSpecs);
break;
case 'delete':
await table.bulkDelete(mut.keys);
break;
}
}
}
}
|
lionsoft-pierre/Dexie.js
|
addons/dexie-cloud/src/sync/sync.ts
|
TypeScript
|
FunctionDeclaration
|
export function filterServerChangesThroughAddedClientChanges(
serverChanges: DBOperationsSet,
addedClientChanges: DBOperationsSet
): DBOperationsSet {
const changes: DBKeyMutationSet = {};
applyOperations(changes, serverChanges);
const localPostChanges: DBKeyMutationSet = {};
applyOperations(localPostChanges, addedClientChanges);
subtractChanges(changes, localPostChanges);
return toDBOperationSet(changes);
}
|
lionsoft-pierre/Dexie.js
|
addons/dexie-cloud/src/sync/sync.ts
|
TypeScript
|
ArrowFunction
|
() => {
if (!syncOptions?.justCheckIfNeeded) {
db.syncStateChangedEvent.next({
phase: 'in-sync',
});
}
}
|
lionsoft-pierre/Dexie.js
|
addons/dexie-cloud/src/sync/sync.ts
|
TypeScript
|
ArrowFunction
|
async (error: any) => {
if (syncOptions?.justCheckIfNeeded) return Promise.reject(error); // Just rethrow.
console.debug('Error from _sync', {
isOnline,
syncOptions,
error,
});
if (
isOnline &&
syncOptions?.retryImmediatelyOnFetchError &&
error?.name === 'TypeError' &&
/fetch/.test(error?.message)
) {
db.syncStateChangedEvent.next({
phase: 'error',
error,
});
// Retry again in 500 ms but if it fails again, don't retry.
await new Promise((resolve) => setTimeout(resolve, 500));
return await sync(db, options, schema, {
...syncOptions,
retryImmediatelyOnFetchError: false,
});
}
// Make sure that no matter whether sync() explodes or not,
// always update the timestamp. Also store the error.
await db.$syncState.update('syncState', {
timestamp: new Date(),
error: '' + error,
});
db.syncStateChangedEvent.next({
phase: isOnline ? 'error' : 'offline',
error,
});
return Promise.reject(error);
}
|
lionsoft-pierre/Dexie.js
|
addons/dexie-cloud/src/sync/sync.ts
|
TypeScript
|
ArrowFunction
|
(tbl) =>
db.table(getMutationTable(tbl.name))
|
lionsoft-pierre/Dexie.js
|
addons/dexie-cloud/src/sync/sync.ts
|
TypeScript
|
ArrowFunction
|
async (tx) => {
// @ts-ignore
tx.idbtrans.disableChangeTracking = true;
// @ts-ignore
tx.idbtrans.disableAccessControl = true; // TODO: Take care of this flag in access control middleware!
await modifyLocalObjectsWithNewUserId(
tablesToSyncify,
currentUser,
persistedSyncState?.realms
);
}
|
lionsoft-pierre/Dexie.js
|
addons/dexie-cloud/src/sync/sync.ts
|
TypeScript
|
ArrowFunction
|
async () => {
const syncState = await db.getPersistedSyncState();
const baseRevs = await db.$baseRevs.toArray();
let clientChanges = await listClientChanges(mutationTables, db);
throwIfCancelled(cancelToken);
if (doSyncify) {
const syncificationInserts = await listSyncifiedChanges(
tablesToSyncify,
currentUser,
schema!,
persistedSyncState?.realms
);
throwIfCancelled(cancelToken);
clientChanges = clientChanges.concat(syncificationInserts);
return [clientChanges, syncState, baseRevs];
}
return [clientChanges, syncState, baseRevs];
}
|
lionsoft-pierre/Dexie.js
|
addons/dexie-cloud/src/sync/sync.ts
|
TypeScript
|
ArrowFunction
|
(set) =>
set.muts.some((mut) => mut.keys.length > 0)
|
lionsoft-pierre/Dexie.js
|
addons/dexie-cloud/src/sync/sync.ts
|
TypeScript
|
ArrowFunction
|
(mut) => mut.keys.length > 0
|
lionsoft-pierre/Dexie.js
|
addons/dexie-cloud/src/sync/sync.ts
|
TypeScript
|
ArrowFunction
|
async (tx) => {
// @ts-ignore
tx.idbtrans.disableChangeTracking = true;
// @ts-ignore
tx.idbtrans.disableAccessControl = true; // TODO: Take care of this flag in access control middleware!
// Update db.cloud.schema from server response.
// Local schema MAY include a subset of tables, so do not force all tables into local schema.
for (const tableName of Object.keys(schema)) {
if (res.schema[tableName]) {
// Write directly into configured schema. This code can only be executed alone.
schema[tableName] = res.schema[tableName];
}
}
await db.$syncState.put(schema, 'schema');
// List mutations that happened during our exchange with the server:
const addedClientChanges = await listClientChanges(mutationTables, db, {
since: latestRevisions,
});
//
// Delete changes now as server has return success
// (but keep changes that haven't reached server yet)
//
for (const mutTable of mutationTables) {
const tableName = getTableFromMutationTable(mutTable.name);
if (
!addedClientChanges.some(
(ch) => ch.table === tableName && ch.muts.length > 0
)
) {
// No added mutations for this table during the time we sent changes
// to the server.
// It is therefore safe to clear all changes (which is faster than
// deleting a range)
await Promise.all([
mutTable.clear(),
db.$baseRevs.where({ tableName }).delete(),
]);
} else if (latestRevisions[mutTable.name]) {
const latestRev = latestRevisions[mutTable.name] || 0;
//await mutTable.where('rev').belowOrEqual(latestRev).reverse().offset(1).delete();
await Promise.all([
mutTable.where('rev').belowOrEqual(latestRev).delete(),
db.$baseRevs
.where(':id')
.between(
[tableName, -Infinity],
[tableName, latestRev + 1],
true,
true
)
.reverse()
.offset(1) // Keep one entry (the one mapping muts that came during fetch --> previous server revision)
.delete(),
]);
} else {
// In this case, the mutation table only contains added items after sending empty changeset to server.
// We should not clear out anything now.
}
}
// Update latestRevisions object according to additional changes:
getLatestRevisionsPerTable(addedClientChanges, latestRevisions);
// Update/add new entries into baseRevs map.
// * On tables without mutations since last serverRevision,
// this will update existing entry.
// * On tables where mutations have been recorded since last
// serverRevision, this will create a new entry.
// The purpose of this operation is to mark a start revision (per table)
// so that all client-mutations that come after this, will be mapped to current
// server revision.
await updateBaseRevs(db, schema, latestRevisions, res.serverRevision);
const syncState = await db.getPersistedSyncState();
//
// Delete objects from removed realms
//
await deleteObjectsFromRemovedRealms(db, res, syncState);
//
// Update syncState
//
const newSyncState: PersistedSyncState = syncState || {
syncedTables: [],
latestRevisions: {},
realms: [],
inviteRealms: [],
clientIdentity
};
newSyncState.syncedTables = tablesToSync
.map((tbl) => tbl.name)
.concat(tablesToSyncify.map((tbl) => tbl.name));
newSyncState.latestRevisions = latestRevisions;
newSyncState.remoteDbId = res.dbId;
newSyncState.initiallySynced = true;
newSyncState.realms = res.realms;
newSyncState.inviteRealms = res.inviteRealms;
newSyncState.serverRevision = res.serverRevision;
newSyncState.timestamp = new Date();
delete newSyncState.error;
const filteredChanges = filterServerChangesThroughAddedClientChanges(
res.changes,
addedClientChanges
);
//
// apply server changes
//
await applyServerChanges(filteredChanges, db);
//
// Update syncState
//
db.$syncState.put(newSyncState, 'syncState');
return addedClientChanges.length === 0;
}
|
lionsoft-pierre/Dexie.js
|
addons/dexie-cloud/src/sync/sync.ts
|
TypeScript
|
ArrowFunction
|
(ch) => ch.table === tableName && ch.muts.length > 0
|
lionsoft-pierre/Dexie.js
|
addons/dexie-cloud/src/sync/sync.ts
|
TypeScript
|
ArrowFunction
|
(tbl) => tbl.name
|
lionsoft-pierre/Dexie.js
|
addons/dexie-cloud/src/sync/sync.ts
|
TypeScript
|
ArrowFunction
|
(idx) =>
idx.keyPath === 'realmId' ||
(Array.isArray(idx.keyPath) && idx.keyPath[0] === 'realmId')
|
lionsoft-pierre/Dexie.js
|
addons/dexie-cloud/src/sync/sync.ts
|
TypeScript
|
ArrowFunction
|
(obj) => !!obj?.realmId && deletedRealmSet.has(obj.realmId)
|
lionsoft-pierre/Dexie.js
|
addons/dexie-cloud/src/sync/sync.ts
|
TypeScript
|
ArrowFunction
|
(key, i) => {
Dexie.setByKeyPath(mut.values[i], primaryKey.keyPath as any, key);
}
|
lionsoft-pierre/Dexie.js
|
addons/dexie-cloud/src/sync/sync.ts
|
TypeScript
|
InterfaceDeclaration
|
/*
TODO:
1. V: Rätta flödet och gör det persistent mellan transaktioner
2. Sync-requestet ska autenticera sig med nuvarande användare.
MEN:
Vissa medskickade operationer kan vara gjorda av annan användare.
Därför: Om några av client-changes är andra användare, så måste de användarnas
tokens följa med som extra parameter till fetch-requestet.
Servern skall då validera och genomföra dessa operationer baserat på alternativt token.
Kanske kan vi skita i det flödet just nu och hindra att det uppstår istället.
Hur? Jo, genom:
1. Användare är ANONYMOUS
2. Data laddas ned.
3. Data modifieras.
4. Användare loggar in.
5. Sync: Några inledande requests är ANONYMOUS men autenticeras som användaren.
X: Se till att vi förhandlar initialt sync state eller uppdaterat sync state (tabell aliases etc)
Y: Använd Bison hjälpare för streamad BISON?
*/
export interface SyncOptions {
isInitialSync?: boolean;
cancelToken?: { cancelled: boolean };
justCheckIfNeeded?: boolean;
retryImmediatelyOnFetchError?: boolean;
purpose?: 'pull' | 'push';
}
|
lionsoft-pierre/Dexie.js
|
addons/dexie-cloud/src/sync/sync.ts
|
TypeScript
|
ClassDeclaration
|
@Route('GetTest')
export class DuplicatePathParamTestController {
@Get('{id}') public getPathParamTest(@Path() id: string) {
return id;
}
@Get('{identifier}') public getPathParamTest2(@Path() identifier: string) {
return identifier;
}
@Post('{id}') public postPathParamTest(@Path() id: string) {
return id;
}
@Post('{identifier}') public postPathParamTest2(@Path() identifier: string) {
return identifier;
}
@Post(':anotherIdentifier') public postPathParamTest3(@Path() anotherIdentifier: string) {
return anotherIdentifier;
}
@Post('{identifier}-{identifier2}') public postPathParamTest4(@Path() identifier: string) {
return identifier;
}
@Post('test-{identifier}') public postPathParamPrefixTest1(@Path() identifier: string) {
return identifier;
}
@Post('anothertest-{identifier}') public postPathParamPrefixTest2(@Path() identifier: string) {
return identifier;
}
@Delete('Delete/{id}') public deletePathParamTest(@Path() id: string) {
return id;
}
// This method should not report a warning cause its prefix route is different.
@Delete('Delete2/{id}') public deletePathParamTest2(@Path() id: string) {
return id;
}
@Delete('Delete/:identifier') public deletePathParamTest3(@Path() identifier: string) {
return identifier;
}
// These two Head method should not raise a warning
@Head('Head/{id}') public headPathParamTest(@Path() id) {
return id;
}
@Head('Head/{id}/{id2}') public headPathParamTest2(@Path() id, @Path() id2) {
return { id, id2 };
}
// These two Head method should raise a warning,
// because in this order "id" could be "something-like-this" and would match
@Head('Head-PartialCollision/{id}') public headPartialCollisionPathParamTest(@Path() id) {
return id;
}
@Head('Head-PartialCollision/{id}-{id2}') public headPartialCollisionPathParamTest2(@Path() id, @Path() id2) {
return { id, id2 };
}
// These two Head method should not raise a warning,
// as the order is fine
@Head('Head-NoPartialCollision/{id}-{id2}') public headNoPartialCollisionPathParamTest2(@Path() id, @Path() id2) {
return { id, id2 };
}
@Head('Head-NoPartialCollision/{id}') public headNoPartialCollisionPathParamTest(@Path() id) {
return id;
}
}
|
InsOpDe/tsoa
|
tests/fixtures/controllers/duplicatePathParamController.ts
|
TypeScript
|
MethodDeclaration
|
@Get('{id}') public getPathParamTest(@Path() id: string) {
return id;
}
|
InsOpDe/tsoa
|
tests/fixtures/controllers/duplicatePathParamController.ts
|
TypeScript
|
MethodDeclaration
|
@Get('{identifier}') public getPathParamTest2(@Path() identifier: string) {
return identifier;
}
|
InsOpDe/tsoa
|
tests/fixtures/controllers/duplicatePathParamController.ts
|
TypeScript
|
MethodDeclaration
|
@Post('{id}') public postPathParamTest(@Path() id: string) {
return id;
}
|
InsOpDe/tsoa
|
tests/fixtures/controllers/duplicatePathParamController.ts
|
TypeScript
|
MethodDeclaration
|
@Post('{identifier}') public postPathParamTest2(@Path() identifier: string) {
return identifier;
}
|
InsOpDe/tsoa
|
tests/fixtures/controllers/duplicatePathParamController.ts
|
TypeScript
|
MethodDeclaration
|
@Post(':anotherIdentifier') public postPathParamTest3(@Path() anotherIdentifier: string) {
return anotherIdentifier;
}
|
InsOpDe/tsoa
|
tests/fixtures/controllers/duplicatePathParamController.ts
|
TypeScript
|
MethodDeclaration
|
@Post('{identifier}-{identifier2}') public postPathParamTest4(@Path() identifier: string) {
return identifier;
}
|
InsOpDe/tsoa
|
tests/fixtures/controllers/duplicatePathParamController.ts
|
TypeScript
|
MethodDeclaration
|
@Post('test-{identifier}') public postPathParamPrefixTest1(@Path() identifier: string) {
return identifier;
}
|
InsOpDe/tsoa
|
tests/fixtures/controllers/duplicatePathParamController.ts
|
TypeScript
|
MethodDeclaration
|
@Post('anothertest-{identifier}') public postPathParamPrefixTest2(@Path() identifier: string) {
return identifier;
}
|
InsOpDe/tsoa
|
tests/fixtures/controllers/duplicatePathParamController.ts
|
TypeScript
|
MethodDeclaration
|
@Delete('Delete/{id}') public deletePathParamTest(@Path() id: string) {
return id;
}
|
InsOpDe/tsoa
|
tests/fixtures/controllers/duplicatePathParamController.ts
|
TypeScript
|
MethodDeclaration
|
// This method should not report a warning cause its prefix route is different.
@Delete('Delete2/{id}') public deletePathParamTest2(@Path() id: string) {
return id;
}
|
InsOpDe/tsoa
|
tests/fixtures/controllers/duplicatePathParamController.ts
|
TypeScript
|
MethodDeclaration
|
@Delete('Delete/:identifier') public deletePathParamTest3(@Path() identifier: string) {
return identifier;
}
|
InsOpDe/tsoa
|
tests/fixtures/controllers/duplicatePathParamController.ts
|
TypeScript
|
MethodDeclaration
|
// These two Head method should not raise a warning
@Head('Head/{id}') public headPathParamTest(@Path() id) {
return id;
}
|
InsOpDe/tsoa
|
tests/fixtures/controllers/duplicatePathParamController.ts
|
TypeScript
|
MethodDeclaration
|
@Head('Head/{id}/{id2}') public headPathParamTest2(@Path() id, @Path() id2) {
return { id, id2 };
}
|
InsOpDe/tsoa
|
tests/fixtures/controllers/duplicatePathParamController.ts
|
TypeScript
|
MethodDeclaration
|
// These two Head method should raise a warning,
// because in this order "id" could be "something-like-this" and would match
@Head('Head-PartialCollision/{id}') public headPartialCollisionPathParamTest(@Path() id) {
return id;
}
|
InsOpDe/tsoa
|
tests/fixtures/controllers/duplicatePathParamController.ts
|
TypeScript
|
MethodDeclaration
|
@Head('Head-PartialCollision/{id}-{id2}') public headPartialCollisionPathParamTest2(@Path() id, @Path() id2) {
return { id, id2 };
}
|
InsOpDe/tsoa
|
tests/fixtures/controllers/duplicatePathParamController.ts
|
TypeScript
|
MethodDeclaration
|
// These two Head method should not raise a warning,
// as the order is fine
@Head('Head-NoPartialCollision/{id}-{id2}') public headNoPartialCollisionPathParamTest2(@Path() id, @Path() id2) {
return { id, id2 };
}
|
InsOpDe/tsoa
|
tests/fixtures/controllers/duplicatePathParamController.ts
|
TypeScript
|
MethodDeclaration
|
@Head('Head-NoPartialCollision/{id}') public headNoPartialCollisionPathParamTest(@Path() id) {
return id;
}
|
InsOpDe/tsoa
|
tests/fixtures/controllers/duplicatePathParamController.ts
|
TypeScript
|
FunctionDeclaration
|
/**
* @description Initialize the TaskStatisticsList
* PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
*
* @param version - Version of the resource
* @param assistantSid - The unique ID of the Assistant.
* @param taskSid - The unique ID of the Task associated with this Field.
*/
declare function TaskStatisticsList(version: V1, assistantSid: string, taskSid: string): TaskStatisticsListInstance;
|
ErikLatimer/1-800-Ask-What
|
node_modules/twilio/lib/rest/autopilot/v1/assistant/task/taskStatistics.d.ts
|
TypeScript
|
ClassDeclaration
|
declare class TaskStatisticsContext {
/**
* Initialize the TaskStatisticsContextPLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
*
* @param version - Version of the resource
* @param assistantSid - The unique ID of the Assistant.
* @param taskSid - The unique ID of the Task associated with this Field.
*/
constructor(version: V1, assistantSid: string, taskSid: string);
/**
* fetch a TaskStatisticsInstance
*
* @param callback - Callback to handle processed record
*/
fetch(callback?: (error: Error | null, items: TaskStatisticsInstance) => any): Promise<TaskStatisticsInstance>;
}
|
ErikLatimer/1-800-Ask-What
|
node_modules/twilio/lib/rest/autopilot/v1/assistant/task/taskStatistics.d.ts
|
TypeScript
|
ClassDeclaration
|
declare class TaskStatisticsInstance extends SerializableClass {
/**
* Initialize the TaskStatisticsContextPLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
*
* @property accountSid - The unique ID of the Account that created this resource.
* @property assistantSid - The unique ID of the Assistant.
* @property taskSid - The unique ID of the Task associated with this Field.
* @property samplesCount - The total number of Samples associated with this Task.
* @property fieldsCount - The total number of Fields associated with this Task.
* @property url - The url
*
* @param version - Version of the resource
* @param payload - The instance payload
* @param assistantSid - The unique ID of the Assistant.
* @param taskSid - The unique ID of the Task associated with this Field.
*/
constructor(version: V1, payload: TaskStatisticsPayload, assistantSid: string, taskSid: string);
private _proxy: TaskStatisticsContext;
accountSid: string;
assistantSid: string;
/**
* fetch a TaskStatisticsInstance
*
* @param callback - Callback to handle processed record
*/
fetch(callback?: (error: Error | null, items: TaskStatisticsInstance) => any): void;
fieldsCount: number;
samplesCount: number;
taskSid: string;
/**
* Produce a plain JSON object version of the TaskStatisticsInstance for serialization.
* Removes any circular references in the object.
*/
toJSON(): any;
url: string;
}
|
ErikLatimer/1-800-Ask-What
|
node_modules/twilio/lib/rest/autopilot/v1/assistant/task/taskStatistics.d.ts
|
TypeScript
|
ClassDeclaration
|
declare class TaskStatisticsPage extends Page<V1, TaskStatisticsPayload, TaskStatisticsResource, TaskStatisticsInstance> {
/**
* Initialize the TaskStatisticsPagePLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: TaskStatisticsSolution);
/**
* Build an instance of TaskStatisticsInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: TaskStatisticsPayload): TaskStatisticsInstance;
}
|
ErikLatimer/1-800-Ask-What
|
node_modules/twilio/lib/rest/autopilot/v1/assistant/task/taskStatistics.d.ts
|
TypeScript
|
InterfaceDeclaration
|
interface TaskStatisticsListInstance {
/**
* @param sid - sid of instance
*/
(sid: string): TaskStatisticsContext;
/**
* Constructs a task_statistics
*/
get(): TaskStatisticsContext;
}
|
ErikLatimer/1-800-Ask-What
|
node_modules/twilio/lib/rest/autopilot/v1/assistant/task/taskStatistics.d.ts
|
TypeScript
|
InterfaceDeclaration
|
interface TaskStatisticsPayload extends TaskStatisticsResource, Page.TwilioResponsePayload {
}
|
ErikLatimer/1-800-Ask-What
|
node_modules/twilio/lib/rest/autopilot/v1/assistant/task/taskStatistics.d.ts
|
TypeScript
|
InterfaceDeclaration
|
interface TaskStatisticsResource {
account_sid: string;
assistant_sid: string;
fields_count: number;
samples_count: number;
task_sid: string;
url: string;
}
|
ErikLatimer/1-800-Ask-What
|
node_modules/twilio/lib/rest/autopilot/v1/assistant/task/taskStatistics.d.ts
|
TypeScript
|
InterfaceDeclaration
|
interface TaskStatisticsSolution {
assistantSid?: string;
taskSid?: string;
}
|
ErikLatimer/1-800-Ask-What
|
node_modules/twilio/lib/rest/autopilot/v1/assistant/task/taskStatistics.d.ts
|
TypeScript
|
MethodDeclaration
|
/**
* fetch a TaskStatisticsInstance
*
* @param callback - Callback to handle processed record
*/
fetch(callback?: (error: Error | null, items: TaskStatisticsInstance) => any): Promise<TaskStatisticsInstance>;
|
ErikLatimer/1-800-Ask-What
|
node_modules/twilio/lib/rest/autopilot/v1/assistant/task/taskStatistics.d.ts
|
TypeScript
|
MethodDeclaration
|
/**
* fetch a TaskStatisticsInstance
*
* @param callback - Callback to handle processed record
*/
fetch(callback?: (error: Error | null, items: TaskStatisticsInstance) => any): void;
|
ErikLatimer/1-800-Ask-What
|
node_modules/twilio/lib/rest/autopilot/v1/assistant/task/taskStatistics.d.ts
|
TypeScript
|
MethodDeclaration
|
/**
* Produce a plain JSON object version of the TaskStatisticsInstance for serialization.
* Removes any circular references in the object.
*/
toJSON(): any;
|
ErikLatimer/1-800-Ask-What
|
node_modules/twilio/lib/rest/autopilot/v1/assistant/task/taskStatistics.d.ts
|
TypeScript
|
MethodDeclaration
|
/**
* Build an instance of TaskStatisticsInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: TaskStatisticsPayload): TaskStatisticsInstance;
|
ErikLatimer/1-800-Ask-What
|
node_modules/twilio/lib/rest/autopilot/v1/assistant/task/taskStatistics.d.ts
|
TypeScript
|
ClassDeclaration
|
@Component({
selector: "contacts-detail-form",
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<div class="contact-form">
<div class="contact-form-row" [formGroup]="contactForm">
<md-input-container>
<input mdInput placeholder="Salutation" formControlName="salutation">
</md-input-container>
<md-input-container>
<input mdInput placeholder="Preferred Name" formControlName="preferredName">
</md-input-container>
<md-input-container>
<input mdInput placeholder="Date of Birth" type="date" formControlName="dateOfBirth">
</md-input-container>
</div>
<div class="contact-form-row" [formGroup]="contactForm">
<md-input-container>
<input mdInput placeholder="First Name" formControlName="firstName">
</md-input-container>
<md-input-container>
<input mdInput placeholder="Middle Name" formControlName="middleName">
</md-input-container>
<md-input-container>
<input mdInput placeholder="Last Name" formControlName="lastName">
</md-input-container>
</div>
<div class="contact-form-row" [formGroup]="contactForm">
<md-input-container>
<input mdInput placeholder="Nationality" formControlName="nationality">
</md-input-container>
<md-input-container>
<input mdInput placeholder="Primary Email" formControlName="primaryEmail">
</md-input-container>
<md-input-container>
<input mdInput placeholder="Secondary Email" formControlName="secondaryEmail">
</md-input-container>
</div>
<div class="contact-form-row" [formGroup]="contactForm">
<md-input-container>
<input mdInput placeholder="Mobile Phone" formControlName="mobilePhone">
</md-input-container>
<md-input-container>
<input mdInput placeholder="Home Phone" formControlName="homePhone">
</md-input-container>
<md-input-container>
<input mdInput placeholder="Work Phone" formControlName="workPhone">
</md-input-container>
</div>
</div>
`
})
export class ContactsDetailFormComponent {
@Input() contactForm: FormGroup;
@Output() remove = new EventEmitter();
constructor( private router: Router ) {
}
onRemove(): void {
this.router.navigate(['/contacts', {outlets: {'m': ['list'], 'd': ['add']}}]);
this.remove.emit(null);
}
}
|
jonoforbes/ether-app
|
src/contacts/components/detail-form/detail-form.component.ts
|
TypeScript
|
MethodDeclaration
|
onRemove(): void {
this.router.navigate(['/contacts', {outlets: {'m': ['list'], 'd': ['add']}}]);
this.remove.emit(null);
}
|
jonoforbes/ether-app
|
src/contacts/components/detail-form/detail-form.component.ts
|
TypeScript
|
ClassDeclaration
|
@Entity()
export class TranscriptionPair {
@PrimaryColumn('varchar', { length: 20 })
voiceId: DiscordId;
@Column('varchar', { length: 20 })
textId: DiscordId;
@Column('varchar', { length: 20 })
guildId: DiscordId;
}
|
Yey007/TranscriberBot
|
src/entity/transcriptionpair.ts
|
TypeScript
|
ClassDeclaration
|
export class Events {
event_name: string;
event_date_time: Date;
event_link: string;
teacher_id: number;
event_school: number;
event_class: number;
event_standard: number;
}
|
aditimewada/ziksuka
|
src/app/pages/studentCalender/models/events.ts
|
TypeScript
|
ArrowFunction
|
(model: ModelDefinition, twin: Twin | ModuleTwin, componentName: string): TwinWithSchema[] => {
if (!model) {
return [];
}
const jsonSchemaAdaptor = new JsonSchemaAdaptor(model);
const writablePropertyModelDefinitions = jsonSchemaAdaptor.getWritableProperties();
const settings = writablePropertyModelDefinitions
.map(writablePropertyModelDefinition => {
return {
desiredValue: getDesiredPropertiesForSpecficComponent(twin, componentName)?.[writablePropertyModelDefinition.name],
reportedSection: getReportedPropertiesForSpecficComponent(twin, componentName)?.[writablePropertyModelDefinition.name],
settingModelDefinition: writablePropertyModelDefinition,
settingSchema: jsonSchemaAdaptor.parseInterfacePropertyToJsonSchema(writablePropertyModelDefinition)
};
});
return settings;
}
|
Azure/azure-iot-explorer
|
src/app/devices/pnp/components/deviceSettings/dataHelper.ts
|
TypeScript
|
ArrowFunction
|
writablePropertyModelDefinition => {
return {
desiredValue: getDesiredPropertiesForSpecficComponent(twin, componentName)?.[writablePropertyModelDefinition.name],
reportedSection: getReportedPropertiesForSpecficComponent(twin, componentName)?.[writablePropertyModelDefinition.name],
settingModelDefinition: writablePropertyModelDefinition,
settingSchema: jsonSchemaAdaptor.parseInterfacePropertyToJsonSchema(writablePropertyModelDefinition)
};
}
|
Azure/azure-iot-explorer
|
src/app/devices/pnp/components/deviceSettings/dataHelper.ts
|
TypeScript
|
ArrowFunction
|
(twin: Twin | ModuleTwin, componentName: string) => {
const reportedTwin = twin?.properties?.reported;
return componentName === DEFAULT_COMPONENT_FOR_DIGITAL_TWIN ?
reportedTwin : (reportedTwin as any)?.[componentName]; // tslint:disable-line: no-any
}
|
Azure/azure-iot-explorer
|
src/app/devices/pnp/components/deviceSettings/dataHelper.ts
|
TypeScript
|
ArrowFunction
|
(twin: Twin | ModuleTwin, componentName: string) => {
const desiredTwin = twin?.properties?.desired;
return componentName === DEFAULT_COMPONENT_FOR_DIGITAL_TWIN ?
desiredTwin : (desiredTwin as any)?.[componentName]; // tslint:disable-line: no-any
}
|
Azure/azure-iot-explorer
|
src/app/devices/pnp/components/deviceSettings/dataHelper.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface ReportedSection {
value?: boolean | string | number | object;
ac?: number;
ad?: string;
av?: number;
}
|
Azure/azure-iot-explorer
|
src/app/devices/pnp/components/deviceSettings/dataHelper.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface TwinWithSchema {
settingModelDefinition: PropertyContent;
settingSchema: ParsedJsonSchema;
desiredValue?: boolean | string | number | object;
reportedSection?: ReportedSection;
}
|
Azure/azure-iot-explorer
|
src/app/devices/pnp/components/deviceSettings/dataHelper.ts
|
TypeScript
|
TypeAliasDeclaration
|
// SPDX-FileCopyrightText: 2022 Dusan Mijatovic (dv4all)
// SPDX-FileCopyrightText: 2022 dv4all
//
// SPDX-License-Identifier: Apache-2.0
// based on ENUMS defined in 012-inter-relation-tables.sql
export type Status = 'requested_by_origin' | 'requested_by_relation' | 'approved'
|
hifis-net/RSD-as-a-service
|
frontend/types/Organisation.ts
|
TypeScript
|
TypeAliasDeclaration
|
export type OrganisationRole = 'participating' | 'funding' | 'hosting'
|
hifis-net/RSD-as-a-service
|
frontend/types/Organisation.ts
|
TypeScript
|
TypeAliasDeclaration
|
export type OrganisationSource = 'RSD' | 'ROR' | 'MANUAL'
|
hifis-net/RSD-as-a-service
|
frontend/types/Organisation.ts
|
TypeScript
|
TypeAliasDeclaration
|
// shared organisation properies
export type CoreOrganisationProps = {
id: string | null
slug: string | null
parent: string | null
primary_maintainer?: string | null
name: string
ror_id: string | null
website: string | null
is_tenant: boolean,
}
|
hifis-net/RSD-as-a-service
|
frontend/types/Organisation.ts
|
TypeScript
|
TypeAliasDeclaration
|
// object for organisation
// from organisation table
export type Organisation = CoreOrganisationProps & {
id: string
// postgrest way of returning logo j
logo_for_organisation?: [
{
'id': string
}
]
}
|
hifis-net/RSD-as-a-service
|
frontend/types/Organisation.ts
|
TypeScript
|
TypeAliasDeclaration
|
// adding source
export type SearchOrganisation = CoreOrganisationProps & {
source: OrganisationSource
}
|
hifis-net/RSD-as-a-service
|
frontend/types/Organisation.ts
|
TypeScript
|
TypeAliasDeclaration
|
// extending with other props for software edit page
export type EditOrganisation = CoreOrganisationProps & {
position?: number
// indicates image already present
logo_id: string | null
// new image to upload
logo_b64: string | null
logo_mime_type: string | null
source?: OrganisationSource
status?: Status
// only maintainers can edit values
canEdit?: boolean
}
|
hifis-net/RSD-as-a-service
|
frontend/types/Organisation.ts
|
TypeScript
|
TypeAliasDeclaration
|
// object for software_for_organisation
export type SoftwareForOrganisation = {
software: string,
organisation: string,
status: Status
}
|
hifis-net/RSD-as-a-service
|
frontend/types/Organisation.ts
|
TypeScript
|
TypeAliasDeclaration
|
// object returned from api
// based on view organisations_for_software
export type OrganisationsForSoftware={
id: string
parent: string | null
slug: string | null
primary_maintainer: string
name: string
ror_id: string
is_tenant: boolean
website: string | null
logo_id: string | null
status: Status
software: string
}
|
hifis-net/RSD-as-a-service
|
frontend/types/Organisation.ts
|
TypeScript
|
TypeAliasDeclaration
|
export type ParticipatingOrganisationProps = {
name: string
website: string | null
logo_url: string | null
slug?: string
}
|
hifis-net/RSD-as-a-service
|
frontend/types/Organisation.ts
|
TypeScript
|
TypeAliasDeclaration
|
export type ProjectOrganisationProps = ParticipatingOrganisationProps & {
role: OrganisationRole
}
|
hifis-net/RSD-as-a-service
|
frontend/types/Organisation.ts
|
TypeScript
|
TypeAliasDeclaration
|
export type OrganisationForOverview = CoreOrganisationProps & {
id: string
logo_id: string | null
software_cnt: number | null
project_cnt: number | null
children_cnt: number | null
}
|
hifis-net/RSD-as-a-service
|
frontend/types/Organisation.ts
|
TypeScript
|
TypeAliasDeclaration
|
export type SoftwareOfOrganisation = {
id: string
slug: string
brand_name: string
short_statement: string
is_published: boolean
is_featured: boolean
contributor_cnt: number | null
mention_cnt: number | null
updated_at: string
organisation: string
}
|
hifis-net/RSD-as-a-service
|
frontend/types/Organisation.ts
|
TypeScript
|
TypeAliasDeclaration
|
export type ProjectOfOrganisation = {
id: string
slug: string
title: string
subtitle: string
date_start: string
date_end: string
updated_at: string
is_published: boolean
image_id: string | null
organisation: string
status: Status
}
|
hifis-net/RSD-as-a-service
|
frontend/types/Organisation.ts
|
TypeScript
|
ArrowFunction
|
(res) => {
if (res !== Constants.confirmClosed) {
this.loggingService.logger('User have set a proxy url: the app must be restarted to update the configuration.', LoggerLevel.info, this);
this.appService.restart();
}
}
|
dnsmichi/leapp
|
src/app/components/shared/profile-page/profile-page.component.ts
|
TypeScript
|
ArrowFunction
|
_ => {}
|
dnsmichi/leapp
|
src/app/components/shared/profile-page/profile-page.component.ts
|
TypeScript
|
ArrowFunction
|
u => u.id === id
|
dnsmichi/leapp
|
src/app/components/shared/profile-page/profile-page.component.ts
|
TypeScript
|
ArrowFunction
|
s => (s as AwsIamRoleFederatedSession).idpUrlId === id
|
dnsmichi/leapp
|
src/app/components/shared/profile-page/profile-page.component.ts
|
TypeScript
|
ArrowFunction
|
parent => {
const childs = this.sessionService.listIamRoleChained(parent);
sessions = sessions.concat(childs);
}
|
dnsmichi/leapp
|
src/app/components/shared/profile-page/profile-page.component.ts
|
TypeScript
|
ArrowFunction
|
s => `<li><div class="removed-sessions"><b>${s.sessionName}</b> - <small>${(s as AwsIamRoleFederatedSession).roleArn.split('/')[1]}</small></div></li>`
|
dnsmichi/leapp
|
src/app/components/shared/profile-page/profile-page.component.ts
|
TypeScript
|
ArrowFunction
|
(res) => {
if (res !== Constants.confirmClosed) {
this.loggingService.logger(`Removing idp url with id: ${id}`, LoggerLevel.info, this);
this.workspaceService.removeIdpUrl(id);
sessions.forEach(session => {
this.sessionService.delete(session.sessionId);
});
this.workspace = this.workspaceService.getWorkspace();
}
}
|
dnsmichi/leapp
|
src/app/components/shared/profile-page/profile-page.component.ts
|
TypeScript
|
ArrowFunction
|
session => {
this.sessionService.delete(session.sessionId);
}
|
dnsmichi/leapp
|
src/app/components/shared/profile-page/profile-page.component.ts
|
TypeScript
|
ArrowFunction
|
p => p.id === id.toString()
|
dnsmichi/leapp
|
src/app/components/shared/profile-page/profile-page.component.ts
|
TypeScript
|
ArrowFunction
|
sess => (sess as any).profileId === id
|
dnsmichi/leapp
|
src/app/components/shared/profile-page/profile-page.component.ts
|
TypeScript
|
ArrowFunction
|
s => `<li><div class="removed-sessions"><b>${s.sessionName}</b> - <small>${(s as AwsIamRoleFederatedSession).roleArn ? (s as AwsIamRoleFederatedSession).roleArn.split('/')[1] : ''}</small></div></li>`
|
dnsmichi/leapp
|
src/app/components/shared/profile-page/profile-page.component.ts
|
TypeScript
|
ArrowFunction
|
async (res) => {
if (res !== Constants.confirmClosed) {
this.loggingService.logger(`Reverting to default profile with id: ${id}`, LoggerLevel.info, this);
this.workspaceService.removeProfile(id);
// Reverting all sessions to default profile
for(let i = 0; i < sessions.length; i++) {
const sess = sessions[i];
this.sessionService = this.sessionProviderService.getService(sess.type);
let wasActive = false;
if ((sess as any).status === SessionStatus.active) {
wasActive = true;
await this.sessionService.stop(sess.sessionId);
}
(sess as any).profileId = this.workspaceService.getDefaultProfileId();
this.sessionService.update(sess.sessionId, sess);
if(wasActive) {
this.sessionService.start(sess.sessionId);
}
}
this.workspace = this.workspaceService.getWorkspace();
}
}
|
dnsmichi/leapp
|
src/app/components/shared/profile-page/profile-page.component.ts
|
TypeScript
|
MethodDeclaration
|
ngOnInit() {
this.workspace = this.workspaceService.getWorkspace();
this.idpUrlValue = '';
this.proxyProtocol = this.workspace.proxyConfiguration.proxyProtocol;
this.proxyUrl = this.workspace.proxyConfiguration.proxyUrl;
this.proxyPort = this.workspace.proxyConfiguration.proxyPort;
this.proxyUsername = this.workspace.proxyConfiguration.username || '';
this.proxyPassword = this.workspace.proxyConfiguration.password || '';
this.form.controls['idpUrl'].setValue(this.idpUrlValue);
this.form.controls['proxyUrl'].setValue(this.proxyUrl);
this.form.controls['proxyProtocol'].setValue(this.proxyProtocol);
this.form.controls['proxyPort'].setValue(this.proxyPort);
this.form.controls['proxyUsername'].setValue(this.proxyUsername);
this.form.controls['proxyPassword'].setValue(this.proxyPassword);
const isProxyUrl = this.workspace.proxyConfiguration.proxyUrl && this.workspace.proxyConfiguration.proxyUrl !== 'undefined';
this.proxyUrl = isProxyUrl ? this.workspace.proxyConfiguration.proxyUrl : '';
if (this.proxyUsername || this.proxyPassword) {
this.showProxyAuthentication = true;
}
this.regions = this.appService.getRegions();
this.locations = this.appService.getLocations();
this.selectedRegion = this.workspace.defaultRegion || environment.defaultRegion;
this.selectedLocation = this.workspace.defaultLocation || environment.defaultLocation;
this.appService.validateAllFormFields(this.form);
}
|
dnsmichi/leapp
|
src/app/components/shared/profile-page/profile-page.component.ts
|
TypeScript
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.