@supabase/postgrest-js 0.37.2 → 1.0.0-next.2

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.
Files changed (133) hide show
  1. package/README.md +4 -4
  2. package/dist/main/PostgrestBuilder.d.ts +24 -0
  3. package/dist/main/PostgrestBuilder.d.ts.map +1 -0
  4. package/dist/main/{lib/types.js → PostgrestBuilder.js} +36 -26
  5. package/dist/main/PostgrestBuilder.js.map +1 -0
  6. package/dist/main/PostgrestClient.d.ts +19 -20
  7. package/dist/main/PostgrestClient.d.ts.map +1 -1
  8. package/dist/main/PostgrestClient.js +37 -14
  9. package/dist/main/PostgrestClient.js.map +1 -1
  10. package/dist/main/{lib/PostgrestFilterBuilder.d.ts → PostgrestFilterBuilder.d.ts} +47 -90
  11. package/dist/main/PostgrestFilterBuilder.d.ts.map +1 -0
  12. package/dist/main/PostgrestFilterBuilder.js +162 -0
  13. package/dist/main/PostgrestFilterBuilder.js.map +1 -0
  14. package/dist/main/PostgrestQueryBuilder.d.ts +69 -0
  15. package/dist/main/PostgrestQueryBuilder.d.ts.map +1 -0
  16. package/dist/main/{lib/PostgrestQueryBuilder.js → PostgrestQueryBuilder.js} +81 -44
  17. package/dist/main/PostgrestQueryBuilder.js.map +1 -0
  18. package/dist/{module/lib → main}/PostgrestTransformBuilder.d.ts +14 -7
  19. package/dist/main/PostgrestTransformBuilder.d.ts.map +1 -0
  20. package/dist/main/{lib/PostgrestTransformBuilder.js → PostgrestTransformBuilder.js} +16 -31
  21. package/dist/main/PostgrestTransformBuilder.js.map +1 -0
  22. package/dist/main/{lib/constants.d.ts → constants.d.ts} +0 -0
  23. package/dist/main/constants.d.ts.map +1 -0
  24. package/dist/main/{lib/constants.js → constants.js} +0 -0
  25. package/dist/main/constants.js.map +1 -0
  26. package/dist/main/index.d.ts +6 -5
  27. package/dist/main/index.d.ts.map +1 -1
  28. package/dist/main/index.js +11 -9
  29. package/dist/main/index.js.map +1 -1
  30. package/dist/main/select-query-parser.d.ts +141 -0
  31. package/dist/main/select-query-parser.d.ts.map +1 -0
  32. package/dist/main/select-query-parser.js +4 -0
  33. package/dist/main/select-query-parser.js.map +1 -0
  34. package/dist/main/types.d.ts +54 -0
  35. package/dist/main/types.d.ts.map +1 -0
  36. package/dist/main/types.js +3 -0
  37. package/dist/main/types.js.map +1 -0
  38. package/dist/main/version.d.ts +2 -0
  39. package/dist/main/version.d.ts.map +1 -0
  40. package/dist/main/{lib/version.js → version.js} +1 -2
  41. package/dist/main/version.js.map +1 -0
  42. package/dist/module/PostgrestBuilder.d.ts +24 -0
  43. package/dist/module/PostgrestBuilder.d.ts.map +1 -0
  44. package/dist/module/{lib/types.js → PostgrestBuilder.js} +36 -25
  45. package/dist/module/PostgrestBuilder.js.map +1 -0
  46. package/dist/module/PostgrestClient.d.ts +19 -20
  47. package/dist/module/PostgrestClient.d.ts.map +1 -1
  48. package/dist/module/PostgrestClient.js +37 -14
  49. package/dist/module/PostgrestClient.js.map +1 -1
  50. package/dist/module/{lib/PostgrestFilterBuilder.d.ts → PostgrestFilterBuilder.d.ts} +47 -90
  51. package/dist/module/PostgrestFilterBuilder.d.ts.map +1 -0
  52. package/dist/module/PostgrestFilterBuilder.js +156 -0
  53. package/dist/module/PostgrestFilterBuilder.js.map +1 -0
  54. package/dist/module/PostgrestQueryBuilder.d.ts +69 -0
  55. package/dist/module/PostgrestQueryBuilder.d.ts.map +1 -0
  56. package/dist/module/PostgrestQueryBuilder.js +169 -0
  57. package/dist/module/PostgrestQueryBuilder.js.map +1 -0
  58. package/dist/{main/lib → module}/PostgrestTransformBuilder.d.ts +14 -7
  59. package/dist/module/PostgrestTransformBuilder.d.ts.map +1 -0
  60. package/dist/module/{lib/PostgrestTransformBuilder.js → PostgrestTransformBuilder.js} +12 -30
  61. package/dist/module/PostgrestTransformBuilder.js.map +1 -0
  62. package/dist/module/{lib/constants.d.ts → constants.d.ts} +0 -0
  63. package/dist/module/constants.d.ts.map +1 -0
  64. package/dist/module/{lib/constants.js → constants.js} +0 -0
  65. package/dist/module/constants.js.map +1 -0
  66. package/dist/module/index.d.ts +6 -5
  67. package/dist/module/index.d.ts.map +1 -1
  68. package/dist/module/index.js +5 -5
  69. package/dist/module/index.js.map +1 -1
  70. package/dist/module/select-query-parser.d.ts +141 -0
  71. package/dist/module/select-query-parser.d.ts.map +1 -0
  72. package/dist/module/select-query-parser.js +3 -0
  73. package/dist/module/select-query-parser.js.map +1 -0
  74. package/dist/module/types.d.ts +54 -0
  75. package/dist/module/types.d.ts.map +1 -0
  76. package/dist/module/types.js +2 -0
  77. package/dist/module/types.js.map +1 -0
  78. package/dist/module/version.d.ts +2 -0
  79. package/dist/module/version.d.ts.map +1 -0
  80. package/dist/module/version.js +2 -0
  81. package/dist/module/version.js.map +1 -0
  82. package/package.json +19 -20
  83. package/dist/main/lib/PostgrestFilterBuilder.d.ts.map +0 -1
  84. package/dist/main/lib/PostgrestFilterBuilder.js +0 -396
  85. package/dist/main/lib/PostgrestFilterBuilder.js.map +0 -1
  86. package/dist/main/lib/PostgrestQueryBuilder.d.ts +0 -80
  87. package/dist/main/lib/PostgrestQueryBuilder.d.ts.map +0 -1
  88. package/dist/main/lib/PostgrestQueryBuilder.js.map +0 -1
  89. package/dist/main/lib/PostgrestRpcBuilder.d.ts +0 -20
  90. package/dist/main/lib/PostgrestRpcBuilder.d.ts.map +0 -1
  91. package/dist/main/lib/PostgrestRpcBuilder.js +0 -41
  92. package/dist/main/lib/PostgrestRpcBuilder.js.map +0 -1
  93. package/dist/main/lib/PostgrestTransformBuilder.d.ts.map +0 -1
  94. package/dist/main/lib/PostgrestTransformBuilder.js.map +0 -1
  95. package/dist/main/lib/constants.d.ts.map +0 -1
  96. package/dist/main/lib/constants.js.map +0 -1
  97. package/dist/main/lib/types.d.ts +0 -64
  98. package/dist/main/lib/types.d.ts.map +0 -1
  99. package/dist/main/lib/types.js.map +0 -1
  100. package/dist/main/lib/version.d.ts +0 -2
  101. package/dist/main/lib/version.d.ts.map +0 -1
  102. package/dist/main/lib/version.js.map +0 -1
  103. package/dist/module/lib/PostgrestFilterBuilder.d.ts.map +0 -1
  104. package/dist/module/lib/PostgrestFilterBuilder.js +0 -390
  105. package/dist/module/lib/PostgrestFilterBuilder.js.map +0 -1
  106. package/dist/module/lib/PostgrestQueryBuilder.d.ts +0 -80
  107. package/dist/module/lib/PostgrestQueryBuilder.d.ts.map +0 -1
  108. package/dist/module/lib/PostgrestQueryBuilder.js +0 -132
  109. package/dist/module/lib/PostgrestQueryBuilder.js.map +0 -1
  110. package/dist/module/lib/PostgrestRpcBuilder.d.ts +0 -20
  111. package/dist/module/lib/PostgrestRpcBuilder.d.ts.map +0 -1
  112. package/dist/module/lib/PostgrestRpcBuilder.js +0 -35
  113. package/dist/module/lib/PostgrestRpcBuilder.js.map +0 -1
  114. package/dist/module/lib/PostgrestTransformBuilder.d.ts.map +0 -1
  115. package/dist/module/lib/PostgrestTransformBuilder.js.map +0 -1
  116. package/dist/module/lib/constants.d.ts.map +0 -1
  117. package/dist/module/lib/constants.js.map +0 -1
  118. package/dist/module/lib/types.d.ts +0 -64
  119. package/dist/module/lib/types.d.ts.map +0 -1
  120. package/dist/module/lib/types.js.map +0 -1
  121. package/dist/module/lib/version.d.ts +0 -2
  122. package/dist/module/lib/version.d.ts.map +0 -1
  123. package/dist/module/lib/version.js +0 -3
  124. package/dist/module/lib/version.js.map +0 -1
  125. package/src/PostgrestClient.ts +0 -94
  126. package/src/index.ts +0 -21
  127. package/src/lib/PostgrestFilterBuilder.ts +0 -469
  128. package/src/lib/PostgrestQueryBuilder.ts +0 -230
  129. package/src/lib/PostgrestRpcBuilder.ts +0 -58
  130. package/src/lib/PostgrestTransformBuilder.ts +0 -138
  131. package/src/lib/constants.ts +0 -2
  132. package/src/lib/types.ts +0 -183
  133. package/src/lib/version.ts +0 -2
package/README.md CHANGED
@@ -25,10 +25,10 @@ const REST_URL = 'http://localhost:3000'
25
25
  const postgrest = new PostgrestClient(REST_URL)
26
26
  ```
27
27
 
28
- - select(): https://supabase.io/docs/reference/javascript/select
29
- - insert(): https://supabase.io/docs/reference/javascript/insert
30
- - update(): https://supabase.io/docs/reference/javascript/update
31
- - delete(): https://supabase.io/docs/reference/javascript/delete
28
+ - select(): https://supabase.com/docs/reference/javascript/select
29
+ - insert(): https://supabase.com/docs/reference/javascript/insert
30
+ - update(): https://supabase.com/docs/reference/javascript/update
31
+ - delete(): https://supabase.com/docs/reference/javascript/delete
32
32
 
33
33
  #### Custom `fetch` implementation
34
34
 
@@ -0,0 +1,24 @@
1
+ import type { Fetch, PostgrestResponse } from './types';
2
+ export default abstract class PostgrestBuilder<Result> implements PromiseLike<PostgrestResponse<Result>> {
3
+ protected method: 'GET' | 'HEAD' | 'POST' | 'PATCH' | 'DELETE';
4
+ protected url: URL;
5
+ protected headers: Record<string, string>;
6
+ protected schema?: string;
7
+ protected body?: unknown;
8
+ protected shouldThrowOnError: boolean;
9
+ protected signal?: AbortSignal;
10
+ protected fetch: Fetch;
11
+ protected allowEmpty: boolean;
12
+ constructor(builder: PostgrestBuilder<Result>);
13
+ /**
14
+ * If there's an error with the query, throwOnError will reject the promise by
15
+ * throwing the error instead of returning it as part of a successful response.
16
+ *
17
+ * {@link https://github.com/supabase/supabase-js/issues/92}
18
+ *
19
+ * @deprecated Use `throwOnError` in the `PostgrestClient` constructor instead.
20
+ */
21
+ throwOnError(throwOnError?: boolean): this;
22
+ then<TResult1 = PostgrestResponse<Result>, TResult2 = never>(onfulfilled?: ((value: PostgrestResponse<Result>) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>;
23
+ }
24
+ //# sourceMappingURL=PostgrestBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PostgrestBuilder.d.ts","sourceRoot":"","sources":["../../src/PostgrestBuilder.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAA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
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.PostgrestBuilder = void 0;
16
15
  const cross_fetch_1 = __importDefault(require("cross-fetch"));
17
16
  class PostgrestBuilder {
18
17
  constructor(builder) {
19
- Object.assign(this, builder);
20
- let _fetch;
18
+ this.method = builder.method;
19
+ this.url = builder.url;
20
+ this.headers = builder.headers;
21
+ this.schema = builder.schema;
22
+ this.body = builder.body;
23
+ this.shouldThrowOnError = builder.shouldThrowOnError;
24
+ this.signal = builder.signal;
25
+ this.allowEmpty = builder.allowEmpty;
21
26
  if (builder.fetch) {
22
- _fetch = builder.fetch;
27
+ this.fetch = builder.fetch;
23
28
  }
24
29
  else if (typeof fetch === 'undefined') {
25
- _fetch = cross_fetch_1.default;
30
+ this.fetch = cross_fetch_1.default;
26
31
  }
27
32
  else {
28
- _fetch = fetch;
33
+ this.fetch = fetch;
29
34
  }
30
- this.fetch = (...args) => _fetch(...args);
31
- this.shouldThrowOnError = builder.shouldThrowOnError || false;
32
35
  }
33
36
  /**
34
37
  * If there's an error with the query, throwOnError will reject the promise by
35
38
  * throwing the error instead of returning it as part of a successful response.
36
39
  *
37
40
  * {@link https://github.com/supabase/supabase-js/issues/92}
41
+ *
42
+ * @deprecated Use `throwOnError` in the `PostgrestClient` constructor instead.
38
43
  */
39
44
  throwOnError(throwOnError) {
40
- if (throwOnError === null || throwOnError === undefined) {
41
- throwOnError = true;
42
- }
43
- this.shouldThrowOnError = throwOnError;
45
+ this.shouldThrowOnError = throwOnError !== null && throwOnError !== void 0 ? throwOnError : true;
44
46
  return this;
45
47
  }
46
48
  then(onfulfilled, onrejected) {
@@ -57,16 +59,21 @@ class PostgrestBuilder {
57
59
  if (this.method !== 'GET' && this.method !== 'HEAD') {
58
60
  this.headers['Content-Type'] = 'application/json';
59
61
  }
60
- let res = this.fetch(this.url.toString(), {
62
+ // NOTE: Invoke w/o `this` to avoid illegal invocation error.
63
+ // https://github.com/supabase/postgrest-js/pull/247
64
+ const _fetch = this.fetch;
65
+ let res = _fetch(this.url.toString(), {
61
66
  method: this.method,
62
67
  headers: this.headers,
63
68
  body: JSON.stringify(this.body),
64
69
  signal: this.signal,
65
70
  }).then((res) => __awaiter(this, void 0, void 0, function* () {
66
- var _a, _b, _c;
67
- let error = null;
68
- let data = null;
69
- let count = null;
71
+ var _a, _b, _c, _d;
72
+ let error = undefined;
73
+ let data = undefined;
74
+ let count = undefined;
75
+ let status = res.status;
76
+ let statusText = res.statusText;
70
77
  if (res.ok) {
71
78
  const isReturnMinimal = (_a = this.headers['Prefer']) === null || _a === void 0 ? void 0 : _a.split(',').includes('return=minimal');
72
79
  if (this.method !== 'HEAD' && !isReturnMinimal) {
@@ -92,11 +99,16 @@ class PostgrestBuilder {
92
99
  try {
93
100
  error = JSON.parse(body);
94
101
  }
95
- catch (_d) {
102
+ catch (_e) {
96
103
  error = {
97
104
  message: body,
98
105
  };
99
106
  }
107
+ if (error && this.allowEmpty && ((_d = error === null || error === void 0 ? void 0 : error.details) === null || _d === void 0 ? void 0 : _d.includes('Results contain 0 rows'))) {
108
+ error = undefined;
109
+ status = 200;
110
+ statusText = 'OK';
111
+ }
100
112
  if (error && this.shouldThrowOnError) {
101
113
  throw error;
102
114
  }
@@ -105,9 +117,8 @@ class PostgrestBuilder {
105
117
  error,
106
118
  data,
107
119
  count,
108
- status: res.status,
109
- statusText: res.statusText,
110
- body: data,
120
+ status,
121
+ statusText,
111
122
  };
112
123
  return postgrestResponse;
113
124
  }));
@@ -119,9 +130,8 @@ class PostgrestBuilder {
119
130
  hint: '',
120
131
  code: fetchError.code || '',
121
132
  },
122
- data: null,
123
- body: null,
124
- count: null,
133
+ data: undefined,
134
+ count: undefined,
125
135
  status: 400,
126
136
  statusText: 'Bad Request',
127
137
  }));
@@ -129,5 +139,5 @@ class PostgrestBuilder {
129
139
  return res.then(onfulfilled, onrejected);
130
140
  }
131
141
  }
132
- exports.PostgrestBuilder = PostgrestBuilder;
133
- //# sourceMappingURL=types.js.map
142
+ exports.default = PostgrestBuilder;
143
+ //# sourceMappingURL=PostgrestBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PostgrestBuilder.js","sourceRoot":"","sources":["../../src/PostgrestBuilder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,8DAAoC;AAIpC,MAA8B,gBAAgB;IAa5C,YAAY,OAAiC;QAC3C,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;QAC5B,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;QACtB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;QAC9B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;QAC5B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;QACxB,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAA;QACpD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;QAC5B,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAA;QAEpC,IAAI,OAAO,CAAC,KAAK,EAAE;YACjB,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAA;SAC3B;aAAM,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;YACvC,IAAI,CAAC,KAAK,GAAG,qBAAU,CAAA;SACxB;aAAM;YACL,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;SACnB;IACH,CAAC;IAED;;;;;;;OAOG;IACH,YAAY,CAAC,YAAsB;QACjC,IAAI,CAAC,kBAAkB,GAAG,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,IAAI,CAAA;QAC9C,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI,CACF,WAGQ,EACR,UAAmF;QAEnF,6DAA6D;QAC7D,IAAI,OAAO,IAAI,CAAC,MAAM,KAAK,WAAW,EAAE;YACtC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AM,KAAK,CAAA;iBACZ;aACF;YAED,MAAM,iBAAiB,GAAG;gBACxB,KAAK;gBACL,IAAI;gBACJ,KAAK;gBACL,MAAM;gBACN,UAAU;aACX,CAAA;YAED,OAAO,iBAAiB,CAAA;QAC1B,CAAC,CAAA,CAAC,CAAA;QACF,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE;YAC5B,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;gBAC/B,KAAK,EAAE;oBACL,OAAO,EAAE,eAAe,UAAU,CAAC,OAAO,EAAE;oBAC5C,OAAO,EAAE,EAAE;oBACX,IAAI,EAAE,EAAE;oBACR,IAAI,EAAE,UAAU,CAAC,IAAI,IAAI,EAAE;iBAC5B;gBACD,IAAI,EAAE,SAAS;gBACf,KAAK,EAAE,SAAS;gBAChB,MAAM,EAAE,GAAG;gBACX,UAAU,EAAE,aAAa;aAC1B,CAAC,CAAC,CAAA;SACJ;QAED,OAAO,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAA;IAC1C,CAAC;CACF;AAlJD,mCAkJC"}
@@ -1,14 +1,12 @@
1
- import PostgrestQueryBuilder from './lib/PostgrestQueryBuilder';
2
- import PostgrestFilterBuilder from './lib/PostgrestFilterBuilder';
3
- import { Fetch } from './lib/types';
4
- export default class PostgrestClient {
1
+ import PostgrestQueryBuilder from './PostgrestQueryBuilder';
2
+ import PostgrestFilterBuilder from './PostgrestFilterBuilder';
3
+ import { Fetch, GenericSchema } from './types';
4
+ export default class PostgrestClient<Database = any, SchemaName extends string & keyof Database = 'public' extends keyof Database ? 'public' : string & keyof Database, Schema extends GenericSchema = Database[SchemaName] extends GenericSchema ? Database[SchemaName] : any> {
5
5
  url: string;
6
- headers: {
7
- [key: string]: string;
8
- };
9
- schema?: string;
6
+ headers: Record<string, string>;
7
+ schema?: SchemaName;
10
8
  fetch?: Fetch;
11
- shouldThrowOnError?: boolean;
9
+ shouldThrowOnError: boolean;
12
10
  /**
13
11
  * Creates a PostgREST client.
14
12
  *
@@ -17,10 +15,8 @@ export default class PostgrestClient {
17
15
  * @param schema Postgres schema to switch to.
18
16
  */
19
17
  constructor(url: string, { headers, schema, fetch, throwOnError, }?: {
20
- headers?: {
21
- [key: string]: string;
22
- };
23
- schema?: string;
18
+ headers?: Record<string, string>;
19
+ schema?: SchemaName;
24
20
  fetch?: Fetch;
25
21
  throwOnError?: boolean;
26
22
  });
@@ -28,6 +24,8 @@ export default class PostgrestClient {
28
24
  * Authenticates the request with JWT.
29
25
  *
30
26
  * @param token The JWT token to use.
27
+ *
28
+ * @deprecated Use `headers` in constructor instead.
31
29
  */
32
30
  auth(token: string): this;
33
31
  /**
@@ -35,18 +33,19 @@ export default class PostgrestClient {
35
33
  *
36
34
  * @param table The table name to operate on.
37
35
  */
38
- from<T = any>(table: string): PostgrestQueryBuilder<T>;
36
+ from<TableName extends string & keyof Schema['Tables'], Table extends Schema['Tables'][TableName]>(table: TableName): PostgrestQueryBuilder<Table>;
39
37
  /**
40
38
  * Perform a function call.
41
39
  *
42
40
  * @param fn The function name to call.
43
- * @param params The parameters to pass to the function call.
44
- * @param head When set to true, no data will be returned.
45
- * @param count Count algorithm to use to count rows in a table.
41
+ * @param args The parameters to pass to the function call.
42
+ * @param options Named parameters.
43
+ * @param options.head When set to true, no data will be returned.
44
+ * @param options.count Count algorithm to use to count rows in a table.
46
45
  */
47
- rpc<T = any>(fn: string, params?: object, { head, count, }?: {
46
+ rpc<FunctionName extends string & keyof Schema['Functions'], Function_ extends Schema['Functions'][FunctionName]>(fn: FunctionName, args?: Function_['Args'], { head, count, }?: {
48
47
  head?: boolean;
49
- count?: null | 'exact' | 'planned' | 'estimated';
50
- }): PostgrestFilterBuilder<T>;
48
+ count?: 'exact' | 'planned' | 'estimated';
49
+ }): PostgrestFilterBuilder<Function_['Returns'] extends any[] ? Function_['Returns'][number] extends Record<string, unknown> ? Function_['Returns'][number] : never : never, Function_['Returns']>;
51
50
  }
52
51
  //# sourceMappingURL=PostgrestClient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PostgrestClient.d.ts","sourceRoot":"","sources":["../../src/PostgrestClient.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,6BAA6B,CAAA;AAE/D,OAAO,sBAAsB,MAAM,8BAA8B,CAAA;AAEjE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEnC,MAAM,CAAC,OAAO,OAAO,eAAe;IAClC,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IAClC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAE5B;;;;;;OAMG;gBAED,GAAG,EAAE,MAAM,EACX,EACE,OAAY,EACZ,MAAM,EACN,KAAK,EACL,YAAY,GACb,GAAE;QACD,OAAO,CAAC,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAA;QACnC,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,KAAK,CAAC,EAAE,KAAK,CAAA;QACb,YAAY,CAAC,EAAE,OAAO,CAAA;KAClB;IASR;;;;OAIG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKzB;;;;OAIG;IACH,IAAI,CAAC,CAAC,GAAG,GAAG,EAAE,KAAK,EAAE,MAAM,GAAG,qBAAqB,CAAC,CAAC,CAAC;IAUtD;;;;;;;OAOG;IACH,GAAG,CAAC,CAAC,GAAG,GAAG,EACT,EAAE,EAAE,MAAM,EACV,MAAM,CAAC,EAAE,MAAM,EACf,EACE,IAAY,EACZ,KAAY,GACb,GAAE;QACD,IAAI,CAAC,EAAE,OAAO,CAAA;QACd,KAAK,CAAC,EAAE,IAAI,GAAG,OAAO,GAAG,SAAS,GAA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,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,EACzC,KAAK,EAAE,SAAS,GAAG,qBAAqB,CAAC,KAAK,CAAC;IAUjD;;;;;;;;OAQG;IACH,GAAG,CACD,YAAY,SAAS,MAAM,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,EACvD,SAAS,SAAS,MAAM,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,EAEnD,EAAE,EAAE,YAAY,EAChB,IAAI,GAAE,SAAS,CAAC,MAAM,CAAM,EAC5B,EACE,IAAY,EACZ,KAAK,GACN,GAAE;QACD,IAAI,CAAC,EAAE,OAAO,CAAA;QACd,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,WAAW,CAAA;KACrC,GACL,sBAAsB,CACvB,SAAS,CAAC,SAAS,CAAC,SAAS,GAAG,EAAE,GAC9B,SAAS,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC1D,SAAS,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,GAC5B,KAAK,GACP,KAAK,EACT,SAAS,CAAC,SAAS,CAAC,CACrB;CA8BF"}
@@ -3,9 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const PostgrestQueryBuilder_1 = __importDefault(require("./lib/PostgrestQueryBuilder"));
7
- const PostgrestRpcBuilder_1 = __importDefault(require("./lib/PostgrestRpcBuilder"));
8
- const constants_1 = require("./lib/constants");
6
+ const PostgrestQueryBuilder_1 = __importDefault(require("./PostgrestQueryBuilder"));
7
+ const PostgrestFilterBuilder_1 = __importDefault(require("./PostgrestFilterBuilder"));
8
+ const constants_1 = require("./constants");
9
9
  class PostgrestClient {
10
10
  /**
11
11
  * Creates a PostgREST client.
@@ -14,7 +14,7 @@ class PostgrestClient {
14
14
  * @param headers Custom headers.
15
15
  * @param schema Postgres schema to switch to.
16
16
  */
17
- constructor(url, { headers = {}, schema, fetch, throwOnError, } = {}) {
17
+ constructor(url, { headers = {}, schema, fetch, throwOnError = false, } = {}) {
18
18
  this.url = url;
19
19
  this.headers = Object.assign(Object.assign({}, constants_1.DEFAULT_HEADERS), headers);
20
20
  this.schema = schema;
@@ -25,6 +25,8 @@ class PostgrestClient {
25
25
  * Authenticates the request with JWT.
26
26
  *
27
27
  * @param token The JWT token to use.
28
+ *
29
+ * @deprecated Use `headers` in constructor instead.
28
30
  */
29
31
  auth(token) {
30
32
  this.headers['Authorization'] = `Bearer ${token}`;
@@ -36,9 +38,9 @@ class PostgrestClient {
36
38
  * @param table The table name to operate on.
37
39
  */
38
40
  from(table) {
39
- const url = `${this.url}/${table}`;
41
+ const url = new URL(`${this.url}/${table}`);
40
42
  return new PostgrestQueryBuilder_1.default(url, {
41
- headers: this.headers,
43
+ headers: Object.assign({}, this.headers),
42
44
  schema: this.schema,
43
45
  fetch: this.fetch,
44
46
  shouldThrowOnError: this.shouldThrowOnError,
@@ -48,18 +50,39 @@ class PostgrestClient {
48
50
  * Perform a function call.
49
51
  *
50
52
  * @param fn The function name to call.
51
- * @param params The parameters to pass to the function call.
52
- * @param head When set to true, no data will be returned.
53
- * @param count Count algorithm to use to count rows in a table.
53
+ * @param args The parameters to pass to the function call.
54
+ * @param options Named parameters.
55
+ * @param options.head When set to true, no data will be returned.
56
+ * @param options.count Count algorithm to use to count rows in a table.
54
57
  */
55
- rpc(fn, params, { head = false, count = null, } = {}) {
56
- const url = `${this.url}/rpc/${fn}`;
57
- return new PostgrestRpcBuilder_1.default(url, {
58
- headers: this.headers,
58
+ rpc(fn, args = {}, { head = false, count, } = {}) {
59
+ let method;
60
+ const url = new URL(`${this.url}/rpc/${fn}`);
61
+ let body;
62
+ if (head) {
63
+ method = 'HEAD';
64
+ Object.entries(args).forEach(([name, value]) => {
65
+ url.searchParams.append(name, `${value}`);
66
+ });
67
+ }
68
+ else {
69
+ method = 'POST';
70
+ body = args;
71
+ }
72
+ const headers = Object.assign({}, this.headers);
73
+ if (count) {
74
+ headers['Prefer'] = `count=${count}`;
75
+ }
76
+ return new PostgrestFilterBuilder_1.default({
77
+ method,
78
+ url,
79
+ headers,
59
80
  schema: this.schema,
81
+ body,
60
82
  fetch: this.fetch,
61
83
  shouldThrowOnError: this.shouldThrowOnError,
62
- }).rpc(params, { head, count });
84
+ allowEmpty: false,
85
+ });
63
86
  }
64
87
  }
65
88
  exports.default = PostgrestClient;
@@ -1 +1 @@
1
- {"version":3,"file":"PostgrestClient.js","sourceRoot":"","sources":["../../src/PostgrestClient.ts"],"names":[],"mappings":";;;;;AAAA,wFAA+D;AAC/D,oFAA2D;AAE3D,+CAAiD;AAGjD,MAAqB,eAAe;IAOlC;;;;;;OAMG;IACH,YACE,GAAW,EACX,EACE,OAAO,GAAG,EAAE,EACZ,MAAM,EACN,KAAK,EACL,YAAY,MAMV,EAAE;QAEN,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,OAAO,mCAAQ,2BAAe,GAAK,OAAO,CAAE,CAAA;QACjD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,kBAAkB,GAAG,YAAY,CAAA;IACxC,CAAC;IAED;;;;OAIG;IACH,IAAI,CAAC,KAAa;QAChB,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,KAAK,EAAE,CAAA;QACjD,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;;;OAIG;IACH,IAAI,CAAU,KAAa;QACzB,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,KAAK,EAAE,CAAA;QAClC,OAAO,IAAI,+BAAqB,CAAI,GAAG,EAAE;YACvC,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,KAAK,EAAE,IAAI,CAAC,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