1- import Stripe from 'stripe'
21import type { ResourceConfig } from './types'
32import type { OpenApiSpec , NestedEndpoint } from '@stripe/openapi'
43import {
54 discoverListEndpoints ,
65 discoverNestedEndpoints ,
6+ isV2Path ,
77 buildListFn ,
88 buildRetrieveFn ,
9- canResolveSdkResource ,
10- isV2Path ,
119 RUNTIME_REQUIRED_TABLES as OPENAPI_RUNTIME_REQUIRED_TABLES ,
1210} from '@stripe/openapi'
1311
@@ -65,7 +63,6 @@ export const RESOURCE_TABLE_NAME_MAP: Record<string, string> = Object.fromEntrie
6563 * All resources get list + retrieve functions derived dynamically from the spec paths.
6664 */
6765export function buildResourceRegistry (
68- stripe : Stripe ,
6966 spec : OpenApiSpec ,
7067 apiKey : string
7168) : Record < string , ResourceConfig > {
@@ -76,7 +73,6 @@ export function buildResourceRegistry(
7673
7774 for ( const [ tableName , endpoint ] of endpoints ) {
7875 const v2 = isV2Path ( endpoint . apiPath )
79- if ( ! v2 && ! canResolveSdkResource ( stripe , endpoint . apiPath ) ) continue
8076
8177 const children = nestedEndpoints
8278 . filter ( ( n : NestedEndpoint ) => n . parentTableName === tableName )
@@ -95,8 +91,8 @@ export function buildResourceRegistry(
9591 supportsLimit : endpoint . supportsLimit ,
9692 sync : true ,
9793 dependencies : [ ] ,
98- listFn : buildListFn ( stripe , endpoint . apiPath , apiKey ) ,
99- retrieveFn : buildRetrieveFn ( stripe , endpoint . apiPath , apiKey ) ,
94+ listFn : buildListFn ( apiKey , endpoint . apiPath ) ,
95+ retrieveFn : buildRetrieveFn ( apiKey , endpoint . apiPath ) ,
10096 nestedResources : children . length > 0 ? children : undefined ,
10197 }
10298 registry [ tableName ] = config
0 commit comments