@percher/shared 1.1.0 → 1.3.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/data-filter.d.ts +27 -0
- package/dist/data-filter.d.ts.map +1 -0
- package/dist/data-filter.js +288 -0
- package/dist/data-filter.js.map +1 -0
- package/dist/data-records.d.ts +359 -0
- package/dist/data-records.d.ts.map +1 -0
- package/dist/data-records.js +124 -0
- package/dist/data-records.js.map +1 -0
- package/dist/deployment-security.d.ts +32 -0
- package/dist/deployment-security.d.ts.map +1 -0
- package/dist/deployment-security.js +146 -0
- package/dist/deployment-security.js.map +1 -0
- package/dist/disposable-email-domains.d.ts +11 -0
- package/dist/disposable-email-domains.d.ts.map +1 -0
- package/dist/disposable-email-domains.js +112 -0
- package/dist/disposable-email-domains.js.map +1 -0
- package/dist/email-budget.d.ts +60 -0
- package/dist/email-budget.d.ts.map +1 -0
- package/dist/email-budget.js +135 -0
- package/dist/email-budget.js.map +1 -0
- package/dist/email-change.d.ts +11 -0
- package/dist/email-change.d.ts.map +1 -0
- package/dist/email-change.js +23 -0
- package/dist/email-change.js.map +1 -0
- package/dist/email-template.d.ts +19 -0
- package/dist/email-template.d.ts.map +1 -0
- package/dist/email-template.js +53 -0
- package/dist/email-template.js.map +1 -0
- package/dist/image-rejection.d.ts +45 -0
- package/dist/image-rejection.d.ts.map +1 -0
- package/dist/image-rejection.js +27 -0
- package/dist/image-rejection.js.map +1 -0
- package/dist/index.d.ts +14 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -2
- package/dist/index.js.map +1 -1
- package/dist/internal-sig.d.ts +2 -2
- package/dist/internal-sig.js +2 -2
- package/dist/ip-prefix.d.ts +43 -0
- package/dist/ip-prefix.d.ts.map +1 -0
- package/dist/ip-prefix.js +225 -0
- package/dist/ip-prefix.js.map +1 -0
- package/dist/legal-changes.d.ts +4 -2
- package/dist/legal-changes.d.ts.map +1 -1
- package/dist/legal-changes.js +124 -0
- package/dist/legal-changes.js.map +1 -1
- package/dist/legal.d.ts +14 -14
- package/dist/legal.d.ts.map +1 -1
- package/dist/legal.js +13 -13
- package/dist/legal.js.map +1 -1
- package/dist/limits.d.ts +11 -0
- package/dist/limits.d.ts.map +1 -1
- package/dist/limits.js +11 -0
- package/dist/limits.js.map +1 -1
- package/dist/oauth-scopes.d.ts +8 -0
- package/dist/oauth-scopes.d.ts.map +1 -1
- package/dist/oauth-scopes.js +11 -13
- package/dist/oauth-scopes.js.map +1 -1
- package/dist/platform.d.ts +3 -3
- package/dist/platform.js +3 -3
- package/dist/signup-capacity.d.ts +12 -0
- package/dist/signup-capacity.d.ts.map +1 -0
- package/dist/signup-capacity.js +29 -0
- package/dist/signup-capacity.js.map +1 -0
- package/dist/signup-day.d.ts +7 -0
- package/dist/signup-day.d.ts.map +1 -0
- package/dist/signup-day.js +42 -0
- package/dist/signup-day.js.map +1 -0
- package/dist/switches.d.ts.map +1 -1
- package/dist/switches.js +2 -1
- package/dist/switches.js.map +1 -1
- package/dist/verified-signup.d.ts +24 -0
- package/dist/verified-signup.d.ts.map +1 -0
- package/dist/verified-signup.js +58 -0
- package/dist/verified-signup.js.map +1 -0
- package/dist/waitlist-token.d.ts +49 -0
- package/dist/waitlist-token.d.ts.map +1 -0
- package/dist/waitlist-token.js +71 -0
- package/dist/waitlist-token.js.map +1 -0
- package/package.json +6 -1
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The data-tools contract: the record shapes, limits, path patterns and
|
|
3
|
+
* error codes shared by the API records routes, the MCP data tools, the
|
|
4
|
+
* client and the Connections editor (spec:
|
|
5
|
+
* docs/plans/IMPLEMENTING_data-tools-connector.md, §3–§5, §8, §10 and §11).
|
|
6
|
+
*
|
|
7
|
+
* Record operations run as an identity of the app (§10): a chosen app user,
|
|
8
|
+
* a visitor, or full access (the PocketBase superuser) as an explicit per-app
|
|
9
|
+
* opt-in. A grant covers all apps or selected apps (§11).
|
|
10
|
+
*
|
|
11
|
+
* Everything a record route returns came from the app's own users. Record
|
|
12
|
+
* contents, validation maps and `currentUpdated` are untrusted diagnostics:
|
|
13
|
+
* they never reach a recovery prompt or any other instruction field.
|
|
14
|
+
*/
|
|
15
|
+
/** A collection name in a data-route path (spec §4.1, `COLLECTION_RE`). */
|
|
16
|
+
export declare const DATA_COLLECTION_RE: RegExp;
|
|
17
|
+
/** A record id in a data-route path (spec §4.1, `RECORD_ID_RE`). */
|
|
18
|
+
export declare const DATA_RECORD_ID_RE: RegExp;
|
|
19
|
+
/** Request, response and expression bounds (spec §3, §4.1, §4.2). */
|
|
20
|
+
export declare const DATA_LIMITS: {
|
|
21
|
+
/** Request body, read as a capped stream. */
|
|
22
|
+
readonly bodyBytes: 262144;
|
|
23
|
+
/** Outward JSON, and every upstream body on decoded bytes before parsing. */
|
|
24
|
+
readonly responseBytes: 1048576;
|
|
25
|
+
readonly maxPage: 1000;
|
|
26
|
+
readonly maxPerPage: 100;
|
|
27
|
+
/** Each of `filter`, `sort` and `fields`. */
|
|
28
|
+
readonly expressionChars: 1024;
|
|
29
|
+
readonly filterMaxDepth: 16;
|
|
30
|
+
readonly filterMaxComparisons: 64;
|
|
31
|
+
/** Apps one grant's data access may list. */
|
|
32
|
+
readonly accessMaxApps: 50;
|
|
33
|
+
/** `GET /api/collections` paging for the schema route. */
|
|
34
|
+
readonly schemaPerPage: 200;
|
|
35
|
+
readonly schemaMaxPages: 10;
|
|
36
|
+
/** PocketBase's `DefaultSortExprLimit` (v0.40.5 `tools/search/provider.go:25`). */
|
|
37
|
+
readonly sortMaxItems: 8;
|
|
38
|
+
/** `duration` sent to PocketBase's impersonate endpoint. */
|
|
39
|
+
readonly actAsTokenSeconds: 900;
|
|
40
|
+
/** Upper bound on an impersonate token's in-memory cache life. */
|
|
41
|
+
readonly actAsCacheMaxSeconds: 600;
|
|
42
|
+
/** Picker candidates per page. */
|
|
43
|
+
readonly identityCandidatesPerPage: 20;
|
|
44
|
+
};
|
|
45
|
+
export declare const DATA_ACCESS_MODES: readonly ["read", "readwrite"];
|
|
46
|
+
/** `read` allows GET and `POST …/query`; `readwrite` allows every data route. */
|
|
47
|
+
export type DataAccessMode = (typeof DATA_ACCESS_MODES)[number];
|
|
48
|
+
export declare const DATA_IDENTITY_KINDS: readonly ["user", "visitor", "superuser"];
|
|
49
|
+
/**
|
|
50
|
+
* Who a connection acts as in one app (§10.2). There is no "unset" value:
|
|
51
|
+
* an absent identity is unset, so the empty state is never the widest one.
|
|
52
|
+
*/
|
|
53
|
+
export type DataIdentity =
|
|
54
|
+
/** A record of a non-system auth collection, both named by id. */
|
|
55
|
+
{
|
|
56
|
+
kind: "user";
|
|
57
|
+
collectionId: string;
|
|
58
|
+
recordId: string;
|
|
59
|
+
}
|
|
60
|
+
/** No Authorization header: the app's public rules. */
|
|
61
|
+
| {
|
|
62
|
+
kind: "visitor";
|
|
63
|
+
}
|
|
64
|
+
/** Explicit per-app opt-in: bypasses the app's rules. */
|
|
65
|
+
| {
|
|
66
|
+
kind: "superuser";
|
|
67
|
+
};
|
|
68
|
+
/** An identity kind, or `unset` where no identity is stored (reads as a visitor, refuses writes). */
|
|
69
|
+
export declare const DATA_ACTING_AS: readonly ["user", "visitor", "superuser", "unset"];
|
|
70
|
+
export type DataActingAs = (typeof DATA_ACTING_AS)[number];
|
|
71
|
+
export declare const DATA_ACCESS_SCOPES: readonly ["selected", "all"];
|
|
72
|
+
export type DataAccessScope = (typeof DATA_ACCESS_SCOPES)[number];
|
|
73
|
+
/**
|
|
74
|
+
* `oauth_grants.data_access` (§11.1); NULL means no access and the revision
|
|
75
|
+
* is its own column. An absent identity is unset: under `selected` only after
|
|
76
|
+
* migration 0176 rewrote an older row, under `all` for every app missing from
|
|
77
|
+
* `identities`.
|
|
78
|
+
*/
|
|
79
|
+
export type DataAccess =
|
|
80
|
+
/** 1..50 entries. */
|
|
81
|
+
{
|
|
82
|
+
scope: "selected";
|
|
83
|
+
apps: {
|
|
84
|
+
id: string;
|
|
85
|
+
mode: DataAccessMode;
|
|
86
|
+
identity?: DataIdentity;
|
|
87
|
+
}[];
|
|
88
|
+
}
|
|
89
|
+
/** Covers current and future apps; 0..50 identities, `superuser` only per app. */
|
|
90
|
+
| {
|
|
91
|
+
scope: "all";
|
|
92
|
+
mode: DataAccessMode;
|
|
93
|
+
identities: {
|
|
94
|
+
id: string;
|
|
95
|
+
identity: DataIdentity;
|
|
96
|
+
}[];
|
|
97
|
+
};
|
|
98
|
+
/** The setter form of {@link DataAccess}: every `selected` entry carries an identity (§10.2). */
|
|
99
|
+
export type DataAccessSet = {
|
|
100
|
+
scope: "selected";
|
|
101
|
+
apps: {
|
|
102
|
+
id: string;
|
|
103
|
+
mode: DataAccessMode;
|
|
104
|
+
identity: DataIdentity;
|
|
105
|
+
}[];
|
|
106
|
+
} | {
|
|
107
|
+
scope: "all";
|
|
108
|
+
mode: DataAccessMode;
|
|
109
|
+
identities: {
|
|
110
|
+
id: string;
|
|
111
|
+
identity: DataIdentity;
|
|
112
|
+
}[];
|
|
113
|
+
};
|
|
114
|
+
/** Body of `POST /internal/oauth-grants/:grantId/data-access`; `null` clears. */
|
|
115
|
+
export interface DataAccessUpdate {
|
|
116
|
+
userId: string;
|
|
117
|
+
access: DataAccessSet | null;
|
|
118
|
+
}
|
|
119
|
+
/** Body of `POST /internal/apps/:appId/data-token-access` (§10.2a); `null` is unset. */
|
|
120
|
+
export interface DataTokenAccessUpdate {
|
|
121
|
+
userId: string;
|
|
122
|
+
identity: DataIdentity | null;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* One `oauth_grant_data_access_outbox` row's payload (§11.5): identity
|
|
126
|
+
* classes only, never a record id, email or label. Under `all`, `apps` lists
|
|
127
|
+
* the apps with a chosen identity and may be empty. A payload without `v` is
|
|
128
|
+
* a pending notice from before the identity cut-over; the API decodes it with
|
|
129
|
+
* its own frozen copy of that shape (§10.10).
|
|
130
|
+
*/
|
|
131
|
+
export type DataAccessNoticePayload = {
|
|
132
|
+
v: 6;
|
|
133
|
+
grantId: string;
|
|
134
|
+
revision: number;
|
|
135
|
+
apps: {
|
|
136
|
+
name: string;
|
|
137
|
+
mode: DataAccessMode;
|
|
138
|
+
identity: DataActingAs;
|
|
139
|
+
}[];
|
|
140
|
+
} & ({
|
|
141
|
+
scope: "selected";
|
|
142
|
+
} | {
|
|
143
|
+
scope: "all";
|
|
144
|
+
mode: DataAccessMode;
|
|
145
|
+
});
|
|
146
|
+
/** One `app_data_token_access_outbox` row's payload (§10.2a); the mode is fixed. */
|
|
147
|
+
export interface DataTokenAccessNoticePayload {
|
|
148
|
+
v: 6;
|
|
149
|
+
appId: string;
|
|
150
|
+
revision: number;
|
|
151
|
+
appName: string;
|
|
152
|
+
identity: DataActingAs;
|
|
153
|
+
}
|
|
154
|
+
export declare const DATA_NOT_RUNNING_REASONS: readonly ["sleeping", "suspended", "stopped", "not_deployed"];
|
|
155
|
+
/** `extra.reason` on 503 `PB_NOT_RUNNING`. */
|
|
156
|
+
export type DataNotRunningReason = (typeof DATA_NOT_RUNNING_REASONS)[number];
|
|
157
|
+
/** One field in the schema projection; never rules or auth config. */
|
|
158
|
+
export interface DataFieldSummary {
|
|
159
|
+
name: string;
|
|
160
|
+
type: string;
|
|
161
|
+
required: boolean;
|
|
162
|
+
hidden: boolean;
|
|
163
|
+
/** Select and relation fields only. */
|
|
164
|
+
options?: {
|
|
165
|
+
values?: string[];
|
|
166
|
+
maxSelect?: number;
|
|
167
|
+
collectionId?: string;
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
/** The five PocketBase collection rules, and `extra.op` on `PB_RULE_DENIED`. */
|
|
171
|
+
export declare const DATA_RULE_OPS: readonly ["list", "view", "create", "update", "delete"];
|
|
172
|
+
export type DataRuleOp = (typeof DATA_RULE_OPS)[number];
|
|
173
|
+
/**
|
|
174
|
+
* A rule's class (§10.6): null → `superuser_only`, non-empty → `rule` (the
|
|
175
|
+
* result depends on the rule, not that it is allowed), empty → `public`.
|
|
176
|
+
* The rule text itself is never returned.
|
|
177
|
+
*/
|
|
178
|
+
export declare const DATA_RULE_CLASSES: readonly ["superuser_only", "rule", "public"];
|
|
179
|
+
export type DataRuleClass = (typeof DATA_RULE_CLASSES)[number];
|
|
180
|
+
export type DataCollectionAccess = Record<DataRuleOp, DataRuleClass>;
|
|
181
|
+
/** One reachable collection in `GET /apps/:appRef/data/schema` (§10.6). */
|
|
182
|
+
export interface DataCollectionSummary {
|
|
183
|
+
name: string;
|
|
184
|
+
type: "base" | "auth" | "view";
|
|
185
|
+
/** False for auth and view collections, and when create, update and delete are all `superuser_only` (unless acting as superuser). */
|
|
186
|
+
writable: boolean;
|
|
187
|
+
fields: DataFieldSummary[];
|
|
188
|
+
access: DataCollectionAccess;
|
|
189
|
+
}
|
|
190
|
+
/** Body of `GET /apps/:appRef/data/schema` (§10.6). */
|
|
191
|
+
export interface DataSchemaResponse {
|
|
192
|
+
collections: DataCollectionSummary[];
|
|
193
|
+
actingAs: DataActingAs;
|
|
194
|
+
/** Collections whose five rules are all `superuser_only`, left out unless acting as superuser; never named. */
|
|
195
|
+
omittedByRules: number;
|
|
196
|
+
}
|
|
197
|
+
/** A record with hidden fields projected out. */
|
|
198
|
+
export interface DataRecord {
|
|
199
|
+
id: string;
|
|
200
|
+
[field: string]: unknown;
|
|
201
|
+
}
|
|
202
|
+
export interface DataPaginatedRecords {
|
|
203
|
+
items: DataRecord[];
|
|
204
|
+
page: number;
|
|
205
|
+
perPage: number;
|
|
206
|
+
totalItems: number;
|
|
207
|
+
totalPages: number;
|
|
208
|
+
}
|
|
209
|
+
/** Body of `POST …/records/query`; unknown keys are rejected. */
|
|
210
|
+
export interface DataQueryOptions {
|
|
211
|
+
filter?: string;
|
|
212
|
+
sort?: string;
|
|
213
|
+
page?: number;
|
|
214
|
+
perPage?: number;
|
|
215
|
+
fields?: string;
|
|
216
|
+
}
|
|
217
|
+
export interface DataCreateInput {
|
|
218
|
+
data: Record<string, unknown>;
|
|
219
|
+
/** A client-chosen id makes a retried create duplicate-detectable. */
|
|
220
|
+
id?: string;
|
|
221
|
+
}
|
|
222
|
+
export interface DataUpdateInput {
|
|
223
|
+
data: Record<string, unknown>;
|
|
224
|
+
/** Best-effort timestamp precondition, not a compare-and-swap (spec §4.4). */
|
|
225
|
+
ifUpdated?: string;
|
|
226
|
+
}
|
|
227
|
+
/** PocketBase's per-field validation map, carried as `extra.fields` on `PB_VALIDATION`. */
|
|
228
|
+
export type DataValidationFields = Record<string, {
|
|
229
|
+
code: string;
|
|
230
|
+
message: string;
|
|
231
|
+
}>;
|
|
232
|
+
/** `extra` on 409 `PB_CONFLICT`. */
|
|
233
|
+
export interface DataConflictExtra {
|
|
234
|
+
currentUpdated?: string;
|
|
235
|
+
reason?: "id_exists";
|
|
236
|
+
}
|
|
237
|
+
/** `superuser_only`: a null rule. `refused`: PocketBase refused a create without detail, never a claim that a rule caused it (§10.4). */
|
|
238
|
+
export declare const DATA_RULE_DENIED_REASONS: readonly ["superuser_only", "refused"];
|
|
239
|
+
export type DataRuleDeniedReason = (typeof DATA_RULE_DENIED_REASONS)[number];
|
|
240
|
+
/** `extra` on 403 `PB_RULE_DENIED` (diagnostics only). */
|
|
241
|
+
export interface DataRuleDeniedExtra {
|
|
242
|
+
op: DataRuleOp;
|
|
243
|
+
reason: DataRuleDeniedReason;
|
|
244
|
+
}
|
|
245
|
+
export declare const DATA_ACT_AS_UNAVAILABLE_REASONS: readonly ["identity_missing", "auth_rule", "token_rejected"];
|
|
246
|
+
export type DataActAsUnavailableReason = (typeof DATA_ACT_AS_UNAVAILABLE_REASONS)[number];
|
|
247
|
+
/** `extra` on 403 `DATA_ACT_AS_UNAVAILABLE` (§10.3; diagnostics only). */
|
|
248
|
+
export interface DataActAsUnavailableExtra {
|
|
249
|
+
reason: DataActAsUnavailableReason;
|
|
250
|
+
}
|
|
251
|
+
/** Whose limiter refused: Percher's own, or the app's PocketBase rate limits (§10.4). */
|
|
252
|
+
export declare const DATA_RATE_LIMIT_SOURCES: readonly ["percher", "app"];
|
|
253
|
+
export type DataRateLimitSource = (typeof DATA_RATE_LIMIT_SOURCES)[number];
|
|
254
|
+
/**
|
|
255
|
+
* `extra` on 429 `DATA_RATE_LIMITED`; a server from before the identity
|
|
256
|
+
* cut-over sends no `source`. Both fields are diagnostics: no value here ever
|
|
257
|
+
* reaches a prompt.
|
|
258
|
+
*/
|
|
259
|
+
export interface DataRateLimitedExtra {
|
|
260
|
+
source?: DataRateLimitSource;
|
|
261
|
+
/** Seconds until Percher's own limiter admits the call again. */
|
|
262
|
+
retryAfterSec?: number;
|
|
263
|
+
}
|
|
264
|
+
/** Every error code a data-records route returns, with its HTTP status (spec §4.5, §10.5). */
|
|
265
|
+
export declare const DATA_RECORD_ERROR_STATUS: {
|
|
266
|
+
readonly PB_VERSION_UNSUPPORTED: 503;
|
|
267
|
+
readonly PB_RECORD_NOT_FOUND: 404;
|
|
268
|
+
readonly PB_VALIDATION: 400;
|
|
269
|
+
readonly PB_CONFLICT: 409;
|
|
270
|
+
readonly PB_CONFLICT_UNSUPPORTED: 400;
|
|
271
|
+
readonly DATA_COLLECTION_FORBIDDEN: 403;
|
|
272
|
+
readonly DATA_FIELD_UNSUPPORTED: 400;
|
|
273
|
+
readonly DATA_RATE_LIMITED: 429;
|
|
274
|
+
readonly DATA_RESPONSE_TOO_LARGE: 413;
|
|
275
|
+
readonly OAUTH_DATA_ACCESS_REQUIRED: 403;
|
|
276
|
+
readonly DATA_TOOLS_NOT_ENABLED: 403;
|
|
277
|
+
readonly PB_AUTH_FAILED: 503;
|
|
278
|
+
readonly PB_NOT_RUNNING: 503;
|
|
279
|
+
readonly PB_BRIDGE_UNAVAILABLE: 502;
|
|
280
|
+
readonly NOT_POCKETBASE: 400;
|
|
281
|
+
/** A filter, sort or fields rejection; `extra` is a `DataQueryInvalidExtra` (diagnostics only). */
|
|
282
|
+
readonly DATA_QUERY_INVALID: 400;
|
|
283
|
+
/** The schema route hit its page ceiling. */
|
|
284
|
+
readonly DATA_SCHEMA_TOO_LARGE: 413;
|
|
285
|
+
/** A read or query passed its deadline. */
|
|
286
|
+
readonly DATA_QUERY_TIMEOUT: 504;
|
|
287
|
+
/** A write timed out or its reply was oversize: it may have completed. Never replayed. */
|
|
288
|
+
readonly DATA_WRITE_OUTCOME_UNKNOWN: 502;
|
|
289
|
+
/** The app's rules refused the identity; `extra` is a `DataRuleDeniedExtra`. */
|
|
290
|
+
readonly PB_RULE_DENIED: 403;
|
|
291
|
+
/** A write under an unset identity, refused before PocketBase is called. */
|
|
292
|
+
readonly DATA_ACT_AS_REQUIRED: 403;
|
|
293
|
+
/** The chosen app user cannot be acted as; `extra` is a `DataActAsUnavailableExtra`. Never falls back. */
|
|
294
|
+
readonly DATA_ACT_AS_UNAVAILABLE: 403;
|
|
295
|
+
};
|
|
296
|
+
export type DataRecordErrorCode = keyof typeof DATA_RECORD_ERROR_STATUS;
|
|
297
|
+
/** The card, editor and email text for each state (§10.7). */
|
|
298
|
+
export declare const DATA_IDENTITY_LABELS: Readonly<Record<DataActingAs, string>>;
|
|
299
|
+
/** Who an owner's API tokens act as in one app (§10.2a); `null` is unset. */
|
|
300
|
+
export interface DataTokenAccessRow {
|
|
301
|
+
appId: string;
|
|
302
|
+
identity: DataIdentity | null;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* The fields `GET /account/oauth-grants` returns beside `grants` (§11.7):
|
|
306
|
+
* the user's app ids on the activation gate, and one token-access row per app
|
|
307
|
+
* that has one (an app without a row is unset).
|
|
308
|
+
*/
|
|
309
|
+
export interface OAuthGrantsDataTools {
|
|
310
|
+
dataToolsApps: string[];
|
|
311
|
+
dataTokenAccess: DataTokenAccessRow[];
|
|
312
|
+
}
|
|
313
|
+
/** Field types a picker label may come from (§10.9); never email, password or token key. */
|
|
314
|
+
export declare const DATA_IDENTITY_LABEL_FIELD_TYPES: readonly ["text", "number", "select"];
|
|
315
|
+
export type DataIdentityLabelFieldType = (typeof DATA_IDENTITY_LABEL_FIELD_TYPES)[number];
|
|
316
|
+
/** Body of `POST /internal/apps/:appId/data/identity-candidates` (§10.9). */
|
|
317
|
+
export interface DataIdentityCandidatesRequest {
|
|
318
|
+
userId: string;
|
|
319
|
+
collectionId?: string;
|
|
320
|
+
displayField?: string;
|
|
321
|
+
q?: string;
|
|
322
|
+
page?: number;
|
|
323
|
+
}
|
|
324
|
+
/** One non-system auth collection the picker offers, with its label-eligible fields. */
|
|
325
|
+
export interface DataIdentityCollection {
|
|
326
|
+
id: string;
|
|
327
|
+
name: string;
|
|
328
|
+
fields: {
|
|
329
|
+
name: string;
|
|
330
|
+
type: DataIdentityLabelFieldType;
|
|
331
|
+
}[];
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Reply of the picker route (§10.9). `candidates` (≤ 20) and `ownerMatch`
|
|
335
|
+
* belong to the requested `collectionId` and are empty/null without one.
|
|
336
|
+
* There is no `omittedByRules` here: that count is the schema reply's (§10.6).
|
|
337
|
+
*/
|
|
338
|
+
export interface DataIdentityCandidatesResponse {
|
|
339
|
+
collections: DataIdentityCollection[];
|
|
340
|
+
candidates: {
|
|
341
|
+
id: string;
|
|
342
|
+
label: string;
|
|
343
|
+
}[];
|
|
344
|
+
/** The record whose `email` is the owner's verified Percher email AND whose `verified` is true. */
|
|
345
|
+
ownerMatch: string | null;
|
|
346
|
+
rulesLockAll: boolean;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Refusals the two access setters may name to the dashboard (§3, §10.2,
|
|
350
|
+
* §10.2a); any other refusal is reported by status. A failed identity lookup
|
|
351
|
+
* is not named: §10.2 gives it no code.
|
|
352
|
+
*/
|
|
353
|
+
export declare const DATA_ACCESS_SETTER_ERROR_STATUS: {
|
|
354
|
+
readonly DATA_TOOLS_NOT_ENABLED: 403;
|
|
355
|
+
/** A changed identity on an app that is not running. */
|
|
356
|
+
readonly PB_NOT_RUNNING: 503;
|
|
357
|
+
};
|
|
358
|
+
export type DataAccessSetterErrorCode = keyof typeof DATA_ACCESS_SETTER_ERROR_STATUS;
|
|
359
|
+
//# sourceMappingURL=data-records.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-records.d.ts","sourceRoot":"","sources":["../src/data-records.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,2EAA2E;AAC3E,eAAO,MAAM,kBAAkB,QAAiC,CAAC;AAEjE,oEAAoE;AACpE,eAAO,MAAM,iBAAiB,QAA0B,CAAC;AAEzD,qEAAqE;AACrE,eAAO,MAAM,WAAW;IACtB,6CAA6C;aAC7C,SAAS,EAAE,MAAO;IAClB,6EAA6E;aAC7E,aAAa,EAAE,OAAS;aACxB,OAAO,EAAE,IAAI;aACb,UAAU,EAAE,GAAG;IACf,6CAA6C;aAC7C,eAAe,EAAE,IAAI;aACrB,cAAc,EAAE,EAAE;aAClB,oBAAoB,EAAE,EAAE;IACxB,6CAA6C;aAC7C,aAAa,EAAE,EAAE;IACjB,0DAA0D;aAC1D,aAAa,EAAE,GAAG;aAClB,cAAc,EAAE,EAAE;IAClB,mFAAmF;aACnF,YAAY,EAAE,CAAC;IACf,4DAA4D;aAC5D,iBAAiB,EAAE,GAAG;IACtB,kEAAkE;aAClE,oBAAoB,EAAE,GAAG;IACzB,kCAAkC;aAClC,yBAAyB,EAAE,EAAE;CACrB,CAAC;AAEX,eAAO,MAAM,iBAAiB,YAAI,MAAM,EAAE,WAAW,CAAU,CAAC;AAChE,iFAAiF;AACjF,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE,eAAO,MAAM,mBAAmB,YAAI,MAAM,EAAE,SAAS,EAAE,WAAW,CAAU,CAAC;AAE7E;;;GAGG;AACH,MAAM,MAAM,YAAY;AACtB,kEAAkE;AAChE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE;AAC1D,u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IAC3B,wDAAwD;aACxD,cAAc,EAAE,GAAG;CACX,CAAC;AACX,MAAM,MAAM,yBAAyB,GAAG,MAAM,OAAO,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The data-tools contract: the record shapes, limits, path patterns and
|
|
3
|
+
* error codes shared by the API records routes, the MCP data tools, the
|
|
4
|
+
* client and the Connections editor (spec:
|
|
5
|
+
* docs/plans/IMPLEMENTING_data-tools-connector.md, §3–§5, §8, §10 and §11).
|
|
6
|
+
*
|
|
7
|
+
* Record operations run as an identity of the app (§10): a chosen app user,
|
|
8
|
+
* a visitor, or full access (the PocketBase superuser) as an explicit per-app
|
|
9
|
+
* opt-in. A grant covers all apps or selected apps (§11).
|
|
10
|
+
*
|
|
11
|
+
* Everything a record route returns came from the app's own users. Record
|
|
12
|
+
* contents, validation maps and `currentUpdated` are untrusted diagnostics:
|
|
13
|
+
* they never reach a recovery prompt or any other instruction field.
|
|
14
|
+
*/
|
|
15
|
+
/** A collection name in a data-route path (spec §4.1, `COLLECTION_RE`). */
|
|
16
|
+
export const DATA_COLLECTION_RE = /^[A-Za-z][A-Za-z0-9_]{0,63}$/;
|
|
17
|
+
/** A record id in a data-route path (spec §4.1, `RECORD_ID_RE`). */
|
|
18
|
+
export const DATA_RECORD_ID_RE = /^[A-Za-z0-9_-]{1,64}$/;
|
|
19
|
+
/** Request, response and expression bounds (spec §3, §4.1, §4.2). */
|
|
20
|
+
export const DATA_LIMITS = {
|
|
21
|
+
/** Request body, read as a capped stream. */
|
|
22
|
+
bodyBytes: 262_144,
|
|
23
|
+
/** Outward JSON, and every upstream body on decoded bytes before parsing. */
|
|
24
|
+
responseBytes: 1_048_576,
|
|
25
|
+
maxPage: 1000,
|
|
26
|
+
maxPerPage: 100,
|
|
27
|
+
/** Each of `filter`, `sort` and `fields`. */
|
|
28
|
+
expressionChars: 1024,
|
|
29
|
+
filterMaxDepth: 16,
|
|
30
|
+
filterMaxComparisons: 64,
|
|
31
|
+
/** Apps one grant's data access may list. */
|
|
32
|
+
accessMaxApps: 50,
|
|
33
|
+
/** `GET /api/collections` paging for the schema route. */
|
|
34
|
+
schemaPerPage: 200,
|
|
35
|
+
schemaMaxPages: 10,
|
|
36
|
+
/** PocketBase's `DefaultSortExprLimit` (v0.40.5 `tools/search/provider.go:25`). */
|
|
37
|
+
sortMaxItems: 8,
|
|
38
|
+
/** `duration` sent to PocketBase's impersonate endpoint. */
|
|
39
|
+
actAsTokenSeconds: 900,
|
|
40
|
+
/** Upper bound on an impersonate token's in-memory cache life. */
|
|
41
|
+
actAsCacheMaxSeconds: 600,
|
|
42
|
+
/** Picker candidates per page. */
|
|
43
|
+
identityCandidatesPerPage: 20,
|
|
44
|
+
};
|
|
45
|
+
export const DATA_ACCESS_MODES = ["read", "readwrite"];
|
|
46
|
+
export const DATA_IDENTITY_KINDS = ["user", "visitor", "superuser"];
|
|
47
|
+
/** An identity kind, or `unset` where no identity is stored (reads as a visitor, refuses writes). */
|
|
48
|
+
export const DATA_ACTING_AS = [...DATA_IDENTITY_KINDS, "unset"];
|
|
49
|
+
export const DATA_ACCESS_SCOPES = ["selected", "all"];
|
|
50
|
+
export const DATA_NOT_RUNNING_REASONS = [
|
|
51
|
+
"sleeping",
|
|
52
|
+
"suspended",
|
|
53
|
+
"stopped",
|
|
54
|
+
"not_deployed",
|
|
55
|
+
];
|
|
56
|
+
/** The five PocketBase collection rules, and `extra.op` on `PB_RULE_DENIED`. */
|
|
57
|
+
export const DATA_RULE_OPS = ["list", "view", "create", "update", "delete"];
|
|
58
|
+
/**
|
|
59
|
+
* A rule's class (§10.6): null → `superuser_only`, non-empty → `rule` (the
|
|
60
|
+
* result depends on the rule, not that it is allowed), empty → `public`.
|
|
61
|
+
* The rule text itself is never returned.
|
|
62
|
+
*/
|
|
63
|
+
export const DATA_RULE_CLASSES = ["superuser_only", "rule", "public"];
|
|
64
|
+
/** `superuser_only`: a null rule. `refused`: PocketBase refused a create without detail, never a claim that a rule caused it (§10.4). */
|
|
65
|
+
export const DATA_RULE_DENIED_REASONS = ["superuser_only", "refused"];
|
|
66
|
+
export const DATA_ACT_AS_UNAVAILABLE_REASONS = [
|
|
67
|
+
"identity_missing",
|
|
68
|
+
"auth_rule",
|
|
69
|
+
"token_rejected",
|
|
70
|
+
];
|
|
71
|
+
/** Whose limiter refused: Percher's own, or the app's PocketBase rate limits (§10.4). */
|
|
72
|
+
export const DATA_RATE_LIMIT_SOURCES = ["percher", "app"];
|
|
73
|
+
/** Every error code a data-records route returns, with its HTTP status (spec §4.5, §10.5). */
|
|
74
|
+
export const DATA_RECORD_ERROR_STATUS = {
|
|
75
|
+
PB_VERSION_UNSUPPORTED: 503,
|
|
76
|
+
PB_RECORD_NOT_FOUND: 404,
|
|
77
|
+
PB_VALIDATION: 400,
|
|
78
|
+
PB_CONFLICT: 409,
|
|
79
|
+
PB_CONFLICT_UNSUPPORTED: 400,
|
|
80
|
+
DATA_COLLECTION_FORBIDDEN: 403,
|
|
81
|
+
DATA_FIELD_UNSUPPORTED: 400,
|
|
82
|
+
DATA_RATE_LIMITED: 429,
|
|
83
|
+
DATA_RESPONSE_TOO_LARGE: 413,
|
|
84
|
+
OAUTH_DATA_ACCESS_REQUIRED: 403,
|
|
85
|
+
DATA_TOOLS_NOT_ENABLED: 403,
|
|
86
|
+
PB_AUTH_FAILED: 503,
|
|
87
|
+
PB_NOT_RUNNING: 503,
|
|
88
|
+
PB_BRIDGE_UNAVAILABLE: 502,
|
|
89
|
+
NOT_POCKETBASE: 400,
|
|
90
|
+
/** A filter, sort or fields rejection; `extra` is a `DataQueryInvalidExtra` (diagnostics only). */
|
|
91
|
+
DATA_QUERY_INVALID: 400,
|
|
92
|
+
/** The schema route hit its page ceiling. */
|
|
93
|
+
DATA_SCHEMA_TOO_LARGE: 413,
|
|
94
|
+
/** A read or query passed its deadline. */
|
|
95
|
+
DATA_QUERY_TIMEOUT: 504,
|
|
96
|
+
/** A write timed out or its reply was oversize: it may have completed. Never replayed. */
|
|
97
|
+
DATA_WRITE_OUTCOME_UNKNOWN: 502,
|
|
98
|
+
/** The app's rules refused the identity; `extra` is a `DataRuleDeniedExtra`. */
|
|
99
|
+
PB_RULE_DENIED: 403,
|
|
100
|
+
/** A write under an unset identity, refused before PocketBase is called. */
|
|
101
|
+
DATA_ACT_AS_REQUIRED: 403,
|
|
102
|
+
/** The chosen app user cannot be acted as; `extra` is a `DataActAsUnavailableExtra`. Never falls back. */
|
|
103
|
+
DATA_ACT_AS_UNAVAILABLE: 403,
|
|
104
|
+
};
|
|
105
|
+
/** The card, editor and email text for each state (§10.7). */
|
|
106
|
+
export const DATA_IDENTITY_LABELS = {
|
|
107
|
+
user: "Acts as the app user you chose. The app's own access rules apply.",
|
|
108
|
+
visitor: "Acts as a visitor who is not signed in. The app's own access rules apply.",
|
|
109
|
+
superuser: "Full access. Bypasses the app's own access rules.",
|
|
110
|
+
unset: "Reads as a visitor. Choose an app user to allow changes.",
|
|
111
|
+
};
|
|
112
|
+
/** Field types a picker label may come from (§10.9); never email, password or token key. */
|
|
113
|
+
export const DATA_IDENTITY_LABEL_FIELD_TYPES = ["text", "number", "select"];
|
|
114
|
+
/**
|
|
115
|
+
* Refusals the two access setters may name to the dashboard (§3, §10.2,
|
|
116
|
+
* §10.2a); any other refusal is reported by status. A failed identity lookup
|
|
117
|
+
* is not named: §10.2 gives it no code.
|
|
118
|
+
*/
|
|
119
|
+
export const DATA_ACCESS_SETTER_ERROR_STATUS = {
|
|
120
|
+
DATA_TOOLS_NOT_ENABLED: 403,
|
|
121
|
+
/** A changed identity on an app that is not running. */
|
|
122
|
+
PB_NOT_RUNNING: 503,
|
|
123
|
+
};
|
|
124
|
+
//# sourceMappingURL=data-records.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-records.js","sourceRoot":"","sources":["../src/data-records.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,2EAA2E;AAC3E,MAAM,C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,EAAE,mDAAmD;IAC9D,KAAK,EAAE,0DAA0D;CAClE,CAAC;AAuBF,4FAA4F;AAC5F,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAU,CAAC;AAgCrF;;;;GAIG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,sBAAsB,EAAE,GAAG;IAC3B,wDAAwD;IACxD,cAAc,EAAE,GAAG;CACX,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** Durable publication decision. Scanner strings are diagnostic data, never instructions. */
|
|
2
|
+
export type SecurityScanFailureCode = "SCANNER_UNAVAILABLE" | "SCANNER_ENGINE_DEGRADED" | "SCANNER_DATABASE_ERROR" | "KEV_CATALOG_STALE" | "IMMUTABLE_SOURCE_UNAVAILABLE" | "IMMUTABLE_SOURCE_CHANGED" | "SCAN_EVIDENCE_UNAVAILABLE" | "SCANNER_EXECUTION_ERROR";
|
|
3
|
+
export type DeploymentSecurityAction = "retry_scan" | "update_dependency" | "wait_for_platform_fix";
|
|
4
|
+
export interface DeploymentSecurityFinding {
|
|
5
|
+
cve: string;
|
|
6
|
+
component: string;
|
|
7
|
+
version: string | null;
|
|
8
|
+
fixedIn: string | null;
|
|
9
|
+
severity: "Critical" | "High" | "Medium" | "Low";
|
|
10
|
+
exploitedKev: boolean;
|
|
11
|
+
responsibility: "user" | "percher";
|
|
12
|
+
}
|
|
13
|
+
export interface DeploymentSecurityBlock {
|
|
14
|
+
version: 1;
|
|
15
|
+
context?: "automatic_rollback";
|
|
16
|
+
reason: "vulnerability" | "scan_unavailable";
|
|
17
|
+
imageId: string | null;
|
|
18
|
+
actions: DeploymentSecurityAction[];
|
|
19
|
+
findings: DeploymentSecurityFinding[];
|
|
20
|
+
totalFindings: number;
|
|
21
|
+
truncated: boolean;
|
|
22
|
+
scanFailureCode?: SecurityScanFailureCode;
|
|
23
|
+
}
|
|
24
|
+
export declare function deploymentSecurityActionText(action: DeploymentSecurityAction, context?: "automatic_rollback"): string;
|
|
25
|
+
/** Fixed authored text only; never interpolate scanner-supplied values here. */
|
|
26
|
+
export declare function deploymentSecuritySummary(block: DeploymentSecurityBlock): string;
|
|
27
|
+
/** Fixed recovery instructions; scanner diagnostics never enter this channel. */
|
|
28
|
+
export declare function deploymentSecurityRecoveryPrompt(block: Pick<DeploymentSecurityBlock, "reason" | "context">): string;
|
|
29
|
+
/** Validate persisted/wire data without turning it into a recovery instruction. */
|
|
30
|
+
export declare function parseDeploymentSecurityBlock(value: unknown): DeploymentSecurityBlock | null;
|
|
31
|
+
export declare function decodeDeploymentSecurityBlock(json: string | null | undefined): DeploymentSecurityBlock | null;
|
|
32
|
+
//# sourceMappingURL=deployment-security.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment-security.d.ts","sourceRoot":"","sources":["../src/deployment-security.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,MAAM,MAAM,uBAAuB,GAC/B,qBAAqB,GACrB,yBAAyB,GACzB,wBAAwB,GACxB,mBAAmB,GACnB,8BAA8B,GAC9B,0BAA0B,GAC1B,2BAA2B,GAC3B,yBAAyB,CAAC;AAE9B,MAAM,MAAM,wBAAwB,GAAG,YAAY,GAAG,mBAAmB,GAAG,uBAAuB,CAAC;AAEpG,MAAM,WAAW,yBAAyB;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IACjD,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,CAAC,CAAC;IACX,OAAO,CAAC,EAAE,oBAAoB,CAAC;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