@vxil/sdk 0.16.0 → 0.17.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/index.d.ts CHANGED
@@ -414,8 +414,10 @@ export interface JobRun {
414
414
  concurrency_limit?: number | null;
415
415
  /** the fan-in batch the run joined (enqueue `batch_id`); null otherwise */
416
416
  batch_id?: string | null;
417
- /** a plain run enqueued with `ttl_seconds`: its START deadline (it is
418
- * dead-lettered `Expired` if not started by then); null otherwise */
417
+ /** the run's deadline. A plain run enqueued with `ttl_seconds`: its START
418
+ * deadline (dead-lettered `Expired` if not started by then). A generation
419
+ * run: its completion deadline (`timeout.after_ms`; past it the run ends
420
+ * `GenerationExpired` and any credit hold is released). Null otherwise. */
419
421
  expires_at?: string | null;
420
422
  /** the single-run read only: the debounce key of a debounced run */
421
423
  debounce_key?: string | null;
@@ -2264,6 +2266,11 @@ type DisabledFeatures<S extends VxilSchemaShape> = {
2264
2266
  export type EnabledVxil<S extends VxilSchemaShape> = Omit<Vxil<S>, DisabledFeatures<S>> & {
2265
2267
  [P in DisabledFeatures<S>]: DisabledFeature<FeatureMap[P] & string>;
2266
2268
  };
2269
+ /** A cms collection's END-USER ACCESS mode (guide ch. 9): what a verified end
2270
+ * user (thin-client key + session) may do on it — `'readwrite'` (default),
2271
+ * `'read'` (writes are `403 server_only`) or `'none'` (reads and writes are
2272
+ * `403 server_only`). Server keys are never affected. */
2273
+ export type CmsEndUserAccess = 'readwrite' | 'read' | 'none';
2267
2274
  /** One config-declared per-record ACTION (guide ch. 4): a button on a record row
2268
2275
  * that invokes the deployed tenant function `fn` ONCE with `{ collection,
2269
2276
  * item_id, action, actor, item }`. Exactly one human-initiated step — no
@@ -3279,7 +3286,13 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
3279
3286
  };
3280
3287
  /** `progress_fields`: the progress keys (`progress` / `stage` /
3281
3288
  * `message`) a webhook-mode `processing` callback also writes onto the
3282
- * mirrored record — realtime clients of that record see them live */
3289
+ * mirrored record — realtime clients of that record see them live.
3290
+ * In END-USER mode (`asEndUser`, or a function invoked for a signed-in
3291
+ * user) the target must be a cms record that user can read: another
3292
+ * user's row, a server-only collection or a non-cms feature answers
3293
+ * 403 `mirror_target_forbidden` and nothing starts (503
3294
+ * `mirror_check_unavailable` if the check could not run — retry).
3295
+ * Mirror onto a server-only row from server-mode code instead. */
3283
3296
  status_mirror?: {
3284
3297
  feature: string;
3285
3298
  collection: string;
@@ -3931,7 +3944,11 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
3931
3944
  };
3932
3945
  readonly cms: {
3933
3946
  collections: {
3934
- /** Define a content type. The model is data — not config. */
3947
+ /** Define a content type. The model is data — not config.
3948
+ * Model management (`create`, `addField` and every fields-route meta-op
3949
+ * in this namespace) is SERVER-ONLY: a client acting as a signed-in end
3950
+ * user (`asEndUser`, a thin-client key) gets `403 server_only`. Call
3951
+ * these with a server key — your backend, `vxil push`, or the dashboard. */
3935
3952
  create: (input: {
3936
3953
  collection: string;
3937
3954
  singular?: string;
@@ -3947,6 +3964,12 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
3947
3964
  * and the owner_field are never exposed. Optional; defaults false. Use the
3948
3965
  * top-level `cmsPublicUrl` / `listCmsPublic` helpers for the reader side. */
3949
3966
  public?: boolean;
3967
+ /** What a VERIFIED end user may do here (guide ch. 9, "Read-only and
3968
+ * server-only collections"): `'readwrite'` (default), `'read'` (every
3969
+ * end-user write is `403 server_only`; reads unchanged) or `'none'`
3970
+ * (end-user reads and writes are `403 server_only`, even with an
3971
+ * owner_field). Server keys are never affected. */
3972
+ end_user_access?: CmsEndUserAccess;
3950
3973
  fields?: Array<{
3951
3974
  field: string;
3952
3975
  type: "string" | "text" | "int" | "float" | "bool" | "datetime" | "json" | "relation" | "file";
@@ -3994,12 +4017,16 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
3994
4017
  owner_field?: string;
3995
4018
  public?: boolean;
3996
4019
  actions?: CmsActionDef[];
4020
+ /** present when not the default 'readwrite' */
4021
+ end_user_access?: CmsEndUserAccess;
3997
4022
  }>;
3998
4023
  list: () => Promise<Array<{
3999
4024
  collection: string;
4000
4025
  singular: string;
4001
4026
  fields: unknown[];
4002
4027
  owner_field?: string | null;
4028
+ /** the collection's end-user access mode (absent from an older server = 'readwrite') */
4029
+ end_user_access?: CmsEndUserAccess;
4003
4030
  }>>;
4004
4031
  addField: (collection: string, field: Record<string, unknown>) => Promise<void>;
4005
4032
  /** Set (or clear, with `null`/`[]`) a field's READ-ROLE gate (guide ch. 4) —
@@ -4031,6 +4058,17 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
4031
4058
  * the owner_field are never exposed. `false` closes the lane (and purges the
4032
4059
  * edge cache). Read the public side with `cmsPublicUrl` / `listCmsPublic`. */
4033
4060
  setPublic: (collection: string, isPublic: boolean) => Promise<void>;
4061
+ /** Set the collection's END-USER ACCESS mode (guide ch. 9, "Read-only and
4062
+ * server-only collections"). `'read'`: a verified end user (thin-client
4063
+ * key + session) may still read — owner-scoped when the collection has an
4064
+ * owner_field — but every end-user write answers `403 server_only`;
4065
+ * `'none'`: end-user reads and writes are both refused; `'readwrite'`
4066
+ * (default) restores today's behaviour. Server keys are never affected.
4067
+ * Audited; takes effect on the next request. */
4068
+ setEndUserAccess: (collection: string, access: CmsEndUserAccess) => Promise<{
4069
+ collection: string;
4070
+ end_user_access: CmsEndUserAccess;
4071
+ }>;
4034
4072
  /** Re-project the collection's index slots after an `index_slot` move
4035
4073
  * (guide ch. 4). Slots are projected on WRITE only, so until this runs,
4036
4074
  * stored rows keep their OLD projection: the new slot is NULL and the
package/dist/index.js CHANGED
@@ -1210,7 +1210,11 @@ export class Vxil {
1210
1210
  };
1211
1211
  cms = {
1212
1212
  collections: {
1213
- /** Define a content type. The model is data — not config. */
1213
+ /** Define a content type. The model is data — not config.
1214
+ * Model management (`create`, `addField` and every fields-route meta-op
1215
+ * in this namespace) is SERVER-ONLY: a client acting as a signed-in end
1216
+ * user (`asEndUser`, a thin-client key) gets `403 server_only`. Call
1217
+ * these with a server key — your backend, `vxil push`, or the dashboard. */
1214
1218
  create: async (input) => (await this.call('POST', '/v1/cms/collections', input)).data,
1215
1219
  list: async () => (await this.call('GET', '/v1/cms/collections')).data.collections,
1216
1220
  addField: async (collection, field) => {
@@ -1262,6 +1266,14 @@ export class Vxil {
1262
1266
  setPublic: async (collection, isPublic) => {
1263
1267
  await this.call('POST', `/v1/cms/collections/${encodeURIComponent(collection)}/fields`, { public: isPublic });
1264
1268
  },
1269
+ /** Set the collection's END-USER ACCESS mode (guide ch. 9, "Read-only and
1270
+ * server-only collections"). `'read'`: a verified end user (thin-client
1271
+ * key + session) may still read — owner-scoped when the collection has an
1272
+ * owner_field — but every end-user write answers `403 server_only`;
1273
+ * `'none'`: end-user reads and writes are both refused; `'readwrite'`
1274
+ * (default) restores today's behaviour. Server keys are never affected.
1275
+ * Audited; takes effect on the next request. */
1276
+ setEndUserAccess: async (collection, access) => (await this.call('POST', `/v1/cms/collections/${encodeURIComponent(collection)}/fields`, { end_user_access: access })).data,
1265
1277
  /** Re-project the collection's index slots after an `index_slot` move
1266
1278
  * (guide ch. 4). Slots are projected on WRITE only, so until this runs,
1267
1279
  * stored rows keep their OLD projection: the new slot is NULL and the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vxil/sdk",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Typed client for the Vxil REST API (notifications, auth, jobs, files, cms, comments, webhooks, realtime, orgs, rate-limits).",