@rebasepro/server 0.20.0 → 0.21.0
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/{admin_block-0Xu0r6eZ.js → admin_block-DxKLmdiv.js} +26 -8
- package/dist/{admin_block-0Xu0r6eZ.js.map → admin_block-DxKLmdiv.js.map} +1 -1
- package/dist/api/ast-schema-editor.d.ts +15 -0
- package/dist/api/rest/api-generator.d.ts +28 -0
- package/dist/{ast-schema-editor-C6mDz0XN.js → ast-schema-editor-CslO8Oje.js} +24 -4
- package/dist/ast-schema-editor-CslO8Oje.js.map +1 -0
- package/dist/auth/jwt.d.ts +67 -0
- package/dist/auth/rls-scope.d.ts +14 -0
- package/dist/{auth-DJsLXsCR.js → auth-gzoRjnuh.js} +24 -12
- package/dist/auth-gzoRjnuh.js.map +1 -0
- package/dist/boot/env.d.ts +8 -2
- package/dist/boot/fetch-bundle.d.ts +19 -0
- package/dist/boot/role.d.ts +2 -0
- package/dist/contract-routes-eLxV0le1.js.map +1 -1
- package/dist/{cron-routes-Bfwni8Zg.js → cron-routes-BamgO0Xr.js} +2 -2
- package/dist/{cron-routes-Bfwni8Zg.js.map → cron-routes-BamgO0Xr.js.map} +1 -1
- package/dist/{cron-store-Bsiw4Q6u.js → cron-store-yXOyIEmn.js} +2 -3
- package/dist/{cron-store-Bsiw4Q6u.js.map → cron-store-yXOyIEmn.js.map} +1 -1
- package/dist/db/ambient-transaction.d.ts +48 -0
- package/dist/ddl-bootstrap-CfNvxMuK.js.map +1 -1
- package/dist/deploy/pod-contract.d.ts +1 -1
- package/dist/errors-DMImyqyR.js.map +1 -1
- package/dist/functions/index.js.map +1 -1
- package/dist/{history-recorder-r5_IzSHK.js → history-recorder-hBGuXcZc.js} +2 -2
- package/dist/{history-recorder-r5_IzSHK.js.map → history-recorder-hBGuXcZc.js.map} +1 -1
- package/dist/{history-store-D4RVK-uZ.js → history-store-C9EtGtoL.js} +5 -6
- package/dist/history-store-C9EtGtoL.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.es.js +2266 -93
- package/dist/index.es.js.map +1 -1
- package/dist/init/callback-client.d.ts +16 -0
- package/dist/init/surfaces.d.ts +37 -7
- package/dist/jobs/types.d.ts +5 -0
- package/dist/{jobs-CW5lm_Ix.js → jobs-DZ8DLLcU.js} +82 -13
- package/dist/jobs-DZ8DLLcU.js.map +1 -0
- package/dist/{jwt-DATvkKB_.js → jwt-C4OW-DNq.js} +136 -4
- package/dist/jwt-C4OW-DNq.js.map +1 -0
- package/dist/logger-DO2PZc4i.js.map +1 -1
- package/dist/mcp/consent-page.d.ts +75 -0
- package/dist/mcp/mcp-routes.d.ts +52 -0
- package/dist/mcp/mcp-tools.d.ts +51 -0
- package/dist/mcp/oauth-metadata.d.ts +123 -0
- package/dist/mcp/oauth-routes.d.ts +52 -0
- package/dist/mcp/oauth-store.d.ts +157 -0
- package/dist/metrics/index.d.ts +16 -1
- package/dist/{openapi-generator-DGyLbISS.js → openapi-generator-CAFKF36E.js} +2 -8
- package/dist/openapi-generator-CAFKF36E.js.map +1 -0
- package/dist/{query-parser-BQiPZrM-.js → query-parser-uqzkZ82i.js} +2 -2
- package/dist/{query-parser-BQiPZrM-.js.map → query-parser-uqzkZ82i.js.map} +1 -1
- package/dist/{schema-editor-routes-C3TLZqAC.js → schema-editor-routes-BKOmdf4M.js} +2 -2
- package/dist/{schema-editor-routes-C3TLZqAC.js.map → schema-editor-routes-BKOmdf4M.js.map} +1 -1
- package/dist/services/webhook-service.d.ts +11 -8
- package/dist/sql-rows-C6GEc2oE.js +45 -0
- package/dist/sql-rows-C6GEc2oE.js.map +1 -0
- package/dist/src-Br6ARbs6.js.map +1 -1
- package/dist/{src-DqZ9YiGA.js → src-DW1cQ_28.js} +261 -17
- package/dist/src-DW1cQ_28.js.map +1 -0
- package/dist/utils/portable-crypto.d.ts +8 -0
- package/package.json +5 -5
- package/dist/ast-schema-editor-C6mDz0XN.js.map +0 -1
- package/dist/auth-DJsLXsCR.js.map +0 -1
- package/dist/history-store-D4RVK-uZ.js.map +0 -1
- package/dist/internal-tables-DYVcFFSv.js +0 -117
- package/dist/internal-tables-DYVcFFSv.js.map +0 -1
- package/dist/jobs-CW5lm_Ix.js.map +0 -1
- package/dist/jwt-DATvkKB_.js.map +0 -1
- package/dist/openapi-generator-DGyLbISS.js.map +0 -1
- package/dist/src-DqZ9YiGA.js.map +0 -1
|
@@ -87,21 +87,6 @@ var RebaseClientError = class extends RebaseApiError {
|
|
|
87
87
|
* agree about it, and a module-local symbol would not.
|
|
88
88
|
*/
|
|
89
89
|
var UNSUPPORTED_METHOD = Symbol.for("rebase.unsupportedMethod");
|
|
90
|
-
/**
|
|
91
|
-
* Build the stub a client installs for a contract method it cannot serve.
|
|
92
|
-
*
|
|
93
|
-
* `listen`, `listenById` and `count` are part of `SDKCollectionClient`, not
|
|
94
|
-
* optional extras — a caller should be able to write
|
|
95
|
-
* `client.data.posts.count()` without asking first, and a transport that cannot
|
|
96
|
-
* serve it should answer with a sentence naming the configuration that would,
|
|
97
|
-
* rather than with `undefined is not a function` at the call site. Where the
|
|
98
|
-
* transport genuinely cannot (a client built with `realtime: false`, a driver
|
|
99
|
-
* with no `listenCollection`), it installs one of these instead of omitting the
|
|
100
|
-
* method.
|
|
101
|
-
*
|
|
102
|
-
* @param message What to tell the caller, naming the fix.
|
|
103
|
-
* @group Errors
|
|
104
|
-
*/
|
|
105
90
|
function unsupportedMethod(message) {
|
|
106
91
|
const stub = () => {
|
|
107
92
|
throw new RebaseClientError(message, { code: "REALTIME_DISABLED" });
|
|
@@ -256,6 +241,34 @@ var Vector = class {
|
|
|
256
241
|
}
|
|
257
242
|
};
|
|
258
243
|
//#endregion
|
|
244
|
+
//#region ../types/src/types/relations.ts
|
|
245
|
+
/**
|
|
246
|
+
* The key a junction row's own columns are carried under, in both directions.
|
|
247
|
+
*
|
|
248
|
+
* A read that includes a `manyToMany` relation serves each related row with its
|
|
249
|
+
* link's columns nested here — `{ id: 5, name: "ts", _pivot: { role: "owner" } }`
|
|
250
|
+
* — and a membership write may name the same key on an element to state what
|
|
251
|
+
* the link should hold. One constant because the two have to be the same word:
|
|
252
|
+
* a wire name that differs between the read and the write it round-trips
|
|
253
|
+
* through is a shape no client can echo back.
|
|
254
|
+
*
|
|
255
|
+
* Leading underscore, like `_matches`: it reads as metadata about the row
|
|
256
|
+
* rather than as one of its columns. A payload property may not be named
|
|
257
|
+
* `_pivot` either — `checkJunctionPayload` refuses it — so the key means one
|
|
258
|
+
* thing wherever it appears.
|
|
259
|
+
*
|
|
260
|
+
* @group Models
|
|
261
|
+
*/
|
|
262
|
+
var JUNCTION_PIVOT_KEY = "_pivot";
|
|
263
|
+
/** @group Models */
|
|
264
|
+
function isManyToMany(relation) {
|
|
265
|
+
return relation.kind === "manyToMany";
|
|
266
|
+
}
|
|
267
|
+
/** @group Models */
|
|
268
|
+
function isToMany(relation) {
|
|
269
|
+
return relation.cardinality === "many";
|
|
270
|
+
}
|
|
271
|
+
//#endregion
|
|
259
272
|
//#region ../types/src/types/policy.ts
|
|
260
273
|
/**
|
|
261
274
|
* The id a request without a logged-in user reports as `rebase.uid()`.
|
|
@@ -1761,6 +1774,35 @@ function toWireKey(columnName) {
|
|
|
1761
1774
|
if (segments.length <= 1) return columnName;
|
|
1762
1775
|
return segments.map((segment, index) => index === 0 ? segment.charAt(0).toLowerCase() + segment.slice(1) : segment.charAt(0).toUpperCase() + segment.slice(1)).join("");
|
|
1763
1776
|
}
|
|
1777
|
+
/**
|
|
1778
|
+
* Release a Node handle's hold on the event loop, where the runtime has one.
|
|
1779
|
+
*
|
|
1780
|
+
* `unref` is Node's, not the web platform's. Node ref-counts the handles that
|
|
1781
|
+
* can keep a process alive — timers, `BroadcastChannel`, sockets — and gives
|
|
1782
|
+
* each an `unref()` that says "you are still live, but do not be the reason
|
|
1783
|
+
* this process refuses to exit". The browser's equivalents have no such method:
|
|
1784
|
+
* `setTimeout` there returns a plain number, and nothing is holding a page open
|
|
1785
|
+
* in the first place.
|
|
1786
|
+
*
|
|
1787
|
+
* So the call is genuinely conditional at runtime, in every package that runs
|
|
1788
|
+
* in both places. Spelled out at the call site it came to
|
|
1789
|
+
* `(handle as unknown as { unref?: () => void }).unref?.()` — a double cast,
|
|
1790
|
+
* because where the DOM declaration of `setTimeout` wins the handle is a
|
|
1791
|
+
* `number`, and `number` does not overlap an object type, so a single `as` is
|
|
1792
|
+
* refused. The `unknown` in the middle was there to make the refusal go away,
|
|
1793
|
+
* and it also discarded the check on the member's name and signature. There
|
|
1794
|
+
* were seven copies, which is seven chances to get one of those wrong.
|
|
1795
|
+
*
|
|
1796
|
+
* Takes `unknown` on purpose: the argument's type is exactly what is not known
|
|
1797
|
+
* here, and narrowing it to a timer would be a claim this cannot make about a
|
|
1798
|
+
* `BroadcastChannel`. A no-op on a browser handle, on `null`/`undefined`, and
|
|
1799
|
+
* on a Node timer that has already fired.
|
|
1800
|
+
*/
|
|
1801
|
+
function unref(handle) {
|
|
1802
|
+
if (handle === null || typeof handle !== "object") return;
|
|
1803
|
+
const fn = handle.unref;
|
|
1804
|
+
if (typeof fn === "function") fn.call(handle);
|
|
1805
|
+
}
|
|
1764
1806
|
//#endregion
|
|
1765
1807
|
//#region ../common/src/util/entities.ts
|
|
1766
1808
|
/**
|
|
@@ -2775,6 +2817,43 @@ function getEffectiveSecurityRules(collection) {
|
|
|
2775
2817
|
return [...explicit, ...injected];
|
|
2776
2818
|
}
|
|
2777
2819
|
policy.or(policy.serverContext(), policy.rolesOverlap(["admin"]));
|
|
2820
|
+
/**
|
|
2821
|
+
* The same synthetic collection, reached from a resolved relation rather than
|
|
2822
|
+
* from a spec.
|
|
2823
|
+
*
|
|
2824
|
+
* The spec is built by walking every collection, which the schema planner does
|
|
2825
|
+
* once at boot and no request path can afford. A read or a write already holds
|
|
2826
|
+
* the relation, and a relation's `through` carries the table, both key columns
|
|
2827
|
+
* and the payload — everything the config is made of. One builder underneath
|
|
2828
|
+
* both, so the shape the planner emitted columns from is the shape the write
|
|
2829
|
+
* path validates a `_pivot` against and the read path strips it with.
|
|
2830
|
+
*/
|
|
2831
|
+
function getJunctionConfigForRelation(through) {
|
|
2832
|
+
return buildJunctionCollectionConfig({
|
|
2833
|
+
table: through.table.includes(".") ? through.table.split(".").pop() : through.table,
|
|
2834
|
+
schema: "public",
|
|
2835
|
+
keyColumns: [through.sourceColumn, through.targetColumn],
|
|
2836
|
+
properties: through.properties
|
|
2837
|
+
});
|
|
2838
|
+
}
|
|
2839
|
+
function buildJunctionCollectionConfig(args) {
|
|
2840
|
+
const properties = {};
|
|
2841
|
+
for (const column of args.keyColumns) properties[column] = {
|
|
2842
|
+
type: "string",
|
|
2843
|
+
columnName: column
|
|
2844
|
+
};
|
|
2845
|
+
for (const [key, property] of Object.entries(args.properties)) {
|
|
2846
|
+
if (key === "_pivot" || key in properties) continue;
|
|
2847
|
+
properties[key] = property;
|
|
2848
|
+
}
|
|
2849
|
+
return {
|
|
2850
|
+
slug: args.table,
|
|
2851
|
+
name: args.table,
|
|
2852
|
+
table: args.table,
|
|
2853
|
+
schema: args.schema,
|
|
2854
|
+
properties
|
|
2855
|
+
};
|
|
2856
|
+
}
|
|
2778
2857
|
(/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2779
2858
|
(function(root, factory) {
|
|
2780
2859
|
if (typeof define === "function" && define.amd) define(factory);
|
|
@@ -3052,6 +3131,170 @@ policy.or(policy.serverContext(), policy.rolesOverlap(["admin"]));
|
|
|
3052
3131
|
* Apply PropertyConditions to a resolved property, evaluating all JSON Logic rules.
|
|
3053
3132
|
*/
|
|
3054
3133
|
//#endregion
|
|
3134
|
+
//#region ../common/src/util/internal-tables.ts
|
|
3135
|
+
/**
|
|
3136
|
+
* The tables Rebase creates for its own bookkeeping, and the SQL that keeps the
|
|
3137
|
+
* end-user role away from them.
|
|
3138
|
+
*
|
|
3139
|
+
* ## Why this exists
|
|
3140
|
+
*
|
|
3141
|
+
* Authenticated requests run as {@link REBASE_USER_ROLE}, and the boot-time role
|
|
3142
|
+
* provisioning grants that role `SELECT, INSERT, UPDATE, DELETE` on every table
|
|
3143
|
+
* in the schemas a project uses — including `rebase`, because a project's own
|
|
3144
|
+
* collections are allowed to live there (the scaffold puts `users` there). It
|
|
3145
|
+
* also sets `ALTER DEFAULT PRIVILEGES`, so a table created *later* by the
|
|
3146
|
+
* migrating role inherits the same grant.
|
|
3147
|
+
*
|
|
3148
|
+
* Every framework-internal table is created later: auth's tables come up during
|
|
3149
|
+
* `initializeAuth`, `api_keys` during route mounting, `cron_logs` when the first
|
|
3150
|
+
* job registers, `idempotency_keys` on the first request that carries a key. So
|
|
3151
|
+
* they all inherited full DML for the end-user role — and none of them enables
|
|
3152
|
+
* row-level security, because none of them is a collection with
|
|
3153
|
+
* `securityRules`. Measured on a freshly provisioned database, `SET ROLE
|
|
3154
|
+
* rebase_user` could read `rebase.refresh_tokens` (session token hashes),
|
|
3155
|
+
* `rebase.mfa_factors` (`secret_encrypted`), `rebase.recovery_codes`, and
|
|
3156
|
+
* `rebase.api_keys` (including its `admin` flag), and insert into
|
|
3157
|
+
* `rebase.app_config`.
|
|
3158
|
+
*
|
|
3159
|
+
* Nothing routes a user-context query at those tables today, so this was not
|
|
3160
|
+
* reachable over the API. That is the wrong thing to depend on: the documented
|
|
3161
|
+
* model is that RLS is the authorization boundary, and these tables sat outside
|
|
3162
|
+
* it. The boundary is now a privilege boundary instead — the role simply cannot
|
|
3163
|
+
* address them.
|
|
3164
|
+
*
|
|
3165
|
+
* ## Why REVOKE rather than ENABLE ROW LEVEL SECURITY
|
|
3166
|
+
*
|
|
3167
|
+
* RLS with no policy denies every row, which is the same outcome, but it is the
|
|
3168
|
+
* *weaker* statement: it leaves the grant in place, so a later policy — or a
|
|
3169
|
+
* `FORCE` flag cleared by some future migration — reopens the table. There is no
|
|
3170
|
+
* row of `refresh_tokens` any end user should ever reach, so the honest encoding
|
|
3171
|
+
* is "this role has no privilege here at all". It also keeps the owner
|
|
3172
|
+
* connection (which auth actually runs on) completely unaffected.
|
|
3173
|
+
*
|
|
3174
|
+
* ## Keeping it true
|
|
3175
|
+
*
|
|
3176
|
+
* `packages/rls-check` scans the `rebase` schema — it used to skip it as a
|
|
3177
|
+
* "platform" schema — and its `rls-disabled` check fires on exactly the
|
|
3178
|
+
* condition this module removes: RLS off *and* a DML grant to a reachable role.
|
|
3179
|
+
* So a table added here without a revoke is caught by `pnpm rls:check`, not by
|
|
3180
|
+
* someone re-reading this file.
|
|
3181
|
+
*/
|
|
3182
|
+
/**
|
|
3183
|
+
* The Postgres role authenticated requests run as.
|
|
3184
|
+
*
|
|
3185
|
+
* Defined here rather than in the Postgres driver because both the driver (which
|
|
3186
|
+
* provisions the role) and this module (which revokes on its behalf) need it,
|
|
3187
|
+
* and a second spelling of a role name is a silent no-op waiting to happen.
|
|
3188
|
+
*/
|
|
3189
|
+
var REBASE_USER_ROLE = "rebase_user";
|
|
3190
|
+
/**
|
|
3191
|
+
* Framework-internal table names, unqualified.
|
|
3192
|
+
*
|
|
3193
|
+
* Deliberately NOT including `users`: the auth user table is also a collection,
|
|
3194
|
+
* with `securityRules`, RLS enabled and policies applied. Users read their own
|
|
3195
|
+
* row through it — revoking there would break sign-in. `revokeInternalTableSql`
|
|
3196
|
+
* now skips any table with RLS enabled, so that exception is enforced rather
|
|
3197
|
+
* than merely remembered — and so is the same hazard for every other name here,
|
|
3198
|
+
* any of which a project may legitimately use for a collection of its own.
|
|
3199
|
+
*
|
|
3200
|
+
* `atlas_schema_revisions` is Atlas's migration ledger, which lands in `rebase`
|
|
3201
|
+
* because `db migrate apply` passes `--revisions-schema rebase`.
|
|
3202
|
+
*
|
|
3203
|
+
* Every entry here must also be revoked by whatever creates it, and vice versa:
|
|
3204
|
+
* the creation-time revoke fires once, on the boot that first makes the table,
|
|
3205
|
+
* so it cannot help a database provisioned before that revoke existed. This
|
|
3206
|
+
* list is what the boot-time sweep in `ensureAppRole` iterates, and the sweep
|
|
3207
|
+
* is the only thing that can repair an already-granted table. A table revoked
|
|
3208
|
+
* at creation but missing here is therefore permanently stranded on any
|
|
3209
|
+
* database that predates its revoke.
|
|
3210
|
+
*
|
|
3211
|
+
* These names are unqualified, and the boot-time sweep applies them to every
|
|
3212
|
+
* schema a project uses — so an entry here is a claim on that name in `public`
|
|
3213
|
+
* as much as in `rebase`. `jobs` is Rebase's queue at `rebase.jobs` AND a
|
|
3214
|
+
* perfectly ordinary collection name, and revoking `public.jobs` from a project
|
|
3215
|
+
* that owns it leaves every read failing 42501 with correct policies applied
|
|
3216
|
+
* and nothing in the RLS logs to explain it. The `relrowsecurity` guard in
|
|
3217
|
+
* `revokeInternalTableSql` is what makes a common noun safe here — it is not a
|
|
3218
|
+
* licence to claim more of them.
|
|
3219
|
+
*/
|
|
3220
|
+
var REBASE_INTERNAL_TABLES = [
|
|
3221
|
+
"user_identities",
|
|
3222
|
+
"refresh_tokens",
|
|
3223
|
+
"password_reset_tokens",
|
|
3224
|
+
"magic_link_tokens",
|
|
3225
|
+
"mfa_factors",
|
|
3226
|
+
"mfa_challenges",
|
|
3227
|
+
"recovery_codes",
|
|
3228
|
+
"app_config",
|
|
3229
|
+
"schema_meta",
|
|
3230
|
+
"api_keys",
|
|
3231
|
+
"cron_logs",
|
|
3232
|
+
"cron_claims",
|
|
3233
|
+
"jobs",
|
|
3234
|
+
"rate_limit_hits",
|
|
3235
|
+
"idempotency_keys",
|
|
3236
|
+
"entity_history",
|
|
3237
|
+
"branches",
|
|
3238
|
+
"metric_samples",
|
|
3239
|
+
"channel_messages",
|
|
3240
|
+
"channel_cursors",
|
|
3241
|
+
"channel_presence",
|
|
3242
|
+
"atlas_schema_revisions"
|
|
3243
|
+
];
|
|
3244
|
+
/** Postgres identifiers this module is willing to interpolate. */
|
|
3245
|
+
var SAFE_IDENTIFIER = /^[A-Za-z_][A-Za-z0-9_$]*$/;
|
|
3246
|
+
/**
|
|
3247
|
+
* A single statement that takes every privilege on `schema.table` away from the
|
|
3248
|
+
* end-user role.
|
|
3249
|
+
*
|
|
3250
|
+
* Wrapped in a `DO` block guarded on `pg_roles` for two reasons, both of which
|
|
3251
|
+
* happen in practice:
|
|
3252
|
+
*
|
|
3253
|
+
* - the role does not exist when the connection is unprivileged (Rebase then
|
|
3254
|
+
* relies on native RLS rather than a role switch), and a bare `REVOKE` on a
|
|
3255
|
+
* missing role is an error, not a no-op;
|
|
3256
|
+
* - the table may not exist yet — `cron_logs` never appears in a project with
|
|
3257
|
+
* no cron jobs — and `to_regclass` returning NULL has to be tolerated too.
|
|
3258
|
+
*
|
|
3259
|
+
* The third guard is the one that decides whether the *right* table is being
|
|
3260
|
+
* revoked. The names in {@link REBASE_INTERNAL_TABLES} are unqualified, and the
|
|
3261
|
+
* boot-time sweep in `ensureAppRole` applies all of them to every schema a
|
|
3262
|
+
* project uses — including the schema its own collections live in. A project is
|
|
3263
|
+
* free to call a collection `jobs`, `branches` or `api_keys`, and when it does,
|
|
3264
|
+
* the sweep was revoking `rebase_user`'s DML on the project's table on every
|
|
3265
|
+
* single boot. That is not a subtle degradation: the collection's whole API
|
|
3266
|
+
* answers 500 `permission denied for table …` from then on, which is what
|
|
3267
|
+
* happened to a public job board whose vacancies live in `public.jobs`.
|
|
3268
|
+
*
|
|
3269
|
+
* `relrowsecurity` separates the two cleanly, and it is the same fact this
|
|
3270
|
+
* module already relies on. Framework-internal tables carry no RLS — that is the
|
|
3271
|
+
* premise stated at the top of this file, and the reason a revoke is needed at
|
|
3272
|
+
* all. Every collection table has it enabled, because that is how Rebase
|
|
3273
|
+
* enforces `securityRules`. So "RLS is off" is exactly "this is not somebody's
|
|
3274
|
+
* collection", and the guard also subsumes the hand-carved `users` exception:
|
|
3275
|
+
* the auth user table is a collection, has RLS, and would now be skipped on its
|
|
3276
|
+
* own merits rather than by being kept off a list.
|
|
3277
|
+
*
|
|
3278
|
+
* One command, so it is safe on handles that speak the extended query protocol
|
|
3279
|
+
* and reject multi-statement strings.
|
|
3280
|
+
*/
|
|
3281
|
+
function revokeInternalTableSql(schema, table) {
|
|
3282
|
+
if (!SAFE_IDENTIFIER.test(schema)) throw new Error(`Refusing to build SQL with an unsafe schema name: ${JSON.stringify(schema)}`);
|
|
3283
|
+
if (!SAFE_IDENTIFIER.test(table)) throw new Error(`Refusing to build SQL with an unsafe table name: ${JSON.stringify(table)}`);
|
|
3284
|
+
const qualified = `"${schema}"."${table}"`;
|
|
3285
|
+
return `
|
|
3286
|
+
DO $rebase_revoke$
|
|
3287
|
+
BEGIN
|
|
3288
|
+
IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = '${REBASE_USER_ROLE}')
|
|
3289
|
+
AND to_regclass('${qualified}') IS NOT NULL
|
|
3290
|
+
AND NOT (SELECT relrowsecurity FROM pg_class WHERE oid = to_regclass('${qualified}')) THEN
|
|
3291
|
+
EXECUTE 'REVOKE ALL ON ${qualified} FROM ${REBASE_USER_ROLE}';
|
|
3292
|
+
END IF;
|
|
3293
|
+
END
|
|
3294
|
+
$rebase_revoke$;
|
|
3295
|
+
`.trim();
|
|
3296
|
+
}
|
|
3297
|
+
//#endregion
|
|
3055
3298
|
//#region ../../node_modules/.pnpm/fast-equals@6.0.2/node_modules/fast-equals/dist/es/index.mjs
|
|
3056
3299
|
var { getOwnPropertyNames, getOwnPropertySymbols } = Object;
|
|
3057
3300
|
var { hasOwnProperty } = Object.prototype;
|
|
@@ -6219,7 +6462,8 @@ function buildRoutedRebaseData({ defaultData, sources, resolveKey }) {
|
|
|
6219
6462
|
return getAccessor(toSnakeCase(prop));
|
|
6220
6463
|
} });
|
|
6221
6464
|
}
|
|
6465
|
+
new Set(REBASE_INTERNAL_TABLES);
|
|
6222
6466
|
//#endregion
|
|
6223
|
-
export {
|
|
6467
|
+
export { resolveClientListLimit as $, createDataSourceRegistry as A, findRelation as B, decodeCursor as C, restrictedFieldNames as D, effectiveAccess as E, getJunctionConfigForRelation as F, buildCompositeId as G, isRelationRequired as H, getEffectiveSecurityRules as I, suggestNearMiss as J, resolvePrimaryKeys as K, getTenantConfig as L, resolveDataSource as M, REBASE_USER_ROLE as N, defaultUsersCollection as O, revokeInternalTableSql as P, MAX_LIST_LIMIT as Q, securityRuleToConditions as R, cursorToStartAfter as S, canWriteField as T, resolveCollectionRelations as U, getTableName as V, enumToObjectEntries as W, unref as X, toSnakeCase as Y, ListLimitError as Z, OrderBySpecError as _, deserializeLogicalCondition as a, isAnonymousUid as at, CursorError as b, collectAllPages as c, isToMany as ct, IncludeSpecError as d, GeoPoint as dt, BATCH_REF_KEY as et, deserializeInclude as f, Vector as ft, topLevelIncludeNames as g, unsupportedMethod as gt, serializeInclude as h, isUnsupported as ht, deserializeFilter as i, ANONYMOUS_USER_ID as it, isRelationalCollection as j, CollectionRegistry as k, paginateFind as l, EntityReference as lt, normalizeInclude as m, RebaseClientError as mt, buildSdkData as n, hasFieldOperation as nt, serializeFilter as o, JUNCTION_PIVOT_KEY as ot, mergeIncludeSpecs as p, RebaseApiError as pt, hydrateRegExp as q, UnknownFilterOperatorError as r, isFieldOperation as rt, serializeLogicalCondition as s, isManyToMany as st, buildRoutedRebaseData as t, FIELD_OPERATORS as tt, resolveFindWindow as u, EntityRelation as ut, normalizeOrderBy as v, reconcileCursorOrder as w, CursorMismatchError as x, serializeOrderBy as y, fieldKeyForColumn as z };
|
|
6224
6468
|
|
|
6225
|
-
//# sourceMappingURL=src-
|
|
6469
|
+
//# sourceMappingURL=src-DW1cQ_28.js.map
|