@flatfile/listener 0.3.19-rc1 → 0.3.19-rc2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"authenticated.client.d.ts","sourceRoot":"","sources":["../../src/events/authenticated.client.ts"],"names":[],"mappings":"AAIA,qBAAa,mBAAmB;IACvB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;gBAEX,WAAW,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;IAa3C,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG;IAwBtC;;;OAGG;IACI,YAAY,CAAC,EAClB,WAAW,EACX,MAAM,GACP,EAAE;QACD,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB;CAIF"}
1
+ {"version":3,"file":"authenticated.client.d.ts","sourceRoot":"","sources":["../../src/events/authenticated.client.ts"],"names":[],"mappings":"AAIA,qBAAa,mBAAmB;IACvB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;gBAEX,WAAW,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;IAa3C,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG;IAoCtC;;;OAGG;IACI,YAAY,CAAC,EAClB,WAAW,EACX,MAAM,GACP,EAAE;QACD,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB;CAIF"}
package/dist/index.cjs CHANGED
@@ -2,12 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var axios = require('axios');
6
-
7
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
-
9
- var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
10
-
11
5
  // src/index.ts
12
6
  var CrossEnvConfig = class {
13
7
  /**
@@ -122,6 +116,44 @@ CrossEnvConfig._overrides = /* @__PURE__ */ new Map();
122
116
  */
123
117
  CrossEnvConfig._aliases = /* @__PURE__ */ new Map();
124
118
 
119
+ function getDefaultExportFromCjs (x) {
120
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
121
+ }
122
+
123
+ var browser = {exports: {}};
124
+
125
+ browser.exports;
126
+
127
+ (function (module, exports) {
128
+
129
+ // ref: https://github.com/tc39/proposal-global
130
+ var getGlobal = function () {
131
+ // the only reliable means to get the global object is
132
+ // `Function('return this')()`
133
+ // However, this causes CSP violations in Chrome apps.
134
+ if (typeof self !== 'undefined') { return self; }
135
+ if (typeof window !== 'undefined') { return window; }
136
+ if (typeof global !== 'undefined') { return global; }
137
+ throw new Error('unable to locate global object');
138
+ };
139
+
140
+ var global = getGlobal();
141
+
142
+ module.exports = exports = global.fetch;
143
+
144
+ // Needed for TypeScript and Webpack.
145
+ if (global.fetch) {
146
+ exports.default = global.fetch.bind(global);
147
+ }
148
+
149
+ exports.Headers = global.Headers;
150
+ exports.Request = global.Request;
151
+ exports.Response = global.Response;
152
+ } (browser, browser.exports));
153
+
154
+ var browserExports = browser.exports;
155
+ var fetch = /*@__PURE__*/getDefaultExportFromCjs(browserExports);
156
+
125
157
  const ensureSingleTrailingSlash = (url) => {
126
158
  // Remove all trailing slashes
127
159
  while (url.endsWith('/')) {
@@ -145,22 +177,31 @@ class AuthenticatedClient {
145
177
  const headers = {
146
178
  Authorization: `Bearer ${this._accessToken}`,
147
179
  'x-disable-hooks': 'true',
180
+ 'Content-Type': 'application/json',
181
+ ...options?.headers,
148
182
  };
149
- const axiosInstance = axios__default["default"].create({
150
- headers,
151
- validateStatus: (status) => {
152
- return status >= 200 && status <= 399;
153
- },
154
- });
155
183
  const fetchUrl = this._apiUrl + url;
156
- const config = {
157
- url: fetchUrl,
158
- method: 'GET',
159
- ...options,
184
+ const fetchOptions = {
185
+ method: options?.method || 'GET',
186
+ headers,
187
+ body: options?.body,
160
188
  };
161
189
  try {
162
- const resp = await axiosInstance(config);
163
- return resp.data.data;
190
+ const response = await fetch(fetchUrl, fetchOptions);
191
+ if (response.status >= 200 && response.status <= 399) {
192
+ const contentType = response.headers.get('content-type');
193
+ if (contentType && contentType.includes('application/json')) {
194
+ const responseData = (await response.json());
195
+ return responseData.data;
196
+ }
197
+ else {
198
+ const responseData = await response.text();
199
+ return responseData;
200
+ }
201
+ }
202
+ else {
203
+ throw new Error(`HTTP error! Status: ${response.status}`);
204
+ }
164
205
  }
165
206
  catch (err) {
166
207
  console.log('event.fetch error: ', err);
@@ -7374,10 +7415,6 @@ function wildcardMatch(pattern, options) {
7374
7415
  return fn;
7375
7416
  }
7376
7417
 
7377
- function getDefaultExportFromCjs (x) {
7378
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
7379
- }
7380
-
7381
7418
  var flat = flatten;
7382
7419
  flatten.flatten = flatten;
7383
7420
  flatten.unflatten = unflatten;
package/dist/index.js CHANGED
@@ -1,12 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('axios')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'axios'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.FlatFileListener = {}, global.axios));
5
- })(this, (function (exports, axios) { 'use strict';
6
-
7
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
-
9
- var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.FlatFileListener = {}));
5
+ })(this, (function (exports) { 'use strict';
10
6
 
11
7
  // src/index.ts
12
8
  var CrossEnvConfig = class {
@@ -122,6 +118,44 @@
122
118
  */
123
119
  CrossEnvConfig._aliases = /* @__PURE__ */ new Map();
124
120
 
121
+ function getDefaultExportFromCjs (x) {
122
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
123
+ }
124
+
125
+ var browser = {exports: {}};
126
+
127
+ browser.exports;
128
+
129
+ (function (module, exports) {
130
+
131
+ // ref: https://github.com/tc39/proposal-global
132
+ var getGlobal = function () {
133
+ // the only reliable means to get the global object is
134
+ // `Function('return this')()`
135
+ // However, this causes CSP violations in Chrome apps.
136
+ if (typeof self !== 'undefined') { return self; }
137
+ if (typeof window !== 'undefined') { return window; }
138
+ if (typeof global !== 'undefined') { return global; }
139
+ throw new Error('unable to locate global object');
140
+ };
141
+
142
+ var global = getGlobal();
143
+
144
+ module.exports = exports = global.fetch;
145
+
146
+ // Needed for TypeScript and Webpack.
147
+ if (global.fetch) {
148
+ exports.default = global.fetch.bind(global);
149
+ }
150
+
151
+ exports.Headers = global.Headers;
152
+ exports.Request = global.Request;
153
+ exports.Response = global.Response;
154
+ } (browser, browser.exports));
155
+
156
+ var browserExports = browser.exports;
157
+ var fetch = /*@__PURE__*/getDefaultExportFromCjs(browserExports);
158
+
125
159
  const ensureSingleTrailingSlash = (url) => {
126
160
  // Remove all trailing slashes
127
161
  while (url.endsWith('/')) {
@@ -145,22 +179,31 @@
145
179
  const headers = {
146
180
  Authorization: `Bearer ${this._accessToken}`,
147
181
  'x-disable-hooks': 'true',
182
+ 'Content-Type': 'application/json',
183
+ ...options?.headers,
148
184
  };
149
- const axiosInstance = axios__default["default"].create({
150
- headers,
151
- validateStatus: (status) => {
152
- return status >= 200 && status <= 399;
153
- },
154
- });
155
185
  const fetchUrl = this._apiUrl + url;
156
- const config = {
157
- url: fetchUrl,
158
- method: 'GET',
159
- ...options,
186
+ const fetchOptions = {
187
+ method: options?.method || 'GET',
188
+ headers,
189
+ body: options?.body,
160
190
  };
161
191
  try {
162
- const resp = await axiosInstance(config);
163
- return resp.data.data;
192
+ const response = await fetch(fetchUrl, fetchOptions);
193
+ if (response.status >= 200 && response.status <= 399) {
194
+ const contentType = response.headers.get('content-type');
195
+ if (contentType && contentType.includes('application/json')) {
196
+ const responseData = (await response.json());
197
+ return responseData.data;
198
+ }
199
+ else {
200
+ const responseData = await response.text();
201
+ return responseData;
202
+ }
203
+ }
204
+ else {
205
+ throw new Error(`HTTP error! Status: ${response.status}`);
206
+ }
164
207
  }
165
208
  catch (err) {
166
209
  console.log('event.fetch error: ', err);
@@ -7374,10 +7417,6 @@
7374
7417
  return fn;
7375
7418
  }
7376
7419
 
7377
- function getDefaultExportFromCjs (x) {
7378
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
7379
- }
7380
-
7381
7420
  var flat = flatten;
7382
7421
  flatten.flatten = flatten;
7383
7422
  flatten.unflatten = unflatten;
package/dist/index.mjs CHANGED
@@ -1,5 +1,3 @@
1
- import axios from 'axios';
2
-
3
1
  // src/index.ts
4
2
  var CrossEnvConfig = class {
5
3
  /**
@@ -114,6 +112,44 @@ CrossEnvConfig._overrides = /* @__PURE__ */ new Map();
114
112
  */
115
113
  CrossEnvConfig._aliases = /* @__PURE__ */ new Map();
116
114
 
115
+ function getDefaultExportFromCjs (x) {
116
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
117
+ }
118
+
119
+ var browser = {exports: {}};
120
+
121
+ browser.exports;
122
+
123
+ (function (module, exports) {
124
+
125
+ // ref: https://github.com/tc39/proposal-global
126
+ var getGlobal = function () {
127
+ // the only reliable means to get the global object is
128
+ // `Function('return this')()`
129
+ // However, this causes CSP violations in Chrome apps.
130
+ if (typeof self !== 'undefined') { return self; }
131
+ if (typeof window !== 'undefined') { return window; }
132
+ if (typeof global !== 'undefined') { return global; }
133
+ throw new Error('unable to locate global object');
134
+ };
135
+
136
+ var global = getGlobal();
137
+
138
+ module.exports = exports = global.fetch;
139
+
140
+ // Needed for TypeScript and Webpack.
141
+ if (global.fetch) {
142
+ exports.default = global.fetch.bind(global);
143
+ }
144
+
145
+ exports.Headers = global.Headers;
146
+ exports.Request = global.Request;
147
+ exports.Response = global.Response;
148
+ } (browser, browser.exports));
149
+
150
+ var browserExports = browser.exports;
151
+ var fetch = /*@__PURE__*/getDefaultExportFromCjs(browserExports);
152
+
117
153
  const ensureSingleTrailingSlash = (url) => {
118
154
  // Remove all trailing slashes
119
155
  while (url.endsWith('/')) {
@@ -137,22 +173,31 @@ class AuthenticatedClient {
137
173
  const headers = {
138
174
  Authorization: `Bearer ${this._accessToken}`,
139
175
  'x-disable-hooks': 'true',
176
+ 'Content-Type': 'application/json',
177
+ ...options?.headers,
140
178
  };
141
- const axiosInstance = axios.create({
142
- headers,
143
- validateStatus: (status) => {
144
- return status >= 200 && status <= 399;
145
- },
146
- });
147
179
  const fetchUrl = this._apiUrl + url;
148
- const config = {
149
- url: fetchUrl,
150
- method: 'GET',
151
- ...options,
180
+ const fetchOptions = {
181
+ method: options?.method || 'GET',
182
+ headers,
183
+ body: options?.body,
152
184
  };
153
185
  try {
154
- const resp = await axiosInstance(config);
155
- return resp.data.data;
186
+ const response = await fetch(fetchUrl, fetchOptions);
187
+ if (response.status >= 200 && response.status <= 399) {
188
+ const contentType = response.headers.get('content-type');
189
+ if (contentType && contentType.includes('application/json')) {
190
+ const responseData = (await response.json());
191
+ return responseData.data;
192
+ }
193
+ else {
194
+ const responseData = await response.text();
195
+ return responseData;
196
+ }
197
+ }
198
+ else {
199
+ throw new Error(`HTTP error! Status: ${response.status}`);
200
+ }
156
201
  }
157
202
  catch (err) {
158
203
  console.log('event.fetch error: ', err);
@@ -7366,10 +7411,6 @@ function wildcardMatch(pattern, options) {
7366
7411
  return fn;
7367
7412
  }
7368
7413
 
7369
- function getDefaultExportFromCjs (x) {
7370
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
7371
- }
7372
-
7373
7414
  var flat = flatten;
7374
7415
  flatten.flatten = flatten;
7375
7416
  flatten.unflatten = unflatten;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatfile/listener",
3
- "version": "0.3.19-rc1",
3
+ "version": "0.3.19-rc2",
4
4
  "description": "A PubSub Listener for configuring and using Flatfile",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",