@fabriktor/fx 0.0.32 → 0.0.34

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 (35) hide show
  1. package/dist/src/billable/billable.d.ts +12 -10
  2. package/dist/src/billable/billable.js +1 -2
  3. package/dist/src/calls/calls.d.ts +5 -5
  4. package/dist/src/chat/chat.d.ts +3 -2
  5. package/dist/src/core/pull.d.ts +39 -0
  6. package/dist/src/core/pull.js +101 -0
  7. package/dist/src/feed/feed.d.ts +167 -0
  8. package/dist/src/feed/feed.js +642 -0
  9. package/dist/src/fx.d.ts +42 -1
  10. package/dist/src/fx.js +94 -2
  11. package/dist/src/index.d.ts +10 -0
  12. package/dist/src/index.js +10 -0
  13. package/dist/src/jobs/jobs.d.ts +74 -0
  14. package/dist/src/jobs/jobs.js +375 -0
  15. package/dist/src/marketplace/marketplace.d.ts +35 -0
  16. package/dist/src/marketplace/marketplace.js +159 -0
  17. package/dist/src/notifications/notifications.d.ts +20 -0
  18. package/dist/src/notifications/notifications.js +45 -0
  19. package/dist/src/payments/payments.d.ts +59 -0
  20. package/dist/src/payments/payments.js +266 -0
  21. package/dist/src/payrolls/payrolls.d.ts +52 -0
  22. package/dist/src/payrolls/payrolls.js +54 -0
  23. package/dist/src/privacy/privacy.d.ts +21 -0
  24. package/dist/src/privacy/privacy.js +78 -0
  25. package/dist/src/routes/routes.d.ts +22 -0
  26. package/dist/src/routes/routes.js +134 -0
  27. package/dist/src/session/session.d.ts +11 -20
  28. package/dist/src/session/session.js +4 -33
  29. package/dist/src/storage/storage.d.ts +22 -13
  30. package/dist/src/storage/storage.js +56 -41
  31. package/dist/src/timesheets/timesheets.d.ts +91 -0
  32. package/dist/src/timesheets/timesheets.js +407 -0
  33. package/dist/src/users/users.d.ts +15 -11
  34. package/dist/src/users/users.js +2 -2
  35. package/package.json +3 -3
package/dist/src/fx.d.ts CHANGED
@@ -1,12 +1,21 @@
1
- import type { BillableOperator, CallsOperator, ChatOperator, ConnectionsOperator, ContactsOperator, NotificationsOperator, PreferencesOperator, StorageOperator, TmpPhonesOperator, TmpUsernamesOperator, UsersOperator } from "@fabriktor/client";
1
+ import type { BillableOperator, CallsOperator, ChatOperator, ConnectionsOperator, ContactsOperator, FeedOperator, JobsOperator, MarketplaceOperator, NotificationsOperator, PaymentsOperator, PayrollsOperator, PreferencesOperator, PrivacyOperator, RoutesOperator, StorageOperator, TimesheetsOperator, TmpPhonesOperator, TmpUsernamesOperator, UsersOperator } from "@fabriktor/client";
2
2
  import type { AuthOperator } from "./auth/auth.js";
3
3
  import type { BillableFX, BillableFXOperator } from "./billable/billable.js";
4
4
  import type { CallsFX, CallsFXOperator } from "./calls/calls.js";
5
5
  import type { ChatFX, ChatFXOperator } from "./chat/chat.js";
6
6
  import type { ContactsFX, ContactsFXOperator } from "./contacts/contacts.js";
7
+ import type { FeedFX, FeedFXOperator } from "./feed/feed.js";
8
+ import type { JobsFX, JobsFXOperator } from "./jobs/jobs.js";
9
+ import type { MarketplaceFX, MarketplaceFXOperator } from "./marketplace/marketplace.js";
10
+ import type { DeviceTokenProvider, NotificationsFX, NotificationsFXOperator } from "./notifications/notifications.js";
11
+ import type { PaymentsFX, PaymentsFXOperator } from "./payments/payments.js";
12
+ import type { PayrollsFX, PayrollsFXOperator } from "./payrolls/payrolls.js";
7
13
  import type { PreferencesFX, PreferencesFXOperator } from "./preferences/preferences.js";
14
+ import type { PrivacyFX, PrivacyFXOperator } from "./privacy/privacy.js";
15
+ import type { RoutesFX, RoutesFXOperator } from "./routes/routes.js";
8
16
  import type { SessionFX, SessionFXOperator } from "./session/session.js";
9
17
  import type { StorageFX, StorageFXOperator } from "./storage/storage.js";
18
+ import type { TimesheetsFX, TimesheetsFXOperator } from "./timesheets/timesheets.js";
10
19
  import type { UsersFX, UsersFXOperator } from "./users/users.js";
11
20
  export type FXOptions = {
12
21
  auth: AuthOperator;
@@ -15,25 +24,48 @@ export type FXOptions = {
15
24
  chat: ChatOperator;
16
25
  connections: ConnectionsOperator;
17
26
  contacts: ContactsOperator;
27
+ feed: FeedOperator;
28
+ jobs: JobsOperator;
29
+ marketplace: MarketplaceOperator;
18
30
  notifications: NotificationsOperator;
31
+ payments: PaymentsOperator;
32
+ payrolls: PayrollsOperator;
19
33
  preferences: PreferencesOperator;
34
+ privacy: PrivacyOperator;
35
+ routes: RoutesOperator;
20
36
  storage: StorageOperator;
37
+ timesheets: TimesheetsOperator;
21
38
  tmp_phones: TmpPhonesOperator;
22
39
  tmp_usernames: TmpUsernamesOperator;
23
40
  users: UsersOperator;
41
+ get_device_token: DeviceTokenProvider;
42
+ feed_keep_alive_interval_ms: number;
43
+ marketplace_keep_alive_interval_ms: number;
24
44
  };
25
45
  export type DefaultFXOptions = {
26
46
  base_url: string;
27
47
  auth: AuthOperator;
48
+ get_device_token: DeviceTokenProvider;
49
+ feed_keep_alive_interval_ms: number;
50
+ marketplace_keep_alive_interval_ms: number;
28
51
  };
29
52
  export interface FXOperator {
30
53
  billable: BillableFXOperator;
31
54
  calls: CallsFXOperator;
32
55
  chat: ChatFXOperator;
33
56
  contacts: ContactsFXOperator;
57
+ feed: FeedFXOperator;
58
+ jobs: JobsFXOperator;
59
+ marketplace: MarketplaceFXOperator;
60
+ notifications: NotificationsFXOperator;
61
+ payments: PaymentsFXOperator;
62
+ payrolls: PayrollsFXOperator;
34
63
  preferences: PreferencesFXOperator;
64
+ privacy: PrivacyFXOperator;
65
+ routes: RoutesFXOperator;
35
66
  session: SessionFXOperator;
36
67
  storage: StorageFXOperator;
68
+ timesheets: TimesheetsFXOperator;
37
69
  users: UsersFXOperator;
38
70
  }
39
71
  export declare class FX implements FXOperator {
@@ -41,9 +73,18 @@ export declare class FX implements FXOperator {
41
73
  calls: CallsFX;
42
74
  chat: ChatFX;
43
75
  contacts: ContactsFX;
76
+ feed: FeedFX;
77
+ jobs: JobsFX;
78
+ marketplace: MarketplaceFX;
79
+ notifications: NotificationsFX;
80
+ payments: PaymentsFX;
81
+ payrolls: PayrollsFX;
44
82
  preferences: PreferencesFX;
83
+ privacy: PrivacyFX;
84
+ routes: RoutesFX;
45
85
  session: SessionFX;
46
86
  storage: StorageFX;
87
+ timesheets: TimesheetsFX;
47
88
  users: UsersFX;
48
89
  constructor(opts: FXOptions);
49
90
  }
package/dist/src/fx.js CHANGED
@@ -1,25 +1,43 @@
1
- // Copyright (C) Fab// Copyright (C) Fabriktor, Inc. 2025-present.
1
+ // Copyright (C) Fabriktor, Inc. 2025-present.
2
2
  //
3
3
  // Licensed under the Apache License, Version 2.0 (the "License"); you may
4
4
  // not use this file except in compliance with the License. You may obtain
5
5
  // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6
- import { newBillableClient, newCallsClient, newChatClient, newConnectionsClient, newContactsClient, newHTTPClient, newNotificationsClient, newPreferencesClient, newStorageClient, newTmpPhonesClient, newTmpUsernamesClient, newUsersClient, } from "@fabriktor/client";
6
+ import { newBillableClient, newCallsClient, newChatClient, newConnectionsClient, newContactsClient, newFeedClient, newHTTPClient, newJobsClient, newMarketplaceClient, newNotificationsClient, newPaymentsClient, newPayrollsClient, newPreferencesClient, newPrivacyClient, newRoutesClient, newStorageClient, newTimesheetsClient, newTmpPhonesClient, newTmpUsernamesClient, newUsersClient, } from "@fabriktor/client";
7
7
  import { newBillableFX } from "./billable/billable.js";
8
8
  import { newCallsFX } from "./calls/calls.js";
9
9
  import { newChatFX } from "./chat/chat.js";
10
10
  import { newContactsFX } from "./contacts/contacts.js";
11
+ import { newFeedFX } from "./feed/feed.js";
12
+ import { newJobsFX } from "./jobs/jobs.js";
13
+ import { newMarketplaceFX } from "./marketplace/marketplace.js";
14
+ import { newNotificationsFX } from "./notifications/notifications.js";
15
+ import { newPaymentsFX } from "./payments/payments.js";
16
+ import { newPayrollsFX } from "./payrolls/payrolls.js";
11
17
  import { newPreferencesFX } from "./preferences/preferences.js";
18
+ import { newPrivacyFX } from "./privacy/privacy.js";
19
+ import { newRoutesFX } from "./routes/routes.js";
12
20
  import { newSessionFX } from "./session/session.js";
13
21
  import { newStorageFX } from "./storage/storage.js";
22
+ import { newTimesheetsFX } from "./timesheets/timesheets.js";
14
23
  import { newUsersFX } from "./users/users.js";
15
24
  export class FX {
16
25
  billable;
17
26
  calls;
18
27
  chat;
19
28
  contacts;
29
+ feed;
30
+ jobs;
31
+ marketplace;
32
+ notifications;
33
+ payments;
34
+ payrolls;
20
35
  preferences;
36
+ privacy;
37
+ routes;
21
38
  session;
22
39
  storage;
40
+ timesheets;
23
41
  users;
24
42
  constructor(opts) {
25
43
  this.billable = newBillableFX({
@@ -35,12 +53,43 @@ export class FX {
35
53
  this.contacts = newContactsFX({
36
54
  contacts: opts.contacts,
37
55
  });
56
+ this.jobs = newJobsFX({
57
+ jobs: opts.jobs,
58
+ });
59
+ this.notifications = newNotificationsFX({
60
+ notifications: opts.notifications,
61
+ get_device_token: opts.get_device_token,
62
+ });
63
+ this.payments = newPaymentsFX({
64
+ payments: opts.payments,
65
+ });
66
+ this.payrolls = newPayrollsFX({
67
+ payrolls: opts.payrolls,
68
+ });
38
69
  this.preferences = newPreferencesFX({
39
70
  preferences: opts.preferences,
40
71
  });
72
+ this.privacy = newPrivacyFX({
73
+ privacy: opts.privacy,
74
+ });
75
+ this.routes = newRoutesFX({
76
+ routes: opts.routes,
77
+ });
41
78
  this.storage = newStorageFX({
42
79
  storage: opts.storage,
43
80
  });
81
+ this.feed = newFeedFX({
82
+ feed: opts.feed,
83
+ storage_fx: this.storage,
84
+ keep_alive_interval_ms: opts.feed_keep_alive_interval_ms,
85
+ });
86
+ this.marketplace = newMarketplaceFX({
87
+ marketplace: opts.marketplace,
88
+ keep_alive_interval_ms: opts.marketplace_keep_alive_interval_ms,
89
+ });
90
+ this.timesheets = newTimesheetsFX({
91
+ timesheets: opts.timesheets,
92
+ });
44
93
  this.users = newUsersFX({
45
94
  users: opts.users,
46
95
  tmp_usernames: opts.tmp_usernames,
@@ -87,21 +136,61 @@ export function newDefaultFX(opts) {
87
136
  base_url: opts.base_url,
88
137
  get_token,
89
138
  }),
139
+ feed: newFeedClient({
140
+ http,
141
+ base_url: opts.base_url,
142
+ get_token,
143
+ }),
144
+ jobs: newJobsClient({
145
+ http,
146
+ base_url: opts.base_url,
147
+ get_token,
148
+ }),
149
+ marketplace: newMarketplaceClient({
150
+ http,
151
+ base_url: opts.base_url,
152
+ get_token,
153
+ }),
90
154
  notifications: newNotificationsClient({
91
155
  http,
92
156
  base_url: opts.base_url,
93
157
  get_token,
94
158
  }),
159
+ payments: newPaymentsClient({
160
+ http,
161
+ base_url: opts.base_url,
162
+ get_token,
163
+ }),
164
+ payrolls: newPayrollsClient({
165
+ http,
166
+ base_url: opts.base_url,
167
+ get_token,
168
+ }),
95
169
  preferences: newPreferencesClient({
96
170
  http,
97
171
  base_url: opts.base_url,
98
172
  get_token,
99
173
  }),
174
+ privacy: newPrivacyClient({
175
+ http,
176
+ base_url: opts.base_url,
177
+ get_token,
178
+ }),
179
+ routes: newRoutesClient({
180
+ http,
181
+ base_url: opts.base_url,
182
+ get_token,
183
+ }),
100
184
  storage: newStorageClient({
101
185
  http,
102
186
  base_url: opts.base_url,
103
187
  get_token,
104
188
  }),
189
+ timesheets: newTimesheetsClient({
190
+ http,
191
+ base_url: opts.base_url,
192
+ get_token,
193
+ }),
105
194
  tmp_phones: newTmpPhonesClient({
106
195
  http,
107
196
  base_url: opts.base_url,
@@ -117,5 +206,8 @@ export function newDefaultFX(opts) {
117
206
  base_url: opts.base_url,
118
207
  get_token,
119
208
  }),
209
+ get_device_token: opts.get_device_token,
210
+ feed_keep_alive_interval_ms: opts.feed_keep_alive_interval_ms,
211
+ marketplace_keep_alive_interval_ms: opts.marketplace_keep_alive_interval_ms,
120
212
  });
121
213
  }
@@ -4,10 +4,20 @@ export * from "./calls/calls.js";
4
4
  export * from "./chat/chat.js";
5
5
  export * from "./contacts/contacts.js";
6
6
  export * from "./core/err.js";
7
+ export * from "./core/pull.js";
8
+ export * from "./feed/feed.js";
7
9
  export * from "./fx.js";
10
+ export * from "./jobs/jobs.js";
11
+ export * from "./marketplace/marketplace.js";
12
+ export * from "./notifications/notifications.js";
13
+ export * from "./payments/payments.js";
14
+ export * from "./payrolls/payrolls.js";
8
15
  export * from "./preferences/preferences.js";
16
+ export * from "./privacy/privacy.js";
17
+ export * from "./routes/routes.js";
9
18
  export * from "./session/session.js";
10
19
  export * from "./storage/storage.js";
20
+ export * from "./timesheets/timesheets.js";
11
21
  export * from "./users/phone.js";
12
22
  export * from "./users/username.js";
13
23
  export * from "./users/users.js";
package/dist/src/index.js CHANGED
@@ -4,10 +4,20 @@ export * from "./calls/calls.js";
4
4
  export * from "./chat/chat.js";
5
5
  export * from "./contacts/contacts.js";
6
6
  export * from "./core/err.js";
7
+ export * from "./core/pull.js";
8
+ export * from "./feed/feed.js";
7
9
  export * from "./fx.js";
10
+ export * from "./jobs/jobs.js";
11
+ export * from "./marketplace/marketplace.js";
12
+ export * from "./notifications/notifications.js";
13
+ export * from "./payments/payments.js";
14
+ export * from "./payrolls/payrolls.js";
8
15
  export * from "./preferences/preferences.js";
16
+ export * from "./privacy/privacy.js";
17
+ export * from "./routes/routes.js";
9
18
  export * from "./session/session.js";
10
19
  export * from "./storage/storage.js";
20
+ export * from "./timesheets/timesheets.js";
11
21
  export * from "./users/phone.js";
12
22
  export * from "./users/username.js";
13
23
  export * from "./users/users.js";
@@ -0,0 +1,74 @@
1
+ import { type Job, type Location, type OperationResult, type RPJobsFindOverlaps } from "@fabriktor/schema";
2
+ import type { JobsOperator, OperationResultOf } from "@fabriktor/client";
3
+ type JobInsert = Parameters<JobsOperator["insertOneJob"]>[0]["in"];
4
+ type JobProgramInsert = Parameters<JobsOperator["insertOneJobProgram"]>[0]["in"];
5
+ type LocationInsert = Parameters<JobsOperator["insertOneLocation"]>[0]["in"];
6
+ export declare const JobProgramCreateMode: {
7
+ readonly Scheduled: "scheduled";
8
+ readonly Immediate: "immediate";
9
+ };
10
+ export type JobProgramCreateMode = (typeof JobProgramCreateMode)[keyof typeof JobProgramCreateMode];
11
+ export type JobsFXOptions = {
12
+ jobs: JobsOperator;
13
+ now?: () => globalThis.Date;
14
+ };
15
+ export type CreateJobInput = Omit<JobInsert, "status" | "is_active" | "auto_start" | "all_members" | "location_id" | "recurrent">;
16
+ export type CreateJobOptions = {
17
+ in: CreateJobInput;
18
+ location: Location;
19
+ auto_start: boolean;
20
+ start_immediately: boolean;
21
+ };
22
+ export type CreateJobProgramInput = Omit<JobProgramInsert, "job_location_id" | "current_occurrences">;
23
+ export type CreateJobProgramOptions = {
24
+ in: CreateJobProgramInput;
25
+ location: Location;
26
+ };
27
+ export type CreateJobProgramResult = {
28
+ mode: typeof JobProgramCreateMode.Scheduled;
29
+ create: OperationResult;
30
+ } | {
31
+ mode: typeof JobProgramCreateMode.Immediate;
32
+ };
33
+ export type FindLocationOverlapsInput = Pick<LocationInsert, "y" | "m" | "d" | "h" | "min" | "tz" | "end_date">;
34
+ export type FindLocationOverlapsOptions = {
35
+ in: FindLocationOverlapsInput;
36
+ source_id?: string;
37
+ exclude_pending?: boolean;
38
+ exclude_started?: boolean;
39
+ exclude_terminated?: boolean;
40
+ };
41
+ export type AddJobForemanOptions = {
42
+ job: Job;
43
+ location: Location;
44
+ member_id: string;
45
+ };
46
+ export type RemoveJobMemberOptions = {
47
+ job: Job;
48
+ member_id: string;
49
+ };
50
+ export type SetLocationMembersOptions = {
51
+ location: Location;
52
+ current_members: string[];
53
+ };
54
+ export interface JobsFXOperator {
55
+ createJob(opts: CreateJobOptions): Promise<OperationResult>;
56
+ createJobProgram(opts: CreateJobProgramOptions): Promise<CreateJobProgramResult>;
57
+ findLocationOverlaps(opts: FindLocationOverlapsOptions): Promise<OperationResultOf<RPJobsFindOverlaps>>;
58
+ addJobForeman(opts: AddJobForemanOptions): Promise<OperationResult>;
59
+ removeJobMember(opts: RemoveJobMemberOptions): Promise<OperationResult>;
60
+ setLocationMembers(opts: SetLocationMembersOptions): Promise<OperationResult>;
61
+ }
62
+ export declare class JobsFX implements JobsFXOperator {
63
+ private jobs;
64
+ private now;
65
+ constructor(opts: JobsFXOptions);
66
+ createJob(opts: CreateJobOptions): Promise<OperationResult>;
67
+ createJobProgram(opts: CreateJobProgramOptions): Promise<CreateJobProgramResult>;
68
+ findLocationOverlaps(opts: FindLocationOverlapsOptions): Promise<OperationResultOf<RPJobsFindOverlaps>>;
69
+ addJobForeman(opts: AddJobForemanOptions): Promise<OperationResult>;
70
+ removeJobMember(opts: RemoveJobMemberOptions): Promise<OperationResult>;
71
+ setLocationMembers(opts: SetLocationMembersOptions): Promise<OperationResult>;
72
+ }
73
+ export declare function newJobsFX(opts: JobsFXOptions): JobsFX;
74
+ export {};