pubky-app-specs 0.3.0-rc.0 → 0.3.0-rc2
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/README.md +27 -0
- package/package.json +1 -1
- package/pubky_app_specs.d.ts +85 -9
- package/pubky_app_specs.js +169 -1
- package/pubky_app_specs_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -165,3 +165,30 @@ This library supports many more domain objects beyond `User` and `Post`. Here ar
|
|
|
165
165
|
- **LastRead**: `createLastRead(...)`
|
|
166
166
|
|
|
167
167
|
Each has a `meta` field for storing relevant IDs/paths and a typed data object.
|
|
168
|
+
|
|
169
|
+
## 📌 Parsing a Pubky URI
|
|
170
|
+
|
|
171
|
+
The `parse_uri()` function converts a Pubky URI string into a strongly typed object.
|
|
172
|
+
|
|
173
|
+
**Usage:**
|
|
174
|
+
|
|
175
|
+
```js
|
|
176
|
+
import { parse_uri } from "pubky-app-specs";
|
|
177
|
+
|
|
178
|
+
try {
|
|
179
|
+
const result = parse_uri("pubky://userID/pub/pubky.app/posts/postID");
|
|
180
|
+
console.log(result.user_id); // "userID"
|
|
181
|
+
console.log(result.resource); // e.g. "posts"
|
|
182
|
+
console.log(result.resource_id); // "postID" or null
|
|
183
|
+
} catch (error) {
|
|
184
|
+
console.error("URI parse error:", error);
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Returns:**
|
|
189
|
+
|
|
190
|
+
A `ParsedUriResult` object with:
|
|
191
|
+
|
|
192
|
+
- **user_id:** The parsed user identifier.
|
|
193
|
+
- **resource:** A string indicating the resource type.
|
|
194
|
+
- **resource_id:** An optional resource identifier.
|
package/package.json
CHANGED
package/pubky_app_specs.d.ts
CHANGED
|
@@ -3,6 +3,42 @@
|
|
|
3
3
|
export function baseUriBuilder(user_id: string): string;
|
|
4
4
|
export function userUriBuilder(user_id: string): string;
|
|
5
5
|
export function postUriBuilder(author_id: string, post_id: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Parses a Pubky URI and returns a strongly typed `ParsedUriResult`.
|
|
8
|
+
*
|
|
9
|
+
* This function wraps the internal ParsedUri ust parsing logic. It converts the result into a
|
|
10
|
+
* strongly typed object that is easier to use in TypeScript.
|
|
11
|
+
*
|
|
12
|
+
* # Parameters
|
|
13
|
+
*
|
|
14
|
+
* - `uri`: A string slice representing the Pubky URI. The URI should follow the format:
|
|
15
|
+
* `pubky://<user_id>/pub/pubky.app/<resource>[/<id>]`.
|
|
16
|
+
*
|
|
17
|
+
* # Returns
|
|
18
|
+
*
|
|
19
|
+
* On success, returns a `ParsedUriResult` with:
|
|
20
|
+
* - `user_id`: the parsed user ID,
|
|
21
|
+
* - `resource`: a string (derived from the Display implementation of internal `Resource` enum),
|
|
22
|
+
* - `resource_id`: an optional resource identifier (if applicable).
|
|
23
|
+
*
|
|
24
|
+
* On failure, returns a JavaScript error (`String`) containing an error message.
|
|
25
|
+
*
|
|
26
|
+
* # Example (TypeScript)
|
|
27
|
+
*
|
|
28
|
+
* ```typescript
|
|
29
|
+
* import { parse_uri } from "pubky-app-specs";
|
|
30
|
+
*
|
|
31
|
+
* try {
|
|
32
|
+
* const result = parse_uri("pubky://user123/pub/pubky.app/posts/abc123");
|
|
33
|
+
* console.log(result.user_id); // e.g. "user123"
|
|
34
|
+
* console.log(result.resource); // e.g. "posts"
|
|
35
|
+
* console.log(result.resource_id); // e.g. "abc123" or null
|
|
36
|
+
* } catch (error) {
|
|
37
|
+
* console.error("Error parsing URI:", error);
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export function parse_uri(uri: string): ParsedUriResult;
|
|
6
42
|
/**
|
|
7
43
|
* Enum representing the layout of the feed.
|
|
8
44
|
*/
|
|
@@ -96,6 +132,28 @@ export class MuteResult {
|
|
|
96
132
|
readonly mute: PubkyAppMute;
|
|
97
133
|
readonly meta: Meta;
|
|
98
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* This object represents the result of parsing a Pubky URI. It contains:
|
|
137
|
+
* - `user_id`: the parsed user ID as a string.
|
|
138
|
+
* - `resource`: a string representing the kind of resource (derived from internal `Resource` enum Display).
|
|
139
|
+
* - `resource_id`: an optional resource identifier (if applicable).
|
|
140
|
+
*/
|
|
141
|
+
export class ParsedUriResult {
|
|
142
|
+
private constructor();
|
|
143
|
+
free(): void;
|
|
144
|
+
/**
|
|
145
|
+
* Returns the user ID.
|
|
146
|
+
*/
|
|
147
|
+
readonly user_id: string;
|
|
148
|
+
/**
|
|
149
|
+
* Returns the resource kind.
|
|
150
|
+
*/
|
|
151
|
+
readonly resource: string;
|
|
152
|
+
/**
|
|
153
|
+
* Returns the resource ID if present.
|
|
154
|
+
*/
|
|
155
|
+
readonly resource_id: string | undefined;
|
|
156
|
+
}
|
|
99
157
|
export class PostResult {
|
|
100
158
|
private constructor();
|
|
101
159
|
free(): void;
|
|
@@ -336,6 +394,13 @@ export class PubkyAppUserLink {
|
|
|
336
394
|
readonly title: string;
|
|
337
395
|
readonly url: string;
|
|
338
396
|
}
|
|
397
|
+
/**
|
|
398
|
+
* Represents user data with name, bio, image, links, and status.
|
|
399
|
+
*/
|
|
400
|
+
export class PubkyId {
|
|
401
|
+
private constructor();
|
|
402
|
+
free(): void;
|
|
403
|
+
}
|
|
339
404
|
/**
|
|
340
405
|
* Represents a user's single link with a title and URL.
|
|
341
406
|
*/
|
|
@@ -349,6 +414,10 @@ export class PubkySpecsBuilder {
|
|
|
349
414
|
createFeed(tags: any, reach: string, layout: string, sort: string, content: string | null | undefined, name: string): FeedResult;
|
|
350
415
|
createFile(name: string, src: string, content_type: string, size: bigint): FileResult;
|
|
351
416
|
createPost(content: string, kind: PubkyAppPostKind, parent?: string | null, embed?: PubkyAppPostEmbed | null, attachments?: string[] | null): PostResult;
|
|
417
|
+
/**
|
|
418
|
+
* Edits an existing post by updating its content while preserving its original ID and timestamp.
|
|
419
|
+
*/
|
|
420
|
+
editPost(original_post: PubkyAppPost, post_id: string, new_content: string): PostResult;
|
|
352
421
|
createTag(uri: string, label: string): TagResult;
|
|
353
422
|
createBookmark(uri: string): BookmarkResult;
|
|
354
423
|
createFollow(followee_id: string): FollowResult;
|
|
@@ -373,6 +442,9 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
373
442
|
|
|
374
443
|
export interface InitOutput {
|
|
375
444
|
readonly memory: WebAssembly.Memory;
|
|
445
|
+
readonly __wbg_pubkyappblob_free: (a: number, b: number) => void;
|
|
446
|
+
readonly pubkyappblob_toJson: (a: number) => [number, number, number];
|
|
447
|
+
readonly pubkyappblob_data: (a: number) => any;
|
|
376
448
|
readonly __wbg_pubkyappbookmark_free: (a: number, b: number) => void;
|
|
377
449
|
readonly __wbg_get_pubkyappbookmark_created_at: (a: number) => bigint;
|
|
378
450
|
readonly __wbg_set_pubkyappbookmark_created_at: (a: number, b: bigint) => void;
|
|
@@ -398,9 +470,6 @@ export interface InitOutput {
|
|
|
398
470
|
readonly pubkyappfile_src: (a: number) => [number, number];
|
|
399
471
|
readonly pubkyappfile_content_type: (a: number) => [number, number];
|
|
400
472
|
readonly pubkyappfile_toJson: (a: number) => [number, number, number];
|
|
401
|
-
readonly __wbg_pubkyappblob_free: (a: number, b: number) => void;
|
|
402
|
-
readonly pubkyappblob_toJson: (a: number) => [number, number, number];
|
|
403
|
-
readonly pubkyappblob_data: (a: number) => any;
|
|
404
473
|
readonly __wbg_pubkyappfollow_free: (a: number, b: number) => void;
|
|
405
474
|
readonly pubkyappfollow_toJson: (a: number) => [number, number, number];
|
|
406
475
|
readonly pubkyapplastread_toJson: (a: number) => [number, number, number];
|
|
@@ -464,36 +533,43 @@ export interface InitOutput {
|
|
|
464
533
|
readonly __wbg_blobresult_free: (a: number, b: number) => void;
|
|
465
534
|
readonly blobresult_blob: (a: number) => number;
|
|
466
535
|
readonly blobresult_meta: (a: number) => number;
|
|
467
|
-
readonly pubkyspecsbuilder_new: (a: number, b: number) => number;
|
|
536
|
+
readonly pubkyspecsbuilder_new: (a: number, b: number) => [number, number, number];
|
|
468
537
|
readonly pubkyspecsbuilder_createUser: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: any, i: number, j: number) => [number, number, number];
|
|
469
538
|
readonly pubkyspecsbuilder_createFeed: (a: number, b: any, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number, number];
|
|
470
539
|
readonly pubkyspecsbuilder_createFile: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: bigint) => [number, number, number];
|
|
471
540
|
readonly pubkyspecsbuilder_createPost: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
|
|
541
|
+
readonly pubkyspecsbuilder_editPost: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
472
542
|
readonly pubkyspecsbuilder_createTag: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
473
543
|
readonly pubkyspecsbuilder_createBookmark: (a: number, b: number, c: number) => [number, number, number];
|
|
474
544
|
readonly pubkyspecsbuilder_createFollow: (a: number, b: number, c: number) => [number, number, number];
|
|
475
545
|
readonly pubkyspecsbuilder_createMute: (a: number, b: number, c: number) => [number, number, number];
|
|
476
546
|
readonly pubkyspecsbuilder_createLastRead: (a: number) => [number, number, number];
|
|
477
547
|
readonly pubkyspecsbuilder_createBlob: (a: number, b: any) => [number, number, number];
|
|
548
|
+
readonly __wbg_parseduriresult_free: (a: number, b: number) => void;
|
|
549
|
+
readonly parseduriresult_user_id: (a: number) => [number, number];
|
|
550
|
+
readonly parseduriresult_resource: (a: number) => [number, number];
|
|
551
|
+
readonly parseduriresult_resource_id: (a: number) => [number, number];
|
|
552
|
+
readonly parse_uri: (a: number, b: number) => [number, number, number];
|
|
478
553
|
readonly __wbg_set_pubkyappfile_created_at: (a: number, b: bigint) => void;
|
|
479
554
|
readonly __wbg_set_pubkyappfollow_created_at: (a: number, b: bigint) => void;
|
|
480
555
|
readonly __wbg_set_pubkyapplastread_timestamp: (a: number, b: bigint) => void;
|
|
481
556
|
readonly __wbg_set_pubkyappmute_created_at: (a: number, b: bigint) => void;
|
|
482
557
|
readonly __wbg_set_pubkyapptag_created_at: (a: number, b: bigint) => void;
|
|
483
|
-
readonly __wbg_get_pubkyappmute_created_at: (a: number) => bigint;
|
|
484
|
-
readonly __wbg_get_pubkyapplastread_timestamp: (a: number) => bigint;
|
|
485
558
|
readonly __wbg_get_pubkyappfollow_created_at: (a: number) => bigint;
|
|
486
|
-
readonly __wbg_get_pubkyappfile_created_at: (a: number) => bigint;
|
|
487
559
|
readonly __wbg_get_pubkyapptag_created_at: (a: number) => bigint;
|
|
560
|
+
readonly __wbg_get_pubkyappmute_created_at: (a: number) => bigint;
|
|
561
|
+
readonly __wbg_get_pubkyappfile_created_at: (a: number) => bigint;
|
|
562
|
+
readonly __wbg_get_pubkyapplastread_timestamp: (a: number) => bigint;
|
|
488
563
|
readonly muteresult_mute: (a: number) => number;
|
|
489
564
|
readonly lastreadresult_last_read: (a: number) => number;
|
|
490
565
|
readonly __wbg_pubkyspecsbuilder_free: (a: number, b: number) => void;
|
|
491
|
-
readonly
|
|
566
|
+
readonly __wbg_pubkyid_free: (a: number, b: number) => void;
|
|
492
567
|
readonly lastreadresult_meta: (a: number) => number;
|
|
493
|
-
readonly __wbg_muteresult_free: (a: number, b: number) => void;
|
|
494
568
|
readonly __wbg_lastreadresult_free: (a: number, b: number) => void;
|
|
569
|
+
readonly __wbg_muteresult_free: (a: number, b: number) => void;
|
|
495
570
|
readonly __wbg_pubkyappmute_free: (a: number, b: number) => void;
|
|
496
571
|
readonly __wbg_pubkyapplastread_free: (a: number, b: number) => void;
|
|
572
|
+
readonly muteresult_meta: (a: number) => number;
|
|
497
573
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
498
574
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
499
575
|
readonly __wbindgen_exn_store: (a: number) => void;
|
package/pubky_app_specs.js
CHANGED
|
@@ -259,6 +259,53 @@ export function postUriBuilder(author_id, post_id) {
|
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
+
/**
|
|
263
|
+
* Parses a Pubky URI and returns a strongly typed `ParsedUriResult`.
|
|
264
|
+
*
|
|
265
|
+
* This function wraps the internal ParsedUri ust parsing logic. It converts the result into a
|
|
266
|
+
* strongly typed object that is easier to use in TypeScript.
|
|
267
|
+
*
|
|
268
|
+
* # Parameters
|
|
269
|
+
*
|
|
270
|
+
* - `uri`: A string slice representing the Pubky URI. The URI should follow the format:
|
|
271
|
+
* `pubky://<user_id>/pub/pubky.app/<resource>[/<id>]`.
|
|
272
|
+
*
|
|
273
|
+
* # Returns
|
|
274
|
+
*
|
|
275
|
+
* On success, returns a `ParsedUriResult` with:
|
|
276
|
+
* - `user_id`: the parsed user ID,
|
|
277
|
+
* - `resource`: a string (derived from the Display implementation of internal `Resource` enum),
|
|
278
|
+
* - `resource_id`: an optional resource identifier (if applicable).
|
|
279
|
+
*
|
|
280
|
+
* On failure, returns a JavaScript error (`String`) containing an error message.
|
|
281
|
+
*
|
|
282
|
+
* # Example (TypeScript)
|
|
283
|
+
*
|
|
284
|
+
* ```typescript
|
|
285
|
+
* import { parse_uri } from "pubky-app-specs";
|
|
286
|
+
*
|
|
287
|
+
* try {
|
|
288
|
+
* const result = parse_uri("pubky://user123/pub/pubky.app/posts/abc123");
|
|
289
|
+
* console.log(result.user_id); // e.g. "user123"
|
|
290
|
+
* console.log(result.resource); // e.g. "posts"
|
|
291
|
+
* console.log(result.resource_id); // e.g. "abc123" or null
|
|
292
|
+
* } catch (error) {
|
|
293
|
+
* console.error("Error parsing URI:", error);
|
|
294
|
+
* }
|
|
295
|
+
* ```
|
|
296
|
+
* @param {string} uri
|
|
297
|
+
* @returns {ParsedUriResult}
|
|
298
|
+
*/
|
|
299
|
+
export function parse_uri(uri) {
|
|
300
|
+
const ptr0 = passStringToWasm0(uri, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
301
|
+
const len0 = WASM_VECTOR_LEN;
|
|
302
|
+
const ret = wasm.parse_uri(ptr0, len0);
|
|
303
|
+
if (ret[2]) {
|
|
304
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
305
|
+
}
|
|
306
|
+
return ParsedUriResult.__wrap(ret[0]);
|
|
307
|
+
}
|
|
308
|
+
|
|
262
309
|
/**
|
|
263
310
|
* Enum representing the layout of the feed.
|
|
264
311
|
* @enum {0 | 1 | 2}
|
|
@@ -666,6 +713,83 @@ export class MuteResult {
|
|
|
666
713
|
}
|
|
667
714
|
}
|
|
668
715
|
|
|
716
|
+
const ParsedUriResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
717
|
+
? { register: () => {}, unregister: () => {} }
|
|
718
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_parseduriresult_free(ptr >>> 0, 1));
|
|
719
|
+
/**
|
|
720
|
+
* This object represents the result of parsing a Pubky URI. It contains:
|
|
721
|
+
* - `user_id`: the parsed user ID as a string.
|
|
722
|
+
* - `resource`: a string representing the kind of resource (derived from internal `Resource` enum Display).
|
|
723
|
+
* - `resource_id`: an optional resource identifier (if applicable).
|
|
724
|
+
*/
|
|
725
|
+
export class ParsedUriResult {
|
|
726
|
+
|
|
727
|
+
static __wrap(ptr) {
|
|
728
|
+
ptr = ptr >>> 0;
|
|
729
|
+
const obj = Object.create(ParsedUriResult.prototype);
|
|
730
|
+
obj.__wbg_ptr = ptr;
|
|
731
|
+
ParsedUriResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
732
|
+
return obj;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
__destroy_into_raw() {
|
|
736
|
+
const ptr = this.__wbg_ptr;
|
|
737
|
+
this.__wbg_ptr = 0;
|
|
738
|
+
ParsedUriResultFinalization.unregister(this);
|
|
739
|
+
return ptr;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
free() {
|
|
743
|
+
const ptr = this.__destroy_into_raw();
|
|
744
|
+
wasm.__wbg_parseduriresult_free(ptr, 0);
|
|
745
|
+
}
|
|
746
|
+
/**
|
|
747
|
+
* Returns the user ID.
|
|
748
|
+
* @returns {string}
|
|
749
|
+
*/
|
|
750
|
+
get user_id() {
|
|
751
|
+
let deferred1_0;
|
|
752
|
+
let deferred1_1;
|
|
753
|
+
try {
|
|
754
|
+
const ret = wasm.parseduriresult_user_id(this.__wbg_ptr);
|
|
755
|
+
deferred1_0 = ret[0];
|
|
756
|
+
deferred1_1 = ret[1];
|
|
757
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
758
|
+
} finally {
|
|
759
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
/**
|
|
763
|
+
* Returns the resource kind.
|
|
764
|
+
* @returns {string}
|
|
765
|
+
*/
|
|
766
|
+
get resource() {
|
|
767
|
+
let deferred1_0;
|
|
768
|
+
let deferred1_1;
|
|
769
|
+
try {
|
|
770
|
+
const ret = wasm.parseduriresult_resource(this.__wbg_ptr);
|
|
771
|
+
deferred1_0 = ret[0];
|
|
772
|
+
deferred1_1 = ret[1];
|
|
773
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
774
|
+
} finally {
|
|
775
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
* Returns the resource ID if present.
|
|
780
|
+
* @returns {string | undefined}
|
|
781
|
+
*/
|
|
782
|
+
get resource_id() {
|
|
783
|
+
const ret = wasm.parseduriresult_resource_id(this.__wbg_ptr);
|
|
784
|
+
let v1;
|
|
785
|
+
if (ret[0] !== 0) {
|
|
786
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
787
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
788
|
+
}
|
|
789
|
+
return v1;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
|
|
669
793
|
const PostResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
670
794
|
? { register: () => {}, unregister: () => {} }
|
|
671
795
|
: new FinalizationRegistry(ptr => wasm.__wbg_postresult_free(ptr >>> 0, 1));
|
|
@@ -1761,6 +1885,27 @@ export class PubkyAppUserLink {
|
|
|
1761
1885
|
}
|
|
1762
1886
|
}
|
|
1763
1887
|
|
|
1888
|
+
const PubkyIdFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1889
|
+
? { register: () => {}, unregister: () => {} }
|
|
1890
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_pubkyid_free(ptr >>> 0, 1));
|
|
1891
|
+
/**
|
|
1892
|
+
* Represents user data with name, bio, image, links, and status.
|
|
1893
|
+
*/
|
|
1894
|
+
export class PubkyId {
|
|
1895
|
+
|
|
1896
|
+
__destroy_into_raw() {
|
|
1897
|
+
const ptr = this.__wbg_ptr;
|
|
1898
|
+
this.__wbg_ptr = 0;
|
|
1899
|
+
PubkyIdFinalization.unregister(this);
|
|
1900
|
+
return ptr;
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1903
|
+
free() {
|
|
1904
|
+
const ptr = this.__destroy_into_raw();
|
|
1905
|
+
wasm.__wbg_pubkyid_free(ptr, 0);
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
|
|
1764
1909
|
const PubkySpecsBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1765
1910
|
? { register: () => {}, unregister: () => {} }
|
|
1766
1911
|
: new FinalizationRegistry(ptr => wasm.__wbg_pubkyspecsbuilder_free(ptr >>> 0, 1));
|
|
@@ -1788,7 +1933,10 @@ export class PubkySpecsBuilder {
|
|
|
1788
1933
|
const ptr0 = passStringToWasm0(pubky_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1789
1934
|
const len0 = WASM_VECTOR_LEN;
|
|
1790
1935
|
const ret = wasm.pubkyspecsbuilder_new(ptr0, len0);
|
|
1791
|
-
|
|
1936
|
+
if (ret[2]) {
|
|
1937
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1938
|
+
}
|
|
1939
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
1792
1940
|
PubkySpecsBuilderFinalization.register(this, this.__wbg_ptr, this);
|
|
1793
1941
|
return this;
|
|
1794
1942
|
}
|
|
@@ -1887,6 +2035,26 @@ export class PubkySpecsBuilder {
|
|
|
1887
2035
|
}
|
|
1888
2036
|
return PostResult.__wrap(ret[0]);
|
|
1889
2037
|
}
|
|
2038
|
+
/**
|
|
2039
|
+
* Edits an existing post by updating its content while preserving its original ID and timestamp.
|
|
2040
|
+
* @param {PubkyAppPost} original_post
|
|
2041
|
+
* @param {string} post_id
|
|
2042
|
+
* @param {string} new_content
|
|
2043
|
+
* @returns {PostResult}
|
|
2044
|
+
*/
|
|
2045
|
+
editPost(original_post, post_id, new_content) {
|
|
2046
|
+
_assertClass(original_post, PubkyAppPost);
|
|
2047
|
+
var ptr0 = original_post.__destroy_into_raw();
|
|
2048
|
+
const ptr1 = passStringToWasm0(post_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2049
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2050
|
+
const ptr2 = passStringToWasm0(new_content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2051
|
+
const len2 = WASM_VECTOR_LEN;
|
|
2052
|
+
const ret = wasm.pubkyspecsbuilder_editPost(this.__wbg_ptr, ptr0, ptr1, len1, ptr2, len2);
|
|
2053
|
+
if (ret[2]) {
|
|
2054
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2055
|
+
}
|
|
2056
|
+
return PostResult.__wrap(ret[0]);
|
|
2057
|
+
}
|
|
1890
2058
|
/**
|
|
1891
2059
|
* @param {string} uri
|
|
1892
2060
|
* @param {string} label
|
package/pubky_app_specs_bg.wasm
CHANGED
|
Binary file
|