@jsm-mit/sultana-core-motoko-package 0.1.0 → 0.2.0
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/declarations/sultana-core-motoko/sultana-core-motoko.did +2 -0
- package/declarations/sultana-core-motoko/sultana-core-motoko.did.d.ts +2 -0
- package/declarations/sultana-core-motoko/sultana-core-motoko.did.js +2 -0
- package/dist/actors/user-profiles-actor.d.ts +5 -1
- package/dist/actors/user-profiles-actor.d.ts.map +1 -1
- package/dist/actors/user-profiles-actor.js +6 -1
- package/dist/admin-actor.d.ts +40 -0
- package/dist/admin-actor.d.ts.map +1 -0
- package/dist/admin-actor.js +55 -0
- package/dist/appointments-actor.d.ts +7 -0
- package/dist/appointments-actor.d.ts.map +1 -0
- package/dist/appointments-actor.js +19 -0
- package/dist/availability-actor.d.ts +13 -0
- package/dist/availability-actor.d.ts.map +1 -0
- package/dist/availability-actor.js +42 -0
- package/dist/hr-actor.d.ts +15 -0
- package/dist/hr-actor.d.ts.map +1 -0
- package/dist/hr-actor.js +45 -0
- package/dist/interfaces.d.ts +2 -0
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/mappers.d.ts.map +1 -1
- package/dist/mappers.js +2 -1
- package/dist/salon-services-actor.d.ts +26 -0
- package/dist/salon-services-actor.d.ts.map +1 -0
- package/dist/salon-services-actor.js +53 -0
- package/dist/salons-actor.d.ts +9 -0
- package/dist/salons-actor.d.ts.map +1 -0
- package/dist/salons-actor.js +18 -0
- package/dist/service-types-actor.d.ts +9 -0
- package/dist/service-types-actor.d.ts.map +1 -0
- package/dist/service-types-actor.js +16 -0
- package/dist/sultana-core-motoko-actor.d.ts +65 -0
- package/dist/sultana-core-motoko-actor.d.ts.map +1 -0
- package/dist/sultana-core-motoko-actor.js +191 -0
- package/dist/user-profiles-actor.d.ts +9 -0
- package/dist/user-profiles-actor.d.ts.map +1 -0
- package/dist/user-profiles-actor.js +31 -0
- package/package.json +59 -58
|
@@ -53,6 +53,7 @@ type UserProfile =
|
|
|
53
53
|
avatarUrl: opt text;
|
|
54
54
|
id: principal;
|
|
55
55
|
name: text;
|
|
56
|
+
settingsJson: opt text;
|
|
56
57
|
whatsAppNumber: opt text;
|
|
57
58
|
};
|
|
58
59
|
type UpdateVisitArgs =
|
|
@@ -78,6 +79,7 @@ type UpdateProfileArgs =
|
|
|
78
79
|
record {
|
|
79
80
|
avatarUrl: opt text;
|
|
80
81
|
name: text;
|
|
82
|
+
settingsJson: opt text;
|
|
81
83
|
whatsAppNumber: opt text;
|
|
82
84
|
};
|
|
83
85
|
type TranslationEntry =
|
|
@@ -505,6 +505,7 @@ export interface SupportedLanguage { 'active' : boolean, 'code' : LangCode }
|
|
|
505
505
|
export type TimeMask = BigUint64Array | bigint[];
|
|
506
506
|
export interface TranslationEntry { 'lang' : LangCode, 'text' : string }
|
|
507
507
|
export interface UpdateProfileArgs {
|
|
508
|
+
'settingsJson' : [] | [string],
|
|
508
509
|
'whatsAppNumber' : [] | [string],
|
|
509
510
|
'name' : string,
|
|
510
511
|
'avatarUrl' : [] | [string],
|
|
@@ -528,6 +529,7 @@ export interface UpdateVisitArgs {
|
|
|
528
529
|
}
|
|
529
530
|
export interface UserProfile {
|
|
530
531
|
'id' : Principal,
|
|
532
|
+
'settingsJson' : [] | [string],
|
|
531
533
|
'whatsAppNumber' : [] | [string],
|
|
532
534
|
'name' : string,
|
|
533
535
|
'avatarUrl' : [] | [string],
|
|
@@ -191,6 +191,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
191
191
|
});
|
|
192
192
|
const UserProfile = IDL.Record({
|
|
193
193
|
'id' : IDL.Principal,
|
|
194
|
+
'settingsJson' : IDL.Opt(IDL.Text),
|
|
194
195
|
'whatsAppNumber' : IDL.Opt(IDL.Text),
|
|
195
196
|
'name' : IDL.Text,
|
|
196
197
|
'avatarUrl' : IDL.Opt(IDL.Text),
|
|
@@ -587,6 +588,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
587
588
|
'salonId' : SalonId,
|
|
588
589
|
});
|
|
589
590
|
const UpdateProfileArgs = IDL.Record({
|
|
591
|
+
'settingsJson' : IDL.Opt(IDL.Text),
|
|
590
592
|
'whatsAppNumber' : IDL.Opt(IDL.Text),
|
|
591
593
|
'name' : IDL.Text,
|
|
592
594
|
'avatarUrl' : IDL.Opt(IDL.Text),
|
|
@@ -16,12 +16,16 @@ export declare class UserProfilesActor extends ActorBase {
|
|
|
16
16
|
* @param name - The display name to set. Cannot be empty.
|
|
17
17
|
* @param avatarUrl - Optional URL of the avatar image.
|
|
18
18
|
* @param whatsAppNumber - Optional WhatsApp phone number.
|
|
19
|
+
* @param settingsJson - Optional JSON blob of client-side settings, stored verbatim (max
|
|
20
|
+
* 2000 characters). Every optional field is a REPLACE, not a merge: omitting this
|
|
21
|
+
* clears the stored settings, so pass the ones you already hold when editing
|
|
22
|
+
* anything else on the profile.
|
|
19
23
|
* @returns A promise that resolves to the updated `UserProfileView`.
|
|
20
24
|
* @throws Error with message `CriticalCanisterError` when there is no communication with the canister
|
|
21
25
|
* or when the canister code crashes during execution.
|
|
22
26
|
* @throws Error with message 'CanisterError' when the canister returns a business error such as validation failure. Examine "cause" field to find more details about error
|
|
23
27
|
* @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect_message` rejects the call before execution (oversized payload, anonymous caller, or exceeded daily action quota) — a transport-level rejection, not a decoded Framework.Result #err.
|
|
24
28
|
*/
|
|
25
|
-
updateMyProfileAsyncUnsafe(name: string, avatarUrl?: string, whatsAppNumber?: string): Promise<UserProfileView>;
|
|
29
|
+
updateMyProfileAsyncUnsafe(name: string, avatarUrl?: string, whatsAppNumber?: string, settingsJson?: string): Promise<UserProfileView>;
|
|
26
30
|
}
|
|
27
31
|
//# sourceMappingURL=user-profiles-actor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-profiles-actor.d.ts","sourceRoot":"","sources":["../../src/actors/user-profiles-actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGxD,qBAAa,iBAAkB,SAAQ,SAAS;gBAEhC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAInD;;;;;;OAMG;IACU,uBAAuB,IAAI,OAAO,CAAC,eAAe,CAAC;IAMhE
|
|
1
|
+
{"version":3,"file":"user-profiles-actor.d.ts","sourceRoot":"","sources":["../../src/actors/user-profiles-actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGxD,qBAAa,iBAAkB,SAAQ,SAAS;gBAEhC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAInD;;;;;;OAMG;IACU,uBAAuB,IAAI,OAAO,CAAC,eAAe,CAAC;IAMhE;;;;;;;;;;;;;;OAcG;IACU,0BAA0B,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;CAUtJ"}
|
|
@@ -20,16 +20,21 @@ export class UserProfilesActor extends ActorBase {
|
|
|
20
20
|
* @param name - The display name to set. Cannot be empty.
|
|
21
21
|
* @param avatarUrl - Optional URL of the avatar image.
|
|
22
22
|
* @param whatsAppNumber - Optional WhatsApp phone number.
|
|
23
|
+
* @param settingsJson - Optional JSON blob of client-side settings, stored verbatim (max
|
|
24
|
+
* 2000 characters). Every optional field is a REPLACE, not a merge: omitting this
|
|
25
|
+
* clears the stored settings, so pass the ones you already hold when editing
|
|
26
|
+
* anything else on the profile.
|
|
23
27
|
* @returns A promise that resolves to the updated `UserProfileView`.
|
|
24
28
|
* @throws Error with message `CriticalCanisterError` when there is no communication with the canister
|
|
25
29
|
* or when the canister code crashes during execution.
|
|
26
30
|
* @throws Error with message 'CanisterError' when the canister returns a business error such as validation failure. Examine "cause" field to find more details about error
|
|
27
31
|
* @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect_message` rejects the call before execution (oversized payload, anonymous caller, or exceeded daily action quota) — a transport-level rejection, not a decoded Framework.Result #err.
|
|
28
32
|
*/
|
|
29
|
-
async updateMyProfileAsyncUnsafe(name, avatarUrl, whatsAppNumber) {
|
|
33
|
+
async updateMyProfileAsyncUnsafe(name, avatarUrl, whatsAppNumber, settingsJson) {
|
|
30
34
|
return this.executeFunctionAsyncUnsafe(() => this.actor.updateMyProfile({
|
|
31
35
|
avatarUrl: avatarUrl ? [avatarUrl] : [],
|
|
32
36
|
whatsAppNumber: whatsAppNumber ? [whatsAppNumber] : [],
|
|
37
|
+
settingsJson: settingsJson ? [settingsJson] : [],
|
|
33
38
|
name
|
|
34
39
|
})).then(mapUserProfileViewMotoko);
|
|
35
40
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type Identity } from "@icp-sdk/core/agent";
|
|
2
|
+
import type { UserProfile } from "../declarations/sultana-core-motoko/sultana-core-motoko.did.js";
|
|
3
|
+
import { Principal } from "@icp-sdk/core/principal";
|
|
4
|
+
import { ActorBase } from "./actor-base.js";
|
|
5
|
+
export declare class AdminActor extends ActorBase {
|
|
6
|
+
constructor(canisterId: string, identity?: Identity);
|
|
7
|
+
/**
|
|
8
|
+
* Sets the current identity as the system administrator.
|
|
9
|
+
*
|
|
10
|
+
* This method calls the canister actor with an empty argument list,
|
|
11
|
+
* which the canister interprets as setting the caller as the system admin.
|
|
12
|
+
*
|
|
13
|
+
* @returns A Promise that resolves to the updated system administrator Principal.
|
|
14
|
+
* @throws Error with message `CriticalErrorCanister` when there is no communication with the canister
|
|
15
|
+
* or when the canister code crashes during execution.
|
|
16
|
+
* @throws Error when the canister returns a business error such as validation failure.
|
|
17
|
+
*/
|
|
18
|
+
setMyselfAsSysAdminAsyncUnsafe(): Promise<Principal>;
|
|
19
|
+
/**
|
|
20
|
+
* Sets a new system administrator Principal on the canister.
|
|
21
|
+
*
|
|
22
|
+
* @param newSysAdmin The Principal to assign as the new system administrator.
|
|
23
|
+
* @returns A Promise that resolves to the updated system administrator Principal.
|
|
24
|
+
* @throws Error with message `CriticalErrorCanister` when there is no communication with the canister
|
|
25
|
+
* or when the canister code crashes during execution.
|
|
26
|
+
* @throws Error when the canister returns a business error such as validation failure.
|
|
27
|
+
*/
|
|
28
|
+
setSysAdminAsyncUnsafe(newSysAdminText: string): Promise<Principal>;
|
|
29
|
+
/**
|
|
30
|
+
* Retrieves the current system administrator Principal from the canister.
|
|
31
|
+
*
|
|
32
|
+
* @returns A Promise that resolves to the current system administrator Principal.
|
|
33
|
+
* @throws Error with message `CriticalErrorCanister` when there is no communication with the canister
|
|
34
|
+
* or when the canister code crashes during execution.
|
|
35
|
+
* @throws Error when the canister returns a business error such as validation failure.
|
|
36
|
+
*/
|
|
37
|
+
getSysAdminAsyncSafe(): Promise<string>;
|
|
38
|
+
getAllProfilesAsyncUnsafe(): Promise<UserProfile[]>;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=admin-actor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-actor.d.ts","sourceRoot":"","sources":["../src/admin-actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAuD,WAAW,EAAE,MAAM,gEAAgE,CAAC;AACvJ,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,qBAAa,UAAW,SAAQ,SAAS;gBAEzB,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAInD;;;;;;;;;;OAUG;IACU,8BAA8B,IAAI,OAAO,CAAC,SAAS,CAAC;IAMjE;;;;;;;;OAQG;IACU,sBAAsB,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAQhF;;;;;;;OAOG;IACU,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC;IAYvC,yBAAyB,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;CAKnE"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {} from "@icp-sdk/core/agent";
|
|
2
|
+
import { Principal } from "@icp-sdk/core/principal";
|
|
3
|
+
import { ActorBase } from "./actor-base.js";
|
|
4
|
+
export class AdminActor extends ActorBase {
|
|
5
|
+
constructor(canisterId, identity) {
|
|
6
|
+
super(canisterId, identity);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Sets the current identity as the system administrator.
|
|
10
|
+
*
|
|
11
|
+
* This method calls the canister actor with an empty argument list,
|
|
12
|
+
* which the canister interprets as setting the caller as the system admin.
|
|
13
|
+
*
|
|
14
|
+
* @returns A Promise that resolves to the updated system administrator Principal.
|
|
15
|
+
* @throws Error with message `CriticalErrorCanister` when there is no communication with the canister
|
|
16
|
+
* or when the canister code crashes during execution.
|
|
17
|
+
* @throws Error when the canister returns a business error such as validation failure.
|
|
18
|
+
*/
|
|
19
|
+
async setMyselfAsSysAdminAsyncUnsafe() {
|
|
20
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.setSystemAdmin([]));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Sets a new system administrator Principal on the canister.
|
|
24
|
+
*
|
|
25
|
+
* @param newSysAdmin The Principal to assign as the new system administrator.
|
|
26
|
+
* @returns A Promise that resolves to the updated system administrator Principal.
|
|
27
|
+
* @throws Error with message `CriticalErrorCanister` when there is no communication with the canister
|
|
28
|
+
* or when the canister code crashes during execution.
|
|
29
|
+
* @throws Error when the canister returns a business error such as validation failure.
|
|
30
|
+
*/
|
|
31
|
+
async setSysAdminAsyncUnsafe(newSysAdminText) {
|
|
32
|
+
const newSysAdmin = Principal.fromText(newSysAdminText);
|
|
33
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.setSystemAdmin([newSysAdmin]));
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Retrieves the current system administrator Principal from the canister.
|
|
37
|
+
*
|
|
38
|
+
* @returns A Promise that resolves to the current system administrator Principal.
|
|
39
|
+
* @throws Error with message `CriticalErrorCanister` when there is no communication with the canister
|
|
40
|
+
* or when the canister code crashes during execution.
|
|
41
|
+
* @throws Error when the canister returns a business error such as validation failure.
|
|
42
|
+
*/
|
|
43
|
+
async getSysAdminAsyncSafe() {
|
|
44
|
+
try {
|
|
45
|
+
const principal = await this.executeFunctionAsyncUnsafe(() => this.actor.getSystemAdmin());
|
|
46
|
+
return principal.toString();
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return "No sys admin";
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
async getAllProfilesAsyncUnsafe() {
|
|
53
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.getAllProfiles());
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Identity } from "@icp-sdk/core/agent";
|
|
2
|
+
import { ActorBase } from "./actor-base.js";
|
|
3
|
+
export declare class AppointmentsActor extends ActorBase {
|
|
4
|
+
constructor(canisterId: string, identity?: Identity);
|
|
5
|
+
bookAppointmentAsyncUnsafe(notes: string, salonId: string, salonServiceId: string, startTimeTs: number, workerIdText: string): Promise<string>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=appointments-actor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appointments-actor.d.ts","sourceRoot":"","sources":["../src/appointments-actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,qBAAa,iBAAkB,SAAQ,SAAS;gBAEhC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAItC,0BAA0B,CACnC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,GACrB,OAAO,CAAC,MAAM,CAAC;CAiBrB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {} from "@icp-sdk/core/agent";
|
|
2
|
+
import { Principal } from "@icp-sdk/core/principal";
|
|
3
|
+
import { ActorBase } from "./actor-base.js";
|
|
4
|
+
export class AppointmentsActor extends ActorBase {
|
|
5
|
+
constructor(canisterId, identity) {
|
|
6
|
+
super(canisterId, identity);
|
|
7
|
+
}
|
|
8
|
+
async bookAppointmentAsyncUnsafe(notes, salonId, salonServiceId, startTimeTs, workerIdText) {
|
|
9
|
+
const startTimeUTC = BigInt(startTimeTs * 1000000);
|
|
10
|
+
const workerId = Principal.fromText(workerIdText);
|
|
11
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.bookAppointment({
|
|
12
|
+
notes,
|
|
13
|
+
salonId,
|
|
14
|
+
salonServiceId,
|
|
15
|
+
startTimeUTC,
|
|
16
|
+
workerId
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Identity } from "@icp-sdk/core/agent";
|
|
2
|
+
import type { TimeMask } from "../declarations/sultana-core-motoko/sultana-core-motoko.did.js";
|
|
3
|
+
import type { Principal } from "@icp-sdk/core/principal";
|
|
4
|
+
import { ActorBase } from "./actor-base.js";
|
|
5
|
+
export declare class AvailabilityActor extends ActorBase {
|
|
6
|
+
constructor(canisterId: string, identity?: Identity);
|
|
7
|
+
setWeeklyTemplateAsyncUnsafe(day: bigint, mask: TimeMask, salonId: string, workerId: Principal): Promise<void>;
|
|
8
|
+
getDayFromWeeklyTemplateAsyncUnsafe(day: bigint, salonId: string, workerId: Principal): Promise<bigint[]>;
|
|
9
|
+
setDailyScheduleAsyncUnsafe(date: bigint, mask: TimeMask, workerId: Principal): Promise<void>;
|
|
10
|
+
removeDailyScheduleAsyncUnsafe(date: bigint, workerId: Principal): Promise<void>;
|
|
11
|
+
getDailyScheduleAsyncUnsafe(date: bigint, workerId: Principal): Promise<TimeMask>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=availability-actor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"availability-actor.d.ts","sourceRoot":"","sources":["../src/availability-actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAA6C,QAAQ,EAAe,MAAM,gEAAgE,CAAC;AACvJ,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,qBAAa,iBAAkB,SAAQ,SAAS;gBAEhC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAItC,4BAA4B,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAW9G,mCAAmC,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAYzG,2BAA2B,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAU7F,8BAA8B,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAShF,2BAA2B,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC;CAQjG"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {} from "@icp-sdk/core/agent";
|
|
2
|
+
import { ActorBase } from "./actor-base.js";
|
|
3
|
+
export class AvailabilityActor extends ActorBase {
|
|
4
|
+
constructor(canisterId, identity) {
|
|
5
|
+
super(canisterId, identity);
|
|
6
|
+
}
|
|
7
|
+
async setWeeklyTemplateAsyncUnsafe(day, mask, salonId, workerId) {
|
|
8
|
+
await this.executeFunctionAsyncUnsafe(() => this.actor.setWeeklyTemplate({
|
|
9
|
+
day,
|
|
10
|
+
mask,
|
|
11
|
+
salonId,
|
|
12
|
+
workerId
|
|
13
|
+
}));
|
|
14
|
+
}
|
|
15
|
+
async getDayFromWeeklyTemplateAsyncUnsafe(day, salonId, workerId) {
|
|
16
|
+
const result = await this.executeFunctionAsyncUnsafe(() => this.actor.getDayFromWeeklyTemplate({
|
|
17
|
+
day,
|
|
18
|
+
salonId,
|
|
19
|
+
workerId
|
|
20
|
+
}));
|
|
21
|
+
return Array.from(result);
|
|
22
|
+
}
|
|
23
|
+
async setDailyScheduleAsyncUnsafe(date, mask, workerId) {
|
|
24
|
+
await this.executeFunctionAsyncUnsafe(() => this.actor.setDailySchedule({
|
|
25
|
+
date,
|
|
26
|
+
mask,
|
|
27
|
+
workerId
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
async removeDailyScheduleAsyncUnsafe(date, workerId) {
|
|
31
|
+
await this.executeFunctionAsyncUnsafe(() => this.actor.removeDailySchedule({
|
|
32
|
+
date,
|
|
33
|
+
workerId
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
async getDailyScheduleAsyncUnsafe(date, workerId) {
|
|
37
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.getDailySchedule({
|
|
38
|
+
date,
|
|
39
|
+
workerId
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Identity } from "@icp-sdk/core/agent";
|
|
2
|
+
import type { UserProfile } from "../declarations/sultana-core-motoko/sultana-core-motoko.did.js";
|
|
3
|
+
import type { Principal } from "@icp-sdk/core/principal";
|
|
4
|
+
import { ActorBase } from "./actor-base.js";
|
|
5
|
+
export declare class HrActor extends ActorBase {
|
|
6
|
+
constructor(canisterId: string, identity?: Identity);
|
|
7
|
+
requestToJoinSalonAsyncUnsafe(salonId: string): Promise<void>;
|
|
8
|
+
getCandidatesBySalonIdAsyncUnsafe(salonId: string): Promise<UserProfile[]>;
|
|
9
|
+
acceptWorkerAsyncUnsafe(salonId: string, workerId: Principal): Promise<void>;
|
|
10
|
+
rejectCandidateAsyncUnsafe(salonId: string, workerId: Principal): Promise<void>;
|
|
11
|
+
removeWorkerFromSalonAsyncUnsafe(salonId: string, workerId: Principal): Promise<void>;
|
|
12
|
+
getWorkersBySalonIdAsyncUnsafe(salonId: string): Promise<UserProfile[]>;
|
|
13
|
+
toggleWorkerCapabilityAsyncUnsafe(canPerform: boolean, salonId: string, salonServiceId: string, workerId: Principal): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=hr-actor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hr-actor.d.ts","sourceRoot":"","sources":["../src/hr-actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAuD,WAAW,EAAE,MAAM,gEAAgE,CAAC;AACvJ,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,qBAAa,OAAQ,SAAQ,SAAS;gBAEtB,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAItC,6BAA6B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ7D,iCAAiC,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAM1E,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAS5E,0BAA0B,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAS/E,gCAAgC,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAUrF,8BAA8B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAMvE,iCAAiC,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;CAUnJ"}
|
package/dist/hr-actor.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {} from "@icp-sdk/core/agent";
|
|
2
|
+
import { ActorBase } from "./actor-base.js";
|
|
3
|
+
export class HrActor extends ActorBase {
|
|
4
|
+
constructor(canisterId, identity) {
|
|
5
|
+
super(canisterId, identity);
|
|
6
|
+
}
|
|
7
|
+
async requestToJoinSalonAsyncUnsafe(salonId) {
|
|
8
|
+
await this.executeFunctionAsyncUnsafe(() => this.actor.requestToJoinSalon({
|
|
9
|
+
salonId
|
|
10
|
+
}));
|
|
11
|
+
}
|
|
12
|
+
async getCandidatesBySalonIdAsyncUnsafe(salonId) {
|
|
13
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.getCandidatesBySalonId(salonId));
|
|
14
|
+
}
|
|
15
|
+
async acceptWorkerAsyncUnsafe(salonId, workerId) {
|
|
16
|
+
await this.executeFunctionAsyncUnsafe(() => this.actor.acceptWorker({
|
|
17
|
+
salonId,
|
|
18
|
+
workerId
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
async rejectCandidateAsyncUnsafe(salonId, workerId) {
|
|
22
|
+
await this.executeFunctionAsyncUnsafe(() => this.actor.rejectCandidate({
|
|
23
|
+
salonId,
|
|
24
|
+
workerId
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
async removeWorkerFromSalonAsyncUnsafe(salonId, workerId) {
|
|
28
|
+
console.log('removeWorkerFromSalon');
|
|
29
|
+
await this.executeFunctionAsyncUnsafe(() => this.actor.removeWorkerFromSalon({
|
|
30
|
+
salonId,
|
|
31
|
+
workerId
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
async getWorkersBySalonIdAsyncUnsafe(salonId) {
|
|
35
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.getWorkersBySalonId(salonId));
|
|
36
|
+
}
|
|
37
|
+
async toggleWorkerCapabilityAsyncUnsafe(canPerform, salonId, salonServiceId, workerId) {
|
|
38
|
+
await this.executeFunctionAsyncUnsafe(() => this.actor.toggleWorkerCapability({
|
|
39
|
+
canPerform,
|
|
40
|
+
salonId,
|
|
41
|
+
salonServiceId,
|
|
42
|
+
workerId
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
}
|
package/dist/interfaces.d.ts
CHANGED
package/dist/interfaces.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,SAAS,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,SAAS,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6FAA6F;IAC7F,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
package/dist/mappers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../src/mappers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gEAAgE,CAAC;AAClG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,WAAW,GAAG,eAAe,
|
|
1
|
+
{"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../src/mappers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gEAAgE,CAAC;AAClG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,WAAW,GAAG,eAAe,CAQ3E"}
|
package/dist/mappers.js
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type Identity } from "@icp-sdk/core/agent";
|
|
2
|
+
import type { SalonService } from "../declarations/sultana-core-motoko/sultana-core-motoko.did.js";
|
|
3
|
+
import { ActorBase } from "./actor-base.js";
|
|
4
|
+
export declare class SalonServicesActor extends ActorBase {
|
|
5
|
+
constructor(canisterId: string, identity?: Identity);
|
|
6
|
+
/**
|
|
7
|
+
* Asynchronous method that unsafely (can throw error) adds a new service to a specific salon.
|
|
8
|
+
* @remarks
|
|
9
|
+
* This method directly wraps the underlying actor call without extra client-side pre-validation
|
|
10
|
+
* and will throw an error if the canister execution fails or if the caller is not authorized.
|
|
11
|
+
* @param active - Flag indicating whether the service is immediately active and visible in search results.
|
|
12
|
+
* @param duration - Service duration in minutes. Must be a multiple of 5.
|
|
13
|
+
* @param name - The display name of the service. Cannot be empty.
|
|
14
|
+
* @param price - The price of the service.
|
|
15
|
+
* @param salonId - The unique identifier of the parent salon.
|
|
16
|
+
* @param serviceTypeIds - An array of category/service type identifiers mapping to this service.
|
|
17
|
+
* @param workerIds - An array of worker principals assigned to perform this service.
|
|
18
|
+
* @returns A promise that resolves to the generated `SalonServiceId` as a string.
|
|
19
|
+
* @throws {Error} If the caller is anonymous, not the salon owner, or if data constraints are violated.
|
|
20
|
+
*/
|
|
21
|
+
addSalonServiceAsyncUnsafe(active: boolean, duration: bigint, name: string, price: bigint, salonId: string, serviceTypeIds: string[], workerIdsString: string[]): Promise<string>;
|
|
22
|
+
updateSalonServiceAsyncUnsafe(active: boolean, duration: bigint, name: string, price: bigint, salonServiceId: string, serviceTypeIds: string[], workerIdsString: string[]): Promise<void>;
|
|
23
|
+
removeSalonServiceAsyncUnsafe(salonService: string): Promise<void>;
|
|
24
|
+
getSalonServicesBySalonIdAsyncUnsafe(salonId: string): Promise<SalonService[]>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=salon-services-actor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"salon-services-actor.d.ts","sourceRoot":"","sources":["../src/salon-services-actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAA+B,YAAY,EAAyB,MAAM,gEAAgE,CAAC;AAEvJ,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,qBAAa,kBAAmB,SAAQ,SAAS;gBAEjC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAInD;;;;;;;;;;;;;;OAcG;IACU,0BAA0B,CACnC,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,EAAE,EACxB,eAAe,EAAE,MAAM,EAAE,GAC1B,OAAO,CAAC,MAAM,CAAC;IAgBL,6BAA6B,CACtC,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,cAAc,EAAE,MAAM,EACtB,cAAc,EAAE,MAAM,EAAE,EACxB,eAAe,EAAE,MAAM,EAAE,GAC1B,OAAO,CAAC,IAAI,CAAC;IAgBH,6BAA6B,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMlE,oCAAoC,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;CAK9F"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {} from "@icp-sdk/core/agent";
|
|
2
|
+
import { Principal } from "@icp-sdk/core/principal";
|
|
3
|
+
import { ActorBase } from "./actor-base.js";
|
|
4
|
+
export class SalonServicesActor extends ActorBase {
|
|
5
|
+
constructor(canisterId, identity) {
|
|
6
|
+
super(canisterId, identity);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Asynchronous method that unsafely (can throw error) adds a new service to a specific salon.
|
|
10
|
+
* @remarks
|
|
11
|
+
* This method directly wraps the underlying actor call without extra client-side pre-validation
|
|
12
|
+
* and will throw an error if the canister execution fails or if the caller is not authorized.
|
|
13
|
+
* @param active - Flag indicating whether the service is immediately active and visible in search results.
|
|
14
|
+
* @param duration - Service duration in minutes. Must be a multiple of 5.
|
|
15
|
+
* @param name - The display name of the service. Cannot be empty.
|
|
16
|
+
* @param price - The price of the service.
|
|
17
|
+
* @param salonId - The unique identifier of the parent salon.
|
|
18
|
+
* @param serviceTypeIds - An array of category/service type identifiers mapping to this service.
|
|
19
|
+
* @param workerIds - An array of worker principals assigned to perform this service.
|
|
20
|
+
* @returns A promise that resolves to the generated `SalonServiceId` as a string.
|
|
21
|
+
* @throws {Error} If the caller is anonymous, not the salon owner, or if data constraints are violated.
|
|
22
|
+
*/
|
|
23
|
+
async addSalonServiceAsyncUnsafe(active, duration, name, price, salonId, serviceTypeIds, workerIdsString) {
|
|
24
|
+
const workerIds = workerIdsString.map(id => Principal.fromText(id));
|
|
25
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.addSalonService({
|
|
26
|
+
active,
|
|
27
|
+
duration,
|
|
28
|
+
name,
|
|
29
|
+
price,
|
|
30
|
+
salonId,
|
|
31
|
+
serviceTypeIds,
|
|
32
|
+
workerIds
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
async updateSalonServiceAsyncUnsafe(active, duration, name, price, salonServiceId, serviceTypeIds, workerIdsString) {
|
|
36
|
+
const workerIds = workerIdsString.map(id => Principal.fromText(id));
|
|
37
|
+
await this.executeFunctionAsyncUnsafe(() => this.actor.updateSalonService({
|
|
38
|
+
active,
|
|
39
|
+
duration,
|
|
40
|
+
name,
|
|
41
|
+
price,
|
|
42
|
+
salonServiceId,
|
|
43
|
+
serviceTypeIds,
|
|
44
|
+
workerIds
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
async removeSalonServiceAsyncUnsafe(salonService) {
|
|
48
|
+
await this.executeFunctionAsyncUnsafe(() => this.actor.removeSalonServiceBySalonServiceId(salonService));
|
|
49
|
+
}
|
|
50
|
+
async getSalonServicesBySalonIdAsyncUnsafe(salonId) {
|
|
51
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.getSalonServicesBySalonId(salonId));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Identity } from "@icp-sdk/core/agent";
|
|
2
|
+
import type { Coordinate, Salon } from "../declarations/sultana-core-motoko/sultana-core-motoko.did.js";
|
|
3
|
+
import { ActorBase } from "./actor-base.js";
|
|
4
|
+
export declare class SalonsActor extends ActorBase {
|
|
5
|
+
constructor(canisterId: string, identity?: Identity);
|
|
6
|
+
createSalonAsyncUnsafe(address: string, geohash6: string, location: Coordinate, name: string): Promise<string>;
|
|
7
|
+
getMySalonsAsyncUnsafe(): Promise<Salon[]>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=salons-actor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"salons-actor.d.ts","sourceRoot":"","sources":["../src/salons-actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAY,UAAU,EAAE,KAAK,EAAuC,MAAM,gEAAgE,CAAC;AAEvJ,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,qBAAa,WAAY,SAAQ,SAAS;gBAE1B,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAItC,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAW9G,sBAAsB,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;CAK1D"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {} from "@icp-sdk/core/agent";
|
|
2
|
+
import { ActorBase } from "./actor-base.js";
|
|
3
|
+
export class SalonsActor extends ActorBase {
|
|
4
|
+
constructor(canisterId, identity) {
|
|
5
|
+
super(canisterId, identity);
|
|
6
|
+
}
|
|
7
|
+
async createSalonAsyncUnsafe(address, geohash6, location, name) {
|
|
8
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.createSalon({
|
|
9
|
+
address,
|
|
10
|
+
geohash6,
|
|
11
|
+
location,
|
|
12
|
+
name
|
|
13
|
+
}));
|
|
14
|
+
}
|
|
15
|
+
async getMySalonsAsyncUnsafe() {
|
|
16
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.getMySalons());
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Identity } from "@icp-sdk/core/agent";
|
|
2
|
+
import { ActorBase } from "./actor-base.js";
|
|
3
|
+
export declare class ServiceTypesActor extends ActorBase {
|
|
4
|
+
constructor(canisterId: string, identity?: Identity);
|
|
5
|
+
addServiceTypeAsyncUnsafe(serviceType: string): Promise<void>;
|
|
6
|
+
removeServiceTypeAsyncUnsafe(serviceType: string): Promise<void>;
|
|
7
|
+
getServiceTypesAsyncUnsafe(): Promise<string[]>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=service-types-actor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-types-actor.d.ts","sourceRoot":"","sources":["../src/service-types-actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,qBAAa,iBAAkB,SAAQ,SAAS;gBAEhC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAItC,yBAAyB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM7D,4BAA4B,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMhE,0BAA0B,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAK/D"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {} from "@icp-sdk/core/agent";
|
|
2
|
+
import { ActorBase } from "./actor-base.js";
|
|
3
|
+
export class ServiceTypesActor extends ActorBase {
|
|
4
|
+
constructor(canisterId, identity) {
|
|
5
|
+
super(canisterId, identity);
|
|
6
|
+
}
|
|
7
|
+
async addServiceTypeAsyncUnsafe(serviceType) {
|
|
8
|
+
await this.executeFunctionAsyncUnsafe(() => this.actor.addServiceType(serviceType));
|
|
9
|
+
}
|
|
10
|
+
async removeServiceTypeAsyncUnsafe(serviceType) {
|
|
11
|
+
await this.executeFunctionAsyncUnsafe(() => this.actor.removeServiceType(serviceType));
|
|
12
|
+
}
|
|
13
|
+
async getServiceTypesAsyncUnsafe() {
|
|
14
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.getServiceTypes());
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type Identity } from "@icp-sdk/core/agent";
|
|
2
|
+
import type { Coordinate, Salon, SalonService, TimeMask, UserProfile } from "../declarations/sultana-core-motoko/sultana-core-motoko.did.js";
|
|
3
|
+
import type { Principal } from "@icp-sdk/core/principal";
|
|
4
|
+
import { ActorBase } from "./actor-base.js";
|
|
5
|
+
export declare class SultanaCoreMotokoActor extends ActorBase {
|
|
6
|
+
constructor(canisterId: string, identity?: Identity);
|
|
7
|
+
/**
|
|
8
|
+
* Sets the current identity as the system administrator.
|
|
9
|
+
*
|
|
10
|
+
* This method calls the canister actor with an empty argument list,
|
|
11
|
+
* which the canister interprets as setting the caller as the system admin.
|
|
12
|
+
*
|
|
13
|
+
* @returns A Promise that resolves to the updated system administrator Principal.
|
|
14
|
+
* @throws Error with message `CriticalErrorCanister` when there is no communication with the canister
|
|
15
|
+
* or when the canister code crashes during execution.
|
|
16
|
+
* @throws Error when the canister returns a business error such as validation failure.
|
|
17
|
+
*/
|
|
18
|
+
setMyselfAsSysAdminAsyncUnsafe(): Promise<Principal>;
|
|
19
|
+
/**
|
|
20
|
+
* Sets a new system administrator Principal on the canister.
|
|
21
|
+
*
|
|
22
|
+
* @param newSysAdmin The Principal to assign as the new system administrator.
|
|
23
|
+
* @returns A Promise that resolves to the updated system administrator Principal.
|
|
24
|
+
* @throws Error with message `CriticalErrorCanister` when there is no communication with the canister
|
|
25
|
+
* or when the canister code crashes during execution.
|
|
26
|
+
* @throws Error when the canister returns a business error such as validation failure.
|
|
27
|
+
*/
|
|
28
|
+
setSysAdminAsyncUnsafe(newSysAdmin: Principal): Promise<Principal>;
|
|
29
|
+
/**
|
|
30
|
+
* Retrieves the current system administrator Principal from the canister.
|
|
31
|
+
*
|
|
32
|
+
* @returns A Promise that resolves to the current system administrator Principal.
|
|
33
|
+
* @throws Error with message `CriticalErrorCanister` when there is no communication with the canister
|
|
34
|
+
* or when the canister code crashes during execution.
|
|
35
|
+
* @throws Error when the canister returns a business error such as validation failure.
|
|
36
|
+
*/
|
|
37
|
+
getSysAdminAsyncUnsafe(): Promise<Principal>;
|
|
38
|
+
setWeeklyTemplateAsyncUnsafe(day: bigint, mask: TimeMask, salonId: string, workerId: Principal): Promise<void>;
|
|
39
|
+
addServiceTypeAsyncUnsafe(serviceType: string): Promise<void>;
|
|
40
|
+
acceptWorkerAsyncUnsafe(salonId: string, workerId: Principal): Promise<void>;
|
|
41
|
+
addSalonServiceAsyncUnsafe(active: boolean, duration: bigint, name: string, price: bigint, salonId: string, serviceTypeIds: string[], workerIds: Principal[]): Promise<string>;
|
|
42
|
+
bookAppointmentAsyncUnsafe(dateMidnight: bigint, dayOfWeek: bigint, notes: string, salonId: string, salonServiceId: string, startTime: bigint, workerId: Principal): Promise<string>;
|
|
43
|
+
createSalonAsyncUnsafe(address: string, geohash6: string, location: Coordinate, name: string): Promise<string>;
|
|
44
|
+
getAllProfilesAsyncUnsafe(): Promise<UserProfile[]>;
|
|
45
|
+
getDailyScheduleAsyncUnsafe(date: bigint, workerId: Principal): Promise<TimeMask>;
|
|
46
|
+
getDayFromWeeklyTemplateAsyncUnsafe(day: bigint, salonId: string, workerId: Principal): Promise<bigint[]>;
|
|
47
|
+
getMyProfileAsyncUnsafe(): Promise<UserProfile>;
|
|
48
|
+
getMySalonsAsyncUnsafe(): Promise<Salon[]>;
|
|
49
|
+
getCandidatesBySalonIdAsyncUnsafe(salonId: string): Promise<UserProfile[]>;
|
|
50
|
+
getSalonServicesBySalonIdAsyncUnsafe(salonId: string): Promise<SalonService[]>;
|
|
51
|
+
getServiceTypesAsyncUnsafe(): Promise<string[]>;
|
|
52
|
+
getSystemAdminAsyncUnsafe(): Promise<Principal>;
|
|
53
|
+
getWorkersBySalonIdAsyncUnsafe(salonId: string): Promise<UserProfile[]>;
|
|
54
|
+
rejectCandidateAsyncUnsafe(salonId: string, workerId: Principal): Promise<void>;
|
|
55
|
+
removeDailyScheduleAsyncUnsafe(date: bigint, workerId: Principal): Promise<void>;
|
|
56
|
+
removeSalonServiceAsyncUnsafe(salonService: string): Promise<void>;
|
|
57
|
+
removeServiceTypeAsyncUnsafe(serviceType: string): Promise<void>;
|
|
58
|
+
removeWorkerFromSalonAsyncUnsafe(salonId: string, workerId: Principal): Promise<void>;
|
|
59
|
+
requestToJoinSalonAsyncUnsafe(salonId: string): Promise<void>;
|
|
60
|
+
setDailyScheduleAsyncUnsafe(date: bigint, mask: TimeMask, workerId: Principal): Promise<void>;
|
|
61
|
+
toggleWorkerCapabilityAsyncUnsafe(canPerform: boolean, salonId: string, salonServiceId: string, workerId: Principal): Promise<void>;
|
|
62
|
+
updateMyProfileAsyncUnsafe(avatarUrl: string, name: string): Promise<UserProfile>;
|
|
63
|
+
updateSalonServiceAsyncUnsafe(active: boolean, duration: bigint, name: string, price: bigint, salonServiceId: string, serviceTypeIds: string[], workerIds: Principal[]): Promise<void>;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=sultana-core-motoko-actor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sultana-core-motoko-actor.d.ts","sourceRoot":"","sources":["../src/sultana-core-motoko-actor.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import {} from "@icp-sdk/core/agent";
|
|
2
|
+
import { ActorBase } from "./actor-base.js";
|
|
3
|
+
export class SultanaCoreMotokoActor extends ActorBase {
|
|
4
|
+
constructor(canisterId, identity) {
|
|
5
|
+
super(canisterId, identity);
|
|
6
|
+
}
|
|
7
|
+
// --- Public Actor Methods ---
|
|
8
|
+
/**
|
|
9
|
+
* Sets the current identity as the system administrator.
|
|
10
|
+
*
|
|
11
|
+
* This method calls the canister actor with an empty argument list,
|
|
12
|
+
* which the canister interprets as setting the caller as the system admin.
|
|
13
|
+
*
|
|
14
|
+
* @returns A Promise that resolves to the updated system administrator Principal.
|
|
15
|
+
* @throws Error with message `CriticalErrorCanister` when there is no communication with the canister
|
|
16
|
+
* or when the canister code crashes during execution.
|
|
17
|
+
* @throws Error when the canister returns a business error such as validation failure.
|
|
18
|
+
*/
|
|
19
|
+
async setMyselfAsSysAdminAsyncUnsafe() {
|
|
20
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.setSystemAdmin([]));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Sets a new system administrator Principal on the canister.
|
|
24
|
+
*
|
|
25
|
+
* @param newSysAdmin The Principal to assign as the new system administrator.
|
|
26
|
+
* @returns A Promise that resolves to the updated system administrator Principal.
|
|
27
|
+
* @throws Error with message `CriticalErrorCanister` when there is no communication with the canister
|
|
28
|
+
* or when the canister code crashes during execution.
|
|
29
|
+
* @throws Error when the canister returns a business error such as validation failure.
|
|
30
|
+
*/
|
|
31
|
+
async setSysAdminAsyncUnsafe(newSysAdmin) {
|
|
32
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.setSystemAdmin([newSysAdmin]));
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Retrieves the current system administrator Principal from the canister.
|
|
36
|
+
*
|
|
37
|
+
* @returns A Promise that resolves to the current system administrator Principal.
|
|
38
|
+
* @throws Error with message `CriticalErrorCanister` when there is no communication with the canister
|
|
39
|
+
* or when the canister code crashes during execution.
|
|
40
|
+
* @throws Error when the canister returns a business error such as validation failure.
|
|
41
|
+
*/
|
|
42
|
+
async getSysAdminAsyncUnsafe() {
|
|
43
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.getSystemAdmin());
|
|
44
|
+
}
|
|
45
|
+
async setWeeklyTemplateAsyncUnsafe(day, mask, salonId, workerId) {
|
|
46
|
+
await this.executeFunctionAsyncUnsafe(() => this.actor.setWeeklyTemplate({
|
|
47
|
+
day,
|
|
48
|
+
mask,
|
|
49
|
+
salonId,
|
|
50
|
+
workerId
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
async addServiceTypeAsyncUnsafe(serviceType) {
|
|
54
|
+
await this.executeFunctionAsyncUnsafe(() => this.actor.addServiceType(serviceType));
|
|
55
|
+
}
|
|
56
|
+
async acceptWorkerAsyncUnsafe(salonId, workerId) {
|
|
57
|
+
await this.executeFunctionAsyncUnsafe(() => this.actor.acceptWorker({
|
|
58
|
+
salonId,
|
|
59
|
+
workerId
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
async addSalonServiceAsyncUnsafe(active, duration, name, price, salonId, serviceTypeIds, workerIds) {
|
|
63
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.addSalonService({
|
|
64
|
+
active,
|
|
65
|
+
duration,
|
|
66
|
+
name,
|
|
67
|
+
price,
|
|
68
|
+
salonId,
|
|
69
|
+
serviceTypeIds,
|
|
70
|
+
workerIds
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
async bookAppointmentAsyncUnsafe(dateMidnight, dayOfWeek, notes, salonId, salonServiceId, startTime, workerId) {
|
|
74
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.bookAppointment({
|
|
75
|
+
dateMidnight,
|
|
76
|
+
dayOfWeek,
|
|
77
|
+
notes,
|
|
78
|
+
salonId,
|
|
79
|
+
salonServiceId,
|
|
80
|
+
startTime,
|
|
81
|
+
workerId
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
async createSalonAsyncUnsafe(address, geohash6, location, name) {
|
|
85
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.createSalon({
|
|
86
|
+
address,
|
|
87
|
+
geohash6,
|
|
88
|
+
location,
|
|
89
|
+
name
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
92
|
+
async getAllProfilesAsyncUnsafe() {
|
|
93
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.getAllProfiles());
|
|
94
|
+
}
|
|
95
|
+
async getDailyScheduleAsyncUnsafe(date, workerId) {
|
|
96
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.getDailySchedule({
|
|
97
|
+
date,
|
|
98
|
+
workerId
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
101
|
+
async getDayFromWeeklyTemplateAsyncUnsafe(day, salonId, workerId) {
|
|
102
|
+
const result = await this.executeFunctionAsyncUnsafe(() => this.actor.getDayFromWeeklyTemplate({
|
|
103
|
+
day,
|
|
104
|
+
salonId,
|
|
105
|
+
workerId
|
|
106
|
+
}));
|
|
107
|
+
return Array.from(result);
|
|
108
|
+
}
|
|
109
|
+
async getMyProfileAsyncUnsafe() {
|
|
110
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.getMyProfile());
|
|
111
|
+
}
|
|
112
|
+
async getMySalonsAsyncUnsafe() {
|
|
113
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.getMySalons());
|
|
114
|
+
}
|
|
115
|
+
async getCandidatesBySalonIdAsyncUnsafe(salonId) {
|
|
116
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.getCandidatesBySalonId(salonId));
|
|
117
|
+
}
|
|
118
|
+
async getSalonServicesBySalonIdAsyncUnsafe(salonId) {
|
|
119
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.getSalonServicesBySalonId(salonId));
|
|
120
|
+
}
|
|
121
|
+
async getServiceTypesAsyncUnsafe() {
|
|
122
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.getServiceTypes());
|
|
123
|
+
}
|
|
124
|
+
async getSystemAdminAsyncUnsafe() {
|
|
125
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.getSystemAdmin());
|
|
126
|
+
}
|
|
127
|
+
async getWorkersBySalonIdAsyncUnsafe(salonId) {
|
|
128
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.getWorkersBySalonId(salonId));
|
|
129
|
+
}
|
|
130
|
+
async rejectCandidateAsyncUnsafe(salonId, workerId) {
|
|
131
|
+
await this.executeFunctionAsyncUnsafe(() => this.actor.rejectCandidate({
|
|
132
|
+
salonId,
|
|
133
|
+
workerId
|
|
134
|
+
}));
|
|
135
|
+
}
|
|
136
|
+
async removeDailyScheduleAsyncUnsafe(date, workerId) {
|
|
137
|
+
await this.executeFunctionAsyncUnsafe(() => this.actor.removeDailySchedule({
|
|
138
|
+
date,
|
|
139
|
+
workerId
|
|
140
|
+
}));
|
|
141
|
+
}
|
|
142
|
+
async removeSalonServiceAsyncUnsafe(salonService) {
|
|
143
|
+
await this.executeFunctionAsyncUnsafe(() => this.actor.removeSalonServiceBySalonServiceId(salonService));
|
|
144
|
+
}
|
|
145
|
+
async removeServiceTypeAsyncUnsafe(serviceType) {
|
|
146
|
+
await this.executeFunctionAsyncUnsafe(() => this.actor.removeServiceType(serviceType));
|
|
147
|
+
}
|
|
148
|
+
async removeWorkerFromSalonAsyncUnsafe(salonId, workerId) {
|
|
149
|
+
await this.executeFunctionAsyncUnsafe(() => this.actor.removeWorkerFromSalon({
|
|
150
|
+
salonId,
|
|
151
|
+
workerId
|
|
152
|
+
}));
|
|
153
|
+
}
|
|
154
|
+
async requestToJoinSalonAsyncUnsafe(salonId) {
|
|
155
|
+
await this.executeFunctionAsyncUnsafe(() => this.actor.requestToJoinSalon({
|
|
156
|
+
salonId
|
|
157
|
+
}));
|
|
158
|
+
}
|
|
159
|
+
async setDailyScheduleAsyncUnsafe(date, mask, workerId) {
|
|
160
|
+
await this.executeFunctionAsyncUnsafe(() => this.actor.setDailySchedule({
|
|
161
|
+
date,
|
|
162
|
+
mask,
|
|
163
|
+
workerId
|
|
164
|
+
}));
|
|
165
|
+
}
|
|
166
|
+
async toggleWorkerCapabilityAsyncUnsafe(canPerform, salonId, salonServiceId, workerId) {
|
|
167
|
+
await this.executeFunctionAsyncUnsafe(() => this.actor.toggleWorkerCapability({
|
|
168
|
+
canPerform,
|
|
169
|
+
salonId,
|
|
170
|
+
salonServiceId,
|
|
171
|
+
workerId
|
|
172
|
+
}));
|
|
173
|
+
}
|
|
174
|
+
async updateMyProfileAsyncUnsafe(avatarUrl, name) {
|
|
175
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.updateMyProfile({
|
|
176
|
+
avatarUrl: avatarUrl ? [avatarUrl] : [],
|
|
177
|
+
name
|
|
178
|
+
}));
|
|
179
|
+
}
|
|
180
|
+
async updateSalonServiceAsyncUnsafe(active, duration, name, price, salonServiceId, serviceTypeIds, workerIds) {
|
|
181
|
+
await this.executeFunctionAsyncUnsafe(() => this.actor.updateSalonService({
|
|
182
|
+
active,
|
|
183
|
+
duration,
|
|
184
|
+
name,
|
|
185
|
+
price,
|
|
186
|
+
salonServiceId,
|
|
187
|
+
serviceTypeIds,
|
|
188
|
+
workerIds
|
|
189
|
+
}));
|
|
190
|
+
}
|
|
191
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Identity } from "@icp-sdk/core/agent";
|
|
2
|
+
import { ActorBase } from "./actor-base.js";
|
|
3
|
+
import type { UserProfileView } from "./interfaces.js";
|
|
4
|
+
export declare class UserProfilesActor extends ActorBase {
|
|
5
|
+
constructor(canisterId: string, identity?: Identity);
|
|
6
|
+
getMyProfileAsyncUnsafe(): Promise<UserProfileView>;
|
|
7
|
+
updateMyProfileAsyncUnsafe(avatarUrl: string, whatsAppNumber: string, name: string): Promise<UserProfileView>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=user-profiles-actor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-profiles-actor.d.ts","sourceRoot":"","sources":["../src/user-profiles-actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,qBAAa,iBAAkB,SAAQ,SAAS;gBAEhC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAItC,uBAAuB,IAAI,OAAO,CAAC,eAAe,CAAC;IAanD,0BAA0B,CAAC,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;CAgB7H"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {} from "@icp-sdk/core/agent";
|
|
2
|
+
import { ActorBase } from "./actor-base.js";
|
|
3
|
+
export class UserProfilesActor extends ActorBase {
|
|
4
|
+
constructor(canisterId, identity) {
|
|
5
|
+
super(canisterId, identity);
|
|
6
|
+
}
|
|
7
|
+
async getMyProfileAsyncUnsafe() {
|
|
8
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.getMyProfile()).then(userFromBackend => {
|
|
9
|
+
return {
|
|
10
|
+
id: userFromBackend.id,
|
|
11
|
+
name: userFromBackend.name,
|
|
12
|
+
whatsAppNumber: userFromBackend.whatsAppNumber[0],
|
|
13
|
+
avatarUrl: userFromBackend.avatarUrl[0]
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
async updateMyProfileAsyncUnsafe(avatarUrl, whatsAppNumber, name) {
|
|
18
|
+
return this.executeFunctionAsyncUnsafe(() => this.actor.updateMyProfile({
|
|
19
|
+
avatarUrl: avatarUrl ? [avatarUrl] : [],
|
|
20
|
+
whatsAppNumber: whatsAppNumber ? [whatsAppNumber] : [],
|
|
21
|
+
name
|
|
22
|
+
})).then(userFromBackend => {
|
|
23
|
+
return {
|
|
24
|
+
id: userFromBackend.id,
|
|
25
|
+
name: userFromBackend.name,
|
|
26
|
+
whatsAppNumber: userFromBackend.whatsAppNumber[0],
|
|
27
|
+
avatarUrl: userFromBackend.avatarUrl[0]
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
package/package.json
CHANGED
|
@@ -1,61 +1,62 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
},
|
|
9
|
-
"repository": {
|
|
10
|
-
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/JSM-Sultana/sultana-core-motoko-package.git"
|
|
12
|
-
},
|
|
13
|
-
"license": "ISC",
|
|
14
|
-
"author": "",
|
|
15
|
-
"type": "module",
|
|
16
|
-
"main": "dist/index.js",
|
|
17
|
-
"types": "dist/index.d.ts",
|
|
18
|
-
"exports": {
|
|
19
|
-
".": {
|
|
20
|
-
"types": "./dist/index.d.ts",
|
|
21
|
-
"import": "./dist/index.js"
|
|
2
|
+
"name": "@jsm-mit/sultana-core-motoko-package",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "A TypeScript library for interacting with the Sultana Core Motoko actor on the Internet Computer (IC) platform.",
|
|
5
|
+
"homepage": "https://github.com/JSM-Sultana/sultana-core-motoko-package#readme",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/JSM-Sultana/sultana-core-motoko-package/issues"
|
|
22
8
|
},
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/JSM-Sultana/sultana-core-motoko-package.git"
|
|
12
|
+
},
|
|
13
|
+
"license": "ISC",
|
|
14
|
+
"author": "",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"main": "dist/index.js",
|
|
17
|
+
"types": "dist/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./declarations/*": "./declarations/*"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist/",
|
|
27
|
+
"declarations/"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsc && tsc -p tsconfig.tests.json",
|
|
31
|
+
"init-service-types": "npx tsx scripts/init-service-types.ts",
|
|
32
|
+
"clean": "rm -rf dist",
|
|
33
|
+
"sync-declarations": "bash scripts/sync-declarations.sh",
|
|
34
|
+
"sync-declarations-assets": "bash scripts/sync-declarations-assets.sh",
|
|
35
|
+
"redeploy": "cd ../sultana-core-motoko && npm run craft:deploy && cd ../sultana-core-motoko-package",
|
|
36
|
+
"prepare": "npm run build",
|
|
37
|
+
"publish-public": "npm run build && npm login && npm publish --access public",
|
|
38
|
+
"test-today": "npx tsx tests/guard-before-noon.ts && npm run redeploy && npx tsx tests/test-today.ts",
|
|
39
|
+
"test-migration-simple": "npm run redeploy && npx tsx tests/test-migration-simple.ts",
|
|
40
|
+
"test-tomorrow": "npm run redeploy && npx tsx tests/test-tomorrow.ts",
|
|
41
|
+
"test-access-restrictions": "npm run redeploy && npx tsx tests/test-access-restrictions.ts",
|
|
42
|
+
"test-assets": "npm run redeploy && npx tsx tests/test-assets.ts",
|
|
43
|
+
"test-promo": "npm run redeploy && npx tsx tests/test-promo.ts",
|
|
44
|
+
"test-lang": "npm run redeploy && npx tsx tests/test-lang.ts",
|
|
45
|
+
"test-big-payload": "npm run redeploy && npx tsx tests/test-big-payload.ts",
|
|
46
|
+
"test-quota-limit": "npm run redeploy && npx tsx tests/test-quota-limit.ts",
|
|
47
|
+
"test-stats": "npm run redeploy && npx tsx tests/test-stats.ts",
|
|
48
|
+
"test-activity-tracking": "npm run redeploy && npx tsx tests/test-activity-tracking.ts"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@icp-sdk/core": "^6.1.0",
|
|
52
|
+
"@jsm-mit/utils-package": "^0.5.0",
|
|
53
|
+
"ngeohash": "^0.6.3"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@types/ngeohash": "^0.6.8",
|
|
57
|
+
"@types/node": "^25.5.2",
|
|
58
|
+
"dotenv": "^16.3.1",
|
|
59
|
+
"tsx": "^4.18.0",
|
|
60
|
+
"typescript": "^5.9.3"
|
|
61
|
+
}
|
|
61
62
|
}
|