@rebasepro/server 0.10.1-canary.ff9ccd6 → 0.10.1-canary.g4db1bb1
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.
- package/dist/api/rest/api-generator.d.ts +20 -0
- package/dist/api/rest/idempotency.d.ts +20 -0
- package/dist/auth/rate-limit-store.d.ts +8 -1
- package/dist/chunk-DSJWtz9O.js +40 -0
- package/dist/index.es.js +279 -3253
- package/dist/index.es.js.map +1 -1
- package/dist/init/health.d.ts +11 -2
- package/dist/init.d.ts +9 -3
- package/dist/{jwt-Dj7r7QX7.js → jwt-D-eI6TTu.js} +4 -39
- package/dist/{jwt-Dj7r7QX7.js.map → jwt-D-eI6TTu.js.map} +1 -1
- package/dist/{openapi-generator-C3_pTcsb.js → openapi-generator-CeOnlAJ3.js} +11 -12
- package/dist/openapi-generator-CeOnlAJ3.js.map +1 -0
- package/dist/{schema-editor-routes-CF-g0gVN.js → schema-editor-routes-BFpXKkPD.js} +2 -2
- package/dist/{schema-editor-routes-CF-g0gVN.js.map → schema-editor-routes-BFpXKkPD.js.map} +1 -1
- package/dist/{src-DRUswG_w.js → src-BYbxB4PR.js} +8 -2
- package/dist/src-BYbxB4PR.js.map +1 -0
- package/dist/src-q6_elgGZ.js +3183 -0
- package/dist/src-q6_elgGZ.js.map +1 -0
- package/package.json +5 -5
- package/dist/openapi-generator-C3_pTcsb.js.map +0 -1
- package/dist/src-DRUswG_w.js.map +0 -1
|
@@ -16,6 +16,12 @@ export declare class RestApiGenerator {
|
|
|
16
16
|
private listLimits;
|
|
17
17
|
private authAdapter?;
|
|
18
18
|
constructor(collections: CollectionConfig[], driver: DataDriver, authAdapter?: AuthAdapter, maxBulkRows?: number, listLimits?: ListLimitOptions);
|
|
19
|
+
/**
|
|
20
|
+
* Built on first use rather than in the constructor: it probes the driver
|
|
21
|
+
* for SQL support and creates a table, and most requests never send a key.
|
|
22
|
+
*/
|
|
23
|
+
private idempotencyStore?;
|
|
24
|
+
private idempotency;
|
|
19
25
|
/**
|
|
20
26
|
* Parse request query params into QueryOptions, applying this generator's
|
|
21
27
|
* list-pagination bounds (default page size + hard max limit) so no read
|
|
@@ -41,6 +47,20 @@ export declare class RestApiGenerator {
|
|
|
41
47
|
* slug, never an id.
|
|
42
48
|
*/
|
|
43
49
|
private enforceSubcollectionApiKeyPermission;
|
|
50
|
+
/**
|
|
51
|
+
* The collection a nested path writes into — the target of the relation its
|
|
52
|
+
* last segment names.
|
|
53
|
+
*
|
|
54
|
+
* Needed so a nested write can be checked against a schema at all. Without
|
|
55
|
+
* it these routes skipped `assertKnownWriteFields` entirely, which is why a
|
|
56
|
+
* typo `POST /posts` rejected with a 400 while the same typo on
|
|
57
|
+
* `POST /authors/1/posts` reached the database.
|
|
58
|
+
*
|
|
59
|
+
* Returns `undefined` rather than throwing when the path cannot be walked:
|
|
60
|
+
* the driver raises the authoritative error a moment later, and duplicating
|
|
61
|
+
* it here would report a resolution failure as a validation failure.
|
|
62
|
+
*/
|
|
63
|
+
private resolveNestedWriteCollection;
|
|
44
64
|
/**
|
|
45
65
|
* Get the request-scoped driver. Throws if none is set — never falls
|
|
46
66
|
* back to the unscoped `this.driver` to avoid bypassing RLS/auth.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DataDriver } from "@rebasepro/types";
|
|
2
|
+
export interface IdempotencyStore {
|
|
3
|
+
/** What this key answered before, or `undefined` if it is new. */
|
|
4
|
+
recall(key: string, uid: string | undefined): Promise<unknown | undefined>;
|
|
5
|
+
/** Record what this key answered. Never throws — see {@link createIdempotencyStore}. */
|
|
6
|
+
remember(key: string, uid: string | undefined, response: unknown): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Returns `undefined` when the driver cannot run SQL, which disables the whole
|
|
10
|
+
* mechanism rather than failing writes: a document backend has no table to put
|
|
11
|
+
* this in, and refusing to serve is far worse than the duplicate this prevents.
|
|
12
|
+
*
|
|
13
|
+
* Every method swallows its own errors for the same reason. A write must not
|
|
14
|
+
* fail because the bookkeeping around it did — the worst case of a failed
|
|
15
|
+
* `remember` is the duplicate we already have today, while a thrown error would
|
|
16
|
+
* reject a write the database has already accepted.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createIdempotencyStore(driver: DataDriver): IdempotencyStore | undefined;
|
|
19
|
+
/** The header the client sends. Matches the widely used Stripe/IETF spelling. */
|
|
20
|
+
export declare const IDEMPOTENCY_HEADER = "Idempotency-Key";
|
|
@@ -42,7 +42,14 @@ export interface RateLimitStore {
|
|
|
42
42
|
export declare class MemoryRateLimitStore implements RateLimitStore {
|
|
43
43
|
private store;
|
|
44
44
|
private cleanupInterval?;
|
|
45
|
-
|
|
45
|
+
private now;
|
|
46
|
+
/**
|
|
47
|
+
* `now` exists so the window can be driven directly instead of by sleeping:
|
|
48
|
+
* a test that waits half a real window is a test that fails on a loaded
|
|
49
|
+
* machine, where the sleep overruns and the hits it expects to still be in
|
|
50
|
+
* the window have left it.
|
|
51
|
+
*/
|
|
52
|
+
constructor(sweepMs?: number, now?: () => number);
|
|
46
53
|
hit(key: string, windowMs: number, limit: number): Promise<RateLimitDecision>;
|
|
47
54
|
private sweep;
|
|
48
55
|
dispose(): void;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "module";
|
|
2
|
+
import "process";
|
|
3
|
+
const require = __createRequire(import.meta.url);
|
|
4
|
+
//#region \0rolldown/runtime.js
|
|
5
|
+
var __create = Object.create;
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
9
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
10
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
12
|
+
var __exportAll = (all, no_symbols) => {
|
|
13
|
+
let target = {};
|
|
14
|
+
for (var name in all) __defProp(target, name, {
|
|
15
|
+
get: all[name],
|
|
16
|
+
enumerable: true
|
|
17
|
+
});
|
|
18
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
19
|
+
return target;
|
|
20
|
+
};
|
|
21
|
+
var __copyProps = (to, from, except, desc) => {
|
|
22
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
23
|
+
key = keys[i];
|
|
24
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
25
|
+
get: ((k) => from[k]).bind(null, key),
|
|
26
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return to;
|
|
30
|
+
};
|
|
31
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
32
|
+
value: mod,
|
|
33
|
+
enumerable: true
|
|
34
|
+
}) : target, mod));
|
|
35
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
|
|
36
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
37
|
+
throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
38
|
+
});
|
|
39
|
+
//#endregion
|
|
40
|
+
export { __toESM as i, __exportAll as n, __require as r, __commonJSMin as t };
|