@paroicms/public-server-lib 1.1.0 → 1.2.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.
@@ -0,0 +1,4 @@
1
+ import { type } from "arktype";
2
+ import type { PaHttpContext } from "../types/backend-plugin-types.d.ts";
3
+ export declare function assertBody<T extends type.Any>(bodyType: T, httpContext: PaHttpContext): T["infer"];
4
+ //# sourceMappingURL=assert-body.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert-body.d.ts","sourceRoot":"","sources":["../src/assert-body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAGxE,wBAAgB,UAAU,CAAC,CAAC,SAAS,IAAI,CAAC,GAAG,EAC3C,QAAQ,EAAE,CAAC,EACX,WAAW,EAAE,aAAa,GACzB,CAAC,CAAC,OAAO,CAAC,CAIZ"}
@@ -0,0 +1,9 @@
1
+ import { type } from "arktype";
2
+ import { ApiError } from "./api-error-handler.js";
3
+ export function assertBody(bodyType, httpContext) {
4
+ const result = bodyType(httpContext.req.body);
5
+ if (result instanceof type.errors)
6
+ throw new ApiError(result.summary, 400);
7
+ return result;
8
+ }
9
+ //# sourceMappingURL=assert-body.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert-body.js","sourceRoot":"","sources":["../src/assert-body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,MAAM,UAAU,UAAU,CACxB,QAAW,EACX,WAA0B;IAE1B,MAAM,MAAM,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC9C,IAAI,MAAM,YAAY,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAC3E,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export type * from "../types/backend-plugin-types.d.ts";
6
6
  export type * from "../types/load-descriptor-types.d.ts";
7
7
  export type * from "../types/template-payload.types.d.ts";
8
8
  export * from "./api-error-handler.js";
9
+ export * from "./assert-body.js";
9
10
  export * from "./html-helpers.js";
10
11
  export * from "./load-descriptors.js";
11
12
  export * from "./media-handle-helpers.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,2CAA2C,CAAC;AAC/D,mBAAmB,sCAAsC,CAAC;AAC1D,mBAAmB,yCAAyC,CAAC;AAC7D,mBAAmB,mCAAmC,CAAC;AACvD,mBAAmB,oCAAoC,CAAC;AACxD,mBAAmB,qCAAqC,CAAC;AACzD,mBAAmB,sCAAsC,CAAC;AAC1D,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uCAAuC,CAAC;AACtD,cAAc,kBAAkB,CAAC;AACjC,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,2CAA2C,CAAC;AAC/D,mBAAmB,sCAAsC,CAAC;AAC1D,mBAAmB,yCAAyC,CAAC;AAC7D,mBAAmB,mCAAmC,CAAC;AACvD,mBAAmB,oCAAoC,CAAC;AACxD,mBAAmB,qCAAqC,CAAC;AACzD,mBAAmB,sCAAsC,CAAC;AAC1D,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uCAAuC,CAAC;AACtD,cAAc,kBAAkB,CAAC;AACjC,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./api-error-handler.js";
2
+ export * from "./assert-body.js";
2
3
  export * from "./html-helpers.js";
3
4
  export * from "./load-descriptors.js";
4
5
  export * from "./media-handle-helpers.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uCAAuC,CAAC;AACtD,cAAc,kBAAkB,CAAC;AACjC,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uCAAuC,CAAC;AACtD,cAAc,kBAAkB,CAAC;AACjC,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paroicms/public-server-lib",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Common utilitaries for paroicms plugins (backend side).",
5
5
  "author": "Paroi Team",
6
6
  "repository": {
@@ -24,9 +24,9 @@
24
24
  "dev": "tsc --watch --preserveWatchOutput"
25
25
  },
26
26
  "dependencies": {
27
- "@paroicms/internal-anywhere-lib": "1.39.8",
27
+ "@paroicms/internal-anywhere-lib": "1.40.0",
28
28
  "@paroicms/public-anywhere-lib": "1.0.1",
29
- "@paroicms/script-lib": "1.0.1",
29
+ "@paroicms/script-lib": "1.0.2",
30
30
  "@typeonly/validator": "~1.1.2",
31
31
  "arktype": "~2.2.1"
32
32
  },
@@ -585,7 +585,10 @@ export interface RiLocalNewAccount {
585
585
  kind: "local";
586
586
  email: string;
587
587
  name: string;
588
- password: string;
588
+ /** When absent, a password-reset link is emailed to the account. */
589
+ password?: string;
590
+ /** Language of the password-reset email; defaults to the site's default language. */
591
+ language?: string;
589
592
  roles: string[];
590
593
  }
591
594