code stringlengths 1 1.05M | repo_name stringlengths 6 83 | path stringlengths 3 242 | language stringclasses 222
values | license stringclasses 20
values | size int64 1 1.05M |
|---|---|---|---|---|---|
from setuptools import find_packages, setup
with open("requirements.txt") as f:
install_requires = f.read().strip().split("\n")
# get version from __version__ variable in print_designer/__init__.py
from print_designer import __version__ as version
setup(
name="print_designer",
version=version,
description="Frapp... | 2302_79757062/print_designer | setup.py | Python | agpl-3.0 | 557 |
import {
Cashflow,
IncomeExpense,
TopExpenses,
TotalCreditAndDebit,
TotalOutstanding,
} from 'utils/db/types';
import { ModelNameEnum } from '../../models/types';
import DatabaseCore from './core';
import { BespokeFunction } from './types';
import { DateTime } from 'luxon';
import { DocItem, ReturnDocItem } f... | 2302_79757062/books | backend/database/bespoke.ts | TypeScript | agpl-3.0 | 12,842 |
import { getDbError, NotFoundError, ValueError } from 'fyo/utils/errors';
import { knex, Knex } from 'knex';
import {
Field,
FieldTypeEnum,
RawValue,
Schema,
SchemaMap,
TargetField,
} from '../../schemas/types';
import {
getIsNullOrUndef,
getRandomString,
getValueMapFromList,
} from '../../utils';
imp... | 2302_79757062/books | backend/database/core.ts | TypeScript | agpl-3.0 | 27,236 |
import BetterSQLite3 from 'better-sqlite3';
import fs from 'fs-extra';
import { DatabaseError } from 'fyo/utils/errors';
import path from 'path';
import { DatabaseDemuxBase, DatabaseMethod } from 'utils/db/types';
import { getMapFromList } from 'utils/index';
import { Version } from 'utils/version';
import { getSchemas... | 2302_79757062/books | backend/database/manager.ts | TypeScript | agpl-3.0 | 6,291 |
import { emitMainProcessError, getDefaultMetaFieldValueMap } from '../helpers';
import { DatabaseManager } from './manager';
import { FieldValueMap, Patch } from './types';
export async function runPatches(
patches: Patch[],
dm: DatabaseManager,
version: string
) {
const list: { name: string; success: boolean ... | 2302_79757062/books | backend/database/runPatch.ts | TypeScript | agpl-3.0 | 1,560 |
import assert from 'assert';
import { cloneDeep } from 'lodash';
import {
addMetaFields,
cleanSchemas,
getAbstractCombinedSchemas,
} from '../../../schemas';
import SingleValue from '../../../schemas/core/SingleValue.json';
import { SchemaMap, SchemaStub, SchemaStubMap } from '../../../schemas/types';
const Cust... | 2302_79757062/books | backend/database/tests/helpers.ts | TypeScript | agpl-3.0 | 4,534 |
import type { Field, FieldType, RawValue } from '../../schemas/types';
import type DatabaseCore from './core';
import type { DatabaseManager } from './manager';
export interface GetQueryBuilderOptions {
offset?: number;
limit?: number;
groupBy?: string | string[];
orderBy?: string | string[];
order?: 'desc' ... | 2302_79757062/books | backend/database/types.ts | TypeScript | agpl-3.0 | 1,863 |
import { constants } from 'fs';
import fs from 'fs/promises';
import { DatabaseMethod } from 'utils/db/types';
import { CUSTOM_EVENTS } from 'utils/messages';
import { KnexColumnType } from './database/types';
export const sqliteTypeMap: Record<string, KnexColumnType> = {
AutoComplete: 'text',
Currency: 'text',
... | 2302_79757062/books | backend/helpers.ts | TypeScript | agpl-3.0 | 1,852 |
import { ModelNameEnum } from '../../models/types';
import { DatabaseManager } from '../database/manager';
import { getDefaultMetaFieldValueMap } from '../helpers';
const defaultUOMs = [
{
name: `Unit`,
isWhole: true,
},
{
name: `Kg`,
isWhole: false,
},
{
name: `Gram`,
isWhole: false,... | 2302_79757062/books | backend/patches/addUOMs.ts | TypeScript | agpl-3.0 | 708 |
import { getDefaultMetaFieldValueMap } from '../../backend/helpers';
import { DatabaseManager } from '../database/manager';
async function execute(dm: DatabaseManager) {
const s = (await dm.db?.getAll('SingleValue', {
fields: ['value'],
filters: { fieldname: 'setupComplete' },
})) as { value: string }[];
... | 2302_79757062/books | backend/patches/createInventoryNumberSeries.ts | TypeScript | agpl-3.0 | 1,055 |
import { ModelNameEnum } from '../../models/types';
import { DatabaseManager } from '../database/manager';
const FIELDNAME = 'roundOffAccount';
async function execute(dm: DatabaseManager) {
const accounts = await dm.db!.getSingleValues(FIELDNAME);
if (!accounts.length) {
await testAndSetRoundOffAccount(dm);
... | 2302_79757062/books | backend/patches/fixRoundOffAccount.ts | TypeScript | agpl-3.0 | 1,298 |
import { Patch } from '../database/types';
import addUOMs from './addUOMs';
import createInventoryNumberSeries from './createInventoryNumberSeries';
import fixRoundOffAccount from './fixRoundOffAccount';
import testPatch from './testPatch';
import updateSchemas from './updateSchemas';
import setPaymentReferenceType fro... | 2302_79757062/books | backend/patches/index.ts | TypeScript | agpl-3.0 | 1,119 |
import { DatabaseManager } from '../database/manager';
async function execute(dm: DatabaseManager) {
await dm.db!.knex!('Payment')
.where({ referenceType: null, paymentType: 'Pay' })
.update({ referenceType: 'PurchaseInvoice' });
await dm.db!.knex!('Payment')
.where({ referenceType: null, paymentType: ... | 2302_79757062/books | backend/patches/setPaymentReferenceType.ts | TypeScript | agpl-3.0 | 433 |
import { DatabaseManager } from '../database/manager';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function execute(dm: DatabaseManager) {
/**
* Execute function will receive the DatabaseManager which is to be used
* to apply database patches.
*/
}
export default { execute, beforeMi... | 2302_79757062/books | backend/patches/testPatch.ts | TypeScript | agpl-3.0 | 335 |
import fs from 'fs/promises';
import { RawValueMap } from 'fyo/core/types';
import { Knex } from 'knex';
import path from 'path';
import { changeKeys, deleteKeys, getIsNullOrUndef, invertMap } from 'utils';
import { getCountryCodeFromCountry } from 'utils/misc';
import { Version } from 'utils/version';
import { ModelNa... | 2302_79757062/books | backend/patches/updateSchemas.ts | TypeScript | agpl-3.0 | 10,046 |
import { DatabaseManager } from '../../database/manager';
/* eslint-disable */
async function execute(dm: DatabaseManager) {
const sourceTables = [
"PurchaseInvoice",
"SalesInvoice",
"JournalEntry",
"Payment",
"StockMovement",
"StockTransfer"
];
await d... | 2302_79757062/books | backend/patches/v0_21_0/fixLedgerDateTime.ts | TypeScript | agpl-3.0 | 1,374 |
import { DateTime } from 'luxon';
// prettier-ignore
export const partyPurchaseItemMap: Record<string, string[]> = {
'Janky Office Spaces': ['Office Rent', 'Office Cleaning'],
"Josféña's 611s": ['611 Jeans - PCH', '611 Jeans - SHR'],
'Lankness Feet Fomenters': ['Bominga Shoes', 'Jade Slippers'],
'The Overcloth... | 2302_79757062/books | dummy/helpers.ts | TypeScript | agpl-3.0 | 1,810 |
import { Fyo, t } from 'fyo';
import { Doc } from 'fyo/model/doc';
import { range, sample } from 'lodash';
import { DateTime } from 'luxon';
import { Invoice } from 'models/baseModels/Invoice/Invoice';
import { Payment } from 'models/baseModels/Payment/Payment';
import { PurchaseInvoice } from 'models/baseModels/Purcha... | 2302_79757062/books | dummy/index.ts | TypeScript | agpl-3.0 | 14,061 |
// App is tagged with a .mjs extension to allow
import path from 'path';
import { fileURLToPath } from 'url';
/**
* electron-builder doesn't look for the APPLE_TEAM_ID environment variable for some reason.
* This workaround allows an environment variable to be added to the electron-builder.yml config
* collection. ... | 2302_79757062/books | electron-builder-config.mjs | JavaScript | agpl-3.0 | 2,092 |
import { Fyo } from 'fyo';
import { AuthDemux } from 'fyo/demux/auth';
import { AuthDemuxBase } from 'utils/auth/types';
import { Creds } from 'utils/types';
import { AuthDemuxConstructor } from './types';
interface AuthConfig {
serverURL: string;
backend: string;
port: number;
}
interface Session {
user: str... | 2302_79757062/books | fyo/core/authHandler.ts | TypeScript | agpl-3.0 | 1,313 |
import { Fyo } from 'fyo';
import { Doc } from 'fyo/model/doc';
import { isPesa } from 'fyo/utils';
import { ValueError } from 'fyo/utils/errors';
import { DateTime } from 'luxon';
import { Field, FieldTypeEnum, RawValue, TargetField } from 'schemas/types';
import { getIsNullOrUndef, safeParseFloat, safeParseInt } from... | 2302_79757062/books | fyo/core/converter.ts | TypeScript | agpl-3.0 | 10,150 |
import { SingleValue } from 'backend/database/types';
import { Fyo } from 'fyo';
import { DatabaseDemux } from 'fyo/demux/db';
import { ValueError } from 'fyo/utils/errors';
import Observable from 'fyo/utils/observable';
import { translateSchema } from 'fyo/utils/translation';
import { Field, RawValue, SchemaMap } from... | 2302_79757062/books | fyo/core/dbHandler.ts | TypeScript | agpl-3.0 | 9,875 |
import { Doc } from 'fyo/model/doc';
import { DocMap, ModelMap, SinglesMap } from 'fyo/model/types';
import { coreModels } from 'fyo/models';
import { NotFoundError, ValueError } from 'fyo/utils/errors';
import Observable from 'fyo/utils/observable';
import { Schema } from 'schemas/types';
import { getRandomString } fr... | 2302_79757062/books | fyo/core/docHandler.ts | TypeScript | agpl-3.0 | 5,210 |
import type { Doc } from 'fyo/model/doc';
import type { Money } from 'pesa';
import type { RawValue } from 'schemas/types';
import type { AuthDemuxBase } from 'utils/auth/types';
import type { DatabaseDemuxBase } from 'utils/db/types';
export type Attachment = { name: string; type: string; data: string };
export type ... | 2302_79757062/books | fyo/core/types.ts | TypeScript | agpl-3.0 | 1,421 |
import { AuthDemuxBase } from 'utils/auth/types';
import { Creds } from 'utils/types';
export class AuthDemux extends AuthDemuxBase {
#isElectron = false;
constructor(isElectron: boolean) {
super();
this.#isElectron = isElectron;
}
async getCreds(): Promise<Creds> {
if (this.#isElectron) {
r... | 2302_79757062/books | fyo/demux/auth.ts | TypeScript | agpl-3.0 | 442 |
import { ConfigMap } from 'fyo/core/types';
import type { IPC } from 'main/preload';
export class Config {
config: Map<string, unknown> | IPC['store'];
constructor(isElectron: boolean) {
this.config = new Map();
if (isElectron) {
this.config = ipc.store;
}
}
get<K extends keyof ConfigMap>(
... | 2302_79757062/books | fyo/demux/config.ts | TypeScript | agpl-3.0 | 672 |
import { DatabaseError, NotImplemented } from 'fyo/utils/errors';
import { SchemaMap } from 'schemas/types';
import { DatabaseDemuxBase, DatabaseMethod } from 'utils/db/types';
import { BackendResponse } from 'utils/ipc/types';
export class DatabaseDemux extends DatabaseDemuxBase {
#isElectron = false;
constructor... | 2302_79757062/books | fyo/demux/db.ts | TypeScript | agpl-3.0 | 2,085 |
import { getMoneyMaker, MoneyMaker } from 'pesa';
import { Field, FieldType } from 'schemas/types';
import { getIsNullOrUndef } from 'utils';
import { markRaw } from 'vue';
import { AuthHandler } from './core/authHandler';
import { DatabaseHandler } from './core/dbHandler';
import { DocHandler } from './core/docHandler... | 2302_79757062/books | fyo/index.ts | TypeScript | agpl-3.0 | 5,704 |
import { Fyo } from 'fyo';
import { Converter } from 'fyo/core/converter';
import { DocValue, DocValueMap, RawValueMap } from 'fyo/core/types';
import { Verb } from 'fyo/telemetry/types';
import { DEFAULT_USER } from 'fyo/utils/consts';
import { ConflictError, MandatoryError, NotFoundError } from 'fyo/utils/errors';
im... | 2302_79757062/books | fyo/model/doc.ts | TypeScript | agpl-3.0 | 26,463 |
import { Fyo } from 'fyo';
import { DuplicateEntryError, NotFoundError } from 'fyo/utils/errors';
import {
DynamicLinkField,
Field,
FieldTypeEnum,
TargetField,
} from 'schemas/types';
import { Doc } from './doc';
type NotFoundDetails = { label: string; value: string };
export async function getDbSyncError(
... | 2302_79757062/books | fyo/model/errorHelpers.ts | TypeScript | agpl-3.0 | 3,888 |
import { Fyo } from 'fyo';
import { DocValue } from 'fyo/core/types';
import { isPesa } from 'fyo/utils';
import { cloneDeep, isEqual } from 'lodash';
import { Field, FieldType, FieldTypeEnum } from 'schemas/types';
import { getIsNullOrUndef } from 'utils';
import { Doc } from './doc';
import { FormulaMap } from './typ... | 2302_79757062/books | fyo/model/helpers.ts | TypeScript | agpl-3.0 | 4,367 |
import { Fyo } from 'fyo';
import NumberSeries from 'fyo/models/NumberSeries';
import { DEFAULT_SERIES_START } from 'fyo/utils/consts';
import { BaseError } from 'fyo/utils/errors';
import { getRandomString } from 'utils';
import { Doc } from './doc';
export function isNameAutoSet(schemaName: string, fyo: Fyo): boolea... | 2302_79757062/books | fyo/model/naming.ts | TypeScript | agpl-3.0 | 2,373 |
import type { Fyo } from 'fyo';
import type { DocValue, DocValueMap } from 'fyo/core/types';
import type SystemSettings from 'fyo/models/SystemSettings';
import type { FieldType, Schema, SelectOption } from 'schemas/types';
import type { QueryFilter } from 'utils/db/types';
import type { RouteLocationRaw, Router } from... | 2302_79757062/books | fyo/model/types.ts | TypeScript | agpl-3.0 | 4,428 |
import { DocValue } from 'fyo/core/types';
import { getOptionList } from 'fyo/utils';
import { ValidationError, ValueError } from 'fyo/utils/errors';
import { t } from 'fyo/utils/translation';
import { Field, OptionField } from 'schemas/types';
import { getIsNullOrUndef } from 'utils';
import { Doc } from './doc';
exp... | 2302_79757062/books | fyo/model/validationFunction.ts | TypeScript | agpl-3.0 | 1,770 |
import { DocValue } from 'fyo/core/types';
import { Doc } from 'fyo/model/doc';
import type {
FormulaMap,
HiddenMap,
ListsMap,
RequiredMap,
ValidationMap,
} from 'fyo/model/types';
import { ValueError } from 'fyo/utils/errors';
import { camelCase } from 'lodash';
import { ModelNameEnum } from 'models/types';
... | 2302_79757062/books | fyo/models/CustomField.ts | TypeScript | agpl-3.0 | 4,007 |
import { Doc } from 'fyo/model/doc';
import { HiddenMap, ListsMap } from 'fyo/model/types';
import { ValidationError } from 'fyo/utils/errors';
import { ModelNameEnum } from 'models/types';
import { Field } from 'schemas/types';
import { getMapFromList } from 'utils/index';
import { CustomField } from './CustomField';
... | 2302_79757062/books | fyo/models/CustomForm.ts | TypeScript | agpl-3.0 | 2,012 |
import { Doc } from 'fyo/model/doc';
import { ReadOnlyMap, ValidationMap } from 'fyo/model/types';
import { ValidationError } from 'fyo/utils/errors';
const invalidNumberSeries = /[/\=\?\&\%]/;
function getPaddedName(prefix: string, next: number, padZeros: number): string {
return prefix + next.toString().padStart(... | 2302_79757062/books | fyo/models/NumberSeries.ts | TypeScript | agpl-3.0 | 1,872 |
import { DocValue } from 'fyo/core/types';
import { Doc } from 'fyo/model/doc';
import { ListsMap, ValidationMap } from 'fyo/model/types';
import { ValidationError } from 'fyo/utils/errors';
import { t } from 'fyo/utils/translation';
import { SelectOption } from 'schemas/types';
import { getCountryInfo } from 'utils/mi... | 2302_79757062/books | fyo/models/SystemSettings.ts | TypeScript | agpl-3.0 | 1,500 |
import { ModelMap } from 'fyo/model/types';
import NumberSeries from './NumberSeries';
import SystemSettings from './SystemSettings';
import { CustomField } from './CustomField';
import { CustomForm } from './CustomForm';
export const coreModels = {
NumberSeries,
SystemSettings,
CustomForm,
CustomField,
} as M... | 2302_79757062/books | fyo/models/index.ts | TypeScript | agpl-3.0 | 329 |
import { Fyo } from 'fyo';
import { Noun, Telemetry, Verb } from './types';
import { ModelNameEnum } from 'models/types';
/**
* # Telemetry
* Used to check if people are using Books or not. All logging
* happens using navigator.sendBeacon
*
* ## `start`
* Used to initialize state. It should be called before any ... | 2302_79757062/books | fyo/telemetry/telemetry.ts | TypeScript | agpl-3.0 | 3,381 |
export type AppVersion = string;
export type UniqueId = string;
export type Timestamp = string;
export enum Verb {
Started = 'started',
Completed = 'completed',
Created = 'created',
Deleted = 'deleted',
Submitted = 'submitted',
Cancelled = 'cancelled',
Imported = 'imported',
Exported = 'exported',
Pr... | 2302_79757062/books | fyo/telemetry/types.ts | TypeScript | agpl-3.0 | 702 |
import { AuthDemuxBase } from 'utils/auth/types';
import { Creds } from 'utils/types';
export class DummyAuthDemux extends AuthDemuxBase {
// eslint-disable-next-line @typescript-eslint/require-await
async getCreds(): Promise<Creds> {
return { errorLogUrl: '', tokenString: '', telemetryUrl: '' };
}
}
| 2302_79757062/books | fyo/tests/helpers.ts | TypeScript | agpl-3.0 | 313 |
export default class CacheManager {
_keyValueCache: Map<string, unknown | undefined>;
_hashCache: Map<string, Map<string, unknown> | undefined>;
constructor() {
this._keyValueCache = new Map();
this._hashCache = new Map();
}
// Regular Cache Ops
getValue(key: string) {
return this._keyValueCac... | 2302_79757062/books | fyo/utils/cacheManager.ts | TypeScript | agpl-3.0 | 1,194 |
export const DEFAULT_INTERNAL_PRECISION = 11;
export const DEFAULT_DISPLAY_PRECISION = 2;
export const DEFAULT_DATE_FORMAT = 'MMM d, y';
export const DEFAULT_LOCALE = 'en-IN';
export const DEFAULT_COUNTRY_CODE = 'in';
export const DEFAULT_CURRENCY = 'INR';
export const DEFAULT_LANGUAGE = 'English';
export const DEFAULT... | 2302_79757062/books | fyo/utils/consts.ts | TypeScript | agpl-3.0 | 548 |
export class BaseError extends Error {
more: Record<string, unknown> = {};
message: string;
statusCode: number;
shouldStore: boolean;
constructor(statusCode: number, message: string, shouldStore = true) {
super(message);
this.name = 'BaseError';
this.statusCode = statusCode;
this.message = me... | 2302_79757062/books | fyo/utils/errors.ts | TypeScript | agpl-3.0 | 2,668 |
import { Fyo } from 'fyo';
import { Doc } from 'fyo/model/doc';
import { DateTime } from 'luxon';
import { Field, FieldType, FieldTypeEnum } from 'schemas/types';
import { getIsNullOrUndef, safeParseFloat, titleCase } from 'utils';
import { isPesa } from '.';
import {
DEFAULT_CURRENCY,
DEFAULT_DATE_FORMAT,
DEFAUL... | 2302_79757062/books | fyo/utils/format.ts | TypeScript | agpl-3.0 | 4,698 |
import { Fyo } from 'fyo';
import { DocValue } from 'fyo/core/types';
import { Doc } from 'fyo/model/doc';
import { Action } from 'fyo/model/types';
import { Money } from 'pesa';
import { Field, FieldType, OptionField, SelectOption } from 'schemas/types';
import { getIsNullOrUndef, safeParseInt } from 'utils';
export ... | 2302_79757062/books | fyo/utils/index.ts | TypeScript | agpl-3.0 | 3,519 |
enum EventType {
Listeners = '_listeners',
OnceListeners = '_onceListeners',
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type Listener = (...args: any[]) => unknown | Promise<unknown>;
export default class Observable<T> {
[key: string]: unknown | T;
_isHot: Map<string, boolean>;
_eventQ... | 2302_79757062/books | fyo/utils/observable.ts | TypeScript | agpl-3.0 | 5,349 |
import { LanguageMap, UnknownMap } from 'utils/types';
import {
getIndexFormat,
getIndexList,
getSnippets,
getWhitespaceSanitized,
} from '../../utils/translationHelpers';
import { ValueError } from './errors';
export type TranslationArgs = boolean | number | string;
export type TranslationLiteral = TemplateSt... | 2302_79757062/books | fyo/utils/translation.ts | TypeScript | agpl-3.0 | 2,994 |
export interface ErrorLog {
name: string;
message: string;
stack?: string;
more?: Record<string, unknown>;
}
| 2302_79757062/books | fyo/utils/types.ts | TypeScript | agpl-3.0 | 117 |
import { app } from 'electron';
import fs from 'fs';
import fetch from 'node-fetch';
import path from 'path';
import { Creds } from 'utils/types';
import { rendererLog } from './helpers';
import type { Main } from 'main';
export function getUrlAndTokenString(): Creds {
const inProduction = app.isPackaged;
const em... | 2302_79757062/books | main/contactMothership.ts | TypeScript | agpl-3.0 | 1,789 |
/**
* Language files are packaged into the binary, if
* newer files are available (if internet available)
* then those will replace the current file.
*
* Language files are fetched from the frappe/books repo
* the language files before storage have a ISO timestamp
* prepended to the file.
*
* This timestamp de... | 2302_79757062/books | main/getLanguageMap.ts | TypeScript | agpl-3.0 | 5,038 |
import fs from 'fs/promises';
import path from 'path';
import { TemplateFile } from 'utils/types';
export async function getTemplates() {
const paths = await getPrintTemplatePaths();
if (!paths) {
return [];
}
const templates: TemplateFile[] = [];
for (const file of paths.files) {
const filePath = p... | 2302_79757062/books | main/getPrintTemplates.ts | TypeScript | agpl-3.0 | 980 |
import { constants } from 'fs';
import fs from 'fs/promises';
import { ConfigFile } from 'fyo/core/types';
import { Main } from 'main';
import config from 'utils/config';
import { BackendResponse } from 'utils/ipc/types';
import { IPC_CHANNELS } from 'utils/messages';
import type { ConfigFilesWithModified } from 'utils... | 2302_79757062/books | main/helpers.ts | TypeScript | agpl-3.0 | 2,424 |
import type {
OpenDialogOptions,
OpenDialogReturnValue,
SaveDialogOptions,
SaveDialogReturnValue,
} from 'electron';
import { contextBridge, ipcRenderer } from 'electron';
import type { ConfigMap } from 'fyo/core/types';
import config from 'utils/config';
import type { DatabaseMethod } from 'utils/db/types';
im... | 2302_79757062/books | main/preload.ts | TypeScript | agpl-3.0 | 6,033 |
import { app } from 'electron';
import installExtension, { VUEJS3_DEVTOOLS } from 'electron-devtools-installer';
import { Main } from '../main';
import { rendererLog } from './helpers';
import { emitMainProcessError } from 'backend/helpers';
export default function registerAppLifecycleListeners(main: Main) {
app.on(... | 2302_79757062/books | main/registerAppLifecycleListeners.ts | TypeScript | agpl-3.0 | 974 |
import { app, dialog } from 'electron';
import { autoUpdater, UpdateInfo } from 'electron-updater';
import { emitMainProcessError } from '../backend/helpers';
import { Main } from '../main';
import { isNetworkError } from './helpers';
export default function registerAutoUpdaterListeners(main: Main) {
autoUpdater.aut... | 2302_79757062/books | main/registerAutoUpdaterListeners.ts | TypeScript | agpl-3.0 | 1,803 |
import {
MessageBoxOptions,
OpenDialogOptions,
SaveDialogOptions,
app,
dialog,
ipcMain,
} from 'electron';
import { autoUpdater } from 'electron-updater';
import { constants } from 'fs';
import fs from 'fs-extra';
import path from 'path';
import { SelectFileOptions, SelectFileReturn } from 'utils/types';
im... | 2302_79757062/books | main/registerIpcMainActionListeners.ts | TypeScript | agpl-3.0 | 6,755 |
import { ipcMain, Menu, shell } from 'electron';
import { Main } from '../main';
import { IPC_MESSAGES } from '../utils/messages';
import { emitMainProcessError } from 'backend/helpers';
export default function registerIpcMainMessageListeners(main: Main) {
ipcMain.on(IPC_MESSAGES.OPEN_MENU, (event) => {
if (even... | 2302_79757062/books | main/registerIpcMainMessageListeners.ts | TypeScript | agpl-3.0 | 1,641 |
import { app } from 'electron';
import { CUSTOM_EVENTS, IPC_CHANNELS } from 'utils/messages';
import { Main } from '../main';
export default function registerProcessListeners(main: Main) {
if (main.isDevelopment) {
if (process.platform === 'win32') {
process.on('message', (data) => {
if (data === '... | 2302_79757062/books | main/registerProcessListeners.ts | TypeScript | agpl-3.0 | 1,014 |
import { App, BrowserWindow } from 'electron';
import fs from 'fs/promises';
import path from 'path';
export async function saveHtmlAsPdf(
html: string,
savePath: string,
app: App,
width: number, // centimeters
height: number // centimeters
): Promise<boolean> {
/**
* Store received html as a file in a ... | 2302_79757062/books | main/saveHtmlAsPdf.ts | TypeScript | agpl-3.0 | 1,503 |
// eslint-disable-next-line
require('source-map-support').install({
handleUncaughtException: false,
environment: 'node',
});
import { emitMainProcessError } from 'backend/helpers';
import {
app,
BrowserWindow,
BrowserWindowConstructorOptions,
protocol,
ProtocolRequest,
ProtocolResponse,
} from 'electro... | 2302_79757062/books | main.ts | TypeScript | agpl-3.0 | 5,153 |
import { Fyo, t } from 'fyo';
import { NotFoundError, ValidationError } from 'fyo/utils/errors';
import { AccountingLedgerEntry } from 'models/baseModels/AccountingLedgerEntry/AccountingLedgerEntry';
import { ModelNameEnum } from 'models/types';
import { Money } from 'pesa';
import { Transactional } from './Transaction... | 2302_79757062/books | models/Transactional/LedgerPosting.ts | TypeScript | agpl-3.0 | 5,433 |
import { Doc } from 'fyo/model/doc';
import { ModelNameEnum } from 'models/types';
import { LedgerPosting } from './LedgerPosting';
/**
* # Transactional
*
* Any model that creates ledger entries on submit should extend the
* `Transactional` model.
*
* Example of transactional models:
* - Invoice
* - Payment
... | 2302_79757062/books | models/Transactional/Transactional.ts | TypeScript | agpl-3.0 | 2,068 |
import { Doc } from 'fyo/model/doc';
import { Money } from 'pesa';
export interface LedgerPostingOptions {
reference: Doc;
party?: string;
}
export interface LedgerEntry {
account: string;
party: string;
date: string;
referenceType: string;
referenceName: string;
reverted: boolean;
debit: Money;
c... | 2302_79757062/books | models/Transactional/types.ts | TypeScript | agpl-3.0 | 387 |
import { Fyo } from 'fyo';
import { Doc } from 'fyo/model/doc';
import {
DefaultMap,
FiltersMap,
ListViewSettings,
RequiredMap,
TreeViewSettings,
ReadOnlyMap,
FormulaMap,
} from 'fyo/model/types';
import { ModelNameEnum } from 'models/types';
import { QueryFilter } from 'utils/db/types';
import { AccountR... | 2302_79757062/books | models/baseModels/Account/Account.ts | TypeScript | agpl-3.0 | 2,708 |
export enum AccountRootTypeEnum {
'Asset'='Asset',
'Liability'='Liability',
'Equity'='Equity',
'Income'='Income',
'Expense'='Expense',
}
export enum AccountTypeEnum {
'Accumulated Depreciation' = 'Accumulated Depreciation',
'Bank' = 'Bank',
'Cash' = 'Cash',
'Chargeable' = 'Chargeable',
'Cost of Goods Sold' ... | 2302_79757062/books | models/baseModels/Account/types.ts | TypeScript | agpl-3.0 | 1,346 |
import { Doc } from 'fyo/model/doc';
import { ListViewSettings } from 'fyo/model/types';
import { ModelNameEnum } from 'models/types';
import { Money } from 'pesa';
export class AccountingLedgerEntry extends Doc {
date?: string | Date;
account?: string;
party?: string;
debit?: Money;
credit?: Money;
refere... | 2302_79757062/books | models/baseModels/AccountingLedgerEntry/AccountingLedgerEntry.ts | TypeScript | agpl-3.0 | 1,103 |
import { Doc } from 'fyo/model/doc';
import {
ChangeArg,
FiltersMap,
HiddenMap,
ListsMap,
ReadOnlyMap,
ValidationMap,
} from 'fyo/model/types';
import { validateEmail } from 'fyo/model/validationFunction';
import { createDiscountAccount } from 'src/setup/setupInstance';
import { getCountryInfo } from 'utils... | 2302_79757062/books | models/baseModels/AccountingSettings/AccountingSettings.ts | TypeScript | agpl-3.0 | 2,043 |
import { t } from 'fyo';
import { Doc } from 'fyo/model/doc';
import {
EmptyMessageMap,
FormulaMap,
ListViewSettings,
ListsMap,
} from 'fyo/model/types';
import { codeStateMap } from 'regional/in';
import { getCountryInfo } from 'utils/misc';
export class Address extends Doc {
formulas: FormulaMap = {
ad... | 2302_79757062/books | models/baseModels/Address/Address.ts | TypeScript | agpl-3.0 | 1,465 |
import { Doc } from 'fyo/model/doc';
import { Money } from 'pesa';
export class CollectionRulesItems extends Doc {
tierName?: string;
collectionFactor?: number;
minimumTotalSpent?: Money;
}
| 2302_79757062/books | models/baseModels/CollectionRulesItems/CollectionRulesItems.ts | TypeScript | agpl-3.0 | 197 |
import { DefaultCashDenominations } from 'models/inventory/Point of Sale/DefaultCashDenominations';
import { Doc } from 'fyo/model/doc';
import { FiltersMap, HiddenMap } from 'fyo/model/types';
import { ModelNameEnum } from 'models/types';
import { PartyRoleEnum } from '../Party/types';
export class Defaults extends D... | 2302_79757062/books | models/baseModels/Defaults/Defaults.ts | TypeScript | agpl-3.0 | 4,525 |
import { Fyo, t } from 'fyo';
import { DocValueMap } from 'fyo/core/types';
import { Doc } from 'fyo/model/doc';
import {
CurrenciesMap,
DefaultMap,
FiltersMap,
FormulaMap,
HiddenMap,
} from 'fyo/model/types';
import { DEFAULT_CURRENCY } from 'fyo/utils/consts';
import { ValidationError } from 'fyo/utils/erro... | 2302_79757062/books | models/baseModels/Invoice/Invoice.ts | TypeScript | agpl-3.0 | 35,252 |
import { PricingRule } from '../PricingRule/PricingRule';
export interface ApplicablePricingRules {
applyOnItem: string;
pricingRule: PricingRule;
}
| 2302_79757062/books | models/baseModels/Invoice/types.ts | TypeScript | agpl-3.0 | 154 |
import { Fyo, t } from 'fyo';
import { DocValue, DocValueMap } from 'fyo/core/types';
import { Doc } from 'fyo/model/doc';
import {
CurrenciesMap,
FiltersMap,
FormulaMap,
HiddenMap,
ValidationMap,
} from 'fyo/model/types';
import { DEFAULT_CURRENCY } from 'fyo/utils/consts';
import { ValidationError } from 'f... | 2302_79757062/books | models/baseModels/InvoiceItem/InvoiceItem.ts | TypeScript | agpl-3.0 | 22,122 |
import { Fyo } from 'fyo';
import { DocValue } from 'fyo/core/types';
import { Doc } from 'fyo/model/doc';
import {
Action,
FiltersMap,
FormulaMap,
HiddenMap,
ListViewSettings,
ReadOnlyMap,
ValidationMap,
} from 'fyo/model/types';
import { ValidationError } from 'fyo/utils/errors';
import { Money } from '... | 2302_79757062/books | models/baseModels/Item/Item.ts | TypeScript | agpl-3.0 | 4,031 |
import { Fyo, t } from 'fyo';
import { Doc } from 'fyo/model/doc';
import {
Action,
DefaultMap,
FiltersMap,
HiddenMap,
ListViewSettings,
} from 'fyo/model/types';
import {
getDocStatus,
getLedgerLinkAction,
getNumberSeries,
getStatusText,
statusColor,
} from 'models/helpers';
import { Transactional ... | 2302_79757062/books | models/baseModels/JournalEntry/JournalEntry.ts | TypeScript | agpl-3.0 | 2,336 |
import { Doc } from 'fyo/model/doc';
import { FiltersMap, FormulaMap } from 'fyo/model/types';
import { Money } from 'pesa';
export class JournalEntryAccount extends Doc {
getAutoDebitCredit(type: 'debit' | 'credit') {
const currentValue = this.get(type) as Money;
if (!currentValue.isZero()) {
return;
... | 2302_79757062/books | models/baseModels/JournalEntryAccount/JournalEntryAccount.ts | TypeScript | agpl-3.0 | 1,075 |
import { Fyo } from 'fyo';
import { Doc } from 'fyo/model/doc';
import {
Action,
LeadStatus,
ListViewSettings,
ValidationMap,
} from 'fyo/model/types';
import { getLeadActions, getLeadStatusColumn } from 'models/helpers';
import {
validateEmail,
validatePhoneNumber,
} from 'fyo/model/validationFunction';
im... | 2302_79757062/books | models/baseModels/Lead/Lead.ts | TypeScript | agpl-3.0 | 1,191 |
import { Doc } from 'fyo/model/doc';
import { ListViewSettings } from 'fyo/model/types';
export class LoyaltyPointEntry extends Doc {
loyaltyProgram?: string;
customer?: string;
invoice?: string;
purchaseAmount?: number;
expiryDate?: Date;
static override getListViewSettings(): ListViewSettings {
retu... | 2302_79757062/books | models/baseModels/LoyaltyPointEntry/LoyaltyPointEntry.ts | TypeScript | agpl-3.0 | 461 |
import { Doc } from 'fyo/model/doc';
import { FiltersMap, ListViewSettings } from 'fyo/model/types';
import { CollectionRulesItems } from '../CollectionRulesItems/CollectionRulesItems';
import { AccountRootTypeEnum } from '../Account/types';
export class LoyaltyProgram extends Doc {
collectionRules?: CollectionRules... | 2302_79757062/books | models/baseModels/LoyaltyProgram/LoyaltyProgram.ts | TypeScript | agpl-3.0 | 644 |
import { Doc } from 'fyo/model/doc';
import { HiddenMap } from 'fyo/model/types';
export class Misc extends Doc {
openCount?: number;
useFullWidth?: boolean;
override hidden: HiddenMap = {};
}
| 2302_79757062/books | models/baseModels/Misc.ts | TypeScript | agpl-3.0 | 200 |
import { Fyo } from 'fyo';
import { Doc } from 'fyo/model/doc';
import {
Action,
FiltersMap,
FormulaMap,
ListViewSettings,
ValidationMap,
} from 'fyo/model/types';
import {
validateEmail,
validatePhoneNumber,
} from 'fyo/model/validationFunction';
import { Money } from 'pesa';
import { PartyRole } from '.... | 2302_79757062/books | models/baseModels/Party/Party.ts | TypeScript | agpl-3.0 | 6,734 |
export type PartyRole = 'Both' | 'Supplier' | 'Customer';
export enum PartyRoleEnum {
'Both' = 'Both',
'Supplier' = 'Supplier',
'Customer' = 'Customer',
}
| 2302_79757062/books | models/baseModels/Party/types.ts | TypeScript | agpl-3.0 | 161 |
import { Fyo, t } from 'fyo';
import { DocValue } from 'fyo/core/types';
import { Doc } from 'fyo/model/doc';
import {
Action,
ChangeArg,
DefaultMap,
FiltersMap,
FormulaMap,
HiddenMap,
ListViewSettings,
RequiredMap,
ValidationMap,
} from 'fyo/model/types';
import { NotFoundError, ValidationError } fro... | 2302_79757062/books | models/baseModels/Payment/Payment.ts | TypeScript | agpl-3.0 | 19,793 |
export type PaymentType = 'Receive' | 'Pay';
export type PaymentMethod = 'Cash' | 'Cheque' | 'Transfer';
export enum PaymentTypeEnum{
Receive = 'Receive',
Pay = 'Pay'
}
export enum AccountFieldEnum{
Account = 'account',
PaymentAccount = 'paymentAccount'
}
| 2302_79757062/books | models/baseModels/Payment/types.ts | TypeScript | agpl-3.0 | 275 |
import { t } from 'fyo';
import { DocValue } from 'fyo/core/types';
import { Doc } from 'fyo/model/doc';
import { FiltersMap, FormulaMap, ValidationMap } from 'fyo/model/types';
import { NotFoundError } from 'fyo/utils/errors';
import { ModelNameEnum } from 'models/types';
import { Money } from 'pesa';
import { PartyRo... | 2302_79757062/books | models/baseModels/PaymentFor/PaymentFor.ts | TypeScript | agpl-3.0 | 2,946 |
import { Doc } from 'fyo/model/doc';
import { ListViewSettings } from 'fyo/model/types';
import { PriceListItem } from './PriceListItem';
import {
getIsDocEnabledColumn,
getPriceListStatusColumn,
} from 'models/helpers';
export class PriceList extends Doc {
isEnabled?: boolean;
isSales?: boolean;
isPurchase?... | 2302_79757062/books | models/baseModels/PriceList/PriceList.ts | TypeScript | agpl-3.0 | 522 |
import { Doc } from 'fyo/model/doc';
import type { FormulaMap } from 'fyo/model/types';
import { ModelNameEnum } from 'models/types';
import type { Money } from 'pesa';
import type { PriceList } from './PriceList';
export class PriceListItem extends Doc {
item?: string;
unit?: string;
rate?: Money;
parentdoc?:... | 2302_79757062/books | models/baseModels/PriceList/PriceListItem.ts | TypeScript | agpl-3.0 | 585 |
import { Doc } from 'fyo/model/doc';
import { Money } from 'pesa';
import { PricingRuleItem } from '../PricingRuleItem/PricingRuleItem';
import { getIsDocEnabledColumn } from 'models/helpers';
import {
HiddenMap,
ListViewSettings,
RequiredMap,
ValidationMap,
} from 'fyo/model/types';
import { DocValue } from 'f... | 2302_79757062/books | models/baseModels/PricingRule/PricingRule.ts | TypeScript | agpl-3.0 | 4,716 |
import { Doc } from 'fyo/model/doc';
export class PricingRuleDetail extends Doc {
referenceName?: string;
referenceItem?: string;
}
| 2302_79757062/books | models/baseModels/PricingRuleDetail/PricingRuleDetail.ts | TypeScript | agpl-3.0 | 137 |
import { Doc } from 'fyo/model/doc';
import { FormulaMap } from 'fyo/model/types';
import { ModelNameEnum } from 'models/types';
export class PricingRuleItem extends Doc {
item?: string;
unit?: string;
formulas: FormulaMap = {
unit: {
formula: () => {
if (!this.item) {
return;
... | 2302_79757062/books | models/baseModels/PricingRuleItem/PricingRuleItem.ts | TypeScript | agpl-3.0 | 420 |
import { Attachment } from 'fyo/core/types';
import { Doc } from 'fyo/model/doc';
import { HiddenMap } from 'fyo/model/types';
export class PrintSettings extends Doc {
logo?: Attachment;
email?: string;
phone?: string;
address?: string;
companyName?: string;
color?: string;
font?: string;
displayLogo?:... | 2302_79757062/books | models/baseModels/PrintSettings/PrintSettings.ts | TypeScript | agpl-3.0 | 367 |
import { Doc } from 'fyo/model/doc';
import { SchemaMap } from 'schemas/types';
import { ListsMap, ListViewSettings, ReadOnlyMap } from 'fyo/model/types';
import { ModelNameEnum } from 'models/types';
import { Fyo } from 'fyo';
export class PrintTemplate extends Doc {
name?: string;
type?: string;
width?: number... | 2302_79757062/books | models/baseModels/PrintTemplate.ts | TypeScript | agpl-3.0 | 1,991 |
import { Fyo } from 'fyo';
import { Action, ListViewSettings } from 'fyo/model/types';
import { LedgerPosting } from 'models/Transactional/LedgerPosting';
import { ModelNameEnum } from 'models/types';
import { getInvoiceActions, getTransactionStatusColumn } from '../../helpers';
import { Invoice } from '../Invoice/Invo... | 2302_79757062/books | models/baseModels/PurchaseInvoice/PurchaseInvoice.ts | TypeScript | agpl-3.0 | 2,201 |
import { InvoiceItem } from '../InvoiceItem/InvoiceItem';
export class PurchaseInvoiceItem extends InvoiceItem {}
| 2302_79757062/books | models/baseModels/PurchaseInvoiceItem/PurchaseInvoiceItem.ts | TypeScript | agpl-3.0 | 115 |
import { Fyo, t } from 'fyo';
import { Action, ListViewSettings, ValidationMap } from 'fyo/model/types';
import { LedgerPosting } from 'models/Transactional/LedgerPosting';
import { ModelNameEnum } from 'models/types';
import {
getAddedLPWithGrandTotal,
getInvoiceActions,
getTransactionStatusColumn,
} from '../..... | 2302_79757062/books | models/baseModels/SalesInvoice/SalesInvoice.ts | TypeScript | agpl-3.0 | 4,093 |
import { InvoiceItem } from '../InvoiceItem/InvoiceItem';
export class SalesInvoiceItem extends InvoiceItem {}
| 2302_79757062/books | models/baseModels/SalesInvoiceItem/SalesInvoiceItem.ts | TypeScript | agpl-3.0 | 112 |
import { Fyo } from 'fyo';
import { DocValueMap } from 'fyo/core/types';
import { Action, FiltersMap, ListViewSettings } from 'fyo/model/types';
import { ModelNameEnum } from 'models/types';
import { getQuoteActions, getTransactionStatusColumn } from '../../helpers';
import { Invoice } from '../Invoice/Invoice';
import... | 2302_79757062/books | models/baseModels/SalesQuote/SalesQuote.ts | TypeScript | agpl-3.0 | 2,482 |
import { InvoiceItem } from '../InvoiceItem/InvoiceItem';
export class SalesQuoteItem extends InvoiceItem {}
| 2302_79757062/books | models/baseModels/SalesQuoteItem/SalesQuoteItem.ts | TypeScript | agpl-3.0 | 110 |