UNPKG

@smartinvoicexyz/graphql

Version:

Unified source for helpers and schema used across the GraphQL services within the Smart Invoice protocol.

780 lines (779 loc) 34.2 kB
/* eslint-disable */ import { AllTypesProps, ReturnTypes, Ops } from './const'; export const HOST = "Specify host"; export const HEADERS = {}; export const apiSubscription = (options) => (query) => { try { const queryString = options[0] + '?query=' + encodeURIComponent(query); const wsString = queryString.replace('http', 'ws'); const host = (options.length > 1 && options[1]?.websocket?.[0]) || wsString; const webSocketOptions = options[1]?.websocket || [host]; const ws = new WebSocket(...webSocketOptions); return { ws, on: (e) => { ws.onmessage = (event) => { if (event.data) { const parsed = JSON.parse(event.data); const data = parsed.data; return e(data); } }; }, off: (e) => { ws.onclose = e; }, error: (e) => { ws.onerror = e; }, open: (e) => { ws.onopen = e; }, }; } catch { throw new Error('No websockets implemented'); } }; const handleFetchResponse = (response) => { if (!response.ok) { return new Promise((_, reject) => { response .text() .then((text) => { try { reject(JSON.parse(text)); } catch (err) { reject(text); } }) .catch(reject); }); } return response.json(); }; export const apiFetch = (options) => (query, variables = {}) => { const fetchOptions = options[1] || {}; if (fetchOptions.method && fetchOptions.method === 'GET') { return fetch(`${options[0]}?query=${encodeURIComponent(query)}`, fetchOptions) .then(handleFetchResponse) .then((response) => { if (response.errors) { throw new GraphQLError(response); } return response.data; }); } return fetch(`${options[0]}`, { body: JSON.stringify({ query, variables }), method: 'POST', headers: { 'Content-Type': 'application/json', }, ...fetchOptions, }) .then(handleFetchResponse) .then((response) => { if (response.errors) { throw new GraphQLError(response); } return response.data; }); }; export const InternalsBuildQuery = ({ ops, props, returns, options, scalars, }) => { const ibb = (k, o, p = '', root = true, vars = []) => { const keyForPath = purifyGraphQLKey(k); const newPath = [p, keyForPath].join(SEPARATOR); if (!o) { return ''; } if (typeof o === 'boolean' || typeof o === 'number') { return k; } if (typeof o === 'string') { return `${k} ${o}`; } if (Array.isArray(o)) { const args = InternalArgsBuilt({ props, returns, ops, scalars, vars, })(o[0], newPath); return `${ibb(args ? `${k}(${args})` : k, o[1], p, false, vars)}`; } if (k === '__alias') { return Object.entries(o) .map(([alias, objectUnderAlias]) => { if (typeof objectUnderAlias !== 'object' || Array.isArray(objectUnderAlias)) { throw new Error('Invalid alias it should be __alias:{ YOUR_ALIAS_NAME: { OPERATION_NAME: { ...selectors }}}'); } const operationName = Object.keys(objectUnderAlias)[0]; const operation = objectUnderAlias[operationName]; return ibb(`${alias}:${operationName}`, operation, p, false, vars); }) .join('\n'); } const hasOperationName = root && options?.operationName ? ' ' + options.operationName : ''; const keyForDirectives = o.__directives ?? ''; const query = `{${Object.entries(o) .filter(([k]) => k !== '__directives') .map((e) => ibb(...e, [p, `field<>${keyForPath}`].join(SEPARATOR), false, vars)) .join('\n')}}`; if (!root) { return `${k} ${keyForDirectives}${hasOperationName} ${query}`; } const varsString = vars.map((v) => `${v.name}: ${v.graphQLType}`).join(', '); return `${k} ${keyForDirectives}${hasOperationName}${varsString ? `(${varsString})` : ''} ${query}`; }; return ibb; }; export const Thunder = (fn, thunderGraphQLOptions) => (operation, graphqlOptions) => (o, ops) => { const options = { ...thunderGraphQLOptions, ...graphqlOptions, }; return fn(Zeus(operation, o, { operationOptions: ops, scalars: options?.scalars, }), ops?.variables).then((data) => { if (options?.scalars) { return decodeScalarsInResponse({ response: data, initialOp: operation, initialZeusQuery: o, returns: ReturnTypes, scalars: options.scalars, ops: Ops, }); } return data; }); }; export const Chain = (...options) => Thunder(apiFetch(options)); export const SubscriptionThunder = (fn, thunderGraphQLOptions) => (operation, graphqlOptions) => (o, ops) => { const options = { ...thunderGraphQLOptions, ...graphqlOptions, }; const returnedFunction = fn(Zeus(operation, o, { operationOptions: ops, scalars: options?.scalars, })); if (returnedFunction?.on && options?.scalars) { const wrapped = returnedFunction.on; returnedFunction.on = (fnToCall) => wrapped((data) => { if (options?.scalars) { return fnToCall(decodeScalarsInResponse({ response: data, initialOp: operation, initialZeusQuery: o, returns: ReturnTypes, scalars: options.scalars, ops: Ops, })); } return fnToCall(data); }); } return returnedFunction; }; export const Subscription = (...options) => SubscriptionThunder(apiSubscription(options)); export const Zeus = (operation, o, ops) => InternalsBuildQuery({ props: AllTypesProps, returns: ReturnTypes, ops: Ops, options: ops?.operationOptions, scalars: ops?.scalars, })(operation, o); export const ZeusSelect = () => ((t) => t); export const Selector = (key) => key && ZeusSelect(); export const TypeFromSelector = (key) => key && ZeusSelect(); export const Gql = Chain(HOST, { headers: { 'Content-Type': 'application/json', ...HEADERS, }, }); export const ZeusScalars = ZeusSelect(); export const fields = (k) => { const t = ReturnTypes[k]; const o = Object.fromEntries(Object.entries(t) .filter(([, value]) => { const isReturnType = ReturnTypes[value]; if (!isReturnType || (typeof isReturnType === 'string' && isReturnType.startsWith('scalar.'))) { return true; } }) .map(([key]) => [key, true])); return o; }; export const decodeScalarsInResponse = ({ response, scalars, returns, ops, initialZeusQuery, initialOp, }) => { if (!scalars) { return response; } const builder = PrepareScalarPaths({ ops, returns, }); const scalarPaths = builder(initialOp, ops[initialOp], initialZeusQuery); if (scalarPaths) { const r = traverseResponse({ scalarPaths, resolvers: scalars })(initialOp, response, [ops[initialOp]]); return r; } return response; }; export const traverseResponse = ({ resolvers, scalarPaths, }) => { const ibb = (k, o, p = []) => { if (Array.isArray(o)) { return o.map((eachO) => ibb(k, eachO, p)); } if (o == null) { return o; } const scalarPathString = p.join(SEPARATOR); const currentScalarString = scalarPaths[scalarPathString]; if (currentScalarString) { const currentDecoder = resolvers[currentScalarString.split('.')[1]]?.decode; if (currentDecoder) { return currentDecoder(o); } } if (typeof o === 'boolean' || typeof o === 'number' || typeof o === 'string' || !o) { return o; } const entries = Object.entries(o).map(([k, v]) => [k, ibb(k, v, [...p, purifyGraphQLKey(k)])]); const objectFromEntries = entries.reduce((a, [k, v]) => { a[k] = v; return a; }, {}); return objectFromEntries; }; return ibb; }; export const SEPARATOR = '|'; export class GraphQLError extends Error { constructor(response) { super(''); this.response = response; console.error(response); } toString() { return 'GraphQL Response Error'; } } const ExtractScalar = (mappedParts, returns) => { if (mappedParts.length === 0) { return; } const oKey = mappedParts[0]; const returnP1 = returns[oKey]; if (typeof returnP1 === 'object') { const returnP2 = returnP1[mappedParts[1]]; if (returnP2) { return ExtractScalar([returnP2, ...mappedParts.slice(2)], returns); } return undefined; } return returnP1; }; export const PrepareScalarPaths = ({ ops, returns }) => { const ibb = (k, originalKey, o, p = [], pOriginals = [], root = true) => { if (!o) { return; } if (typeof o === 'boolean' || typeof o === 'number' || typeof o === 'string') { const extractionArray = [...pOriginals, originalKey]; const isScalar = ExtractScalar(extractionArray, returns); if (isScalar?.startsWith('scalar')) { const partOfTree = { [[...p, k].join(SEPARATOR)]: isScalar, }; return partOfTree; } return {}; } if (Array.isArray(o)) { return ibb(k, k, o[1], p, pOriginals, false); } if (k === '__alias') { return Object.entries(o) .map(([alias, objectUnderAlias]) => { if (typeof objectUnderAlias !== 'object' || Array.isArray(objectUnderAlias)) { throw new Error('Invalid alias it should be __alias:{ YOUR_ALIAS_NAME: { OPERATION_NAME: { ...selectors }}}'); } const operationName = Object.keys(objectUnderAlias)[0]; const operation = objectUnderAlias[operationName]; return ibb(alias, operationName, operation, p, pOriginals, false); }) .reduce((a, b) => ({ ...a, ...b, })); } const keyName = root ? ops[k] : k; return Object.entries(o) .filter(([k]) => k !== '__directives') .map(([k, v]) => { // Inline fragments shouldn't be added to the path as they aren't a field const isInlineFragment = originalKey.match(/^...\s*on/) != null; return ibb(k, k, v, isInlineFragment ? p : [...p, purifyGraphQLKey(keyName || k)], isInlineFragment ? pOriginals : [...pOriginals, purifyGraphQLKey(originalKey)], false); }) .reduce((a, b) => ({ ...a, ...b, })); }; return ibb; }; export const purifyGraphQLKey = (k) => k.replace(/\([^)]*\)/g, '').replace(/^[^:]*\:/g, ''); const mapPart = (p) => { const [isArg, isField] = p.split('<>'); if (isField) { return { v: isField, __type: 'field', }; } return { v: isArg, __type: 'arg', }; }; export const ResolveFromPath = (props, returns, ops) => { const ResolvePropsType = (mappedParts) => { const oKey = ops[mappedParts[0].v]; const propsP1 = oKey ? props[oKey] : props[mappedParts[0].v]; if (propsP1 === 'enum' && mappedParts.length === 1) { return 'enum'; } if (typeof propsP1 === 'string' && propsP1.startsWith('scalar.') && mappedParts.length === 1) { return propsP1; } if (typeof propsP1 === 'object') { if (mappedParts.length < 2) { return 'not'; } const propsP2 = propsP1[mappedParts[1].v]; if (typeof propsP2 === 'string') { return rpp(`${propsP2}${SEPARATOR}${mappedParts .slice(2) .map((mp) => mp.v) .join(SEPARATOR)}`); } if (typeof propsP2 === 'object') { if (mappedParts.length < 3) { return 'not'; } const propsP3 = propsP2[mappedParts[2].v]; if (propsP3 && mappedParts[2].__type === 'arg') { return rpp(`${propsP3}${SEPARATOR}${mappedParts .slice(3) .map((mp) => mp.v) .join(SEPARATOR)}`); } } } }; const ResolveReturnType = (mappedParts) => { if (mappedParts.length === 0) { return 'not'; } const oKey = ops[mappedParts[0].v]; const returnP1 = oKey ? returns[oKey] : returns[mappedParts[0].v]; if (typeof returnP1 === 'object') { if (mappedParts.length < 2) return 'not'; const returnP2 = returnP1[mappedParts[1].v]; if (returnP2) { return rpp(`${returnP2}${SEPARATOR}${mappedParts .slice(2) .map((mp) => mp.v) .join(SEPARATOR)}`); } } }; const rpp = (path) => { const parts = path.split(SEPARATOR).filter((l) => l.length > 0); const mappedParts = parts.map(mapPart); const propsP1 = ResolvePropsType(mappedParts); if (propsP1) { return propsP1; } const returnP1 = ResolveReturnType(mappedParts); if (returnP1) { return returnP1; } return 'not'; }; return rpp; }; export const InternalArgsBuilt = ({ props, ops, returns, scalars, vars, }) => { const arb = (a, p = '', root = true) => { if (typeof a === 'string') { if (a.startsWith(START_VAR_NAME)) { const [varName, graphQLType] = a.replace(START_VAR_NAME, '$').split(GRAPHQL_TYPE_SEPARATOR); const v = vars.find((v) => v.name === varName); if (!v) { vars.push({ name: varName, graphQLType, }); } else { if (v.graphQLType !== graphQLType) { throw new Error(`Invalid variable exists with two different GraphQL Types, "${v.graphQLType}" and ${graphQLType}`); } } return varName; } } const checkType = ResolveFromPath(props, returns, ops)(p); if (checkType.startsWith('scalar.')) { // eslint-disable-next-line @typescript-eslint/no-unused-vars const [_, ...splittedScalar] = checkType.split('.'); const scalarKey = splittedScalar.join('.'); return scalars?.[scalarKey]?.encode?.(a) || JSON.stringify(a); } if (Array.isArray(a)) { return `[${a.map((arr) => arb(arr, p, false)).join(', ')}]`; } if (typeof a === 'string') { if (checkType === 'enum') { return a; } return `${JSON.stringify(a)}`; } if (typeof a === 'object') { if (a === null) { return `null`; } const returnedObjectString = Object.entries(a) .filter(([, v]) => typeof v !== 'undefined') .map(([k, v]) => `${k}: ${arb(v, [p, k].join(SEPARATOR), false)}`) .join(',\n'); if (!root) { return `{${returnedObjectString}}`; } return returnedObjectString; } return `${a}`; }; return arb; }; export const resolverFor = (type, field, fn) => fn; export const START_VAR_NAME = `$ZEUS_VAR`; export const GRAPHQL_TYPE_SEPARATOR = `__$GRAPHQL__`; export const $ = (name, graphqlType) => { return (START_VAR_NAME + name + GRAPHQL_TYPE_SEPARATOR + graphqlType); }; export var ADR; (function (ADR) { ADR["individual"] = "individual"; ADR["arbitrator"] = "arbitrator"; })(ADR || (ADR = {})); export var Agreement_orderBy; (function (Agreement_orderBy) { Agreement_orderBy["id"] = "id"; Agreement_orderBy["type"] = "type"; Agreement_orderBy["src"] = "src"; Agreement_orderBy["createdAt"] = "createdAt"; })(Agreement_orderBy || (Agreement_orderBy = {})); export var Deposit_orderBy; (function (Deposit_orderBy) { Deposit_orderBy["id"] = "id"; Deposit_orderBy["txHash"] = "txHash"; Deposit_orderBy["sender"] = "sender"; Deposit_orderBy["invoice"] = "invoice"; Deposit_orderBy["invoice__id"] = "invoice__id"; Deposit_orderBy["invoice__network"] = "invoice__network"; Deposit_orderBy["invoice__address"] = "invoice__address"; Deposit_orderBy["invoice__factoryAddress"] = "invoice__factoryAddress"; Deposit_orderBy["invoice__token"] = "invoice__token"; Deposit_orderBy["invoice__client"] = "invoice__client"; Deposit_orderBy["invoice__provider"] = "invoice__provider"; Deposit_orderBy["invoice__resolverType"] = "invoice__resolverType"; Deposit_orderBy["invoice__resolver"] = "invoice__resolver"; Deposit_orderBy["invoice__resolutionRate"] = "invoice__resolutionRate"; Deposit_orderBy["invoice__isLocked"] = "invoice__isLocked"; Deposit_orderBy["invoice__numMilestones"] = "invoice__numMilestones"; Deposit_orderBy["invoice__currentMilestone"] = "invoice__currentMilestone"; Deposit_orderBy["invoice__total"] = "invoice__total"; Deposit_orderBy["invoice__released"] = "invoice__released"; Deposit_orderBy["invoice__createdAt"] = "invoice__createdAt"; Deposit_orderBy["invoice__creationTxHash"] = "invoice__creationTxHash"; Deposit_orderBy["invoice__terminationTime"] = "invoice__terminationTime"; Deposit_orderBy["invoice__details"] = "invoice__details"; Deposit_orderBy["invoice__ipfsHash"] = "invoice__ipfsHash"; Deposit_orderBy["invoice__disputeId"] = "invoice__disputeId"; Deposit_orderBy["invoice__projectName"] = "invoice__projectName"; Deposit_orderBy["invoice__projectDescription"] = "invoice__projectDescription"; Deposit_orderBy["invoice__startDate"] = "invoice__startDate"; Deposit_orderBy["invoice__endDate"] = "invoice__endDate"; Deposit_orderBy["invoice__invoiceType"] = "invoice__invoiceType"; Deposit_orderBy["invoice__version"] = "invoice__version"; Deposit_orderBy["invoice__lateFee"] = "invoice__lateFee"; Deposit_orderBy["invoice__lateFeeTimeInterval"] = "invoice__lateFeeTimeInterval"; Deposit_orderBy["invoice__deadline"] = "invoice__deadline"; Deposit_orderBy["invoice__fulfilled"] = "invoice__fulfilled"; Deposit_orderBy["amount"] = "amount"; Deposit_orderBy["timestamp"] = "timestamp"; })(Deposit_orderBy || (Deposit_orderBy = {})); export var Dispute_orderBy; (function (Dispute_orderBy) { Dispute_orderBy["id"] = "id"; Dispute_orderBy["txHash"] = "txHash"; Dispute_orderBy["invoice"] = "invoice"; Dispute_orderBy["invoice__id"] = "invoice__id"; Dispute_orderBy["invoice__network"] = "invoice__network"; Dispute_orderBy["invoice__address"] = "invoice__address"; Dispute_orderBy["invoice__factoryAddress"] = "invoice__factoryAddress"; Dispute_orderBy["invoice__token"] = "invoice__token"; Dispute_orderBy["invoice__client"] = "invoice__client"; Dispute_orderBy["invoice__provider"] = "invoice__provider"; Dispute_orderBy["invoice__resolverType"] = "invoice__resolverType"; Dispute_orderBy["invoice__resolver"] = "invoice__resolver"; Dispute_orderBy["invoice__resolutionRate"] = "invoice__resolutionRate"; Dispute_orderBy["invoice__isLocked"] = "invoice__isLocked"; Dispute_orderBy["invoice__numMilestones"] = "invoice__numMilestones"; Dispute_orderBy["invoice__currentMilestone"] = "invoice__currentMilestone"; Dispute_orderBy["invoice__total"] = "invoice__total"; Dispute_orderBy["invoice__released"] = "invoice__released"; Dispute_orderBy["invoice__createdAt"] = "invoice__createdAt"; Dispute_orderBy["invoice__creationTxHash"] = "invoice__creationTxHash"; Dispute_orderBy["invoice__terminationTime"] = "invoice__terminationTime"; Dispute_orderBy["invoice__details"] = "invoice__details"; Dispute_orderBy["invoice__ipfsHash"] = "invoice__ipfsHash"; Dispute_orderBy["invoice__disputeId"] = "invoice__disputeId"; Dispute_orderBy["invoice__projectName"] = "invoice__projectName"; Dispute_orderBy["invoice__projectDescription"] = "invoice__projectDescription"; Dispute_orderBy["invoice__startDate"] = "invoice__startDate"; Dispute_orderBy["invoice__endDate"] = "invoice__endDate"; Dispute_orderBy["invoice__invoiceType"] = "invoice__invoiceType"; Dispute_orderBy["invoice__version"] = "invoice__version"; Dispute_orderBy["invoice__lateFee"] = "invoice__lateFee"; Dispute_orderBy["invoice__lateFeeTimeInterval"] = "invoice__lateFeeTimeInterval"; Dispute_orderBy["invoice__deadline"] = "invoice__deadline"; Dispute_orderBy["invoice__fulfilled"] = "invoice__fulfilled"; Dispute_orderBy["sender"] = "sender"; Dispute_orderBy["details"] = "details"; Dispute_orderBy["ipfsHash"] = "ipfsHash"; Dispute_orderBy["disputeToken"] = "disputeToken"; Dispute_orderBy["disputeFee"] = "disputeFee"; Dispute_orderBy["disputeId"] = "disputeId"; Dispute_orderBy["timestamp"] = "timestamp"; })(Dispute_orderBy || (Dispute_orderBy = {})); export var Invoice_orderBy; (function (Invoice_orderBy) { Invoice_orderBy["id"] = "id"; Invoice_orderBy["network"] = "network"; Invoice_orderBy["address"] = "address"; Invoice_orderBy["factoryAddress"] = "factoryAddress"; Invoice_orderBy["token"] = "token"; Invoice_orderBy["client"] = "client"; Invoice_orderBy["provider"] = "provider"; Invoice_orderBy["resolverType"] = "resolverType"; Invoice_orderBy["resolver"] = "resolver"; Invoice_orderBy["resolutionRate"] = "resolutionRate"; Invoice_orderBy["isLocked"] = "isLocked"; Invoice_orderBy["amounts"] = "amounts"; Invoice_orderBy["numMilestones"] = "numMilestones"; Invoice_orderBy["currentMilestone"] = "currentMilestone"; Invoice_orderBy["total"] = "total"; Invoice_orderBy["released"] = "released"; Invoice_orderBy["createdAt"] = "createdAt"; Invoice_orderBy["creationTxHash"] = "creationTxHash"; Invoice_orderBy["terminationTime"] = "terminationTime"; Invoice_orderBy["details"] = "details"; Invoice_orderBy["ipfsHash"] = "ipfsHash"; Invoice_orderBy["disputeId"] = "disputeId"; Invoice_orderBy["projectName"] = "projectName"; Invoice_orderBy["projectDescription"] = "projectDescription"; Invoice_orderBy["projectAgreement"] = "projectAgreement"; Invoice_orderBy["startDate"] = "startDate"; Invoice_orderBy["endDate"] = "endDate"; Invoice_orderBy["deposits"] = "deposits"; Invoice_orderBy["withdraws"] = "withdraws"; Invoice_orderBy["releases"] = "releases"; Invoice_orderBy["disputes"] = "disputes"; Invoice_orderBy["resolutions"] = "resolutions"; Invoice_orderBy["tokenMetadata"] = "tokenMetadata"; Invoice_orderBy["tokenMetadata__id"] = "tokenMetadata__id"; Invoice_orderBy["tokenMetadata__name"] = "tokenMetadata__name"; Invoice_orderBy["tokenMetadata__symbol"] = "tokenMetadata__symbol"; Invoice_orderBy["tokenMetadata__decimals"] = "tokenMetadata__decimals"; Invoice_orderBy["verified"] = "verified"; Invoice_orderBy["milestonesAdded"] = "milestonesAdded"; Invoice_orderBy["invoiceType"] = "invoiceType"; Invoice_orderBy["version"] = "version"; Invoice_orderBy["lateFee"] = "lateFee"; Invoice_orderBy["lateFeeTimeInterval"] = "lateFeeTimeInterval"; Invoice_orderBy["tipAmount"] = "tipAmount"; Invoice_orderBy["deadline"] = "deadline"; Invoice_orderBy["fulfilled"] = "fulfilled"; })(Invoice_orderBy || (Invoice_orderBy = {})); export var MilestonesAdded_orderBy; (function (MilestonesAdded_orderBy) { MilestonesAdded_orderBy["id"] = "id"; MilestonesAdded_orderBy["sender"] = "sender"; MilestonesAdded_orderBy["invoice"] = "invoice"; MilestonesAdded_orderBy["milestones"] = "milestones"; })(MilestonesAdded_orderBy || (MilestonesAdded_orderBy = {})); /** Defines the order direction, either ascending or descending */ export var OrderDirection; (function (OrderDirection) { OrderDirection["asc"] = "asc"; OrderDirection["desc"] = "desc"; })(OrderDirection || (OrderDirection = {})); export var Release_orderBy; (function (Release_orderBy) { Release_orderBy["id"] = "id"; Release_orderBy["txHash"] = "txHash"; Release_orderBy["invoice"] = "invoice"; Release_orderBy["invoice__id"] = "invoice__id"; Release_orderBy["invoice__network"] = "invoice__network"; Release_orderBy["invoice__address"] = "invoice__address"; Release_orderBy["invoice__factoryAddress"] = "invoice__factoryAddress"; Release_orderBy["invoice__token"] = "invoice__token"; Release_orderBy["invoice__client"] = "invoice__client"; Release_orderBy["invoice__provider"] = "invoice__provider"; Release_orderBy["invoice__resolverType"] = "invoice__resolverType"; Release_orderBy["invoice__resolver"] = "invoice__resolver"; Release_orderBy["invoice__resolutionRate"] = "invoice__resolutionRate"; Release_orderBy["invoice__isLocked"] = "invoice__isLocked"; Release_orderBy["invoice__numMilestones"] = "invoice__numMilestones"; Release_orderBy["invoice__currentMilestone"] = "invoice__currentMilestone"; Release_orderBy["invoice__total"] = "invoice__total"; Release_orderBy["invoice__released"] = "invoice__released"; Release_orderBy["invoice__createdAt"] = "invoice__createdAt"; Release_orderBy["invoice__creationTxHash"] = "invoice__creationTxHash"; Release_orderBy["invoice__terminationTime"] = "invoice__terminationTime"; Release_orderBy["invoice__details"] = "invoice__details"; Release_orderBy["invoice__ipfsHash"] = "invoice__ipfsHash"; Release_orderBy["invoice__disputeId"] = "invoice__disputeId"; Release_orderBy["invoice__projectName"] = "invoice__projectName"; Release_orderBy["invoice__projectDescription"] = "invoice__projectDescription"; Release_orderBy["invoice__startDate"] = "invoice__startDate"; Release_orderBy["invoice__endDate"] = "invoice__endDate"; Release_orderBy["invoice__invoiceType"] = "invoice__invoiceType"; Release_orderBy["invoice__version"] = "invoice__version"; Release_orderBy["invoice__lateFee"] = "invoice__lateFee"; Release_orderBy["invoice__lateFeeTimeInterval"] = "invoice__lateFeeTimeInterval"; Release_orderBy["invoice__deadline"] = "invoice__deadline"; Release_orderBy["invoice__fulfilled"] = "invoice__fulfilled"; Release_orderBy["milestone"] = "milestone"; Release_orderBy["amount"] = "amount"; Release_orderBy["timestamp"] = "timestamp"; })(Release_orderBy || (Release_orderBy = {})); export var Resolution_orderBy; (function (Resolution_orderBy) { Resolution_orderBy["id"] = "id"; Resolution_orderBy["txHash"] = "txHash"; Resolution_orderBy["details"] = "details"; Resolution_orderBy["ipfsHash"] = "ipfsHash"; Resolution_orderBy["invoice"] = "invoice"; Resolution_orderBy["invoice__id"] = "invoice__id"; Resolution_orderBy["invoice__network"] = "invoice__network"; Resolution_orderBy["invoice__address"] = "invoice__address"; Resolution_orderBy["invoice__factoryAddress"] = "invoice__factoryAddress"; Resolution_orderBy["invoice__token"] = "invoice__token"; Resolution_orderBy["invoice__client"] = "invoice__client"; Resolution_orderBy["invoice__provider"] = "invoice__provider"; Resolution_orderBy["invoice__resolverType"] = "invoice__resolverType"; Resolution_orderBy["invoice__resolver"] = "invoice__resolver"; Resolution_orderBy["invoice__resolutionRate"] = "invoice__resolutionRate"; Resolution_orderBy["invoice__isLocked"] = "invoice__isLocked"; Resolution_orderBy["invoice__numMilestones"] = "invoice__numMilestones"; Resolution_orderBy["invoice__currentMilestone"] = "invoice__currentMilestone"; Resolution_orderBy["invoice__total"] = "invoice__total"; Resolution_orderBy["invoice__released"] = "invoice__released"; Resolution_orderBy["invoice__createdAt"] = "invoice__createdAt"; Resolution_orderBy["invoice__creationTxHash"] = "invoice__creationTxHash"; Resolution_orderBy["invoice__terminationTime"] = "invoice__terminationTime"; Resolution_orderBy["invoice__details"] = "invoice__details"; Resolution_orderBy["invoice__ipfsHash"] = "invoice__ipfsHash"; Resolution_orderBy["invoice__disputeId"] = "invoice__disputeId"; Resolution_orderBy["invoice__projectName"] = "invoice__projectName"; Resolution_orderBy["invoice__projectDescription"] = "invoice__projectDescription"; Resolution_orderBy["invoice__startDate"] = "invoice__startDate"; Resolution_orderBy["invoice__endDate"] = "invoice__endDate"; Resolution_orderBy["invoice__invoiceType"] = "invoice__invoiceType"; Resolution_orderBy["invoice__version"] = "invoice__version"; Resolution_orderBy["invoice__lateFee"] = "invoice__lateFee"; Resolution_orderBy["invoice__lateFeeTimeInterval"] = "invoice__lateFeeTimeInterval"; Resolution_orderBy["invoice__deadline"] = "invoice__deadline"; Resolution_orderBy["invoice__fulfilled"] = "invoice__fulfilled"; Resolution_orderBy["resolverType"] = "resolverType"; Resolution_orderBy["resolver"] = "resolver"; Resolution_orderBy["clientAward"] = "clientAward"; Resolution_orderBy["providerAward"] = "providerAward"; Resolution_orderBy["resolutionDetails"] = "resolutionDetails"; Resolution_orderBy["resolutionFee"] = "resolutionFee"; Resolution_orderBy["ruling"] = "ruling"; Resolution_orderBy["timestamp"] = "timestamp"; })(Resolution_orderBy || (Resolution_orderBy = {})); export var Tip_orderBy; (function (Tip_orderBy) { Tip_orderBy["id"] = "id"; Tip_orderBy["sender"] = "sender"; Tip_orderBy["amount"] = "amount"; })(Tip_orderBy || (Tip_orderBy = {})); export var Token_orderBy; (function (Token_orderBy) { Token_orderBy["id"] = "id"; Token_orderBy["name"] = "name"; Token_orderBy["symbol"] = "symbol"; Token_orderBy["decimals"] = "decimals"; })(Token_orderBy || (Token_orderBy = {})); export var Verified_orderBy; (function (Verified_orderBy) { Verified_orderBy["id"] = "id"; Verified_orderBy["client"] = "client"; Verified_orderBy["invoice"] = "invoice"; })(Verified_orderBy || (Verified_orderBy = {})); export var Withdraw_orderBy; (function (Withdraw_orderBy) { Withdraw_orderBy["id"] = "id"; Withdraw_orderBy["txHash"] = "txHash"; Withdraw_orderBy["invoice"] = "invoice"; Withdraw_orderBy["invoice__id"] = "invoice__id"; Withdraw_orderBy["invoice__network"] = "invoice__network"; Withdraw_orderBy["invoice__address"] = "invoice__address"; Withdraw_orderBy["invoice__factoryAddress"] = "invoice__factoryAddress"; Withdraw_orderBy["invoice__token"] = "invoice__token"; Withdraw_orderBy["invoice__client"] = "invoice__client"; Withdraw_orderBy["invoice__provider"] = "invoice__provider"; Withdraw_orderBy["invoice__resolverType"] = "invoice__resolverType"; Withdraw_orderBy["invoice__resolver"] = "invoice__resolver"; Withdraw_orderBy["invoice__resolutionRate"] = "invoice__resolutionRate"; Withdraw_orderBy["invoice__isLocked"] = "invoice__isLocked"; Withdraw_orderBy["invoice__numMilestones"] = "invoice__numMilestones"; Withdraw_orderBy["invoice__currentMilestone"] = "invoice__currentMilestone"; Withdraw_orderBy["invoice__total"] = "invoice__total"; Withdraw_orderBy["invoice__released"] = "invoice__released"; Withdraw_orderBy["invoice__createdAt"] = "invoice__createdAt"; Withdraw_orderBy["invoice__creationTxHash"] = "invoice__creationTxHash"; Withdraw_orderBy["invoice__terminationTime"] = "invoice__terminationTime"; Withdraw_orderBy["invoice__details"] = "invoice__details"; Withdraw_orderBy["invoice__ipfsHash"] = "invoice__ipfsHash"; Withdraw_orderBy["invoice__disputeId"] = "invoice__disputeId"; Withdraw_orderBy["invoice__projectName"] = "invoice__projectName"; Withdraw_orderBy["invoice__projectDescription"] = "invoice__projectDescription"; Withdraw_orderBy["invoice__startDate"] = "invoice__startDate"; Withdraw_orderBy["invoice__endDate"] = "invoice__endDate"; Withdraw_orderBy["invoice__invoiceType"] = "invoice__invoiceType"; Withdraw_orderBy["invoice__version"] = "invoice__version"; Withdraw_orderBy["invoice__lateFee"] = "invoice__lateFee"; Withdraw_orderBy["invoice__lateFeeTimeInterval"] = "invoice__lateFeeTimeInterval"; Withdraw_orderBy["invoice__deadline"] = "invoice__deadline"; Withdraw_orderBy["invoice__fulfilled"] = "invoice__fulfilled"; Withdraw_orderBy["amount"] = "amount"; Withdraw_orderBy["timestamp"] = "timestamp"; })(Withdraw_orderBy || (Withdraw_orderBy = {})); export var _SubgraphErrorPolicy_; (function (_SubgraphErrorPolicy_) { _SubgraphErrorPolicy_["allow"] = "allow"; _SubgraphErrorPolicy_["deny"] = "deny"; })(_SubgraphErrorPolicy_ || (_SubgraphErrorPolicy_ = {}));