@fabriktor/client 0.0.28 → 0.0.29

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.
Files changed (40) hide show
  1. package/dist/src/billable/billable.d.ts +213 -0
  2. package/dist/src/billable/billable.js +441 -0
  3. package/dist/src/calls/calls.d.ts +34 -0
  4. package/dist/src/calls/calls.js +65 -0
  5. package/dist/src/chat/chat.d.ts +97 -0
  6. package/dist/src/chat/chat.js +234 -0
  7. package/dist/src/contacts/contacts.d.ts +37 -0
  8. package/dist/src/contacts/contacts.js +94 -0
  9. package/dist/src/core/crud.d.ts +1 -1
  10. package/dist/src/core/crud.js +1 -1
  11. package/dist/src/core/http.d.ts +3 -0
  12. package/dist/src/core/http.js +3 -3
  13. package/dist/src/core/idempotency.js +1 -1
  14. package/dist/src/core/multipart.d.ts +25 -0
  15. package/dist/src/core/multipart.js +93 -0
  16. package/dist/src/feed/feed.d.ts +65 -0
  17. package/dist/src/feed/feed.js +130 -0
  18. package/dist/src/fulfillments/fulfillments.d.ts +36 -0
  19. package/dist/src/fulfillments/fulfillments.js +68 -0
  20. package/dist/src/index.d.ts +14 -0
  21. package/dist/src/index.js +14 -0
  22. package/dist/src/jobs/jobs.d.ts +69 -0
  23. package/dist/src/jobs/jobs.js +143 -0
  24. package/dist/src/marketplace/marketplace.d.ts +49 -0
  25. package/dist/src/marketplace/marketplace.js +94 -0
  26. package/dist/src/payments/payments.d.ts +154 -0
  27. package/dist/src/payments/payments.js +328 -0
  28. package/dist/src/payrolls/payrolls.d.ts +179 -0
  29. package/dist/src/payrolls/payrolls.js +380 -0
  30. package/dist/src/processes/processes.d.ts +3 -3
  31. package/dist/src/routes/routes.d.ts +93 -0
  32. package/dist/src/routes/routes.js +185 -0
  33. package/dist/src/storage/storage.d.ts +124 -0
  34. package/dist/src/storage/storage.js +249 -0
  35. package/dist/src/timesheets/timesheets.d.ts +49 -0
  36. package/dist/src/timesheets/timesheets.js +105 -0
  37. package/dist/src/users/tmp_phones.d.ts +1 -1
  38. package/dist/src/users/tmp_usernames.d.ts +1 -1
  39. package/dist/src/users/users.d.ts +1 -1
  40. package/package.json +3 -2
@@ -0,0 +1,49 @@
1
+ import { type InSummary, type InWeekSheet, type OperationResult, type PLTimesheetsApprove, type PLTimesheetsSync, type Punch, type Summary, type WeekSheet } from "@fabriktor/schema";
2
+ import type { TokenProvider } from "../core/auth.js";
3
+ import type { DeleteManyOptionsCRUD, DeleteOneOptionsCRUD, FindOneOptionsCRUD, OperationResultOf, QueryOptionsCRUD, ReplaceOneOptionsCRUD } from "../core/crud.js";
4
+ import type { HTTPDoer } from "../core/http.js";
5
+ export type ApproveTimesheetsOptions = PLTimesheetsApprove;
6
+ export type SyncTimesheetsOptions = PLTimesheetsSync;
7
+ export type PunchTimesheetOptions = Punch;
8
+ export type TimesheetsClientOptions = {
9
+ http: HTTPDoer;
10
+ base_url: string;
11
+ get_token?: TokenProvider;
12
+ };
13
+ export interface TimesheetsOperator {
14
+ queryWeekSheets(opts?: QueryOptionsCRUD): Promise<OperationResultOf<WeekSheet[]>>;
15
+ findOneWeekSheet(opts: FindOneOptionsCRUD): Promise<OperationResultOf<WeekSheet>>;
16
+ replaceOneWeekSheet(opts: ReplaceOneOptionsCRUD<InWeekSheet>): Promise<OperationResult>;
17
+ deleteOneWeekSheet(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
18
+ deleteManyWeekSheets(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
19
+ querySummaries(opts?: QueryOptionsCRUD): Promise<OperationResultOf<Summary[]>>;
20
+ findOneSummary(opts: FindOneOptionsCRUD): Promise<OperationResultOf<Summary>>;
21
+ replaceOneSummary(opts: ReplaceOneOptionsCRUD<InSummary>): Promise<OperationResult>;
22
+ deleteOneSummary(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
23
+ deleteManySummaries(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
24
+ approve(opts: ApproveTimesheetsOptions): Promise<void>;
25
+ sync(opts: SyncTimesheetsOptions): Promise<void>;
26
+ punch(opts: PunchTimesheetOptions): Promise<OperationResult>;
27
+ }
28
+ export declare class TimesheetsClient implements TimesheetsOperator {
29
+ private weeksheets;
30
+ private summaries;
31
+ private http;
32
+ private base_url;
33
+ private get_token?;
34
+ constructor(opts: TimesheetsClientOptions);
35
+ queryWeekSheets(opts?: QueryOptionsCRUD): Promise<OperationResultOf<WeekSheet[]>>;
36
+ findOneWeekSheet(opts: FindOneOptionsCRUD): Promise<OperationResultOf<WeekSheet>>;
37
+ replaceOneWeekSheet(opts: ReplaceOneOptionsCRUD<InWeekSheet>): Promise<OperationResult>;
38
+ deleteOneWeekSheet(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
39
+ deleteManyWeekSheets(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
40
+ querySummaries(opts?: QueryOptionsCRUD): Promise<OperationResultOf<Summary[]>>;
41
+ findOneSummary(opts: FindOneOptionsCRUD): Promise<OperationResultOf<Summary>>;
42
+ replaceOneSummary(opts: ReplaceOneOptionsCRUD<InSummary>): Promise<OperationResult>;
43
+ deleteOneSummary(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
44
+ deleteManySummaries(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
45
+ approve(opts: ApproveTimesheetsOptions): Promise<void>;
46
+ sync(opts: SyncTimesheetsOptions): Promise<void>;
47
+ punch(opts: PunchTimesheetOptions): Promise<OperationResult>;
48
+ }
49
+ export declare function newTimesheetsClient(opts: TimesheetsClientOptions): TimesheetsClient;
@@ -0,0 +1,105 @@
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 { ColTimesheetsSummaries, ColTimesheetsWeekSheets, HTTPMethodPost, PathTimesheetsApprove, PathTimesheetsPunch, PathTimesheetsSync, SvcTimesheets, } 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 TimesheetsClient {
11
+ weeksheets;
12
+ summaries;
13
+ http;
14
+ base_url;
15
+ get_token;
16
+ constructor(opts) {
17
+ this.weeksheets = newCRUDClient({
18
+ http: opts.http,
19
+ base_url: opts.base_url,
20
+ svc: SvcTimesheets,
21
+ col: ColTimesheetsWeekSheets,
22
+ get_token: opts.get_token,
23
+ });
24
+ this.summaries = newCRUDClient({
25
+ http: opts.http,
26
+ base_url: opts.base_url,
27
+ svc: SvcTimesheets,
28
+ col: ColTimesheetsSummaries,
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 queryWeekSheets(opts) {
36
+ return await this.weeksheets.query(opts);
37
+ }
38
+ async findOneWeekSheet(opts) {
39
+ return await this.weeksheets.findOne(opts);
40
+ }
41
+ async replaceOneWeekSheet(opts) {
42
+ return await this.weeksheets.replaceOne(opts);
43
+ }
44
+ async deleteOneWeekSheet(opts) {
45
+ return await this.weeksheets.deleteOne(opts);
46
+ }
47
+ async deleteManyWeekSheets(opts) {
48
+ return await this.weeksheets.deleteMany(opts);
49
+ }
50
+ async querySummaries(opts) {
51
+ return await this.summaries.query(opts);
52
+ }
53
+ async findOneSummary(opts) {
54
+ return await this.summaries.findOne(opts);
55
+ }
56
+ async replaceOneSummary(opts) {
57
+ return await this.summaries.replaceOne(opts);
58
+ }
59
+ async deleteOneSummary(opts) {
60
+ return await this.summaries.deleteOne(opts);
61
+ }
62
+ async deleteManySummaries(opts) {
63
+ return await this.summaries.deleteMany(opts);
64
+ }
65
+ async approve(opts) {
66
+ const token = await requiredToken(this.get_token);
67
+ return await this.http.do({
68
+ base_url: this.base_url,
69
+ path: weekSheetPath(PathTimesheetsApprove),
70
+ method: HTTPMethodPost,
71
+ token,
72
+ body: opts,
73
+ });
74
+ }
75
+ async sync(opts) {
76
+ const token = await requiredToken(this.get_token);
77
+ return await this.http.do({
78
+ base_url: this.base_url,
79
+ path: weekSheetPath(PathTimesheetsSync),
80
+ method: HTTPMethodPost,
81
+ token,
82
+ body: opts,
83
+ });
84
+ }
85
+ async punch(opts) {
86
+ const token = await requiredToken(this.get_token);
87
+ return await this.http.do({
88
+ base_url: this.base_url,
89
+ path: weekSheetPath(PathTimesheetsPunch),
90
+ method: HTTPMethodPost,
91
+ token,
92
+ body: opts,
93
+ });
94
+ }
95
+ }
96
+ export function newTimesheetsClient(opts) {
97
+ return new TimesheetsClient(opts);
98
+ }
99
+ function weekSheetPath(action) {
100
+ return buildPath({
101
+ svc: SvcTimesheets,
102
+ col: ColTimesheetsWeekSheets,
103
+ action,
104
+ });
105
+ }
@@ -1,4 +1,4 @@
1
- import type { PLUsersSendCode, PLUsersVerifyCode } from "@fabriktor/schema";
1
+ import { type PLUsersSendCode, type PLUsersVerifyCode } from "@fabriktor/schema";
2
2
  import type { TokenProvider } from "../core/auth.js";
3
3
  import type { HTTPDoer } from "../core/http.js";
4
4
  export type SendPhoneVerificationOptions = PLUsersSendCode;
@@ -1,4 +1,4 @@
1
- import type { PLUsersUsername } from "@fabriktor/schema";
1
+ import { type PLUsersUsername } from "@fabriktor/schema";
2
2
  import type { TokenProvider } from "../core/auth.js";
3
3
  import type { HTTPDoer, Op } from "../core/http.js";
4
4
  export type VerifyUsernameOptions = PLUsersUsername;
@@ -1,4 +1,4 @@
1
- import type { InUser, OperationResult, PLUsersContactList, PLUsersForgotPassword, PLUsersResolveUsername, PLUsersVerifyEmail, PLUsersSignInLink, UpsertResult, User } from "@fabriktor/schema";
1
+ import { type InUser, type OperationResult, type PLUsersContactList, type PLUsersForgotPassword, type PLUsersResolveUsername, type PLUsersSignInLink, type PLUsersVerifyEmail, type UpsertResult, type User } from "@fabriktor/schema";
2
2
  import type { TokenProvider } from "../core/auth.js";
3
3
  import type { HTTPDoer, Op } from "../core/http.js";
4
4
  export type BootstrapOptions = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabriktor/client",
3
- "version": "0.0.28",
3
+ "version": "0.0.29",
4
4
  "description": "![Fabriktor Logo](./img/fabriktor-character.gif)",
5
5
  "type": "module",
6
6
  "exports": {
@@ -17,6 +17,7 @@
17
17
  "typescript": "^6.0.3"
18
18
  },
19
19
  "dependencies": {
20
- "@fabriktor/schema": "^0.0.21"
20
+ "@fabriktor/client": "0.0.25",
21
+ "@fabriktor/schema": "0.0.27"
21
22
  }
22
23
  }