repo_name string | dataset string | owner string | lang string | func_name string | code string | docstring string | url string | sha string |
|---|---|---|---|---|---|---|---|---|
Yi.Abp.Admin | github_2023 | ccnetcore | typescript | StorageProxy.clear | public async clear() {
return new Promise<void>((resolve, reject) => {
this.storage
.clear()
.then(() => {
resolve();
})
.catch(err => {
reject(err);
});
});
} | /**
* @description 从离线仓库中删除所有的键名,重置数据库
*/ | https://github.com/ccnetcore/Yi.Abp.Admin/blob/e03895bcb6eca1f1894af1de15784838172956d5/Yi.Pure.Vue3/src/utils/localforage/index.ts#L76-L87 | e03895bcb6eca1f1894af1de15784838172956d5 |
Yi.Abp.Admin | github_2023 | ccnetcore | typescript | StorageProxy.keys | public async keys() {
return new Promise<string[]>((resolve, reject) => {
this.storage
.keys()
.then(keys => {
resolve(keys);
})
.catch(err => {
reject(err);
});
});
} | /**
* @description 获取数据仓库中所有的key
*/ | https://github.com/ccnetcore/Yi.Abp.Admin/blob/e03895bcb6eca1f1894af1de15784838172956d5/Yi.Pure.Vue3/src/utils/localforage/index.ts#L92-L103 | e03895bcb6eca1f1894af1de15784838172956d5 |
Yi.Abp.Admin | github_2023 | ccnetcore | typescript | handleSelectionChange | function handleSelectionChange(val) {
selectedNum.value = val.length;
// 重置表格高度
tableRef.value.setAdaptive();
} | /** 当CheckBox选择项发生变化时会触发该事件 */ | https://github.com/ccnetcore/Yi.Abp.Admin/blob/e03895bcb6eca1f1894af1de15784838172956d5/Yi.Pure.Vue3/src/views/monitor/logs/login/hook.tsx#L99-L103 | e03895bcb6eca1f1894af1de15784838172956d5 |
Yi.Abp.Admin | github_2023 | ccnetcore | typescript | onSelectionCancel | function onSelectionCancel() {
selectedNum.value = 0;
// 用于多选表格,清空用户的选择
tableRef.value.getTableRef().clearSelection();
} | /** 取消选择 */ | https://github.com/ccnetcore/Yi.Abp.Admin/blob/e03895bcb6eca1f1894af1de15784838172956d5/Yi.Pure.Vue3/src/views/monitor/logs/login/hook.tsx#L106-L110 | e03895bcb6eca1f1894af1de15784838172956d5 |
Yi.Abp.Admin | github_2023 | ccnetcore | typescript | onbatchDel | function onbatchDel() {
// 返回当前选中的行
const curSelected = tableRef.value.getTableRef().getSelectionRows();
// 接下来根据实际业务,通过选中行的某项数据,比如下面的id,调用接口进行批量删除
message(`已删除序号为 ${getKeyList(curSelected, "id")} 的数据`, {
type: "success"
});
tableRef.value.getTableRef().clearSelection();
onSearch();
... | /** 批量删除 */ | https://github.com/ccnetcore/Yi.Abp.Admin/blob/e03895bcb6eca1f1894af1de15784838172956d5/Yi.Pure.Vue3/src/views/monitor/logs/login/hook.tsx#L113-L122 | e03895bcb6eca1f1894af1de15784838172956d5 |
Yi.Abp.Admin | github_2023 | ccnetcore | typescript | clearAll | function clearAll() {
// 根据实际业务,调用接口删除所有日志数据
message("已删除所有日志数据", {
type: "success"
});
onSearch();
} | /** 清空日志 */ | https://github.com/ccnetcore/Yi.Abp.Admin/blob/e03895bcb6eca1f1894af1de15784838172956d5/Yi.Pure.Vue3/src/views/monitor/logs/login/hook.tsx#L125-L131 | e03895bcb6eca1f1894af1de15784838172956d5 |
Yi.Abp.Admin | github_2023 | ccnetcore | typescript | handleSelectionChange | function handleSelectionChange(val) {
selectedNum.value = val.length;
// 重置表格高度
tableRef.value.setAdaptive();
} | /** 当CheckBox选择项发生变化时会触发该事件 */ | https://github.com/ccnetcore/Yi.Abp.Admin/blob/e03895bcb6eca1f1894af1de15784838172956d5/Yi.Pure.Vue3/src/views/monitor/logs/operation/hook.tsx#L105-L109 | e03895bcb6eca1f1894af1de15784838172956d5 |
Yi.Abp.Admin | github_2023 | ccnetcore | typescript | onSelectionCancel | function onSelectionCancel() {
selectedNum.value = 0;
// 用于多选表格,清空用户的选择
tableRef.value.getTableRef().clearSelection();
} | /** 取消选择 */ | https://github.com/ccnetcore/Yi.Abp.Admin/blob/e03895bcb6eca1f1894af1de15784838172956d5/Yi.Pure.Vue3/src/views/monitor/logs/operation/hook.tsx#L112-L116 | e03895bcb6eca1f1894af1de15784838172956d5 |
Yi.Abp.Admin | github_2023 | ccnetcore | typescript | onbatchDel | function onbatchDel() {
// 返回当前选中的行
const curSelected = tableRef.value.getTableRef().getSelectionRows();
// 接下来根据实际业务,通过选中行的某项数据,比如下面的id,调用接口进行批量删除
message(`已删除序号为 ${getKeyList(curSelected, "id")} 的数据`, {
type: "success"
});
tableRef.value.getTableRef().clearSelection();
onSearch();
... | /** 批量删除 */ | https://github.com/ccnetcore/Yi.Abp.Admin/blob/e03895bcb6eca1f1894af1de15784838172956d5/Yi.Pure.Vue3/src/views/monitor/logs/operation/hook.tsx#L119-L128 | e03895bcb6eca1f1894af1de15784838172956d5 |
Yi.Abp.Admin | github_2023 | ccnetcore | typescript | clearAll | function clearAll() {
// 根据实际业务,调用接口删除所有日志数据
message("已删除所有日志数据", {
type: "success"
});
onSearch();
} | /** 清空日志 */ | https://github.com/ccnetcore/Yi.Abp.Admin/blob/e03895bcb6eca1f1894af1de15784838172956d5/Yi.Pure.Vue3/src/views/monitor/logs/operation/hook.tsx#L131-L137 | e03895bcb6eca1f1894af1de15784838172956d5 |
Yi.Abp.Admin | github_2023 | ccnetcore | typescript | handleSelectionChange | function handleSelectionChange(val) {
console.log(val);
} | /** 当CheckBox选择项发生变化时会触发该事件 */ | https://github.com/ccnetcore/Yi.Abp.Admin/blob/e03895bcb6eca1f1894af1de15784838172956d5/Yi.Pure.Vue3/src/views/monitor/online/hook.tsx#L77-L79 | e03895bcb6eca1f1894af1de15784838172956d5 |
Yi.Abp.Admin | github_2023 | ccnetcore | typescript | rowStyle | function rowStyle({ row: { id } }) {
return {
cursor: "pointer",
background: id === curRow.value?.id ? "var(--el-fill-color-light)" : ""
};
} | /** 高亮当前权限选中行 */ | https://github.com/ccnetcore/Yi.Abp.Admin/blob/e03895bcb6eca1f1894af1de15784838172956d5/Yi.Pure.Vue3/src/views/system/config/utils/hook.tsx#L31-L36 | e03895bcb6eca1f1894af1de15784838172956d5 |
Yi.Abp.Admin | github_2023 | ccnetcore | typescript | rowStyle | function rowStyle({ row: { id } }) {
return {
cursor: "pointer",
background: id === curRow.value?.id ? "var(--el-fill-color-light)" : ""
};
} | /** 高亮当前权限选中行 */ | https://github.com/ccnetcore/Yi.Abp.Admin/blob/e03895bcb6eca1f1894af1de15784838172956d5/Yi.Pure.Vue3/src/views/system/post/utils/hook.tsx#L230-L235 | e03895bcb6eca1f1894af1de15784838172956d5 |
Yi.Abp.Admin | github_2023 | ccnetcore | typescript | filterMethod | const filterMethod = (query: string, node) => {
return transformI18n(node.title)!.includes(query);
}; | /** 数据权限 可自行开发 */ | https://github.com/ccnetcore/Yi.Abp.Admin/blob/e03895bcb6eca1f1894af1de15784838172956d5/Yi.Pure.Vue3/src/views/system/post/utils/hook.tsx#L240-L242 | e03895bcb6eca1f1894af1de15784838172956d5 |
Yi.Abp.Admin | github_2023 | ccnetcore | typescript | handleMenu | async function handleMenu(row?: any) {
const { id } = row;
if (id) {
curRow.value = (await getRole(id)).data;
curRow.value.menuIds = (await getRoleMenuSelect(id)).data.map(m => m.id);
isShow.value = true;
nextTick(async () => {
treeRef.value.setCheckedKeys(curRow.value.menuIds);
... | /** 菜单权限 */ | https://github.com/ccnetcore/Yi.Abp.Admin/blob/e03895bcb6eca1f1894af1de15784838172956d5/Yi.Pure.Vue3/src/views/system/role/utils/hook.tsx#L249-L262 | e03895bcb6eca1f1894af1de15784838172956d5 |
Yi.Abp.Admin | github_2023 | ccnetcore | typescript | rowStyle | function rowStyle({ row: { id } }) {
return {
cursor: "pointer",
background: id === curRow.value?.id ? "var(--el-fill-color-light)" : ""
};
} | /** 高亮当前权限选中行 */ | https://github.com/ccnetcore/Yi.Abp.Admin/blob/e03895bcb6eca1f1894af1de15784838172956d5/Yi.Pure.Vue3/src/views/system/role/utils/hook.tsx#L265-L270 | e03895bcb6eca1f1894af1de15784838172956d5 |
Yi.Abp.Admin | github_2023 | ccnetcore | typescript | handleSave | async function handleSave() {
const { id, roleName } = curRow.value;
curRow.value.menuIds = treeRef.value.getCheckedKeys();
// 根据用户 id 调用实际项目中菜单权限修改接口
await updateRole(id, curRow.value);
message(`角色名称为${roleName}的菜单权限修改成功`, {
type: "success"
});
} | /** 菜单权限-保存 */ | https://github.com/ccnetcore/Yi.Abp.Admin/blob/e03895bcb6eca1f1894af1de15784838172956d5/Yi.Pure.Vue3/src/views/system/role/utils/hook.tsx#L273-L282 | e03895bcb6eca1f1894af1de15784838172956d5 |
Yi.Abp.Admin | github_2023 | ccnetcore | typescript | onQueryChanged | const onQueryChanged = (query: string) => {
treeRef.value!.filter(query);
}; | /** 数据权限 可自行开发 */ | https://github.com/ccnetcore/Yi.Abp.Admin/blob/e03895bcb6eca1f1894af1de15784838172956d5/Yi.Pure.Vue3/src/views/system/role/utils/hook.tsx#L287-L289 | e03895bcb6eca1f1894af1de15784838172956d5 |
Yi.Abp.Admin | github_2023 | ccnetcore | typescript | handleSelectionChange | function handleSelectionChange(val) {
selectedNum.value = val.length;
// 重置表格高度
tableRef.value.setAdaptive();
} | /** 当CheckBox选择项发生变化时会触发该事件 */ | https://github.com/ccnetcore/Yi.Abp.Admin/blob/e03895bcb6eca1f1894af1de15784838172956d5/Yi.Pure.Vue3/src/views/system/user/utils/hook.tsx#L263-L267 | e03895bcb6eca1f1894af1de15784838172956d5 |
Yi.Abp.Admin | github_2023 | ccnetcore | typescript | onSelectionCancel | function onSelectionCancel() {
selectedNum.value = 0;
// 用于多选表格,清空用户的选择
tableRef.value.getTableRef().clearSelection();
} | /** 取消选择 */ | https://github.com/ccnetcore/Yi.Abp.Admin/blob/e03895bcb6eca1f1894af1de15784838172956d5/Yi.Pure.Vue3/src/views/system/user/utils/hook.tsx#L270-L274 | e03895bcb6eca1f1894af1de15784838172956d5 |
Yi.Abp.Admin | github_2023 | ccnetcore | typescript | onbatchDel | async function onbatchDel() {
// 返回当前选中的行
const curSelected = tableRef.value.getTableRef().getSelectionRows();
const delIds = getKeyList(curSelected, "id");
await delUser(delIds);
// 接下来根据实际业务,通过选中行的某项数据,比如下面的id,调用接口进行批量删除
message(`已删除用户编号为 ${delIds} 的数据`, {
type: "success"
});
tab... | /** 批量删除 */ | https://github.com/ccnetcore/Yi.Abp.Admin/blob/e03895bcb6eca1f1894af1de15784838172956d5/Yi.Pure.Vue3/src/views/system/user/utils/hook.tsx#L277-L288 | e03895bcb6eca1f1894af1de15784838172956d5 |
Yi.Abp.Admin | github_2023 | ccnetcore | typescript | handleUpload | function handleUpload(row) {
addDialog({
title: "裁剪、上传头像",
width: "40%",
closeOnClickModal: false,
fullscreen: deviceDetection(),
contentRenderer: () =>
h(ReCropperPreview, {
ref: cropRef,
imgSrc: getFileUrl(row.avatar, userAvatar),
onCropper: info... | /** 上传头像 */ | https://github.com/ccnetcore/Yi.Abp.Admin/blob/e03895bcb6eca1f1894af1de15784838172956d5/Yi.Pure.Vue3/src/views/system/user/utils/hook.tsx#L393-L429 | e03895bcb6eca1f1894af1de15784838172956d5 |
Yi.Abp.Admin | github_2023 | ccnetcore | typescript | handleReset | function handleReset(row) {
addDialog({
title: `重置 ${row.userName} 用户的密码`,
width: "30%",
draggable: true,
closeOnClickModal: false,
fullscreen: deviceDetection(),
contentRenderer: () => (
<>
<ElForm ref={ruleFormRef} model={pwdForm}>
<ElFormItem
... | /** 重置密码 */ | https://github.com/ccnetcore/Yi.Abp.Admin/blob/e03895bcb6eca1f1894af1de15784838172956d5/Yi.Pure.Vue3/src/views/system/user/utils/hook.tsx#L438-L509 | e03895bcb6eca1f1894af1de15784838172956d5 |
Yi.Abp.Admin | github_2023 | ccnetcore | typescript | rowStyle | function rowStyle({ row: { name } }) {
return {
cursor: "pointer",
background: name === selectValue.value ? "var(--el-fill-color-light)" : ""
};
} | /** 高亮当前选中行 */ | https://github.com/ccnetcore/Yi.Abp.Admin/blob/e03895bcb6eca1f1894af1de15784838172956d5/Yi.Pure.Vue3/src/views/table/high/table-select/radio/columns.tsx#L40-L45 | e03895bcb6eca1f1894af1de15784838172956d5 |
Yi.Abp.Admin | github_2023 | ccnetcore | typescript | onRowClick | function onRowClick(row) {
selectValue.value = row.name;
selectRef.value.blur();
message(`当前选中行的数据为:${JSON.stringify(row)}`, { type: "success" });
} | /** 行点击 */ | https://github.com/ccnetcore/Yi.Abp.Admin/blob/e03895bcb6eca1f1894af1de15784838172956d5/Yi.Pure.Vue3/src/views/table/high/table-select/radio/columns.tsx#L48-L52 | e03895bcb6eca1f1894af1de15784838172956d5 |
Yi.Abp.Admin | github_2023 | ccnetcore | typescript | initToDetail | const initToDetail = (model: "query" | "params") => {
if (getParameter) toDetail(getParameter, model);
}; | // 用于页面刷新,重新获取浏览器地址栏参数并保存到标签页 | https://github.com/ccnetcore/Yi.Abp.Admin/blob/e03895bcb6eca1f1894af1de15784838172956d5/Yi.Pure.Vue3/src/views/tabs/hooks.ts#L64-L66 | e03895bcb6eca1f1894af1de15784838172956d5 |
react-native-audio-waveform | github_2023 | SimformSolutionsPvtLtd | typescript | styles | const styles = (params: StyleSheetParams = {}) =>
StyleSheet.create({
appContainer: {
flex: 1,
backgroundColor: useColorScheme() === "dark" ? Colors.gray : Colors.white,
},
screenBackground: {
flex: 1,
paddingBottom: params.bottom,
},
container: {
flex: 1,
paddi... | /**
* A StyleSheet object that contains all of the application's styles.
* @param {ThemeMode} theme - The theme of the application.
* @returns {StyleSheet} - A StyleSheet object containing all of the application's styles.
*/ | https://github.com/SimformSolutionsPvtLtd/react-native-audio-waveform/blob/2c3282e299affdbd5c403b80671fe681b064fef6/example/src/styles.ts#L19-L137 | 2c3282e299affdbd5c403b80671fe681b064fef6 |
react-native-audio-waveform | github_2023 | SimformSolutionsPvtLtd | typescript | copyFile | const copyFile = async (
value: string,
destinationPath: string
): Promise<boolean> => {
const fileExists = await fs.exists(`${destinationPath}/${value}`);
if (!fileExists) {
try {
const file = await fs.readFileRes(`raw/${value}`, 'base64');
await fs.writeFile(`${destinationPath}/${value}`, fil... | /**
* Copy a file to the specified destination path if it doesn't exist.
* @param {string} value - The name of the file to copy.
* @param {string} destinationPath - The destination path to copy the file to.
* @returns {Promise<boolean>} A Promise that resolves to true if the file is copied successfully, otherwise f... | https://github.com/SimformSolutionsPvtLtd/react-native-audio-waveform/blob/2c3282e299affdbd5c403b80671fe681b064fef6/example/src/constants/Audios.ts#L25-L43 | 2c3282e299affdbd5c403b80671fe681b064fef6 |
react-native-audio-waveform | github_2023 | SimformSolutionsPvtLtd | typescript | copyFilesToNativeResources | const copyFilesToNativeResources = async (): Promise<string[]> => {
if (globalMetrics.isAndroid) {
const successfulCopies = await Promise.all(
audioAssetArray.map(async value => {
const isSuccess = await copyFile(value, filePath);
return isSuccess ? value : null;
})
);
// Filt... | /**
* Copy all files in the 'audioAssetArray' to the destination path (Android only), or return all files (iOS).
* @returns {Promise<string[]>} A Promise that resolves to a list of successfully copied file paths.
*/ | https://github.com/SimformSolutionsPvtLtd/react-native-audio-waveform/blob/2c3282e299affdbd5c403b80671fe681b064fef6/example/src/constants/Audios.ts#L49-L64 | 2c3282e299affdbd5c403b80671fe681b064fef6 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.constructor | constructor() {
const inner = new LiteSVMInner();
this.inner = inner;
} | /** Create a new LiteSVM instance with standard functionality enabled */ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L94-L97 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.default | static default(): LiteSVM {
const svm = new LiteSVM();
const inner = LiteSVMInner.default();
svm.inner = inner;
return svm;
} | /** Create a new LiteSVM instance with minimal functionality enabled */ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L101-L106 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.withComputeBudget | withComputeBudget(budget: ComputeBudget): LiteSVM {
this.inner.setComputeBudget(budget);
return this;
} | /**
* Set the compute budget
* @param budget - The new compute budget
* @returns The modified LiteSVM instance
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L113-L116 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.withSigverify | withSigverify(sigverify: boolean): LiteSVM {
this.inner.setSigverify(sigverify);
return this;
} | /**
* Enable or disable sigverify
* @param sigverify - if false, transaction signatures will not be checked.
* @returns The modified LiteSVM instance
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L123-L126 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.withBlockhashCheck | withBlockhashCheck(check: boolean): LiteSVM {
this.inner.setBlockhashCheck(check);
return this;
} | /**
* Enables or disables transaction blockhash checking.
* @param check - If false, the blockhash check will be skipped
* @returns The modified LiteSVM instance
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L133-L136 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.withSysvars | withSysvars(): LiteSVM {
this.inner.setSysvars();
return this;
} | /**
* Sets up the standard sysvars.
* @returns The modified LiteSVM instance
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L142-L145 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.withBuiltins | withBuiltins(featureSet?: FeatureSet): LiteSVM {
this.inner.setBuiltins(featureSet);
return this;
} | /**
* Adds the standard builtin programs.
* @param featureSet if provided, decides what builtins to add based on what
* features are active
* @returns The modified LiteSVM instance
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L153-L156 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.withLamports | withLamports(lamports: bigint): LiteSVM {
this.inner.setLamports(lamports);
return this;
} | /**
* Changes the initial lamports in LiteSVM's airdrop account.
* @param lamports - The number of lamports to set in the airdrop account
* @returns The modified LiteSVM instance
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L163-L166 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.withSplPrograms | withSplPrograms(): LiteSVM {
this.inner.setSplPrograms();
return this;
} | /**
* Adds the standard SPL programs.
* @returns The modified LiteSVM instance
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L172-L175 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.withTransactionHistory | withTransactionHistory(capacity: bigint): LiteSVM {
this.inner.setTransactionHistory(capacity);
return this;
} | /**
* Changes the capacity of the transaction history.
* @param capacity - How many transactions to store in history.
* Set this to 0 to disable transaction history and allow duplicate transactions.
* @returns The modified LiteSVM instance
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L183-L186 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.withLogBytesLimit | withLogBytesLimit(limit?: bigint): LiteSVM {
this.inner.setLogBytesLimit(limit);
return this;
} | /**
* Set a limit for transaction logs, beyond which they will be truncated.
* @param limit - The limit in bytes. If null, no limit is enforced.
* @returns The modified LiteSVM instance
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L193-L196 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.withPrecompiles | withPrecompiles(featureSet?: FeatureSet): LiteSVM {
this.inner.setPrecompiles(featureSet);
return this;
} | /**
* Adds the standard precompiles.
* @param featureSet if provided, decides what precompiles to add based on what
* features are active
* @returns The modified LiteSVM instance
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L204-L207 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.minimumBalanceForRentExemption | minimumBalanceForRentExemption(dataLen: bigint): bigint {
return this.inner.minimumBalanceForRentExemption(dataLen);
} | /**
* Calculates the minimum balance required to make an account with specified data length rent exempt.
* @param dataLen - The number of bytes in the account.
* @returns The required balance in lamports
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L214-L216 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.getAccount | getAccount(address: PublicKey): AccountInfoBytes | null {
const inner = this.inner.getAccount(address.toBytes());
return inner === null ? null : toAccountInfo(inner);
} | /**
* Return the account at the given address.
* If the account is not found, None is returned.
* @param address - The account address to look up.
* @returns The account object, if the account exists.
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L224-L227 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.setAccount | setAccount(address: PublicKey, account: AccountInfoBytes) {
this.inner.setAccount(address.toBytes(), fromAccountInfo(account));
} | /**
* Create or overwrite an account, subverting normal runtime checks.
*
* This method exists to make it easier to set up artificial situations
* that would be difficult to replicate by sending individual transactions.
* Beware that it can be used to create states that would not be reachable
* by sending t... | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L240-L242 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.getBalance | getBalance(address: PublicKey): bigint | null {
return this.inner.getBalance(address.toBytes());
} | /**
* Gets the balance of the provided account address.
* @param address - The account address.
* @returns The account's balance in lamports.
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L249-L251 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.latestBlockhash | latestBlockhash(): string {
return this.inner.latestBlockhash();
} | /**
* Gets the latest blockhash.
* Since LiteSVM doesn't have blocks, this is an arbitrary value controlled by LiteSVM
* @returns The designated latest blockhash.
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L258-L260 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.getTransaction | getTransaction(
signature: Uint8Array,
): TransactionMetadata | FailedTransactionMetadata | null {
return this.inner.getTransaction(signature);
} | /**
* Gets a transaction from the transaction history.
* @param signature - The transaction signature bytes
* @returns The transaction, if it is found in the history.
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L267-L271 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.airdrop | airdrop(
address: PublicKey,
lamports: bigint,
): TransactionMetadata | FailedTransactionMetadata | null {
return this.inner.airdrop(address.toBytes(), lamports);
} | /**
* Airdrops the lamport amount specified to the given address.
* @param address The airdrop recipient.
* @param lamports - The amount to airdrop.
* @returns The transaction result.
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L279-L284 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.addProgramFromFile | addProgramFromFile(programId: PublicKey, path: string) {
return this.inner.addProgramFromFile(programId.toBytes(), path);
} | /**
* Adds an SBF program to the test environment from the file specified.
* @param programId - The program ID.
* @param path - The path to the .so file.
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L291-L293 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.addProgram | addProgram(programId: PublicKey, programBytes: Uint8Array) {
return this.inner.addProgram(programId.toBytes(), programBytes);
} | /**
* Adds am SBF program to the test environment.
* @param programId - The program ID.
* @param programBytes - The raw bytes of the compiled program.
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L300-L302 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.sendTransaction | sendTransaction(
tx: Transaction | VersionedTransaction,
): TransactionMetadata | FailedTransactionMetadata {
const internal = this.inner;
const serialized = tx.serialize({
requireAllSignatures: true,
verifySignatures: internal.getSigverify(),
});
if (tx instanceof Transaction) {
return internal.se... | /**
* Processes a transaction and returns the result.
* @param tx - The transaction to send.
* @returns TransactionMetadata if the transaction succeeds, else FailedTransactionMetadata
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L309-L323 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.simulateTransaction | simulateTransaction(
tx: Transaction | VersionedTransaction,
): FailedTransactionMetadata | SimulatedTransactionInfo {
const internal = this.inner;
const serialized = tx.serialize({
requireAllSignatures: true,
verifySignatures: internal.getSigverify(),
});
const inner =
tx instanceof Transaction
... | /**
* Simulates a transaction
* @param tx The transaction to simulate
* @returns SimulatedTransactionInfo if simulation succeeds, else FailedTransactionMetadata
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L330-L345 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.expireBlockhash | expireBlockhash() {
this.inner.expireBlockhash();
} | /**
* Expires the current blockhash.
* The return value of `latestBlockhash()` will be different after calling this.
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L351-L353 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.warpToSlot | warpToSlot(slot: bigint) {
this.inner.warpToSlot(slot);
} | /**
* Warps the clock to the specified slot. This is a convenience wrapper
* around `setClock()`.
* @param slot - The new slot.
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L360-L362 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.getClock | getClock(): Clock {
return this.inner.getClock();
} | /**
* Get the cluster clock.
* @returns the clock object.
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L368-L370 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.setClock | setClock(clock: Clock) {
this.inner.setClock(clock);
} | /**
* Overwrite the clock sysvar.
* @param clock - The clock object.
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L376-L378 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.getEpochRewards | getEpochRewards(): EpochRewards {
return this.inner.getEpochRewards();
} | /**
* Get the EpochRewards sysvar.
* @returns the EpochRewards object.
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L384-L386 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.setEpochRewards | setEpochRewards(rewards: EpochRewards) {
this.inner.setEpochRewards(rewards);
} | /**
* Overwrite the EpochRewards sysvar.
* @param rewards - The EpochRewards object.
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L392-L394 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.getEpochSchedule | getEpochSchedule(): EpochSchedule {
return this.inner.getEpochSchedule();
} | /**
* Get the EpochSchedule sysvar.
* @returns the EpochSchedule object.
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L400-L402 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.setEpochSchedule | setEpochSchedule(schedule: EpochSchedule) {
this.inner.setEpochSchedule(schedule);
} | /**
* Overwrite the EpochSchedule sysvar.
* @param schedule - The EpochSchedule object.
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L408-L410 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.getLastRestartSlot | getLastRestartSlot(): bigint {
return this.inner.getLastRestartSlot();
} | /**
* Get the last restart slot sysvar.
* @returns the last restart slot.
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L416-L418 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.setLastRestartSlot | setLastRestartSlot(slot: bigint) {
this.inner.setLastRestartSlot(slot);
} | /**
* Overwrite the last restart slot sysvar.
* @param slot - The last restart slot.
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L424-L426 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.getRent | getRent(): Rent {
return this.inner.getRent();
} | /**
* Get the cluster rent.
* @returns The rent object.
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L432-L434 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.setRent | setRent(rent: Rent) {
this.inner.setRent(rent);
} | /**
* Overwrite the rent sysvar.
* @param rent - The new rent object.
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L440-L442 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.getSlotHashes | getSlotHashes(): SlotHash[] {
return this.inner.getSlotHashes();
} | /**
* Get the SlotHashes sysvar.
* @returns The SlotHash array.
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L448-L450 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.setSlotHashes | setSlotHashes(hashes: SlotHash[]) {
this.inner.setSlotHashes(hashes);
} | /**
* Overwrite the SlotHashes sysvar.
* @param hashes - The SlotHash array.
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L456-L458 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.getSlotHistory | getSlotHistory(): SlotHistory {
return this.inner.getSlotHistory();
} | /**
* Get the SlotHistory sysvar.
* @returns The SlotHistory object.
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L464-L466 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.setSlotHistory | setSlotHistory(history: SlotHistory) {
this.inner.setSlotHistory(history);
} | /**
* Overwrite the SlotHistory sysvar.
* @param history - The SlotHistory object
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L472-L474 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.getStakeHistory | getStakeHistory(): StakeHistory {
return this.inner.getStakeHistory();
} | /**
* Get the StakeHistory sysvar.
* @returns The StakeHistory object.
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L480-L482 | 8113575d6778163a134d92e48add90fd0c8c5130 |
litesvm | github_2023 | LiteSVM | typescript | LiteSVM.setStakeHistory | setStakeHistory(history: StakeHistory) {
this.inner.setStakeHistory(history);
} | /**
* Overwrite the StakeHistory sysvar.
* @param history - The StakeHistory object
*/ | https://github.com/LiteSVM/litesvm/blob/8113575d6778163a134d92e48add90fd0c8c5130/crates/node-litesvm/litesvm/index.ts#L488-L490 | 8113575d6778163a134d92e48add90fd0c8c5130 |
siteone-crawler-gui | github_2023 | janreges | typescript | CrawlerFormContent.makeCorrections | private makeCorrections(): void {
if (this.offlineExportDir !== null && this.offlineExportDir.trim() === '') {
this.offlineExportDir = '%domain%';
}
if (this.sitemapXmlFile !== null && this.sitemapXmlFile.trim() === '.sitemap.xml') {
this.sitemapXmlFile = '%domain%.sitemap.xml';
... | // } | https://github.com/janreges/siteone-crawler-gui/blob/88f4916d2bb580fc4de63996ea005f92174c9f02/src/renderer/src/types/CrawlerFormContent.ts#L300-L310 | 88f4916d2bb580fc4de63996ea005f92174c9f02 |
degital-twin-3d | github_2023 | anyone-yuren | typescript | ThreeMobx | function ThreeMobx({ children }: IProps) {
return <ThreeStore>{children}</ThreeStore>;
} | // 实例化根store | https://github.com/anyone-yuren/degital-twin-3d/blob/6628c0b3ebe526121982617dd53d07aae9db839f/packages/mobx-store/modules/three/index.tsx#L12-L14 | 6628c0b3ebe526121982617dd53d07aae9db839f |
degital-twin-3d | github_2023 | anyone-yuren | typescript | Canva | const Canva = (props) => {
return (
<>
{/* <Tools /> */}
<Canvas
shadows
gl={{
logarithmicDepthBuffer: true,
}}
>
{/* 场景类 */}
<BaseSence />
{/* 工厂类 */}
<Factory />
{props.children}
{/* 帮助类 */}
<Gizmo />
... | // 创建Canva组件 | https://github.com/anyone-yuren/degital-twin-3d/blob/6628c0b3ebe526121982617dd53d07aae9db839f/packages/three/Canva/index.tsx#L9-L29 | 6628c0b3ebe526121982617dd53d07aae9db839f |
degital-twin-3d | github_2023 | anyone-yuren | typescript | BaseSence | const BaseSence = () => {
const threeStore = useContext(ThreeStoreContext);
// console.log('3D中的', ThreeStore.visible);
return (
<group>
<Lights />
<Camera />
<SkyBox />
{/* <GridModule /> */}
{/* 其他 */}
{/* <Man /> */}
{/* 建筑 */}
<Buildings />
{/* 树 */}... | // 创建Canva组件 | https://github.com/anyone-yuren/degital-twin-3d/blob/6628c0b3ebe526121982617dd53d07aae9db839f/packages/three/Canva/components/BaseSence/index.tsx#L17-L36 | 6628c0b3ebe526121982617dd53d07aae9db839f |
degital-twin-3d | github_2023 | anyone-yuren | typescript | sleep | const sleep = (time: number | undefined) =>
// @ts-ignore
new Promise<void>((resolve) => {
setTimeout(() => {
resolve();
}, time);
}); | /**
* @description sleep
* @param {number} time
*/ | https://github.com/anyone-yuren/degital-twin-3d/blob/6628c0b3ebe526121982617dd53d07aae9db839f/packages/utils/module/common.ts#L15-L21 | 6628c0b3ebe526121982617dd53d07aae9db839f |
degital-twin-3d | github_2023 | anyone-yuren | typescript | autoAddPrefix | const autoAddPrefix = (key: string) => {
const prefix = config.prefix ? config.prefix + '_' : '';
return prefix + key;
}; | // 名称前自动添加前缀 | https://github.com/anyone-yuren/degital-twin-3d/blob/6628c0b3ebe526121982617dd53d07aae9db839f/packages/utils/module/storage.ts#L183-L186 | 6628c0b3ebe526121982617dd53d07aae9db839f |
degital-twin-3d | github_2023 | anyone-yuren | typescript | autoRemovePrefix | const autoRemovePrefix = (key: { substr: (arg: string | number | null) => string }) => {
const len = config.prefix ? config.prefix.length + 1 : '';
return key.substr(len);
}; | // 移除已添加的前缀 | https://github.com/anyone-yuren/degital-twin-3d/blob/6628c0b3ebe526121982617dd53d07aae9db839f/packages/utils/module/storage.ts#L189-L192 | 6628c0b3ebe526121982617dd53d07aae9db839f |
degital-twin-3d | github_2023 | anyone-yuren | typescript | encrypt | const encrypt = (data: string) => {
if (typeof data === 'object') {
try {
data = JSON.stringify(data);
} catch (error) {
console.log('encrypt error:', error);
}
}
const dataHex = CryptoJS.enc.Utf8.parse(data);
const encrypted = CryptoJS.AES.encrypt(dataHex, SECRET_KEY, {
iv: SECRET_I... | /**
* 加密方法
* @param data
* @returns {string}
*/ | https://github.com/anyone-yuren/degital-twin-3d/blob/6628c0b3ebe526121982617dd53d07aae9db839f/packages/utils/module/storage.ts#L199-L214 | 6628c0b3ebe526121982617dd53d07aae9db839f |
degital-twin-3d | github_2023 | anyone-yuren | typescript | decrypt | const decrypt = (data: string) => {
const encryptedHexStr = CryptoJS.enc.Hex.parse(data);
const str = CryptoJS.enc.Base64.stringify(encryptedHexStr);
const decrypt = CryptoJS.AES.decrypt(str, SECRET_KEY, {
iv: SECRET_IV,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7,
});
const decryptedStr ... | /**
* 解密方法
* @param data
* @returns {string}
*/ | https://github.com/anyone-yuren/degital-twin-3d/blob/6628c0b3ebe526121982617dd53d07aae9db839f/packages/utils/module/storage.ts#L221-L231 | 6628c0b3ebe526121982617dd53d07aae9db839f |
nodejs-vertexai | github_2023 | googleapis | typescript | VertexAI.constructor | constructor(init: VertexInit) {
const opts = validateGoogleAuthOptions(
init.project,
init.googleAuthOptions
);
this.location = resolveLocation(init.location);
this.project = resolveProject(init.project);
this.googleAuth = new GoogleAuth(opts);
this.apiEndpoint = init.apiEndpoint;
... | /**
* @constructor
* @param init - assign authentication related information,
* including the project and location strings, to instantiate a Vertex AI
* client.
* @throws {IllegalArgumentError}
*/ | https://github.com/googleapis/nodejs-vertexai/blob/99f3ee8a4589b97f32fa14e0f3adc01163cd9846/src/vertex_ai.ts#L58-L73 | 99f3ee8a4589b97f32fa14e0f3adc01163cd9846 |
nodejs-vertexai | github_2023 | googleapis | typescript | VertexAI.getGenerativeModel | getGenerativeModel(
modelParams: ModelParams,
requestOptions?: RequestOptions
): GenerativeModel {
const getGenerativeModelParams: GetGenerativeModelParams = {
model: modelParams.model,
project: this.project,
location: this.location,
googleAuth: this.googleAuth,
apiEndpoint: ... | /**
* Gets the GenerativeModel class instance.
*
* This method creates a new instance of the `GenerativeModel` class with the
* platform initialization parameters provided in {@link VertexInit} and model
* initialization parameters provided in {@link ModelParams}. You can
* optionally provide {@link R... | https://github.com/googleapis/nodejs-vertexai/blob/99f3ee8a4589b97f32fa14e0f3adc01163cd9846/src/vertex_ai.ts#L120-L138 | 99f3ee8a4589b97f32fa14e0f3adc01163cd9846 |
nodejs-vertexai | github_2023 | googleapis | typescript | VertexAIPreview.constructor | constructor(
project: string,
location: string,
googleAuth: GoogleAuth,
apiEndpoint?: string
) {
this.project = project;
this.location = location;
this.googleAuth = googleAuth;
this.apiEndpoint = apiEndpoint;
this.apiClient = new Resources.ApiClient(
this.project,
this... | /**
* @constructor
* @param project - The Google Cloud project to use for the request
* @param location - location The Google Cloud project location to use for the
* request
* @param googleAuth - The GoogleAuthen class instance from
* google-auth-library.
* Complete list of authentic... | https://github.com/googleapis/nodejs-vertexai/blob/99f3ee8a4589b97f32fa14e0f3adc01163cd9846/src/vertex_ai.ts#L177-L195 | 99f3ee8a4589b97f32fa14e0f3adc01163cd9846 |
nodejs-vertexai | github_2023 | googleapis | typescript | VertexAIPreview.getGenerativeModel | getGenerativeModel(
modelParams: ModelParams,
requestOptions?: RequestOptions
): GenerativeModelPreview {
const getGenerativeModelParams: GetGenerativeModelParams = {
model: modelParams.model,
project: this.project,
location: this.location,
googleAuth: this.googleAuth,
apiEnd... | /**
* @param modelParams - {@link ModelParams} Parameters to
* specify the generative model.
* @returns Instance of the GenerativeModelPreview class.
*/ | https://github.com/googleapis/nodejs-vertexai/blob/99f3ee8a4589b97f32fa14e0f3adc01163cd9846/src/vertex_ai.ts#L202-L220 | 99f3ee8a4589b97f32fa14e0f3adc01163cd9846 |
nodejs-vertexai | github_2023 | googleapis | typescript | getResponseStream | function getResponseStream(
inputStream: ReadableStream<string>
): ReadableStream<unknown> {
const reader = inputStream.getReader();
const stream = new ReadableStream<unknown>({
start(controller) {
let currentText = '';
return pump();
function pump(): Promise<(() => Promise<void>) | undefine... | /**
* Reads a raw stream from the fetch response and join incomplete
* chunks, returning a new stream that provides a single complete
* GenerateContentResponse in each iteration.
* @ignore
*/ | https://github.com/googleapis/nodejs-vertexai/blob/99f3ee8a4589b97f32fa14e0f3adc01163cd9846/src/functions/post_fetch_processing.ts#L133-L180 | 99f3ee8a4589b97f32fa14e0f3adc01163cd9846 |
nodejs-vertexai | github_2023 | googleapis | typescript | ChatSession.constructor | constructor(
request: StartChatSessionRequest,
requestOptions?: RequestOptions
) {
this.project = request.project;
this.location = request.location;
this.googleAuth = request.googleAuth;
this.resourcePath = request.resourcePath;
this.historyInternal = request.history ?? [];
this.genera... | /**
* @constructor
* @param request - {@link StartChatSessionRequest}
*/ | https://github.com/googleapis/nodejs-vertexai/blob/99f3ee8a4589b97f32fa14e0f3adc01163cd9846/src/models/chat_session.ts#L73-L93 | 99f3ee8a4589b97f32fa14e0f3adc01163cd9846 |
nodejs-vertexai | github_2023 | googleapis | typescript | ChatSessionPreview.fetchToken | private fetchToken(): Promise<string | null | undefined> {
const tokenPromise = this.googleAuth.getAccessToken().catch(e => {
throw new GoogleAuthError(constants.CREDENTIAL_ERROR_MESSAGE, e);
});
return tokenPromise;
} | /**
* Gets access token from GoogleAuth. Throws {@link GoogleAuthError} when
* fails.
* @returns Promise of token.
*/ | https://github.com/googleapis/nodejs-vertexai/blob/99f3ee8a4589b97f32fa14e0f3adc01163cd9846/src/models/chat_session.ts#L100-L105 | 99f3ee8a4589b97f32fa14e0f3adc01163cd9846 |
nodejs-vertexai | github_2023 | googleapis | typescript | ChatSession.sendMessage | async sendMessage(
request: string | Array<string | Part>
): Promise<GenerateContentResult> {
const newContent: Content[] =
formulateNewContentFromSendMessageRequest(request);
const generateContentRequest: GenerateContentRequest = {
contents: this.historyInternal.concat(newContent),
safe... | /**
* Makes an async call to send chat message.
*
* The response is returned in {@link
* GenerateContentResult.response}.
*
* @example
* ```
* const chat = generativeModel.startChat();
* const result1 = await chat.sendMessage("How can I learn more about Node.js?");
* console.log('Response:... | https://github.com/googleapis/nodejs-vertexai/blob/99f3ee8a4589b97f32fa14e0f3adc01163cd9846/src/models/chat_session.ts#L126-L166 | 99f3ee8a4589b97f32fa14e0f3adc01163cd9846 |
nodejs-vertexai | github_2023 | googleapis | typescript | ChatSession.sendMessageStream | async sendMessageStream(
request: string | Array<string | Part>
): Promise<StreamGenerateContentResult> {
const newContent: Content[] =
formulateNewContentFromSendMessageRequest(request);
const generateContentrequest: GenerateContentRequest = {
contents: this.historyInternal.concat(newContent)... | /**
* Makes an async call to stream send message.
*
* The response is streamed chunk by chunk in
* {@link StreamGenerateContentResult.stream}. The aggregated response is
* avaliable in {@link StreamGenerateContentResult.response} after all chunks
* are returned.
*
* @example
* ```
* const ... | https://github.com/googleapis/nodejs-vertexai/blob/99f3ee8a4589b97f32fa14e0f3adc01163cd9846/src/models/chat_session.ts#L211-L249 | 99f3ee8a4589b97f32fa14e0f3adc01163cd9846 |
nodejs-vertexai | github_2023 | googleapis | typescript | ChatSessionPreview.constructor | constructor(
request: StartChatSessionRequest,
requestOptions?: RequestOptions
) {
this.project = request.project;
this.location = request.location;
this.googleAuth = request.googleAuth;
this.resourcePath = request.resourcePath;
this.historyInternal = request.history ?? [];
this.genera... | /**
* @constructor
* @param request - {@link StartChatSessionRequest}
*/ | https://github.com/googleapis/nodejs-vertexai/blob/99f3ee8a4589b97f32fa14e0f3adc01163cd9846/src/models/chat_session.ts#L284-L305 | 99f3ee8a4589b97f32fa14e0f3adc01163cd9846 |
nodejs-vertexai | github_2023 | googleapis | typescript | ChatSessionPreview.sendMessage | async sendMessage(
request: string | Array<string | Part>
): Promise<GenerateContentResult> {
const newContent: Content[] =
formulateNewContentFromSendMessageRequest(request);
const generateContentRequest: GenerateContentRequest = {
contents: this.historyInternal.concat(newContent),
safe... | /**
* Makes an async call to send chat message.
*
* The response is returned in {@link
* GenerateContentResult.response}.
*
* @example
* ```
* const chat = generativeModelPreview.startChat();
* const result1 = await chat.sendMessage("How can I learn more about Node.js?");
* console.log('Re... | https://github.com/googleapis/nodejs-vertexai/blob/99f3ee8a4589b97f32fa14e0f3adc01163cd9846/src/models/chat_session.ts#L337-L379 | 99f3ee8a4589b97f32fa14e0f3adc01163cd9846 |
nodejs-vertexai | github_2023 | googleapis | typescript | ChatSessionPreview.sendMessageStream | async sendMessageStream(
request: string | Array<string | Part>
): Promise<StreamGenerateContentResult> {
const newContent: Content[] =
formulateNewContentFromSendMessageRequest(request);
const generateContentRequest: GenerateContentRequest = {
contents: this.historyInternal.concat(newContent)... | /**
* Makes an async call to stream send message.
*
* The response is streamed chunk by chunk in
* {@link StreamGenerateContentResult.stream}. The aggregated response is
* avaliable in {@link StreamGenerateContentResult.response} after all chunks
* are returned.
*
* @example
* ```
* const ... | https://github.com/googleapis/nodejs-vertexai/blob/99f3ee8a4589b97f32fa14e0f3adc01163cd9846/src/models/chat_session.ts#L424-L463 | 99f3ee8a4589b97f32fa14e0f3adc01163cd9846 |
nodejs-vertexai | github_2023 | googleapis | typescript | assignRoleToPartsAndValidateSendMessageRequest | function assignRoleToPartsAndValidateSendMessageRequest(
parts: Array<Part>
): Content[] {
const userContent: Content = {role: constants.USER_ROLE, parts: []};
const functionContent: Content = {role: constants.USER_ROLE, parts: []};
let hasUserContent = false;
let hasFunctionContent = false;
for (const part... | /**
* When multiple Part types (i.e. FunctionResponsePart and TextPart) are
* passed in a single Part array, we may need to assign different roles to each
* part. Currently only FunctionResponsePart requires a role other than 'user'.
* @ignore
* @param parts Array of parts to pass to the model
* @returns Array of... | https://github.com/googleapis/nodejs-vertexai/blob/99f3ee8a4589b97f32fa14e0f3adc01163cd9846/src/models/chat_session.ts#L494-L526 | 99f3ee8a4589b97f32fa14e0f3adc01163cd9846 |
nodejs-vertexai | github_2023 | googleapis | typescript | GenerativeModel.constructor | constructor(getGenerativeModelParams: GetGenerativeModelParams) {
this.project = getGenerativeModelParams.project;
this.location = getGenerativeModelParams.location;
this.apiEndpoint = getGenerativeModelParams.apiEndpoint;
this.googleAuth = getGenerativeModelParams.googleAuth;
this.model = getGenera... | /**
* @constructor
* @param getGenerativeModelParams - {@link GetGenerativeModelParams}
*/ | https://github.com/googleapis/nodejs-vertexai/blob/99f3ee8a4589b97f32fa14e0f3adc01163cd9846/src/models/generative_models.ts#L74-L97 | 99f3ee8a4589b97f32fa14e0f3adc01163cd9846 |
nodejs-vertexai | github_2023 | googleapis | typescript | GenerativeModelPreview.fetchToken | private fetchToken(): Promise<string | null | undefined> {
const tokenPromise = this.googleAuth.getAccessToken().catch(e => {
throw new GoogleAuthError(constants.CREDENTIAL_ERROR_MESSAGE, e);
});
return tokenPromise;
} | /**
* Gets access token from GoogleAuth. Throws {@link GoogleAuthError} when
* fails.
* @returns Promise of token string.
*/ | https://github.com/googleapis/nodejs-vertexai/blob/99f3ee8a4589b97f32fa14e0f3adc01163cd9846/src/models/generative_models.ts#L104-L109 | 99f3ee8a4589b97f32fa14e0f3adc01163cd9846 |
nodejs-vertexai | github_2023 | googleapis | typescript | GenerativeModel.generateContent | async generateContent(
request: GenerateContentRequest | string
): Promise<GenerateContentResult> {
request = formulateRequestToGenerateContentRequest(request);
const formulatedRequest =
formulateSystemInstructionIntoGenerateContentRequest(
request,
this.systemInstruction
);
... | /**
* Makes an async call to generate content.
*
* The response will be returned in {@link
* GenerateContentResult.response}.
*
* @example
* ```
* const request = {
* contents: [{role: 'user', parts: [{text: 'How are you doing today?'}]}],
* };
* const result = await generativeModel.g... | https://github.com/googleapis/nodejs-vertexai/blob/99f3ee8a4589b97f32fa14e0f3adc01163cd9846/src/models/generative_models.ts#L129-L150 | 99f3ee8a4589b97f32fa14e0f3adc01163cd9846 |
nodejs-vertexai | github_2023 | googleapis | typescript | GenerativeModel.generateContentStream | async generateContentStream(
request: GenerateContentRequest | string
): Promise<StreamGenerateContentResult> {
request = formulateRequestToGenerateContentRequest(request);
const formulatedRequest =
formulateSystemInstructionIntoGenerateContentRequest(
request,
this.systemInstruction... | /**
* Makes an async stream request to generate content.
*
* The response is returned chunk by chunk as it's being generated in {@link
* StreamGenerateContentResult.stream}. After all chunks of the response are
* returned, the aggregated response is available in
* {@link StreamGenerateContentResult.re... | https://github.com/googleapis/nodejs-vertexai/blob/99f3ee8a4589b97f32fa14e0f3adc01163cd9846/src/models/generative_models.ts#L176-L197 | 99f3ee8a4589b97f32fa14e0f3adc01163cd9846 |
nodejs-vertexai | github_2023 | googleapis | typescript | GenerativeModelPreview.countTokens | async countTokens(request: CountTokensRequest): Promise<CountTokensResponse> {
return countTokens(
this.location,
this.resourcePath,
this.fetchToken(),
request,
this.apiEndpoint,
this.requestOptions
);
} | /**
* Makes an async request to count tokens.
*
* The `countTokens` function returns the token count and the number of
* billable characters for a prompt.
*
* @example
* ```
* const request = {
* contents: [{role: 'user', parts: [{text: 'How are you doing today?'}]}],
* };
* const res... | https://github.com/googleapis/nodejs-vertexai/blob/99f3ee8a4589b97f32fa14e0f3adc01163cd9846/src/models/generative_models.ts#L217-L226 | 99f3ee8a4589b97f32fa14e0f3adc01163cd9846 |
nodejs-vertexai | github_2023 | googleapis | typescript | GenerativeModel.startChat | startChat(request?: StartChatParams): ChatSession {
const startChatRequest: StartChatSessionRequest = {
project: this.project,
location: this.location,
googleAuth: this.googleAuth,
publisherModelEndpoint: this.publisherModelEndpoint,
resourcePath: this.resourcePath,
tools: this.t... | /**
* Instantiates a {@link ChatSession}.
*
* The {@link ChatSession} class is a stateful class that holds the state of
* the conversation with the model and provides methods to interact with the
* model in chat mode. Calling this method doesn't make any calls to a remote
* endpoint. To make remote ca... | https://github.com/googleapis/nodejs-vertexai/blob/99f3ee8a4589b97f32fa14e0f3adc01163cd9846/src/models/generative_models.ts#L252-L277 | 99f3ee8a4589b97f32fa14e0f3adc01163cd9846 |
nodejs-vertexai | github_2023 | googleapis | typescript | GenerativeModelPreview.constructor | constructor(getGenerativeModelParams: GetGenerativeModelParams) {
this.project = getGenerativeModelParams.project;
this.location = getGenerativeModelParams.location;
this.apiEndpoint = getGenerativeModelParams.apiEndpoint;
this.googleAuth = getGenerativeModelParams.googleAuth;
this.model = getGenera... | /**
* @constructor
* @param getGenerativeModelParams - {@link GetGenerativeModelParams}
*/ | https://github.com/googleapis/nodejs-vertexai/blob/99f3ee8a4589b97f32fa14e0f3adc01163cd9846/src/models/generative_models.ts#L306-L330 | 99f3ee8a4589b97f32fa14e0f3adc01163cd9846 |
nodejs-vertexai | github_2023 | googleapis | typescript | GenerativeModelPreview.generateContent | async generateContent(
request: GenerateContentRequest | string
): Promise<GenerateContentResult> {
request = formulateRequestToGenerateContentRequest(request);
const formulatedRequest = {
...formulateSystemInstructionIntoGenerateContentRequest(
request,
this.systemInstruction
... | /**
* Makes an async call to generate content.
*
* The response will be returned in {@link GenerateContentResult.response}.
*
* @example
* ```
* const request = {
* contents: [{role: 'user', parts: [{text: 'How are you doing today?'}]}],
* };
* const result = await generativeModelPreview... | https://github.com/googleapis/nodejs-vertexai/blob/99f3ee8a4589b97f32fa14e0f3adc01163cd9846/src/models/generative_models.ts#L361-L384 | 99f3ee8a4589b97f32fa14e0f3adc01163cd9846 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.