pubky-app-specs 0.4.2 → 0.4.4

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/package.json CHANGED
@@ -1,51 +1,59 @@
1
1
  {
2
- "name": "pubky-app-specs",
3
- "description": "Pubky.app Data Model Specifications",
4
- "version": "0.4.2",
5
- "license": "MIT",
2
+ "bugs": {
3
+ "url": "https://github.com/pubky/pubky-app-specs/issues"
4
+ },
6
5
  "contributors": [
7
6
  "SHAcollision",
8
7
  "tipogi",
9
8
  "ok300"
10
9
  ],
11
- "repository": {
12
- "type": "git",
13
- "url": "git+https://github.com/pubky/pubky-app-specs.git"
10
+ "description": "Pubky.app Data Model Specifications",
11
+ "devDependencies": {
12
+ "mocha": "^10.2.0"
14
13
  },
15
- "bugs": {
16
- "url": "https://github.com/pubky/pubky-app-specs/issues"
14
+ "exports": {
15
+ ".": {
16
+ "import": "./index.js",
17
+ "require": "./index.cjs",
18
+ "types": "./pubky_app_specs.d.ts"
19
+ },
20
+ "./validationLimits": {
21
+ "import": "./validationLimits.js",
22
+ "require": "./validationLimits.cjs"
23
+ },
24
+ "./validationLimits.json": "./validationLimits.json"
17
25
  },
18
26
  "files": [
19
27
  "pubky_app_specs_bg.wasm",
20
28
  "pubky_app_specs.d.ts",
21
29
  "index.cjs",
22
30
  "index.js",
23
- "example.js"
31
+ "example.js",
32
+ "validationLimits.json",
33
+ "validationLimits.js",
34
+ "validationLimits.cjs"
24
35
  ],
25
- "type": "module",
36
+ "homepage": "https://pubky.app",
37
+ "keywords": [
38
+ "pubky-app",
39
+ "pubky-nexus",
40
+ "specs"
41
+ ],
42
+ "license": "MIT",
26
43
  "main": "index.cjs",
27
44
  "module": "index.js",
28
- "types": "pubky_app_specs.d.ts",
29
- "exports": {
30
- ".": {
31
- "types": "./pubky_app_specs.d.ts",
32
- "import": "./index.js",
33
- "require": "./index.cjs"
34
- }
35
- },
36
- "homepage": "https://pubky.app",
37
- "sideEffects": false,
38
- "devDependencies": {
39
- "mocha": "^10.2.0"
45
+ "name": "pubky-app-specs",
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/pubky/pubky-app-specs.git"
40
49
  },
41
50
  "scripts": {
42
51
  "build": "cargo run --bin bundle_specs_npm",
43
52
  "example": "node example.js",
44
53
  "test": "mocha test.js"
45
54
  },
46
- "keywords": [
47
- "pubky-app",
48
- "pubky-nexus",
49
- "specs"
50
- ]
55
+ "sideEffects": false,
56
+ "type": "module",
57
+ "types": "pubky_app_specs.d.ts",
58
+ "version": "0.4.4"
51
59
  }
@@ -41,6 +41,16 @@ export function feedUriBuilder(author_id: string, feed_id: string): string;
41
41
  * Builds a LastRead URI of the form "pubky://<author_id>/pub/pubky.app/last_read"
42
42
  */
43
43
  export function lastReadUriBuilder(author_id: string): string;
44
+ /**
45
+ * Each FFI function:
46
+ * - Accepts minimal fields in a JavaScript-friendly manner (e.g. strings, JSON).
47
+ * - Creates the Rust model, sanitizes, and validates it.
48
+ * - Generates the ID (if applicable).
49
+ * - Generates the path (if applicable).
50
+ * - Returns { json, id, path, url } or a descriptive error.
51
+ * Returns validation limits as a JSON value for client-side use without a builder.
52
+ */
53
+ export function getValidationLimits(): any;
44
54
  /**
45
55
  * Returns the list of valid MIME types for file attachments.
46
56
  *
@@ -168,14 +178,6 @@ export class LastReadResult {
168
178
  readonly last_read: PubkyAppLastRead;
169
179
  readonly meta: Meta;
170
180
  }
171
- /**
172
- * Each FFI function:
173
- * - Accepts minimal fields in a JavaScript-friendly manner (e.g. strings, JSON).
174
- * - Creates the Rust model, sanitizes, and validates it.
175
- * - Generates the ID (if applicable).
176
- * - Generates the path (if applicable).
177
- * - Returns { json, id, path, url } or a descriptive error.
178
- */
179
181
  export class Meta {
180
182
  private constructor();
181
183
  free(): void;
@@ -483,6 +485,10 @@ export class PubkySpecsBuilder {
483
485
  createMute(mutee_id: string): MuteResult;
484
486
  createLastRead(): LastReadResult;
485
487
  createBlob(blob_data: any): BlobResult;
488
+ /**
489
+ * Returns validation limits as a JSON value for client-side use.
490
+ */
491
+ readonly validationLimits: any;
486
492
  }
487
493
  export class TagResult {
488
494
  private constructor();
Binary file
@@ -0,0 +1,9 @@
1
+ const limits = require("./validationLimits.json");
2
+
3
+ const clone = () => JSON.parse(JSON.stringify(limits));
4
+
5
+ module.exports = {
6
+ validationLimits: limits,
7
+ getValidationLimits: clone,
8
+ default: limits,
9
+ };
@@ -0,0 +1,5 @@
1
+ import limits from "./validationLimits.json" assert { type: "json" };
2
+
3
+ export const validationLimits = limits;
4
+ export const getValidationLimits = () => JSON.parse(JSON.stringify(limits));
5
+ export default limits;
@@ -0,0 +1,35 @@
1
+ {
2
+ "maxBlobSizeBytes": 104857600,
3
+ "maxFileSizeBytes": 104857600,
4
+ "tagLabelMinLength": 1,
5
+ "tagLabelMaxLength": 20,
6
+ "tagInvalidChars": [
7
+ ",",
8
+ ":",
9
+ " ",
10
+ "\t",
11
+ "\n",
12
+ "\r"
13
+ ],
14
+ "userNameMinLength": 3,
15
+ "userNameMaxLength": 50,
16
+ "userBioMaxLength": 160,
17
+ "userImageUrlMaxLength": 300,
18
+ "userLinksMaxCount": 5,
19
+ "userLinkTitleMaxLength": 100,
20
+ "userLinkUrlMaxLength": 300,
21
+ "userStatusMaxLength": 50,
22
+ "postShortContentMaxLength": 2000,
23
+ "postLongContentMaxLength": 50000,
24
+ "postAttachmentsMaxCount": 4,
25
+ "postAttachmentUrlMaxLength": 200,
26
+ "postAllowedAttachmentProtocols": [
27
+ "pubky",
28
+ "http",
29
+ "https"
30
+ ],
31
+ "fileNameMinLength": 1,
32
+ "fileNameMaxLength": 255,
33
+ "fileSrcMaxLength": 1024,
34
+ "feedTagsMaxCount": 5
35
+ }