@fabriktor/client 0.0.26 → 0.0.28

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.
@@ -9,6 +9,8 @@ export * from "./core/path.js";
9
9
  export * from "./memos/memos.js";
10
10
  export * from "./notifications/notifications.js";
11
11
  export * from "./preferences/preferences.js";
12
+ export * from "./privacy/privacy.js";
13
+ export * from "./processes/processes.js";
12
14
  export * from "./users/tmp_phones.js";
13
15
  export * from "./users/tmp_usernames.js";
14
16
  export * from "./users/users.js";
package/dist/src/index.js CHANGED
@@ -9,6 +9,8 @@ export * from "./core/path.js";
9
9
  export * from "./memos/memos.js";
10
10
  export * from "./notifications/notifications.js";
11
11
  export * from "./preferences/preferences.js";
12
+ export * from "./privacy/privacy.js";
13
+ export * from "./processes/processes.js";
12
14
  export * from "./users/tmp_phones.js";
13
15
  export * from "./users/tmp_usernames.js";
14
16
  export * from "./users/users.js";
@@ -0,0 +1,47 @@
1
+ import { type AccountLock, type DeletionRequest, type InAccountLock, type InDeletionRequest, type OperationResult } from "@fabriktor/schema";
2
+ import type { TokenProvider } from "../core/auth.js";
3
+ import type { DeleteManyOptionsCRUD, DeleteOneOptionsCRUD, FindOneOptionsCRUD, InsertOneOptionsCRUD, OperationResultOf, QueryOptionsCRUD, ReplaceOneOptionsCRUD } from "../core/crud.js";
4
+ import type { HTTPDoer } from "../core/http.js";
5
+ export type PrivacyExport = Record<string, unknown>;
6
+ export type PrivacyClientOptions = {
7
+ http: HTTPDoer;
8
+ base_url: string;
9
+ get_token?: TokenProvider;
10
+ };
11
+ export interface PrivacyOperator {
12
+ queryDeletionRequests(opts?: QueryOptionsCRUD): Promise<OperationResultOf<DeletionRequest[]>>;
13
+ insertOneDeletionRequest(opts: InsertOneOptionsCRUD<InDeletionRequest>): Promise<OperationResult>;
14
+ findOneDeletionRequest(opts: FindOneOptionsCRUD): Promise<OperationResultOf<DeletionRequest>>;
15
+ replaceOneDeletionRequest(opts: ReplaceOneOptionsCRUD<InDeletionRequest>): Promise<OperationResult>;
16
+ deleteOneDeletionRequest(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
17
+ deleteManyDeletionRequests(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
18
+ queryAccountLocks(opts?: QueryOptionsCRUD): Promise<OperationResultOf<AccountLock[]>>;
19
+ insertOneAccountLock(opts: InsertOneOptionsCRUD<InAccountLock>): Promise<OperationResult>;
20
+ findOneAccountLock(opts: FindOneOptionsCRUD): Promise<OperationResultOf<AccountLock>>;
21
+ replaceOneAccountLock(opts: ReplaceOneOptionsCRUD<InAccountLock>): Promise<OperationResult>;
22
+ deleteOneAccountLock(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
23
+ deleteManyAccountLocks(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
24
+ exportData(): Promise<PrivacyExport>;
25
+ }
26
+ export declare class PrivacyClient implements PrivacyOperator {
27
+ private deletion_requests;
28
+ private account_locks;
29
+ private http;
30
+ private base_url;
31
+ private get_token?;
32
+ constructor(opts: PrivacyClientOptions);
33
+ queryDeletionRequests(opts?: QueryOptionsCRUD): Promise<OperationResultOf<DeletionRequest[]>>;
34
+ insertOneDeletionRequest(opts: InsertOneOptionsCRUD<InDeletionRequest>): Promise<OperationResult>;
35
+ findOneDeletionRequest(opts: FindOneOptionsCRUD): Promise<OperationResultOf<DeletionRequest>>;
36
+ replaceOneDeletionRequest(opts: ReplaceOneOptionsCRUD<InDeletionRequest>): Promise<OperationResult>;
37
+ deleteOneDeletionRequest(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
38
+ deleteManyDeletionRequests(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
39
+ queryAccountLocks(opts?: QueryOptionsCRUD): Promise<OperationResultOf<AccountLock[]>>;
40
+ insertOneAccountLock(opts: InsertOneOptionsCRUD<InAccountLock>): Promise<OperationResult>;
41
+ findOneAccountLock(opts: FindOneOptionsCRUD): Promise<OperationResultOf<AccountLock>>;
42
+ replaceOneAccountLock(opts: ReplaceOneOptionsCRUD<InAccountLock>): Promise<OperationResult>;
43
+ deleteOneAccountLock(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
44
+ deleteManyAccountLocks(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
45
+ exportData(): Promise<PrivacyExport>;
46
+ }
47
+ export declare function newPrivacyClient(opts: PrivacyClientOptions): PrivacyClient;
@@ -0,0 +1,90 @@
1
+ // Copyright (C) Fabriktor, Inc. 2025-present.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License"); you may
4
+ // not use this file except in compliance with the License. You may obtain
5
+ // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ import { ColPrivacyAccountLocks, ColPrivacyDeletionRequests, HTTPMethodPost, PathPrivacyExport, SvcPrivacy, } from "@fabriktor/schema";
7
+ import { requiredToken } from "../core/auth.js";
8
+ import { newCRUDClient } from "../core/crud.js";
9
+ import { buildPath } from "../core/path.js";
10
+ export class PrivacyClient {
11
+ deletion_requests;
12
+ account_locks;
13
+ http;
14
+ base_url;
15
+ get_token;
16
+ constructor(opts) {
17
+ this.deletion_requests = newCRUDClient({
18
+ http: opts.http,
19
+ base_url: opts.base_url,
20
+ svc: SvcPrivacy,
21
+ col: ColPrivacyDeletionRequests,
22
+ get_token: opts.get_token,
23
+ });
24
+ this.account_locks = newCRUDClient({
25
+ http: opts.http,
26
+ base_url: opts.base_url,
27
+ svc: SvcPrivacy,
28
+ col: ColPrivacyAccountLocks,
29
+ get_token: opts.get_token,
30
+ });
31
+ this.http = opts.http;
32
+ this.base_url = opts.base_url;
33
+ this.get_token = opts.get_token;
34
+ }
35
+ async queryDeletionRequests(opts) {
36
+ return await this.deletion_requests.query(opts);
37
+ }
38
+ async insertOneDeletionRequest(opts) {
39
+ return await this.deletion_requests.insertOne(opts);
40
+ }
41
+ async findOneDeletionRequest(opts) {
42
+ return await this.deletion_requests.findOne(opts);
43
+ }
44
+ async replaceOneDeletionRequest(opts) {
45
+ return await this.deletion_requests.replaceOne(opts);
46
+ }
47
+ async deleteOneDeletionRequest(opts) {
48
+ return await this.deletion_requests.deleteOne(opts);
49
+ }
50
+ async deleteManyDeletionRequests(opts) {
51
+ return await this.deletion_requests.deleteMany(opts);
52
+ }
53
+ async queryAccountLocks(opts) {
54
+ return await this.account_locks.query(opts);
55
+ }
56
+ async insertOneAccountLock(opts) {
57
+ return await this.account_locks.insertOne(opts);
58
+ }
59
+ async findOneAccountLock(opts) {
60
+ return await this.account_locks.findOne(opts);
61
+ }
62
+ async replaceOneAccountLock(opts) {
63
+ return await this.account_locks.replaceOne(opts);
64
+ }
65
+ async deleteOneAccountLock(opts) {
66
+ return await this.account_locks.deleteOne(opts);
67
+ }
68
+ async deleteManyAccountLocks(opts) {
69
+ return await this.account_locks.deleteMany(opts);
70
+ }
71
+ async exportData() {
72
+ const token = await requiredToken(this.get_token);
73
+ return await this.http.do({
74
+ base_url: this.base_url,
75
+ path: deletionRequestPath(PathPrivacyExport),
76
+ method: HTTPMethodPost,
77
+ token,
78
+ });
79
+ }
80
+ }
81
+ export function newPrivacyClient(opts) {
82
+ return new PrivacyClient(opts);
83
+ }
84
+ function deletionRequestPath(action) {
85
+ return buildPath({
86
+ svc: SvcPrivacy,
87
+ col: ColPrivacyDeletionRequests,
88
+ action,
89
+ });
90
+ }
@@ -0,0 +1,21 @@
1
+ import { type PLProcessesSpeechToText, type RPSpeechToText } from "@fabriktor/schema";
2
+ import type { TokenProvider } from "../core/auth.js";
3
+ import type { OperationResultOf } from "../core/crud.js";
4
+ import type { HTTPDoer } from "../core/http.js";
5
+ export type SpeechToTextOptions = PLProcessesSpeechToText;
6
+ export type ProcessesClientOptions = {
7
+ http: HTTPDoer;
8
+ base_url: string;
9
+ get_token?: TokenProvider;
10
+ };
11
+ export interface ProcessesOperator {
12
+ speechToText(opts: SpeechToTextOptions): Promise<OperationResultOf<RPSpeechToText>>;
13
+ }
14
+ export declare class ProcessesClient implements ProcessesOperator {
15
+ private http;
16
+ private base_url;
17
+ private get_token?;
18
+ constructor(opts: ProcessesClientOptions);
19
+ speechToText(opts: SpeechToTextOptions): Promise<OperationResultOf<RPSpeechToText>>;
20
+ }
21
+ export declare function newProcessesClient(opts: ProcessesClientOptions): ProcessesClient;
@@ -0,0 +1,38 @@
1
+ // Copyright (C) Fabriktor, Inc. 2025-present.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License"); you may
4
+ // not use this file except in compliance with the License. You may obtain
5
+ // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ import { HTTPMethodPost, PathProcessesProcesses, PathProcessesSpeechToText, SvcProcesses, } from "@fabriktor/schema";
7
+ import { requiredToken } from "../core/auth.js";
8
+ import { buildPath } from "../core/path.js";
9
+ export class ProcessesClient {
10
+ http;
11
+ base_url;
12
+ get_token;
13
+ constructor(opts) {
14
+ this.http = opts.http;
15
+ this.base_url = opts.base_url;
16
+ this.get_token = opts.get_token;
17
+ }
18
+ async speechToText(opts) {
19
+ const token = await requiredToken(this.get_token);
20
+ return await this.http.do({
21
+ base_url: this.base_url,
22
+ path: processesPath(PathProcessesSpeechToText),
23
+ method: HTTPMethodPost,
24
+ token,
25
+ body: opts,
26
+ });
27
+ }
28
+ }
29
+ export function newProcessesClient(opts) {
30
+ return new ProcessesClient(opts);
31
+ }
32
+ function processesPath(action) {
33
+ return buildPath({
34
+ svc: SvcProcesses,
35
+ col: PathProcessesProcesses,
36
+ action,
37
+ });
38
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabriktor/client",
3
- "version": "0.0.26",
3
+ "version": "0.0.28",
4
4
  "description": "![Fabriktor Logo](./img/fabriktor-character.gif)",
5
5
  "type": "module",
6
6
  "exports": {
@@ -17,6 +17,6 @@
17
17
  "typescript": "^6.0.3"
18
18
  },
19
19
  "dependencies": {
20
- "@fabriktor/schema": "^0.0.19"
20
+ "@fabriktor/schema": "^0.0.21"
21
21
  }
22
22
  }