Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion dist/cjs/src/types.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions dist/cjs/types/generated/generated.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/cjs/types/generated/generated.d.ts.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/cjs/types/src/types.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/cjs/types/src/types.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/esm/src/types.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions dist/esm/types/generated/generated.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/esm/types/generated/generated.d.ts.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/esm/types/src/types.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/esm/types/src/types.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions generated/generated.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const createRequestWrapper =
(
tokenCache: TokenCache,
params: CreateFragmentClientParams,
retryConfig: RetryConfig,
retryConfig: RetryConfig
): SdkFunctionWrapper =>
async (request, operationName, operationType) => {
const { clientId, clientSecret, scope, authUrl } = params;
Expand Down Expand Up @@ -86,15 +86,15 @@ const createRequestWrapper =
bail(
new FragmentError({
message: `You can only invoke a single mutation with a mutation operation. You specified ${dataKeys.length} for operation ${operationName}.`,
}),
})
);
}
const [graphQlOperationName] = dataKeys;
const typeName = (data as any)[graphQlOperationName]
.__typename as string;
const { code, message } = (data as any)[graphQlOperationName];
const retryable = getRetryableField(
(data as any)[graphQlOperationName] as any,
(data as any)[graphQlOperationName] as any
);

switch (typeName) {
Expand Down Expand Up @@ -127,7 +127,7 @@ const createRequestWrapper =
new FragmentError({
message: `Encountered unsupported error type: ${typeName}`,
cause: (data as any)[graphQlOperationName],
}),
})
);
}
break;
Expand All @@ -144,7 +144,7 @@ const createRequestWrapper =
bail(
new FragmentError({
cause: error,
}),
})
);
} else {
bail(error as Error);
Expand All @@ -155,7 +155,7 @@ const createRequestWrapper =
bail(
new FragmentError({
message: `Unknown operation type: ${operationType}`,
}),
})
);

return {} as never;
Expand All @@ -181,7 +181,7 @@ type CreateFragmentClientResult<
export const createFragmentClient = <
T extends (
client: GraphQLClient,
wrapper: SdkFunctionWrapper,
wrapper: SdkFunctionWrapper
) => any = typeof getDefaultSdk,
>({
params,
Expand All @@ -200,6 +200,6 @@ export const createFragmentClient = <
}
return getDefaultSdk(
graphql,
requestWrapper,
requestWrapper
) as CreateFragmentClientResult<T>;
};
25 changes: 24 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,25 @@
export { CurrencyCode } from "../generated/generated.js";
export {
BalanceUpdateConsistencyMode,
CurrencyCode,
CurrencyMode,
ExternalTransferType,
ExternalTxSource,
Granularity,
IncreaseEnv,
LedgerAccountClearingStatus,
LedgerAccountTypes,
LedgerDataMigrationStatus,
LedgerLinesConsistencyMode,
LedgerMigrationStatus,
LedgerTypes,
LinkType,
ReadBalanceConsistencyMode,
SceneEventType,
SchemaConsistencyMode,
SchemaLedgerAccountStatus,
SchemaLedgerEntryStatus,
StripeEnv,
TxType,
UnitEnv,
} from "../generated/generated.js";
export type * from "../generated/generated.js";
19 changes: 19 additions & 0 deletions tests/fixtures/generated-test-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1279,6 +1279,15 @@ export type LedgerAccountConsistencyConfigInput = {
* See [Configure consistency](https://fragment.dev/docs/configure-consistency).
*/
ownBalanceUpdates?: InputMaybe<BalanceUpdateConsistencyMode>;
/**
* EXPERIMENTAL: If set to `strong`, then a Ledger Account's `totalBalance` updates will be strongly consistent with the API response.
* This Ledger Account's balance will be updated and available for strongly consistent reads before you receive an API response.
*
* Otherwise if unset or set to `eventual`, `totalBalance` updates are applied asynchronously and may not be immediately reflected in queries.
*
* See [Configure consistency](https://fragment.dev/docs/configure-consistency).
*/
totalBalanceUpdates?: InputMaybe<BalanceUpdateConsistencyMode>;
};

/** Represents a data migration for a specific Ledger Account in a Ledger. */
Expand Down Expand Up @@ -1394,10 +1403,20 @@ export type LedgerAccountsConnection = {
export type LedgerAccountsFilterSet = {
/** Use this to filter Ledger Accounts by their clearing account status */
clearingStatus?: InputMaybe<LedgerAccountClearingStatusFilter>;
/**
* Filter by the earliest posted timestamp across all currencies for clearing accounts. This must be used alongside the clearingStatus filter.
* Only clearing accounts where the minimum posted timestamp (across all currencies) matches this filter will be included.
*/
earliestPostedTimestamp?: InputMaybe<DateTimeFilter>;
/** Use this to filter Ledger Accounts by their parent status */
hasParentLedgerAccount?: InputMaybe<Scalars['Boolean']['input']>;
/** Use this to filter Ledger Accounts by their linked status */
isLinkedAccount?: InputMaybe<Scalars['Boolean']['input']>;
/**
* Filter by the latest posted timestamp across all currencies for clearing accounts. This must be used alongside the clearingStatus filter.
* Only clearing accounts where the maximum posted timestamp (across all currencies) matches this filter will be included.
*/
latestPostedTimestamp?: InputMaybe<DateTimeFilter>;
/** Use this to filter Ledger Accounts by their ID or path */
ledgerAccount?: InputMaybe<LedgerAccountFilter>;
/** Use this to filter Ledger Accounts by their external linked account ID */
Expand Down
Loading