@drawbridge/drawbridge-utils 0.0.130 → 0.0.132

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4855,7 +4855,7 @@ var projectConnection = (record) => {
4855
4855
  var resolveConnection = (item, data2, env = {}) => {
4856
4856
  if (!item) return item;
4857
4857
  return Object.fromEntries(
4858
- Object.entries(item).filter(([key]) => !["auth", "enabled", "fields", "hooks", "inbound", "provider", "requires", "steps", "supports"].includes(key)).map(([key, value]) => [
4858
+ Object.entries(item).filter(([key]) => !["auth", "enabled", "fields", "hooks", "inbound", "provider", "requires", "status", "steps", "supports"].includes(key)).map(([key, value]) => [
4859
4859
  key,
4860
4860
  typeof value === "function" ? value(data2, env) : value
4861
4861
  ])
@@ -6033,7 +6033,14 @@ const resolveConnection = ( item, data, env = {} ) => {
6033
6033
  // PLATFORM configuration — which credentials an admin types in for this
6034
6034
  // vendor — and no merchant-facing resolution has any business carrying
6035
6035
  // it, even as bare descriptors.
6036
- .filter( ( [ key ] ) => ! [ 'auth', 'enabled', 'fields', 'hooks', 'inbound', 'provider', 'requires', 'steps', 'supports' ].includes( key ) )
6036
+ //
6037
+ // `status` is in it because the hook judges a STORED DOCUMENT, and
6038
+ // resolution runs over whatever data it is handed — including none.
6039
+ // Asked about an absent document, the hook answers 'pending', and that
6040
+ // answer baked a Pending badge into Klaviyo, Mailchimp and Attentive
6041
+ // cards nobody had connected. Status belongs to the caller's own
6042
+ // read-time pass (api's applyStatus), never to projection.
6043
+ .filter( ( [ key ] ) => ! [ 'auth', 'enabled', 'fields', 'hooks', 'inbound', 'provider', 'requires', 'status', 'steps', 'supports' ].includes( key ) )
6037
6044
  .map( ( [ key, value ] ) => [
6038
6045
  key,
6039
6046
  ( typeof value === 'function' ? value( data, env ) : value )
@@ -6033,7 +6033,14 @@ const resolveConnection = ( item, data, env = {} ) => {
6033
6033
  // PLATFORM configuration — which credentials an admin types in for this
6034
6034
  // vendor — and no merchant-facing resolution has any business carrying
6035
6035
  // it, even as bare descriptors.
6036
- .filter( ( [ key ] ) => ! [ 'auth', 'enabled', 'fields', 'hooks', 'inbound', 'provider', 'requires', 'steps', 'supports' ].includes( key ) )
6036
+ //
6037
+ // `status` is in it because the hook judges a STORED DOCUMENT, and
6038
+ // resolution runs over whatever data it is handed — including none.
6039
+ // Asked about an absent document, the hook answers 'pending', and that
6040
+ // answer baked a Pending badge into Klaviyo, Mailchimp and Attentive
6041
+ // cards nobody had connected. Status belongs to the caller's own
6042
+ // read-time pass (api's applyStatus), never to projection.
6043
+ .filter( ( [ key ] ) => ! [ 'auth', 'enabled', 'fields', 'hooks', 'inbound', 'provider', 'requires', 'status', 'steps', 'supports' ].includes( key ) )
6037
6044
  .map( ( [ key, value ] ) => [
6038
6045
  key,
6039
6046
  ( typeof value === 'function' ? value( data, env ) : value )
@@ -4781,7 +4781,7 @@ var projectConnection = (record) => {
4781
4781
  var resolveConnection = (item, data2, env = {}) => {
4782
4782
  if (!item) return item;
4783
4783
  return Object.fromEntries(
4784
- Object.entries(item).filter(([key]) => !["auth", "enabled", "fields", "hooks", "inbound", "provider", "requires", "steps", "supports"].includes(key)).map(([key, value]) => [
4784
+ Object.entries(item).filter(([key]) => !["auth", "enabled", "fields", "hooks", "inbound", "provider", "requires", "status", "steps", "supports"].includes(key)).map(([key, value]) => [
4785
4785
  key,
4786
4786
  typeof value === "function" ? value(data2, env) : value
4787
4787
  ])
package/dist/twilio.cjs CHANGED
@@ -115,7 +115,7 @@ var twilio = {
115
115
  // Basic auth throughout, like Messages.
116
116
  searchNumbers: async ({ accountSid, areaCode, authToken, contains, country = "US", cursor, limit = 10, request: request2 = request }) => {
117
117
  if (!accountSid || !authToken) throw new Error("Twilio credentials missing \u2014 accountSid, authToken");
118
- const [page, token] = String(cursor || "").split("~");
118
+ const page = Number(cursor) || 0;
119
119
  const result = await request2({
120
120
  method: "GET",
121
121
  url: "https://api.twilio.com/2010-04-01/Accounts/" + accountSid + "/AvailablePhoneNumbers/" + country + "/Local.json",
@@ -130,18 +130,17 @@ var twilio = {
130
130
  // match anywhere in the number, so one search box serves "my
131
131
  // area code" and "ends in 7777" alike.
132
132
  ...contains && { Contains: contains },
133
- ...token && { Page: page, PageToken: token }
133
+ ...page && { Page: page }
134
134
  }
135
135
  });
136
- const nextQuery = (result == null ? void 0 : result.next_page_uri) ? new URLSearchParams(String(result.next_page_uri).split("?")[1] || "") : null;
137
- const nextToken = nextQuery == null ? void 0 : nextQuery.get("PageToken");
136
+ const items = ((result == null ? void 0 : result.available_phone_numbers) || []).map((entry) => ({
137
+ friendly: entry.friendly_name,
138
+ locality: entry.locality || entry.region || null,
139
+ number: entry.phone_number
140
+ }));
138
141
  return {
139
- cursor: nextToken ? (nextQuery.get("Page") || "") + "~" + nextToken : null,
140
- items: ((result == null ? void 0 : result.available_phone_numbers) || []).map((entry) => ({
141
- friendly: entry.friendly_name,
142
- locality: entry.locality || entry.region || null,
143
- number: entry.phone_number
144
- }))
142
+ cursor: items.length === limit ? String(page + 1) : null,
143
+ items
145
144
  };
146
145
  },
147
146
  purchaseNumber: async ({ accountSid, authToken, number, request: request2 = request, smsUrl }) => {
package/dist/twilio.d.cts CHANGED
@@ -81,11 +81,15 @@ const twilio = {
81
81
 
82
82
  if( ! accountSid || ! authToken ) throw new Error( 'Twilio credentials missing — accountSid, authToken' );
83
83
 
84
- // The vendor pages with Page + PageToken and answers next_page_uri
85
- // (AvailablePhoneNumbers resource docs). Ours is one opaque cursor —
86
- // `<Page>~<PageToken>` so the caller never learns the vendor's two
87
- // halves and cannot recombine them wrong.
88
- const [ page, token ] = String( cursor || '' ).split( '~' );
84
+ // PAGING, as the vendor actually does it rather than as its docs say.
85
+ // The AvailablePhoneNumbers reference lists PageToken/next_page_uri, but
86
+ // the resource returns NO next_page_uri at all (measured 2026-09-03)
87
+ // while a bare Page index works and answers a different set. So the
88
+ // cursor is simply the page number, and "is there a next page" is the
89
+ // full-page heuristic: a short page is the last one. (A page-boundary
90
+ // exact fit costs one empty page at the end — the trade for a vendor
91
+ // that will not say how much inventory it has.)
92
+ const page = Number( cursor ) || 0;
89
93
 
90
94
  const result = await request$1({
91
95
  method : 'GET',
@@ -101,24 +105,20 @@ const twilio = {
101
105
  // match anywhere in the number, so one search box serves "my
102
106
  // area code" and "ends in 7777" alike.
103
107
  ...( contains && { Contains : contains } ),
104
- ...( token && { Page : page, PageToken : token } )
108
+ ...( page && { Page : page } )
105
109
  }
106
110
  });
107
111
 
108
- const nextQuery = result?.next_page_uri
109
- ? new URLSearchParams( String( result.next_page_uri ).split( '?' )[ 1 ] || '' )
110
- : null;
111
-
112
- const nextToken = nextQuery?.get( 'PageToken' );
112
+ const items = ( result?.available_phone_numbers || [] ).map( ( entry ) => ({
113
+ friendly : entry.friendly_name,
114
+ locality : entry.locality || entry.region || null,
115
+ number : entry.phone_number
116
+ }) );
113
117
 
114
118
  // The caller-facing shape is ours; the vendor's field names stay here.
115
119
  return {
116
- cursor : nextToken ? ( nextQuery.get( 'Page' ) || '' ) + '~' + nextToken : null,
117
- items : ( result?.available_phone_numbers || [] ).map( ( entry ) => ({
118
- friendly : entry.friendly_name,
119
- locality : entry.locality || entry.region || null,
120
- number : entry.phone_number
121
- }) )
120
+ cursor : items.length === limit ? String( page + 1 ) : null,
121
+ items
122
122
  };
123
123
 
124
124
  },
package/dist/twilio.d.ts CHANGED
@@ -81,11 +81,15 @@ const twilio = {
81
81
 
82
82
  if( ! accountSid || ! authToken ) throw new Error( 'Twilio credentials missing — accountSid, authToken' );
83
83
 
84
- // The vendor pages with Page + PageToken and answers next_page_uri
85
- // (AvailablePhoneNumbers resource docs). Ours is one opaque cursor —
86
- // `<Page>~<PageToken>` so the caller never learns the vendor's two
87
- // halves and cannot recombine them wrong.
88
- const [ page, token ] = String( cursor || '' ).split( '~' );
84
+ // PAGING, as the vendor actually does it rather than as its docs say.
85
+ // The AvailablePhoneNumbers reference lists PageToken/next_page_uri, but
86
+ // the resource returns NO next_page_uri at all (measured 2026-09-03)
87
+ // while a bare Page index works and answers a different set. So the
88
+ // cursor is simply the page number, and "is there a next page" is the
89
+ // full-page heuristic: a short page is the last one. (A page-boundary
90
+ // exact fit costs one empty page at the end — the trade for a vendor
91
+ // that will not say how much inventory it has.)
92
+ const page = Number( cursor ) || 0;
89
93
 
90
94
  const result = await request$1({
91
95
  method : 'GET',
@@ -101,24 +105,20 @@ const twilio = {
101
105
  // match anywhere in the number, so one search box serves "my
102
106
  // area code" and "ends in 7777" alike.
103
107
  ...( contains && { Contains : contains } ),
104
- ...( token && { Page : page, PageToken : token } )
108
+ ...( page && { Page : page } )
105
109
  }
106
110
  });
107
111
 
108
- const nextQuery = result?.next_page_uri
109
- ? new URLSearchParams( String( result.next_page_uri ).split( '?' )[ 1 ] || '' )
110
- : null;
111
-
112
- const nextToken = nextQuery?.get( 'PageToken' );
112
+ const items = ( result?.available_phone_numbers || [] ).map( ( entry ) => ({
113
+ friendly : entry.friendly_name,
114
+ locality : entry.locality || entry.region || null,
115
+ number : entry.phone_number
116
+ }) );
113
117
 
114
118
  // The caller-facing shape is ours; the vendor's field names stay here.
115
119
  return {
116
- cursor : nextToken ? ( nextQuery.get( 'Page' ) || '' ) + '~' + nextToken : null,
117
- items : ( result?.available_phone_numbers || [] ).map( ( entry ) => ({
118
- friendly : entry.friendly_name,
119
- locality : entry.locality || entry.region || null,
120
- number : entry.phone_number
121
- }) )
120
+ cursor : items.length === limit ? String( page + 1 ) : null,
121
+ items
122
122
  };
123
123
 
124
124
  },
package/dist/twilio.js CHANGED
@@ -90,7 +90,7 @@ var twilio = {
90
90
  // Basic auth throughout, like Messages.
91
91
  searchNumbers: async ({ accountSid, areaCode, authToken, contains, country = "US", cursor, limit = 10, request: request2 = request }) => {
92
92
  if (!accountSid || !authToken) throw new Error("Twilio credentials missing \u2014 accountSid, authToken");
93
- const [page, token] = String(cursor || "").split("~");
93
+ const page = Number(cursor) || 0;
94
94
  const result = await request2({
95
95
  method: "GET",
96
96
  url: "https://api.twilio.com/2010-04-01/Accounts/" + accountSid + "/AvailablePhoneNumbers/" + country + "/Local.json",
@@ -105,18 +105,17 @@ var twilio = {
105
105
  // match anywhere in the number, so one search box serves "my
106
106
  // area code" and "ends in 7777" alike.
107
107
  ...contains && { Contains: contains },
108
- ...token && { Page: page, PageToken: token }
108
+ ...page && { Page: page }
109
109
  }
110
110
  });
111
- const nextQuery = (result == null ? void 0 : result.next_page_uri) ? new URLSearchParams(String(result.next_page_uri).split("?")[1] || "") : null;
112
- const nextToken = nextQuery == null ? void 0 : nextQuery.get("PageToken");
111
+ const items = ((result == null ? void 0 : result.available_phone_numbers) || []).map((entry) => ({
112
+ friendly: entry.friendly_name,
113
+ locality: entry.locality || entry.region || null,
114
+ number: entry.phone_number
115
+ }));
113
116
  return {
114
- cursor: nextToken ? (nextQuery.get("Page") || "") + "~" + nextToken : null,
115
- items: ((result == null ? void 0 : result.available_phone_numbers) || []).map((entry) => ({
116
- friendly: entry.friendly_name,
117
- locality: entry.locality || entry.region || null,
118
- number: entry.phone_number
119
- }))
117
+ cursor: items.length === limit ? String(page + 1) : null,
118
+ items
120
119
  };
121
120
  },
122
121
  purchaseNumber: async ({ accountSid, authToken, number, request: request2 = request, smsUrl }) => {
package/package.json CHANGED
@@ -215,5 +215,5 @@
215
215
  "test": ". \"$HOME/.nvm/nvm.sh\" && nvm use && node --test"
216
216
  },
217
217
  "types": "dist/index.d.ts",
218
- "version": "0.0.130"
218
+ "version": "0.0.132"
219
219
  }